serviceSet.vue
19.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
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
<!-- 店面服务设置 -->
<template>
<div class="before-sale edit-equity mall-server">
<template v-if="showPage == 1">
<div class="container edit-container mall-server-box">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="154px" defaultWidth="432px" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form>
<glsx-combi-form ref="editFormRefBrand" labelWidth="154px" defaultWidth="432px" formRef="editChildRefBrand" :formObj.sync="editForm" :formData="editFormDataCar">
<template slot="vehicleBrandId">
<el-select v-model="editForm.vehicleBrandId" placeholder="请选择品牌" filterable @change="handleChangeBrand(editForm.vehicleBrandId)" style="width:136px;" clearable>
<el-option v-for="item in baseData.carBrandOptions" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</template>
<template slot="vehicleSubBrandId">
<el-select v-model="editForm.vehicleSubBrandId" placeholder="请选择子品牌" filterable style="width:136px;" clearable>
<el-option v-for="item in baseData.carChildOptions" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</template>
</glsx-combi-form>
<!-- v1.1.0新增活码 -->
<div class="new_container">
<p class="title">针对包含“车主生活权益服务”的服务套餐,提供两种领取该服务的方式供门店选择。</p>
<div class="point_title">
<span class="point_icon"></span>
<span class="point_text">方式1:小程序领取。(车主直接登录小程序领取)</span>
</div>
<div style="height: 8px"></div>
<div class="point_title">
<span class="point_icon"></span>
<span class="point_text">方式2:加企微领取。(创建自动回复配有领取链接的活码,客户扫码加企微,自动回复小程序领取)</span>
</div>
<div class="radio_wrap">
<div class="box">
<div class="radio_title">
<el-radio v-model="wayRadio" :label="1">小程序领取</el-radio>
</div>
<div class="radio_panel">
<el-image :class="wayRadio == 2 ? 'opcaSty' : ''" style="width: 88px; height: 88px" :src="settingData.qrcodeUrl" :preview-src-list="[settingData.qrcodeUrl]"></el-image>
</div>
</div>
<div v-if="!settingData.liveCodeUrl" class="box">
<div class="radio_title">
<el-radio v-model="wayRadio" :label="2">加企微领取</el-radio>
</div>
<el-button :disabled="wayRadio == 1" size="small" @click="openActiveModal" class="custom_blue">选择活码</el-button>
</div>
<div v-if="settingData.liveCodeUrl || this.activeId" class="box">
<div class="radio_title">
<el-radio v-model="wayRadio" :label="2" @change="selectActivedRadio">加企微领取</el-radio>
</div>
<div class="radio_panel">
<el-image :class="wayRadio == 1 ? 'opcaSty' : ''" style="width: 88px; height: 88px" :src="settingData.liveCodeUrl" :preview-src-list="[settingData.liveCodeUrl]"></el-image>
</div>
<div class="radio_tip">{{ settingData.liveCodeName }}</div>
<div v-show="wayRadio == 2" class="radio_edit" @click="toEditActived">修改</div>
</div>
</div>
</div>
<!-- <div style="margin-left: 140px">
<p>针对包含“车主生活权益服务”的服务套餐,提供通过扫描小程序码进行领取“车主生活权益服务”。</p>
<img style="margin-top: 20px;" class="qrcodeImg" :src="qrcodeUrl" />
</div> -->
</div>
<div class="fixed_bottom flex_cc">
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
</template>
<template v-if="showPage == 2">
<div class="nodata_widget">
<div :style="[{ height: nodataHeight + 'px' }]" class="wrapper">
<img src="../../assets/nodata_icon.png" />
<span class="nodata_tip_1">您暂未开通售前权益服务</span>
<span class="nodata_tip_2">合作开通后,您方可在此页设置店面的服务热线和默认提单车辆品牌等。</span>
</div>
</div>
</template>
<GLDialog mode="big" bigTitle="选择渠道活码" :visible.sync="dialogTableVisible">
<div slot="custombigtitle" class="customTitle">
<div class="title1">选择渠道活码</div>
<span class="h9_title">仅查询自动回复中活动类型为“无忧服务”的活码</span>
</div>
<GLTable ref="table1" max-height="500" :tableTotal="tableTotal" layout="prev, pager, next" :hasNum="false" :tableData="tableData" :tableParams="tableParams">
<div slot="qrCode" slot-scope="scope">
<el-radio v-model="activeId" :label="scope.scope.qrCode" @change="selectActived($event, scope.scope)"> </el-radio>
</div>
<div slot="tagging" slot-scope="scope" class="tag-panel">
<el-popover trigger="hover" placement="top" v-if="scope.scope.taggingList && scope.scope.taggingList.length > 3">
<div :title="item.name" class="accountType-row accountType-row-tag" v-for="(item, index) in scope.scope.taggingList" :key="index">
{{ item ? item.name : '' }}
</div>
<div slot="reference" class="name-wrapper">
<div v-for="(item, index) in scope.scope.taggingList" :key="index" v-show="index < 4">
<div :title="item.name" class="accountType-row accountType-row-tag">{{ index == 3 && scope.scope.taggingList.length > 3 ? '...(' + scope.scope.taggingList.length + ')' : item ? item.name : '' }}</div>
</div>
</div>
</el-popover>
<template v-if="scope.scope.taggingList && scope.scope.taggingList.length <= 3 && scope.scope.taggingList.length > 0">
<div v-for="(item, index) in scope.scope.taggingList" :key="index">
<div :title="item.name" class="accountType-row accountType-row-tag">{{ item ? item.name : '' }}</div>
</div>
</template>
<div v-if="!scope.scope.taggingList || (scope.scope.taggingList && scope.scope.taggingList.length == 0)">--</div>
</div>
</GLTable>
<span slot="footer" class="dialog-footer">
<span v-if="!tableData.length" @click="jumpToCreated" class="created_btn">创建活码</span>
<el-button plain size="small" class="btn-three" @click="dialogTableVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="toConfimActived">确定</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'serviceSet',
data() {
return {
size: 'small',
isBlock: true,
title: '店面服务设置',
editChildRef: 'editChildRef',
qrcodeUrl: '',
editForm: {
hotline: '',
vehicleBrandId: '',
vehicleSubBrandId: ''
},
editRule: {
// hotline: [{ required: true, message: '请输入服务热线', trigger: 'change' }]
},
editFormData: [
{
label: '服务热线',
name: 'hotline',
type: 'input',
maxlength: 20
}
],
editFormDataCar: [
{
label: '主营品牌',
name: 'vehicleBrandId',
addHtml: 'vehicleBrandId'
},
{
label: '',
// label: '子品牌',
name: 'vehicleSubBrandId',
addHtml: 'vehicleSubBrandId'
}
],
// 公共数据
baseData: {
carBrandOptions: [],
carChildOptions: []
},
showPage: 0,
nodataHeight: 0,
wayRadio: 1,
dialogTableVisible: false,
tabletotal: 0,
tableData: [],
tableParams: {
tableOption: false,
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '',
prop: 'qrCode',
width: '40px',
addHtml: 'qrCode'
},
{
label: '渠道名称',
prop: 'codeName'
},
{
label: '使用专员',
prop: 'staffName',
width: '130px'
},
{
label: '标签',
prop: 'tagging',
addHtml: 'tagging',
width: '150px'
},
{
label: '回复活动',
prop: 'marketingName',
formatter: cellValue => {
return `【${cellValue.marketingName}】`
}
}
]
},
activeId: '',
settingData: {}
}
},
components: {
glsxCombiForm
},
created() {
let clientHeight = document.documentElement.clientHeight
this.nodataHeight = clientHeight * 0.86
const openStatus = localStorage.getItem('preSetStatus')
if (openStatus == 2) {
this.showPage = 2
return
}
this.showPage = 1
this.getAllVehicleBrand()
this.getCarChildList()
},
mounted() {
if (this.showPage == 2) {
return
}
this.getHotline()
this.getActiveCode()
// this.getDefaultCarbrand()
},
methods: {
getHotline() {
this.$apis.ghBeforeSale.getHotlineApi({}).then(res => {
this.editForm.hotline = res.serviceHotline
this.wayRadio = res.codeType ? res.codeType : 1
this.settingData = res
})
},
getDefaultCarbrand() {
this.$apis.ghBeforeSale.getDefaultCarbrandApi({}).then(res => {
// console.log(res)
if (res) {
this.editForm.id = res.id
this.editForm.vehicleBrandId = res.vehicleBrandId
this.editForm.vehicleSubBrandId = res.vehicleSubBrandId
this.handleChangeBrand(this.editForm.vehicleBrandId, true)
}
})
},
// 获取品牌车型
getAllVehicleBrand(fn = () => {}) {
const params = {}
this.$apis.ghBeforeSale.getCarBrandListApi(params).then(res => {
// console.log(res)
this.baseData.carBrandOptions = res || []
})
},
handleChangeBrand(brandId, isRecovery = false) {
!isRecovery && (this.editForm.vehicleSubBrandId = '')
this.baseData.carChildOptions = brandId ? this.allCarChildList.find(item => item.id == brandId).childs : []
},
// 获取子品牌
getCarChildList(isRecovery = false) {
this.$apis.ghBeforeSale.getCarChildListApi({}).then(res => {
this.allCarChildList = res || []
if (isRecovery) {
this.baseData.carChildOptions = this.allCarChildList.find(item => item.id == this.editForm.vehicleBrandId).childs
}
this.getDefaultCarbrand()
})
},
handleConfirm() {
if (this.wayRadio == 1 || (this.activeId && this.wayRadio == 2)) {
this.comfimSelect()
}
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
Promise.all([this.$apis.ghBeforeSale.updateHotlineApi(params), this.$apis.ghBeforeSale.updateCarBrandApi(params)]).then(([hotlineRes, carBrandRes]) => {
this.$message({
message: hotlineRes.code == '0' && carBrandRes.code == '0' ? '操作成功' : '操作失败',
type: hotlineRes.code == '0' && carBrandRes.code == '0' ? 'success' : 'error'
})
this.getHotline()
this.getDefaultCarbrand()
})
}
})
},
// 获取活码
getActiveCode() {
let para = {
pageNum: this.dialogTableVisible ? this.$refs.table1.page.pageNum : 1,
pageSize: this.dialogTableVisible ? this.$refs.table1.page.pageSize : 10
}
this.$apis.ghBeforeSale.activeCodeList(para).then(res => {
this.tableData = res.data
this.tableData.forEach(item => {
item.tagging = item.tagging || []
this.$set(item, 'taggingList', [])
const tagging = eval(item.tagging)
tagging.forEach(itm => {
let name = itm.name.split(',')
name.forEach((tag, index) => {
item.taggingList.push({ name: tag })
})
})
})
})
},
openActiveModal() {
if (this.wayRadio == 1) {
return
}
this.dialogTableVisible = true
},
// 列表确定活码
toConfimActived() {
this.comfimSelect()
},
comfimSelect() {
if (this.activeId == -1 && this.wayRadio == 2) {
return
}
if (!this.tableData.length && this.dialogTableVisible) {
this.dialogTableVisible = false
return
}
const { session } = this.$globalState
let para = {}
if (this.wayRadio == 1) {
para = {
merchantId: session.merchantId,
codeType: this.wayRadio
}
} else {
para = {
merchantId: session.merchantId,
liveCodeUrl: this.activeId,
codeType: this.wayRadio,
liveCodeName: this.activeInfo.codeName,
liveCodeId: this.activeInfo.id
}
}
this.$apis.ghBeforeSale.updateActiveCode(para).then(res => {
this.dialogTableVisible = false
this.settingData.liveCodeUrl = this.activeId
this.getHotline()
})
},
// 修改活码
toEditActived() {
this.tableData.forEach(item => {
if (item.id == this.settingData.liveCodeId) {
this.activeId = item.qrCode
this.activeInfo = {
codeName: item.codeName,
id: item.id
}
}
})
this.dialogTableVisible = true
},
// 选择活码
selectActived(e, item) {
this.activeInfo = item
},
// 跳转到新建活码渠道
jumpToCreated() {
this.$history.push('/drainage/channel/addCode')
},
// 选择企微
selectActivedRadio(e) {
if (this.settingData.liveCodeUrl) {
this.activeId = this.settingData.liveCodeUrl
this.activeInfo = {
codeName: this.settingData.liveCodeName,
id: this.settingData.liveCodeId
}
}
}
}
}
</script>
<style lang="scss" scoped>
.before-sale .container {
padding: 0 !important;
background: #ffffff;
padding: 20px;
height: calc(100vh - 195px);
}
/deep/ #vehicleBrandId {
margin-right: 12px !important;
}
.before-sale .edit-form-container {
margin-top: 20px;
}
.before-sale .txt-center {
text-align: center;
}
.before-sale .footer {
width: calc(100% + 40px);
position: absolute;
bottom: 0;
height: 64px;
left: -40px;
text-align: center;
line-height: 64px;
background: #ffffff;
z-index: 999;
}
.before-sale .flex {
display: flex;
justify-content: space-between;
}
.before-sale .flex-grow {
flex: 1;
}
.before-sale .edit-title {
padding: 0 20px;
font-size: 16px;
font-weight: bold;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
color: #333333;
}
.before-sale .edit-sub-title {
position: relative;
font-size: 13px;
font-weight: 700;
height: 32px;
line-height: 32px;
color: #333333;
margin-bottom: 20px;
padding-left: 8px;
background-color: rgba(242, 242, 242, 1);
}
.before-sale .message-Z-zinde {
z-index: 3000 !important;
}
.before-sale .txt-red {
color: red;
}
.one-line-ellipsis {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.before-sale .qrcodeImg {
width: 160px;
height: 160px;
}
.mall-server {
height: calc(100% - 94px);
}
.mall-server-box {
height: 100%;
}
.nodata_widget {
// margin-top: 17px;
.wrapper {
width: 100%;
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow: hidden;
.nodata_tip_1 {
font-size: 18px;
font-weight: 500;
color: #3a3a3a;
margin-top: 48px;
}
.nodata_tip_2 {
font-size: 14px;
font-weight: 400;
color: #3a3a3a;
margin-top: 9px;
}
}
}
.fixed_bottom {
margin-top: 16px;
// position: fixed;
// width: 100%;
// bottom: 0px;
// height: 78px;
// display: flex;
// align-items: center;
// justify-content: center;
// background: #ffffff;
// z-index: 999;
// box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
.new_container {
box-sizing: border-box;
padding-left: 76px;
margin-top: 36px;
.title {
// width: 594px;
height: 22px;
font-size: 16px;
font-weight: 500;
color: #333333;
line-height: 22px;
margin-bottom: 16px;
}
.point_title {
display: flex;
align-items: center;
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 20px;
.point_icon {
width: 5px;
height: 5px;
background: #5850ff;
border-radius: 50%;
margin-right: 4px;
}
}
.radio_wrap {
margin-top: 28px;
display: flex;
.box {
margin-right: 122px;
.radio_panel {
margin-top: 10px;
width: 88px;
height: 88px;
border-radius: 2px;
border: 1px solid #dbdbdb;
> img {
width: 88px;
height: 88px;
}
.opcaSty {
opacity: 0.2;
}
}
.radio_tip {
font-size: 12px;
font-weight: 400;
color: #333333;
line-height: 17px;
margin: 4px 0;
}
.radio_edit {
font-size: 12px;
font-weight: 400;
color: #5850ff;
line-height: 17px;
cursor: pointer;
}
.custom_blue {
margin-top: 10px;
width: 96px;
background: #ffffff;
color: #5850ff;
border: 1px solid #5850ff;
}
}
}
}
.customTitle {
display: flex;
align-items: center;
.title1 {
font-size: 20px;
font-weight: 600;
color: #333333;
line-height: 28px;
margin-right: 8px;
}
}
.accountType-row {
text-align: left;
position: relative;
font-size: 14px;
line-height: 14px;
padding-left: 15px;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 6px;
display: inline-block;
margin-bottom: 5px;
margin-right: 5px;
&-tag {
display: inline-block;
border: 1px solid #e8e8ea;
background: #fafbfe;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #666;
max-width: 150px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
i {
color: #75acff;
}
// &::before {
// content: '';
// position: absolute;
// width: 6px;
// height: 6px;
// background: #5850ff;
// border-radius: 8px;
// left: 0px;
// top: 7px;
// }
}
.dialog-footer {
position: relative;
display: flex;
align-items: center;
justify-content: flex-end;
.btn-three {
border-color: #c8c8c8;
color: #666;
}
.created_btn {
position: absolute;
left: 0px;
height: 50%;
transform: translate(0, -50%);
cursor: pointer;
font-size: 16px;
font-weight: 600;
text-decoration: underline;
color: #5850ff;
line-height: 26px;
}
}
.edit-equity /deep/ .el-dialog__body {
height: 520px;
}
/deep/ .combi-form-label {
color: #333;
}
</style>