|
@@ -94,7 +94,7 @@
|
|
<view class="pros-product">
|
|
<view class="pros-product">
|
|
<view class="producttitle">{{failure.name}}</view>
|
|
<view class="producttitle">{{failure.name}}</view>
|
|
<view class="productspec">规格:{{failure.unit ? failure.unit : ''}}</view>
|
|
<view class="productspec">规格:{{failure.unit ? failure.unit : ''}}</view>
|
|
- <view class="productstate">{{failureStateText(failure.failureState)}}</view>
|
|
|
|
|
|
+ <view class="productstate">{{failureStateText(failure.status)}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="pros-marks" v-if="failure.isFailureLayer"></view>
|
|
<view class="pros-marks" v-if="failure.isFailureLayer"></view>
|
|
</view>
|
|
</view>
|
|
@@ -428,7 +428,14 @@
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- totalPeice(){ //计算总价格,每次调用此方法,将初始值为0,遍历价格并累加
|
|
|
|
|
|
+ totalPeice(){//计算总价格,每次调用此方法,将初始值为0,遍历价格并累加
|
|
|
|
+ /*
|
|
|
|
+ *originalPrice:商品原价
|
|
|
|
+ *price:商品现价
|
|
|
|
+ *mode:促销商品满减计算 促销方式mode为 2 的单独做计算 当mode == 2时商品promotions字段为促销活动内容,
|
|
|
|
+ *touchPrice 为需要满金额
|
|
|
|
+ *reducedPrice 为满减金额
|
|
|
|
+ **/
|
|
this.allPrice = 0
|
|
this.allPrice = 0
|
|
let productsList =[];
|
|
let productsList =[];
|
|
//店铺满减
|
|
//店铺满减
|
|
@@ -445,13 +452,7 @@
|
|
// 正常商品
|
|
// 正常商品
|
|
let _totalNonePrice = 0;
|
|
let _totalNonePrice = 0;
|
|
let _isFlag = false;
|
|
let _isFlag = false;
|
|
- /*
|
|
|
|
- *originalPrice:商品原价
|
|
|
|
- *price:商品现价
|
|
|
|
- *mode:促销商品满减计算 促销方式mode为 2 的单独做计算 当mode == 2时商品promotions字段为促销活动内容,
|
|
|
|
- *touchPrice 为需要满金额
|
|
|
|
- *reducedPrice 为满减金额
|
|
|
|
- **/
|
|
|
|
|
|
+ let _isShopFlag = false;
|
|
this.goodsList.forEach((item,index)=>{
|
|
this.goodsList.forEach((item,index)=>{
|
|
item.cartList.forEach(pros=>{
|
|
item.cartList.forEach(pros=>{
|
|
if(pros.productsChecked){
|
|
if(pros.productsChecked){
|
|
@@ -484,21 +485,29 @@
|
|
_totalPrice += _price //统计合计价格
|
|
_totalPrice += _price //统计合计价格
|
|
}else if(pros.promotions && pros.promotions.type == 2 && pros.promotions.mode == 2){//凑单满减计算合计
|
|
}else if(pros.promotions && pros.promotions.type == 2 && pros.promotions.mode == 2){//凑单满减计算合计
|
|
let _price = 0;
|
|
let _price = 0;
|
|
|
|
+ let reducedPriceList =[];
|
|
|
|
+ let _promsReducedPrice = 0;
|
|
this.promotionsList.forEach(proms =>{
|
|
this.promotionsList.forEach(proms =>{
|
|
|
|
+ if(proms.type == 2 && proms.mode == 2){
|
|
|
|
+ reducedPriceList.push(proms.reducedPrice)
|
|
|
|
+ }
|
|
proms.productList.forEach(el =>{
|
|
proms.productList.forEach(el =>{
|
|
if (pros.productId == el.productId){
|
|
if (pros.productId == el.productId){
|
|
_isFlag = true;
|
|
_isFlag = true;
|
|
_price += pros.price*pros.number
|
|
_price += pros.price*pros.number
|
|
- _totalOriginalPrice += pros.originalPrice*pros.number; //统计原商品价格
|
|
|
|
|
|
+ _totalOriginalPrice += pros.originalPrice*pros.number; //统计原商品价格
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- if(_price >= pros.promotions.touchPrice){//判断如果商品合计价格已满足满减活动,计算价格
|
|
|
|
- _reducedPromsPrice = pros.promotions.reducedPrice //统计总减金额
|
|
|
|
- }else{
|
|
|
|
- _reducedPromsPrice = 0 //将满减金额置为0
|
|
|
|
- }
|
|
|
|
})
|
|
})
|
|
_promsPrice += _price//统计合计价格
|
|
_promsPrice += _price//统计合计价格
|
|
|
|
+ if(_promsPrice >= pros.promotions.touchPrice){//判断如果商品合计价格已满足满减活动,计算价格
|
|
|
|
+ _reducedPromsPrice = _promsReducedPrice //统计总减金额
|
|
|
|
+ }else{
|
|
|
|
+ _reducedPromsPrice = 0 //将满减金额置为0
|
|
|
|
+ }
|
|
|
|
+ console.log(reducedPriceList)
|
|
|
|
+ // console.log(_promsPrice)
|
|
|
|
+ // console.log(_reducedPromsPrice)
|
|
}else{
|
|
}else{
|
|
_totalNonePrice += pros.price*pros.number; //正常商品的价格总计
|
|
_totalNonePrice += pros.price*pros.number; //正常商品的价格总计
|
|
}
|
|
}
|
|
@@ -508,9 +517,14 @@
|
|
if(_isFlag){
|
|
if(_isFlag){
|
|
_promsPrice = _promsPrice - _reducedPromsPrice
|
|
_promsPrice = _promsPrice - _reducedPromsPrice
|
|
}
|
|
}
|
|
|
|
+ //总商品原价合计 = 店铺满减商品总原价 + 单品+凑单满减商品总原价
|
|
this.totalOriginalPrice = totalOriginalPrice + _totalOriginalPrice;
|
|
this.totalOriginalPrice = totalOriginalPrice + _totalOriginalPrice;
|
|
|
|
+
|
|
|
|
+ //最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
|
|
this.reducedPrice = reducedPrice + _reducedPrice + _reducedPromsPrice;
|
|
this.reducedPrice = reducedPrice + _reducedPrice + _reducedPromsPrice;
|
|
- this.allPrice = totalPrice + _totalPrice + _promsPrice + _totalNonePrice;
|
|
|
|
|
|
+
|
|
|
|
+ //最终合计价格 = 店铺满减合计 + 单品满减 + 正常合计 + 凑单满减
|
|
|
|
+ this.allPrice = totalPrice + _totalPrice + _totalNonePrice + _promsPrice ;
|
|
},
|
|
},
|
|
totalCount(){//计算总数量
|
|
totalCount(){//计算总数量
|
|
this.allCount = 0
|
|
this.allCount = 0
|