store_code_analyse.vue
8.96 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<div class="g-card">
<div class="g-card-title">数据趋势</div>
<search-title :showMore="true" @search="getLineData"></search-title>
<chart-line style="height: 300px;" :legend="legend" :xData="xdata" :series="series"></chart-line>
</div>
<div class="g-card">
<div class="g-card-title">门店新增客户Top10</div>
<search-title @search="getTop10Fn"></search-title>
<chart-bar style="height: 300px;" :xData="bar" :series="value" :legend="barLegend"></chart-bar>
</div>
<div class="g-card">
<div class="g-card-title">数据报表</div>
<div class="mid-action">
<search-title :showMore="true" @search="getTableFn"></search-title>
<el-button type="primary" size="mini" @click="exportFn" v-loading="exportLoading">导出Excel</el-button>
</div>
<el-table v-loading="loading" :data="tableList" style="width: 100%;">
<el-table-column label="日期" align="center" min-width="100" prop="createTime" show-overflow-tooltip />
<el-table-column label="所属地区" align="center" min-width="100" prop="area" show-overflow-tooltip />
<el-table-column
label="门店名称"
align="center"
prop="storeName"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="点击/扫码总次数"
align="center"
prop="totalStoreGroupScannNumber"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="进群总客户数"
align="center"
prop="totalJoinGroupMemberNumber"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="退群总客户数"
align="center"
prop="totalExitGroupMemberNumber"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="今日点击/扫码总次数"
align="center"
prop="tdStoreGroupScannNumber"
min-width="120"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="今日进群客户数"
align="center"
prop="tdJoinGroupMemberNumber"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="今日退群客户数"
align="center"
prop="tdExitGroupMemberNumber"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
<template slot-scope="{ row }">
<el-button
type="text"
@click="
$router.push({
path: 'detail',
query: {
id: row.storeCodeId
}
})
"
>
详情
</el-button>
</template>
</el-table-column>
</el-table>
<!-- <div class="bottom"> -->
<pagination
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getTableChangeSize()"
/>
<!-- </div> -->
</div>
</div>
</template>
<script>
import ChartBar from '@/components/ChartBar.vue'
import ChartLine from '@/components/ChartLine.vue'
import SearchTitle from '../components/SearchTitleInStore.vue'
import {
getStoreCodeTab,
getLineDataStoreCode,
getBarTop10StoreCode,
getTableInStoreCode,
getTableStoreCodeExport
} from '@/api/drainageCode/store'
import { download } from '@/utils/common'
export default {
name: 'store-code-statistics',
components: {
SearchTitle,
ChartLine,
ChartBar
},
data() {
return {
exportLoading: false,
barLegend: ['门店'],
legend: ['点击/扫码次数', '进群客户数', '退群客户数'],
xdata: [],
series: [],
cardData: [
{
title: '点击/扫码总次数',
tips: '进入门店群码页面的总人数(去重)',
value: 0,
noArrow: true
},
{
title: '进群总客户数',
tips: '成功添加门店客户群的客户数(去重)',
value: 0,
noArrow: true
},
{
title: '退群总客户数',
tips: '退出门店客户群的客户数(去重)',
value: 0,
noArrow: true
},
{
title: '今日点击/扫码次数',
tips: '今日进入门店群码页面的总人数(去重)',
value: 0,
title1: '较前日',
value1: 0
},
{
title: '今日进群客户数',
tips: '今日成功添加门店客户群的客户数(去重)',
value: 0,
title1: '较前日',
value1: 0
},
{
title: '今日退群客户数',
tips: '今日退出门店客户群的客户数(去重)',
value: 0,
title1: '较前日',
value1: 0
}
],
total: 0,
query: {
pageSize: 10,
pageNum: 1
},
tableList: [],
loading: false,
searchData: {},
bar: [],
value: [],
tableSearch: {}
}
},
methods: {
exportFn() {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.exportLoading = true
return getTableStoreCodeExport(Object.assign({}, this.query, this.tableSearch))
})
.then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '数据报表.xlsx' //指定下载文件名
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.exportLoading = false
})
},
getTabTotalFn() {
getStoreCodeTab().then((res) => {
this.cardData[0].value = res.data.totalStoreGroupScannNumber
this.cardData[1].value = res.data.totalJoinGroupMemberNumber
this.cardData[2].value = res.data.totalExitGroupMemberNumber
this.cardData[3].value = res.data.tdStoreGroupScannNumber
this.cardData[3].value1 = res.data.ydStoreGroupScannNumber
this.cardData[4].value = res.data.tdJoinGroupMemberNumber
this.cardData[4].value1 = res.data.ydJoinGroupMemberNumber
this.cardData[5].value = res.data.tdExitGroupMemberNumber
this.cardData[5].value1 = res.data.ydExitGroupMemberNumber
})
},
getLineData(data) {
this.$forceUpdate()
getLineDataStoreCode(data).then((res) => {
this.xdata = []
this.series = []
let arr1 = []
let arr2 = []
let arr3 = []
if (res.data && res.data.length) {
res.data.forEach((dd) => {
this.xdata.push(dd.dataTime)
arr1.push(dd.totalStoreGroupScannNumber)
arr2.push(dd.totalJoinGroupMemberNumber)
arr3.push(dd.totalExitGroupMemberNumber)
})
this.series = [arr1, arr2, arr3]
this.$forceUpdate()
}
})
},
getTop10Fn(data) {
getBarTop10StoreCode(data).then((res) => {
if (res.data && res.data.length) {
this.bar = []
this.value = []
res.data.forEach((dd) => {
this.bar.push(dd.storeName)
this.value.push(dd.customerNumber)
})
}
})
},
getTableChangeSize() {
this.loading = true
getTableInStoreCode(Object.assign({}, this.query, this.tableSearch)).then((res) => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
},
getTableFn(data) {
this.loading = true
this.tableSearch = data
getTableInStoreCode(Object.assign({}, this.query, data)).then((res) => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
}
},
created() {
this.getTabTotalFn()
// this.getTop5Fn()
}
}
</script>
<style lang="scss" scoped></style>