<template>
  <div class="home_wrapper">
    <header-nav :currentNav="3" returnUrl="/sunVillage/index"></header-nav>
    <equityHeader :serialTag="2"></equityHeader>
    <div class="equity_main">
      <div class="date_main" @click="selectDateFun">
        <i class="icon"></i>
        <div class="year">2022<span class="unit">年</span></div>
      </div>
      <div class="header_mian">
        <div class="flex3">
          <div class="title">户人数</div>
          <div class="cont">4</div>
        </div>
        <div class="flex4">
          <div class="title">总股数</div>
          <div class="cont">4500</div>
        </div>
        <div class="flex4">
          <div class="title">总分红</div>
          <div class="cont">4500</div>
        </div>
      </div>
      <div class="households_main">
        <div class="flex_block">
          <div class="unit">户主</div>
          <div class="head">
            <img src="../../../assets/images/sunVillage/head_portrait.jpg" />
          </div>
          <div class="name">刘树人</div>
          <div class="numberShare" @click="skip('/sunVillage/shareBonus_num')">
            <div class="text">股数</div>
            <div class="code">2.00</div>
          </div>
          <div class="bonus" @click="skip('/sunVillage/shareBonus_amount')">
            <div class="text">总分红(元)</div>
            <div class="code">850.00</div>
          </div>
        </div>
      </div>
    </div>
    <van-popup v-model:show="dateVisbile" round position="bottom">
      <van-picker
        title="选择年"
        show-toolbar
        :columns="yearColumns"
        :default-index="yearSelect"
        @confirm="yearConfirm"
        @cancel="dateVisbile = false"
      />
    </van-popup>
  </div>
</template>

<style scoped lang="scss">
.home_wrapper {
  width: 100%;
  padding-top: 126px;
  min-height: 100vh;
  background: #fff;
  .equity_main {
    margin: 0 24px;
    padding: 15px 0;
    .date_main {
      width: 220px;
      height: 68px;
      border-bottom: 2px solid #ededed;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 28px;
      .icon {
        width: 26px;
        height: 26px;
        background: url("../../../assets/images/sunVillage/select_date_icon.jpg")
          no-repeat;
        background-size: 100% 100%;
        display: block;
        margin: 0 25px 0 12px;
      }
      .year {
        .unit {
          padding: 0 10px;
        }
      }
    }
    .header_mian {
      height: 80px;
      display: flex;
      margin-bottom: 15px;
      justify-content: center; /* 相对父元素水平居中 */
      align-items: center; /*  子元素相对父元素垂直居中 */
      .flex3 {
        flex: 3;
        display: flex;
      }
      .flex4 {
        flex: 4;
        display: flex;
      }
      .title {
        font-size: 30px;
        padding: 0 15px;
        color: #999;
      }
      .cont {
        font-size: 30px;
        color: #07c160;
        flex: 1;
        text-align: center;
      }
    }
    .households_main {
      .flex_block {
        height: 115px;
        position: relative;
        margin-bottom: 18px;
        margin-left: 60px;
        display: flex;
        border-bottom: 1px solid #e6e6e6;
        justify-content: center; /* 相对父元素水平居中 */
        align-items: center; /*  子元素相对父元素垂直居中 */
        .unit {
          width: 34px;
          display: flex;
          position: absolute;
          left: -40px;
          font-size: 28px;
          color: #07c160;
        }
        .head {
          width: 64px;
          height: 64px;
          margin-left: 10px;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .name {
          width: 150px;
          text-align: center;
          font-size: 30px;
        }

        .bonus,
        .numberShare {
          flex: 1;
          font-size: 28px;
          text-align: center;
          .text {
            color: #999;
            margin-bottom: 8px;
          }
        }
      }
    }
  }
}
</style>

<script>
import headerNav from "@/components/sunVillage/common/header.vue";
import equityHeader from "@/components/sunVillage/equity_header";
export default {
  name: "sunVillageEquity",
  components: { headerNav, equityHeader },
  data() {
    return {
      dateVisbile: false,
      yearColumns: [2000, 2001, 2002],
      yearSelect: null,
    };
  },
  mounted() {
    this.yearData();
  },
  methods: {
    skip(url) {
      this.$router.push(url);
    },
    selectDateFun() {
      this.dateVisbile = !this.dateVisbile;
    },
    yearData() {
      for (let i = 2000; i < 2060; i++) {
        this.yearColumns.push(i);
      }
      //显示当前年份

      var year = new Date().getFullYear();
      this.yearSelect = this.yearColumns.indexOf(Number(year));
    },
    yearConfirm(value) {
      //   this.formatDate = value + "年";
      //   this.form.reportDate = value.toString();
      //   this.yearShow = false;
      this.dateVisbile = false;
    },
  },
};
</script>
