CoreIndex.vue 3.05 KB
<template>
  <div class="core-box">
    <box-title title="核心指标"></box-title>
    <div class="core-box-content">
      <StatisticsBox :list="coreIndexList"></StatisticsBox>
      <PullDownSelect class="down-select" :selectList="selectList" @selectVal="selectVal"></PullDownSelect>
    <inner-tab class="tab-box" :list="tabList" :width="18.3" :itemPadding="0.5" @changeTab="changeTab"></inner-tab>
    <BarChart ref="coreChartRef" domId="coreChart" :dataList.sync="dataList" :colorList="colorList" :barWidth="'50'" :tooltipFormatterObj="tooltips"></BarChart>
    </div>
  </div>
</template>

<script>
import PullDownSelect from './PullDownSelect.vue'
import BarChart from './BarChart.vue'
export default {
  name: 'CoreIndex',
  components: {
    PullDownSelect,
    BarChart
  },
  data() {
    return {
      tabList: ['SaaS+门店总数', '有成交门店数', '活跃门店数'],
      coreIndexList: [
        {
          name: '门店总数',
          valueName: 'count',
          value: '0',
          unit: '¥',
          unitType: 'left',
          bottomType: 'ratio',
          ratioLeftLabel: '周同比',
          ratioLeftValueName: 'outputvalueTb',
          ratioLeftValue: '0',
          ratioRightLabel: '日环比',
          ratioRightValueName: 'outputvalueHb',
          ratioRightValue: '0'
        },
        {
          name: '留存门店总数',
          valueName: 'countvalue',
          value: '0',
          unit: '¥',
          unitType: 'left',
          bottomType: 'ratio',
          ratioLeftLabel: '周同比',
          ratioLeftValueName: 'outputvalueTb',
          ratioLeftValue: '0',
          ratioRightLabel: '日环比',
          ratioRightValueName: 'outputvalueHb',
          ratioRightValue: '0'
        }
      ],
      selectList: [
        {
          name: '门店活跃统计',
          val: 'num'
        },
        {
          name: 'Saas门店留存率',
          val: 'merNum'
        }
      ],
      selectType: '',
      dataList: [
        {
          statMonth: '2021',
          actiNum: 400
        },
        {
          statMonth: '2022',
          actiNum: 400
        },
        {
          statMonth: '2023',
          actiNum: 400
        }
      ],
      colorList: ['#22D8FF', '#223FA9', '#061422'],
      tooltips: {
        label: '场次',
        attrName: 'actiNum'
      }
    }
  },

  mounted() {
    this.$refs.coreChartRef.drawBar()
  },

  methods: {
    selectVal(val) {
      this.selectType = val
    },
    // tab切换
    changeTab(val) {
      // switch (val) {
      //   case 0:
      //     this.paymentData = this.dataList.totalData
      //     break
      //   case 1:
      //     this.paymentData = this.dataList.inProgress
      //     break
      //   case 2:
      //     this.paymentData = this.dataList.completed
      //     break
      // }
    }
  }
}
</script>

<style lang="scss" scoped>
.core-box {
  width: 23.33vw;
  height: 40vh;
  box-shadow: inset 0 0 20px 0 #3d57ff69;
  &-content {
    padding: 1.56vh 0.83vw;
    .down-select,
    .tab-box {
      margin-top: 1.78vh;
    }
  }
}
</style>