+1
-1
@@ -19,3 +19,3 @@ /** | ||
| */ | ||
| export declare function returnCalcPrice(goods: BaseCartItem, fullReductionActivitie: FullReductionActivity | undefined, limitTimeDiscount: TimeLimitDiscountConfig | null | undefined, useVipPrice: boolean, idKey?: string): number | undefined; | ||
| export declare function returnCalcPrice(goods: BaseCartItem, fullReductionActivitie: FullReductionActivity | undefined, limitTimeDiscount: TimeLimitDiscountConfig | null | undefined, useVipPrice: boolean, idKey?: string): number; | ||
| /** | ||
@@ -22,0 +22,0 @@ * 计算满减活动门槛 |
+13
-36
@@ -163,36 +163,15 @@ "use strict"; | ||
| //可以使用限时折扣 | ||
| if (limitTimeDiscount.discountPriority == "limit-time") { | ||
| //限时价优先 | ||
| const result = (0, bignumber_js_1.BigNumber)(goods.salePrice) | ||
| .times(discountRate) | ||
| .decimalPlaces(2, bignumber_js_1.BigNumber.ROUND_UP) | ||
| .toNumber(); | ||
| return result; | ||
| } | ||
| if (limitTimeDiscount.discountPriority == "vip-price") { | ||
| //会员价优先 | ||
| if (useVipPrice && goods.memberPrice && goods.memberPrice * 1 > 0) { | ||
| //使用会员价 | ||
| return returnMemberPrice(useVipPrice, goods); | ||
| } | ||
| else { | ||
| //不使用会员价 | ||
| const result = (0, bignumber_js_1.BigNumber)(goods.salePrice) | ||
| .times(discountRate) | ||
| .decimalPlaces(2, bignumber_js_1.BigNumber.ROUND_UP) | ||
| .toNumber(); | ||
| return result; | ||
| } | ||
| } | ||
| const result = (0, bignumber_js_1.BigNumber)(goods.salePrice) | ||
| .times(discountRate) | ||
| .decimalPlaces(2, bignumber_js_1.BigNumber.ROUND_UP) | ||
| .toNumber(); | ||
| return result; | ||
| } | ||
| //会员价优先 | ||
| if (useVipPrice) { | ||
| //使用会员价 | ||
| return returnMemberPrice(useVipPrice, goods); | ||
| } | ||
| else { | ||
| //不可以使用限时折扣 | ||
| //会员价优先 | ||
| if (useVipPrice) { | ||
| //使用会员价 | ||
| return returnMemberPrice(useVipPrice, goods); | ||
| } | ||
| else { | ||
| return goods.salePrice; | ||
| } | ||
| return goods.salePrice; | ||
| } | ||
@@ -490,6 +469,7 @@ } | ||
| //限时折扣优先 | ||
| return truncateToTwoDecimals(new bignumber_js_1.BigNumber(goods.salePrice) | ||
| const limitPrice = truncateToTwoDecimals(new bignumber_js_1.BigNumber(goods.salePrice) | ||
| .times((activity ? activity.discountRate : 100) / 100) | ||
| .decimalPlaces(2, bignumber_js_1.BigNumber.ROUND_UP) | ||
| .toNumber()); | ||
| return limitPrice; | ||
| } | ||
@@ -774,5 +754,2 @@ // 3. 优先级3:营销活动折扣(如限时折扣,需按商品ID匹配活动) | ||
| return 0; | ||
| if (shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice != 1) { | ||
| return 0; | ||
| } | ||
| return truncateToTwoDecimals(new bignumber_js_1.BigNumber(goodsRealAmount) | ||
@@ -779,0 +756,0 @@ .times((100 - (shopUserInfo.discount || 100)) / 100) |
+1
-1
| { | ||
| "name": "ysk-utils", | ||
| "version": "1.0.81", | ||
| "version": "1.0.82", | ||
| "main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
272942
-0.33%6504
-0.35%