detailCustomer.vue
13.4 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
<template>
<div>
<BasicInof :eventBus="eventBus" :id="$route.params.id" :form="'customer'" @handleSelect="handleSelect" @handleCustomSelect="handleCustomSelect"></BasicInof>
<div class="detail-container">
<div class="detail-modular">
<div class="title">员工详情</div>
<div class="detail-info">
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
<el-menu-item index>全部</el-menu-item>
<el-menu-item index="1">已发送员工</el-menu-item>
<el-menu-item index="0">未发送员工</el-menu-item>
<el-menu-item index="2">员工发送失败</el-menu-item>
</el-menu>
<div class="detail-total">共 {{ employeelist.length || 0 }} 人</div>
<div v-if="employeelist.length != 0" class="info-list">
<div class="info-item" v-for="(item, index) in employeelist" :key="item.id">
<img class="info-avatar" :src="item.avatar ? item.avatar : require('@/assets/guestCustom/default-avatar.png')" alt />
<div class="info-content">
<div class="info-text">
<div class="info-name">
{{ item.staffName }}
<span :class="[item.status == 0 ? 'unsend' : 'send']">
{{ item.status == 0 ? '未发送' : item.status == 1 ? '已发送' : '发送失败' }}
<el-popover v-show="item.status != 0 && item.status != 1" placement="top-start" title="失败原因:" width="400" trigger="hover">
<p>1.若插入活动发送失败,可能为企微未绑定活动小程序,请绑定后再尝试。</p>
<p>2.可能为客户开启消息免打扰,消息发送失败。</p>
<p>3.可能为群发次数达到上限,上限次数为每个客户/客户群每天仅可接收1条群发消息。</p>
<p>4.一个客户加多个员工时,先发消息的员工可以送达客户,后发消息的员工无法送达客户。</p>
<img slot="reference" :src="iconUrl" alt />
</el-popover>
</span>
</div>
<div class="info-num">共{{ item.customerCount ? item.customerCount : 0 }}个客户</div>
</div>
<div class="info-right">
<div v-if="item.status != 0 || item.remindStatus == 1">已提醒</div>
<el-button v-if="item.status == 0" :disabled="item.remindStatus == 1 || isDisabled" size="mini" type="primary" @click="remind(item, index)">提醒</el-button>
</div>
</div>
</div>
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="@/assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
</div>
</div>
<div class="detail-modular">
<div class="title">客户详情</div>
<div class="detail-info">
<el-menu :default-active="customIndex" class="el-menu-demo" mode="horizontal" @select="handleCustomSelect" infinite-scroll-distance="10">
<el-menu-item index>全部</el-menu-item>
<el-menu-item index="1">已送达客户</el-menu-item>
<el-menu-item index="0">未送达客户</el-menu-item>
<el-menu-item index="2">客户送达失败</el-menu-item>
</el-menu>
<div class="detail-total">共 {{ customerCount || 0 }} 人</div>
<div v-if="customerCount != 0" class="info-list" v-infinite-scroll="customerDetailLoad" immediate-check="false">
<div class="info-item" v-for="item in customerlist" :key="item.id">
<img class="info-avatar" :src="item.avatar ? item.avatar : require('@/assets/guestCustom/default-avatar.png')" alt />
<div class="info-content info-custom">
<div class="info-text">
<div class="info-name">
{{ item.customerName }}
<div class="customer-table" :class="[item.status == 0 ? 'unsend' : 'send']">
{{ item.status == 0 ? '未送达' : item.status == 1 ? '已送达' : '送达失败' }}
<el-popover v-show="item.status != 0 && item.status != 1" placement="top-start" title="失败原因:" width="400" trigger="hover">
<p>1.若插入活动发送失败,可能为企微未绑定活动小程序,请绑定后再尝试。</p>
<p>2.可能为客户开启消息免打扰,消息发送失败。</p>
<p>3.可能为群发次数达到上限,上限次数为每个客户/客户群每天仅可接收1条群发消息。</p>
<img slot="reference" :src="iconUrl" alt />
</el-popover>
</div>
</div>
</div>
<div class="info-right">
<div>通过 {{ item.staffName }}发送</div>
</div>
</div>
</div>
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="@/assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
const iconUrl =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAFoTx1HAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADqADAAQAAAABAAAADgAAAAC98Dn6AAAB7klEQVQoFVVSQUhUURQ9981sVFyYRRHuFFq1CGlZC3etnBlMRhMXQwhtCqIQJBA3gSSi1EpkNqkjCjOjm1YWuGojBVO7Fi0K2qQLF6H453bO+/ODLvz37z333PvOu+8BtImCf0K56J8VYKLoC9HRMlnwRxaRgB0kOHDDz5gl/0hZBaaFwGl3H65j577nygV/ITCM71pinRo1GiF4zm8jqzkr5dEtluiTJZ9zx8fYTEBmbP5D/tSY3wnaRUwB0rbdsAH5SYK3sW2l4r1/jnFIsUMElmsNmxdB7JGsUnGUWvQz+XkHXtXqNsxx/KL/Zg+oS5xxi8A2T8SqNe0az3NANyfVJD4N5ripZDTDrc1da8kn/i1QxGya4eq4Kl8aui7hblRLUd/JXCSxxXarBJ9T8fuYFLsztiqTv4NjXUTh2rZteEhiP8OKiiIez3+CFoWubdXtpUDe1XAbmJEfQLxpRxFPRz7T1ccz6BFkl6okRzHFOJ5ccbnkr8l5LF8mrl5Pnv5gJksJjmlD/wclv9121ClxeqthH4TJQh5fLhIMaa7LOrRuIk2la89lfO29ghuU/69IHBatqIZfOhgWv2OXhUIOi/FCnDpoZuYqaCaYpYJ5gvf+m6pInUE9Y5NRhoPCdGl80fscyFK1aqfCZH8B0rPa9foo7e4AAAAASUVORK5CYII='
import Vue from 'vue'
import BasicInof from './components/basicInfo.vue'
export default {
components: {
BasicInof
},
data() {
return {
iconUrl,
activeIndex: '',
customIndex: '',
employeelist: [],
customerlist: [],
basicInfo: {},
eventBus: new Vue(),
isDisabled: false,
footerLeft: 0,
footerWidth: 0,
// 客户详情分页
customerPage: {
pageSize: 10,
pageNum: 1
},
// 客户详情总数
customerCount: 0
}
},
mounted() {
this.getCustomerDetail(() => {
this.getStaffList()
this.getCustomerList()
})
let clientHeight = document.documentElement.clientHeight
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.boxHeight = clientHeight - 200
},
methods: {
handleSelect(val) {
this.activeIndex = val
this.getStaffList(val)
},
// 客户详情选择切换
handleCustomSelect(val) {
this.customIndex = val
this.customerlist = []
// 获取滑动高度清0,防止tab切换时记录滚动条位置问题
var scrolltopList = document.querySelectorAll('.info-list')
if (scrolltopList) {
scrolltopList[1] ? (scrolltopList[1].scrollTop = 0) : ''
}
this.customerPage = {
pageSize: 10,
pageNum: 1
}
this.getCustomerList(val)
},
remind(data, index) {
if (!data.remindStatus) {
this.$apis.customerTransform
.remindUserGroup({
id: data.id,
type: 1
})
.then(res => {
this.getStaffList(this.activeIndex)
this.$message({
type: 'success',
message: '已提醒'
})
// this.$set(this.employeelist[index], 'remindStatus', true)
})
}
},
getCustomerDetail(callback) {
const id = this.$route.params.id
this.$apis.customerTransform.customerDetail({ id }).then(res => {
this.basicInfo = res
const date = new Date(res.sendTime)
const currentDate = new Date()
this.isDisabled = date > currentDate
callback()
})
},
getStaffList(status = null) {
const id = this.$route.params.id
this.$apis.customerTransform.staffList({ id, status }).then(res => {
this.employeelist = res ? res : []
})
},
// 客户详情下拉加载
customerDetailLoad() {
// 详情列表有数据时才触发
if (this.customerlist.length > 0) {
this.customerPage.pageNum++
// 详情数组数量小于总数才触发,带上切换的tab值
if (this.customerlist.length < this.customerCount) this.getCustomerList(this.customIndex)
}
},
// 获取客户详情列表
getCustomerList(status = null) {
const id = this.$route.params.id
var params = JSON.parse(JSON.stringify(this.customerPage))
params.status = status
params.id = id
this.$apis.customerTransform.customerDetailList(params).then(res => {
this.customerCount = res.count
if (!res.data.length) {
this.customerlist = []
return
}
this.customerlist.push(...res.data)
})
},
remindUserGroup() {
const id = this.$route.params.id
this.$apis.customerTransform.remindUserGroup({ id, type: 1 }).then(res => {})
}
}
}
</script>
<style lang="scss" scope>
.detail-container {
display: flex;
width: 100%;
justify-content: space-between;
// margin-bottom: 84px;
.detail-modular {
width: calc(50% - 10px);
background-color: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
}
.title {
padding: 20px 0 17px 20px;
font-size: 16px;
font-weight: 600;
color: #333;
border-bottom: 1px solid #d8d8d8;
}
.detail-info {
padding: 0 20px;
.detail-total {
padding: 20px 0 14px;
font-size: 14px;
color: #333;
line-height: 16px;
}
.info-list {
max-height: 432px;
overflow: auto;
margin-bottom: 20px;
}
.info-item {
display: flex;
align-items: center;
background-color: #f6f6ff;
border-radius: 2px;
border: 1px solid rgba(88, 80, 255, 0.8);
padding: 15px;
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
.info-avatar {
width: 58px;
height: 58px;
margin-right: 20px;
}
.info-content {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
.info-text {
height: 62px;
}
.info-right {
display: flex;
align-items: center;
font-size: 16px;
color: #5850ff;
line-height: 22px;
}
.info-name {
display: flex;
align-items: center;
font-size: 16px;
color: #333;
font-weight: 600;
line-height: 22px;
margin-bottom: 14px;
span {
display: inline-block;
margin-left: 10px;
font-size: 14px;
}
.send {
position: relative;
color: #666;
font-weight: normal;
span {
img {
position: absolute;
right: -6px;
top: 4px;
}
}
}
.unsend {
padding: 3px 10px;
background-color: #eb4e4e;
color: #fff;
border-radius: 2px;
font-weight: normal;
}
.customer-table {
display: flex;
margin-top: 0;
margin-left: 10px;
&.send {
width: 80px;
}
span {
vertical-align: middle;
}
}
div {
margin-top: 10px;
font-size: 14px;
}
}
.info-num {
font-size: 14px;
color: #666;
line-height: 20px;
}
button {
margin-left: 10px;
padding: 9px 28px;
}
}
}
}
.el-menu.el-menu--horizontal {
border-bottom: none;
}
.el-menu-item {
line-height: 56px;
font-size: 16px;
height: 46px;
}
.el-menu--horizontal > .el-menu-item.is-active {
border-bottom-color: #5850ff;
color: #5850ff;
font-weight: 600;
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0px;
height: 64px;
width: 100%;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
z-index: 1;
}
.el-empty {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
text-align: center;
box-sizing: border-box;
padding: 40px 0;
}
.model-item-empty {
height: 200px;
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
}
</style>