<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">{{ girdMsgList.girdName || '' }}</span>
          <!-- <span class="boxesRight">{{ girdUser.appGirdInfo.girdName }}</span> -->
        </div>

        <div class="boxes">
          <span class="boxesLeft">网格类型</span>

          <span class="boxesRight">
            {{ $dict.getLabel('girdType', girdMsgList.girdType) || '' }}
          </span>
        </div>

        <div class="boxes">
          <span class="boxesLeft">网格层级</span>

          <span class="boxesRight">{{ $dict.getLabel('girdLevel', girdMsgList.girdLevel) || '' }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Statistics',
  components: {},
  props: {
    dict: Object,
    instance: Function,
    params: Object,
  },
  data() {
    return {
      girdUser: [],
      peopleList: {},
      girdMsgList: {},
      checkType: '',
    }
  },
  computed: {},
  watch: {},
  onLoad() {},
  created() {
    this.$dict.load('girdType', 'girdLevel').then(() => {
      this.isGirdUser()
      this.girdMsgList = this.params
      this.getList()
    })

    uni.$on('goback', (res) => {
      this.girdMsgList = res
      this.getList()
    })
  },
  methods: {
    isGirdUser() {
      this.$http.post('/app/appgirdmemberinfo/checkLogOnUser').then((res) => {
        if (res.code == 0) {
          this.girdUser = res.data
        }
      })
    },

    getList() {
      this.$http.post(`/app/appgirdmemberinfo/girdMemberAndResidentStatistic?girdId=${this.girdMsgList.id}`).then((res) => {
        if (res.code == 0) {
          this.peopleList = res.data
        }
      })
    },
    linkTo(url) {
      uni.navigateTo({ url })
    },
  },
}
</script>

<style scoped lang="scss">
uni-page-body {
  height: 100%;
}
.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;
        }
        .boxesRight {
          margin-left: 40px;
          font-size: 28px;
          font-family: PingFangSC-Regular, PingFang SC;
          color: #666666;
        }
      }
    }
  }
}
</style>
