EquityTop.vue 2.49 KB
<template>
  <div>
    <div class="pie-box">
    <TotalBill :totalBillData="numProportion" :totalNum="totalNum"></TotalBill>
    <TotalMerchant :totalMerchantData="merProportion" :totalMerchant="totalMerchant"></TotalMerchant>
  </div>
  <div class="pie-box">
    <ActiveMerchant :activeMerchantData="activeMerchantData" :totalActiveMerchant="totalActiveMerchant"></ActiveMerchant>
    <InactiveMerchant :inactiveMerchantData="inactiveMerchantData" :totalInactiveMerchant="totalInactiveMerchant"></InactiveMerchant>
  </div>
  </div>
</template>

<script>
import TotalBill from './components/TotalBill.vue'
import TotalMerchant from './components/TotalMerchant.vue'
import ActiveMerchant from './components/ActiveMerchant.vue'
import InactiveMerchant from './components/InactiveMerchant.vue'
export default {
  name: 'EquityTop',
  components: {
    TotalBill,
    TotalMerchant,
    ActiveMerchant,
    InactiveMerchant
  },
  data() {
    return {
      totalNum: 0,
      totalMerchant: 0,
      totalActiveMerchant: 0,
      totalInactiveMerchant: 0,
      merProportion: [],
      numProportion: [],
      activeMerchantData: [],
      inactiveMerchantData: [],
      month: ''
    }
  },

  created() {
    this.$bus.$on('selectMonthChange', val => {
      if (val === '全部') val = ''
      this.month = val
      this.getWholesaleNum()
      this.getWholesaleOpenCloseNum()
    })
    this.getWholesaleNum()
    this.getWholesaleOpenCloseNum()
  },

  mounted() {},

  methods: {
    async getWholesaleNum() {
      const params = {
        statMonth: this.month
      }
      const _result = await this.api.equity.getWholesaleNum(params)
      const { merProportion, numProportion, totalNum, totalMerchant } = _result.data.dataList[0]
      this.merProportion = merProportion
      this.numProportion = numProportion
      this.totalNum = totalNum
      this.totalMerchant = totalMerchant
    },
    async getWholesaleOpenCloseNum() {
      const params = {
        statMonth: this.month
      }
      const _result = await this.api.equity.getWholesaleOpenCloseNum(params)
      const { closeProportion, openProportion, closeNum, openNum } = _result.data.dataList[0]
      console.log(openNum, closeNum);
      this.activeMerchantData = openProportion
      this.inactiveMerchantData = closeProportion
      this.totalActiveMerchant = openNum
      this.totalInactiveMerchant = closeNum
    }
  }
}
</script>

<style lang="scss" scoped>
.pie-box {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.78vh;
}
</style>