|
@@ -246,13 +246,6 @@
|
|
|
this.goodsList.forEach((item,index) => {
|
|
|
item.productList.forEach(pros => {
|
|
|
pros.shopId = item.shopId;
|
|
|
- // if(pros.step === 2){
|
|
|
- // if(pros.productCount % pros.min != 0){
|
|
|
- // pros.productCount = pros.min
|
|
|
- // this.totalShopPeice()
|
|
|
- // this.updateShoppogNum(pros)
|
|
|
- // }
|
|
|
- // }
|
|
|
})
|
|
|
})
|
|
|
this.totalShopPeice()
|
|
@@ -383,44 +376,27 @@
|
|
|
let touchPrice = 0;
|
|
|
let reducedPrice = 0;//商铺合计满减价
|
|
|
this.goodsList.map((item,index)=>{
|
|
|
- //计算店铺满减后店铺合计
|
|
|
- // if(item.promotion && item.promotion.mode == 2){
|
|
|
- // let prosPrice=0;
|
|
|
- // let totalOriginalPrice = 0;//商铺合计原价
|
|
|
- // item.productList.forEach(pros=>{
|
|
|
- // prosPrice += pros.price*pros.productCount
|
|
|
- // totalOriginalPrice += pros.originalPrice*pros.productCount
|
|
|
- // })
|
|
|
- // if(prosPrice >= item.promotion.touchPrice){
|
|
|
- // item.totalPrice = prosPrice - item.promotion.reducedPrice
|
|
|
- // item.reducedPrice = item.promotion.reducedPrice
|
|
|
- // item.totalOriginalPrice = totalOriginalPrice
|
|
|
- // }else{
|
|
|
- // item.reducedPrice = 0 //统计合计价格
|
|
|
- // item.totalPrice = prosPrice
|
|
|
- // }
|
|
|
- // }else{//以下为计算除店铺满减以外的单品满减以及正常商品合计
|
|
|
- let _totalPrice = 0;
|
|
|
- let _reducedPrice = 0;
|
|
|
- let _totalOriginalPrice =0;
|
|
|
- item.productList.forEach(pros=>{
|
|
|
- let _price = pros.retailPrice*pros.productCount
|
|
|
- _totalOriginalPrice += pros.retailPrice*pros.productCount;
|
|
|
- if(pros.promotion && pros.promotion.type != 2 && pros.promotion.mode == 2){
|
|
|
- if(_price >= pros.promotion.touchPrice){
|
|
|
- _price = _price - pros.promotion.reducedPrice
|
|
|
- _reducedPrice += pros.promotion.reducedPrice
|
|
|
- }
|
|
|
- _totalPrice += _price
|
|
|
- }else{
|
|
|
- _reducedPrice = 0;
|
|
|
- _totalPrice += pros.retailPrice*pros.productCount;
|
|
|
+ let _totalPrice = 0;
|
|
|
+ let _reducedPrice = 0;
|
|
|
+ let _totalOriginalPrice =0;
|
|
|
+ item.productList.forEach(pros=>{
|
|
|
+ let _price = pros.retailPrice*pros.productCount
|
|
|
+ _totalOriginalPrice += pros.retailPrice*pros.productCount;
|
|
|
+ if(pros.promotion && pros.promotion.type != 2 && pros.promotion.mode == 2){
|
|
|
+ if(_price >= pros.promotion.touchPrice){
|
|
|
+ _price = _price - pros.promotion.reducedPrice
|
|
|
+ _reducedPrice += pros.promotion.reducedPrice
|
|
|
}
|
|
|
- })
|
|
|
- item.reducedPrice = _reducedPrice
|
|
|
- item.totalOriginalPrice = _totalOriginalPrice
|
|
|
- item.totalPrice = _totalPrice
|
|
|
- // }
|
|
|
+ _totalPrice += _price
|
|
|
+ }else{
|
|
|
+ _reducedPrice = 0;
|
|
|
+ _totalPrice += pros.retailPrice*pros.productCount;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ item.reducedPrice = _reducedPrice
|
|
|
+ item.totalOriginalPrice = _totalOriginalPrice
|
|
|
+ item.totalPrice = _totalPrice
|
|
|
+ console.log(item.totalPrice)
|
|
|
})
|
|
|
},
|
|
|
totalPeice(){//计算总价格,每次调用此方法,将初始值为0,遍历价格并累加
|
|
@@ -453,22 +429,6 @@
|
|
|
reducedPrice += item.reducedprice;
|
|
|
originalPrice += item.originalprice;
|
|
|
})
|
|
|
- // //总促销计算
|
|
|
- // this.promotionsList.forEach(promotions =>{
|
|
|
- // // 凑单满减
|
|
|
- // if(promotion.mode*1===2 && promotion.type*1===2){
|
|
|
- // let total = 0;
|
|
|
- // promotion.productList.forEach(pros=>{
|
|
|
- // if (this.submitIds.includes(pros.productId*1)){
|
|
|
- // total += pros.productCount * pros.price;
|
|
|
- // }
|
|
|
- // });
|
|
|
- // if(total>=promotion.touchPrice){
|
|
|
- // totalPrice -= promotion.reducedPrice;
|
|
|
- // reducedPrice += promotion.reducedPrice;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
//最后统计商品原价
|
|
|
this.totalOriginalPrice = originalPrice;
|
|
|
//最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
|
|
@@ -523,22 +483,24 @@
|
|
|
this.totalShopPeice();
|
|
|
},
|
|
|
changeInput(pros){//输入商品数量更新
|
|
|
- pros.isStep = false
|
|
|
+
|
|
|
},
|
|
|
changeNnmber(e,item,pros){//输入商品数量更新
|
|
|
let _value = Number(e.detail.value);
|
|
|
if(!this.$api.isNumber(_value)){
|
|
|
pros.productCount = pros.minBuyNumber
|
|
|
}else if(_value < pros.minBuyNumber){
|
|
|
+ console.log('111111')
|
|
|
this.$util.msg(`该商品最小起订量为${pros.minBuyNumber}`,2000);
|
|
|
pros.productCount = pros.minBuyNumber
|
|
|
}else if(_value % pros.minBuyNumber != 0){
|
|
|
+ console.log('22222222')
|
|
|
pros.productCount = pros.minBuyNumber
|
|
|
}else{
|
|
|
- pros.productCount = e.detail.value
|
|
|
+ console.log('33333333')
|
|
|
+ pros.productCount = _value
|
|
|
this.processActivityPrice(pros)
|
|
|
}
|
|
|
- console.log('222222222222')
|
|
|
this.updateShoppogNum(pros)
|
|
|
this.totalShopPeice();
|
|
|
},
|