<template>
  <div class="DetailPeople" v-if="pageShow">
    <div class="top">
      <image src="./components/img/4.png" />
      <div class="top-right">
        <div class="top-right__top">
          <div class="left">
            <h2>卓作旺</h2>
            <i>已注销</i>
          </div>
          <span>户主</span>
        </div>
        <div class="top-right__bottom">
          <span>退役军人</span>
          <span>退役军人</span>
          <span>退役军人</span>
          <span>退役军人</span>
          <span>退役军人</span>
          <span>退役军人</span>
          <span>退役军人</span>
        </div>
      </div>
    </div>
    <!-- <div class="top">
      <div class="photos">
        <img :src="data.resident.photo" alt="" v-if="data.resident && data.resident.photo" />
        <img src="./components/img/44.png" alt="" v-else />
      </div>

      <div class="right">
        <div class="rightTop">
          <span class="names">{{ data.resident && data.resident.name }}<span class="fileStatuss" v-if="data.resident.fileStatus == 1">已注销</span></span>
          <span class="householdNames" v-if="data.resident && data.resident.householdName == 1">户主</span>
          <span class="householdNames" v-else>
            {{ $dict.getLabel('householdRelation', data.resident && data.resident.householdRelation) }}
          </span>
        </div>

        <div class="rightBottom" v-if="data.resident && data.resident.phone">{{ data.resident.phone }}</div>
      </div>
    </div> -->
    <div class="line"></div>
    <div class="middle">
      <div class="hint">个人基本信息</div>
      <div class="contents">
        <div class="item">
          <span>籍贯</span>
          <i>{{ data.resident && data.resident.birthplaceAreaName }}</i>
        </div>
        <div class="item">
          <span>身份证号</span>
          <i>{{ data.resident && data.resident.idNumber.replace(/^(\w{6})\w{8}(.*)$/, '$1********$2') }}</i>
        </div>
        <div class="item">
          <span>民族</span>
          <i v-if="data.resident && data.resident.nation"> {{ $dict.getLabel('nation', data.resident.nation) }}</i>
        </div>
        <div class="item">
          <span>文化程度</span>
          <i v-if="data.resident && data.resident.education">{{ $dict.getLabel('education', data.resident.education) }}</i>
        </div>
        <div class="item">
          <span>婚姻状况</span>
          <i v-if="data.resident && data.resident.maritalStatus">{{ $dict.getLabel('maritalStatus', data.resident.maritalStatus) }}</i>
        </div>
        <div class="item">
          <span>政治面貌</span>
          <i v-if="data.resident && data.resident.politicsStatus">{{ $dict.getLabel('politicsStatus', data.resident.politicsStatus) }}</i>
        </div>
        <div class="item">
          <span>兵役状况</span>
          <i v-if="data.resident && data.resident.militaryStatus">{{ $dict.getLabel('militaryStatus', data.resident.militaryStatus) }}</i>
        </div>
        <div class="item">
          <span>宗教信仰</span>
          <i v-if="data.resident && data.resident.faithType">{{ $dict.getLabel('faithType', data.resident.faithType) }}</i>
        </div>
        <div class="item">
          <span>职业</span>
          <i v-if="data.resident && data.resident.job">{{ $dict.getLabel('job', data.resident.job) }}</i>
        </div>
      </div>
    </div>
    <div class="lines"></div>
    <div class="bottom">
      <div class="hint">联络信息</div>
      <div class="contents">
        <div class="item">
          <span>联系方式</span>
          <i class="phones" v-if="data.resident && data.resident.phone" @click="callPhone(data.resident.phone)">{{ data.resident.phone }}</i>
        </div>
        <div class="item">
          <span>现住址</span>
          <i v-if="data.resident && data.resident.currentAreaName">{{ data.resident.currentAreaName }}</i>
        </div>
        <div class="item">
          <span>现住详细地址</span>
          <i v-if="data.resident && data.resident.currentAddress">{{ data.resident.currentAddress }}</i>
        </div>
        <div class="item">
          <span>户籍地址</span>
          <i v-if="data.resident && data.resident.householdAreaName">{{ data.resident.householdAreaName }}</i>
        </div>
        <div class="item">
          <span>户籍详细地址</span>
          <i v-if="data.resident && data.resident.householdAddress">{{ data.resident.householdAddress }}</i>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'DetailPeople',

    appName: '家庭成员信息',

    data() {
      return {
        id: '',
        data: [],
        pageShow: false
      }
    },

    onLoad(o) {
      this.id = o.id
      this.$dict.load('householdRelation', 'nation', 'education', 'maritalStatus', 'politicsStatus', 'militaryStatus', 'faithType', 'job').then(() => {
        this.getDetail()
      })
    },

    methods: {
      getDetail() {
        this.$loading()
        this.$http.post(`/app/appresident/detail?id=${this.id}`).then((res) => {
          if (res.code == 0) {
            this.data = res.data
            this.pageShow = true
          }
        })
      },

      callPhone(phone) {
        uni.makePhoneCall({ phoneNumber: phone })
      }
    }
  }
</script>

<style scoped lang="scss">
.DetailPeople {
  height: 100%;
  background: #fff;
  .top {
    display: flex;
    align-items: center;
    padding: 48px 32px 32px;
    background: #fff;

    & > image {
      width: 112px;
      height: 112px;
      margin-right: 24px;
      border-radius: 50%;
    }

    .top-right {
      flex: 1;

      .top-right__bottom {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        color: #999999;
        font-size: 28px;

        span {
          line-height: 1.4;
          margin-right: 16px;
        }
      }

      .top-right__top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;

        & > span {
          color: #5AAD6A;
          font-size: 32px;
        }

        .left {
          display: flex;
          align-items: center;

          h2 {
            margin-right: 16px;
            color: #333;
            font-size: 36px;
            font-weight: 700;
          }

          i {
            width: 88px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            background: #FFECEF;
            border-radius: 8px;
            color: #FF4466;
            font-size: 24px;
            font-style: normal;
          }
        }
      }
    }
  }

  .line {
    height: 8px;
    background: #f5f5f5;
  }

  .middle,
  .bottom {
    padding: 0 32px;

    .hint {
      height: 108px;
      line-height: 108px;
      font-weight: 700;
      font-size: 32px;
      color: #333333;
    }

    .contents {
        .item {
          display: flex;
          line-height: 1.3;
          padding: 14px 0;
          font-size: 32px;

          .phones {
            color: #3d94fb;
          }

          span {
            width: 190px;
            flex-shrink: 1;
            color: #999;
          }

          i {
            flex: 1;
            margin-left: 16px;
            text-align: right;
            color: #333;
            font-style: normal;
          }
        }
    }
  }

  .lines {
    height: 4px;
    background: #f5f5f5;
  }
}
</style>
