chenrui 11 hónapja
szülő
commit
ccbc974799

+ 43 - 18
src/views/promotionRulesManagement/promotionManagement/edit.vue

@@ -76,6 +76,7 @@
                   code="PROMO_CONTENT_TYPE"
                   showType="radio"
                   :disabled="isDisabled"
+                  @change="changeContentType"
                   allowClear></v-select>
               </a-form-model-item>
             </a-col>
@@ -117,8 +118,9 @@
                   :maxLength="100"
                   v-model.trim="form.contentLink"
                   placeholder="请输入跳转链接"
+                  @blur="handleLink"
                   allowClear />
-                <a-select id="promotionEdit-title" default-value="货架促销" style="width: 120px;margin-left:10px;" v-model="form.linkType">
+                <a-select id="promotionEdit-title" default-value="货架促销" @change="handleLinkType" style="width: 120px;margin-left:10px;" v-model="form.linkType">
                   <a-select-option value="1">
                     货架促销
                   </a-select-option>
@@ -130,9 +132,9 @@
             </a-col>
           </a-row>
           <!-- 参数配置 -->
-          <a-row style="width:83%;margin:0 auto 24px;" v-if="form.contentType =='LINK'">
+          <a-row style="width:83%;margin:0 auto 24px;" v-if="form.contentType =='LINK'&&form.linkType!='2'">
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-              <a-checkbox @change="onChangeParams">参数配置</a-checkbox>
+              <a-checkbox @change="onChangeParams" :disabled="isDisabled">参数配置</a-checkbox>
             </a-col>
             <a-col
               :xs="24"
@@ -142,7 +144,7 @@
               :xl="24"
               v-show="isShowParams">
               <!-- 参数配置内容 -->
-              <setPromotion style="margin-top:20px;" @addProduct="insterProduct"></setPromotion>
+              <setPromotion style="margin-top:20px;" :disabledVal="isDisabled" @addProduct="insterProduct"></setPromotion>
             </a-col>
           </a-row>
           <a-row>
@@ -227,7 +229,7 @@ export default {
         enabledFlag: '0',
         sort: undefined,
         contentLink: '',
-        linkType: '1'
+        linkType: undefined
       },
       pageType: undefined, // 页面类型
       showProModal: false,
@@ -274,6 +276,7 @@ export default {
     },
     // 返回列表
     handleBack () {
+      this.resetSearchForm()
       this.$router.push({ name: 'promotionManagementList', query: { closeLastOldTab: true } })
     },
     // 预览
@@ -381,28 +384,50 @@ export default {
         showFlag: '0',
         content: '',
         enabledFlag: '0',
-        sort: undefined
+        sort: undefined,
+        contentLink: '',
+        linkType: undefined
       }
       this.images = []
       this.isDisabled = false
       this.$refs.ruleForm.resetFields()
-      this.$refs.formBox.scrollTop = 0
+    },
+    // 选择内容类型
+    changeContentType (e) {
+      if (e === 'LINK') {
+        this.form.linkType = '1'
+        this.form.contentLink = '/pagesB/promoDetail'
+      } else {
+        this.form.linkType = undefined
+        this.form.contentLink = ''
+      }
+      this.form.contentType = e
+    },
+    // 填入link内容
+    handleLink (con) {
+      if (!con.target.value || con.target.value != '/pagesB/promoDetail') {
+        this.form.linkType = '2'
+      } else {
+        this.form.linkType = '1'
+      }
+      this.form.contentLink = con.target.value
+    },
+    // 选择货架促销填入默认值
+    handleLinkType (val) {
+      this.form.contentLink = val === '2' ? '' : '/pagesB/promoDetail'
+    },
+    pageInit () {
+      this.pageType = this.$route.params.pageType ? this.$route.params.pageType : 'add'
+      if (this.pageType === 'edit' || this.pageType === 'see') {
+        this.getDetail()
+      }
     }
   },
   mounted () {
-    this.pageType = this.$route.params.pageType
-    if (this.pageType == 'edit' || this.pageType == 'see') {
-      this.getDetail()
-    }
-    this.resetSearchForm()
+    this.pageInit()
   },
   activated () {
-    this.pageType = this.$route.params.pageType
-    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
-    if (this.pageType == 'edit' || this.pageType == 'see') {
-      this.getDetail()
-    }
-    this.resetSearchForm()
+    this.pageInit()
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {})

+ 51 - 20
src/views/promotionRulesManagement/promotionManagement/setPromotion.vue

@@ -16,17 +16,30 @@
               ref="saleStatus"
               id="promotion-saleStatus"
               code="PROMO_CONTENT_TYPE"
+              :disabled="disabledVal"
               allowClear></v-select>
           </a-form-model-item>
         </a-col>
         <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
           <a-form-model-item label="券名称" prop="title" :label-col="{span:4}" :wrapper-col="{span:18}">
-            <a-input id="setPromotion-title" :maxLength="20" v-model.trim="sellForm.title" placeholder="请输入券名称(最多20个字符)" allowClear />
+            <a-input
+              :disabled="disabledVal"
+              id="setPromotion-title"
+              :maxLength="20"
+              v-model.trim="sellForm.title"
+              placeholder="请输入券名称(最多20个字符)"
+              allowClear />
           </a-form-model-item>
         </a-col>
         <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
           <a-form-model-item label="券副标题" :label-col="{span:2}" :wrapper-col="{span:18}">
-            <a-input id="setPromotion-title" :maxLength="20" v-model.trim="sellForm.title" placeholder="请输入券副标题(最多20个字符)" allowClear />
+            <a-input
+              :disabled="disabledVal"
+              id="setPromotion-title"
+              :maxLength="20"
+              v-model.trim="sellForm.title"
+              placeholder="请输入券副标题(最多20个字符)"
+              allowClear />
           </a-form-model-item>
         </a-col>
         <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
@@ -37,6 +50,7 @@
                 style="width: 100%"
                 :tree-data="treeData"
                 tree-checkable
+                :disabled="disabledVal"
                 :show-checked-strategy="SHOW_ALL"
                 :getPopupContainer="triggerNode => triggerNode.parentNode"
                 placeholder="请选择产品范围" />
@@ -46,7 +60,7 @@
         </a-col>
         <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
           <a-form-model-item label="生成方式" prop="contentType">
-            <a-radio-group v-model="sellForm.value" @change="onChangeType">
+            <a-radio-group v-model="sellForm.value" @change="onChangeType" :disabled="disabledVal">
               <a-radio :value="1">
                 按订单生成券
               </a-radio>
@@ -71,10 +85,11 @@
                           :step="1"
                           :max="99999999"
                           :precision="0"
+                          :disabled="disabledVal"
                           size="small"/>
                         <a-select
                           default-value="GE"
-                          :disabled="i!=0"
+                          :disabled="disabledVal"
                           v-model="couponForm.regularUnit"
                           style="width: 60px;"
                           size="small"
@@ -88,6 +103,7 @@
                         </a-select>
                         活动产品,送<a-input-number
                           v-model="couponForm.promotionValue"
+                          :disabled="disabledVal"
                           style="margin:0 5px;"
                           :min="0"
                           :step="1"
@@ -96,12 +112,12 @@
                           size="small"/> 元
                       </a-form-model-item>
                       <a-form-model-item label="活动产品" prop="region">
-                        <a-button type="primary" @click="handleAddProduct" size="small">添加产品</a-button>
+                        <a-button type="primary" @click="handleAddProduct" :disabled="disabledVal" size="small">添加产品</a-button>
                         <div class="productCon">
-                          <a-tag closable @close="delBuyerName(con)">
+                          <a-tag closable @close="delBuyerName(con)" :disabled="disabledVal">
                             产品编码
                           </a-tag>
-                          <a-tag closable @close="delBuyerName(con)">
+                          <a-tag closable @close="delBuyerName(con)" :disabled="disabledVal">
                             产品编码
                           </a-tag>
                         </div>
@@ -113,8 +129,8 @@
                   </div>
                 </a-col>
                 <a-col :md="2" :sm="24">
-                  <a-button type="link" class="button-info">+新增</a-button>
-                  <a-button type="link">删除</a-button>
+                  <a-button type="link" class="button-info" :disabled="disabledVal">+新增</a-button>
+                  <a-button type="link" :disabled="disabledVal">删除</a-button>
                 </a-col>
               </a-row>
               <a-row v-show="sellForm.value===2" v-for="item in couponList" :key="item.id">
@@ -129,13 +145,14 @@
                           :step="1"
                           :max="99999999"
                           :precision="0"
+                          :disabled="disabledVal"
                           size="small"/>
                         <a-select
                           default-value="GE"
-                          :disabled="i!=0"
                           v-model="couponForm.regularUnit"
                           style="width: 60px;"
                           size="small"
+                          :disabled="disabledVal"
                           @change="handleChangeUnit">
                           <a-select-option value="GE">
@@ -151,15 +168,16 @@
                           :step="1"
                           :precision="2"
                           :max="99999999"
+                          :disabled="disabledVal"
                           size="small"/> 元
                       </a-form-model-item>
                       <a-form-model-item label="活动产品" prop="region">
-                        <a-button type="primary" @click="handleAddProduct" size="small">添加产品</a-button>
+                        <a-button type="primary" :disabled="disabledVal" @click="handleAddProduct" size="small">添加产品</a-button>
                         <div class="productCon">
-                          <a-tag closable @close="delBuyerName(con)">
+                          <a-tag closable @close="delBuyerName(con)" :disabled="disabledVal">
                             产品编码
                           </a-tag>
-                          <a-tag closable @close="delBuyerName(con)">
+                          <a-tag closable @close="delBuyerName(con)" :disabled="disabledVal">
                             产品编码
                           </a-tag>
                         </div>
@@ -168,14 +186,20 @@
                         全部产品
                       </a-form-model-item>
                       <a-form-model-item label="使用说明" prop="desc">
-                        <a-input v-model="couponForm.desc" style="width:80%;" type="textarea" placeholder="请输入使用说明" :maxLength="200" />
+                        <a-input
+                          v-model="couponForm.desc"
+                          :disabled="disabledVal"
+                          style="width:80%;"
+                          type="textarea"
+                          placeholder="请输入使用说明"
+                          :maxLength="200" />
                       </a-form-model-item>
                     </a-form-model>
                   </div>
                 </a-col>
                 <a-col :md="2" :sm="24">
-                  <a-button type="link" v-if="i===0" class="button-info" @click="addCouponCon">+新增</a-button>
-                  <a-button type="link" v-else @click="delCouponCon(item.id)">删除</a-button>
+                  <a-button type="link" v-if="i===0" class="button-info" @click="addCouponCon" :disabled="disabledVal">+新增</a-button>
+                  <a-button type="link" v-else @click="delCouponCon(item.id)" :disabled="disabledVal">删除</a-button>
                 </a-col>
               </a-row>
             </div>
@@ -189,12 +213,12 @@
           :xl="24"
           v-show="sellForm.value===1">
           <a-form-model-item label="使用说明">
-            <a-input v-model="sellForm.desc" type="textarea" placeholder="请输入使用说明" :maxLength="200" />
+            <a-input v-model="sellForm.desc" type="textarea" placeholder="请输入使用说明" :disabled="disabledVal" :maxLength="200" />
           </a-form-model-item>
         </a-col>
         <a-col :xs="24" :sm="24" :md="12" :lg="24" :xl="24">
           <a-form-model-item label="券有效期">
-            <a-radio-group v-model="sellForm.termVal">
+            <a-radio-group v-model="sellForm.termVal" :disabled="disabledVal">
               <a-radio :style="radioStyle" :value="1">
                 <span>固定日期</span>
                 <a-range-picker
@@ -202,6 +226,7 @@
                   v-model="sellForm.time"
                   :format="dateFormat"
                   @change="dateChange"
+                  :disabled="disabledVal"
                   :placeholder="['开始时间', '结束时间']" />
                   <!-- :disabled-date="disabledDate" -->
               </a-radio>
@@ -211,6 +236,7 @@
                   v-model="sellForm.regularValue"
                   :step="1"
                   :max="99999999"
+                  :disabled="disabledVal"
                   :precision="0"/>天
               </a-radio>
             </a-radio-group>
@@ -218,7 +244,7 @@
         </a-col>
         <a-col :xs="24" :sm="24" :md="12" :lg="24" :xl="24">
           <a-form-model-item label="加盟商编辑" prop="enabledFlag">
-            <a-radio-group button-style="solid" v-model="sellForm.enabledFlag">
+            <a-radio-group button-style="solid" :disabled="disabledVal" v-model="sellForm.enabledFlag">
               <a-radio-button value="1">
               </a-radio-button>
@@ -242,6 +268,12 @@ export default {
   name: 'PromotionAddModal',
   mixins: [commonMixin],
   components: { VSelect },
+  props: {
+    disabledVal: {
+      type: Boolean,
+      default: false
+    }
+  },
   data () {
     return {
       spinning: false,
@@ -315,7 +347,6 @@ export default {
     handleChangeUnit () {},
     // 添加产品
     handleAddProduct () {
-      console.log('111111111111111111:')
       this.$emit('addProduct', true)
     },
     // 生成方式 change