|
@@ -26,7 +26,7 @@
|
26
|
26
|
:action='$api.file.image.url'
|
27
|
27
|
:show-file-list="false"
|
28
|
28
|
:on-success="handleAvatarSuccess">
|
29
|
|
- <img v-if="cardInfo.Images[0].CardImageUrl" :src="cardInfo.Images[0].CardImageUrl" class="avatar">
|
|
29
|
+ <img v-if="cardInfo.Images" :src="cardInfo.Images[0].CardImageUrl" class="avatar">
|
30
|
30
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
31
|
31
|
</el-upload>
|
32
|
32
|
</div>
|
|
@@ -225,32 +225,29 @@ export default {
|
225
|
225
|
Type: 'xxx'
|
226
|
226
|
}], // 指定商品数据
|
227
|
227
|
cardInfo: {
|
228
|
|
- CardId: '',
|
229
|
228
|
CardName: '',
|
230
|
229
|
SendType: '',
|
231
|
230
|
VideoUrl: '',
|
232
|
|
- Price: '',
|
|
231
|
+ Price: ' ',
|
233
|
232
|
StartDate: '',
|
234
|
233
|
EndDate: '',
|
235
|
234
|
TotalCount: '',
|
236
|
|
- SentCount: '',
|
237
|
|
- UsedCount: '',
|
238
|
|
- Status: '',
|
239
|
235
|
CaseId: '',
|
240
|
236
|
OrgId: '',
|
241
|
237
|
Share: {
|
242
|
238
|
CardShareInfo: '',
|
243
|
239
|
CardUseRule: '',
|
244
|
|
- CardUseInstruction: '',
|
|
240
|
+ CardUseInstruction: ''
|
245
|
241
|
},
|
246
|
242
|
Images: [{
|
247
|
|
- CardImageUrl: '',
|
|
243
|
+ CardImageUrl: ''
|
248
|
244
|
}],
|
249
|
245
|
Targets: [{
|
250
|
246
|
TargetType: '',
|
251
|
247
|
TargetId: '',
|
252
|
248
|
TargetName: ''
|
253
|
249
|
}],
|
|
250
|
+ ChannelId: ''
|
254
|
251
|
},
|
255
|
252
|
postData: {
|
256
|
253
|
page: 1,
|
|
@@ -264,14 +261,33 @@ export default {
|
264
|
261
|
caseid: this.defaultCaseId,
|
265
|
262
|
page: 1,
|
266
|
263
|
pagesize: 10000
|
267
|
|
- })
|
268
|
|
- this.GetCourseList({
|
269
|
|
- caseid: this.defaultCaseId,
|
270
|
|
- page: 1,
|
271
|
|
- pagesize: 10000
|
272
|
|
- }).then((res) => {
|
273
|
|
- // console.log(JSON.stringify(res))
|
274
|
|
- this.courseList = res.list
|
|
264
|
+ }).then(() => {
|
|
265
|
+ this.GetCourseList({
|
|
266
|
+ caseid: this.defaultCaseId,
|
|
267
|
+ page: 1,
|
|
268
|
+ pagesize: 10000
|
|
269
|
+ }).then((res) => {
|
|
270
|
+ this.courseList = res.list
|
|
271
|
+ if (this.$route.query.id) {
|
|
272
|
+ this.getCardById({
|
|
273
|
+ id: this.$route.query.id
|
|
274
|
+ }).then((res) => {
|
|
275
|
+ // console.log(JSON.stringify(res.Card))
|
|
276
|
+ this.cardInfo = res.Card
|
|
277
|
+ if (res.Card.VideoUrl) {
|
|
278
|
+ this.videoOff = true
|
|
279
|
+ }
|
|
280
|
+ if (res.Card.Images === null) {
|
|
281
|
+ this.cardInfo.Images = [{
|
|
282
|
+ CardImageUrl: ''
|
|
283
|
+ }]
|
|
284
|
+ }
|
|
285
|
+ if (res.Card.StartDate) {
|
|
286
|
+ this.date = [res.Card.StartDate, res.Card.EndDate]
|
|
287
|
+ }
|
|
288
|
+ })
|
|
289
|
+ }
|
|
290
|
+ })
|
275
|
291
|
})
|
276
|
292
|
})
|
277
|
293
|
},
|
|
@@ -349,13 +365,47 @@ export default {
|
349
|
365
|
},
|
350
|
366
|
submit () { // 保存
|
351
|
367
|
if (this.$route.query.id) {
|
352
|
|
- // 1
|
|
368
|
+ if (this.date !== '') {
|
|
369
|
+ this.cardInfo.StartDate = this.date[0]
|
|
370
|
+ this.cardInfo.EndDate = this.date[1]
|
|
371
|
+ }
|
|
372
|
+ for (var x = 0; x < this.courseList.length; x++) {
|
|
373
|
+ if (this.courseList[x].CourseId === this.cardInfo.Targets[0].TargetId) {
|
|
374
|
+ this.cardInfo.Targets[0].TargetType = this.courseList[x].CourseType
|
|
375
|
+ this.cardInfo.Targets[0].TargetName = this.courseList[x].CourseName
|
|
376
|
+ }
|
|
377
|
+ }
|
|
378
|
+ this.cardInfo.TotalCount = this.cardInfo.TotalCount - 0
|
|
379
|
+ console.log(JSON.stringify(this.cardInfo))
|
|
380
|
+ this.editCard(this.cardInfo).then((res) => {
|
|
381
|
+ this.$alert('操作成功', '提示', {
|
|
382
|
+ confirmButtonText: '确定',
|
|
383
|
+ callback: action => {
|
|
384
|
+ this.$router.push({ name: 'cardList' })
|
|
385
|
+ }
|
|
386
|
+ })
|
|
387
|
+ })
|
353
|
388
|
} else {
|
354
|
389
|
this.cardInfo.OrgId = this.OrgId
|
|
390
|
+ if (this.date !== '') {
|
|
391
|
+ this.cardInfo.StartDate = this.date[0]
|
|
392
|
+ this.cardInfo.EndDate = this.date[1]
|
|
393
|
+ }
|
|
394
|
+ for (var n = 0; n < this.courseList.length; n++) {
|
|
395
|
+ if (this.courseList[n].CourseId === this.cardInfo.Targets[0].TargetId) {
|
|
396
|
+ this.cardInfo.Targets[0].TargetType = this.courseList[n].CourseType
|
|
397
|
+ this.cardInfo.Targets[0].TargetName = this.courseList[n].CourseName
|
|
398
|
+ }
|
|
399
|
+ }
|
|
400
|
+ this.cardInfo.TotalCount = this.cardInfo.TotalCount - 0
|
355
|
401
|
console.log(JSON.stringify(this.cardInfo))
|
356
|
|
- this.addCard({
|
357
|
|
- info: this.cardInfo
|
358
|
|
- }).then((res) => {
|
|
402
|
+ this.addCard(this.cardInfo).then((res) => {
|
|
403
|
+ this.$alert('操作成功', '提示', {
|
|
404
|
+ confirmButtonText: '确定',
|
|
405
|
+ callback: action => {
|
|
406
|
+ this.$router.push({ name: 'cardList' })
|
|
407
|
+ }
|
|
408
|
+ })
|
359
|
409
|
})
|
360
|
410
|
}
|
361
|
411
|
},
|