فهرست منبع

买产品送产品添加id

chenrui 1 سال پیش
والد
کامیت
4ee3f0e6ce

+ 13 - 12
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -198,7 +198,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
-import { promotionSave, getRuleDetail } from '@/api/promotion'
+import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
 import ImportGuideModal from './importGuideModal.vue'
 export default {
   name: 'PromotionListBasicInfoModal',
@@ -227,7 +227,7 @@ export default {
         wrapperCol: { span: 17 }
       },
       fullGiftRuleList: [{
-        id: this.generateRandomString(),
+        id: undefined,
         scopeLevel: undefined,
         regularValue: undefined,
         promotionValue: undefined
@@ -260,14 +260,14 @@ export default {
       },
       chooseVal: 'a',
       openGuideModal: false, // 导入弹窗
-      id: ''
+      id: null
     }
   },
   methods: {
     // 生成随机id
-    generateRandomString () {
-      const result = new Date().getTime() + 'IDNUM'
-      return result
+    async generateRandomString () {
+      const result = await getNewScopeSn({})
+      this.id = result.data
     },
     // 单位切换时,满赠规则数据清空
     handleChangeUnit (e) {
@@ -280,10 +280,10 @@ export default {
       this.chooseVal = e.target.value
     },
     // 新增  满减规则  最多能添加五个
-    addFullGiftRule () {
-      this.id = this.generateRandomString()
+    async addFullGiftRule () {
+      const result = await getNewScopeSn({})
       const obj = {
-        id: this.id,
+        id: result.data,
         scopeLevel: undefined,
         regularValue: undefined,
         promotionValue: undefined
@@ -506,7 +506,7 @@ export default {
       return flag
     },
     // 重置表格
-    resetSearchForm () {
+    async resetSearchForm () {
       this.form = {
         giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例]   满产品送产品写死为: 按比例
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
@@ -536,12 +536,13 @@ export default {
       this.fullGiftRuleList.forEach((val, i) => {
         this.$refs['offerProduct' + i][0].reSetTableData()
       })
+      const result = await getNewScopeSn({})
       this.fullGiftRuleList = [{
-        id: this.generateRandomString(),
+        id: result.data,
         regularValue: undefined,
         promotionValue: undefined
       }]
-      this.id = ''
+      this.id = null
     },
     // 获取编辑详情
     getDetail () {

+ 1 - 1
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -300,7 +300,7 @@ export default {
     },
     handleProvincePrice (e) {
       this.setTableData[0].provinceValue = Number(e.target.value)
-      if (this.setTableData[0].cityValue) {
+      if (this.setTableData[0].cityValue || this.setTableData[0].cityValue == 0) {
         this.setTableData[0].cityValue = Number(e.target.value)
       }
     },