NearMerchantsRank.vue
2.7 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
<!-- 近一年门店活动排名 -->
<template>
<div class="merchants-rank-box">
<box-title title="近一年门店活动排名"></box-title>
<inner-tab class="tab-box" :list="tabList" :width="25" :itemPadding="1.05" @changeTab="changeTab"></inner-tab>
<div class="rank-content" v-if="merchantRankList.length">
<Ranking class="rank-box" :rankingsList="merchantRankList" :rankingDataObj="isRate ? rankingRateObj : rankingDataObj" @goDetailPage="goDetailPage"></Ranking>
</div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template>
<script>
export default {
name: 'NearMerchantsRank',
data() {
return {
isRate: false,
dataList: {},
tabList: ['活动场次排名', '活动平均客单价排名', '活动退单率排名'],
merchantRankList: [],
rankingDataObj: [
{
name: 'merchantName',
width: '20vw',
action: true
},
{
name: 'num',
width: '8vw',
type: 'number'
}
],
rankingRateObj: [
{
name: 'merchantName',
width: '20vw',
action: true
},
{
name: 'num',
width: '8vw',
type: 'decimal'
}
]
}
},
created() {
this.getMerchantActivityRank()
},
mounted() {},
methods: {
async getMerchantActivityRank() {
const _result = await this.api.crowdFunding.getMerchantActivityRank()
this.dataList = _result.data.dataList[0]
this.merchantRankList = this.dataList.activityRank
},
// 跳转售后众筹二级页面
goDetailPage(item) {
const routeData = this.$router.resolve({
name: 'crowdfundingDetail',
query: {
merchantName: item.merchantName,
merchantid: item.merchantId
}
})
window.open(routeData.href, '_blank')
},
// tab切换
changeTab(val) {
switch (val) {
case 0:
this.merchantRankList = this.dataList.activityRank
this.isRate = false
break
case 1:
this.merchantRankList = this.dataList.percRank
this.isRate = false
break
case 2:
this.merchantRankList = this.dataList.chargebackRank
this.isRate = true
break
}
}
}
}
</script>
<style lang="scss" scoped>
.merchants-rank-box {
width: 36.94vw;
height: 34vh;
box-shadow: inset 0 0 20px 0 #3d57ff69;
.tab-box {
margin: 2.22vh auto;
}
.rank-content {
padding: 0 1.39vw;
}
.rank-box {
/deep/.ranking-box-item {
padding-bottom: 1.11vh;
}
}
.empty {
height: 21.33vh;
display: flex;
align-items: center;
}
}
</style>