EquityRight.vue
3.17 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
126
127
128
129
130
131
132
133
134
135
136
<template>
<div>
<!-- 第一个盒子 -->
<div class="rank-box">
<box-title title="门店产值排名"></box-title>
<div class="rank-content" v-if="storeOutputList.length">
<Ranking :id="'storeOutput'" :rankingsList="storeOutputList" :rankingDataObj="rankingDataObj"></Ranking>
</div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
<!-- 第二个盒子 -->
<div class="rank-box">
<box-title title="门店转化率排行"></box-title>
<div class="rank-content" v-if="storePercentList.length">
<Ranking :id="'storePercent'" :rankingsList="storePercentList" :rankingDataObj="rankPercentObj"></Ranking>
</div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
<!-- 第三个盒子 -->
<div class="rank-box">
<box-title title="门店客单价排行"></box-title>
<div class="rank-content" v-if="storePriceList.length">
<Ranking :id="'storePrice'" :rankingsList="storePriceList" :rankingDataObj="rankingDataObj"></Ranking>
</div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'EquityRight',
data() {
return {
// 门店产值排名数据
storeOutputList: [],
// 门店转化率排名数据
storePercentList: [],
// 门店客单价排名数据
storePriceList: [],
// rankingDataObj
rankingDataObj: [
{
name: 'merchantname',
width: '17vw'
},
{
name: 'num',
width: '7vw',
type: 'number',
preunit: '¥'
}
],
rankPercentObj: [
{
name: 'merchantname',
width: '18vw',
action: true
},
{
name: 'num',
width: '3vw',
type: 'decimal'
}
],
area: '',
month: ''
}
},
watch: {
area: {
handler(newVal) {
this.getRetailRank()
}
},
month: {
handler(newVal) {
this.getRetailRank()
}
}
},
created() {
this.$bus.$on('selectAreaChange', val => {
if (val === '全部') val = ''
this.area = val
})
this.$bus.$on('selectMonthChange', val => {
if (val === '全部') val = ''
this.month = val
})
this.getRetailRank()
},
mounted() {},
methods: {
async getRetailRank() {
const params = {
province: this.area,
statMonth: this.month
}
const _result = await this.api.equity.getRetailRank(params)
const { outputvalueRank, perCusTransRank, conversionRateRank } = _result.data.dataList[0]
this.storeOutputList = outputvalueRank.slice(0,5)
this.storePercentList = conversionRateRank.slice(0,5)
this.storePriceList = perCusTransRank.slice(0,5)
}
}
}
</script>
<style lang="scss" scoped>
.rank-box {
width: 31.39vw;
height: 26.78vh;
box-shadow: inset 0 0 20px 0 #3d57ff69;
&:nth-child(-n + 2) {
margin-bottom: 1.78vh;
}
.rank-content {
padding: 1.67vh 1.39vw;
}
.empty {
height: 24.45vh;
display: flex;
align-items: center;
}
}
</style>