问题修复,下单优化,订单结算问题修复
This commit is contained in:
@@ -31,11 +31,8 @@ export function returnGoodsPrice(goods, user, shopInfo, limitTimeDiscount) {
|
||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
||||
.toNumber();
|
||||
}
|
||||
if (
|
||||
canUseLimit &&
|
||||
limitTimeDiscount.discountPriority == "vip-price" &&
|
||||
!canUseVipPrice
|
||||
) {
|
||||
|
||||
if (canUseLimit && limitTimeDiscount.discountPriority == "vip-price") {
|
||||
if (canUseVipPrice) {
|
||||
return goods.memberPrice;
|
||||
} else {
|
||||
@@ -161,7 +158,10 @@ function returnCanCalcGoodsList(canCalcGoodsArr, coupon, shopInfo, user) {
|
||||
return canCalcGoodsArr.filter((goods) => {
|
||||
console.log("goods");
|
||||
console.log(goods);
|
||||
if (!coupon.discountShare && (goods.is_time_discount||goods.isTimeDiscount)) {
|
||||
if (
|
||||
!coupon.discountShare &&
|
||||
(goods.is_time_discount || goods.isTimeDiscount)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
@@ -391,6 +391,7 @@ export function calcDiscountGoodsArrPrice(
|
||||
let hasCountNum = 0;
|
||||
let discountPrice = 0;
|
||||
let hasDiscountGoodsArr = [];
|
||||
|
||||
for (let i = 0; i < discountGoodsArr.length; i++) {
|
||||
if (hasCountNum >= discountNum) {
|
||||
break;
|
||||
@@ -398,8 +399,14 @@ export function calcDiscountGoodsArrPrice(
|
||||
const goods = discountGoodsArr[i];
|
||||
const shengyuNum = discountNum - hasCountNum;
|
||||
const num = Math.min(goods.num, shengyuNum);
|
||||
discountPrice +=
|
||||
returnGoodsPrice(goods, user, shopInfo, limitTimeDiscount) * num;
|
||||
const realPrice = returnGoodsPrice(
|
||||
goods,
|
||||
user,
|
||||
shopInfo,
|
||||
limitTimeDiscount
|
||||
);
|
||||
|
||||
discountPrice += realPrice * num;
|
||||
|
||||
hasCountNum += num;
|
||||
hasDiscountGoodsArr.push({
|
||||
@@ -433,7 +440,7 @@ export function returnCouponDiscount(
|
||||
shopInfo,
|
||||
limitTimeDiscount
|
||||
) {
|
||||
arr = returnCanDikouGoods(arr, user, shopInfo);
|
||||
arr = returnCanDikouGoods(arr, user, shopInfo,limitTimeDiscount);
|
||||
const canDikouGoodsArr = returnCanDikouGoodsArr({
|
||||
canDikouGoodsArr: arr,
|
||||
selCoupon,
|
||||
@@ -554,8 +561,10 @@ export function returnCouponProductDiscount(
|
||||
limitTimeDiscount
|
||||
) {
|
||||
const { useFoods, discountNum, useRule } = coupon;
|
||||
|
||||
//抵扣商品数组
|
||||
let discountGoodsArr = [];
|
||||
|
||||
//抵扣全部商品
|
||||
if (useFoods.length === 0) {
|
||||
if (useRule == "price_asc") {
|
||||
@@ -574,6 +583,8 @@ export function returnCouponProductDiscount(
|
||||
discountGoodsArr = discountSelGoodsArr.slice(0, discountNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const result = calcDiscountGoodsArrPrice(
|
||||
discountGoodsArr,
|
||||
discountNum,
|
||||
|
||||
Reference in New Issue
Block a user