فهرست منبع

关联线下盲票商品、可选优惠券与券包

lsx 2 سال پیش
والد
کامیت
6fa8039020

+ 19 - 14
src/views/business/ticket/components/AwardForm.vue

@@ -56,20 +56,20 @@
         </el-table>
       </div>
       <div class="prize-btn">
-          <el-button type="primary" :disabled="goodsList.length > 0" size="small" @click="goodsCommand('goods', 0)">
-            添加商品
-          </el-button>
-<!--        <el-dropdown @command="goodsCommand($event, index)">-->
-<!--          <el-button type="primary" size="small">-->
-<!--            添加奖品<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--          <el-button type="primary" :disabled="goodsList.length > 0" size="small" @click="goodsCommand('goods', 0)">-->
+<!--            添加商品-->
 <!--          </el-button>-->
-<!--          <el-dropdown-menu slot="dropdown">-->
-<!--            <el-dropdown-item command="goods">商品</el-dropdown-item>-->
-<!--            <el-dropdown-item command="coupon">券</el-dropdown-item>-->
-<!--            <el-dropdown-item command="coupon_pkg">券包</el-dropdown-item>-->
+        <el-dropdown @command="goodsCommand($event, 0)">
+          <el-button type="primary" size="small"  :disabled="goodsList.length > 0">
+            添加奖品<i class="el-icon-arrow-down el-icon--right"></i>
+          </el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item command="goods">商品</el-dropdown-item>
+            <el-dropdown-item command="coupon">券</el-dropdown-item>
+            <el-dropdown-item command="coupon_pkg">券包</el-dropdown-item>
 <!--            <el-dropdown-item command="coin">盲豆</el-dropdown-item>-->
-<!--          </el-dropdown-menu>-->
-<!--        </el-dropdown>-->
+          </el-dropdown-menu>
+        </el-dropdown>
       </div>
     </div>
   </div>
@@ -101,8 +101,13 @@ export default {
   },
   methods: {
     // 添加奖品
-    add(item) {
-      this.goodsList = item;
+    add(type,item) {
+      if(type == 1) {
+        // this.goodsList[this.prizeIndex] = this.goodsList[this.prizeIndex].concat(item);
+        this.goodsList = item
+      } else if (type == 3) {
+        this.goodsList = item
+      }
       this.$emit('input', this.goodsList)
       this.$emit('close')
     },

+ 13 - 1
src/views/business/ticket/components/CouponAdd.vue

@@ -102,6 +102,10 @@ export default {
       type: Boolean,
       default: false,
     },
+    iconic: {
+      type: String,
+      default: '',
+    },
   },
   data() {
     return {
@@ -164,7 +168,15 @@ export default {
         this.msgInfo('请选择券')
         return
       }
-      this.$emit("confirmCoupon", this.selectCouponList);
+      if(this.iconic == 'couponForm'){
+        if(this.selectCouponList.length > 1) {
+          this.msgInfo('只能选择一张券')
+          return
+        }
+        this.$emit("confirmCouponForm", this.selectCouponList);
+      }else {
+        this.$emit("confirmCoupon", this.selectCouponList);
+      }
     },
 
     close() {

+ 14 - 1
src/views/business/ticket/components/CouponPkgAdd.vue

@@ -75,6 +75,10 @@ export default {
       type: Boolean,
       default: false,
     },
+    iconic: {
+      type: String,
+      default: '',
+    },
   },
   data() {
     return {
@@ -130,7 +134,16 @@ export default {
         this.msgInfo('请选择券包')
         return
       }
-      this.$emit("confirmCouponPkg", this.selectCouponPkgList);
+      if(this.iconic == 'couponPkgForm'){
+        if(this.selectCouponPkgList.length > 1) {
+          this.msgInfo('只能选择一个券包')
+          return
+        }
+        this.$emit("confirmCouponPkgForm", this.selectCouponPkgList);
+      }else {
+        this.$emit("confirmCouponPkg", this.selectCouponPkgList);
+      }
+
     },
 
     close() {

+ 31 - 12
src/views/business/ticket/create.vue

@@ -157,9 +157,9 @@
         </el-form>
       </div>
       <!--  关联商品设置 -->
-      <div class="base-info-title"  v-if="form.type != 'offline'">商品设置(购买即可提货)</div>
+      <div class="base-info-title">商品设置(购买即可提货)</div>
 
-      <award-form ref="awardFrom" @close="close" v-model="goodsList" :id="ids"  @goodsCommand="goodsCommand"  v-if="form.type != 'offline'"></award-form>
+      <award-form ref="awardFrom" @close="close" v-model="goodsList" :id="ids"  @goodsCommand="goodsCommand"></award-form>
 
       <!-- 奖级设置 -->
       <div class="base-info-title" >奖级设置</div>
@@ -178,9 +178,9 @@
     <!-- 添加商品 -->
     <goods-add :dialog-visible="goodsTableVisible" @close="close" @confirmGoods="confirmGoods" v-if="goodsTableVisible" />
     <!-- 添加券 -->
-    <coupon-add :dialog-visible="couponTableVisible" @close="close" @confirmCoupon="confirmCoupon" v-if="couponTableVisible" />
+    <coupon-add :dialog-visible="couponTableVisible" :iconic="iconic" @close="close" @confirmCouponForm="confirmCouponForm" @confirmCoupon="confirmCoupon" v-if="couponTableVisible" />
     <!-- 添加券包 -->
-    <coupon-pkg-add :dialog-visible="couponPkgTableVisible" @close="close" @confirmCouponPkg="confirmCouponPkg" v-if="couponPkgTableVisible" />
+    <coupon-pkg-add :dialog-visible="couponPkgTableVisible" :iconic="iconic" @close="close" @confirmCouponPkgForm="confirmCouponPkgForm" @confirmCouponPkg="confirmCouponPkg" v-if="couponPkgTableVisible" />
     <!-- 添加盲豆 -->
     <coin-add :dialog-visible="coinTableVisible" @close="close" @confirmCoin="confirmCoin" v-if="coinTableVisible" />
     <!-- 添加商品 -->
@@ -339,6 +339,7 @@ export default {
         pageSize: 10,
       },
       goodsVisibleForm: false, //添加关联商品弹框
+      iconic: '',//区分添加的是关联商品还是奖品
     };
   },
   computed: {
@@ -376,7 +377,7 @@ export default {
         }
         if(awardsList){
           awardsList.forEach((item) => {
-              item.isEdit = true,
+              item.isEdit = true
               item.prizeList.forEach((ele) => {
                 (ele.picUrl = publicFileGetUrl + ele.picUrl.split(',')[0]),
                 (ele.prizeType = JSON.parse(ele.prizeType).value);
@@ -394,9 +395,9 @@ export default {
               // (item.prizeType = JSON.parse(item.prizeType).value);
               (item.prizeType = 'goods');
           });
-          if(this.$refs.awardFrom && this.form.type != 'offline') {
+          if(this.$refs.awardFrom) {
             this.$nextTick(() => {
-              this.$refs.awardFrom.add(goodsList)
+              this.$refs.awardFrom.add(3,goodsList)
             })
           }
           // this.goodsList = goodsList
@@ -564,15 +565,25 @@ export default {
       if (e == "goods") {
         this.goodsTableVisible = true;
       } else if (e == "coupon") {
+        this.iconic = 'coupon'
         this.couponTableVisible = true;
       } else if (e == "coupon_pkg") {
+        this.iconic = 'couponPkg'
         this.couponPkgTableVisible = true;
       } else if (e == "coin") {
         this.coinTableVisible = true;
       }
     },
-    goodsCommand() {
-      this.goodsVisibleForm = true;
+    goodsCommand(e) {
+      if (e == "goods") {
+        this.goodsVisibleForm = true;
+      } else if (e == "coupon") {
+        this.iconic = 'couponForm'
+        this.couponTableVisible = true;
+      } else if (e == "coupon_pkg") {
+        this.iconic = 'couponPkgForm'
+        this.couponPkgTableVisible = true;
+      }
     },
     // 确认选中商品
     confirmGoods(arr) {
@@ -580,12 +591,12 @@ export default {
     },
 
     // 确认选中卡券
-    confirmCoupon(arr) {;
+    confirmCoupon(arr) {
       this.$refs.awards.add(1, arr)
     },
 
     // 确认选中券包
-    confirmCouponPkg(arr) {;
+    confirmCouponPkg(arr) {
       this.$refs.awards.add(1, arr)
     },
 
@@ -596,7 +607,15 @@ export default {
 
     //选中的关联商品
     confirmGoodsForm(arr) {
-      this.$refs.awardFrom.add(arr)
+      this.$refs.awardFrom.add(1,arr)
+    },
+    // 确认选中关联卡券
+    confirmCouponForm(arr) {
+      this.$refs.awardFrom.add(1, arr)
+    },
+    // 确认选中关联券包
+    confirmCouponPkgForm(arr) {
+      this.$refs.awardFrom.add(1, arr)
     },
 
     // 取消