<template>
  <div class="Statistics">
    <div class="middle">
      <div class="girdPeople">网格内人员情况</div>

      <div class="card">
        <div class="box">
          <span class="count" v-if="peopleList && peopleList['网格长']">{{ peopleList['网格长'] }}</span>
          <span class="count" v-else>0</span>
          <span class="girdCount">网格长</span>
        </div>

        <div class="box">
          <span class="count" v-if="peopleList && peopleList['网格员']">{{ peopleList['网格员'] }}</span>
          <span class="count" v-else>0</span>
          <span class="girdCount">网格员</span>
        </div>

        <div class="box">
          <span class="count" v-if="peopleList && peopleList['责任家庭数']">{{ peopleList['责任家庭数'] }}</span>
          <span class="count" v-else>0</span>
          <span class="girdCount">责任家庭数</span>
        </div>
      </div>
    </div>

    <div class="bottom">
      <div class="girdMsg">网格信息</div>

      <div class="girdCont">
        <div class="boxes">
          <span class="boxesLeft">网格名称</span>
          <span class="boxesRight">{{ gridInfo.girdName || '' }}</span>
        </div>

        <div class="boxes">
          <span class="boxesLeft">标绘状态</span>

          <span class="boxesRight">{{ gridInfo.plottingStatus == 1 ? '已标绘' : '未标绘' }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Statistics',
  components: {},
  props: {
    dict: Object,
    instance: Function,
    params: Object,
  },
  data() {
    return {
      peopleList: {},
      gridInfo: {},
      checkType: '',
    }
  },
  created() {
    this.gridInfo = this.params
    this.getList()
    uni.$on('goback', (res) => {
      this.gridInfo = res
      this.getList()
    })
  },
  methods: {
    getList() {
      this.$http.post(`/app/appgirdmemberinfo/girdMemberAndResidentStatistic?girdId=${this.gridInfo.id}`).then((res) => {
        if (res?.data) {
          this.peopleList = res.data
        }
      })
    },
    linkTo(url) {
      uni.navigateTo({url})
    },
  },
}
</script>

<style scoped lang="scss">
.Statistics {
  padding: 0 30px;
  box-sizing: border-box;

  .middle {
    background: #ffffff;
    border-radius: 16px;
    margin-top: 32px;
    padding: 32px 0 60px 0;

    .girdPeople {
      padding: 0 0 56px 24px;
      font-size: 32px;
      font-family: PingFangSC-Regular, PingFang SC;
      color: #333333;
    }

    .card {
      display: flex;
      justify-content: space-around;

      .box {
        display: flex;
        flex-direction: column;
        align-items: center;

        .count {
          font-size: 64px;
          font-family: DINAlternate-Bold, DINAlternate;
          font-weight: bold;
          color: #3b424a;
        }

        .girdCount {
          margin-top: 8px;
          font-size: 28px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #999999;
        }
      }
    }
  }

  .bottom {
    background: #ffffff;
    border-radius: 16px;
    margin-top: 32px;
    padding: 0 24px 64px 24px;

    .girdMsg {
      padding: 32px 0;
      font-size: 32px;
      font-family: PingFangSC-Regular, PingFang SC;
      color: #333333;
    }

    .girdCont {
      .boxes {
        padding: 24px 0 30px 0;
        box-shadow: inset 0px -1px 0px 0px #d8dde6;

        .boxesLeft {
          font-size: 30px;
          font-family: PingFang-SC-Heavy, PingFang-SC;
          font-weight: 800;
          color: #333333;
          display: inline-block;
          width: 140px;
          vertical-align: top;
        }

        .boxesRight {
          margin-left: 40px;
          font-size: 28px;
          font-family: PingFangSC-Regular, PingFang SC;
          color: #666666;
          display: inline-block;
          width: calc(100% - 200px);
        }
      }
    }
  }
}
</style>
