CollapseItem.vue
23.9 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
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
<!--
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-09-05 17:24:08
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2024-01-16 15:58:18
* @FilePath: \scrm-micro-journey\src\views\journeyConfig\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div :class="{ 'collapse-item': true, 'is-active': stepItem.isExpaned }" ref="collapseRef">
<div class="collapse-item-tab flex-column-center plr20" @click="handleExpand(item)">
<i class="el-icon-caret-bottom" v-show="stepItem.isExpaned"></i>
<i class="el-icon-caret-right" v-show="!stepItem.isExpaned"></i>
<div class="tab-label">
{{ stepItem.label }}
</div>
<div class="tab-sop" @click.stop="showStat" v-if="stepItem.instStatus == 1">SOP执行统计</div>
</div>
<div class="collapse-item-panel" :style="{ display: stepItem.isExpaned ? 'block' : 'none' }">
<div class="task-item">
<template>
<div class="task-item-head flex-column-center">
<div class="task-item-icon">
<img src="@/assets/config/log.png" />
</div>
<div class="task-item-name">
进入条件
<el-popover placement="top" width="300" trigger="hover">
<div>描述用户触发何种条件后,将自动变更为该旅程阶段</div>
<img src="@/assets/icon-tip.png" class="question" slot="reference" alt="" />
</el-popover>
</div>
<div class="task-item-desc">该旅程阶段{{ stepItem.editable ? '' : '不' }}支持手动标记</div>
</div>
<div class="progress-item-content bg-fff" v-if="stepItem.conditionsList.length">
<div class="progress-item" v-for="(v, k) in stepItem.conditionsList" :key="k">
<div class="progress-item-num">
<span>条件{{ k + 1 }}</span>
<span>{{ spiltString(v) }}</span>
</div>
<div class="progress-edit" @click="showEdit(v, k)">编辑</div>
</div>
</div>
<div class="empty-panel" v-else>
<div class="empty-img">
<img src="@/assets/empty.png" />
</div>
<div class="empty-txt">暂无进入条件</div>
</div>
</template>
<template>
<div class="task-item-sop flex">
<div class="task-sop-l">
<div class="task-item-head flex-column-center">
<div class="task-item-icon">
<img src="@/assets/config/sop.png" />
</div>
<div class="task-item-name">
SOP任务
<el-popover placement="top" width="300" trigger="hover">
<div>系统面向当前旅程阶段客户的营销计划</div>
<img src="@/assets/icon-tip.png" class="question" slot="reference" alt="" />
</el-popover>
</div>
</div>
<div class="task-item-content bg-fff" v-if="stepItem.sopList.length">
<div class="step-item" v-for="(v, k) in stepItem.sopList" :key="k">
<div class="step-item-day">
<img src="@/assets/config/step-border.png" />
<span>第{{ v[0].day }}天</span>
</div>
<div class="step-item-content">
<div v-for="(value, key) in v" :key="key" class="step-time-item flex-column-center">
<div>
<div class="step-item-desc">
<span>[{{ value.time }}]发送 | {{ stageInfo(value.nodeProtoId).nodeName }} |{{ stageInfo(value.nodeProtoId).desc }}</span>
</div>
<div class="step-item-name flex-column-center" v-if="value.taskType">
<div class="task-type flex">
受众客户:全旅程阶段客户
<div>
<div v-if="value.dataTag && value.dataTag.length > 0" class="flex">
、标签客户
<div class="tag" v-for="tag in value.dataTag" :key="tag.labelId">{{ tag.labelName }}</div>
</div>
</div>
</div>
<div class="task-type-edit" @click="setCriteria(value)" v-show="[7, 8, 9].includes(value.taskType)">
<img src="@/assets/config/icon-edit.png" />
<a>设置条件</a>
</div>
</div>
<!-- 仅企微提醒、企微群发、企微朋友圈展示 -->
<div class="step-item-name flex-column-center" v-show="[7, 8, 9].includes(value.taskType)">
<div class="task-type">跟进员工类型:{{ value.taskParam ? value.taskParam.followName : '' }}</div>
</div>
<!-- -->
<div class="step-item-name flex-column-center">
<div v-if="[5, 7, 8, 9, 10].includes(value.taskType)" class="task-type">
{{ stage_prefix[value.taskType].label }}
<span v-for="(tpl, index) in value.taskParam && value.taskParam.attContentList" :key="index">
<template v-if="tpl.attType == 1">{{ tpl.attContent }}</template>
</span>
</div>
<div class="task-type" v-else>{{ stage_prefix[value.taskType].label }}{{ stage_prefix[value.taskType].key ? activityInfo[stage_prefix[value.taskType].key] : remind(stage_prefix[value.taskType], k) }}</div>
<div class="task-type-edit" @click="editContent(value)" v-show="[5, 7, 8, 9, 10].includes(value.taskType)">
<img src="@/assets/config/icon-edit.png" />
<a>编辑内容</a>
</div>
</div>
<div class="task-tpl-wrap flex" v-if="[8, 9, 10].includes(value.taskType)">
<div v-for="(tpl, index) in value.taskParam && value.taskParam.attContentList" :key="index">
<img class="tpl-img" :src="tpl.attContent" v-if="tpl.attType == 2" />
<div v-if="tpl.attType == 7" class="mini-program flex">
<img class="icon" src="@/assets/gift.png" />
{{ tpl.attContent.marketingName }}
</div>
<div v-if="tpl.attType == 6" class="mini-program flex">
<img class="icon" src="@/assets/gift.png" />
{{ JSON.parse(tpl.attContent).fileName }}
</div>
<video class="tpl-video" type="video/mp4" v-if="tpl.attType == 3" width="100%" height="100%" :src="tpl.attContent"></video>
</div>
</div>
</div>
<!-- <div class="step-detail-btn" @click="getEmpDetail">详情</div> -->
</div>
</div>
</div>
</div>
<div class="empty-panel" v-else>
<div class="empty-img">
<img src="@/assets/empty.png" />
</div>
<div class="empty-txt">暂无SOP任务</div>
</div>
</div>
<div class="task-sop-calendar">
<div class="task-item-head flex-column-center">
<div class="task-item-icon">
<img src="@/assets/config/calendar.png" />
</div>
<div class="task-item-name">SOP日历</div>
</div>
<div class="task-item-content bg-fff">
<div class="calendar-panel">
<div class="calendar-item" v-for="(v, k) in stepItem.sopList" :key="k">
<div class="calendar-day">第{{ v[0].day }}天</div>
<div class="calendar-time flex-column-center" v-for="(value, key) in v" :key="key">
<el-popover popper-class="popover-dialog" placement="top-start" width="100" trigger="click">
<div class="popover-panel" v-for="(t, pkey) in v" :key="pkey">
<div class="flex-column-center">
<span>{{ t.time }}</span>
</div>
<div class="stage-desc">{{ stageInfo(t.nodeProtoId).nodeName }}</div>
</div>
<div slot="reference" class="flex-column-center" v-if="v.length <= 2">
<span>{{ value.time }}</span>
</div>
<div slot="reference" class="flex-column-center" v-if="v.length > 2 && key == 0">
<span>3条内容</span>
</div>
</el-popover>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
</div>
</div>
<stat-dialog v-if="statVisible" :statVisible="statVisible" :stageid="stageid"></stat-dialog>
<edit-condition v-if="conditionVisible" :conditionVisible="conditionVisible" :order="stepItem.order" :conditionInfo="conditionInfo" @closeCondition="closeCondition"></edit-condition>
<select-tag ref="selectTagRef" @tagSelected="handleTagSelect"></select-tag>
<model-dialog :tplVisible="tplVisible" v-bind="sopItem" @dialogClose="dialogClose" @confirm="updateContent"></model-dialog>
</div>
</template>
<script>
const STAGE = Object.freeze({
1: '门店助手短信',
2: 'AI外呼',
3: '门店助手朋友圈',
4: '门店助手1v1',
5: '跟进提醒',
6: '客户信息查询',
7: '企微提醒',
8: '企微群发',
9: '企微朋友圈',
10: '发送短信'
})
const ICON = Object.freeze({
4: 1,
3: 2,
1: 3,
2: 4,
5: 5,
6: 6
})
const STAGE_PREFIX = Object.freeze({
4: {
key: 'activityName',
label: '活动名称:'
},
3: {
key: 'activityName',
label: '活动名称:'
},
1: {
key: 'textMessage',
label: '短信模版:'
},
2: {
key: 'aiSpeech',
label: '话术模版:'
},
5: {
key: 'aiSpeech',
label: '提醒模版:'
},
6: '查询内容:到保日期',
7: {
key: 'aiSpeech',
label: '提醒模版:'
},
8: {
key: 'aiSpeech',
label: '营销模版:'
},
9: {
key: 'aiSpeech',
label: '营销模版:'
},
10: {
key: 'textMessage',
label: '短信模版:'
}
})
import statDialog from './statDialog'
import editCondition from './editCondition'
import SelectTag from './selectTag'
import ModelDialog from './Model.vue'
import model from '@/mixins/model'
import { utils } from 'glsx-common'
export default {
mixins: [model],
components: {
statDialog,
editCondition,
SelectTag,
ModelDialog
},
props: {
stepItem: {
type: Object,
default: () => {}
},
activityInfo: {
type: Object,
default: () => {}
}
},
data() {
return {
conditionInfo: {},
stage: STAGE,
stage_prefix: STAGE_PREFIX,
stage_icon: ICON,
empVisible: false,
statVisible: false,
conditionVisible: false,
tplVisible: false,
sopItem: {}
}
},
created() {},
mounted() {
},
methods: {
//获取已选择标签
handleTagSelect(data) {
let dataTag = [],
options
data.forEach(group => {
let labelList = group.labelList
labelList.forEach(label => {
dataTag.push({
groupId: group.labelGroup.id,
groupName: group.labelGroup.name,
groupType: group.labelType,
labelId: label.id,
labelName: label.name
})
})
})
options = {
dataTag,
taskParam: ''
}
this.updateParam(options)
},
recursionTreeTag(selectItem, dataTag) {
if (dataTag.length == 0) return
selectItem.push({
labelGroup: {
id: dataTag[0].groupId,
name: dataTag[0].groupName
},
labelType: dataTag[0].groupType,
labelList: []
})
for (let i = 0; i < dataTag.length; i++) {
let len = selectItem.length - 1,
item = dataTag[i]
if (selectItem[len].labelGroup.id == item.groupId) {
selectItem[len].labelList.push({
id: item.labelId,
name: item.labelName
})
dataTag.splice(i--, 1)
}
}
if (dataTag.length > 0) {
this.recursionTreeTag(selectItem, dataTag)
}
},
//设置条件
setCriteria(item) {
let selectItem = []
let dataTag = utils.deepClone(item.dataTag)
this.recursionTreeTag(selectItem, dataTag)
this.sopItem = item
this.$refs.selectTagRef.init(selectItem)
},
updateContent(data) {
let taskParam = data,
options = {
taskParam,
dataTag: ''
}
this.updateParam(options)
},
updateParam(options) {
console.log(options, this.sopItem)
let { day, stage, stageid, taskType, nodeId, time } = this.sopItem
let dataTag = options.dataTag || this.sopItem.dataTag,
taskParam = options.taskParam || this.sopItem.taskParam,
data = {
day,
stage,
stageid,
time,
taskType,
dataTag,
taskParam: taskParam ? taskParam : {}
}
if (taskType == 7||taskType == 5) {
data.taskParam.content = taskParam && taskParam.attachments && taskParam.attachments.length ? taskParam.attachments[0].attContent : ''
delete data.taskParam.attachments
}
this.$apis.journeyConfig.updateParam({ nodeId, data }).then(res => {
if (res == 'success') {
this.$parent.getDetail(this.stepItem.order)
this.tplVisible = false
}
})
},
/* 编辑内容
* 门店助手跟进提醒
* 企微提醒
* 发送短信
* 企微群发/企微朋友圈
*/
editContent(item) {
this.sopItem = item
this.tplVisible = true
},
dialogClose(val) {
this.tplVisible = val
},
showEdit(v, k) {
const { title } = this.$route.query,
{ label, conditionsList, editable, flag } = this.stepItem
this.conditionInfo = {
title,
flag,
label,
editable,
conditionsList: conditionsList,
index: k
}
this.conditionVisible = true
},
closeCondition() {
this.conditionVisible = false
},
showStat() {
this.stageid = this.stepItem.order.slice(5)
this.statVisible = true
},
remind(v, k) {
if (typeof v == 'string') return v
if (this.stepItem.label == '保费报价') {
return v[this.stepItem.label][k]
} else {
return v[this.stepItem.label]
}
},
spiltString(data, n) {
let title = ''
try {
title += JSON.parse(data.paramRemark).title
} catch (error) {
console.log(error)
}
if (!data.flag) {
return data.name
}
const val = data.conditions.find(i => i.id == data.flag)
try {
title += JSON.parse(val.paramRemark).title
let day = ''
if (val.operators && val.operators.length) {
val.operators.forEach(item => {
if (item.value) {
day = [item.name, item.value]
}
})
}
if (/\[.*\]/.test(title) && day.length == 2) {
title = title.replace(/\[.*?\]/, day[0]).replace(/\[.*?\]/, day[1])
}
} catch (error) {
console.log(error)
}
val &&
val.subConditions &&
val.subConditions.length &&
val.subConditions.forEach(i => {
i.operators.forEach(o => {
if (o.value) {
title += `并且满足${i.name}${o.name}${o.value}${o.unit?o.unit:''},`
}
})
})
return title.replace(/,+$/, '')
},
//查看详情
getEmpDetail() {
this.empVisible = true
},
//展开收起
handleExpand() {
this.stepItem.isExpaned = !this.stepItem.isExpaned
}
}
}
</script>
<style lang="scss" scoped>
.question {
width: 16px;
height: 16px;
vertical-align: bottom;
}
.empty-panel {
background: #fff;
padding: 10px;
font-size: 12px;
color: #666666;
text-align: center;
margin: 10px 0px;
.empty-img {
width: 48px;
height: 30px;
margin: 10px auto 4px;
}
}
.collapse-item {
overflow: hidden;
height: 51px;
cursor: pointer;
&.is-active {
height: auto;
}
.collapse-item-tab {
height: 50px;
border-bottom: 1px solid #e5e5e5;
i {
cursor: pointer;
margin-right: 2px;
}
.tab-label {
font-weight: 600;
font-size: 14px;
color: #1d2129;
}
.tab-sop {
font-weight: 400;
font-size: 14px;
color: #5850ff;
margin-left: auto;
}
}
.collapse-item-panel {
background: #f7f7fc;
padding: 16px;
transition: all 0.3s;
.task-item {
&-head {
.task-item-icon {
width: 20px;
height: 20px;
}
.task-item-name {
color: #333333;
font-size: 14px;
margin-left: 10px;
}
.task-item-desc {
color: #999999;
font-size: 12px;
margin-left: auto;
}
}
.task-sop-l {
flex: 1;
}
.task-sop-calendar {
width: 296px;
margin-left: 16px;
}
}
.progress-item-content {
padding: 16px;
margin: 10px 0px;
row-gap: 20px;
position: relative;
.progress-edit {
position: absolute;
top: 50%;
right: 20px;
font-size: 14px;
line-height: 20px;
color: #5850ff;
margin-top: -10px;
}
.progress-item {
position: relative;
padding-left: 20px;
height: 32px;
display: flex;
align-items: center;
.progress-item-num {
flex: 1;
}
img {
width: 32px;
height: 4px;
margin: 0 10px;
}
span {
display: inline-block;
&:first-child {
margin-right: 40px;
width: 48px;
}
&:last-child {
// width: 80px;
}
}
&::before {
content: '';
position: absolute;
width: 6px;
height: 6px;
background: #5850ff;
border-radius: 50%;
left: 0px;
top: 12px;
}
}
}
.task-item-content {
padding: 16px;
margin-top: 10px;
height: calc(100% - 70px);
.step-item-day {
position: relative;
img {
width: 216px;
height: 52px;
}
span {
position: absolute;
top: 18px;
left: 52px;
}
}
.step-item {
.step-time-item {
padding: 12px 16px;
background: #f9fafe;
.step-detail-btn {
margin-left: auto;
font-size: 14px;
color: #5850ff;
cursor: pointer;
}
&:not(:first-child) {
margin-top: 10px;
}
}
&:last-child {
.step-item-content {
border: none;
}
}
}
.step-item-content {
padding: 16px 22px 20px;
border-left: 1px dashed #b8b9ff;
margin: -10px 0px -10px 20px;
}
.step-item-desc {
font-size: 14px;
color: #c6c6c6;
}
.step-item-name {
font-size: 14px;
color: #333333;
margin-top: 8px;
line-height: 20px;
.task-type {
// max-width: calc(100% - 150px);
.tag {
color: #666666;
line-height: 16px;
padding: 3px 6px;
background: #fafbfe;
border: 1px solid #e8e8ea;
border-radius: 3px;
display: inline-block;
margin-left: 6px;
}
}
.task-type-edit {
width: 80px;
color: #5850ff;
margin-left: 10px;
img {
width: 14px;
height: 14px;
}
a {
font-size: 12px;
color: #5850ff;
}
}
}
.task-tpl-wrap {
margin-top: 8px;
.tpl-img {
width: 24px;
height: 24px;
margin-right: 6px;
}
.mini-program {
height: 32px;
padding: 8px;
box-sizing: border-box;
background: #ffffff;
border-radius: 2px;
font-size: 12px;
color: #333333;
align-items: center;
.icon {
width: 16px;
height: 16px;
margin-right: 8px;
}
}
.tpl-video {
width: 24px;
height: 24px;
}
}
.calendar-panel {
display: grid;
grid-template-columns: repeat(4, 25%);
row-gap: 12px;
.calendar-item {
.calendar-day {
font-size: 12px;
color: #c6c6c6;
}
.calendar-time {
line-height: 20px;
/deep/ {
.el-popover__reference-wrapper {
display: flex;
align-items: center;
.el-popover__reference {
height: 32px;
line-height: 32px;
}
&:hover {
span {
color: #5850ff;
}
.stage-1 {
background: url('../../../assets/config/calendar-icon.png') -114px -62px;
}
.stage-2 {
background: url('../../../assets/config/calendar-icon.png') -10px -10px;
}
.stage-3 {
background: url('../../../assets/config/calendar-icon.png') -62px -10px;
}
.stage-4 {
background: url('../../../assets/config/calendar-icon.png') -62px -166px;
}
.stage-5 {
background: url('../../../assets/config/calendar-icon.png') -10px -114px;
}
.stage-6 {
background: url('../../../assets/config/calendar-icon.png') -62px -114px;
}
.stage-7 {
background: url('../../../assets/config/calendar-icon.png') -114px -114px;
}
}
}
}
span {
font-size: 14px;
color: #666666;
text-decoration: underline;
cursor: pointer;
}
}
}
}
}
}
}
.stage-desc {
font-size: 12px;
color: #333333;
}
.stage-icon {
width: 32px;
height: 32px;
transform: scale(0.5);
}
.stage-2 {
background: url('../../../assets/config/calendar-icon.png') -62px -62px;
}
.stage-3 {
background: url('../../../assets/config/calendar-icon.png') -114px -10px;
}
.stage-1 {
background: url('../../../assets/config/calendar-icon.png') -10px -62px;
}
.stage-4 {
background: url('../../../assets/config/calendar-icon.png') -166px -10px;
}
.stage-5 {
background: url('../../../assets/config/calendar-icon.png') -166px -62px;
}
.stage-6 {
background: url('../../../assets/config/calendar-icon.png') -166px -114px;
}
.stage-7 {
background: url('../../../assets/config/calendar-icon.png') -10px -166px;
}
</style>