lilei 6 月之前
父节点
当前提交
cbf40755ba

+ 2 - 2
src/utils/util.js

@@ -286,12 +286,12 @@ export function getAuthPriceCode (config, router, store) {
     
     // 从所有的权限菜单中查找当前权限code对应的权限菜单数据
     const authNode = treeFind(authTree,(item)=>item.code == authCode)
-    console.log(authNode,url.replace(/\//g,'_'))
+    // console.log(authNode,url.replace(/\//g,'_'))
     if(!authNode){return []}
     if(!authNode.permission){return []}
     // 从找到的对应权限菜单数据中判断当前调用接口的url是否存在,这里和权限菜单中的后台权限code比较
     const hasReqUrl = authNode.permission.split(',').find(item => url.replace(/\//g,'_').indexOf(item)>=0)
-    console.log(hasReqUrl)
+    // console.log(hasReqUrl)
     // 如果存在则返回一个如 [1,0,1,0,0] 的格式的价格权限字符串给后台接口
     if(hasReqUrl&&authNode.children&&authNode.children.length){
       return hasPriceAuth(authNode.children,priceOptions,userAuthCode)

+ 41 - 22
src/views/salesManagement/salesQueryNew/comps/activeStatisticsList.vue

@@ -8,7 +8,7 @@
         border-y
         border-x
         border-around
-        row-key-field-name="id"
+        row-key-field-name="salesPromoSn"
         :checkbox-option="checkboxOption"
         :column-width-resize-option="columnWidthResizeOption"
         :cell-style-option="cellStyleOption"
@@ -29,7 +29,7 @@
     <!-- 查看累计产品 -->
     <totalProductDetailModal ref="totalProductModal" :show="openTotalProductModal" @close="openTotalProductModal=false"></totalProductDetailModal>
     <!-- 查看买赠产品详情 -->
-    <normalProductDetailModal ref="normalProductModal" :openModal="openNormalProductModal" @close="openNormalProductModal=false"></normalProductDetailModal>
+    <normalProductDetailModal ref="normalProductModal" :buyGiftsInfo="buyGiftsInfo" :openModal="openNormalProductModal" @close="openNormalProductModal=false"></normalProductDetailModal>
   </div>
 </template>
 
@@ -99,20 +99,18 @@ export default {
         disableSelectedRowKeys: [],
         // 行选择改变事件
         selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
-          console.log(row, isSelected, selectedRowKeys)
           // 当前勾选产品
           const endSelProduct = selectedRowKeys[selectedRowKeys.length - 1]
           // 叠加多选
-          if (endSelProduct && row.stackFlag == '1') {
-            this.checkboxOption.selectedRowKeys = selectedRowKeys
+          if (endSelProduct && row.promotion && row.promotion.stackFlag == '1') {
+            const rows = this.activeList.filter(item => selectedRowKeys.includes(item.salesPromoSn) && item.promotion && item.promotion.stackFlag == '1')
+            this.checkboxOption.selectedRowKeys = rows.map(item => item.salesPromoSn)
           } else {
             // 非叠加单选
             this.checkboxOption.selectedRowKeys = isSelected ? [endSelProduct] : []
           }
-          console.log(this.checkboxOption.selectedRowKeys)
           // 查询此活动下的已选产品列表
-          const salesPromoSn = this.activeList.filter(item => this.checkboxOption.selectedRowKeys.includes(item.id)).map(item => item.salesPromoSn)
-          this.$emit('selected', isSelected ? salesPromoSn : null)
+          this.$emit('selected', isSelected ? this.checkboxOption.selectedRowKeys : null)
         }
       },
       // 单元格样式
@@ -159,21 +157,30 @@ export default {
             return ++rowIndex
           }
         },
-        { field: 'promotionRuleType',
+        {
+          field: 'promotionRuleType',
           key: 'ruletype',
           width: 100,
           title: '活动类型',
           align: 'center',
           fixed: 'left',
           renderBodyCell: ({ row, column, rowIndex }, h) => {
-            const isRejia = row && row.promotionRule && row.promotionRule.promotionRuleType == 'PROMO_PROD'
-            return (<div style="width:100%;display:flex;justify-content: space-between;">
-              <div style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title={row[column.field]}>{row[column.field]}</div>
-              {isRejia ? <div style="display:flex;">
-                <span style="width:12px;color:#ed1c24;text-align:center;margin-left:5px;cursor:pointer;" onClick={() => _this.moveTjRow(row, rowIndex, 'up')} title="上移">{rowIndex != 0 ? '⇡' : ''}</span>
-                <span style="width:12px;color:#108ee9;text-align:center;cursor:pointer;" onClick={() => _this.moveTjRow(row, rowIndex, 'down')} title="下移">{rowIndex != _this.activeList.length - 1 ? '⇣' : ''}</span>
-              </div> : ''}
-            </div>)
+            const equalWord = <div style="display:flex;">
+              <span style="width:12px;color:#ed1c24;text-align:center;margin-left:5px;cursor:pointer;" onClick={() => _this.moveTjRow(row, rowIndex, 'up')} title="上移">{rowIndex != 0 ? '⇡' : ''}</span>
+              <span style="width:12px;color:#108ee9;text-align:center;cursor:pointer;" onClick={() => _this.moveTjRow(row, rowIndex, 'down')} title="下移">{rowIndex != _this.activeList.length - 1 ? '⇣' : ''}</span>
+            </div>
+            // 买产品送产品  同款产品 是累计产品才弹详情窗
+            if (row.promotionRule.promotionRuleType === 'BUY_PROD_GIVE_PROD' && row.promotion.borrowFlag == '1' && row.promotionRule.regularSameFlag == '1') {
+              return (<div style="width:100%;display:flex;justify-content: space-between;">
+                <div class="table-link-text" onClick={() => _this.showBuyGifts(row)} style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title={row[column.field]}>{row[column.field]}</div>
+                {equalWord}
+              </div>)
+            } else {
+              return (<div style="width:100%;display:flex;justify-content: space-between;">
+                <div style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title={row[column.field]}>{row[column.field]}</div>
+                {equalWord}
+              </div>)
+            }
           }
         },
         { field: 'promotionRuleDesc',
@@ -437,9 +444,10 @@ export default {
       ],
       tableData: [],
       openDetailModal: false, // 规则详情弹框
-      detailSn: null,
+      detailSn: null, // 销售单sn
       disabledActiveOption: null,
-      openGuideModal: false //  导入产品引导
+      openGuideModal: false, //  导入产品引导
+      uyGiftsInfo: null // 买赠产品弹窗详情信息
     }
   },
   methods: {
@@ -474,11 +482,11 @@ export default {
         const purchaseSurplus = (purchaseLimit - purchaseSelected) || 0 // 结余
         const purchaseOverspend = (purchaseSelected - purchaseLimit) || 0 // 超支
         // 特价产品
-        const isYuan2 = item.specialPriceUnit == 'YUAN'
+        const isYuan2 = item.gateRuleUnit == 'YUAN'
         const specialPriceUnit = isYuan2 ? '元' : '个' // 单位
         const specialPriceQuota = (isYuan2 ? item.specialPriceQuotaAmount : item.specialPriceQuotaQty) || 0 // 配额
-        const specialPriceSelected = isYuan2 ? item.specialPriceTotalAmount : item.specialPriceTotalQty || 0 // 已选
-        const specialPriceBalance = specialPriceQuota - specialPriceSelected || 0// 差额 = 配额 - 已选 - 累计
+        const specialPriceSelected = isYuan2 ? item.discountAmount : item.discountQty || 0 // 已选
+        const specialPriceBalance = !specialPriceQuota ? 0 : (specialPriceQuota - specialPriceSelected)// 差额 = 配额 - 已选 - 累计
 
         // 促销品
         this.tableData.push({
@@ -493,6 +501,7 @@ export default {
           geteBalance, // 差额 = 配额 - 已选 - 累计
           // 正价
           regularUnit, // 单位
+          regularQuota, // 配额
           regularSelected, // 已选
           regularTotal, // 累计
           regularBalance, // 差额 = 配额 - 已选 - 累计
@@ -538,6 +547,16 @@ export default {
       this.openTotalProductModal = true
       this.$refs.totalProductModal.pageInit({ salesBillSn: row.salesBillSn, salesPromoSn: row.salesPromoSn })
     },
+    // 显示买赠产品弹窗
+    showBuyGifts (rowVal) {
+      rowVal.promotionRule.salesPromoSn = rowVal.salesPromoSn
+      this.buyGiftsInfo = rowVal.promotionRule
+      this.openNormalProductModal = true
+      const _this = this
+      this.$nextTick(() => {
+        _this.$refs.normalProductModal.resetSearchForm()
+      })
+    },
     // 启用规则
     enabledActive (item) {
       const _this = this

+ 2 - 3
src/views/salesManagement/salesQueryNew/edit.vue

@@ -167,7 +167,7 @@ import {
   salesDetailBySn,
   salesPromoQueryCount,
   salesWriteSubmit,
-  salesPromoQueryStatisticsList,
+  salesPromoQueryList,
   salesPromoDiscountSort,
   salesQueryUnPartPromo,
   salesPromoValidaSubmit,
@@ -271,7 +271,7 @@ export default {
     // 获取销售单参与的活动列表
     async getActiveList () {
       // 已参与活动列表
-      const list = await salesPromoQueryStatisticsList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
+      const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
       this.activeList = list.filter(item => item.promotion && item.promotionRule)
       // 触发活动统计查询变量
       this.$nextTick(() => {
@@ -334,7 +334,6 @@ export default {
     },
     // 获取指定活动的产品列表
     getActiveProduct (active) {
-      console.log(active, 'salesPromoSnSet')
       this.salesPromoSnSet = active
     },
     // 添加活动产品成功的回调,刷新产品列表