Просмотр исходного кода

Merge branch 'develop_yh31' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh31

lilei 1 год назад
Родитель
Сommit
6f4d234880

+ 11 - 13
src/views/promotionRulesManagement/dealerPromotions/detail.vue

@@ -86,7 +86,7 @@
               <div v-if="record.restrictFlag==='1'">限制正价产品{{ record.restrictCategory }}款</div>
             </div>
             <div v-else-if="record.promotionRuleType == 'BUY_PROD_GIVE_MONEY'">
-              <div v-if="record.giveRuleType==='SUM_MONEY'">金额叠加;购买满{{ record.giveRuleList[0].regularValue }}{{ record.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ record.giveRuleList[0].promotionValue }}元<span v-if="record.giveRuleList[0].regularUnit==='YUAN'">({{ record.giveRuleList[0].regularValue!=0?(record.giveRuleList[0].promotionValue/record.giveRuleList[0].regularValue).toFixed(2)*100:0 }}%促销品采购额)</span></div>
+              <div v-if="record.giveRuleType==='SUM_MONEY'">金额叠加;购买满{{ record.giveRuleList[0].regularValue }}{{ record.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ record.giveRuleList[0].promotionValue }}元<span v-if="record.giveRuleList[0].regularUnit==='YUAN'">({{ record.giveRuleList[0].regularValue!=0?(record.giveRuleList[0].promotionValue/record.giveRuleList[0].regularValue).toFixed(2)*100:0 }}%促销品采购额)</span><span v-else>(促销品采购额)</span></div>
               <div v-if="record.giveRuleType==='RATIO' &&record.giveRuleList && record.giveRuleList.length>0 ">
                 <span>按比例;</span>
                 <div v-for="item in record.giveRuleList" :key="item.scopeLevel">
@@ -126,19 +126,17 @@
           </template>
         </s-table>
       </a-card>
-      <div class="footerBtn" v-if="$route.query.type=='rule'">
-        <a-card size="small" :bordered="false">
-          <a-button
-            type="primary"
-            class="button-info"
-            size="large"
-            style="padding:0 40px;"
-            @click="handleSubmit"
-            :disabled="disabled"
-            v-if="$hasPermissions('B_rulesSubmit')&&(mainContentList&&mainContentList.length>0)">提交</a-button>
-        </a-card>
-      </div>
     </a-spin>
+    <div class="affix-cont" v-if="$route.query.type=='rule'">
+      <a-button
+        type="primary"
+        class="button-info"
+        size="large"
+        style="padding:0 40px;"
+        @click="handleSubmit"
+        :disabled="disabled"
+        v-if="$hasPermissions('B_rulesSubmit')&&(mainContentList&&mainContentList.length>0)">提交</a-button>
+    </div>
     <!-- 查看参与客户 -->
     <lookUp-customers-modal ref="lookUpCustomers" :openModal="openCustomerModal" @close="openCustomerModal = false"></lookUp-customers-modal>
     <!-- 促销品费用归属品牌/促销品费用归属品类 -->

+ 12 - 2
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -346,12 +346,22 @@ export default {
             }
           }
           if (_this.form.giveRuleType == 'SUM_MONEY') {
-            if (_this.fullGiftRuleList[0].regularValue <= 0 || _this.fullGiftRuleList[0].promotionValue <= 0) {
+            if (!_this.fullGiftRuleList[0].regularValue || _this.fullGiftRuleList[0].regularValue <= 0) {
+              _this.$message.warning('满赠规则条件不能为空!')
+              return
+            }
+            if (!_this.fullGiftRuleList[0].promotionValue || _this.fullGiftRuleList[0].promotionValue <= 0) {
               _this.$message.warning('满赠规则条件不能为空!')
               return
             }
           } else {
-            const hasNullVal = _this.fullGiftRuleList.some(itemVal => (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0))
+            const hasNullVal = _this.fullGiftRuleList.some(itemVal => {
+              if (itemVal.regularValue && itemVal.promotionValue) {
+                return (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0)
+              } else {
+                return true
+              }
+            })
             if (hasNullVal) {
               _this.$message.warning('满赠规则条件不能为空!')
               return

+ 20 - 13
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
@@ -358,7 +358,13 @@ export default {
               return
             }
           }
-          const hasNullVal = _this.fullGiftRuleList.some(itemVal => (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0))
+          const hasNullVal = _this.fullGiftRuleList.some(itemVal => {
+            if (itemVal.regularValue && itemVal.promotionValue) {
+              return (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0)
+            } else {
+              return true
+            }
+          })
           if (hasNullVal) {
             _this.$message.warning('满赠规则条件不能为空!')
             return
@@ -506,7 +512,7 @@ export default {
       return flag
     },
     // 重置表格
-    resetSearchForm () {
+    async resetSearchForm () {
       this.form = {
         giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例]   满产品送产品写死为: 按比例
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
@@ -536,12 +542,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 () {

+ 36 - 23
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -55,14 +55,14 @@
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
               购买每满
-              <a-input-number v-model="form.gateValue" :max="999999" :min="0" :precision="form.regularUnit==='YUAN'?2:0" size="small"/>
-              <a-select default-value="YUAN" v-model="form.regularUnit" style="width: 50px;margin-left:5px;" size="small" @change="handleUnit">
-                <a-select-option value="YUAN">
-                  元
-                </a-select-option>
+              <a-input-number v-model="form.gateValue" :max="999999" :min="0" :precision="form.regularUnit=='YUAN'?2:0" size="small"/>
+              <a-select default-value="GE" v-model="form.regularUnit" style="width: 50px;margin-left:5px;" size="small" @change="handleUnit">
                 <a-select-option value="GE">
                 </a-select-option>
+                <a-select-option value="YUAN">
+                  元
+                </a-select-option>
               </a-select>
               门槛产品,可采购
               <a-input-number v-model="form.quotaAmount" :max="999999" :min="0" :precision="0" size="small"/>
@@ -148,19 +148,20 @@
                 :min="0"
                 :step="1"
                 :precision="2"
-                :max="record.provinceValue||999999"
+                :max="999999"
                 placeholder="请输入"
                 @blur="handleCityPrice"/>
             </template>
             <template slot="specialPrice" slot-scope="text, record">
               <a-input-number
                 size="small"
-                v-model="record.specialValue"
+                :value="record.specialValue"
                 :min="0"
                 :step="1"
                 :precision="2"
-                :max="record.cityValue||999999"
-                placeholder="请输入"/>
+                :max="999999"
+                placeholder="请输入"
+                @blur="handleSpecialPrice"/>
             </template>
           </a-table>
         </a-form-model-item>
@@ -254,7 +255,7 @@ export default {
         gateFlag: '0', // 门槛
         gateType: undefined,
         gateValue: undefined,
-        regularUnit: 'YUAN',
+        regularUnit: 'GE',
         quotaAmount: undefined,
         discountType: '0', // 特价规则
         gateInfo: undefined,
@@ -300,13 +301,13 @@ export default {
     },
     handleProvincePrice (e) {
       this.setTableData[0].provinceValue = Number(e.target.value)
-      if (this.setTableData[0].cityValue) {
-        this.setTableData[0].cityValue = Number(e.target.value)
-      }
     },
     handleCityPrice (e) {
       this.setTableData[0].cityValue = Number(e.target.value)
     },
+    handleSpecialPrice (e) {
+      this.setTableData[0].specialValue = Number(e.target.value)
+    },
     // 特价规则切换时清空数据
     handleDiscountType (val) {
       this.form.discountType = val
@@ -357,6 +358,13 @@ export default {
               return
             }
           }
+          // 判断特价规则必填
+          if (_this.form.discountType != '0' && _this.setTableData) {
+            if (!_this.setTableData[0].provinceValue || !_this.setTableData[0].cityValue || !_this.setTableData[0].specialValue) {
+              _this.$message.warning('特价规则条件不能为空!')
+              return
+            }
+          }
           const form = JSON.parse(JSON.stringify(_this.form))
           if (form.gateFlag === '1') {
             form.gateProductList = _this.$refs.cillProduct.getResultVal()
@@ -383,16 +391,21 @@ export default {
             form.gateType = undefined
           }
           form.specialProductList = _this.$refs.specialProduct.getResultVal()
-          // 为空判断
-          const isTypeEmpty = form.specialProductList.some(item => (item.productTypeList && item.productTypeList.length == 0) && (item.productBrandList && item.productBrandList.length == 0))
-          if (isTypeEmpty) {
-            _this.$message.warning('产品分类或品牌不能为空!')
-            return
-          }
-          const isNumEmpty = form.specialProductList.some(item => (!item.unitType || !item.unitQty))
-          if (isNumEmpty) {
-            _this.$message.warning('订单起订量设置不能为空!')
+          if (form.specialProductList.length == 0) {
+            _this.$message.warning('请添加特价产品!')
             return
+          } else {
+            // 为空判断
+            const isTypeEmpty = form.specialProductList.some(item => (item.productTypeList && item.productTypeList.length == 0) && (item.productBrandList && item.productBrandList.length == 0))
+            if (isTypeEmpty) {
+              _this.$message.warning('产品分类或品牌不能为空!')
+              return
+            }
+            const isNumEmpty = form.specialProductList.some(item => (!item.unitType || !item.unitQty))
+            if (isNumEmpty) {
+              _this.$message.warning('订单起订量设置不能为空!')
+              return
+            }
           }
           if (form.discountType === '0') { // 手动输入
             const isCountEmpty = _this.isNumEmpty(form.specialProductList)
@@ -498,7 +511,7 @@ export default {
         gateFlag: '0', // 门槛
         gateType: undefined,
         gateValue: undefined,
-        regularUnit: 'YUAN',
+        regularUnit: 'GE',
         quotaAmount: undefined,
         discountType: '0', // 特价规则
         gateProductList: undefined,

+ 6 - 6
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -101,7 +101,7 @@
         <div v-else >
           <div v-if="record.provincePrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
             <span v-if="rulesType=='1'">{{ (setData[0].provinceValue||setData[0].provinceValue==0)?(record.provincePrice*setData[0].provinceValue/100).toFixed(2):'--' }}</span>
-            <span v-else>{{ (setData[0].provinceValue||setData[0].provinceValue==0)?(record.provincePrice - setData[0].provinceValue):'--' }}</span>
+            <span v-else>{{ (setData[0].provinceValue||setData[0].provinceValue==0)?(record.provincePrice - setData[0].provinceValue).toFixed(2):'--' }}</span>
           </div>
           <span v-else>--</span>
         </div>
@@ -124,7 +124,7 @@
         </div>
         <div v-else>
           <span v-if="rulesType=='1'">{{ (setData[0].provinceValue||setData[0].provinceValue==0)?setData[0].provinceValue+'%':'--' }}</span>
-          <span v-else>{{ (setData[0].provinceValue || setData[0].provinceValue==0)?'-'+(setData[0].provinceValue).toFixed(2):'--' }}</span>
+          <span v-else>{{ setData[0].provinceValue?'-'+(setData[0].provinceValue).toFixed(2):setData[0].provinceValue==0?'0.00':'--' }}</span>
         </div>
       </template>
       <!-- 市价特价 -->
@@ -148,7 +148,7 @@
         <div v-else >
           <div v-if="record.cityPrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
             <span v-if="rulesType=='1'">{{ (setData[0].cityValue||setData[0].cityValue==0)?(record.cityPrice*setData[0].cityValue/100).toFixed(2):'--' }}</span>
-            <span v-else>{{ (setData[0].cityValue||setData[0].cityValue==0)?(record.cityPrice - setData[0].cityValue):'--' }}</span>
+            <span v-else>{{ (setData[0].cityValue||setData[0].cityValue==0)?(record.cityPrice - setData[0].cityValue).toFixed(2):'--' }}</span>
           </div>
           <span v-else>--</span>
         </div>
@@ -171,7 +171,7 @@
         </div>
         <div v-else>
           <span v-if="rulesType=='1'">{{ (setData[0].cityValue||setData[0].cityValue==0)?setData[0].cityValue+'%':'--' }}</span>
-          <span v-else>{{ (setData[0].cityValue || setData[0].cityValue==0)?'-'+(setData[0].cityValue).toFixed(2):'--' }}</span>
+          <span v-else>{{ setData[0].cityValue?'-'+(setData[0].cityValue).toFixed(2):setData[0].cityValue==0?'0.00':'--' }}</span>
         </div>
       </template>
       <!-- 特约特价 -->
@@ -195,7 +195,7 @@
         <div v-else>
           <div v-if="record.specialPrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
             <span v-if="rulesType=='1'">{{ (setData[0].specialValue||setData[0].specialValue==0)?(record.specialPrice*setData[0].specialValue/100).toFixed(2):'--' }}</span>
-            <span v-else>{{ (setData[0].specialValue||setData[0].specialValue==0)?(record.specialPrice - setData[0].specialValue):'--' }}</span>
+            <span v-else>{{ (setData[0].specialValue||setData[0].specialValue==0)?(record.specialPrice - setData[0].specialValue).toFixed(2):'--' }}</span>
           </div>
           <span v-else>--</span>
         </div>
@@ -218,7 +218,7 @@
         </div>
         <div v-else>
           <span v-if="rulesType=='1'">{{ (setData[0].specialValue||setData[0].specialValue==0)?setData[0].specialValue+'%':'--' }}</span>
-          <span v-else>{{ (setData[0].specialValue || setData[0].specialValue==0)?'-'+(setData[0].specialValue).toFixed(2):'--' }}</span>
+          <span v-else>{{ setData[0].specialValue?'-'+(setData[0].specialValue).toFixed(2):setData[0].specialValue==0?'0.00':'--' }}</span>
         </div>
       </template>
       <!-- 设置起订量 -->