chenrui hace 1 año
padre
commit
d83f482f7c

+ 108 - 37
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -54,53 +54,102 @@
               购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>元,不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
-              购买满
+              购买
               <a-input-number v-model="form.gateAmount" :max="999999" :min="0" :precision="2" size="small"/>
-              元门槛产品,可使用
+              <a-select default-value="1" v-model="form.regularSameFlag" style="width: 50px;margin-left:5px;" size="small">
+                <a-select-option value="1">
+                  元
+                </a-select-option>
+                <a-select-option value="0">
+                  个
+                </a-select-option>
+              </a-select>
+              门槛产品,可采购
               <a-input-number v-model="form.quotaAmount" :max="999999" :min="0" :precision="2" size="small"/>
-              元配额,采购规则中的特价商品(配额算销售额)
+              个特价产品(配额算销售额)
             </div>
           </div>
         </a-form-model-item>
-        <a-form-model-item prop="minOrderFlag" label="订单起订金额">
-          <a-select default-value="1" v-model="form.minOrderFlag" style="width: 160px" size="small">
-            <a-select-option value="0">
-              不限
-            </a-select-option>
+        <a-form-model-item label="特价规则" prop="description">
+          <a-select default-value="1" v-model="form.regularSameFlag" style="width:60%;" size="small">
             <a-select-option value="1">
-              限制
+              各级别价打折
             </a-select-option>
-          </a-select>
-          <a-input-number
-            v-show="form.minOrderFlag && form.minOrderFlag=='1'"
-            size="small"
-            style="margin-left:10px;width:300px;"
-            v-model="form.minOrderAmount"
-            :min="0"
-            :step="1"
-            :max="999999"
-            :precision="2"
-            placeholder="请输入金额"/>
-        </a-form-model-item>
-        <a-form-model-item prop="upperLimitFlag" label="活动经费上限">
-          <a-select default-value="1" v-model="form.upperLimitFlag" style="width: 160px" size="small">
             <a-select-option value="0">
-              不限
-            </a-select-option>
-            <a-select-option value="1">
-              限制
+              各级别价直降
             </a-select-option>
           </a-select>
-          <a-input-number
-            v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
+          <a-table
+            class="sTable"
+            ref="setTable"
             size="small"
-            style="margin-left:10px;width:300px;"
-            v-model="form.upperLimitAmount"
-            :min="0"
-            :step="1"
-            :max="999999"
-            :precision="2"
-            placeholder="请输入金额"/>
+            :rowKey="(record) => record.id"
+            :columns="setColumns"
+            :dataSource="setTableData"
+            :pagination="false"
+            style="width:60%;"
+            bordered>
+            <template slot="provinceDiscount" slot-scope="text, record">
+              <a-input
+                v-model="record.provinceDiscountRate"
+                style="width:80%;"
+                type="number"
+                @input="record.provinceDiscountRate=record.provinceDiscountRate.match(/^\d{1,4}(\.?\d{0,2})/g) ? record.provinceDiscountRate.match(/^\d{1,4}(\.?\d{0,2})/g)[0] : ''"
+                :min="0"
+                placeholder="请输入"
+                size="small"/>%
+            </template>
+            <template slot="cityDiscount" slot-scope="text, record">
+              <a-input
+                v-model="record.provinceDiscountRate"
+                style="width:80%;"
+                type="number"
+                @input="record.provinceDiscountRate=record.provinceDiscountRate.match(/^\d{1,4}(\.?\d{0,2})/g) ? record.provinceDiscountRate.match(/^\d{1,4}(\.?\d{0,2})/g)[0] : ''"
+                :min="0"
+                placeholder="请输入"
+                size="small"/>%
+            </template>
+            <template slot="specialDiscount" slot-scope="text, record">
+              <a-input
+                v-model="record.provinceDiscountRate"
+                style="width:80%;"
+                type="number"
+                @input="record.provinceDiscountRate=record.provinceDiscountRate.match(/^\d{1,4}(\.?\d{0,2})/g) ? record.provinceDiscountRate.match(/^\d{1,4}(\.?\d{0,2})/g)[0] : ''"
+                :min="0"
+                placeholder="请输入"
+                size="small"/>%
+            </template>
+            <template slot="provincePrice" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                v-model="record.unitQty"
+                :min="0"
+                :step="1"
+                :precision="0"
+                :max="999999"
+                placeholder="请输入"/>
+            </template>
+            <template slot="cityPrice" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                v-model="record.unitQty"
+                :min="0"
+                :step="1"
+                :precision="0"
+                :max="999999"
+                placeholder="请输入"/>
+            </template>
+            <template slot="specialPrice" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                v-model="record.unitQty"
+                :min="0"
+                :step="1"
+                :precision="0"
+                :max="999999"
+                placeholder="请输入"/>
+            </template>
+          </a-table>
         </a-form-model-item>
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
@@ -180,6 +229,7 @@ export default {
   },
   data () {
     return {
+      setTableData: [],
       isShow: this.openModal, //  是否打开弹框
       spinning: false,
       formItemLayout: {
@@ -207,7 +257,28 @@ export default {
       chooseVal: 'a',
       openProductsModal: false,
       chooseProducts: [],
-      openGuideModal: false// 导入弹窗
+      openGuideModal: false, // 导入弹窗
+      setFlag: false
+    }
+  },
+  computed: {
+    setColumns () {
+      var arr = []
+      if (this.setFlag) {
+        arr = [
+          { title: '省价折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '33%', align: 'right' },
+          { title: '市价折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '33%', align: 'center' },
+          { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '33%', align: 'center' }
+        ]
+      } else {
+        arr = [
+          { title: '省价直降', scopedSlots: { customRender: 'provincePrice' }, width: '33%', align: 'right' },
+          { title: '市价直降', scopedSlots: { customRender: 'cityPrice' }, width: '33%', align: 'center' },
+          { title: '特约直降', scopedSlots: { customRender: 'specialPrice' }, width: '33%', align: 'center' }
+        ]
+      }
+
+      return arr
     }
   },
   methods: {