ranking.vue
5.05 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<template>
<div v-if="show" class="rank-container">
<div class="page_title">门店产值排名</div>
<div class="tipper flex_scb">
<div class="tip_text">
<span>共</span>
<sapn style="color: #5850ff">{{ tableData.length }}</sapn>
<span>家门店开通精品升级业务,平均单店产值:</span>
<span style="color: #5850ff">¥{{ pjstoreTotal }}</span>
<span>;高于平均线</span>
<span>(同行此业务的平均产值为:</span>
<span style="color: #5850ff">¥{{ product || 0 }}</span>
<span>)的共</span>
<span style="color: #5850ff; font-size: 16px">{{ storeNum }}</span>
<span>家</span>
</div>
<!-- <div class="tip_rig h15_title">
查看同行如何提高产值
<i class="el-icon-d-arrow-right"></i>
</div> -->
</div>
<div class="table_widget">
<el-table :data="tableData" class="hightline" height="350" style="100%" highlight-current-row>
<el-table-column fixed="left" width="5">
<template slot-scope="scope">
<span :scope="scope"></span>
</template>
</el-table-column>
<el-table-column label="排名" width="100" align="center" type="index" :index="index => index + 1"></el-table-column>
<el-table-column prop="merchantName" label="门店名称" align="center"></el-table-column>
<el-table-column label="总产值" width="500">
<template slot-scope="scope">
<div class="echat_wrap">
<div class="h19_title xtext">{{ scope.row.divisionMoney }}</div>
<div class="progress_wrap">
<div :style="{ width: (100 * scope.row.divisionMoney) / custSortMax + '%' }" class="summary-progress-barin"></div>
</div>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="openBtn h18_title" @click="showContainer">
<span>收缩详情</span>
<img src="../../assets/updown_icon.png" />
</div>
</div>
</template>
<script>
import { orderTotalOfJT } from '../../api/modules/rules'
import { converterApi } from '../../api/modules/converter'
import utils from '../../util/util'
export default {
name: '',
data() {
return {
tableData: [],
pjstoreTotal: 0,
storeNum: 0,
productValue: 0,
custSortMax: 0
}
},
props: {
show: {
type: Boolean,
default: false
},
product: Number
},
created() {
this.today = utils.dateFormat(new Date())
},
mounted() {
this.orderAll()
},
methods: {
orderAll() {
let openInfo = JSON.parse(localStorage.getItem('openInfo'))
this.bengintime = utils.dateFormat(openInfo.openDate)
// this.bengintime = this.$defaultStartDate
let method = orderTotalOfJT()
let para = {
routerMethod: method,
beginDateStr: this.bengintime,
endDateStr: this.today,
reportType: 2,
orderByType: 1 //1 分账 2分润
}
converterApi(para).then(res => {
let arr = res || []
let total = 0
this.tableData = arr
this.custSortMax = 0
this.tableData.forEach(item => {
total = total + parseFloat(item.divisionMoney)
if (item.divisionMoney >= this.custSortMax) {
this.custSortMax = item.divisionMoney
}
})
this.pjstoreTotal = utils.decimal(total / arr.length, 2)
this.storeNum = this.sortNum(arr, this.pjstoreTotal)
})
},
sortNum(arr, total) {
let count = 0
arr.forEach(item => {
if (item.divisionMoney > total) {
count++
}
})
return count
},
showContainer() {
this.show = false
this.$emit('closeRank', false)
}
}
}
</script>
<style lang="scss" scoped>
.rank-container {
width: 100%;
height: 454px;
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
margin-top: 10px;
position: relative;
}
.openBtn {
position: absolute;
left: 50%;
transform: translate(-50%, 0);
bottom: 10px;
cursor: pointer;
> img {
margin-left: 5px;
width: 10px;
height: 9px;
}
}
.page_title {
padding: 15px 20px 10px 20px;
font-size: 16px;
font-weight: 600;
color: #333333;
}
.tipper {
width: 100%;
box-sizing: border-box;
padding: 0 20px;
.tip_text {
font-size: 12px;
font-weight: 400;
color: #000000;
display: flex;
align-items: center;
}
.tip_rig {
cursor: pointer;
> i {
margin-left: 5px;
}
}
}
.table_widget {
box-sizing: border-box;
padding: 10px 15px;
.echat_wrap {
display: flex;
align-items: center;
.xtext {
width: 20%;
}
.progress_wrap {
margin-left: 10px;
width: 65%;
}
.summary-progress-barin {
background-color: #5850ff;
height: 15px;
}
}
}
// .table_widget /deep/ .el-table--enable-row-hover .el-table__body tr:hover{
// background: #f4f3ff !important;
// }
// .table_widget /deep/ .el-table tbody tr:hover >td{
// background: #f4f3ff !important;
// }
</style>