touchList.vue
14.3 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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<!-- 完成率分析-->
<template>
<div class="marketing sop-analysis touch-list">
<div class="container">
<div class="title m-b-20">
SOP名称:
<span>{{ sopInfo.sopName }}</span>
</div>
<div v-loading="loading">
<div class="tagUpdate-warp">
<glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<!-- <span slot="footer">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span> -->
</glsx-combi-form>
<p class="tag-update">标签更新:{{ this.labelOptUpdate == 1 ? '开启' : '关闭' }}</p>
</div>
<div class="analysis-box">
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
<img src="@/assets/sop/sop01.png"/>
<div class="analysis-name"> 客户总数
<p class="analysis-num">{{ baseData.sopEventList.length ? sopInfo.customerCount : '-' }}</p></div>
</div>
</div>
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
<img src="@/assets/sop/sop02.png"/>
<div class="analysis-name"> 已执行客户数
<p class="analysis-num">
{{ baseData.sopEventList.length ? selectedEventInfo.eventStatistics.executedTargetCount : '-' }}
</p></div>
</div>
</div>
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
<img src="@/assets/sop/sop03.png"/>
<div class="analysis-name"> 执行率
<p class="analysis-num">
{{ baseData.sopEventList.length ? selectedEventInfo.eventStatistics.executedRatio : '-' }}%</p></div>
</div>
</div>
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
<img src="@/assets/sop/sop04.png"/>
<div class="analysis-name">
已触达客户数
<p class="analysis-num">
{{ baseData.sopEventList.length ? selectedEventInfo.eventStatistics.reachCustomerCount : '-' }}</p>
</div>
</div>
</div>
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
<img src="@/assets/sop/sop05.png"/>
<div class="analysis-name">
触达率
<p class="analysis-num">{{ sopInfo.touchPercent }}</p>
</div>
</div>
<!-- <div id="completePie" class="chart-pie"></div>-->
</div>
</div>
<p class="m-b-10">客户触达明细</p>
<!-- 表格区域 开始 -->
<GLTable ref="touchListRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm"
:tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun"></GLTable>
<!-- 表格区域 end -->
</div>
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
export default {
name: 'touchList',
data() {
return {
size: 'small',
url: url,
loading: false,
searchForm: {
sopId: '',
eventId: ''
},
sopInfo: {},
selectedEventInfo: {
eventStatistics: {}
},
labelOptUpdate: '',
// 搜索
searchFormData: [
{
label: '营销事件',
name: 'eventId',
type: 'select',
width: '415px',
optionList: [],
optionId: 'id',
optionLabel: 'confName',
optionsName: 'sopEventList',
changeAttr: (val, targetItem) => {
this.searchForm.eventId = val
this.selectedEventInfo = this.baseData.sopEventList.find(item => item.id == val)
this.labelOptUpdate = this.selectedEventInfo.labelOptUpdate
this.getBaseInfo()
this.$refs.touchListRef.refreshTable()
}
}
],
// 表格
getListApi: this.$apis.sop.getSopCustomerStatisticsListApi,
tableParams: {
listName: 'list',
tableColumns: []
},
tableColumns: [
{
label: '客户名称',
prop: 'customerName',
formatter: cellValue => {
return cellValue.customerName || '-'
}
},
{
label: '客户手机号',
prop: 'customerPhone',
width: '110',
formatter: cellValue => {
return cellValue.customerPhone || '-'
}
},
{
label: '推送人',
prop: 'pusherName'
},
{
label: '推送时间',
prop: 'pusherTime'
},
{
label: '初次查看时间',
prop: 'firstViewDate',
formatter: cellValue => {
return cellValue.firstViewDate ? dayjs(cellValue.firstViewDate).format('YYYY-MM-DD HH:mm:ss') : '--'
}
},
{
label: '查看次数',
prop: 'viewCount',
formatter: cellValue => {
return cellValue.viewCount || '--'
}
},
{
label: '查看总时长',
prop: 'viewDuration',
formatter: cellValue => {
if (!cellValue.viewDuration) {
return '--'
} else {
let secondTime = parseInt(cellValue.viewDuration);// 秒
let minuteTime = 0;// 分
let hourTime = 0;// 小时
if (secondTime > 60) {//如果秒数大于60,将秒数转换成整数
//获取分钟,除以60取整数,得到整数分钟
minuteTime = parseInt(secondTime / 60);
//获取秒数,秒数取佘,得到整数秒数
secondTime = parseInt(secondTime % 60);
//如果分钟大于60,将分钟转换成小时
if (minuteTime > 60) {
//获取小时,获取分钟除以60,得到整数小时
hourTime = parseInt(minuteTime / 60);
//获取小时后取佘的分,获取分钟除以60取佘的分
minuteTime = parseInt(minuteTime % 60);
}
}
let result = "" + parseInt(secondTime) + "s";
if (minuteTime > 0) {
result = "" + parseInt(minuteTime) + "min" + result;
}
if (hourTime > 0) {
result = "" + parseInt(hourTime) + "h" + result;
}
return result
}
}
},
],
frontColumns: [
{
label: '群名称',
prop: 'groupName',
},
],
otherTableColumns: [
{
label: '是否点赞',
prop: 'likeCount',
formatter: cellValue => {
return !cellValue.likeCount ? '否' : '是'
}
}, {
label: '是否评论',
prop: 'commentCount',
formatter: cellValue => {
return !cellValue.commentCount ? '否' : '是'
}
}
],
diffsRepeatMode: {
1: '按天',
2: '按周',
3: '按月'
},
pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'},
baseData: {
sopEventList: []
}
}
},
props: {
sopId: {
type: String,
default: ''
},
sopType: {
type: String,
default: ''
}
},
mounted() {
this.tableParams.tableColumns = this.tableColumns
this.getBaseData()
this.$refs.touchListRef.tableHeightValues = '400px'
this.$refs.touchListRef.refreshTable()
},
methods: {
getBaseInfo() {
this.$apis.sop.getSopBaseInfoApi({sopId: this.sopId}).then(res => {
this.sopInfo = res
if (this.sopInfo.sopType == 2) {
this.tableParams.tableColumns = [...this.frontColumns, ...this.tableColumns]
}
if (this.sopInfo.sopType == 1) {
if (this.selectedEventInfo.pushChannelType == 3) {
this.tableParams.tableColumns = this.tableColumns.concat(this.otherTableColumns)
} else {
this.tableParams.tableColumns = this.tableColumns
}
}
this.sopInfo.touchPercent = this.baseData.sopEventList.length && this.sopInfo.customerCount ? Math.round((this.selectedEventInfo.eventStatistics.reachCustomerCount / this.sopInfo.customerCount) * 100).toFixed(0) + '%' : '-'
// this.drawPie()
})
},
getBaseData() {
this.loading = true
var params = {
sopId: this.sopId,
ifFilter: 'Y',
pageNum: 1,
pageSize: 999999
}
var pushChannelTypeList = {
1: '企业微信',
2: '短信',
3: '微信朋友圈'
}
this.$apis.sop
.getEventListApi(params)
.then(res => {
this.baseData.sopEventList = res.list
this.labelOptUpdate = this.baseData.sopEventList.length && this.baseData.sopEventList[0].labelOptUpdate
if (this.baseData.sopEventList.length) {
this.baseData.sopEventList.forEach(item => {
item.confName = item.eventStartDate + ' ' + item.eventTime + ' ' + (item.repeatFlag == 'Y' ? this.diffsRepeatMode[item.repeatMode] : '单次') + ' ' + (this.sopType == 2 ? '企微群推送' : pushChannelTypeList[item.pushChannelType])
// item.confName = item.eventStartDate + (item.repeatFlag == 'Y' ? (''-' + item.eventEndDate' || '') : '') + ' ' + item.eventTime + ' ' + pushChannelTypeList[item.pushChannelType]
})
this.getOptionsList('searchFormData', false)
this.searchForm.eventId = this.baseData.sopEventList[0].id
this.selectedEventInfo = this.baseData.sopEventList[0]
}
this.getBaseInfo()
this.$refs.touchListRef.refreshTable()
})
.finally(() => {
this.loading = false
})
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchForm.sopId = this.sopId
this.baseData.sopEventList.length ? resolve() : reject()
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.touchListRef.data.length ? (this.$refs.touchListRef.tableHeightValues = '') : this.$refs.touchListRef.setTableHeightFun()
},
// drawPie() {
// if (this.baseData.sopEventList.length) {
// let chartDom = document.getElementById('completePie')
// let myChart = echarts.init(chartDom)
// let option = JSON.parse(JSON.stringify(pieOption))
//
// option.series[0].data = [
// {
// value: this.selectedEventInfo.eventStatistics.reachCustomerCount ? this.selectedEventInfo.eventStatistics.reachCustomerCount : 0,
// name: '已触达的客户数'
// },
// {
// value: this.sopInfo.customerCount - this.selectedEventInfo.eventStatistics.reachCustomerCount,
// name: '未触达的客户数'
// }
// ]
//
// option && myChart.setOption(option)
// }
// }
}
}
</script>
<style lang="scss" scoped>
.sop-analysis {
.title {
height: 32px;
line-height: 32px;
font-size: 20px;
font-weight: 600;
}
.analysis-box {
margin-bottom: 40px;
display: flex;
//background: #F9FAFC;
.analysis-block {
position: relative;
box-sizing: border-box;
width: 216px;
height: 116px;
padding: 30px 20px 20px;
margin-right: 20px;
//flex-basis: 0 0 auto;;
//box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
background: #F9FAFC;
display: flex;
align-items: center;
.analysis-title-block {
display: flex;
//justify-content: space-between;
margin-left: 16px;
align-items: center;
height: 40px;
//line-height: 40px;
font-size: 14px;
color: #666666;
.analysis-name {
margin-left: 16px;
color: #333333;
.analysis-tips {
display: flex;
.tips {
margin-left: 3px;
}
}
}
}
.chart-pie {
position: absolute;
top: 20px;
right: 20px;
width: 70px;
height: 74px;
}
.analysis-num {
font-size: 26px;
font-weight: 600;
margin-top: 16px;
}
}
.analysis-block.back-image-green {
background-image: linear-gradient(0deg, #f8f8fc 0%, #f0fffa 100%);
}
.analysis-block.back-image-blue {
background-image: linear-gradient(0deg, #f8f8fc 0%, #f0f0ff 100%);
}
}
}
.tagUpdate-warp {
display: flex;
//align-items: center;
.tag-update {
color: #5850FF;
font-size: 14px;
line-height: 32px;
}
}
</style>