@pisell/pisellos 2.3.40 → 2.3.42
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/core/index.d.ts +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +751 -510
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +8 -4
- package/dist/solution/BookingTicket/index.js +134 -51
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +2 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +197 -87
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +8 -4
- package/lib/solution/BookingTicket/index.js +64 -19
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -3,6 +3,7 @@ import { OrderModule, ProductList, QuotationModule, SalesSummaryModule, ScanOrde
|
|
|
3
3
|
import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderConfig as BaseSalesLoggerProviderConfig, ScanOrderLoggerProviderType as BaseSalesLoggerProviderType } from '../../modules/ScanOrderLogger/types';
|
|
4
4
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
5
5
|
import type { QuotationCustomerScopeInfo } from '../../modules/Quotation/types';
|
|
6
|
+
import type { PaymentMethod } from '../../modules/Payment/types';
|
|
6
7
|
/**
|
|
7
8
|
* BaseSales 流程 hook 后缀。
|
|
8
9
|
* 完整事件名应由当前模块名动态拼接,避免多个实例共享固定事件 key。
|
|
@@ -16,11 +17,62 @@ export declare const BaseSalesHookNames: {
|
|
|
16
17
|
readonly onPaymentSyncStart: "onPaymentSyncStart";
|
|
17
18
|
readonly onPaymentSyncEnd: "onPaymentSyncEnd";
|
|
18
19
|
readonly onDepositPaymentSyncEnd: "onDepositPaymentSyncEnd";
|
|
20
|
+
readonly onWalletAssetsStateChanged: "onWalletAssetsStateChanged";
|
|
19
21
|
};
|
|
20
22
|
export type BaseSalesHookName = typeof BaseSalesHookNames[keyof typeof BaseSalesHookNames];
|
|
21
23
|
export declare function createBaseSalesHook(moduleName: string, hookName: BaseSalesHookName): string;
|
|
22
24
|
export type BaseSalesStatus = 'idle' | 'initializing' | 'ready' | 'error';
|
|
23
25
|
export type BaseSalesPaymentStatus = 'paid' | 'partially_paid' | 'unpaid' | 'payment_processing' | string;
|
|
26
|
+
export interface BaseSalesCashPaymentConfig {
|
|
27
|
+
available: boolean;
|
|
28
|
+
paymentMethod?: PaymentMethod;
|
|
29
|
+
amountDue: number;
|
|
30
|
+
recommendedAmounts: number[];
|
|
31
|
+
}
|
|
32
|
+
export interface BaseSalesPayCashParams {
|
|
33
|
+
/** 实际计入订单的现金支付金额(部分支付时小于待付金额)。 */
|
|
34
|
+
amount: number;
|
|
35
|
+
/** 顾客实际交付现金;可大于 amount。 */
|
|
36
|
+
actualPaidAmount?: number;
|
|
37
|
+
changeAmount?: number;
|
|
38
|
+
roundingAmount?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface BaseSalesPayCashResult {
|
|
41
|
+
payment: Record<string, any>;
|
|
42
|
+
payments: Record<string, any>[];
|
|
43
|
+
syncResult: Record<string, any>;
|
|
44
|
+
isOrderFullyPaid: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface BaseSalesCommitPaymentMethodParams {
|
|
47
|
+
/** 支付方式 id;与 paymentMethodCode 至少传一个。 */
|
|
48
|
+
paymentMethodId?: number | string;
|
|
49
|
+
/** 支付方式 code,大小写不敏感。 */
|
|
50
|
+
paymentMethodCode?: string;
|
|
51
|
+
/** 本次计入订单的支付金额。 */
|
|
52
|
+
amount: number;
|
|
53
|
+
/** 支付设备返回的原始金额;缺省时与 amount 相同。 */
|
|
54
|
+
originAmount?: number;
|
|
55
|
+
/** 支付设备返回的实际手续费配置。 */
|
|
56
|
+
serviceCharge?: {
|
|
57
|
+
amount?: string | number;
|
|
58
|
+
percentage?: string | number;
|
|
59
|
+
} | null;
|
|
60
|
+
/** 支付设备返回的唯一流水号等扩展信息。 */
|
|
61
|
+
metadata?: Record<string, any>;
|
|
62
|
+
/** 少数支付方式需要透传的额外 payment 字段。 */
|
|
63
|
+
paymentData?: Record<string, any>;
|
|
64
|
+
}
|
|
65
|
+
export interface BaseSalesCommitPaymentMethodResult {
|
|
66
|
+
payment: Record<string, any>;
|
|
67
|
+
payments: Record<string, any>[];
|
|
68
|
+
syncResult: Record<string, any>;
|
|
69
|
+
isOrderFullyPaid: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface BaseSalesConfirmWalletPaymentResult<T = Record<string, any>> {
|
|
72
|
+
submitResult: T;
|
|
73
|
+
payments: Record<string, any>[];
|
|
74
|
+
isOrderFullyPaid: boolean;
|
|
75
|
+
}
|
|
24
76
|
export interface BaseSalesEntryContext {
|
|
25
77
|
biz: string;
|
|
26
78
|
mode: 'scan' | 'append';
|
|
@@ -31,7 +31,8 @@ var BaseSalesHookNames = {
|
|
|
31
31
|
onCartValidationChanged: "onCartValidationChanged",
|
|
32
32
|
onPaymentSyncStart: "onPaymentSyncStart",
|
|
33
33
|
onPaymentSyncEnd: "onPaymentSyncEnd",
|
|
34
|
-
onDepositPaymentSyncEnd: "onDepositPaymentSyncEnd"
|
|
34
|
+
onDepositPaymentSyncEnd: "onDepositPaymentSyncEnd",
|
|
35
|
+
onWalletAssetsStateChanged: "onWalletAssetsStateChanged"
|
|
35
36
|
};
|
|
36
37
|
function createBaseSalesHook(moduleName, hookName) {
|
|
37
38
|
return `${moduleName}:${hookName}`;
|
|
@@ -78,6 +78,7 @@ export interface CartPromotionEvaluator {
|
|
|
78
78
|
}>;
|
|
79
79
|
hasApplicableStrategy: boolean;
|
|
80
80
|
}>;
|
|
81
|
+
getStrategyConfigs?: () => unknown[];
|
|
81
82
|
}
|
|
82
83
|
/** 单个赠品减量项 */
|
|
83
84
|
export interface GiftReduceItem {
|
|
@@ -267,7 +268,8 @@ export declare function appendPromotionTags<T extends Record<string, any>>(produ
|
|
|
267
268
|
* 处理购物车的促销计算与赠品差异化。
|
|
268
269
|
*
|
|
269
270
|
* 流程:
|
|
270
|
-
* 1. 分离 main / gift / edit-product
|
|
271
|
+
* 1. 分离 main / gift / edit-product 三类(普通促销下带 `booking_id` 的编辑态商品不参与;
|
|
272
|
+
* 配置 ITEM_REWARD 时,编辑态商品也参与商品奖励重算)
|
|
271
273
|
* 2. 转 PromotionProduct 喂评估器 → 拿到 `evaluateCartWithPricing` 与 `getProductsApplicableStrategies`
|
|
272
274
|
* 3. 把 PricedProduct 映射回 OrderProduct 形态:
|
|
273
275
|
* - 参与促销的,写 `metadata._promotion` + 调整 `selling_price` / `main_product_selling_price`
|
|
@@ -77,19 +77,43 @@ function getOrderProductOriginalPriceForPromotion(product) {
|
|
|
77
77
|
}
|
|
78
78
|
return getOrderProductBasePrice(product);
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
var X_ITEMS_FOR_Y_PRICE = "X_ITEMS_FOR_Y_PRICE";
|
|
81
|
+
var ITEM_REWARD = "ITEM_REWARD";
|
|
82
|
+
function isItemRewardPromotionDiscountItem(item) {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return (item == null ? void 0 : item.type) === "product" && ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === ITEM_REWARD;
|
|
85
|
+
}
|
|
86
|
+
function isManagedPromotionDiscountItem(item) {
|
|
87
|
+
if ((item == null ? void 0 : item.type) === "promotion")
|
|
88
|
+
return true;
|
|
89
|
+
return isItemRewardPromotionDiscountItem(item);
|
|
90
|
+
}
|
|
91
|
+
function wasInPromotionBeforeEvaluation(item) {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
if (((_b = (_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a._promotion) == null ? void 0 : _b.inPromotion) === true)
|
|
94
|
+
return true;
|
|
95
|
+
return Array.isArray(item == null ? void 0 : item.discount_list) && item.discount_list.some(isItemRewardPromotionDiscountItem);
|
|
96
|
+
}
|
|
97
|
+
function updatePromotionDiscountList(item, promotionDiscount, options) {
|
|
81
98
|
let discountList = Array.isArray(item.discount_list) ? [...item.discount_list] : [];
|
|
82
|
-
discountList = discountList.filter((d) => (d
|
|
99
|
+
discountList = discountList.filter((d) => !isManagedPromotionDiscountItem(d));
|
|
83
100
|
if (promotionDiscount) {
|
|
101
|
+
const discountType = (options == null ? void 0 : options.discountType) || "promotion";
|
|
84
102
|
discountList.push({
|
|
85
|
-
type:
|
|
103
|
+
type: discountType,
|
|
86
104
|
amount: promotionDiscount.amount,
|
|
87
105
|
discount: {
|
|
88
106
|
original_amount: promotionDiscount.original_amount,
|
|
89
107
|
fixed_amount: promotionDiscount.fixed_amount,
|
|
90
108
|
title: promotionDiscount.title,
|
|
91
109
|
resource_id: ""
|
|
92
|
-
}
|
|
110
|
+
},
|
|
111
|
+
...discountType === "product" ? {
|
|
112
|
+
metadata: {
|
|
113
|
+
source: "promotion",
|
|
114
|
+
actionType: (options == null ? void 0 : options.actionType) || ITEM_REWARD
|
|
115
|
+
}
|
|
116
|
+
} : {}
|
|
93
117
|
});
|
|
94
118
|
}
|
|
95
119
|
if (discountList.length > 0) {
|
|
@@ -98,7 +122,15 @@ function updatePromotionDiscountList(item, promotionDiscount) {
|
|
|
98
122
|
delete item.discount_list;
|
|
99
123
|
}
|
|
100
124
|
}
|
|
101
|
-
|
|
125
|
+
function evaluatorHasActionType(evaluator, actionType) {
|
|
126
|
+
var _a;
|
|
127
|
+
const configs = (_a = evaluator == null ? void 0 : evaluator.getStrategyConfigs) == null ? void 0 : _a.call(evaluator);
|
|
128
|
+
if (!Array.isArray(configs))
|
|
129
|
+
return false;
|
|
130
|
+
return configs.some(
|
|
131
|
+
(config) => ((config == null ? void 0 : config.actions) || []).some((action) => (action == null ? void 0 : action.type) === actionType)
|
|
132
|
+
);
|
|
133
|
+
}
|
|
102
134
|
function applyPromoUnitPriceToLine(item, input) {
|
|
103
135
|
const metadata = item.metadata || (item.metadata = {});
|
|
104
136
|
const optionSum = (0, import_utils.sumOptionUnitPrice)((0, import_utils.getProductSkuOptions)(item)).toNumber();
|
|
@@ -125,6 +157,9 @@ function applyPromoUnitPriceToLine(item, input) {
|
|
|
125
157
|
amount: discountAmount,
|
|
126
158
|
original_amount: catalogSource,
|
|
127
159
|
fixed_amount: discountAmount
|
|
160
|
+
}, {
|
|
161
|
+
actionType: input.actionType,
|
|
162
|
+
discountType: input.actionType === ITEM_REWARD ? "product" : "promotion"
|
|
128
163
|
});
|
|
129
164
|
} else {
|
|
130
165
|
updatePromotionDiscountList(item, null);
|
|
@@ -396,14 +431,13 @@ function buildConsolidateKeyForPromotion(item) {
|
|
|
396
431
|
].join("#");
|
|
397
432
|
}
|
|
398
433
|
function consolidateMainProductsForPromotion(entries) {
|
|
399
|
-
var _a, _b;
|
|
400
434
|
if (!Array.isArray(entries) || entries.length <= 1) {
|
|
401
435
|
return [...entries || []];
|
|
402
436
|
}
|
|
403
437
|
const groups = /* @__PURE__ */ new Map();
|
|
404
438
|
for (const { item, originalListIndex } of entries) {
|
|
405
439
|
const key = buildConsolidateKeyForPromotion(item);
|
|
406
|
-
const wasInPromotion = (
|
|
440
|
+
const wasInPromotion = wasInPromotionBeforeEvaluation(item);
|
|
407
441
|
const existing = groups.get(key);
|
|
408
442
|
if (!existing) {
|
|
409
443
|
const mergedItem = (0, import_lodash_es.cloneDeep)(item);
|
|
@@ -469,6 +503,9 @@ function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
|
|
|
469
503
|
function generateNumericId() {
|
|
470
504
|
return Math.floor(Math.random() * 1e9) + Date.now();
|
|
471
505
|
}
|
|
506
|
+
function isBookingEditProductLine(product) {
|
|
507
|
+
return (product == null ? void 0 : product.booking_id) !== void 0 && (product == null ? void 0 : product.booking_id) !== null && product.booking_id !== 0 && product.booking_id !== "0";
|
|
508
|
+
}
|
|
472
509
|
function convertToPromotionProduct(product, index) {
|
|
473
510
|
const metadata = (product == null ? void 0 : product.metadata) || {};
|
|
474
511
|
const numericId = generateNumericId();
|
|
@@ -481,6 +518,7 @@ function convertToPromotionProduct(product, index) {
|
|
|
481
518
|
price: getOrderProductOriginalPriceForPromotion(product),
|
|
482
519
|
quantity: Number((product == null ? void 0 : product.num) ?? 1) || 1,
|
|
483
520
|
bundle: getProductBundleForEvaluator(product),
|
|
521
|
+
_promotionOnlyForItemReward: isBookingEditProductLine(product),
|
|
484
522
|
_originalItem: originalItem,
|
|
485
523
|
_originalId: getOrderProductUid(product),
|
|
486
524
|
_originalIndex: index
|
|
@@ -582,6 +620,9 @@ function resolveStrategyRequiredQuantity(matched) {
|
|
|
582
620
|
if (matched.actionType === "BUY_X_GET_Y_FREE") {
|
|
583
621
|
return Number(detail.buyQuantity) || 1;
|
|
584
622
|
}
|
|
623
|
+
if (matched.actionType === "ITEM_REWARD") {
|
|
624
|
+
return Number(detail.triggerQuantity) || 1;
|
|
625
|
+
}
|
|
585
626
|
return 1;
|
|
586
627
|
}
|
|
587
628
|
function resolveStrategyEligibleProducts(matched) {
|
|
@@ -692,6 +733,10 @@ function processCartPromotion(list, evaluator, options) {
|
|
|
692
733
|
};
|
|
693
734
|
if (!list || list.length === 0 || !evaluator)
|
|
694
735
|
return empty;
|
|
736
|
+
const shouldIncludeEditProductsForItemReward = evaluatorHasActionType(
|
|
737
|
+
evaluator,
|
|
738
|
+
ITEM_REWARD
|
|
739
|
+
);
|
|
695
740
|
const mainProductsWithIndex = [];
|
|
696
741
|
const existingGiftsWithIndex = [];
|
|
697
742
|
const editProductsWithIndex = [];
|
|
@@ -702,8 +747,12 @@ function processCartPromotion(list, evaluator, options) {
|
|
|
702
747
|
editProductsWithIndex.push({ item, originalListIndex: i });
|
|
703
748
|
} else if (giftInfo) {
|
|
704
749
|
existingGiftsWithIndex.push({ item, originalListIndex: i });
|
|
705
|
-
} else if ((item
|
|
706
|
-
|
|
750
|
+
} else if (isBookingEditProductLine(item)) {
|
|
751
|
+
if (shouldIncludeEditProductsForItemReward) {
|
|
752
|
+
mainProductsWithIndex.push({ item, originalListIndex: i });
|
|
753
|
+
} else {
|
|
754
|
+
editProductsWithIndex.push({ item, originalListIndex: i });
|
|
755
|
+
}
|
|
707
756
|
} else {
|
|
708
757
|
mainProductsWithIndex.push({ item, originalListIndex: i });
|
|
709
758
|
}
|
|
@@ -746,7 +795,8 @@ function processCartPromotion(list, evaluator, options) {
|
|
|
746
795
|
name: ((_a2 = item == null ? void 0 : item.metadata) == null ? void 0 : _a2.product_name) || (item == null ? void 0 : item.title) || "",
|
|
747
796
|
price: getOrderProductBasePrice(item),
|
|
748
797
|
quantity: Number((item == null ? void 0 : item.num) ?? 1) || 1,
|
|
749
|
-
bundle: getProductBundleForEvaluator(item)
|
|
798
|
+
bundle: getProductBundleForEvaluator(item),
|
|
799
|
+
_promotionOnlyForItemReward: isBookingEditProductLine(item)
|
|
750
800
|
};
|
|
751
801
|
});
|
|
752
802
|
for (let i = 0; i < consolidatedMainProductsWithIndex.length; i++) {
|
|
@@ -815,7 +865,7 @@ function processCartPromotion(list, evaluator, options) {
|
|
|
815
865
|
const metadata = newItem.metadata || {};
|
|
816
866
|
const sourceCartNum = (0, import_utils2.getSafeProductNum)(originalItem.num);
|
|
817
867
|
newItem._sourceCartNum = sourceCartNum;
|
|
818
|
-
const wasInPromotion = (
|
|
868
|
+
const wasInPromotion = wasInPromotionBeforeEvaluation(originalItem) || originalItem._wasInPromotionBeforeConsolidate === true;
|
|
819
869
|
delete metadata._promotion;
|
|
820
870
|
if (Array.isArray(newItem.product_bundle)) {
|
|
821
871
|
for (const b of newItem.product_bundle) {
|
|
@@ -832,7 +882,8 @@ function processCartPromotion(list, evaluator, options) {
|
|
|
832
882
|
applyPromoUnitPriceToLine(newItem, {
|
|
833
883
|
promoUnitPrice,
|
|
834
884
|
originalBasePrice,
|
|
835
|
-
strategyTitle: (
|
|
885
|
+
strategyTitle: (_a = priced.strategyMetadata) == null ? void 0 : _a.name,
|
|
886
|
+
actionType: priced.strategyId ? (_b = strategyActionMap.get(priced.strategyId)) == null ? void 0 : _b.actionType : void 0
|
|
836
887
|
});
|
|
837
888
|
} else {
|
|
838
889
|
const optionSum = (0, import_utils.sumOptionUnitPrice)((0, import_utils.getProductSkuOptions)(newItem)).toNumber();
|
|
@@ -82,8 +82,13 @@ export interface ISalesBooking {
|
|
|
82
82
|
metadata?: Record<string, any> | null;
|
|
83
83
|
[key: string]: any;
|
|
84
84
|
}
|
|
85
|
+
export interface ISalesPaymentMetadata extends Record<string, any> {
|
|
86
|
+
/** 刷卡机设备快照;OS 不解析内部字段 */
|
|
87
|
+
card_reader_snapshot?: Record<string, unknown>;
|
|
88
|
+
}
|
|
85
89
|
export interface ISalesPayment {
|
|
86
90
|
order_payment_id?: number | null;
|
|
91
|
+
payment_number?: string;
|
|
87
92
|
custom_payment_id?: number;
|
|
88
93
|
code?: string;
|
|
89
94
|
name?: string;
|
|
@@ -95,7 +100,7 @@ export interface ISalesPayment {
|
|
|
95
100
|
status?: string;
|
|
96
101
|
payment_time?: string | null;
|
|
97
102
|
service_charge?: Record<string, any> | null;
|
|
98
|
-
metadata?:
|
|
103
|
+
metadata?: ISalesPaymentMetadata | null;
|
|
99
104
|
[key: string]: any;
|
|
100
105
|
}
|
|
101
106
|
export interface ISalesSurcharge {
|
|
@@ -10,7 +10,6 @@ import { ITime } from '../../modules/Date/types';
|
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
12
12
|
import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
|
|
13
|
-
import { IAppendFormRecordParams } from '../../modules/Holder/types';
|
|
14
13
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
15
14
|
protected defaultName: string;
|
|
16
15
|
protected defaultVersion: string;
|
|
@@ -127,20 +126,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
127
126
|
* @param params
|
|
128
127
|
*/
|
|
129
128
|
fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* 获取 holder 表单 map
|
|
132
|
-
*/
|
|
133
|
-
getHolderFormMap(): import("../../modules").HolderFormMap;
|
|
134
|
-
/**
|
|
135
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
136
|
-
*/
|
|
137
|
-
refreshAllHolderFormRecords(params?: {
|
|
138
|
-
customer_id?: number;
|
|
139
|
-
}): Promise<import("../../modules").HolderFormMap>;
|
|
140
|
-
/**
|
|
141
|
-
* 添加表单记录
|
|
142
|
-
*/
|
|
143
|
-
appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
|
|
144
129
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
145
130
|
clearDateRange(): void;
|
|
146
131
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -317,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
317
302
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
318
303
|
errorList: any[];
|
|
319
304
|
};
|
|
320
|
-
getTimeSlotByAllResources(resources_code: string
|
|
305
|
+
getTimeSlotByAllResources(resources_code: string): any[];
|
|
321
306
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
322
307
|
resources_code: string;
|
|
323
308
|
startDate: string;
|
|
@@ -326,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
311
|
date: string;
|
|
327
312
|
status: string;
|
|
328
313
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
315
|
}[]>;
|
|
331
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
317
|
private getScheduleDataByIds;
|
|
@@ -89,7 +89,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
89
89
|
}
|
|
90
90
|
const moduleArr = [
|
|
91
91
|
"accountList",
|
|
92
|
-
"holder",
|
|
93
92
|
"cart",
|
|
94
93
|
"schedule",
|
|
95
94
|
"summary",
|
|
@@ -380,27 +379,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
380
379
|
}
|
|
381
380
|
return this.store.accountList.fetchHolderAccounts(params);
|
|
382
381
|
}
|
|
383
|
-
/**
|
|
384
|
-
* 获取 holder 表单 map
|
|
385
|
-
*/
|
|
386
|
-
getHolderFormMap() {
|
|
387
|
-
return this.store.holder.getHolderFormMap();
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
391
|
-
*/
|
|
392
|
-
async refreshAllHolderFormRecords(params) {
|
|
393
|
-
return this.store.holder.refreshAllFormRecords({
|
|
394
|
-
customer_id: params == null ? void 0 : params.customer_id,
|
|
395
|
-
useCache: false
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* 添加表单记录
|
|
400
|
-
*/
|
|
401
|
-
appendFormRecord(params) {
|
|
402
|
-
return this.store.holder.appendFormRecord(params);
|
|
403
|
-
}
|
|
404
382
|
// 设置日期范围,注入到日期模块中
|
|
405
383
|
async setDateRange(dateRange) {
|
|
406
384
|
this.store.date.setDateRange(dateRange);
|
|
@@ -508,14 +486,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
508
486
|
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
509
487
|
}
|
|
510
488
|
this.updateQuotationPriceAndCart(date);
|
|
511
|
-
try {
|
|
512
|
-
const customerId = Number(accountInfo.id);
|
|
513
|
-
await this.refreshAllHolderFormRecords({
|
|
514
|
-
customer_id: customerId
|
|
515
|
-
});
|
|
516
|
-
} catch (error) {
|
|
517
|
-
console.error("[BookingByStep] 登录后刷新 holder 表单失败", error);
|
|
518
|
-
}
|
|
519
489
|
}
|
|
520
490
|
} else {
|
|
521
491
|
throw new Error(`没有找到${accountId}账户`);
|
|
@@ -542,11 +512,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
542
512
|
}
|
|
543
513
|
// 购物车提交订单
|
|
544
514
|
async submitOrder(extraData) {
|
|
545
|
-
var _a;
|
|
546
515
|
const cartItems = this.store.cart.getItems();
|
|
547
516
|
const newCartItems = (0, import_lodash_es.cloneDeep)(cartItems);
|
|
548
517
|
newCartItems.forEach((item) => {
|
|
549
|
-
var
|
|
518
|
+
var _a;
|
|
550
519
|
if (item._origin.resources && item._origin.resources.length) {
|
|
551
520
|
item._origin.resources = item._origin.resources.map((n) => {
|
|
552
521
|
const newResourcesItem = (0, import_lodash_es.cloneDeep)(n);
|
|
@@ -556,7 +525,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
556
525
|
return { ...newResourcesItem };
|
|
557
526
|
});
|
|
558
527
|
const { currentCapacity, formatCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
559
|
-
if (!((
|
|
528
|
+
if (!((_a = item._origin) == null ? void 0 : _a.metadata)) {
|
|
560
529
|
item._origin.metadata = {};
|
|
561
530
|
}
|
|
562
531
|
item._origin.metadata.capacity = formatCapacity;
|
|
@@ -574,7 +543,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
574
543
|
cartItems: newCartItems,
|
|
575
544
|
type,
|
|
576
545
|
platform: this.platform,
|
|
577
|
-
business_code: (_a = this.otherParams) == null ? void 0 : _a.business_code,
|
|
578
546
|
extraData
|
|
579
547
|
}
|
|
580
548
|
});
|
|
@@ -660,15 +628,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
660
628
|
account = activeAccount;
|
|
661
629
|
}
|
|
662
630
|
}
|
|
663
|
-
try {
|
|
664
|
-
this.store.holder.ensureFormByProduct({
|
|
665
|
-
product: productData,
|
|
666
|
-
shop_id: (productData == null ? void 0 : productData.shop_id) || "",
|
|
667
|
-
useCache: true
|
|
668
|
-
});
|
|
669
|
-
} catch (error) {
|
|
670
|
-
console.error("[BookingByStep] 加载 holder 表单失败", error);
|
|
671
|
-
}
|
|
672
631
|
const flag = this.store.cart.mergeCartItemByRowKey({
|
|
673
632
|
rowKey,
|
|
674
633
|
quantity,
|
|
@@ -1191,7 +1150,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1191
1150
|
}
|
|
1192
1151
|
const totalCapacity = (countMap[n.id] || []).reduce(
|
|
1193
1152
|
(sum, item) => {
|
|
1194
|
-
const hasOverlap = (0, import_dayjs.default)(item.time.start_at).
|
|
1153
|
+
const hasOverlap = !(0, import_dayjs.default)(item.time.start_at).isAfter((0, import_dayjs.default)(timeSlots.start_at)) && !(0, import_dayjs.default)(item.time.end_at).isBefore((0, import_dayjs.default)(timeSlots.end_at));
|
|
1195
1154
|
return hasOverlap ? sum + item.pax : sum;
|
|
1196
1155
|
},
|
|
1197
1156
|
0
|
|
@@ -1273,10 +1232,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1273
1232
|
}
|
|
1274
1233
|
);
|
|
1275
1234
|
cartItems2.forEach((item, index) => {
|
|
1276
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
|
1235
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1277
1236
|
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
1278
|
-
|
|
1279
|
-
if (hasOriginTimeSlot) {
|
|
1237
|
+
if (item._origin.start_time && !(timeSlots == null ? void 0 : timeSlots.start_time)) {
|
|
1280
1238
|
recordTimeSlots = {
|
|
1281
1239
|
start_time: item._origin.start_time,
|
|
1282
1240
|
end_time: item._origin.end_time,
|
|
@@ -1288,13 +1246,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1288
1246
|
const currentResourceConfig = (_c = (_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
|
|
1289
1247
|
(n) => n.code === resources_code
|
|
1290
1248
|
);
|
|
1291
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct
|
|
1292
|
-
|
|
1293
|
-
let start_at = recordEndAt;
|
|
1294
|
-
let end_at = start_at.add(
|
|
1249
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct) {
|
|
1250
|
+
let start_at = (0, import_dayjs.default)(recordTimeSlots.end_time).add(
|
|
1295
1251
|
((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10,
|
|
1296
1252
|
"minutes"
|
|
1297
1253
|
);
|
|
1254
|
+
let end_at = start_at.add(
|
|
1255
|
+
((_h = (_g = item._productOrigin) == null ? void 0 : _g.duration) == null ? void 0 : _h.value) || 10,
|
|
1256
|
+
"minutes"
|
|
1257
|
+
);
|
|
1298
1258
|
recordTimeSlots = {
|
|
1299
1259
|
start_time: start_at.format("HH:mm"),
|
|
1300
1260
|
end_time: end_at.format("HH:mm"),
|
|
@@ -1346,7 +1306,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1346
1306
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1347
1307
|
let selectedResources = [];
|
|
1348
1308
|
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
1349
|
-
((
|
|
1309
|
+
((_j = (_i = item._productOrigin) == null ? void 0 : _i.product_resource) == null ? void 0 : _j.resources) || []
|
|
1350
1310
|
);
|
|
1351
1311
|
const currentResourcesRenderList = [];
|
|
1352
1312
|
resources2.forEach((n) => {
|
|
@@ -1394,11 +1354,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1394
1354
|
return recordCount >= currentCapacity;
|
|
1395
1355
|
});
|
|
1396
1356
|
});
|
|
1397
|
-
const targetRenderList = (
|
|
1357
|
+
const targetRenderList = (_k = productResources.find(
|
|
1398
1358
|
(n) => n.code === resources_code
|
|
1399
|
-
)) == null ? void 0 :
|
|
1359
|
+
)) == null ? void 0 : _k.renderList;
|
|
1400
1360
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
1401
|
-
if ((
|
|
1361
|
+
if ((_l = item._origin.resources) == null ? void 0 : _l.some(
|
|
1402
1362
|
(n) => n.form_id === targetRenderList[0].form_id
|
|
1403
1363
|
)) {
|
|
1404
1364
|
return;
|
|
@@ -1406,9 +1366,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1406
1366
|
const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
|
|
1407
1367
|
resources: targetRenderList,
|
|
1408
1368
|
currentCapacity,
|
|
1409
|
-
countMap: selectResourcesMap
|
|
1410
|
-
targetDate: (_k = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _k.date,
|
|
1411
|
-
durationMinutes: ((_l = item == null ? void 0 : item.duration) == null ? void 0 : _l.value) || ((_n = (_m = item == null ? void 0 : item._productOrigin) == null ? void 0 : _m.duration) == null ? void 0 : _n.value) || 10
|
|
1369
|
+
countMap: selectResourcesMap
|
|
1412
1370
|
});
|
|
1413
1371
|
const targetResource = fastestResource || targetRenderList[0];
|
|
1414
1372
|
targetResource.capacity = currentCapacity;
|
|
@@ -1445,7 +1403,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1445
1403
|
return { errorList };
|
|
1446
1404
|
}
|
|
1447
1405
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
1448
|
-
getTimeSlotByAllResources(resources_code
|
|
1406
|
+
getTimeSlotByAllResources(resources_code) {
|
|
1449
1407
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1450
1408
|
let dateRange = this.store.date.getDateRange();
|
|
1451
1409
|
const resources = [];
|
|
@@ -1603,7 +1561,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1603
1561
|
resourcesMap,
|
|
1604
1562
|
duration,
|
|
1605
1563
|
currentDate: dateRange[0].date,
|
|
1606
|
-
split,
|
|
1564
|
+
split: 10,
|
|
1607
1565
|
resourcesUseableMap,
|
|
1608
1566
|
capacity: maxCapacity,
|
|
1609
1567
|
cut_off_time: maxCutOffTime,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule
|
|
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;
|
|
@@ -16,7 +16,6 @@ export interface BookingByStepState {
|
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
17
|
salesSummary?: SalesSummaryModule;
|
|
18
18
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
19
|
-
holder: HolderModule;
|
|
20
19
|
}
|
|
21
20
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
22
21
|
export declare enum BookingByStepHooks {
|
|
@@ -81,11 +81,6 @@ function createModule(moduleName, solutionName, name, version) {
|
|
|
81
81
|
`${solutionName}_${name || moduleName}`,
|
|
82
82
|
version
|
|
83
83
|
);
|
|
84
|
-
case "holder":
|
|
85
|
-
return new import_modules.HolderModule(
|
|
86
|
-
`${solutionName}_${name || moduleName}`,
|
|
87
|
-
version
|
|
88
|
-
);
|
|
89
84
|
default:
|
|
90
85
|
throw new Error(`Unknown module type: ${moduleName}`);
|
|
91
86
|
}
|
|
@@ -49,27 +49,8 @@ var formatDefaultCapacitys = ({
|
|
|
49
49
|
const id = d.bundle_product_id;
|
|
50
50
|
const variantId = d.bundle_variant_id;
|
|
51
51
|
const item = ((capacity == null ? void 0 : capacity.package) || []).find(
|
|
52
|
-
(item2) => item2.product_id
|
|
52
|
+
(item2) => item2.product_id === id || item2.product_id === variantId
|
|
53
53
|
);
|
|
54
|
-
if (!item && (window == null ? void 0 : window.sendWarningLog)) {
|
|
55
|
-
window.sendWarningLog({
|
|
56
|
-
title: "未找到套餐 capacity 配置",
|
|
57
|
-
content: [
|
|
58
|
-
{
|
|
59
|
-
key: "product_id",
|
|
60
|
-
value: id
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
key: "variant_id",
|
|
64
|
-
value: variantId
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
key: "package",
|
|
68
|
-
value: JSON.stringify((capacity == null ? void 0 : capacity.package) || [])
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
54
|
return {
|
|
74
55
|
id,
|
|
75
56
|
value: item ? d.num || 0 : 0,
|
|
@@ -19,12 +19,10 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
|
|
|
19
19
|
* @param countMap 已预约数量映射
|
|
20
20
|
* @returns 最快可用的资源
|
|
21
21
|
*/
|
|
22
|
-
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap,
|
|
22
|
+
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
|
|
23
23
|
resources: ResourceItem[];
|
|
24
24
|
currentCapacity?: number;
|
|
25
25
|
countMap?: Record<number, number>;
|
|
26
|
-
targetDate?: string | Dayjs;
|
|
27
|
-
durationMinutes?: number;
|
|
28
26
|
}): ResourceItem | null;
|
|
29
27
|
/**
|
|
30
28
|
* 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
|