couponInfoListMap=goods.couponInfoListMap;
}
}
goodsPrice = parseFloat(goodsPrice).toFixed(2);
let receivePerson = res.data[0];
this.setData({
currentLogisticsText: (logisticsList != undefined && logisticsList.length > 0) ? logisticsList[0].logisticsName : “”,
receiveName: receivePerson.receiveName != undefined ? receivePerson.receiveName : “”,
receiveMobile: receivePerson.receiveMobile != undefined ? receivePerson.receiveMobile : “”,
receiveAddress: receivePerson.receiveAddress != undefined ? receivePerson.receiveAddress : “”,
goodsPrice: goodsPrice,
goodsTotalPrice: goodsPrice,
couponInfoListMap: couponInfoListMap,
goodsNum: goodsNum
});
this.countTotalPrice();
}
}
})
}
},
countTotalPrice() {
//计算商品价格
let goodsPrice= 0.00
let goodsTotalPrice = 0.00
for (let goods of this.data.goodsList) {
//goodsPrice += (goods.goodsAmount * goods.goodsPrice)
goodsPrice += (1 * goods.goodsPrice)
//console.log(“goodsPrice=” + goodsPrice+“//goodsPrice=”+goods.goodsPrice);
}
goodsPrice = parseFloat(goodsPrice).toFixed(2);
goodsTotalPrice = parseFloat(goodsPrice).toFixed(2);
//console.log(“goodsTotalPrice=” + goodsTotalPrice);
//判断是否使用优惠劵
let couponInfoListMap=this.data.couponInfoListMap
let userCouponInfo=null;
if(couponInfoListMap.length>=1){
for (let couponInfo of couponInfoListMap) {
//console.log(“couponInfo=” + JSON.stringify(couponInfo));
if(couponInfo.useConditionsContent<=goodsTotalPrice){
if(userCouponInfo==null){//只有1张优惠劵满足条件
userCouponInfo=couponInfo;
}else{//有多张优惠劵满足条件
if(couponInfo.couponAmount>userCouponInfo.couponAmount){
userCouponInfo=couponInfo;
}
}
}