<template>
  <div class="event">
    <div class="tabs">
      <Tabs v-model="type" :list="typeList" @changeVal="typeChange"/>
    </div>
    <div class="content">
      <div class="total">
        <div class="tit">事件总数</div>
        <div class="num orange">{{sumNum?sumNum:0}}</div>
        <div class="desc"><span>较上月</span>-{{lastSumNum?lastSumNum:0}}</div>
      </div>
      <div class="processing">
        <div class="bg">
          <div class="bg-1">
          </div>
          <div class="num">
            {{processNum?processNum:0}}
          </div>
          <div class="name">处理中</div>
        </div>
      </div>
      <div class="total">
        <div class="tit">已办结</div>
        <div class="num blue">{{closedNum?closedNum:0}}</div>
        <div class="desc white"><span>办结率</span>{{closedRatio?closedRatio:0}}%</div>
      </div>
    </div>
  </div>
</template>

<script>
import Tabs from "@/views/dataBoard/satisfactionEval/components/Tabs/index.vue";

export default {
  name: "EventAndFollowUp",
  components: {Tabs},
  props: {
    date: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      org: this.$store.state.chooseArea.chooseName,
      typeList: [{
        label: '12345事件',
        value: '12345'
      }, {
        label: '事件回访',
        value: 'follow'
      }],
      type: '12345',
      sumNum: 0,
      lastSumNum: 0,
      processNum: 0,
      closedNum: 0,
    }
  },
  watch: {
    "$store.state.chooseArea.chooseName"(val) {
      if (val.orgId) {
        this.getData()
      }
    },
    date() {
      this.getData()
    }
  },
  mounted() {
    if (this.org.orgId) {
      this.getData()
    }
  },
  methods: {
    getData() {
      this.$http.get('/actual/base/streetOverview/eventAndFollowGroup?month=' + this.date + '&level=' + this.$store.state.chooseArea.chooseName.level + '&orgId=' + this.$store.state.chooseArea.chooseName.orgId + '&queryType=' + this.type).then(({data: {data}}) => {
        this.sumNum = data.sumNum
        this.lastSumNum = data.lastSumNum
        this.processNum = data.processNum
        this.closedNum = data.closedNum
        this.closedRatio = data.closedRatio
      })
    },
    typeChange(val) {
      console.log(val,'val')
      this.type = val
      this.getData()
    }
  }
}
</script>

<style scoped lang="scss">
.event {
  padding: 10px 16px;
}
.tabs {
  margin: 10px 0;
}

.content {
  background: linear-gradient(90deg, rgba(1, 94, 234, 0.1) 0%, rgba(16, 50, 103, 0) 50%, rgba(1, 94, 234, 0.1) 100%);
  padding: 20px 19px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total {
  .tit {
    font-size: 16px;
    font-weight: 400;
    color: #FFFFFF;
  }

  .num {
    height: 24px;
    font-size: 32px;
    font-weight: bold;
    font-style: italic;
    margin: 20px 0 15px;
  }

  .orange {
    color: #FF7845;
  }

  .blue {
    color: #76C0EF;
  }

  .desc {
    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    color: #00D6D9;

    span {
      font-style: normal;
      font-size: 14px;
      font-weight: 500;
      color: #A3B9DA;
    }
  }

  .white {
    color: #fff;
  }
}


.processing {
  .bg {
    background: url("@/assets/images/gailan/yuan_bg.png") no-repeat center;
    flex: 0 0 150px;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;

    .bg-1 {
      background: url("@/assets/images/gailan/zq_bg.png") no-repeat center;
      width: 146px;
      height: 136px;
      position: absolute;
      left: 9px;
      top: 9px;
    }

    .num {
      font-size: 32px;
      font-weight: bold;
      font-style: italic;
      color: #64C1FF;
    }

    .name {
      position: absolute;
      bottom: 10px;
      font-size: 16px;
      font-weight: 400;
      color: #FFFFFF;
    }

  }


}


</style>