|
@@ -1,13 +1,13 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="subPage">
|
3
|
3
|
<form class="mainForm">
|
4
|
|
- <h1 style="font-size:22px;">{{isEdit === 0 ? '新建' : '编辑'}}{{type === 'drink' ? '饮品优惠券' : '课程优惠券'}}</h1>
|
|
4
|
+ <!-- <h1 style="font-size:22px;">{{isEdit === 0 ? '新建' : '编辑'}}{{couponInfo.CouponTypeId === 'goods' ? '饮品优惠券' : '课程优惠券'}}</h1> -->
|
5
|
5
|
<ul>
|
6
|
6
|
<li class="flex-h">
|
7
|
7
|
<span>选择案场:</span>
|
8
|
8
|
<div class="flex-item">
|
9
|
9
|
<div style="width:50%">
|
10
|
|
- <el-select v-model="postData.CaseId" placeholder="请选择">
|
|
10
|
+ <el-select v-model="couponInfo.CaseId" placeholder="请选择" @change="caseChange">
|
11
|
11
|
<el-option
|
12
|
12
|
v-for="item in cases"
|
13
|
13
|
:key="item.CaseId"
|
|
@@ -27,7 +27,7 @@
|
27
|
27
|
:action='$api.file.image.url'
|
28
|
28
|
:show-file-list="false"
|
29
|
29
|
:on-success="handleAvatarSuccess">
|
30
|
|
- <img v-if="postData.Img" :src="postData.Img" class="avatar">
|
|
30
|
+ <img v-if="couponInfo.Images[0].CouponImageUrl" :src="couponInfo.Images[0].CouponImageUrl" class="avatar">
|
31
|
31
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
32
|
32
|
</el-upload>
|
33
|
33
|
</div>
|
|
@@ -39,7 +39,7 @@
|
39
|
39
|
<div style="width:200px;">
|
40
|
40
|
<el-input
|
41
|
41
|
placeholder="请输入"
|
42
|
|
- v-model="postData.Name"
|
|
42
|
+ v-model="couponInfo.CouponName"
|
43
|
43
|
clearable>
|
44
|
44
|
</el-input>
|
45
|
45
|
</div>
|
|
@@ -49,11 +49,11 @@
|
49
|
49
|
<span>券类型:</span>
|
50
|
50
|
<div class="flex-item">
|
51
|
51
|
<div style="width:50%">
|
52
|
|
- <el-select v-model="postData.Type" placeholder="请选择">
|
|
52
|
+ <el-select v-model="couponInfo.CouponTypeId" placeholder="请选择" @change="couponTypeChange">
|
53
|
53
|
<el-option
|
54
|
54
|
v-for="item in TypeList"
|
55
|
55
|
:key="item.id"
|
56
|
|
- :label="item.name"
|
|
56
|
+ :label="item.value"
|
57
|
57
|
:value="item.id">
|
58
|
58
|
</el-option>
|
59
|
59
|
</el-select>
|
|
@@ -66,7 +66,7 @@
|
66
|
66
|
<div style="width:200px;">
|
67
|
67
|
<el-input
|
68
|
68
|
placeholder="请输入"
|
69
|
|
- v-model="postData.Price"
|
|
69
|
+ v-model="couponInfo.Price"
|
70
|
70
|
clearable>
|
71
|
71
|
</el-input>
|
72
|
72
|
</div>
|
|
@@ -78,7 +78,7 @@
|
78
|
78
|
<div style="width:200px;">
|
79
|
79
|
<el-input
|
80
|
80
|
placeholder="请输入"
|
81
|
|
- v-model="postData.TotalNum"
|
|
81
|
+ v-model="couponInfo.TotalCount"
|
82
|
82
|
clearable>
|
83
|
83
|
</el-input>
|
84
|
84
|
</div>
|
|
@@ -88,22 +88,22 @@
|
88
|
88
|
<span>发送类型:</span>
|
89
|
89
|
<div class="flex-item">
|
90
|
90
|
<div>
|
91
|
|
- <el-radio v-model="postData.SendType" label="1">渠道</el-radio>
|
92
|
|
- <el-radio v-if="type === 'course'" v-model="postData.SendType" label="3">案场</el-radio>
|
93
|
|
- <el-radio v-model="postData.SendType" label="2">系统</el-radio>
|
|
91
|
+ <el-radio v-model="couponInfo.SendType" label="channel">渠道</el-radio>
|
|
92
|
+ <el-radio v-if="couponInfo.CouponTypeId === 'case'" v-model="couponInfo.SendType" label="case">案场</el-radio>
|
|
93
|
+ <el-radio v-model="couponInfo.SendType" label="system">系统</el-radio>
|
94
|
94
|
</div>
|
95
|
95
|
</div>
|
96
|
96
|
</li>
|
97
|
|
- <li class="flex-h">
|
|
97
|
+ <li class="flex-h" v-if="couponInfo.SendType === 'channel'">
|
98
|
98
|
<span>选择渠道:</span>
|
99
|
99
|
<div class="flex-item">
|
100
|
100
|
<div style="width:50%">
|
101
|
|
- <el-select v-model="postData.ChannelId" placeholder="请选择">
|
|
101
|
+ <el-select v-model="couponInfo.ChannelId" placeholder="请选择">
|
102
|
102
|
<el-option
|
103
|
|
- v-for="item in ChannelList"
|
104
|
|
- :key="item.id"
|
105
|
|
- :label="item.name"
|
106
|
|
- :value="item.id">
|
|
103
|
+ v-for="item in channelList"
|
|
104
|
+ :key="item.ChannelId"
|
|
105
|
+ :label="item.ChannelName"
|
|
106
|
+ :value="item.ChannelId">
|
107
|
107
|
</el-option>
|
108
|
108
|
</el-select>
|
109
|
109
|
</div>
|
|
@@ -113,24 +113,24 @@
|
113
|
113
|
<span>目标商品:</span>
|
114
|
114
|
<div class="flex-item">
|
115
|
115
|
<div>
|
116
|
|
- <el-radio v-model="postData.Assign" label="1">全部商品</el-radio>
|
117
|
|
- <el-radio v-model="postData.Assign" label="2">指定商品</el-radio>
|
|
116
|
+ <el-radio v-model="couponInfo.IsAll" label="1">全部商品</el-radio>
|
|
117
|
+ <el-radio v-model="couponInfo.IsAll" label="0">指定商品</el-radio>
|
118
|
118
|
</div>
|
119
|
119
|
</div>
|
120
|
120
|
</li>
|
121
|
|
- <li class="flex-h" v-if="postData.Assign === '2'">
|
|
121
|
+ <li class="flex-h" v-if="couponInfo.IsAll === '0'">
|
122
|
122
|
<div class="flex-item">
|
123
|
123
|
<div style="border: 1px solid #eee;">
|
124
|
124
|
<el-table
|
125
|
|
- :data="currentList"
|
|
125
|
+ :data="couponInfo.Targets"
|
126
|
126
|
stripe
|
127
|
127
|
style="width: 100%">
|
128
|
128
|
<el-table-column
|
129
|
|
- prop="Name"
|
|
129
|
+ prop="TargetName"
|
130
|
130
|
label="商品">
|
131
|
131
|
</el-table-column>
|
132
|
132
|
<el-table-column
|
133
|
|
- prop="Type"
|
|
133
|
+ prop="TargetType"
|
134
|
134
|
label="分类">
|
135
|
135
|
</el-table-column>
|
136
|
136
|
<el-table-column label="操作">
|
|
@@ -148,20 +148,20 @@
|
148
|
148
|
</div>
|
149
|
149
|
</div>
|
150
|
150
|
</li>
|
151
|
|
- <li class="flex-h" v-if="type === 'drink'">
|
|
151
|
+ <li class="flex-h" v-if="couponInfo.CouponTypeId === 'goods'">
|
152
|
152
|
<span>券有效时间:</span>
|
153
|
153
|
<div class="flex-item">
|
154
|
154
|
<div>
|
155
|
155
|
<div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
|
156
|
156
|
<el-radio v-model="postData.TimeType" label="1">固定时间</el-radio>
|
157
|
157
|
<el-date-picker
|
158
|
|
- v-model="postData.StartDate"
|
|
158
|
+ v-model="couponInfo.StartDate"
|
159
|
159
|
type="date"
|
160
|
160
|
placeholder="选择起始日期">
|
161
|
161
|
</el-date-picker>
|
162
|
162
|
<span style="line-height:40px;">至</span>
|
163
|
163
|
<el-date-picker
|
164
|
|
- v-model="postData.EndDate"
|
|
164
|
+ v-model="couponInfo.EndDate"
|
165
|
165
|
type="date"
|
166
|
166
|
placeholder="选择截止日期">
|
167
|
167
|
</el-date-picker>
|
|
@@ -171,7 +171,7 @@
|
171
|
171
|
<span style="width:100px;">
|
172
|
172
|
<el-input
|
173
|
173
|
placeholder="请输入"
|
174
|
|
- v-model="postData.Days"
|
|
174
|
+ v-model="couponInfo.ValidDays"
|
175
|
175
|
clearable>
|
176
|
176
|
</el-input>
|
177
|
177
|
</span>
|
|
@@ -185,13 +185,13 @@
|
185
|
185
|
<div class="flex-item">
|
186
|
186
|
<div>
|
187
|
187
|
<el-date-picker
|
188
|
|
- v-model="postData.StartDate"
|
|
188
|
+ v-model="couponInfo.StartDate"
|
189
|
189
|
type="date"
|
190
|
190
|
placeholder="选择起始日期">
|
191
|
191
|
</el-date-picker>
|
192
|
192
|
<span style="line-height:40px;">至</span>
|
193
|
193
|
<el-date-picker
|
194
|
|
- v-model="postData.EndDate"
|
|
194
|
+ v-model="couponInfo.EndDate"
|
195
|
195
|
type="date"
|
196
|
196
|
placeholder="选择截止日期">
|
197
|
197
|
</el-date-picker>
|
|
@@ -201,7 +201,17 @@
|
201
|
201
|
<li class="flex-h">
|
202
|
202
|
<span>视频:</span>
|
203
|
203
|
<div class="flex-item">
|
204
|
|
- <div></div>
|
|
204
|
+ <div style="vertical-align: middle;">
|
|
205
|
+ <a style="line-height: 40px;" v-if="videoOff" :href="couponInfo.VideoUrl" target="blank">{{couponInfo.VideoUrl}}</a>
|
|
206
|
+ <el-upload
|
|
207
|
+ class="avatar-uploader"
|
|
208
|
+ :action='$api.file.image.url'
|
|
209
|
+ :show-file-list="false"
|
|
210
|
+ :on-success="videoSuccess">
|
|
211
|
+ <a style="line-height: 40px;padding: 0 10px;">{{videoOff ? '更换' : '添加'}}视频</a>
|
|
212
|
+ </el-upload>
|
|
213
|
+ <el-button v-if="videoOff" type="danger" @click="deleteVideo">删除视频</el-button>
|
|
214
|
+ </div>
|
205
|
215
|
</div>
|
206
|
216
|
</li>
|
207
|
217
|
<li class="flex-h">
|
|
@@ -212,7 +222,7 @@
|
212
|
222
|
type="textarea"
|
213
|
223
|
:rows="2"
|
214
|
224
|
placeholder="请输入"
|
215
|
|
- v-model="postData.ShareDesc">
|
|
225
|
+ v-model="couponInfo.Share.CouponShareInfo">
|
216
|
226
|
</el-input>
|
217
|
227
|
</div>
|
218
|
228
|
</div>
|
|
@@ -225,7 +235,7 @@
|
225
|
235
|
type="textarea"
|
226
|
236
|
:rows="2"
|
227
|
237
|
placeholder="请输入"
|
228
|
|
- v-model="postData.RuleDesc">
|
|
238
|
+ v-model="couponInfo.Share.UseRule">
|
229
|
239
|
</el-input>
|
230
|
240
|
</div>
|
231
|
241
|
</div>
|
|
@@ -238,7 +248,7 @@
|
238
|
248
|
type="textarea"
|
239
|
249
|
:rows="2"
|
240
|
250
|
placeholder="请输入"
|
241
|
|
- v-model="postData.UsedDesc">
|
|
251
|
+ v-model="couponInfo.Share.UseInstruction">
|
242
|
252
|
</el-input>
|
243
|
253
|
</div>
|
244
|
254
|
</div>
|
|
@@ -255,22 +265,22 @@
|
255
|
265
|
width="650px"
|
256
|
266
|
center>
|
257
|
267
|
<div>
|
258
|
|
- <div v-if="type === 'drink'">
|
|
268
|
+ <div v-if="couponInfo.CouponTypeId === 'goods'">
|
259
|
269
|
<el-table
|
260
|
270
|
ref="multipleTable"
|
261
|
|
- :data="drinkList"
|
|
271
|
+ :data="goodsList.list"
|
262
|
272
|
tooltip-effect="dark"
|
263
|
273
|
style="width: 100%"
|
264
|
|
- @selection-change="handleSelectionChange">
|
|
274
|
+ @selection-change="handleGoodsChange">
|
265
|
275
|
<el-table-column
|
266
|
276
|
type="selection">
|
267
|
277
|
</el-table-column>
|
268
|
278
|
<el-table-column
|
269
|
|
- prop="Name"
|
|
279
|
+ prop="GoodsName"
|
270
|
280
|
label="商品名称">
|
271
|
281
|
</el-table-column>
|
272
|
282
|
<el-table-column
|
273
|
|
- prop="Type"
|
|
283
|
+ prop="TypeId"
|
274
|
284
|
label="类别">
|
275
|
285
|
</el-table-column>
|
276
|
286
|
<el-table-column
|
|
@@ -286,22 +296,22 @@
|
286
|
296
|
:total="total">
|
287
|
297
|
</el-pagination>
|
288
|
298
|
</div>
|
289
|
|
- <div v-if="type === 'course'">
|
|
299
|
+ <div v-if="couponInfo.CouponTypeId === 'course'">
|
290
|
300
|
<el-table
|
291
|
301
|
ref="multipleTable"
|
292
|
|
- :data="courseList"
|
|
302
|
+ :data="courseList.list"
|
293
|
303
|
tooltip-effect="dark"
|
294
|
304
|
style="width: 100%"
|
295
|
|
- @selection-change="handleSelectionChange">
|
|
305
|
+ @selection-change="handleCourseChange">
|
296
|
306
|
<el-table-column
|
297
|
307
|
type="selection">
|
298
|
308
|
</el-table-column>
|
299
|
309
|
<el-table-column
|
300
|
|
- prop="Name"
|
|
310
|
+ prop="CourseName"
|
301
|
311
|
label="商品名称">
|
302
|
312
|
</el-table-column>
|
303
|
313
|
<el-table-column
|
304
|
|
- prop="StartDate"
|
|
314
|
+ prop="BeginDate"
|
305
|
315
|
label="开始时间">
|
306
|
316
|
</el-table-column>
|
307
|
317
|
<el-table-column
|
|
@@ -309,7 +319,7 @@
|
309
|
319
|
label="结束时间">
|
310
|
320
|
</el-table-column>
|
311
|
321
|
<el-table-column
|
312
|
|
- prop="Type"
|
|
322
|
+ prop="CourseType"
|
313
|
323
|
label="类别">
|
314
|
324
|
</el-table-column>
|
315
|
325
|
<el-table-column
|
|
@@ -328,75 +338,290 @@
|
328
|
338
|
</div>
|
329
|
339
|
<span slot="footer" class="dialog-footer">
|
330
|
340
|
<el-button @click="centerDialogVisible = false">取 消</el-button>
|
331
|
|
- <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
|
|
341
|
+ <el-button type="primary" @click="sureAddItem">确 定</el-button>
|
332
|
342
|
</span>
|
333
|
343
|
</el-dialog>
|
334
|
344
|
</div>
|
335
|
345
|
</template>
|
336
|
346
|
|
337
|
347
|
<script>
|
338
|
|
-import { mapState } from 'vuex'
|
|
348
|
+import { mapState, createNamespacedHelpers } from 'vuex'
|
|
349
|
+const { mapActions: mapCouponActions } = createNamespacedHelpers('coupon')
|
|
350
|
+const { mapState: mapChannelState, mapActions: mapChannelActions } = createNamespacedHelpers('channel')
|
|
351
|
+const { mapState: mapGoodsState, mapActions: mapGoodsActions } = createNamespacedHelpers('goods')
|
|
352
|
+const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
|
339
|
353
|
|
340
|
354
|
export default {
|
341
|
355
|
name: '',
|
342
|
356
|
data () {
|
343
|
357
|
return {
|
|
358
|
+ videoOff: false,
|
344
|
359
|
total: 0,
|
345
|
|
- drinkList: [], // 饮品列表
|
346
|
|
- courseList: [], // 课程列表
|
347
|
360
|
centerDialogVisible: false,
|
348
|
|
- type: this.$route.query.type,
|
|
361
|
+ type: this.$route.query.type || '', // goods、course
|
349
|
362
|
isEdit: this.$route.query.id === undefined ? 0 : 1,
|
350
|
363
|
ChannelList: [], // 渠道列表
|
351
|
|
- TypeList: [], // 类型列表
|
|
364
|
+ TypeList: [{ // 类型列表
|
|
365
|
+ value: '商品券',
|
|
366
|
+ id: 'goods'
|
|
367
|
+ }, {
|
|
368
|
+ value: '课程券',
|
|
369
|
+ id: 'course'
|
|
370
|
+ }],
|
352
|
371
|
currentList: [{
|
353
|
372
|
Name: 'ccc',
|
354
|
373
|
Type: 'xxx'
|
355
|
374
|
}], // 指定商品数据
|
|
375
|
+ couponInfo: {
|
|
376
|
+ CaseId: '',
|
|
377
|
+ CouponName: '',
|
|
378
|
+ CouponTypeId: '',
|
|
379
|
+ Price: '',
|
|
380
|
+ TotalCount: '',
|
|
381
|
+ SendType: '',
|
|
382
|
+ IsAll: '',
|
|
383
|
+ StartDate: '',
|
|
384
|
+ EndDate: '',
|
|
385
|
+ ValidDays: '',
|
|
386
|
+ VideoUrl: '',
|
|
387
|
+ ChannelId: '',
|
|
388
|
+ Images: [{
|
|
389
|
+ CouponImageUrl: ''
|
|
390
|
+ }],
|
|
391
|
+ Share: {
|
|
392
|
+ CouponShareInfo: '',
|
|
393
|
+ UseRule: '',
|
|
394
|
+ UseInstruction: ''
|
|
395
|
+ },
|
|
396
|
+ Targets: []
|
|
397
|
+ },
|
356
|
398
|
postData: {
|
357
|
399
|
page: 1,
|
358
|
|
- pagesize: 10,
|
|
400
|
+ pagesize: 6,
|
359
|
401
|
},
|
|
402
|
+ currentSelectArr: [],
|
360
|
403
|
}
|
361
|
404
|
},
|
362
|
405
|
mounted () {
|
363
|
|
- this.$nextTick(function () { })
|
|
406
|
+ this.$nextTick(function () {
|
|
407
|
+ this.GetChannelListList({
|
|
408
|
+ caseid: this.defaultCaseId,
|
|
409
|
+ page: 1,
|
|
410
|
+ pagesize: 10000
|
|
411
|
+ }).then(() => {
|
|
412
|
+ if (this.$route.query.id) {
|
|
413
|
+ this.getCouponById({
|
|
414
|
+ id: this.$route.query.id
|
|
415
|
+ }).then((res) => {
|
|
416
|
+ // console.log(JSON.stringify(res))
|
|
417
|
+ res.coupon.IsAll = String(res.coupon.IsAll)
|
|
418
|
+ if (res.coupon.VideoUrl !== '') {
|
|
419
|
+ this.videoOff = true
|
|
420
|
+ }
|
|
421
|
+ this.couponInfo = res.coupon
|
|
422
|
+ })
|
|
423
|
+ }
|
|
424
|
+ })
|
|
425
|
+ })
|
364
|
426
|
},
|
365
|
427
|
computed: {
|
366
|
428
|
...mapState({
|
367
|
429
|
cases: x => x.app.cases.list,
|
368
|
430
|
defaultCaseId: x => x.app.cases.default
|
369
|
431
|
}),
|
|
432
|
+ ...mapChannelState({
|
|
433
|
+ channelList: x => x.channelList,
|
|
434
|
+ }),
|
|
435
|
+ ...mapGoodsState({
|
|
436
|
+ goodsList: x => x.goodsList,
|
|
437
|
+ }),
|
|
438
|
+ ...mapCourseState({
|
|
439
|
+ courseList: x => x.courseList,
|
|
440
|
+ }),
|
370
|
441
|
CaseId: {
|
371
|
442
|
get () {
|
372
|
|
- return this.postData.caseid || this.defaultCaseId
|
|
443
|
+ return this.couponInfo.caseid || this.defaultCaseId
|
373
|
444
|
},
|
374
|
445
|
set (val) {
|
375
|
|
- this.postData.caseid = val
|
|
446
|
+ this.couponInfo.caseid = val
|
376
|
447
|
}
|
377
|
448
|
}
|
378
|
449
|
},
|
379
|
450
|
methods: {
|
380
|
|
- handleSelectionChange (val) {
|
381
|
|
- // this.multipleSelection = val;
|
|
451
|
+ ...mapGoodsActions([
|
|
452
|
+ 'GetGoodsList',
|
|
453
|
+ ]),
|
|
454
|
+ ...mapCouponActions([
|
|
455
|
+ 'addCoupon',
|
|
456
|
+ 'getCouponById',
|
|
457
|
+ 'editCoupon',
|
|
458
|
+ ]),
|
|
459
|
+ ...mapChannelActions([
|
|
460
|
+ 'GetChannelListList',
|
|
461
|
+ ]),
|
|
462
|
+ ...mapCourseActions([
|
|
463
|
+ 'GetCourseList',
|
|
464
|
+ ]),
|
|
465
|
+ deleteVideo () { // 删除视频
|
|
466
|
+ this.couponInfo.VideoUrl = ''
|
|
467
|
+ this.videoOff = false
|
|
468
|
+ },
|
|
469
|
+ caseChange () { // 选择案场
|
|
470
|
+ this.couponInfo.ChannelId = ''
|
|
471
|
+ this.GetChannelListList({
|
|
472
|
+ caseid: this.couponInfo.CaseId,
|
|
473
|
+ page: 1,
|
|
474
|
+ pagesize: 10000
|
|
475
|
+ })
|
|
476
|
+ },
|
|
477
|
+ sureAddItem () { // 确定添加指定商品
|
|
478
|
+ var bool = true
|
|
479
|
+ if (this.couponInfo.CouponTypeId === 'goods') {
|
|
480
|
+ for (var n = 0; n < this.currentSelectArr.length; n++) {
|
|
481
|
+ if (this.couponInfo.Targets.length) {
|
|
482
|
+ bool = true
|
|
483
|
+ for (var a = 0; a < this.couponInfo.Targets.length; a++) {
|
|
484
|
+ if (this.currentSelectArr[n].GoodsId === this.couponInfo.Targets[a].TargetId) {
|
|
485
|
+ bool = false
|
|
486
|
+ }
|
|
487
|
+ }
|
|
488
|
+ if (bool) {
|
|
489
|
+ this.couponInfo.Targets.push({
|
|
490
|
+ TargetName: this.currentSelectArr[n].GoodsName,
|
|
491
|
+ TargetId: this.currentSelectArr[n].GoodsId,
|
|
492
|
+ TargetType: this.currentSelectArr[n].TypeId
|
|
493
|
+ })
|
|
494
|
+ }
|
|
495
|
+ } else {
|
|
496
|
+ this.couponInfo.Targets.push({
|
|
497
|
+ TargetName: this.currentSelectArr[n].GoodsName,
|
|
498
|
+ TargetId: this.currentSelectArr[n].GoodsId,
|
|
499
|
+ TargetType: this.currentSelectArr[n].TypeId
|
|
500
|
+ })
|
|
501
|
+ }
|
|
502
|
+ }
|
|
503
|
+ } else if (this.couponInfo.CouponTypeId === 'course') {
|
|
504
|
+ for (var x = 0; x < this.currentSelectArr.length; x++) {
|
|
505
|
+ if (this.couponInfo.Targets.length) {
|
|
506
|
+ bool = true
|
|
507
|
+ for (var y = 0; y < this.couponInfo.Targets.length; y++) {
|
|
508
|
+ if (this.currentSelectArr[x].CourseId === this.couponInfo.Targets[y].TargetId) {
|
|
509
|
+ bool = false
|
|
510
|
+ }
|
|
511
|
+ }
|
|
512
|
+ if (bool) {
|
|
513
|
+ this.couponInfo.Targets.push({
|
|
514
|
+ TargetName: this.currentSelectArr[x].CourseName,
|
|
515
|
+ TargetId: this.currentSelectArr[x].CourseId,
|
|
516
|
+ TargetType: this.currentSelectArr[x].CourseType
|
|
517
|
+ })
|
|
518
|
+ }
|
|
519
|
+ } else {
|
|
520
|
+ this.couponInfo.Targets.push({
|
|
521
|
+ TargetName: this.currentSelectArr[x].CourseName,
|
|
522
|
+ TargetId: this.currentSelectArr[x].CourseId,
|
|
523
|
+ TargetType: this.currentSelectArr[x].CourseType
|
|
524
|
+ })
|
|
525
|
+ }
|
|
526
|
+ }
|
|
527
|
+ }
|
|
528
|
+ this.centerDialogVisible = false
|
|
529
|
+ },
|
|
530
|
+ handleGoodsChange (val) {
|
|
531
|
+ this.currentSelectArr = val
|
|
532
|
+ },
|
|
533
|
+ handleCourseChange (val) {
|
|
534
|
+ this.currentSelectArr = val
|
|
535
|
+ },
|
|
536
|
+ couponTypeChange () {
|
|
537
|
+ if (this.goodsList.length) {
|
|
538
|
+ this.goodsList = []
|
|
539
|
+ }
|
|
540
|
+ if (this.courseList.length) {
|
|
541
|
+ this.courseList = []
|
|
542
|
+ }
|
|
543
|
+ this.couponInfo.Targets = []
|
382
|
544
|
},
|
383
|
545
|
addGoods () { // 添加指定商品
|
384
|
|
- this.centerDialogVisible = true
|
|
546
|
+ if (this.couponInfo.CouponTypeId === 'goods') {
|
|
547
|
+ this.GetGoodsList({
|
|
548
|
+ ...this.postData,
|
|
549
|
+ caseid: this.couponInfo.CaseId
|
|
550
|
+ }).then((res) => {
|
|
551
|
+ this.total = res.pagenum
|
|
552
|
+ this.centerDialogVisible = true
|
|
553
|
+ })
|
|
554
|
+ } else if (this.couponInfo.CouponTypeId === 'course') {
|
|
555
|
+ this.GetCourseList({
|
|
556
|
+ ...this.postData,
|
|
557
|
+ caseid: this.couponInfo.CaseId
|
|
558
|
+ }).then((res) => {
|
|
559
|
+ this.total = res.pagenum
|
|
560
|
+ this.centerDialogVisible = true
|
|
561
|
+ })
|
|
562
|
+ }
|
385
|
563
|
},
|
386
|
564
|
submit () { // 保存
|
387
|
|
- // 1
|
|
565
|
+ if (this.$route.query.id) {
|
|
566
|
+ this.editCoupon({
|
|
567
|
+ ...this.couponInfo,
|
|
568
|
+ IsAll: this.couponInfo.IsAll - 0,
|
|
569
|
+ TotalCount: this.couponInfo.TotalCount - 0,
|
|
570
|
+ ValidDays: this.couponInfo.ValidDays || 0
|
|
571
|
+ }).then((res) => {
|
|
572
|
+ this.$alert('操作成功', '提示', {
|
|
573
|
+ confirmButtonText: '确定',
|
|
574
|
+ callback: action => {
|
|
575
|
+ this.$router.push({ name: 'couponList' })
|
|
576
|
+ }
|
|
577
|
+ })
|
|
578
|
+ })
|
|
579
|
+ } else {
|
|
580
|
+ this.addCoupon({
|
|
581
|
+ ...this.couponInfo,
|
|
582
|
+ IsAll: this.couponInfo.IsAll - 0,
|
|
583
|
+ TotalCount: this.couponInfo.TotalCount - 0,
|
|
584
|
+ ValidDays: this.couponInfo.ValidDays || 0
|
|
585
|
+ }).then((res) => {
|
|
586
|
+ this.$alert('操作成功', '提示', {
|
|
587
|
+ confirmButtonText: '确定',
|
|
588
|
+ callback: action => {
|
|
589
|
+ this.$router.push({ name: 'couponList' })
|
|
590
|
+ }
|
|
591
|
+ })
|
|
592
|
+ })
|
|
593
|
+ }
|
388
|
594
|
},
|
389
|
595
|
cancel () { // 取消
|
390
|
596
|
this.$router.push({ name: 'couponList' })
|
391
|
597
|
},
|
392
|
|
- deleteGoodsItem () { // 删除指定商品item
|
393
|
|
- // 1
|
|
598
|
+ deleteGoodsItem (index, row) { // 删除指定商品item
|
|
599
|
+ this.couponInfo.Targets.splice(index, 1)
|
394
|
600
|
},
|
395
|
601
|
handleAvatarSuccess (res, file) {
|
396
|
|
- this.postData.Img = res.result.url
|
|
602
|
+ this.couponInfo.Images[0].CouponImageUrl = res.result.url
|
|
603
|
+ },
|
|
604
|
+ videoSuccess (res, file) {
|
|
605
|
+ this.videoOff = true
|
|
606
|
+ this.couponInfo.VideoUrl = res.result.url
|
397
|
607
|
},
|
398
|
608
|
handleCurrentChange (val) { // 跳转到分页
|
399
|
|
- // this.getList()
|
|
609
|
+ this.postData.page = val
|
|
610
|
+ if (this.couponInfo.CouponTypeId === 'goods') {
|
|
611
|
+ this.GetGoodsList({
|
|
612
|
+ ...this.postData,
|
|
613
|
+ caseid: this.couponInfo.CaseId
|
|
614
|
+ }).then((res) => {
|
|
615
|
+ this.total = res.pagenum
|
|
616
|
+ })
|
|
617
|
+ } else if (this.couponInfo.CouponTypeId === 'course') {
|
|
618
|
+ this.GetCourseList({
|
|
619
|
+ ...this.postData,
|
|
620
|
+ caseid: this.couponInfo.CaseId
|
|
621
|
+ }).then((res) => {
|
|
622
|
+ this.total = res.pagenum
|
|
623
|
+ })
|
|
624
|
+ }
|
400
|
625
|
},
|
401
|
626
|
}
|
402
|
627
|
}
|
|
@@ -409,4 +634,7 @@ export default {
|
409
|
634
|
margin-right: 10px;
|
410
|
635
|
}
|
411
|
636
|
}
|
|
637
|
+.mainForm > ul > li > div > div > button {
|
|
638
|
+ margin-top: 0;
|
|
639
|
+}
|
412
|
640
|
</style>
|