|
@@ -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
|
|
|
|