@pisell/pisellos 0.0.263 → 0.0.264
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Cart/utils/cartProduct.js +9 -2
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/modules/Cart/utils/cartProduct.js +9 -2
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
12
12
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
13
|
import Decimal from 'decimal.js';
|
|
14
14
|
import { isNormalProduct } from "../../Product/utils";
|
|
15
|
+
import { getDiscountAmount } from "../../../solution/ShopDiscount/utils";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* @title 处理组合商品
|
|
@@ -192,8 +193,14 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
|
192
193
|
// 不是商品券则代表折扣卡,计算打折后的价格
|
|
193
194
|
// 一个商品折扣卡只能存在于一张
|
|
194
195
|
if (currentValue.type !== 'good_pass') {
|
|
195
|
-
var
|
|
196
|
-
price =
|
|
196
|
+
var _currentValue$discoun;
|
|
197
|
+
price = getDiscountAmount({
|
|
198
|
+
tag: currentValue.type,
|
|
199
|
+
par_value: currentValue.discount.percent,
|
|
200
|
+
metadata: {
|
|
201
|
+
discount_card_type: currentValue === null || currentValue === void 0 || (_currentValue$discoun = currentValue.discount) === null || _currentValue$discoun === void 0 ? void 0 : _currentValue$discoun.discount_card_type
|
|
202
|
+
}
|
|
203
|
+
}, price, price);
|
|
197
204
|
}
|
|
198
205
|
});
|
|
199
206
|
}
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -314,7 +314,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
314
314
|
}[];
|
|
315
315
|
setOtherData(key: string, value: any): void;
|
|
316
316
|
getOtherData(key: string): any;
|
|
317
|
-
getProductTypeById(id: number): Promise<"
|
|
317
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
318
318
|
/**
|
|
319
319
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
320
320
|
*
|
|
@@ -44,6 +44,7 @@ __export(cartProduct_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(cartProduct_exports);
|
|
45
45
|
var import_decimal = __toESM(require("decimal.js"));
|
|
46
46
|
var import_utils = require("../../Product/utils");
|
|
47
|
+
var import_utils2 = require("../../../solution/ShopDiscount/utils");
|
|
47
48
|
var handleVariantProduct = (product) => {
|
|
48
49
|
var _a;
|
|
49
50
|
if (product == null ? void 0 : product.product_variant_id) {
|
|
@@ -183,9 +184,15 @@ var getProductTotalPrice = (params) => {
|
|
|
183
184
|
}
|
|
184
185
|
if (discounts == null ? void 0 : discounts.length) {
|
|
185
186
|
discounts.forEach((currentValue) => {
|
|
187
|
+
var _a;
|
|
186
188
|
if (currentValue.type !== "good_pass") {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
price = (0, import_utils2.getDiscountAmount)({
|
|
190
|
+
tag: currentValue.type,
|
|
191
|
+
par_value: currentValue.discount.percent,
|
|
192
|
+
metadata: {
|
|
193
|
+
discount_card_type: (_a = currentValue == null ? void 0 : currentValue.discount) == null ? void 0 : _a.discount_card_type
|
|
194
|
+
}
|
|
195
|
+
}, price, price);
|
|
189
196
|
}
|
|
190
197
|
});
|
|
191
198
|
}
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -314,7 +314,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
314
314
|
}[];
|
|
315
315
|
setOtherData(key: string, value: any): void;
|
|
316
316
|
getOtherData(key: string): any;
|
|
317
|
-
getProductTypeById(id: number): Promise<"
|
|
317
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
318
318
|
/**
|
|
319
319
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
320
320
|
*
|