chenrui 4 vuotta sitten
vanhempi
commit
feb49656fb
1 muutettua tiedostoa jossa 65 lisäystä ja 22 poistoa
  1. 65 22
      src/views/CouponCenter/AddCouponModal.vue

+ 65 - 22
src/views/CouponCenter/AddCouponModal.vue

@@ -28,14 +28,21 @@
               @change="selectChange('couponType')"
               showArrow
               placeholder="请选择优惠券类型"
-              code="COUPON_TYPE"></v-select>
+              code="COUPON_TYPE"
+              :disabled="takeCount > 0"></v-select>
           </a-form-model-item>
         </a-col>
       </a-row>
       <a-row>
         <a-col :span="12" v-if="form.couponType == 'VOUCHER'">
-          <a-form-model-item label="优惠券面额" prop="price">
-            <a-input-number v-model="form.price" :min="0" :max="999999" placeholder="请输入优惠券面额" class="input-number-s" />
+          <a-form-model-item label="优惠券面额" prop="subAmount">
+            <a-input-number
+              v-model="form.subAmount"
+              :disabled="takeCount > 0"
+              :min="1"
+              :max="999999"
+              placeholder="请输入优惠券面额"
+              class="input-number-s" />
             <span class="unit">元</span>
           </a-form-model-item>
         </a-col>
@@ -50,12 +57,19 @@
                     @change="selectChange('isLimitE')"
                     showArrow
                     placeholder="请选择"
-                    code="FLAG"></v-select>
+                    code="FLAG"
+                    :disabled="takeCount > 0"></v-select>
                 </a-form-model-item>
               </a-col>
               <a-col :span="15" v-if="isLimit == '1'">
                 <a-form-model-item prop="limitAmount">
-                  满<a-input-number v-model="form.limitAmount" :min="0" :max="999999" placeholder="限额数值" class="input-number-ms" />元使用
+                  满<a-input-number
+                    v-model="form.limitAmount"
+                    :disabled="takeCount > 0"
+                    :min="1"
+                    :max="999999"
+                    placeholder="限额数值"
+                    class="input-number-ms" />元使用
                 </a-form-model-item>
               </a-col>
             </a-row>
@@ -68,13 +82,25 @@
             <a-row>
               <a-col :span="12">
                 <a-form-model-item prop="limitAmount">
-                  <a-input-number v-model="form.limitAmount" :min="0" :max="999999" placeholder="限额数值" class="input-number-ls" />
+                  <a-input-number
+                    v-model="form.limitAmount"
+                    :disabled="takeCount > 0"
+                    :min="1"
+                    :max="999999"
+                    placeholder="限额数值"
+                    class="input-number-ls" />
                   <span class="unit">减</span>
                 </a-form-model-item>
               </a-col>
               <a-col :span="12">
                 <a-form-model-item prop="subAmount">
-                  <a-input-number v-model="form.subAmount" :min="0" :max="999999" placeholder="减免金额" class="input-number-ls" />
+                  <a-input-number
+                    v-model="form.subAmount"
+                    :disabled="takeCount > 0"
+                    :min="1"
+                    :max="999999"
+                    placeholder="减免金额"
+                    class="input-number-ls" />
                   <span class="unit">元</span>
                 </a-form-model-item>
               </a-col>
@@ -88,12 +114,24 @@
             <a-row :gutter="20">
               <a-col :span="9">
                 <a-form-model-item label="" prop="quotaLimit">
-                  <v-select ref="limitFlag" v-model="form.quotaLimit" showArrow placeholder="请选择" code="LIMIT_FLAG"></v-select>
+                  <v-select
+                    ref="limitFlag"
+                    v-model="form.quotaLimit"
+                    :disabled="takeCount > 0"
+                    showArrow
+                    placeholder="请选择"
+                    code="LIMIT_FLAG"></v-select>
                 </a-form-model-item>
               </a-col>
               <a-col :span="15" v-if="form.quotaLimit == '1'">
                 <a-form-model-item label="" prop="quota">
-                  <a-input-number v-model="form.quota" :min="0" :max="999999" placeholder="请输入限制发放总量" class="input-number-s" />
+                  <a-input-number
+                    v-model="form.quota"
+                    :disabled="takeCount > 0"
+                    :min="1"
+                    :max="999999"
+                    placeholder="请输入限制发放总量"
+                    class="input-number-s" />
                   <span class="unit">份</span>
                 </a-form-model-item>
               </a-col>
@@ -129,7 +167,7 @@
                 <a-row>
                   <a-col :span="11">
                     <a-form-model-item prop="cardholderCouponLimit.limitCount">
-                      <a-input-number v-model="form.cardholderCouponLimit.limitCount" :min="0" :max="999999" placeholder="限领份数" class="input-number-s" />
+                      <a-input-number v-model="form.cardholderCouponLimit.limitCount" :min="1" :max="999999" placeholder="限领份数" class="input-number-s" />
                     </a-form-model-item>
                   </a-col>
                   <a-col :span="4">份/每</a-col>
@@ -163,7 +201,7 @@
                 <a-row>
                   <a-col :span="11">
                     <a-form-model-item prop="normalCouponLimit.limitCount">
-                      <a-input-number v-model="form.normalCouponLimit.limitCount" :min="0" :max="999999" placeholder="限领份数" class="input-number-s" />
+                      <a-input-number v-model="form.normalCouponLimit.limitCount" :min="1" :max="999999" placeholder="限领份数" class="input-number-s" />
                     </a-form-model-item>
                   </a-col>
                   <a-col :span="4">份/每</a-col>
@@ -184,21 +222,27 @@
             <a-row :gutter="20">
               <a-col :span="9">
                 <a-form-model-item prop="validType">
-                  <a-select v-model="form.validType" @change="selectChange('validType')" placeholder="请选择">
+                  <a-select v-model="form.validType" :disabled="takeCount > 0" @change="selectChange('validType')" placeholder="请选择">
                     <a-select-option :value="item.code" v-for="(item, index) in couponValidityList" :key="index">{{ item.dispName }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </a-col>
               <a-col :span="15" v-if="form.validType == 'ABSOLUTE'">
                 <a-form-model-item prop="timeRange">
-                  <a-range-picker v-model="form.timeRange" @change="validDateChange" :disabled-date="disabledDate" format="YYYY-MM-DD" />
+                  <a-range-picker v-model="form.timeRange" :disabled="takeCount > 0" @change="validDateChange" :disabled-date="disabledDate" format="YYYY-MM-DD" />
                 </a-form-model-item>
               </a-col>
               <a-col :span="15" v-if="form.validType == 'RELATIVE'">
                 <a-row>
                   <a-col :span="16">
                     <a-form-model-item prop="validDate">
-                      <a-input-number v-model="form.validDate" :min="0" :max="999999" placeholder="请输入" class="input-number-s" />
+                      <a-input-number
+                        v-model="form.validDate"
+                        :disabled="takeCount > 0"
+                        :min="1"
+                        :max="999999"
+                        placeholder="请输入"
+                        class="input-number-s" />
                     </a-form-model-item>
                   </a-col>
                   <a-col :span="8">天内有效</a-col>
@@ -296,9 +340,8 @@ export default {
         quotaLimit: '0', //  是否限制发放数量(0否 1是)
         quota: '', //  发放数量
         couponType: 'VOUCHER', //  优惠券类型:FULLSUB满减/SUB立减/DISCOUNT折扣券/VOUCHER代金券/PROMOCODE优惠码
-        price: '', //  优惠券金额: 代金券时有效,其它为0
         limitAmount: '', //  限定金额
-        subAmount: '', //  减免
+        subAmount: '', //  满减券 减免 / 代金券面额
         ruleDesc: '', //  规则说明
         normalCouponLimit: { //  非持卡会员
           isLimit: '0', //  是否限制0否1是
@@ -327,9 +370,8 @@ export default {
         title: [{ required: true, message: '请输入优惠券名称', trigger: 'blur' }],
         quota: [{ required: true, message: '请输入限制发放总量', trigger: 'blur' }],
         couponType: [{ required: true, message: '请选择优惠券类型', trigger: 'blur' }],
-        price: [{ required: true, message: '请输入优惠券面额', trigger: 'blur' }],
         limitAmount: [{ required: true, message: '请输入限额数值', trigger: 'blur' }],
-        subAmount: [{ required: true, message: '请输入减免金额', trigger: 'blur' }],
+        subAmount: [{ required: true, message: '请输入金额', trigger: 'blur' }],
         'normalCouponLimit.limitCount': [{ required: true, message: '请输入限领份数', trigger: 'blur' }],
         'cardholderCouponLimit.limitCount': [{ required: true, message: '请输入限领份数', trigger: 'blur' }],
         timeRange: [{ required: true, message: '请选择日期范围', trigger: 'blur' }],
@@ -354,7 +396,8 @@ export default {
         { dispName: '部分', code: '1' }
       ],
       itemQueryList: [], //  适用洗车类型
-      openOutletsModal: false //  选择网点  弹框展示状态
+      openOutletsModal: false, //  选择网点  弹框展示状态
+      takeCount: '' //  发放数量(指客户已领取但未使用的数量)  usedCount(指客户已领取并已使用的数量)
     }
   },
   methods: {
@@ -442,6 +485,7 @@ export default {
       couponToUpdate({ id: id }).then(res => {
         if (res.status == 200) {
           this.setVal(res.data)
+          this.takeCount = res.data.takeCount //  发放数量
         }
       })
     },
@@ -453,7 +497,7 @@ export default {
         this.form.limitAmount = data.limitAmount
         this.form.subAmount = data.subAmount
       } else if (data.couponType === 'VOUCHER') { //  代金券
-        this.form.price = data.price
+        this.form.subAmount = data.subAmount
         this.isLimit = data.isLimit
         this.form.limitAmount = data.limitAmount
       }
@@ -493,7 +537,6 @@ export default {
       if (type == 'couponType') { //  优惠券类型
         this.form.subAmount = ''
         this.form.limitAmount = ''
-        this.form.price = ''
         this.isLimit = '0' //  代金券  是否限额使用(0否,1是)
       } else if (type === 'isLimitE') { //  是否限额使用
         this.form.limitAmount = ''
@@ -512,7 +555,7 @@ export default {
     },
     // 重置表单数据
     resetForm () {
-      const emptyArr = [ 'title', 'quota', 'price', 'limitAmount', 'subAmount', 'ruleDesc', 'startTime', 'endTime', 'validDate' ]
+      const emptyArr = [ 'title', 'quota', 'limitAmount', 'subAmount', 'ruleDesc', 'startTime', 'endTime', 'validDate' ]
       const zeroArr = [ 'quotaLimit', 'isOverlay', 'isStoreLimit' ]
       const array = [ 'timeRange', 'couponScopeList', 'couponStoreList' ]
       emptyArr.map(item => { this.form[item] = '' })