Browse Source

修改bug

chenrui 1 year ago
parent
commit
d4a31108bc

+ 21 - 4
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -185,9 +185,9 @@
             @click="openGuideModal=true"
             id="promotionList-edit-btn">+导入产品</a-button>
         </div>
-        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
-        <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct"></tableType1></div>
-        <div v-show="chooseVal=='c'"><tableType1 ref="offerProduct"></tableType1></div>
+        <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
+        <div v-show="chooseVal=='b'"><tableType1 :unitTypeList="unitTypeDataList" ref="normalPriceProduct"></tableType1></div>
+        <div v-show="chooseVal=='c'"><tableType1 :unitTypeList="unitTypeDataList" ref="offerProduct"></tableType1></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -205,6 +205,7 @@ import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
 import { promotionSave, getRuleDetail } from '@/api/promotion'
 import ImportGuideModal from './importGuideModal.vue'
+import { getLookUpData } from '@/api/data'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -256,7 +257,9 @@ export default {
       fullGiftRuleList: [{
         regularValue: undefined,
         promotionValue: undefined
-      }]
+      }],
+      code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
+      unitTypeDataList: []
     }
   },
   methods: {
@@ -612,6 +615,18 @@ export default {
         }
       })
       return list
+    },
+    getUnitTypeList () {
+      const _this = this
+      getLookUpData({
+        pageNo: 1,
+        pageSize: 1000,
+        lookupCode: _this.code
+      }).then(res => {
+        if (res.status == 200) {
+          _this.unitTypeDataList = res.data.list
+        }
+      })
     }
   },
   watch: {
@@ -625,6 +640,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {

+ 21 - 9
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -180,9 +180,9 @@
             @click="openGuideModal=true"
             id="promotionList-edit-btn">+导入产品</a-button>
         </div>
-        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
-        <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct"></tableType1></div>
-        <div v-show="chooseVal==('c'+item.id)" v-for="(item,i) in fullGiftRuleList" :key="item.id"><tableType1 :ref="'offerProduct'+i"></tableType1></div>
+        <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
+        <div v-show="chooseVal=='b'"><tableType1 :unitTypeList="unitTypeDataList" ref="normalPriceProduct"></tableType1></div>
+        <div v-show="chooseVal==('c'+item.id)" v-for="(item,i) in fullGiftRuleList" :key="item.id"><tableType1 :unitTypeList="unitTypeDataList" :ref="'offerProduct'+i"></tableType1></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -200,6 +200,7 @@ import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
 import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
 import ImportGuideModal from './importGuideModal.vue'
+import { getLookUpData } from '@/api/data'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -260,15 +261,12 @@ export default {
       },
       chooseVal: 'a',
       openGuideModal: false, // 导入弹窗
-      id: null
+      id: null,
+      code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
+      unitTypeDataList: []
     }
   },
   methods: {
-    // 生成随机id
-    async generateRandomString () {
-      const result = await getNewScopeSn({})
-      this.id = result.data
-    },
     // 单位切换时,满赠规则数据清空
     handleChangeUnit (e) {
       this.form.regularUnit = e
@@ -652,6 +650,18 @@ export default {
         }
       })
       return list
+    },
+    getUnitTypeList () {
+      const _this = this
+      getLookUpData({
+        pageNo: 1,
+        pageSize: 1000,
+        lookupCode: _this.code
+      }).then(res => {
+        if (res.status == 200) {
+          _this.unitTypeDataList = res.data.list
+        }
+      })
     }
   },
   watch: {
@@ -665,6 +675,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {

+ 31 - 7
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -194,8 +194,8 @@
               @click="addProducts">+新增产品</a-button>
           </div>
         </div>
-        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
-        <div v-show="chooseVal=='d'"><tableType3 :setData="setTableData" :rulesType="form.discountType" ref="specialProduct"></tableType3></div>
+        <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
+        <div v-show="chooseVal=='d'"><tableType3 :setData="setTableData" :rulesType="form.discountType" :unitTypeList="unitTypeDataList" ref="specialProduct"></tableType3></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -220,9 +220,10 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
 import tableType3 from './tableType3.vue'
-import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
+import { promotionSave, getRuleDetail } from '@/api/promotion'
 import chooseProductsModal from './chooseProductsModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
+import { getLookUpData } from '@/api/data'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -270,7 +271,9 @@ export default {
       chooseVal: 'a',
       openProductsModal: false,
       chooseProducts: [],
-      openGuideModal: false // 导入弹窗
+      openGuideModal: false, // 导入弹窗
+      code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
+      unitTypeDataList: []
     }
   },
   computed: {
@@ -721,15 +724,22 @@ export default {
         _this.handleProductsOk(newConArr)
       }
     },
+    // 生成随机数
+    generateUniqueRandomNumber () {
+      const timestamp = new Date().getTime()
+      const randomNumber = Math.floor(Math.random() * 1e5).toString().padStart(5, '0')
+      const uniqueRandomNumber = timestamp + randomNumber
+      return uniqueRandomNumber
+    },
     // +新增产品
     handleProductsOk (con) {
       const _this = this
       con.forEach(async (item) => {
         const chooseProductsList = []
-        const getSn = await getNewScopeSn({})
-        if (getSn.status == 200) {
+        const getSn = this.generateUniqueRandomNumber()
+        if (getSn) {
           const newData = {
-            productScopeSn: getSn.data,
+            productScopeSn: getSn,
             dataSourceOrigin: '1',
             productTypeArr: [],
             productTypeList: [],
@@ -778,6 +788,18 @@ export default {
         }
         _this.$refs.specialProduct.setSourceData(chooseProductsList)
       })
+    },
+    getUnitTypeList () {
+      const _this = this
+      getLookUpData({
+        pageNo: 1,
+        pageSize: 1000,
+        lookupCode: _this.code
+      }).then(res => {
+        if (res.status == 200) {
+          _this.unitTypeDataList = res.data.list
+        }
+      })
     }
   },
   watch: {
@@ -791,6 +813,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {

+ 45 - 37
src/views/promotionRulesManagement/dealerPromotions/tableType1.vue

@@ -107,14 +107,17 @@
       </template>
       <!-- 设置起订量 -->
       <template slot="setNum" slot-scope="text, record">
-        <v-select
+        <a-select
+          default-value="SL"
           v-model="record.unitType"
           size="small"
-          ref="returnReason"
-          code="SCOPE_UNIT_TYPE"
-          placeholder="请选择"
           style="width:100%;"
-          allowClear></v-select>
+          placeholder="请选择"
+          allowClear>
+          <a-select-option :value="con.code" v-for="con in unitTypeList" :key="con.id">
+            {{ con.dispName }}
+          </a-select-option>
+        </a-select>
         <a-input-number
           size="small"
           style="margin-top:8px;width:100%;"
@@ -172,12 +175,17 @@ import { VSelect } from '@/components'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
 import chooseProductsModal from './chooseProductsModal.vue'
-import { getNewScopeSn } from '@/api/promotion'
 import { forEach } from 'core-js/library/es6/array'
 export default {
   name: 'TableType1',
   mixins: [commonMixin],
   components: { VSelect, ChooseBrandModal, ChooseTypeModal, chooseProductsModal },
+  props: {
+    unitTypeList: { // 起订类型数据
+      type: Array,
+      default: () => []
+    }
+  },
   data () {
     return {
       spinning: false,
@@ -205,27 +213,30 @@ export default {
       this.chooseProducts = []
       this.openProductsModal = false
     },
+    // 生成随机数
+    generateUniqueRandomNumber () {
+      const timestamp = new Date().getTime()
+      const randomNumber = Math.floor(Math.random() * 1e5).toString().padStart(5, '0')
+      const uniqueRandomNumber = timestamp + randomNumber
+      return uniqueRandomNumber
+    },
     // 新增一行
     handleAddRow () {
       const _this = this
-      _this.spinning = false
-      getNewScopeSn({}).then(res => {
-        if (res.status == 200) {
-          const newData = {
-            productScopeSn: res.data,
-            productTypeArr: [],
-            productTypeList: [],
-            productBrandArr: [],
-            productBrandList: [],
-            productThisList: [],
-            unitType: 'SL',
-            unitQty: 1
-          }
-          _this.dataSource.push(newData)
-        } else {
-          _this.spinning = false
+      const newSn = _this.generateUniqueRandomNumber()
+      if (newSn) {
+        const newData = {
+          productScopeSn: newSn,
+          productTypeArr: [],
+          productTypeList: [],
+          productBrandArr: [],
+          productBrandList: [],
+          productThisList: [],
+          unitType: 'SL',
+          unitQty: 1
         }
-      })
+        _this.dataSource.push(newData)
+      }
     },
     // 导入新增一行
     importRow (list) {
@@ -237,20 +248,17 @@ export default {
       })
       if (list.length > 0) {
         list.forEach(con => {
-          getNewScopeSn({}).then(res => {
-            if (res.status == 200) {
-              const newData = {
-                productScopeSn: res.data,
-                productThisList: [{
-                  productCode: con.productCode,
-                  productSn: con.product.productSn
-                }],
-                unitType: con.unitType,
-                unitQty: con.unitQty
-              }
-              _this.dataSource.push(newData)
-            }
-          })
+          const newSn = _this.generateUniqueRandomNumber()
+          const newData = {
+            productScopeSn: newSn,
+            productThisList: [{
+              productCode: con.productCode,
+              productSn: con.product.productSn
+            }],
+            unitType: con.unitType,
+            unitQty: con.unitQty
+          }
+          _this.dataSource.push(newData)
         })
       } else {
         _this.$message.warning('请勿导入重复数据!')

+ 29 - 26
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -223,14 +223,11 @@
       </template>
       <!-- 设置起订量 -->
       <template slot="setNum" slot-scope="text, record">
-        <v-select
-          v-model="record.unitType"
-          size="small"
-          ref="returnReason"
-          code="SCOPE_UNIT_TYPE"
-          style="width:100%;"
-          placeholder="请选择"
-          allowClear></v-select>
+        <a-select default-value="SL" v-model="record.unitType" size="small" style="width:100%;"  placeholder="请选择" allowClear>
+          <a-select-option :value="con.code" v-for="con in unitTypeList" :key="con.id">
+            {{con.dispName}}
+          </a-select-option>
+        </a-select>
         <a-input-number
           size="small"
           style="margin-top:8px;width:100%;"
@@ -279,7 +276,6 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
-import { getNewScopeSn } from '@/api/promotion'
 export default {
   name: 'TableType3',
   mixins: [commonMixin],
@@ -296,6 +292,10 @@ export default {
     setData: {
       type: Array,
       default: () => []
+    },
+    unitTypeList:{
+      type: Array,
+      default: () => []
     }
   },
   data () {
@@ -362,27 +362,30 @@ export default {
     setSourceData (list) {
       this.dataSource = this.dataSource.concat(list)
     },
+    // 生成随机数
+     generateUniqueRandomNumber() {
+        const timestamp = new Date().getTime();
+        const randomNumber = Math.floor(Math.random() * 1e5).toString().padStart(5, '0');
+        const uniqueRandomNumber = timestamp + randomNumber;
+       return uniqueRandomNumber
+      },
     // 新增一行
     handleAddRow () {
       const _this = this
-      _this.spinning = false
-      getNewScopeSn({}).then(res => {
-        if (res.status == 200) {
-          const newData = {
-            productScopeSn: res.data,
-            dataSourceOrigin: '0',
-            productTypeArr: [],
-            productTypeList: [],
-            productBrandArr: [],
-            productBrandList: [],
-            unitType: 'SL',
-            unitQty: 1
-          }
-          _this.dataSource.push(newData)
-        } else {
-          _this.spinning = false
+      let newSn = _this.generateUniqueRandomNumber()
+      if(newSn){
+        let newData = {
+          productScopeSn: newSn,
+          dataSourceOrigin: '0',
+          productTypeArr: [],
+          productTypeList: [],
+          productBrandArr: [],
+          productBrandList: [],
+          unitType: 'SL',
+          unitQty: 1
         }
-      })
+        _this.dataSource.push(newData)
+      }
     },
     // 删除一行
     handleDel (row) {