许成详 6 years ago
parent
commit
1e67b8a1ba

+ 26
- 12
src/pages/system/cardAndCouponManager/couponManager/edit.vue View File

132
                 <el-table-column
132
                 <el-table-column
133
                   prop="TargetType"
133
                   prop="TargetType"
134
                   label="分类">
134
                   label="分类">
135
+                  <template slot-scope="scope">
136
+                    {{returnGoodsType(scope.row.TargetType)}}
137
+                  </template>
135
                 </el-table-column>
138
                 </el-table-column>
136
                 <el-table-column label="操作">
139
                 <el-table-column label="操作">
137
                   <template slot-scope="scope">
140
                   <template slot-scope="scope">
409
         page: 1,
412
         page: 1,
410
         pagesize: 10000
413
         pagesize: 10000
411
       }).then(() => {
414
       }).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
-        }
415
+        this.GetGoodTypes({ pagesize: 1000, caseid: this.$route.query.caseid }).then(() => {
416
+          if (this.$route.query.id) {
417
+            this.getCouponById({
418
+              id: this.$route.query.id
419
+            }).then((res) => {
420
+              // console.log(JSON.stringify(res))
421
+              res.coupon.IsAll = String(res.coupon.IsAll)
422
+              if (res.coupon.VideoUrl !== '') {
423
+                this.videoOff = true
424
+              }
425
+              this.couponInfo = res.coupon
426
+            })
427
+          }
428
+        })
424
       })
429
       })
425
     })
430
     })
426
   },
431
   },
434
     }),
439
     }),
435
     ...mapGoodsState({
440
     ...mapGoodsState({
436
       goodsList: x => x.goodsList,
441
       goodsList: x => x.goodsList,
442
+      goodsTypes: x => x.goodsTypes.list,
437
     }),
443
     }),
438
     ...mapCourseState({
444
     ...mapCourseState({
439
       courseList: x => x.courseList,
445
       courseList: x => x.courseList,
450
   methods: {
456
   methods: {
451
     ...mapGoodsActions([
457
     ...mapGoodsActions([
452
       'GetGoodsList',
458
       'GetGoodsList',
459
+      'GetGoodTypes',
453
     ]),
460
     ]),
454
     ...mapCouponActions([
461
     ...mapCouponActions([
455
       'addCoupon',
462
       'addCoupon',
462
     ...mapCourseActions([
469
     ...mapCourseActions([
463
       'GetCourseList',
470
       'GetCourseList',
464
     ]),
471
     ]),
472
+    returnGoodsType (val) {
473
+      for (var n = 0; n < this.goodsTypes.length; n++) {
474
+        if (this.goodsTypes[n].TypeId === val) {
475
+          return this.goodsTypes[n].TypeName
476
+        }
477
+      }
478
+    },
465
     deleteVideo () { // 删除视频
479
     deleteVideo () { // 删除视频
466
       this.couponInfo.VideoUrl = ''
480
       this.couponInfo.VideoUrl = ''
467
       this.videoOff = false
481
       this.videoOff = false

+ 1
- 1
src/pages/system/cardAndCouponManager/couponManager/index.vue View File

282
       this.getList()
282
       this.getList()
283
     },
283
     },
284
     handleEdit (index, row) { // 编辑
284
     handleEdit (index, row) { // 编辑
285
-      this.$router.push({ name: 'editCoupon', query: { type: row.CouponTypeId, id: row.CouponId } })
285
+      this.$router.push({ name: 'editCoupon', query: { type: row.CouponTypeId, id: row.CouponId, caseid: row.CaseId } })
286
     },
286
     },
287
     handleDelete (index, row) { // 删除
287
     handleDelete (index, row) { // 删除
288
       let name = '确认删除渠道“' + row.ChannelName + '”?'
288
       let name = '确认删除渠道“' + row.ChannelName + '”?'

+ 10
- 7
src/store/goods/goods.js View File

38
       })
38
       })
39
     },
39
     },
40
     GetGoodTypes ({ commit }, payload) {
40
     GetGoodTypes ({ commit }, payload) {
41
-      ajax(api.goodsManager.getGoodsTypeList.url, {
42
-        method: api.goodsManager.getGoodsTypeList.method,
43
-        queryData: {
44
-          ...payload,
45
-        }
46
-      }).then(res => {
47
-        commit('updateTypes', res)
41
+      return new Promise((resolve, reject) => {
42
+        ajax(api.goodsManager.getGoodsTypeList.url, {
43
+          method: api.goodsManager.getGoodsTypeList.method,
44
+          queryData: {
45
+            ...payload,
46
+          }
47
+        }).then(res => {
48
+          commit('updateTypes', res)
49
+          resolve(res)
50
+        }).catch(reject)
48
       })
51
       })
49
     },
52
     },
50
     GetGoodSpecs ({ commit }, payload) {
53
     GetGoodSpecs ({ commit }, payload) {