<template>
  <div class="AppSpecialGroups">
    <div class="title">特殊人群总计 : {{ total }}人</div>
    <div class="item" @click="toList(item.label)" v-for="(item, index) in statisticsList" :key="index">
      <div class="left">
        <img src="./img/user-icon-mini.png" alt="">
        <span>{{ item.label }}</span>
      </div>
      <div class="right">
        {{ item.value }}<img src="./img/down-icon-666.png" alt="">
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "AppSpecialGroups",
  appName: "特殊人群",
  data() {
    return {
      statisticsList: [],
      total: 0
    }
  },
  methods: {
    getStatistic() {
      this.statisticsList = []
      this.total = 0
      this.$http.post(`/app/appspecialadjustment/statistic?type=0&range=0`).then((res) => {
        if (res?.data) {
          for (let i in res.data.map) {
            var obj = {
              label: i,
              value: res.data.map[i],
            }
            this.total = this.total + res.data.map[i]
            this.statisticsList.push(obj)
          }
        }
      })
    },
    toList(label) {
      uni.navigateTo({ url: `./List?label=${label}`})
    }
  },
  created() {
    this.getStatistic()
  },
  onShow() {
    document.title = "特殊人群"
  },
}
</script>

<style lang="scss" scoped>
.AppSpecialGroups {
  .title {
    font-size: 28px;
    font-family: PingFangSC-Regular, PingFang SC;
    color: #666666;
    line-height: 28px;
    padding: 40px 0 20px 30px;
  }
  .item {
    display: flex;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    margin: 0 30px 30px 30px;
    width: calc(100% - 60px);
    box-sizing: border-box;
    .left {
      font-size: 28px;
      font-family: PingFangSC-Regular, PingFang SC;
      color: #666;
      line-height: 48px;
      width: calc(100% - 200px);
      img {
        width: 44px;
        height: 44px;
        margin-right: 16px;
        vertical-align: middle;
      }
      span {
        display: inline-block;
        width: calc(100% - 60px);
        word-break: break-all;
        vertical-align: text-top;
      }
    }
    .right {
      font-size: 28px;
      font-family: PingFangSC-Regular, PingFang SC;
      color: #000;
      line-height: 48px;
      width: 200px;
      text-align: right;
      img {
        width: 32px;
        height: 32px;
        margin: -4px 0 0 16px;
        vertical-align: middle;
        transform: rotate(270deg);
      }
    }
  }
}
</style>
