@pisell/pisellos 3.0.89 → 3.0.91
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.js +1 -0
- package/dist/model/strategy/adapter/index.d.ts +7 -0
- package/dist/model/strategy/adapter/index.js +7 -0
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +483 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +79 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +382 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/dist/model/strategy/adapter/itemRule/index.js +5 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/dist/model/strategy/adapter/promotion/examples.js +166 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/dist/model/strategy/adapter/promotion/type.js +209 -0
- package/dist/model/strategy/adapter/type.d.ts +28 -0
- package/dist/model/strategy/adapter/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +502 -0
- package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/dist/model/strategy/adapter/walletPass/example.js +258 -0
- package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/dist/model/strategy/adapter/walletPass/index.js +182 -0
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/dist/model/strategy/adapter/walletPass/locales.js +26 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +187 -0
- package/dist/model/strategy/adapter/walletPass/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +1104 -0
- package/dist/model/strategy/engine.d.ts +106 -0
- package/dist/model/strategy/engine.js +611 -0
- package/dist/model/strategy/index.d.ts +3 -0
- package/dist/model/strategy/index.js +8 -0
- package/dist/model/strategy/strategy-example.d.ts +5 -0
- package/dist/model/strategy/strategy-example.js +331 -0
- package/dist/model/strategy/type.d.ts +228 -0
- package/dist/model/strategy/type.js +94 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +90 -3
- package/dist/modules/Discount/types.d.ts +6 -0
- package/dist/modules/OpenData/index.d.ts +24 -0
- package/dist/modules/OpenData/index.js +173 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +66 -1
- package/dist/modules/Order/index.js +884 -10
- package/dist/modules/Order/types.d.ts +174 -12
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +118 -0
- package/dist/modules/Order/utils.js +586 -2
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +3 -1
- package/dist/modules/ProductList/index.js +19 -11
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +248 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.js +17 -18
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +60 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +480 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +23 -0
- package/dist/modules/ScanOrderLogger/index.js +174 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +221 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/utils.d.ts +3 -3
- package/dist/modules/Summary/utils.js +41 -31
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingByStep/index.js +2 -1
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/ScanOrder/index.d.ts +158 -0
- package/dist/solution/ScanOrder/index.js +3474 -0
- package/dist/solution/ScanOrder/types.d.ts +306 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +172 -0
- package/dist/solution/ScanOrder/utils.js +796 -0
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +201 -0
- package/dist/solution/VenueBooking/index.js +3472 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +154 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/dist/solution/VenueBooking/utils/resource.js +131 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +239 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/model/index.d.ts +1 -0
- package/lib/model/index.js +23 -0
- package/lib/model/strategy/adapter/index.d.ts +7 -0
- package/lib/model/strategy/adapter/index.js +57 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +377 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +79 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +316 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +60 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/lib/model/strategy/adapter/promotion/examples.js +192 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/lib/model/strategy/adapter/promotion/type.js +51 -0
- package/lib/model/strategy/adapter/type.d.ts +28 -0
- package/lib/model/strategy/adapter/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +424 -0
- package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/lib/model/strategy/adapter/walletPass/example.js +207 -0
- package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/lib/model/strategy/adapter/walletPass/index.js +142 -0
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/lib/model/strategy/adapter/walletPass/locales.js +54 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +187 -0
- package/lib/model/strategy/adapter/walletPass/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +791 -0
- package/lib/model/strategy/engine.d.ts +106 -0
- package/lib/model/strategy/engine.js +450 -0
- package/lib/model/strategy/index.d.ts +3 -0
- package/lib/model/strategy/index.js +38 -0
- package/lib/model/strategy/strategy-example.d.ts +5 -0
- package/lib/model/strategy/strategy-example.js +318 -0
- package/lib/model/strategy/type.d.ts +228 -0
- package/lib/model/strategy/type.js +44 -0
- package/lib/modules/Cart/utils/cartProduct.js +1 -0
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +60 -2
- package/lib/modules/Discount/types.d.ts +6 -0
- package/lib/modules/OpenData/index.d.ts +24 -0
- package/lib/modules/OpenData/index.js +119 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +66 -1
- package/lib/modules/Order/index.js +525 -0
- package/lib/modules/Order/types.d.ts +174 -12
- package/lib/modules/Order/utils.d.ts +118 -0
- package/lib/modules/Order/utils.js +483 -2
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +3 -1
- package/lib/modules/ProductList/index.js +45 -34
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +152 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.js +17 -18
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +60 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +420 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +23 -0
- package/lib/modules/ScanOrderLogger/index.js +147 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +157 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/utils.d.ts +3 -3
- package/lib/modules/Summary/utils.js +22 -16
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingByStep/index.js +2 -2
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/ScanOrder/index.d.ts +158 -0
- package/lib/solution/ScanOrder/index.js +2135 -0
- package/lib/solution/ScanOrder/types.d.ts +306 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +172 -0
- package/lib/solution/ScanOrder/utils.js +658 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +201 -0
- package/lib/solution/VenueBooking/index.js +1937 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +154 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/lib/solution/VenueBooking/utils/resource.js +92 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +237 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -46,7 +46,7 @@ export declare const formatScheduleResult: (schedule: ScheduleItem) => {
|
|
|
46
46
|
};
|
|
47
47
|
export declare const calcScheduleDateRange: (schedule: ScheduleItem) => any[];
|
|
48
48
|
export declare const calcCalendarDataBySchedules: (schedules: ScheduleItem[]) => unknown[];
|
|
49
|
-
export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) =>
|
|
49
|
+
export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) => ScheduleAllMap;
|
|
50
50
|
/**
|
|
51
51
|
* @title: 格式化日程数据
|
|
52
52
|
* @description:
|
|
@@ -7,8 +7,8 @@ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], i
|
|
|
7
7
|
* @param item
|
|
8
8
|
*/
|
|
9
9
|
export declare const getBundleDiscountList: (bundle: any[]) => any[];
|
|
10
|
-
export declare const calcDiscountListDifference: (discountList: any[]) =>
|
|
11
|
-
export declare const getProductDiscountProductDiscountDifference: (item: CartItem) =>
|
|
10
|
+
export declare const calcDiscountListDifference: (discountList: any[]) => number;
|
|
11
|
+
export declare const getProductDiscountProductDiscountDifference: (item: CartItem) => number;
|
|
12
12
|
/**
|
|
13
13
|
* 计算订单税费(折扣前/折扣后),并把单品税费信息回写到商品数据上(用于明细展示/后续计算)。
|
|
14
14
|
*
|
|
@@ -94,7 +94,7 @@ export declare const calculateDeposit: (items: CartItem[]) => {
|
|
|
94
94
|
export declare const getSurchargeAmount: ({ bookingDetail, bookingId }: {
|
|
95
95
|
bookingDetail?: any;
|
|
96
96
|
bookingId?: number | undefined;
|
|
97
|
-
}, surcharge: any[], options: any) =>
|
|
97
|
+
}, surcharge: any[], options: any) => number;
|
|
98
98
|
/**
|
|
99
99
|
* 订单附加费各项信息
|
|
100
100
|
*
|
|
@@ -94,8 +94,8 @@ export var getBundleDiscountList = function getBundleDiscountList(bundle) {
|
|
|
94
94
|
export var calcDiscountListDifference = function calcDiscountListDifference(discountList) {
|
|
95
95
|
return discountList.reduce(function (pre, cur) {
|
|
96
96
|
var _cur$metadata;
|
|
97
|
-
return pre
|
|
98
|
-
}, 0);
|
|
97
|
+
return pre.plus((cur === null || cur === void 0 || (_cur$metadata = cur.metadata) === null || _cur$metadata === void 0 ? void 0 : _cur$metadata.product_discount_difference) || 0);
|
|
98
|
+
}, new Decimal(0)).toNumber();
|
|
99
99
|
};
|
|
100
100
|
export var getProductDiscountProductDiscountDifference = function getProductDiscountProductDiscountDifference(item) {
|
|
101
101
|
var _item$_origin, _item$_origin2;
|
|
@@ -662,8 +662,8 @@ export var getSurchargeAmount = function getSurchargeAmount(_ref7, surcharge, op
|
|
|
662
662
|
if (!Array.isArray(surcharge)) return 0;
|
|
663
663
|
// 新增状态使用 getSurcharge 的返回值进行求和
|
|
664
664
|
return surcharge.reduce(function (total, item) {
|
|
665
|
-
return total
|
|
666
|
-
}, 0);
|
|
665
|
+
return total.plus(item.value || 0);
|
|
666
|
+
}, new Decimal(0)).toNumber();
|
|
667
667
|
};
|
|
668
668
|
|
|
669
669
|
// bundle商品是否是原价
|
|
@@ -695,20 +695,30 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
|
695
695
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
696
696
|
*/
|
|
697
697
|
var getMainProductTotal = function getMainProductTotal(item) {
|
|
698
|
-
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
698
|
+
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$metadata2, _item$metadata3, _item$metadata4;
|
|
699
|
+
// 新语义 v2 下 `main_product_selling_price` / `metadata.main_product_selling_price`
|
|
700
|
+
// 已经是"含 option、含主商品折扣"的主价,直接作为主商品基准,无需再减折扣或加 option。
|
|
701
|
+
// 仅需叠加 markup / markdown 类 bundle(原价 bundle 的税费单独处理)。
|
|
702
|
+
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);
|
|
703
|
+
|
|
704
|
+
// 做个兜底 如果新语义价格字段都没有,则切换回老逻辑
|
|
705
|
+
var hasMainProductPrice = (item === null || item === void 0 ? void 0 : item.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.main_product_original_price) != null;
|
|
706
|
+
if (!hasMainProductPrice) {
|
|
707
|
+
var _ref10, _ref11, _item$main_product_se2, _item$metadata5, _item$_origin3, _item$_originData;
|
|
708
|
+
total = new Decimal((_ref10 = (_ref11 = (_item$main_product_se2 = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se2 !== void 0 ? _item$main_product_se2 : item === null || item === void 0 || (_item$metadata5 = item.metadata) === null || _item$metadata5 === void 0 ? void 0 : _item$metadata5.main_product_selling_price) !== null && _ref11 !== void 0 ? _ref11 : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
709
|
+
var discount = (item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.discount_list) || (item === null || item === void 0 || (_item$_originData = item._originData) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.product) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.discount_list) === null || _item$_originData === void 0 ? void 0 : _item$_originData.filter(function (item) {
|
|
710
|
+
var _item$metadata6;
|
|
711
|
+
return !(item !== null && item !== void 0 && (_item$metadata6 = item.metadata) !== null && _item$metadata6 !== void 0 && _item$metadata6.custom_product_bundle_map_id);
|
|
712
|
+
})) || [];
|
|
713
|
+
var mainProductDiscountAmount = getDiscountAmount(discount);
|
|
714
|
+
total = total.minus(mainProductDiscountAmount);
|
|
715
|
+
|
|
716
|
+
// 单规格
|
|
717
|
+
if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
|
|
718
|
+
total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
|
|
719
|
+
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
720
|
+
}, new Decimal(0)));
|
|
721
|
+
}
|
|
712
722
|
}
|
|
713
723
|
var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
|
|
714
724
|
_step4;
|
|
@@ -716,9 +726,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
716
726
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
717
727
|
var bundleItem = _step4.value;
|
|
718
728
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
719
|
-
var
|
|
720
|
-
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
721
|
-
var bundleItemTotal = new Decimal((
|
|
729
|
+
var _ref12, _bundleItem$bundle_se2;
|
|
730
|
+
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
731
|
+
var bundleItemTotal = new Decimal((_ref12 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref12 !== void 0 ? _ref12 : 0);
|
|
722
732
|
total = total.add(bundleItemTotal);
|
|
723
733
|
}
|
|
724
734
|
}
|
|
@@ -838,12 +848,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
838
848
|
* @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
|
|
839
849
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
840
850
|
*/
|
|
841
|
-
export var getSurcharge = function getSurcharge(
|
|
851
|
+
export var getSurcharge = function getSurcharge(_ref13, options) {
|
|
842
852
|
var _service$filter;
|
|
843
|
-
var service =
|
|
844
|
-
addons =
|
|
845
|
-
bookingDetail =
|
|
846
|
-
bookingId =
|
|
853
|
+
var service = _ref13.service,
|
|
854
|
+
addons = _ref13.addons,
|
|
855
|
+
bookingDetail = _ref13.bookingDetail,
|
|
856
|
+
bookingId = _ref13.bookingId;
|
|
847
857
|
var isEdit = options.isEdit,
|
|
848
858
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
849
859
|
surcharge_list = options.surcharge_list,
|
|
@@ -965,11 +975,11 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
965
975
|
scheduleById: scheduleById || {},
|
|
966
976
|
isInScheduleByDate: isInScheduleByDate
|
|
967
977
|
})) {
|
|
968
|
-
var
|
|
978
|
+
var _ref14, _bundleItem$bundle_se3;
|
|
969
979
|
var _mainQuantity = item.num || 1;
|
|
970
980
|
matchedItems.push({
|
|
971
981
|
isMain: false,
|
|
972
|
-
total: Number((
|
|
982
|
+
total: Number((_ref14 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref14 !== void 0 ? _ref14 : 0),
|
|
973
983
|
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
974
984
|
item: bundleItem,
|
|
975
985
|
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
@@ -1185,9 +1195,9 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
1185
1195
|
}
|
|
1186
1196
|
return surchargeWithAmount;
|
|
1187
1197
|
};
|
|
1188
|
-
function resetItemsSurchargeSideEffects(
|
|
1189
|
-
var service =
|
|
1190
|
-
addons =
|
|
1198
|
+
function resetItemsSurchargeSideEffects(_ref15) {
|
|
1199
|
+
var service = _ref15.service,
|
|
1200
|
+
addons = _ref15.addons;
|
|
1191
1201
|
var resetItem = function resetItem(item) {
|
|
1192
1202
|
if (!item) return;
|
|
1193
1203
|
item.surcharge_fee = 0;
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -10,4 +10,8 @@ export * from './Payment';
|
|
|
10
10
|
export * from './Resource';
|
|
11
11
|
export * from './Step';
|
|
12
12
|
export * from './Summary';
|
|
13
|
+
export * from './SalesSummary';
|
|
13
14
|
export * from './Schedule';
|
|
15
|
+
export * from './Quotation';
|
|
16
|
+
export * from './ScanOrderLogger';
|
|
17
|
+
export * from './OpenData';
|
package/dist/modules/index.js
CHANGED
|
@@ -10,4 +10,8 @@ export * from "./Payment";
|
|
|
10
10
|
export * from "./Resource";
|
|
11
11
|
export * from "./Step";
|
|
12
12
|
export * from "./Summary";
|
|
13
|
-
export * from "./
|
|
13
|
+
export * from "./SalesSummary";
|
|
14
|
+
export * from "./Schedule";
|
|
15
|
+
export * from "./Quotation";
|
|
16
|
+
export * from "./ScanOrderLogger";
|
|
17
|
+
export * from "./OpenData";
|
|
@@ -301,7 +301,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
301
301
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
302
302
|
errorList: any[];
|
|
303
303
|
};
|
|
304
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
304
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
305
305
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
306
306
|
resources_code: string;
|
|
307
307
|
startDate: string;
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 1 | 3 | 2 | 4 | 5 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
357
357
|
};
|
|
358
358
|
setOtherData(key: string, value: any): void;
|
|
359
359
|
getOtherData(key: string): any;
|
|
360
|
-
getProductTypeById(id: number): Promise<"
|
|
360
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
361
361
|
/**
|
|
362
362
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
363
363
|
*
|
|
@@ -2061,6 +2061,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2061
2061
|
_cartItems$,
|
|
2062
2062
|
_cartItems$2,
|
|
2063
2063
|
_this$shopStore$get;
|
|
2064
|
+
var split = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
2064
2065
|
var dateRange = this.store.date.getDateRange();
|
|
2065
2066
|
// 取出购物车中所有一已选择的第一步资源
|
|
2066
2067
|
var resources = [];
|
|
@@ -2244,7 +2245,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2244
2245
|
resourcesMap: resourcesMap,
|
|
2245
2246
|
duration: duration,
|
|
2246
2247
|
currentDate: dateRange[0].date,
|
|
2247
|
-
split:
|
|
2248
|
+
split: split,
|
|
2248
2249
|
resourcesUseableMap: resourcesUseableMap,
|
|
2249
2250
|
capacity: maxCapacity,
|
|
2250
2251
|
cut_off_time: maxCutOffTime,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -14,6 +14,8 @@ export interface BookingByStepState {
|
|
|
14
14
|
currentProduct?: ProductData;
|
|
15
15
|
currentProductMeta?: Record<string, any>;
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
|
+
salesSummary?: SalesSummaryModule;
|
|
18
|
+
scanOrderLogger?: ScanOrderLoggerModule;
|
|
17
19
|
}
|
|
18
20
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
19
21
|
export declare enum BookingByStepHooks {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, ScheduleModule } from "../../modules";
|
|
1
|
+
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from "../../modules";
|
|
2
2
|
export function createModule(moduleName, solutionName, name, version) {
|
|
3
3
|
switch (moduleName) {
|
|
4
4
|
case 'cart':
|
|
5
5
|
return new CartModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
6
6
|
case 'summary':
|
|
7
7
|
return new SummaryModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
8
|
+
case 'salesSummary':
|
|
9
|
+
return new SalesSummaryModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
8
10
|
case 'step':
|
|
9
11
|
return new StepModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
10
12
|
case 'products':
|
|
@@ -19,6 +21,8 @@ export function createModule(moduleName, solutionName, name, version) {
|
|
|
19
21
|
return new PaymentModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
20
22
|
case 'schedule':
|
|
21
23
|
return new ScheduleModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
24
|
+
case 'scanOrderLogger':
|
|
25
|
+
return new ScanOrderLoggerModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
22
26
|
default:
|
|
23
27
|
throw new Error("Unknown module type: ".concat(moduleName));
|
|
24
28
|
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
+
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult, ScanOrderTempOrder } from './types';
|
|
4
|
+
import type { UpdateProductInOrderParams } from '../../modules/Order/types';
|
|
5
|
+
import type { Discount } from '../../modules/Discount/types';
|
|
6
|
+
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
7
|
+
import type { StrategyConfig } from '../../model/strategy/type';
|
|
8
|
+
import type { ProductData } from '../../modules/Product/types';
|
|
9
|
+
export * from './types';
|
|
10
|
+
interface ScanOrderItemRuleRuntimeConfig {
|
|
11
|
+
strategyConfigs?: StrategyConfig[];
|
|
12
|
+
pax?: Partial<PaxInfo>;
|
|
13
|
+
historicalItems?: CartItemSummary[];
|
|
14
|
+
serviceType?: string;
|
|
15
|
+
submissionIndex?: number;
|
|
16
|
+
custom?: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
19
|
+
protected defaultName: string;
|
|
20
|
+
protected defaultVersion: string;
|
|
21
|
+
isSolution: boolean;
|
|
22
|
+
private initializeOptions;
|
|
23
|
+
private store;
|
|
24
|
+
private otherParams;
|
|
25
|
+
private cacheId;
|
|
26
|
+
private window;
|
|
27
|
+
private request;
|
|
28
|
+
private itemRuleEvaluator;
|
|
29
|
+
private itemRuleConfigs;
|
|
30
|
+
private itemRuleConfigsPromise;
|
|
31
|
+
private itemRulePrefillApplied;
|
|
32
|
+
private itemRuleRuntimeConfig;
|
|
33
|
+
/** 最近一次 checkResourceAvailable 从预约规则 link 拉取的商品快照 */
|
|
34
|
+
private enabledReservationRuleProducts;
|
|
35
|
+
private loginEffectDisposers;
|
|
36
|
+
private customerLoginRefreshInFlight;
|
|
37
|
+
private customerLoginRefreshIdInFlight;
|
|
38
|
+
private static readonly PISELL1_LOGIN_SUCCESS;
|
|
39
|
+
private getScanOrderLoggerContext;
|
|
40
|
+
private safeStringify;
|
|
41
|
+
private pickErrorMessage;
|
|
42
|
+
private serializeError;
|
|
43
|
+
private addScanOrderLog;
|
|
44
|
+
private logMethodStart;
|
|
45
|
+
private logMethodSuccess;
|
|
46
|
+
private logMethodError;
|
|
47
|
+
private assertProductListLoaded;
|
|
48
|
+
addLog(params: ScanOrderAddLogParams): Promise<void>;
|
|
49
|
+
private normalizeCustomerId;
|
|
50
|
+
private resolveCustomerIdFromLoginPayload;
|
|
51
|
+
private clearLoginEffectListeners;
|
|
52
|
+
private registerLoginEffect;
|
|
53
|
+
private registerCustomerLoginListeners;
|
|
54
|
+
private refreshOrderMarketingAfterLogin;
|
|
55
|
+
constructor(name?: string, version?: string);
|
|
56
|
+
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
57
|
+
getCacheId(): string | undefined;
|
|
58
|
+
private destroyRegisteredChildModules;
|
|
59
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
60
|
+
destroy(): Promise<void>;
|
|
61
|
+
retryInit(): Promise<void>;
|
|
62
|
+
refresh(): Promise<void>;
|
|
63
|
+
getStatus(): import("./types").ScanOrderStatus;
|
|
64
|
+
getEntryContext(): import("./types").ScanOrderEntryContext | null;
|
|
65
|
+
getConfig(): Record<string, any>;
|
|
66
|
+
getItemRuleQuantityLimits(): QuantityLimitResult[];
|
|
67
|
+
getCartValidationPassed(): boolean | null;
|
|
68
|
+
getCartValidation(): {
|
|
69
|
+
passed: boolean | null;
|
|
70
|
+
failures: QuantityCheckResult[];
|
|
71
|
+
};
|
|
72
|
+
getTempOrder(): ScanOrderTempOrder | null;
|
|
73
|
+
updateTempOrderNote(note: string): string;
|
|
74
|
+
setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
|
|
75
|
+
service_type: 'dine_in' | '';
|
|
76
|
+
pickup_reference_mode: 'counter_pickup' | 'table_service';
|
|
77
|
+
};
|
|
78
|
+
setPickupRef(buzzer: string): string;
|
|
79
|
+
private ensureTempOrder;
|
|
80
|
+
addNewOrder(): Promise<ScanOrderTempOrder>;
|
|
81
|
+
restoreOrder(): Promise<ScanOrderTempOrder>;
|
|
82
|
+
getOrderProducts(): ScanOrderOrderProduct[];
|
|
83
|
+
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
84
|
+
getDiscountList(): Discount[];
|
|
85
|
+
scanCode(code: string, customerId?: number): Promise<ScanOrderScanCodeResult>;
|
|
86
|
+
setDiscountSelected(params: {
|
|
87
|
+
discountId: number;
|
|
88
|
+
isSelected: boolean;
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
onCustomerLogin(params: {
|
|
91
|
+
customerId: number;
|
|
92
|
+
}): Promise<void>;
|
|
93
|
+
private findReservationRuleResource;
|
|
94
|
+
private buildScanOrderResourceMetadata;
|
|
95
|
+
private prepareRetailAvailability;
|
|
96
|
+
private buildSubmitPayloadEnhancer;
|
|
97
|
+
submitScanOrder<T = any>(): Promise<T>;
|
|
98
|
+
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
99
|
+
updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
|
|
100
|
+
/**
|
|
101
|
+
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
102
|
+
* 多行同 SKU 时必须传入与删除/更新一致的 identity(如 `identity_key`)。
|
|
103
|
+
*/
|
|
104
|
+
setOrderProductLineNote(identity: ScanOrderOrderProductIdentity, note: string): Promise<ScanOrderOrderProduct[]>;
|
|
105
|
+
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
106
|
+
private loadRuntimeConfigs;
|
|
107
|
+
private syncItemRuleConfigsFromDineInConfig;
|
|
108
|
+
private fetchItemRuleConfigsByModelIds;
|
|
109
|
+
private buildPrefillProductSourceMap;
|
|
110
|
+
private getItemRuleRuntimeConfig;
|
|
111
|
+
private ensureItemRuleConfigsLoaded;
|
|
112
|
+
private refreshItemRuleQuantityLimits;
|
|
113
|
+
private applyPrefillByItemRule;
|
|
114
|
+
applyItemRulePrefill(): Promise<void>;
|
|
115
|
+
private evaluateCartValidationByItemRule;
|
|
116
|
+
private validateBeforeSubmitByItemRule;
|
|
117
|
+
private refreshCartValidationPassed;
|
|
118
|
+
setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
|
|
119
|
+
private normalizeResourceState;
|
|
120
|
+
private resolveResourceSelectType;
|
|
121
|
+
private fetchResourceOccupyDetailsByResourceId;
|
|
122
|
+
private resolveAdditionalOrderFromOccupyDetail;
|
|
123
|
+
checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
|
|
124
|
+
restorePreviousOrderData(): Promise<void>;
|
|
125
|
+
getAdditionalOrderInfo(): Promise<{
|
|
126
|
+
orderId: string;
|
|
127
|
+
orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
|
|
128
|
+
orderTime: string;
|
|
129
|
+
orderAmount: number;
|
|
130
|
+
orderItems: any[];
|
|
131
|
+
}>;
|
|
132
|
+
getProductList(): Promise<ProductData[]>;
|
|
133
|
+
getOtherParams(): Record<string, any>;
|
|
134
|
+
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
135
|
+
cover?: boolean;
|
|
136
|
+
}): Promise<void>;
|
|
137
|
+
private static readonly UI_STATE_KEY_PREFIX;
|
|
138
|
+
private getUIStateBucketKey;
|
|
139
|
+
private readUIStateBucket;
|
|
140
|
+
private writeUIStateBucket;
|
|
141
|
+
setUIState(key: string, value: any): void;
|
|
142
|
+
getUIState<T = any>(key: string): T | undefined;
|
|
143
|
+
deleteUIState(key: string): void;
|
|
144
|
+
clearUIState(): void;
|
|
145
|
+
setEntryPaxNumber(number: number): Promise<void>;
|
|
146
|
+
getEntryPaxNumber(): number | null;
|
|
147
|
+
syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
|
|
148
|
+
getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
|
|
149
|
+
checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
|
|
150
|
+
getFulfillmentModes(): {
|
|
151
|
+
enablePickup: boolean;
|
|
152
|
+
enableTableService: boolean;
|
|
153
|
+
};
|
|
154
|
+
checkManualPickupRef(): {
|
|
155
|
+
enabled: boolean;
|
|
156
|
+
manualInputType?: string;
|
|
157
|
+
};
|
|
158
|
+
}
|