Browse Source

经销商促销详情显示

chenrui 1 year ago
parent
commit
79ceadafc9

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

@@ -72,7 +72,7 @@
                 <span>购买每满{{ record.gateValue }}{{ record.regularUnit==='YUAN'?'元':'个' }}门槛产品,可采购{{ record.quotaAmount }}个特价产品</span>
               </span>
             </div>
-            <span v-else>--</span>
+            <span v-else></span>
           </template>
           <!-- 规则 -->
           <template slot="ruleProduct" slot-scope="text, record">

+ 121 - 44
src/views/promotionRulesManagement/dealerPromotions/detailModal.vue

@@ -15,44 +15,60 @@
         :model="form"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="规则简称" v-if="form.description">
-          {{form.description}}
-        </a-form-model-item>
         <a-form-model-item label="规则门槛" v-if="form.gateFlag">
-          {{form.gateFlag==='1'?'有':'无'}}
+          {{ form.gateFlag==='1'?'有':'无' }}
           <div v-if="form.gateFlag==='1'">
-            <span v-if="form.gateType==='RATIO_AMOUNT'">购买门槛产品金额 {{ form.gateAmount*100 }}% 作为配额 </span>
-            <span v-if="form.gateType==='MIN_AMOUNT'">购买门槛产品满最低金额 {{ form.gateAmount }} 元,不限制配额。</span>
-            <span v-if="form.gateType==='FIXED_AMOUNT'">购买满 {{ form.gateAmount }} 元门槛产品,可使用 {{ form.quotaAmount }} 元配额,采购规则中的 {{ form.promotionRuleType!='PROMO_PROD'?'正价':'特价' }} 商品(配额算销售额)</span>
+            <span v-if="form.gateType==='RATIO_AMOUNT'">购买门槛产品金额 {{ form.gateValue*100 }}% 作为配额 </span>
+            <span v-if="form.gateType==='MIN_AMOUNT'">购买门槛产品满最低金额 {{ form.gateValue }} 元,不限制配额。</span>
+            <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType !='PROMO_PROD'">购买满 {{ form.gateValue }} 元门槛产品,可使用 {{ form.quotaAmount }} 元配额,采购规则中的正价商品(配额算销售额)</span>
+            <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType ==='PROMO_PROD'">购买每满 {{ form.gateValue }} {{ form.regularUnit==='YUAN'?'元':'个' }}门槛产品,可采购 {{ form.quotaAmount }} 个特价产品(配额算销售额)</span>
           </div>
         </a-form-model-item>
+        <a-form-model-item label="规则简称" v-if="form.description">
+          {{ form.description }}
+        </a-form-model-item>
         <!-- 买产品送产品 -->
-        <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'">
-          <span>{{ form.regularSameFlag==='1'?'同款':'不同款' }}产品购买满 {{ form.regularQty }} 个正价产品,送 {{ form.promotionQty }} 个促销产品</span>
-          <span v-if="form.restrictFlag&&form.restrictFlag==1">,限制正价产品款数 {{ form.restrictCategory }}</span>
+        <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.giveRuleList&&form.giveRuleList.length>0">
+          <div v-for="item in form.giveRuleList" :key="item.scopeLevel">{{ item.scopeLevel }}、{{ item.regularSameFlag==='1'?'同款':'不同款' }}产品购买满 {{ item.regularValue }} {{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送 {{ item.promotionValue }} 个促销产品</div>
+          <div v-if="form.restrictFlag&&form.restrictFlag==1">限制正价产品{{ form.restrictCategory }}款 </div>
+          <div v-if="form.convertExpenseFlag&&form.convertExpenseFlag==1">可转费用报销单</div>
         </a-form-model-item>
+        <!-- 买产品送采购额 -->
         <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'">
-          购买满 {{ form.regularAmount }} 元正价产品,送 {{ form.giveAmount }} 元({{ perCentNum }}%促销品采购额)
-        </a-form-model-item>
-        <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.accrualFlag">
-          {{form.accrualFlag==='1'?'是':'否'}}
-        </a-form-model-item>
-        <a-form-model-item label="金额叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'&&form.accrualFlag">
-          {{form.accrualFlag==='1'?'是':'否'}}
+          <!--          购买满 {{ form.regularAmount }} 元正价产品,送 {{ form.giveAmount }} 元({{ perCentNum }}%促销品采购额) -->
+          <div>{{ form.giveRuleType==='SUM_MONEY'?'金额叠加':'按比例' }}</div>
+          <div v-if="form.giveRuleType==='SUM_MONEY'">购买满{{ form.giveRuleList[0].regularValue }}{{ form.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ form.giveRuleList[0].promotionValue }}元<span v-if="form.giveRuleList[0].regularUnit==='YUAN'">({{ perCentNum }}%促销品采购额)</span></div>
+          <div v-if="form.giveRuleType==='RATIO' &&form.giveRuleList && form.giveRuleList.length>0 ">
+            <div v-for="item in form.giveRuleList" :key="item.scopeLevel">
+              {{ item.scopeLevel }}、产品购买满{{ item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送该规则订单金额的{{ item.promotionValue }}%为促销品采购额
+            </div>
+          </div>
         </a-form-model-item>
-        <a-form-model-item prop="minOrderFlag" label="订单起订金额">
-          {{form.minOrderFlag==='1'?'限制':'不限'}}
-          {{ form.minOrderAmount? (form.minOrderAmount + '元'):'' }}
+        <!-- 特价产品 -->
+        <a-form-model-item label="特价规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='PROMO_PROD'">
+          {{ form.discountType==='0'?'手动输入特价':form.discountType==='1'?'各级别价打折':'各级别价直降' }}
+          <a-table
+            v-show="form.discountType!=0"
+            class="sTable"
+            ref="setTable"
+            size="small"
+            :rowKey="(record) => record.regularValue"
+            rowKeyName="regularValue"
+            :columns="setColumns"
+            :data-source="setTableData"
+            :pagination="false"
+            style="width:60%;"
+            bordered>
+          </a-table>
         </a-form-model-item>
-        <a-form-model-item prop="upperLimitFlag" label="活动经费上限">
-          {{form.upperLimitFlag==='1'?'限制':'不限'}}
-          {{ form.upperLimitAmount?(form.upperLimitAmount+'元'):'' }}
+        <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.accrualFlag">
+          {{ form.accrualFlag==='1'?'是':'否' }}
         </a-form-model-item>
         <a-form-model-item label="促销品是否与正品一致" v-if="form.regularPromotionSameFlag" prop="regularPromotionSameFlag">
-          {{form.regularPromotionSameFlag==='1'?'是':'否'}}
+          {{ form.regularPromotionSameFlag==='1'?'是':'否' }}
         </a-form-model-item>
         <a-form-model-item label="采购额适用范围" v-if="form.scopeFlag" prop="scopeFlag" >
-          {{form.scopeFlag==='1'?'全部产品':'部分产品'}}
+          {{ form.scopeFlag==='1'?'全部产品':'部分产品' }}
         </a-form-model-item>
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
@@ -63,15 +79,18 @@
           <a-radio-button value="b" v-show="form.promotionRuleType!='PROMO_PROD'">
             正价产品
           </a-radio-button>
-          <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'||form.scopeFlag==='0'">
+          <a-radio-button value="c" v-show="(form.regularPromotionSameFlag==='0'||form.scopeFlag==='0')&&form.promotionRuleType!='BUY_PROD_GIVE_PROD'">
             促销产品
           </a-radio-button>
+          <a-radio-button :value="'c'+i" v-for="(item,i) in form.giveRuleList" :key="i" v-show="(form.regularPromotionSameFlag==='0'||form.scopeFlag==='0')&&form.promotionRuleType=='BUY_PROD_GIVE_PROD'&&form.giveRuleList">
+            {{ i==0?'促销产品':'阶梯'+i+'促销产品' }}
+          </a-radio-button>
           <a-radio-button value="d" v-show="form.promotionRuleType=='PROMO_PROD'">
             特价产品
           </a-radio-button>
         </a-radio-group>
         <!-- 列表 -->
-        <div v-show="chooseVal!='d'">
+        <div v-show="chooseVal==='a'||chooseVal==='b'||chooseVal==='c'">
           <a-table
             class="sTable"
             style="margin-top:10px;max-height:340px;"
@@ -109,6 +128,45 @@
             </template>
           </a-table>
         </div>
+        <!-- 买产品送产品列表 -->
+        <div v-for="(con,k) in form.giveRuleList" :key="k" v-show="chooseVal==('c'+k)">
+          <a-table
+            class="sTable"
+            style="margin-top:10px;max-height:340px;"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.id"
+            :columns="columns"
+            :data-source="form.giftProductMap['GIFT'+(k*1+1)]"
+            :scroll="{ y: 330 }"
+            :pagination="false"
+            bordered
+          >
+            <!-- 产品分类 -->
+            <template slot="productType" slot-scope="text, record">
+              <div class="tabBox" v-if="record.productTypeList && record.productTypeList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName3? item.productTypeName2+'/'+item.productTypeName3:(item.productTypeName2&&!item.productTypeName3)?item.productTypeName2:item.productTypeName1 }}</a-tag>
+              </div>
+            </template>
+            <!-- 品牌 -->
+            <template slot="productBrand" slot-scope="text, record">
+              <div class="tabBox" v-if="record.productBrandList && record.productBrandList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
+              </div>
+            </template>
+            <!-- 产品 -->
+            <template slot="product" slot-scope="text, record">
+              <div class="tabBox" v-if="record.productThisList && record.productThisList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
+              </div>
+            </template>
+            <!-- 设置起订量 -->
+            <template slot="setNum" slot-scope="text, record">
+              <a-tag style="width:60%;margin-bottom:5px;margin-right:0;">{{ record.unitTypeDictValue }}</a-tag>
+              <a-tag style="width:60%;margin-right:0;">{{ record.unitQty }}</a-tag>
+            </template>
+          </a-table>
+        </div>
         <!-- 特价产品 -->
         <div v-show="chooseVal=='d'">
           <a-table
@@ -159,12 +217,10 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { STable } from '@/components'
 import { getRuleDetail } from '@/api/promotion'
 export default {
   name: 'DetailModal',
   mixins: [commonMixin],
-  components: { STable },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -187,7 +243,7 @@ export default {
       form: {
         promotionRuleType: undefined,
         gateFlag: undefined, // 门槛
-        gateAmount: undefined,
+        gateValue: undefined,
         quotaAmount: undefined,
         regularSameFlag: undefined, // 满赠规则  不同款商品
         regularQty: undefined,
@@ -223,25 +279,37 @@ export default {
         { title: '特约特价', dataIndex: 'specialDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
         { title: '设置起订量', width: '7%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
-      ]
-    }
-  },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
+      ],
+      columns: [
         { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
         { title: '品牌', width: '35%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
         { title: '产品', width: '35%', scopedSlots: { customRender: 'product' }, align: 'center' },
         { title: '设置起订量', width: '20%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
       ]
-      if (_this.chooseVal == 'c') {
-        arr.pop()
+    }
+  },
+  computed: {
+    perCentNum () {
+      const val = (this.form.giveRuleList[0].regularValue && this.form.giveRuleList[0].regularValue != 0) ? Math.floor(((this.form.giveRuleList[0].promotionValue / this.form.giveRuleList[0].regularValue) * 100).toFixed(2)) : 0
+      return val
+    },
+    setColumns () {
+      const _this = this
+      var arr = []
+      if (_this.form.discountType === '1') {
+        arr = [
+          { title: '省价折扣', dataIndex: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '市价折扣', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '特约折扣', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } }
+        ]
+      } else if (_this.form.discountType === '2') {
+        arr = [
+          { title: '省价直降', dataIndex: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '市价直降', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '特约直降', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } }
+        ]
       }
       return arr
-    },
-    perCentNum () {
-      return Math.floor(((this.form.giveAmount / this.form.regularAmount) * 100).toFixed(2))
     }
   },
   methods: {
@@ -250,7 +318,7 @@ export default {
       this.form = {
         promotionRuleType: undefined,
         gateFlag: undefined, // 门槛
-        gateAmount: undefined,
+        gateValue: undefined,
         quotaAmount: undefined,
         regularSameFlag: undefined, // 满赠规则  不同款商品
         regularQty: undefined,
@@ -272,8 +340,17 @@ export default {
       getRuleDetail({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
           const resultObj = res.data
-          this.chooseVal = resultObj.gateFlag == '1' ? 'a' : resultObj.promotionRuleType == 'PROMO_PROD' ? 'd' : 'b'
+          if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
+            this.chooseVal = 'c0'
+          } else {
+            this.chooseVal = resultObj.gateFlag == '1' ? 'a' : resultObj.promotionRuleType == 'PROMO_PROD' ? 'd' : 'b'
+          }
           this.form = { ...this.form, ...resultObj }
+          this.setTableData = [{
+            provinceValue: this.form.provinceValue,
+            cityValue: this.form.cityValue,
+            specialValue: this.form.specialValue
+          }]
         }
       })
     }

+ 3 - 0
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -479,6 +479,9 @@ export default {
           if (resultObj.gateFlag === '1') {
             resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
           }
+          if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
+            _this.fullGiftRuleList = resultObj.giveRuleList
+          }
           // 重新组成保存数据
           if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
             resultObj.gateProductList = _this.newData(resultObj.gateProductList)

+ 30 - 16
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -183,7 +183,7 @@
         </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'+i)" v-for="(item,i) in fullGiftRuleList" :key="i" ><tableType1 :ref="'offerProduct'+i"></tableType1></div>
+        <div v-show="chooseVal==('c'+i)" v-for="(item,i) in fullGiftRuleList" :key="i"><tableType1 :ref="'offerProduct'+i"></tableType1></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -228,6 +228,7 @@ export default {
         wrapperCol: { span: 17 }
       },
       fullGiftRuleList: [{
+        scopeLevel: undefined,
         regularValue: undefined,
         promotionValue: undefined
       }],
@@ -274,6 +275,7 @@ export default {
     // 新增  满减规则  最多能添加五个
     addFullGiftRule () {
       const obj = {
+        scopeLevel: undefined,
         regularValue: undefined,
         promotionValue: undefined
       }
@@ -384,11 +386,11 @@ export default {
           if (form.regularPromotionSameFlag === '0') { // 促销产品   阶梯促销产品
             const allGiftObj = {}
             _this.fullGiftRuleList.forEach((val, i) => {
-              allGiftObj['GIFT' + i] = _this.$refs['offerProduct' + i][0].getResultVal()
+              allGiftObj['GIFT' + (i * 1 + 1)] = _this.$refs['offerProduct' + i][0].getResultVal()
             })
             var lengthFlag = null
-            for (const con in allGiftObj) {
-              if (allGiftObj[con].length === 0) {
+            for (const key in allGiftObj) {
+              if (allGiftObj[key].length === 0) {
                 lengthFlag = true
               }
             }
@@ -397,12 +399,20 @@ export default {
               return
             }
             const arrFlag = []
-            for (const con in allGiftObj) {
-              if (con.length > 0) {
-                arrFlag.push(_this.isJudge(allGiftObj[con]))
+            for (const key in allGiftObj) {
+              if (allGiftObj[key] && allGiftObj[key].length > 0) {
+                arrFlag.push(_this.isJudge(allGiftObj[key]))
               }
             }
             rowFlag3 = arrFlag.some(val => { return val })
+            // 组数据,添加数组标识
+            let keyPos = 0
+            for (const key in allGiftObj) {
+              keyPos += 1
+              allGiftObj[key].forEach((item, j) => {
+                item.scopeLevel = keyPos
+              })
+            }
             form.giftProductMap = allGiftObj
           } else {
             form.giftProductMap = {}
@@ -499,27 +509,31 @@ export default {
     // 获取编辑详情
     getDetail () {
       const _this = this
-      getRuleDetail({ sn: this.itemSn }).then(res => {
+      getRuleDetail({ sn: _this.itemSn }).then(res => {
         if (res.status == 200) {
           const resultObj = res.data
           _this.chooseVal = resultObj.gateFlag == '0' ? 'b' : 'a'
-          if (resultObj.gateFlag === '1') {
+          if (resultObj.gateFlag == '1') {
             resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
           }
+          if(resultObj.giveRuleList &&resultObj.giveRuleList.length>0){
+            _this.fullGiftRuleList = resultObj.giveRuleList
+            _this.$nextTick(()=>{
+              resultObj.giveRuleList.forEach((item,i)=>{
+                _this.$refs['offerProduct' + i][0].setTabVal(_this.newData(resultObj.giftProductMap['GIFT'+(i*1+1)]))
+              })
+            })
+          }
           // 重新组成保存数据
           if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
             resultObj.gateProductList = _this.newData(resultObj.gateProductList)
-            this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
+            _this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
           }
           if (resultObj.regularProductList && resultObj.regularProductList.length > 0) {
             resultObj.regularProductList = _this.newData(resultObj.regularProductList)
-            this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
-          }
-          if (resultObj.giftProductList && resultObj.giftProductList.length > 0) {
-            resultObj.giftProductList = _this.newData(resultObj.giftProductList)
-            this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
+            _this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
           }
-          this.form = { ...this.form, ...resultObj }
+          _this.form = { ..._this.form, ...resultObj }
         }
       })
     },

+ 12 - 6
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -261,7 +261,11 @@ export default {
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
         discountType: [{ required: true, message: '请选择特价规则', trigger: 'change' }]
       },
-      setTableData: [],
+      setTableData: [{
+        provinceValue: undefined,
+        cityValue: undefined,
+        specialValue: undefined
+      }],
       chooseVal: 'a',
       openProductsModal: false,
       chooseProducts: [],
@@ -285,11 +289,6 @@ export default {
           { title: '特约直降', scopedSlots: { customRender: 'specialPrice' }, width: '33%', align: 'center' }
         ]
       }
-      _this.setTableData = [{
-        provinceValue: undefined,
-        cityValue: undefined,
-        specialValue: undefined
-      }]
       return arr
     }
   },
@@ -490,6 +489,13 @@ export default {
           if (resultObj.gateFlag === '1') {
             resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
           }
+          if (resultObj.discountType != '0') {
+            _this.setTableData = [{
+              provinceValue: resultObj.provinceValue,
+              cityValue: resultObj.cityValue,
+              specialValue: resultObj.specialValue
+            }]
+          }
           // 重新组成保存数据
           if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
             resultObj.gateProductList = _this.newData(resultObj.gateProductList)