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