statistic.vue
10.8 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
<template>
<div class="statisic-container">
<van-tabs v-model="tabIndex" sticky @change="tabChange">
<van-tab :title="'未送达(' + deliveredData.undelivered + ')'">
<scroll-view @ReachBottom="onReachBottom" ref="scrollView">
<div class="reason">
<div>未送达可能原因:</div>
<div>1. 客户开启消息免打扰,消息发送失败;</div>
<div>2. 群发次数达到上限,上限次数为每个客户每天仅可接收1条群发消息。(系统将连续重试3天)</div>
</div>
<customer-card v-if="customerInfo1.length > 0" :customerInfo="customerInfo1" @showFollowPop="showFollowPop" @showInfoPop="showInfoPop" @showAction="showAction"></customer-card>
<empty v-else></empty>
</scroll-view>
</van-tab>
<van-tab :title="'已送达(' + deliveredData.delivered + ')'">
<div class="statistic-pic flex">
<div class="funnel-logo">
<img v-if="activityGroupType" src="@/assets/images/funnel.png" alt="" />
<img v-else src="@/assets/images/funnel2.png" alt="" />
</div>
<div class="statistic-list">
<template v-for="(status, index) in reachStatus">
<div class="font-12 color-2f flex m-b-14" :key="index">
<div class="circle" :style="{ background: status.color }"></div>
{{ status.text }}
<span class="font-16 color-3 m-l-8 bold">{{ status.value(deliveredData) }}</span>
<span class="font-10 color39 m-l-4 fw5">
({{ Number(status.proportion(deliveredData)) == 0 ? '0' : parseInt((Number(status.value(deliveredData)) / Number(status.proportion(deliveredData))) * 100) }}%)
</span>
</div>
</template>
</div>
</div>
<select-bar :index="alreadyIndex" :list="selectBarList" @change="changeSelectTab"></select-bar>
<customer-card v-if="customerInfo2.length > 0" :customerInfo="customerInfo2" @showFollowPop="showFollowPop" @showInfoPop="showInfoPop" @showAction="showAction"></customer-card>
<empty v-else></empty>
</van-tab>
</van-tabs>
<!-- 跟进弹窗 -->
<customer-follow-popup ref="customerFollowRef" :info="followCustomerData" @changeIndexEvent="changeIndexEvent"></customer-follow-popup>
<!-- 客户信息弹窗 -->
<customer-info-popup ref="customerInfoRef"></customer-info-popup>
<van-action-sheet v-model:show="show" :actions="actions" @select="onSelect" cancel-text="取消" close-on-click-action @cancel="onCancel" />
</div>
</template>
<script>
import Empty from '../../components/Empty.vue'
import ScrollView from '../../components/ScrollView.vue'
import SelectBar from '../../components/SelectBar.vue'
import { solicitApi } from '@/api'
import { mapState } from 'vuex'
import { Notify } from 'vant'
export default {
components: { SelectBar, Empty, ScrollView },
data() {
return {
// 电话营销弹窗
show: false,
actions: [{ name: '呼叫' }, { name: '复制' }],
phoneNumber: '',
tabIndex: 0,
alreadyIndex: 0,
deliveredNum: 0,
selectBarList: [
{
text: '已送达',
value: 0
},
{ text: '已查看', value: 1 },
{
text: '已领取',
value: 2
},
{
text: '已到店',
value: 3
}
],
// 未送达客户列表
customerInfo1: [],
// 已送达客户列表
customerInfo2: [],
followCustomerData: {},
customerIndex: 0,
// 客户送达分层
deliveredData: {},
// 套餐类型是否不是权益套餐或秒杀活动
activityGroupType: true,
reachStatus: [
{
text: '已送达',
value: obj => {
return obj.delivered
},
proportion: obj => {
return obj.delivered
},
color: '#3975C6'
},
{
text: '已查看',
value: obj => {
return obj.viewed
},
proportion: obj => {
return obj.delivered
},
color: '#59BCFF'
},
{
text: '已领取',
value: obj => {
return obj.received
},
proportion: obj => {
return obj.delivered
},
color: '#33C1B9'
},
{
text: '已到店',
value: obj => {
return obj.arrived
},
proportion: obj => {
return obj.delivered
},
color: '#82D876'
}
]
}
},
computed: {
...mapState({
activityId: state => state.solicit.activityId,
staffId: state => state.solicit.staffId
})
},
created() {
this.groupId = this.getQuery().groupId
},
mounted() {
this.showLoading()
//一键营销状态回收
this.ocmarketingRecovery()
//员工发送状态判断
this.staffSendStatus()
// 触达统计-客户送达分层
this.deliveredStatistics()
this.getSendCustomerList(0) // 未送达
this.getSendCustomerList(1) // 已送达
},
methods: {
// 初始化微信接口
initWx() {
window.$wx = wxConfig
window.$wx.init(['setClipboardData', 'navigateToAddCustomer', 'openEnterpriseChat', 'makePhoneCall']).then(() => {})
},
// 电话招揽弹窗关闭
onCancel() {
this.show = false
},
// 选择电话营销方式
onSelect(e) {
// 呼叫
if (e.name === '呼叫') {
// window.location.href = 'tel://' + this.telNumber
this.makePhoneCall(this.phoneNumber)
return
}
// 复制
this.setClipboardData(this.phoneNumber)
},
showAction(data) {
this.show = true
this.phoneNumber = data.phoneNumber
},
ocmarketingRecovery() {
let params = {
id: this.activityId,
staffId: this.staffId,
groupId: this.groupId
}
solicitApi.ocmarketingRecovery(params).then(({ code, data, message }) => {})
},
staffSendStatus() {
let params = {
// id: 65,
// staffId: 67,
// groupId: 26816
id: this.activityId,
staffId: this.staffId,
groupId: this.groupId
}
solicitApi.staffSendStatus(params).then(({ code, data, message }) => {
if (code == 0) {
if (data.createFlag == 0) {
Notify('营销活动尚未创建,请创建一键营销后重试')
}
if (data.massStatus == 1 && data.createFlag == 1 && data.status == 0) {
Notify('请前往“群发助手”确认群发消息')
}
}
})
},
showFollowPop(data) {
this.$refs.customerFollowRef.init()
this.customerIndex = data.customerIndex
this.followCustomerData = data.followCustomerData
},
showInfoPop(data) {
this.$refs.customerInfoRef.getCustomerDetail(data.followCustomerData)
},
changeIndexEvent() {
let params = {
customerId: this.followCustomerData.actCutId
}
let target = ['customerInfo1', 'customerInfo2']
solicitApi.getCustomerDetail(params).then(({ code, data, message }) => {
if (code == 0) {
data.solicitTime = data.solicitTime ? data.solicitTime.slice(0, 11) : data.solicitTime
data.updatedTime = data.updatedTime ? data.updatedTime.slice(0, 11) : data.updatedTime
this[target[this.tabIndex]][this.customerIndex] = data
this.$set(this[target[this.tabIndex]], this.customerIndex, data)
// if (data.followFlag == 2) {
// this[target[this.tabIndex]].splice(this.customerIndex, 1)
// } else {
// this.$set(this[target[this.tabIndex]], this.customerIndex, data)
// }
} else {
Notify(message)
}
})
},
// tab栏切换
tabChange(e) {
this.tabIndex = e
},
// 已送达Tab四种状态
changeSelectTab(e) {
this.alreadyIndex = e
this.getSendCustomerList(1)
},
// 获取送达客户信息
getSendCustomerList(index) {
this.hideLoading()
let target = ['customerInfo1', 'customerInfo2']
let { alreadyIndex } = this
let params = {
customerGroupType: 2,
id: this.activityId,
staffId: this.staffId,
groupId: this.groupId,
sendStatus: index // 发送状态 0-未发送 1-已发送
}
if (index === 1) {
// 0-未查看 1-已查看
if (alreadyIndex === 1) params.checkStatus = 1
// 0-未领取 1-已领取
if (alreadyIndex === 2) params.receiveStatus = 1
// 0.未到店 1.已到店
if (alreadyIndex === 3) params.retFacFlag = 1
}
solicitApi.getCustomerList(params).then(({ code, data, message }) => {
if (code == 0) {
data.map(item => {
item.solicitTime = item.solicitTime ? item.solicitTime.slice(0, 11) : item.solicitTime
item.updatedTime = item.updatedTime ? item.updatedTime.slice(0, 11) : item.updatedTime
})
this[target[index]] = data
} else {
Notify(message)
}
})
},
// 客户送达分层
deliveredStatistics() {
let params = {
id: this.activityId,
staffId: this.staffId,
groupId: this.groupId
}
solicitApi.deliveredStatistics(params).then(({ code, data, message }) => {
if (code == 0) {
this.deliveredData = data
// 判断发送方式是否为权益套餐或秒杀活动
if ((data.activityGroupType && data.activityGroupType == 4) || (data.activityGroupType && data.activityGroupType == 5)) {
this.activityGroupType = false
this.reachStatus.splice(2, 1)
this.selectBarList.splice(2, 1)
}
}
})
},
// 下拉触底刷新
onReachBottom() {
this.$refs.scrollView.loading = false
this.$refs.scrollView.finished = true
}
}
}
</script>
<style lang="scss" scoped>
.statisic-container {
/deep/ .van-list {
background: #f7f7f7;
}
}
.reason {
padding: 16px;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(47, 64, 86, 0.7);
line-height: 18px;
}
.statistic-pic {
width: 100%;
height: 172px;
background: #ffffff;
box-shadow: 0px 1px 0px 0px rgba(233, 233, 233, 1);
padding: 16px 40px;
box-sizing: border-box;
.funnel-logo {
width: 144px;
height: 140px;
margin-right: 24px;
img {
width: 100%;
height: 100%;
}
}
.statistic-list {
white-space: nowrap;
// width: calc(100% - 190px);
.circle {
width: 8px;
height: 8px;
background: #3975c6;
border-radius: 2px;
margin-right: 6px;
}
}
.statistic-list div:nth-child(4) {
margin-bottom: 0;
}
}
/deep/ .van-tabs__line {
background-color: #3975c6;
}
</style>