lilei vor 1 Jahr
Ursprung
Commit
a944dc523d

+ 42 - 40
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -283,59 +283,61 @@
                 salesBillSn: this.salesBillSn,
                 showStock: this.showStock,
                 warehouseSn: this.warehouseSn,
-                promotionFlag: this.promoFlag
+                promotionFlag: this.promoFlag == '' ? undefined : this.promoFlag
             }
             const active = this.activeList.filter(item => item.enabledFlag == 1)
 
             // 正常产品
-            const proList = await salesDetailAllList(params).then(res => res.data)
-            const norTotal = await salesDetaiCount(params).then(res => res.data)
+            const hasSearchNormal = !params.promotionFlag || params.promotionFlag == 0
+            const proList = hasSearchNormal ? await salesDetailAllList(params).then(res => res.data) : []
+            const norTotal = hasSearchNormal ? await salesDetaiCount(params).then(res => res.data) : null
             // 没有活动时,表格不显示统计数据
             let listData = active.length ? (proList.length ? [{
                 id: 'promo-normal',
                 total: norTotal
               },...proList] : []) : proList
             
-            // 循环获取活动产品
-            for(let i=0;i<active.length;i++){
-              const promo = active[i]
-              const activeParams = {
-                promoRuleSn: promo.promoRuleSn,
-                promoSn: promo.promoSn,
-                salesPromoSn: promo.salesPromoSn,
-                ...params
-              }
-              
-              // 获取活动产品统计
-              const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
-              if(acTotal){
-                // 采购额结余
-                acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)
-                // 采购额超出
-                acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)
-              }
-              // 有数据时才调用接口,避免做无用的调用
-              if(acTotal&&acTotal.totalQty){
-                // 获取活动产品列表
-                const aclist = await salesDetailAllList(activeParams).then(res => res.data)
-                const retList = aclist.length ? [{
-                  id: 'promo-'+i,
-                  promo: promo,
-                  total: acTotal
-                },...aclist] : []
-                // 将活动产品数据拼接
-                listData = aclist&&aclist.length ? listData.concat(retList) : listData
+            if(params.promotionFlag != 0){  
+              // 循环获取活动产品
+              for(let i=0;i<active.length;i++){
+                const promo = active[i]
+                const activeParams = {
+                  promoRuleSn: promo.promoRuleSn,
+                  promoSn: promo.promoSn,
+                  salesPromoSn: promo.salesPromoSn,
+                  ...params
+                }
+                
+                // 获取活动产品统计
+                const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
+                if(acTotal){
+                  // 采购额结余
+                  acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)
+                  // 采购额超出
+                  acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)
+                }
+                // 有数据时才调用接口,避免做无用的调用
+                if(acTotal&&acTotal.totalQty){
+                  // 获取活动产品列表
+                  const aclist = await salesDetailAllList(activeParams).then(res => res.data)
+                  const retList = aclist.length ? [{
+                    id: 'promo-'+i,
+                    promo: promo,
+                    total: acTotal
+                  },...aclist] : []
+                  // 将活动产品数据拼接
+                  listData = aclist&&aclist.length ? listData.concat(retList) : listData
+                }
               }
-            }
-            console.log(listData)
-            // 如果活动没有任何产品,不显示统计一行
-            if(active.length){
-              const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0)
-              if(hasAcp && hasAcp.length==0){
-                listData = listData.filter(item => item.id.indexOf("promo-")<0) || []
+              console.log(listData)
+              // 如果活动没有任何产品,不显示统计一行
+              if(active.length){
+                const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0)
+                if(hasAcp && hasAcp.length==0){
+                  listData = listData.filter(item => item.id.indexOf("promo-")<0) || []
+                }
               }
             }
-
             console.log(listData)
             this.dataSource = listData
 

+ 45 - 45
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -60,7 +60,7 @@
           </a-col>
           <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
             <a-button type="primary" @click="searchTable" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
-            <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm(null)" id="productInfoList-reset">重置</a-button>
           </a-col>
         </a-row>
       </a-form>
@@ -412,12 +412,11 @@ export default {
         this.queryParam.salesBillSn = this.salesBillSn
         this.queryParam.showStock = true
         const params = this.queryParam
- 
         const active = this.activeList
-
         // 正常产品
-        const proList = await salesDetailAllList(params).then(res => res.data)
-        const norTotal = await salesDetaiCount(params).then(res => res.data)
+        const hasSearchNormal = !params.promotionFlag || params.promotionFlag == 0
+        const proList = hasSearchNormal ? await salesDetailAllList(params).then(res => res.data) : []
+        const norTotal = hasSearchNormal ? await salesDetaiCount(params).then(res => res.data) : null
         // 是否有正常产品
         this.hasNormalProduct = proList.length > 0
         //没有活动时不显示统计
@@ -425,49 +424,50 @@ export default {
             id: 'promo-normal',
             total: norTotal
           },...proList] : []) : proList
-         
-        // 循环获取活动产品
-        for(let i=0;i<active.length;i++){
-          const promo = active[i]
-          const activeParams = {
-            promoRuleSn: promo.promoRuleSn,
-            promoSn: promo.promoSn,
-            salesPromoSn: promo.salesPromoSn,
-            ...params
-          }
-          
-          
-          // 获取活动产品统计
-          const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
-          if(acTotal){
-            // 采购额结余
-            acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)
-            // 采购额超出
-            acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)
-          }
-           
-          // 有数据时才调用接口,避免做无用的调用
-          if(acTotal&&acTotal.totalQty){
-            // 获取活动产品列表
-            const aclist = await salesDetailAllList(activeParams).then(res => res.data)
-            const retList = aclist.length ? [{
-              id: 'promo-'+i,
-              promo: promo,
-              total: acTotal
-            },...aclist] : []
-            // 将活动产品数据拼接
-            listData = aclist&&aclist.length ? listData.concat(retList) : listData
+        
+        if(params.promotionFlag != 0){
+          // 循环获取活动产品
+          for(let i=0;i<active.length;i++){
+            const promo = active[i]
+            const activeParams = {
+              promoRuleSn: promo.promoRuleSn,
+              promoSn: promo.promoSn,
+              salesPromoSn: promo.salesPromoSn,
+              ...params
+            }
+            
+            
+            // 获取活动产品统计
+            const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
+            if(acTotal){
+              // 采购额结余
+              acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)
+              // 采购额超出
+              acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)
+            }
+             
+            // 有数据时才调用接口,避免做无用的调用
+            if(acTotal&&acTotal.totalQty){
+              // 获取活动产品列表
+              const aclist = await salesDetailAllList(activeParams).then(res => res.data)
+              const retList = aclist.length ? [{
+                id: 'promo-'+i,
+                promo: promo,
+                total: acTotal
+              },...aclist] : []
+              // 将活动产品数据拼接
+              listData = aclist&&aclist.length ? listData.concat(retList) : listData
+            }
           }
-        }
-  
-        // 如果活动没有任何产品
-        if(active.length){
-          const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0)
-          if(hasAcp && hasAcp.length==0){
-            listData = listData.filter(item => item.id.indexOf("promo-")<0) || []
+    
+          // 如果活动没有任何产品
+          if(active.length){
+            const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0)
+            if(hasAcp && hasAcp.length==0){
+              listData = listData.filter(item => item.id.indexOf("promo-")<0) || []
+            }
           }
         }
-        
         console.log(listData)
         this.dataSource = listData