giftDetail.vue
16 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
<!-- 礼包详情 -->
<template>
<div class="edit-gift detail-page marketing edit-box">
<!-- <div class="container approval-container">
<p class="edit-title">审批信息</p>
<div class="approval-info">
<div class="approval_label">审批人:{{ editForm.approveBy }}</div>
<div class="approval_label">
审批状态:
<span :style="{ color: approvalStatusColor[approvalStatus] }">{{ approvalStatusVal[approvalStatus] }}</span>
</div>
<div v-if="approvalStatus == 2" class="approval_label">
驳回说明:
<div class="approval_con">{{ editForm.approveExplain }}</div>
</div>
</div>
</div> -->
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form v-loading="loading" class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="415px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="giftNameSlot" class="gift-name-slot">{{editForm.name}} <div class="group-label" v-if="editForm.merchantType==2">集团</div></div>
<div slot="couponListBlock" class="gift-block" v-show="editForm.couponList && editForm.couponList.length != 0">
<div class="gift-title">
预估成本:
<span class="price">{{ totalEstimatedCost }}</span>
元
</div>
<div v-for="(item, index) in orderShow" :key="index">
<div class="gift-box" v-show="couponObj[item].list.length">
<!-- <div class="gift-label">{{ couponObj[item].label }}:</div> -->
<img class="server-type" :src="require(`@/assets/coupon/icon-${item}.png`)" />
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex">
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<p :class="['gift-info', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p>
<p v-show="subItem.status == '3'" class="gift-tips">已失效</p>
</div>
</div>
</div>
</div>
</div>
<div slot="approveFlagBlock">
{{ editForm.approveFlag == 1 ? '赠送前需审批' : '无需审批' }}
</div>
<div slot="receiveDetails" :class="editForm.receiveRule == 4 ? 'user' : ''">
<span v-if="editForm.receiveRule == 2 && editForm.receiveWay && editForm.receiveDetails">{{ `${editForm.receiveWay == '1' ? '手机号:' : '车架号后6位:'}${editForm.receiveDetails}` }}</span>
<span v-if="editForm.receiveRule == 1">{{ editForm.receiveWay == '1' ? '指定手机号' : '指定车架号后6位' }}:</span>
<span v-if="editForm.receiveRule == 4"><span style="color: #f56c6c;margin-right: 4px;">*</span>用户手机号:</span>
<div v-if="editForm.receiveRule == 1 || editForm.receiveRule == 4" class="phone-wrap">
<span :class="['phone', editForm.receiveWay == 1 ? 'realTel' : 'realNum']" v-for="(item, id) in receiveDetailList" :key="id">{{ item }}</span>
</div>
</div>
<div slot="staffListBlock" class="sale-select" v-show="editForm.staffList && editForm.staffList.length != 0">
<div :key="key" class="el-input-tag input-tag-wrapper-detail">
<el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" :disable-transitions="false" @close="handleStaffRemove(tag, idx)">
<i class="el-icon-user-solid"></i>
{{ tag.staffName }}
</el-tag>
</div>
</div>
</glsx-combi-form>
<div class="approval_note_container">
<div class="line"></div>
<div class="note_container">
<div class="left">
<span class="mar40">创建时间:{{ editForm.createdDate }}</span>
<span class="">创建人:{{ editForm.createdBy }}</span>
</div>
<div class="right">
<span class="mar40">最后修改时间:{{ editForm.updatedDate }}</span>
<span class="">修改人:{{ editForm.updatedBy }}</span>
</div>
</div>
</div>
</div>
<GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
</GLFooter>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
export default {
name: 'giftDetail',
data() {
return {
size: 'small',
title: '礼包详情',
loading: false,
editChildRef: 'editChildRef',
receiveDetailList: [],
routeInfo: {
// add-新增;edit-编辑;detail-详情
addOrEdit: 'add',
id: ''
},
labelWidth: '144px',
editForm: {
name: '',
remarkName: '',
receiveWay: '1',
receiveDetails: '',
receivedFlag: 2,
staffList: [],
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList: [],
receiveRule: 1
},
totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'],
numToCoupon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
couponObj: {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: []
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: []
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: []
},
// 会员服务
service: {
label: '会员服务',
discountType: 7,
list: []
}
},
editRule: {
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }],
remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }],
couponList: [{ required: true, message: '请选择礼包', trigger: 'change' }],
receiveWay: [{ required: true, message: '请选择领取规则', trigger: 'change' }],
staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }],
approveFlag: [{ required: true, message: '请选择审批要求', trigger: 'change' }],
stock: [{ required: true, message: '请选择库存数量', trigger: 'change' }],
receiveRule: [{ required: true, message: '请选择领取规则设置', trigger: 'change' }],
},
isEdit: true,
editFormData: [
{
label: '礼包名称',
name: 'name',
addHtml: 'giftNameSlot'
},
{
label: '备注名称',
name: 'remarkName',
type: 'showTxt'
},
{
label: '礼包设置',
name: 'couponList',
addHtml: 'couponListBlock'
},
{
label: '库存数量',
name: 'stock',
type: 'showTxt',
isHide: false
},
{
label: '审批要求',
name: 'approveFlag',
addHtml: 'approveFlagBlock',
isHide: false
},
{
label: '领取规则设置',
name: 'receiveRule',
type: 'radio',
optionId: 'confId',
optionLabel: 'confName',
isDisabled: true,
optionList: [
{
confId: 1,
confName: '创建时指定',
suffixSonSlot: 'bubble'
},
{
confId: 2,
confName: '员工赠送时指定',
suffixSonSlot: 'giveAway'
},
{
confId: 3,
confName: '直接领取',
suffixSonSlot: 'receives'
},
{
confId: 4,
confName: '直接发送到小程序卡包',
suffixSonSlot: 'cardHolder'
}
]},
{
label: '',
name: 'receiveWay',
addHtml: 'receiveDetails'
},
{
label: '发放员工',
name: 'staffList',
addHtml: 'staffListBlock'
},
{
label: '赠送原因',
name: 'giveReason',
type: 'showTxt'
}
],
// 审批状态 0审批中 1审批通过 2审批驳回
approvalStatus: -1,
approvalStatusVal: ['审批中', '审批通过', '已驳回', '审批撤销', '待审批'],
approvalStatusColor: ['#FF6D00', '#2CCA74', '#EB4E4E', '#999999', '#999999']
}
},
mounted() {
this.setMinHeight()
this.routeInfo = this.$route.query
this.loading = true
this.getInfo()
},
methods: {
getInfo() {
const API = this.routeInfo.type == 'received' ? 'getReceivedGiftDetail' : 'getGiftInfoApi'
const paramsKey = this.routeInfo.type == 'received' ? 'userDirectionalGiftId' : 'id'
this.$apis.giftBag[API]({ [paramsKey]: this.routeInfo.id })
.then(res => {
res.data.createdDate = dayjs(res.data.createdDate).format('YYYY-MM-DD HH:mm:ss')
res.data.updatedDate = dayjs(res.data.updatedDate).format('YYYY-MM-DD HH:mm:ss')
this.editForm = res.data
if(res?.data?.receiveRule == 4){
let target = this.editFormData.find(item => item.name == 'stock')
let targets = this.editFormData.find(item => item.name == 'approveFlag')
target.isHide = true
targets.isHide = true
}
if(res?.data?.receiveRule == 1){
let targetss = this.editFormData.find(item => item.name == 'receiveWay')
targetss.label = '领取条件'
}
let arr = []
res.data.receiveDetails && (arr = res.data.receiveDetails.split(','))
this.receiveDetailList = [...arr]
this.approvalStatus = res.data.approveStatus - 1
this.recoveryCoupon()
this.recoveryTotalPrice()
})
.finally(() => {
this.loading = false
})
},
recoveryCoupon() {
this.orderShow.forEach(item => {
this.couponObj[item].list = []
})
this.editForm.couponList.forEach(item => {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
})
},
receiveWayChange(val) {
var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails')
this.editFormData[receiveDetailsIdx].placeholder = val == '1' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '1' ? 11 : 6
},
// 计算预估成本
recoveryTotalPrice() {
this.totalEstimatedCost = 0
this.orderShow.forEach(itme => {
this.couponObj[itme].list.forEach(subItem => {
// 失效券不加入预估成本
if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + subItem.couponAnticipatedCost * subItem.couponAmount
}
})
})
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
},
handleCancel() {
this.$router.push({
path: '/giftBag/index',
query: { type: this.routeInfo.type }
})
}
}
}
</script>
<style lang="scss">
.marketing.edit-gift .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
.marketing.edit-gift .staff-block {
width: 567px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e5e5e5;
}
.detail-page {
#receiveRule{
.el-radio-group{
.is-checked {
.el-radio__input.is-checked .el-radio__inner{
border-color:#5850ff;
&::after{
background-color: #5850ff;
}
}
}
.el-radio__label{
color: #333333!important;
}
}
}
}
.marketing.edit-gift {
// 礼包
.gift-name-slot{
display: flex;
align-items: center;
.group-label{
width: 42px;
height: 20px;
line-height: 20px;
text-align: center;
background: rgba(255,101,61,0.15);
border-radius: 4px;
margin-left: 4px;
font-size: 12px;
display: inline-block;
color: #FF653D;
}
}
.gift-block {
width: 878px;
border-radius: 4px;
border: 1px solid #e5e5e5;
.gift-title {
padding: 10px;
background-color: #f4f6fc;
border-bottom: 1px solid #e5e5e5;
.price {
font-size: 18px;
}
}
.gift-box {
display: flex;
padding: 10px 0 10px 10px;
.server-type {
margin: 4px 12px 0 0;
height: 23px;
width: 58px;
}
.gift-label {
width: 70px;
color: #999999;
text-align: right;
}
.gift-content {
width: calc(100% - 70px);
border-bottom: 1px solid #e5e5e5;
.gift-item {
display: inline-block;
width: 50%;
.gift-info {
display: inline-block;
margin: 0 5px 0 7px;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
}
.gift-content:last-child {
border-bottom: 0px;
}
}
}
.phone-wrap {
width: 878px;
background-color: #f9f9f9;
padding: 5px 10px;
line-height: 14px;
font-size: 14px;
box-sizing: border-box;
margin-top: 5px;
.phone {
display: inline-block;
margin: 5px 16px 5px 0;
}
.realTel {
width: 120px;
}
.realNum {
width: 80px;
}
}
// 发放员工
.sale-select {
display: flex;
align-items: center;
}
.input-tag-wrapper-detail {
max-height: 68px;
overflow: auto;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
// border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px 5px 0px 5px;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 567px;
display: flex;
align-items: center;
// margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
margin-bottom: 5px;
// background: #fff !important;
}
.el-tag.el-tag--info .el-tag__close {
color: #e8e8ea;
background-color: rgba(0, 0, 0, 0) !important;
}
.el-tag.el-tag--info .el-tag__close:hover {
background-color: #5f5efb !important;
}
.tag-input {
background: transparent;
border: none !important;
font-size: 14px;
height: 32px;
outline: none;
padding-left: 0;
width: 100px;
}
}
// v2.0.0
.approval-info {
display: flex;
box-sizing: border-box;
padding: 32px 0 12px 82px;
.approval_label {
font-size: 14px;
font-weight: 400;
color: #666666;
width: 30%;
// width: 80px;
display: flex;
line-height: 20px;
white-space: nowrap;
.approval_con {
width: 80%;
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
white-space: pre-wrap;
}
}
}
.approval_note_container {
.line {
margin: 0 20px;
border-top: 1px solid #d8d8d8;
}
.note_container {
box-sizing: border-box;
padding: 32px 68px 12px 68px;
display: flex;
justify-content: space-between;
.left,
.right {
display: flex;
align-items: center;
font-size: 14px;
font-weight: 400;
color: #666666;
.mar40 {
margin-right: 40px;
}
}
}
}
.user {
margin-left: 144px;
}
</style>