CoreIndex.vue
3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<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="innerTabWidth" :itemPadding="0.5" @changeTab="changeTab"></inner-tab>
<BarChart ref="coreChartRef" :label="'statYear'" height="28vh" domId="coreChart" :colorList="colorList" :barWidth="'50'" :valueName="valueName"></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: [],
selectList: [
{
name: '门店活跃统计',
val: 'activeMerchant'
},
{
name: 'Saas门店留存率',
val: 'coreRetention'
}
],
activeMerchant: [],
coreRetention: [],
colorList: ['#22D8FF', '#223FA9', '#061422'],
valueName: 'saasMerchantNum',
selectActive: 0,
innerTabWidth: 18.3
}
},
created() {
// 门店活跃统计
this.getCoreActiveMerchant()
// SAAS门店留存率
this.getCoreRetention()
},
mounted() {
// this.$refs.coreChartRef.drawBar()
this.$bus.$on('innerGetAllOverview', data => {
this.coreIndexList = data.filter(item => item.tag === 'coreKeepMerchant')
})
},
methods: {
selectVal(val) {
console.log(val)
switch (val.val) {
case 'activeMerchant':
this.tabList = ['SaaS+门店总数', '有成交门店数', '活跃门店数']
this.selectActive = 0
this.innerTabWidth = 18.3
this.valueName = 'saasMerchantNum'
this.$refs.coreChartRef.drawBar(this.activeMerchant)
break
case 'coreRetention':
this.tabList = ['当年留存门店数', '上半年活跃门店数', '门店留存率']
this.selectActive = 1
this.innerTabWidth = 19.9
this.tooltips.attrName = 'retentionNum'
this.$refs.coreChartRef.drawBar(this.coreRetention)
break
}
},
// tab切换
changeTab(val) {
console.log(val)
let _dataList = []
switch (val) {
case 0:
this.valueName = this.selectActive === 0 ? 'saasMerchantNum' : 'retentionNum'
break
case 1:
this.valueName = this.selectActive === 0 ? 'clinchDealMerchantNum' : 'lastyearActive'
break
case 2:
this.valueName = this.selectActive === 0 ? 'activeMerchantNum' : 'retention'
break
}
_dataList = this.selectActive === 0 ? this.activeMerchant : this.coreRetention
this.$refs.coreChartRef.drawBar(_dataList)
},
async getCoreActiveMerchant() {
const _data = await this.api.internal.getCoreActiveMerchant()
const _dataList = _data.data.dataList
this.activeMerchant = _dataList
this.$refs.coreChartRef.drawBar(_dataList)
},
async getCoreRetention() {
const _data = await this.api.internal.getCoreRetention()
const _dataList = _data.data.dataList
this.coreRetention = _dataList
}
}
}
</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;
.tab-box {
margin-top: 1.78vh;
}
}
}
</style>