<template>
  <div class="ExamineList">
    <AiTopFixed>
      <u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#CDDCF0" bar-width="48" active-color="#fff " @change="change"></u-tabs>
      <div class="middle">
        <div class="left">
          <AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName" style="color: #666">
            <u-icon name="map-fill" color="#3192F4" size="20px" style="vertical-align: text-bottom"></u-icon>
            <span style="margin-left: 4px" v-if="areaName">{{ areaName }}</span>
            <span v-else>请选择</span>
            <u-icon name="arrow-down" color="#666" size="28" style="margin-left: 4px" />
          </AiAreaPicker>
        </div>
        <u-search v-model="keyword" :clearabled="true" placeholder="请输入姓名" :show-action="false" bg-color="#F5F5F5" search-icon-color="#999" color="#999" height="58" @search="handerSearch" @clear="handerClear"></u-search>
      </div>
    </AiTopFixed>
    <div v-if="data.family && data.family.length > 0">
      <div class="card" v-for="(item, i) in data.family" :key="i" @click="toDetailPeople(item)">
        <div class="photos">
          <img :src="item.photo" alt="" v-if="item.photo" />
          <img src="./components/img/44.png" alt="" v-else />
        </div>
        <div class="right">
          <div class="rightTop">
            <div class="rightTop-lefts">
              <span class="names">{{ item.name }}</span>
              <span class="fileStatuss" v-if="item.fileStatus == 1"> {{ $dict.getLabel('fileStatus', item.fileStatus) }}</span>
              <span class="householdNames" v-if="item.householdName == 1">户主</span>
              <span class="householdNames" v-else>
                {{ $dict.getLabel('householdRelation', item.householdRelation) }}
              </span>
            </div>

            <div class="rightTop-rights">
              <u-section :show-line="false" sub-title="详情"></u-section>
            </div>
          </div>

          <div class="rightBottom">
            <span>身份证号：</span>
            <span>{{ item.idNumber.replace(/^(\w{6})\w{8}(.*)$/, '$1******$2') }}</span>
          </div>
        </div>
      </div>
    </div>

    <AiEmpty v-else></AiEmpty>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'ExamineList',
  components: {},
  props: {},
  data() {
    return {
      id: '',
      data: [],
      resident: {},
      areaId: '',
      areaName: '',
      tabList: [
        {
          name: '待处理',
        },
        {
          name: '已处理',
        },
      ],
      currentTabs: 0,
    }
  },
  computed: {
    ...mapState(['user']),
  },
  onShow() {
    document.title = '居民档案审核'
  },
  methods: {
    change(index) {
      this.data = []
      // this.keyword = ''
      this.currentTabs = index
      // this.current = 1
      // this.getList()
    },
    getDetail() {
      this.$http.post(`/app/appresident/detail?id=${this.id}`).then((res) => {
        if (res.code == 0) {
          this.data = res.data
          this.$forceUpdate()
          this.$nextTick(() => {
            this.resident = res.data.resident
            this.$forceUpdate()
          })
        }
      })
    },

    toDetailPeople(item) {
      uni.navigateTo({ url: `./DetailPeople?id=${item.id}` })
    },
  },
}
</script>

<style scoped lang="scss">
.ExamineList {
  height: 100%;
  .card {
    display: flex;
    box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 48px 32px;
    margin-bottom: 32px;
    .photos {
      img {
        width: 96px;
        height: 96px;
        border-radius: 50%;
      }
    }

    .right {
      display: flex;
      flex-direction: column;
      margin-left: 40px;
      width: 100%;
      .rightTop {
        display: flex;
        justify-content: space-between;
        .rightTop-lefts {
          .names {
            font-size: 32px;
            font-weight: 600;
          }
          .householdNames {
            margin-left: 30px;
            font-size: 26px;
            font-weight: 500;
            color: #5aad6a;
          }
          .fileStatuss {
            display: inline-block;
            margin-left: 30px;
            color: #ff4466;
            background: #ffecef;
            border-radius: 8px;
            width: 88px;
            height: 40px;
            line-height: 40px;
            text-align: center;
          }
        }
        .rightTop-rights {
          ::v-deep .u-section {
            .u-section__right-info {
              color: #3975c6 !important;
              .u-section__right-info__icon-arrow {
                .u-icon {
                  .u-icon__icon {
                    color: #3975c6 !important;
                  }
                }
              }
            }
          }
        }
      }
      .rightBottom {
        margin-top: 20px;
      }
    }
  }
  .card:nth-child(2n-1) {
    // background: royalblue;
    background: url(http://respub.sinoecare.net/20211222/装饰-20211222162743.png) no-repeat;
    background-size: 100% 100%;
  }
  .card:nth-child(2n) {
    // background: pink;
    background: url(http://respub.sinoecare.net/20211222/装饰2-20211222162934.png) no-repeat;
    background-size: 100% 100%;
  }
  .middle {
    display: flex;
    padding: 24px 32px;
    .left {
      width: 40%;
      display: flex;
      align-items: center;

      img {
        width: 48px;
        height: 48px;
      }
    }
    .u-search {
      margin-bottom: 0 !important;
    }
  }

  ::v-deep .content{
    padding: 0;
  }
  
}
</style>
