IncreMerchants.vue 1.83 KB
<template>
  <div class="increMerchants-box">
    <box-title title="新增门店数分析"></box-title>
    <BarChart
      v-if="!isEmpty"
      ref="increMerchantsTrendChartRef"
      class="bar-chart"
      isMultiple
      domId="increMerchantsTrendChart"
      height="44.89vh"
      :dataList.sync="dataList"
      :colorList="colorList"
      :tooltipFormatterObj="tooltips.amountTooltip"
      :barWidth="30"
    ></BarChart>
    <div v-else class="empty">
      <Empty></Empty>
    </div>
  </div>
</template>

<script>
import { boutiqueMixin } from '@/mixins'
import BarChart from '../../crowdfunding/components/BarChart.vue'
export default {
  name: 'IncreMerchants',
  mixins: [boutiqueMixin],
  components: {
    BarChart
  },
  data() {
    return {
      isEmpty: false,
      dataList: [],
      tooltips: {
        amountTooltip: {
          label: '门店',
          attrName: 'incrMer'
        }
      },
      colorList: [
        ['#2AD191', '#00A89E', '#061422'],
        ['#22D8FF', '#223FA9', '#061422']
      ]
    }
  },

  mounted() {},

  methods: {
    init() {
      const { boutique } = this.$store.state.app
      const params = {
        year: boutique.year,
        channelName: boutique.channel.value
      }
      this.getIncreMerchantTrend(params)
    },
    async getIncreMerchantTrend(params) {
      const _result = await this.api.boutique.getIncreMerchantTrend(params)
      const _data = _result.data.dataList
      if (!_data.length) {
        this.isEmpty = true
        return
      }
      this.dataList = _data
      this.$nextTick(() => {
        this.$refs.increMerchantsTrendChartRef.drawBar()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.increMerchants-box {
//   width: 36.94vw;
//   height: 34vh;
//   box-shadow: inset 0 0 20px 0 #3d57ff69;
  .bar-chart {
    // padding-left: 1.39vw;
  }
}
</style>