Browse Source

Merge branch 'master' of https://gitee.com/linlinjava/litemall

linlinjava 5 years ago
parent
commit
cd32740e0d
1 changed files with 25 additions and 1 deletions
  1. 25 1
      litemall-admin/src/views/promotion/coupon.vue

+ 25 - 1
litemall-admin/src/views/promotion/coupon.vue

@@ -447,7 +447,18 @@ export default {
     },
     handleUpdate(row) {
       this.dataForm = Object.assign({}, row)
-
+      if (this.dataForm.goodsType === 1) {
+        this.couponCategoryList = []
+        for (let i = 0, len = row.goodsValue.length; i < len; i++) {
+          this.couponCategoryList.push(this.getGoodsCategoryById(row.goodsValue[i]))
+        }
+      }
+      if (this.dataForm.goodsType === 2) {
+        this.couponGoodsList = []
+        for (let i = 0, len = row.goodsValue.length; i < len; i++) {
+          this.couponGoodsList.push(this.getGoodsById(row.goodsValue[i]))
+        }
+      }
       this.dialogStatus = 'update'
       this.dialogFormVisible = true
       this.$nextTick(() => {
@@ -601,6 +612,19 @@ export default {
         }
       })
     },
+    getGoodsCategoryById(id) {
+      let name
+      let parentName
+      for (let i = 0; i < this.goodsCategoryOptions.length; i++) {
+        for (let j = 0; j < this.goodsCategoryOptions[i].children.length; j++) {
+          if (this.goodsCategoryOptions[i].children[j].value === id) {
+            parentName = this.goodsCategoryOptions[i].label
+            name = this.goodsCategoryOptions[i].children[j].label
+          }
+        }
+      }
+      return { goodsCategoryId: id, goodsCategoryName: name, parentCategoryName: parentName }
+    },
     getGoodsCategoryByIds(ids) {
       let name
       let parentName