@pisell/pisellos 0.0.511 → 0.0.512
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Order/index.js +79 -58
- package/dist/modules/Order/types.d.ts +11 -0
- package/dist/modules/Order/utils.d.ts +63 -11
- package/dist/modules/Order/utils.js +242 -43
- package/dist/modules/SalesSummary/utils.js +33 -68
- package/dist/modules/Summary/utils.js +6 -21
- package/dist/solution/ScanOrder/index.d.ts +3 -0
- package/dist/solution/ScanOrder/index.js +558 -498
- package/dist/solution/ScanOrder/types.d.ts +29 -2
- package/dist/solution/ScanOrder/utils.d.ts +18 -2
- package/dist/solution/ScanOrder/utils.js +111 -29
- package/dist/solution/VenueBooking/index.js +35 -27
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.js +20 -7
- package/lib/modules/Order/types.d.ts +11 -0
- package/lib/modules/Order/utils.d.ts +63 -11
- package/lib/modules/Order/utils.js +149 -17
- package/lib/modules/SalesSummary/utils.js +13 -47
- package/lib/modules/Summary/utils.js +4 -18
- package/lib/solution/ScanOrder/index.d.ts +3 -0
- package/lib/solution/ScanOrder/index.js +30 -4
- package/lib/solution/ScanOrder/types.d.ts +29 -2
- package/lib/solution/ScanOrder/utils.d.ts +18 -2
- package/lib/solution/ScanOrder/utils.js +66 -15
- package/lib/solution/VenueBooking/index.js +13 -6
- package/package.json +1 -1
|
@@ -706,31 +706,16 @@ var getBundleItemIsDiscountPrice = function getBundleItemIsDiscountPrice(item) {
|
|
|
706
706
|
var getBundleItemIsMarkupOrDiscountPrice = function getBundleItemIsMarkupOrDiscountPrice(item) {
|
|
707
707
|
return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
|
|
708
708
|
};
|
|
709
|
-
var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
710
|
-
return (discounts || []).reduce(function (total, discount) {
|
|
711
|
-
return total.add(new Decimal(discount.amount || 0));
|
|
712
|
-
}, new Decimal(0)).toNumber();
|
|
713
|
-
};
|
|
714
709
|
|
|
715
710
|
/**
|
|
716
711
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
717
712
|
*/
|
|
718
713
|
var getMainProductTotal = function getMainProductTotal(item) {
|
|
719
|
-
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
})) || [];
|
|
725
|
-
var mainProductDiscountAmount = getDiscountAmount(discount);
|
|
726
|
-
total = total.minus(mainProductDiscountAmount);
|
|
727
|
-
|
|
728
|
-
// 单规格
|
|
729
|
-
if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
|
|
730
|
-
total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
|
|
731
|
-
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
732
|
-
}, new Decimal(0)));
|
|
733
|
-
}
|
|
714
|
+
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$metadata2;
|
|
715
|
+
// 新语义 v2 下 `main_product_selling_price` / `metadata.main_product_selling_price`
|
|
716
|
+
// 已经是"含 option、含主商品折扣"的主价,直接作为主商品基准,无需再减折扣或加 option。
|
|
717
|
+
// 仅需叠加 markup / markdown 类 bundle(原价 bundle 的税费单独处理)。
|
|
718
|
+
var total = new Decimal((_ref8 = (_ref9 = (_item$main_product_se = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se !== void 0 ? _item$main_product_se : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.main_product_selling_price) !== null && _ref9 !== void 0 ? _ref9 : item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.main_product_original_price) !== null && _ref8 !== void 0 ? _ref8 : 0);
|
|
734
719
|
var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
|
|
735
720
|
_step4;
|
|
736
721
|
try {
|
|
@@ -738,7 +723,7 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
738
723
|
var bundleItem = _step4.value;
|
|
739
724
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
740
725
|
var _ref10, _bundleItem$bundle_se2;
|
|
741
|
-
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
726
|
+
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
742
727
|
var bundleItemTotal = new Decimal((_ref10 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
743
728
|
total = total.add(bundleItemTotal);
|
|
744
729
|
}
|
|
@@ -49,6 +49,9 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
49
49
|
private registerCustomerLoginListeners;
|
|
50
50
|
private refreshOrderMarketingAfterLogin;
|
|
51
51
|
constructor(name?: string, version?: string);
|
|
52
|
+
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
53
|
+
getCacheId(): string | undefined;
|
|
54
|
+
private destroyRegisteredChildModules;
|
|
52
55
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
53
56
|
destroy(): Promise<void>;
|
|
54
57
|
retryInit(): Promise<void>;
|