@pisell/pisellos 2.2.322 → 2.2.324
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/index.d.ts +2 -2
- package/dist/modules/BookingContext/index.js +55 -25
- package/dist/modules/BookingContext/types.d.ts +2 -0
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/dist/modules/BookingContext/utils/productExtend.js +122 -29
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +16 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +54 -11
- package/dist/modules/Order/index.js +2699 -1411
- package/dist/modules/Order/types.d.ts +43 -5
- package/dist/modules/Order/types.js +4 -0
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +18 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +5 -0
- package/dist/modules/ProductList/clientDataVariants.js +6 -2
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +161 -51
- package/dist/modules/ResourcePlanner/planner.js +58 -2
- package/dist/modules/ResourcePlanner/types.d.ts +13 -0
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +58 -39
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +1312 -1154
- package/dist/server/modules/order/index.js +2 -1
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +4 -0
- package/dist/shared/receipt/small-ticket.js +70 -12
- package/dist/solution/BaseSales/index.d.ts +40 -5
- package/dist/solution/BaseSales/index.js +1939 -1484
- package/dist/solution/BaseSales/types.d.ts +4 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
- package/dist/solution/BookingByStep/index.d.ts +16 -2
- package/dist/solution/BookingByStep/index.js +676 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +249 -135
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/OrderInvoicePreview/index.js +14 -8
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +166 -67
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/dist/solution/UnifiedBookingSales/index.js +3391 -1176
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/dist/solution/UnifiedBookingSales/types.js +7 -1
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/BookingContext/index.d.ts +2 -2
- package/lib/modules/BookingContext/index.js +42 -10
- package/lib/modules/BookingContext/types.d.ts +2 -0
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/lib/modules/BookingContext/utils/productExtend.js +96 -7
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +16 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +54 -11
- package/lib/modules/Order/index.js +659 -80
- package/lib/modules/Order/types.d.ts +43 -5
- package/lib/modules/Order/types.js +2 -0
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +19 -2
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +5 -0
- package/lib/modules/ProductList/clientDataVariants.js +6 -2
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +74 -0
- package/lib/modules/ResourcePlanner/planner.js +52 -1
- package/lib/modules/ResourcePlanner/types.d.ts +13 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +25 -9
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +124 -16
- package/lib/server/modules/order/index.js +2 -1
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +4 -0
- package/lib/shared/receipt/small-ticket.js +63 -8
- package/lib/solution/BaseSales/index.d.ts +40 -5
- package/lib/solution/BaseSales/index.js +296 -43
- package/lib/solution/BaseSales/types.d.ts +4 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +16 -2
- package/lib/solution/BookingByStep/index.js +222 -14
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +47 -4
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/OrderInvoicePreview/index.js +7 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +72 -2
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/lib/solution/UnifiedBookingSales/index.js +1339 -74
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/lib/solution/UnifiedBookingSales/types.js +4 -1
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -449,6 +449,17 @@ export interface ReplaceTempOrderOptions {
|
|
|
449
449
|
recalculateSummary?: boolean;
|
|
450
450
|
persist?: boolean;
|
|
451
451
|
saveDraft?: boolean;
|
|
452
|
+
/** Internal same-order updates may explicitly retain an anonymous order's session. */
|
|
453
|
+
preserveOrderSessionId?: string;
|
|
454
|
+
}
|
|
455
|
+
export interface OrderSessionChangedPayload {
|
|
456
|
+
sessionId: string | null;
|
|
457
|
+
previousSessionId: string | null;
|
|
458
|
+
}
|
|
459
|
+
export interface HydrateTempOrderOptions {
|
|
460
|
+
recalcOnHydrate?: boolean;
|
|
461
|
+
source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
|
|
462
|
+
preserveOrderSessionId?: string;
|
|
452
463
|
}
|
|
453
464
|
export type AddProductBookingInput = Record<string, any>;
|
|
454
465
|
/**
|
|
@@ -457,6 +468,8 @@ export type AddProductBookingInput = Record<string, any>;
|
|
|
457
468
|
* 避免步进器修改数量改变该组展示位置。
|
|
458
469
|
*/
|
|
459
470
|
export interface AddProductToOrderOptions {
|
|
471
|
+
/** Associates a selection with an existing runtime voucher group. */
|
|
472
|
+
productVoucherGroupKey?: string;
|
|
460
473
|
insertAfterProductUid?: string;
|
|
461
474
|
/** 新增商品行插入 products 首位,优先于 insertAfterProductUid。 */
|
|
462
475
|
insertAtStart?: boolean;
|
|
@@ -474,11 +487,22 @@ export interface AddProductToOrderOptions {
|
|
|
474
487
|
/** 发布后的订单/业务归属检查;只用于阻止旧异步收尾写入新单,不再校验截止或 revision。 */
|
|
475
488
|
availabilityCommitTargetGuard?: () => boolean;
|
|
476
489
|
}
|
|
490
|
+
/** Atomic replacement of one unsubmitted Party booking and its explicitly confirmed retail children. */
|
|
491
|
+
export interface ReplaceBookingProductWithRelatedRetailParams {
|
|
492
|
+
productLineUid: string;
|
|
493
|
+
product: Partial<OrderProduct> & OrderProductIdentity;
|
|
494
|
+
booking: AddProductBookingInput;
|
|
495
|
+
relatedRetailProducts: Array<Partial<OrderProduct> & OrderProductIdentity>;
|
|
496
|
+
availabilityCommitGuard: () => void;
|
|
497
|
+
availabilityCommitTargetGuard?: () => boolean;
|
|
498
|
+
}
|
|
477
499
|
/**
|
|
478
500
|
* 删除商品后的可选位置保持策略。
|
|
479
501
|
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
480
502
|
*/
|
|
481
503
|
export interface RemoveProductsFromOrderOptions {
|
|
504
|
+
/** Validate the selected row/cascade snapshot before mutation; may throw. Not called during finalization. */
|
|
505
|
+
beforeApply?: () => void;
|
|
482
506
|
/** 自动购物车写入的订单归属检查;失效时不再变更或发布异步收尾结果。 */
|
|
483
507
|
isCurrentOrder?: () => boolean;
|
|
484
508
|
preserveDisplayPosition?: {
|
|
@@ -523,6 +547,13 @@ export interface UpdateOrderProductParams {
|
|
|
523
547
|
*/
|
|
524
548
|
allow_booking_discount_reapply?: boolean;
|
|
525
549
|
}
|
|
550
|
+
/** Opt-in atomic draft update for asynchronous re-quotation callers. */
|
|
551
|
+
export interface UpdateOrderProductsOptions {
|
|
552
|
+
/** Validate the quoted source snapshot immediately before publication; may throw. */
|
|
553
|
+
beforeApply?: () => void;
|
|
554
|
+
/** Order/business ownership only. Called after publication too; exclude old prices/quantities. */
|
|
555
|
+
isCurrentOrder?: () => boolean;
|
|
556
|
+
}
|
|
526
557
|
/** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
|
|
527
558
|
export interface UpdateOrderProductQuantityParams extends OrderProductIdentity {
|
|
528
559
|
num: number;
|
|
@@ -557,6 +588,11 @@ export interface OrderHooksConfig {
|
|
|
557
588
|
beforeCartIntentCommit?: (context: OrderCartIntentCommitContext) => void;
|
|
558
589
|
/** Captures tenant/business runtime identity for asynchronous cart intents. */
|
|
559
590
|
getCartIntentScope?: () => unknown;
|
|
591
|
+
/** Awaited before a local cart draft is published. Reject to leave the live order unchanged. */
|
|
592
|
+
onBeforeCartCommit?: (context: {
|
|
593
|
+
currentItems: readonly OrderProduct[];
|
|
594
|
+
proposedItems: readonly OrderProduct[];
|
|
595
|
+
}) => void | Promise<void>;
|
|
560
596
|
onBeforeMergeProductToOrder?: (context: OrderProductMergeDecisionContext) => OrderProductMergeDecisionResult | Promise<OrderProductMergeDecisionResult>;
|
|
561
597
|
}
|
|
562
598
|
/**
|
|
@@ -862,6 +898,10 @@ export interface OrderModuleAPI {
|
|
|
862
898
|
salesSummaryModuleName?: string;
|
|
863
899
|
}) => void;
|
|
864
900
|
getTempOrder: () => OrderTempOrder | null;
|
|
901
|
+
/** Runtime-only identity; never part of an order or a persisted draft. */
|
|
902
|
+
getOrderSessionId: () => string | null;
|
|
903
|
+
/** Also rejects a session while an asynchronous order replacement is pending. */
|
|
904
|
+
isOrderSessionCurrent: (sessionId: string) => boolean;
|
|
865
905
|
ensureTempOrder: () => OrderTempOrder;
|
|
866
906
|
replaceTempOrder: (tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions) => Promise<OrderTempOrder>;
|
|
867
907
|
addNewOrder: () => Promise<OrderTempOrder>;
|
|
@@ -910,6 +950,7 @@ export interface OrderModuleAPI {
|
|
|
910
950
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
911
951
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
912
952
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
|
|
953
|
+
replaceBookingProductWithRelatedRetail: (params: ReplaceBookingProductWithRelatedRetailParams) => Promise<OrderProduct[]>;
|
|
913
954
|
getSalesNotes: () => SalesNote[];
|
|
914
955
|
createSalesNotesMutationSnapshot: () => SalesNotesMutationSnapshot;
|
|
915
956
|
restoreSalesNotesMutationSnapshot: (snapshot: SalesNotesMutationSnapshot) => void;
|
|
@@ -918,7 +959,7 @@ export interface OrderModuleAPI {
|
|
|
918
959
|
clearSalesNotes: () => Promise<void>;
|
|
919
960
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
920
961
|
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
921
|
-
updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
|
|
962
|
+
updateOrderProducts: (paramsList: UpdateOrderProductParams[], options?: UpdateOrderProductsOptions) => Promise<OrderProduct[]>;
|
|
922
963
|
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams, options?: {
|
|
923
964
|
isCurrentOrder?: () => boolean;
|
|
924
965
|
}) => Promise<OrderProduct[]>;
|
|
@@ -992,10 +1033,7 @@ export interface OrderModuleAPI {
|
|
|
992
1033
|
}) => OrderPaymentData[];
|
|
993
1034
|
sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
|
|
994
1035
|
saveDraft: () => Promise<void>;
|
|
995
|
-
hydrateTempOrderFromRecord: (record: Record<string, any>, options?:
|
|
996
|
-
recalcOnHydrate?: boolean;
|
|
997
|
-
source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
|
|
998
|
-
}) => Promise<OrderTempOrder>;
|
|
1036
|
+
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: HydrateTempOrderOptions) => Promise<OrderTempOrder>;
|
|
999
1037
|
syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
|
|
1000
1038
|
getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
|
|
1001
1039
|
getLastOrderInfo: () => Record<string, any> | undefined;
|
|
@@ -77,6 +77,8 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
77
77
|
* 避免步进器修改数量改变该组展示位置。
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
|
+
/** Atomic replacement of one unsubmitted Party booking and its explicitly confirmed retail children. */
|
|
81
|
+
|
|
80
82
|
/**
|
|
81
83
|
* 删除商品后的可选位置保持策略。
|
|
82
84
|
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
@@ -84,6 +86,8 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
84
86
|
|
|
85
87
|
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
|
|
86
88
|
|
|
89
|
+
/** Opt-in atomic draft update for asynchronous re-quotation callers. */
|
|
90
|
+
|
|
87
91
|
/** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
|
|
88
92
|
|
|
89
93
|
/**
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud saved orders with no payment rows report a zero gap, even while unpaid.
|
|
3
|
+
* Restore the OS payment target from the same snapshot, without repricing products.
|
|
4
|
+
* Voided rows are local payment history and are omitted from cloud checkout.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeUnpaidOrderAmountGap<T extends Record<string, any>>(order: T): T;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
|
+
import Decimal from 'decimal.js';
|
|
8
|
+
var UNPAID_STATUSES = new Set(['unpaid', 'payment_pending', 'payment_processing']);
|
|
9
|
+
var CANCELLED_STATUSES = new Set(['cancelled', 'canceled', 'voided']);
|
|
10
|
+
function firstValue() {
|
|
11
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12
|
+
values[_key] = arguments[_key];
|
|
13
|
+
}
|
|
14
|
+
return values.find(function (value) {
|
|
15
|
+
return value != null && String(value).trim() !== '';
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function money(value) {
|
|
19
|
+
if (typeof value !== 'string' && typeof value !== 'number') return undefined;
|
|
20
|
+
try {
|
|
21
|
+
var amount = new Decimal(value);
|
|
22
|
+
return amount.isFinite() ? amount : undefined;
|
|
23
|
+
} catch (_unused) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Cloud saved orders with no payment rows report a zero gap, even while unpaid.
|
|
30
|
+
* Restore the OS payment target from the same snapshot, without repricing products.
|
|
31
|
+
* Voided rows are local payment history and are omitted from cloud checkout.
|
|
32
|
+
*/
|
|
33
|
+
export function normalizeUnpaidOrderAmountGap(order) {
|
|
34
|
+
var _firstValue, _order$status, _money2;
|
|
35
|
+
var summary = order.summary && _typeof(order.summary) === 'object' && !Array.isArray(order.summary) ? order.summary : {};
|
|
36
|
+
var status = String((_firstValue = firstValue(order.payment_status, summary.payment_status, order.original_payment_status)) !== null && _firstValue !== void 0 ? _firstValue : '').trim().toLowerCase();
|
|
37
|
+
if (!UNPAID_STATUSES.has(status) || CANCELLED_STATUSES.has(String((_order$status = order.status) !== null && _order$status !== void 0 ? _order$status : '').trim().toLowerCase())) return order;
|
|
38
|
+
if (Array.isArray(order.refunds) && order.refunds.length > 0) return order;
|
|
39
|
+
|
|
40
|
+
// An omitted collection is a sparse patch, not proof that the order has no payments.
|
|
41
|
+
if (!Array.isArray(order.payments) || order.payments.some(function (payment) {
|
|
42
|
+
var _payment$status;
|
|
43
|
+
return String((_payment$status = payment === null || payment === void 0 ? void 0 : payment.status) !== null && _payment$status !== void 0 ? _payment$status : '').trim().toLowerCase() !== 'voided';
|
|
44
|
+
})) return order;
|
|
45
|
+
for (var _i = 0, _arr = ['order_paid_amount', 'customer_paid_amount', 'total_refund_amount', 'paid_amount', 'payment_amount']; _i < _arr.length; _i++) {
|
|
46
|
+
var field = _arr[_i];
|
|
47
|
+
var values = [summary[field], order[field]].filter(function (value) {
|
|
48
|
+
return value != null && String(value).trim() !== '';
|
|
49
|
+
});
|
|
50
|
+
if (values.some(function (value) {
|
|
51
|
+
var _money;
|
|
52
|
+
return !((_money = money(value)) !== null && _money !== void 0 && _money.isZero());
|
|
53
|
+
})) return order;
|
|
54
|
+
}
|
|
55
|
+
var gapValue = firstValue(summary.amount_gap, order.amount_gap);
|
|
56
|
+
if (gapValue !== undefined && !((_money2 = money(gapValue)) !== null && _money2 !== void 0 && _money2.isZero())) return order;
|
|
57
|
+
var expected = money(firstValue(summary.expect_amount, order.expect_amount, summary.total_amount, order.total_amount));
|
|
58
|
+
if (!(expected !== null && expected !== void 0 && expected.gt(0))) return order;
|
|
59
|
+
var target = expected;
|
|
60
|
+
if (Number(order.is_deposit) === 1) {
|
|
61
|
+
var deposit = money(firstValue(summary.deposit_amount, order.deposit_amount, 0));
|
|
62
|
+
if (!deposit || deposit.lt(0) || deposit.gt(expected)) return order;
|
|
63
|
+
if (deposit.gt(0)) target = deposit;
|
|
64
|
+
}
|
|
65
|
+
var amountGap = target.toFixed(2);
|
|
66
|
+
return _objectSpread(_objectSpread({}, order), {}, {
|
|
67
|
+
amount_gap: amountGap,
|
|
68
|
+
summary: _objectSpread(_objectSpread({}, summary), {}, {
|
|
69
|
+
amount_gap: amountGap
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -279,7 +279,7 @@ export function consolidateDiscountFreeProductLines(tempOrder) {
|
|
|
279
279
|
_step6;
|
|
280
280
|
try {
|
|
281
281
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
282
|
-
var _product$booking_uid, _product$metadata4, _booking_id, _product$metadata5, _product$order_detail, _holder_id, _product$metadata6, _product$metadata7, _product$metadata8, _product$product_sku2, _product$metadata9, _tempOrder$_extend, _product$selling_pric, _product$original_pri, _custom_price, _product$is_charge_ta, _product$gift_card, _product$bundle_edit, _product$metadata$pri, _product$metadata10, _product$metadata$sou, _product$metadata11, _product$metadata$mai, _product$metadata12, _product$metadata$mai2, _product$metadata13, _product$product_vari;
|
|
282
|
+
var _product$booking_uid, _product$metadata4, _booking_id, _product$metadata5, _product$order_detail, _holder_id, _product$metadata6, _product$metadata7, _product$metadata8, _product$product_sku2, _product$metadata9, _tempOrder$_extend, _product$selling_pric, _product$original_pri, _custom_price, _product$is_charge_ta, _product$gift_card, _product$bundle_edit, _product$metadata$pri, _product$metadata10, _product$metadata$sou, _product$metadata11, _product$metadata$mai, _product$metadata12, _product$metadata$mai2, _product$metadata13, _tempOrder$_extend$pr, _tempOrder$_extend2, _product$product_vari;
|
|
283
283
|
var product = _step6.value;
|
|
284
284
|
var productBundle = Array.isArray(product.product_bundle) ? product.product_bundle : [];
|
|
285
285
|
var hasDiscount = (product.discount_list || []).length > 0 || productBundle.some(function (bundle) {
|
|
@@ -337,7 +337,7 @@ export function consolidateDiscountFreeProductLines(tempOrder) {
|
|
|
337
337
|
};
|
|
338
338
|
})
|
|
339
339
|
});
|
|
340
|
-
var mergeKey = [discountSplitOriginUid, product.product_id, (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0, fingerprint, priceSignature].join('#');
|
|
340
|
+
var mergeKey = [discountSplitOriginUid, productUid ? (_tempOrder$_extend$pr = (_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.productsByUid) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2[productUid]) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2.productVoucherGroupKey) !== null && _tempOrder$_extend$pr !== void 0 ? _tempOrder$_extend$pr : '' : '', product.product_id, (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0, fingerprint, priceSignature].join('#');
|
|
341
341
|
var matchedIndex = productIndexByKey.get(mergeKey);
|
|
342
342
|
|
|
343
343
|
// 当前拆分来源 + 商品结构组合第一次出现时,保留该行作为回并目标。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Discount } from '../../Discount/types';
|
|
2
|
+
import type { OrderTempOrder } from '../types';
|
|
3
|
+
/** Runtime-only allocation constraints. Never copied into order/product metadata. */
|
|
4
|
+
export interface ProductVoucherGroup {
|
|
5
|
+
key: string;
|
|
6
|
+
discountIds: Array<number | string>;
|
|
7
|
+
}
|
|
8
|
+
export declare function productVoucherGroupKey(order: OrderTempOrder, product: any): string | undefined;
|
|
9
|
+
export declare function isUsableProductVoucher(discount: Discount): boolean;
|
|
10
|
+
export declare function voucherGroupError(): Error & {
|
|
11
|
+
code: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function allowsProductVoucher(order: OrderTempOrder | null | undefined, product: any, discount: Discount): boolean;
|
|
14
|
+
/** Reductions stay possible when a voucher expires; checkout always requires full coverage. */
|
|
15
|
+
export declare function validateProductVoucherGroups(order: OrderTempOrder, discounts: Discount[], previous?: OrderTempOrder, requireCoverage?: boolean): void;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
4
|
+
import { getDiscountUsageBlockReason } from "../../Discount/availability";
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
import { getDiscountTimeUnavailableReason } from "../../../solution/ShopDiscount/utils";
|
|
7
|
+
|
|
8
|
+
/** Runtime-only allocation constraints. Never copied into order/product metadata. */
|
|
9
|
+
|
|
10
|
+
export function productVoucherGroupKey(order, product) {
|
|
11
|
+
var _product$metadata$uni, _product$metadata, _order$_extend;
|
|
12
|
+
var uid = (_product$metadata$uni = product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product === null || product === void 0 ? void 0 : product.unique_identification_number;
|
|
13
|
+
return (_order$_extend = order._extend) === null || _order$_extend === void 0 || (_order$_extend = _order$_extend.productsByUid) === null || _order$_extend === void 0 || (_order$_extend = _order$_extend[String(uid)]) === null || _order$_extend === void 0 ? void 0 : _order$_extend.productVoucherGroupKey;
|
|
14
|
+
}
|
|
15
|
+
export function isUsableProductVoucher(discount) {
|
|
16
|
+
return (discount.tag || discount.type) === 'good_pass' && !discount.isEditMode && !discount.isDisabled && !getDiscountUsageBlockReason(discount) && !getDiscountTimeUnavailableReason(discount, dayjs().format('YYYY-MM-DD HH:mm:ss'));
|
|
17
|
+
}
|
|
18
|
+
export function voucherGroupError() {
|
|
19
|
+
return Object.assign(new Error('The selected items no longer match the available vouchers. Please adjust your selection.'), {
|
|
20
|
+
code: 'PRODUCT_VOUCHER_GROUP_INVALID'
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function allowsProductVoucher(order, product, discount) {
|
|
24
|
+
var _order$_extend2, _groups$find;
|
|
25
|
+
var groups = order === null || order === void 0 || (_order$_extend2 = order._extend) === null || _order$_extend2 === void 0 ? void 0 : _order$_extend2.productVoucherGroups;
|
|
26
|
+
if (!order || !(groups !== null && groups !== void 0 && groups.length)) return true;
|
|
27
|
+
var key = productVoucherGroupKey(order, product);
|
|
28
|
+
if (!key) return !groups.some(function (group) {
|
|
29
|
+
return group.discountIds.some(function (id) {
|
|
30
|
+
return String(id) === String(discount.id);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return (discount.tag || discount.type) === 'good_pass' && Boolean((_groups$find = groups.find(function (group) {
|
|
34
|
+
return group.key === key;
|
|
35
|
+
})) === null || _groups$find === void 0 ? void 0 : _groups$find.discountIds.some(function (id) {
|
|
36
|
+
return String(id) === String(discount.id);
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Reductions stay possible when a voucher expires; checkout always requires full coverage. */
|
|
41
|
+
export function validateProductVoucherGroups(order, discounts, previous) {
|
|
42
|
+
var _order$_extend3;
|
|
43
|
+
var requireCoverage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
44
|
+
var groups = (_order$_extend3 = order._extend) === null || _order$_extend3 === void 0 ? void 0 : _order$_extend3.productVoucherGroups;
|
|
45
|
+
if (!(groups !== null && groups !== void 0 && groups.length)) return;
|
|
46
|
+
var usedIds = new Set();
|
|
47
|
+
var byId = new Map(discounts.filter(isUsableProductVoucher).map(function (discount) {
|
|
48
|
+
return [String(discount.id), discount];
|
|
49
|
+
}));
|
|
50
|
+
var quantity = function quantity(item) {
|
|
51
|
+
var _ref, _item$num;
|
|
52
|
+
return Number((_ref = (_item$num = item.num) !== null && _item$num !== void 0 ? _item$num : item.product_quantity) !== null && _ref !== void 0 ? _ref : 0);
|
|
53
|
+
};
|
|
54
|
+
var _iterator = _createForOfIteratorHelper(groups),
|
|
55
|
+
_step;
|
|
56
|
+
try {
|
|
57
|
+
var _loop = function _loop() {
|
|
58
|
+
var _previous$products$fi;
|
|
59
|
+
var group = _step.value;
|
|
60
|
+
var items = order.products.filter(function (item) {
|
|
61
|
+
return productVoucherGroupKey(order, item) === group.key;
|
|
62
|
+
});
|
|
63
|
+
var selected = items.reduce(function (sum, item) {
|
|
64
|
+
return sum + quantity(item);
|
|
65
|
+
}, 0);
|
|
66
|
+
var before = (_previous$products$fi = previous === null || previous === void 0 ? void 0 : previous.products.filter(function (item) {
|
|
67
|
+
return productVoucherGroupKey(previous, item) === group.key;
|
|
68
|
+
}).reduce(function (sum, item) {
|
|
69
|
+
return sum + quantity(item);
|
|
70
|
+
}, 0)) !== null && _previous$products$fi !== void 0 ? _previous$products$fi : 0;
|
|
71
|
+
if (!requireCoverage && previous && selected <= before) return 0; // continue
|
|
72
|
+
var ids = new Set(group.discountIds.map(String).filter(function (id) {
|
|
73
|
+
return byId.has(id);
|
|
74
|
+
}));
|
|
75
|
+
if (!Number.isInteger(selected) || selected < 0 || selected > ids.size) throw voucherGroupError();
|
|
76
|
+
if (!requireCoverage) return 0; // continue
|
|
77
|
+
var _iterator2 = _createForOfIteratorHelper(items),
|
|
78
|
+
_step2;
|
|
79
|
+
try {
|
|
80
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
81
|
+
var _applied$0$discount$r, _applied$, _voucher$config;
|
|
82
|
+
var item = _step2.value;
|
|
83
|
+
var applied = (item.discount_list || []).filter(function (entry) {
|
|
84
|
+
return (entry.type || entry.tag) === 'good_pass';
|
|
85
|
+
});
|
|
86
|
+
// Rules splits a good_pass allocation into one physical line per instance.
|
|
87
|
+
var id = String((_applied$0$discount$r = (_applied$ = applied[0]) === null || _applied$ === void 0 || (_applied$ = _applied$.discount) === null || _applied$ === void 0 ? void 0 : _applied$.resource_id) !== null && _applied$0$discount$r !== void 0 ? _applied$0$discount$r : '');
|
|
88
|
+
var voucher = byId.get(id);
|
|
89
|
+
if (quantity(item) !== 1 || applied.length !== 1 || !ids.has(id) || !(voucher !== null && voucher !== void 0 && voucher.isAvailable) || ((_voucher$config = voucher.config) === null || _voucher$config === void 0 ? void 0 : _voucher$config.isAvailable) === false || usedIds.has(id)) throw voucherGroupError();
|
|
90
|
+
usedIds.add(id);
|
|
91
|
+
}
|
|
92
|
+
} catch (err) {
|
|
93
|
+
_iterator2.e(err);
|
|
94
|
+
} finally {
|
|
95
|
+
_iterator2.f();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
_ret;
|
|
99
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
100
|
+
_ret = _loop();
|
|
101
|
+
if (_ret === 0) continue;
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
_iterator.e(err);
|
|
105
|
+
} finally {
|
|
106
|
+
_iterator.f();
|
|
107
|
+
}
|
|
108
|
+
if (order.products.some(function (item) {
|
|
109
|
+
return !groups.some(function (group) {
|
|
110
|
+
return group.key === productVoucherGroupKey(order, item);
|
|
111
|
+
});
|
|
112
|
+
})) {
|
|
113
|
+
throw voucherGroupError();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -128,7 +128,9 @@ export declare function getBundleSellingMagnitude(bundle: Record<string, any> |
|
|
|
128
128
|
*
|
|
129
129
|
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
130
130
|
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
131
|
-
* (`metadata.source_product_price
|
|
131
|
+
* (`metadata.source_product_price`);买赠行的 `price` 为 0,`original_price` 仍保留 source。
|
|
132
|
+
* 赠品基础价已被赠送优惠抵扣,只有收费 option / bundle 继续按卡券规则计算。
|
|
133
|
+
* Rules 内部 `getProductTotalPrice` /
|
|
132
134
|
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
133
135
|
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
134
136
|
* total(source + option + bundle)对齐。
|
|
@@ -597,7 +597,9 @@ export function getBundleSellingMagnitude(bundle) {
|
|
|
597
597
|
*
|
|
598
598
|
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
599
599
|
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
600
|
-
* (`metadata.source_product_price
|
|
600
|
+
* (`metadata.source_product_price`);买赠行的 `price` 为 0,`original_price` 仍保留 source。
|
|
601
|
+
* 赠品基础价已被赠送优惠抵扣,只有收费 option / bundle 继续按卡券规则计算。
|
|
602
|
+
* Rules 内部 `getProductTotalPrice` /
|
|
601
603
|
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
602
604
|
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
603
605
|
* total(source + option + bundle)对齐。
|
|
@@ -901,7 +903,8 @@ export function createDefaultOrderRulesHooks(getBookings, getHolderRelations) {
|
|
|
901
903
|
_id: (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.unique_identification_number ? "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(product.metadata.unique_identification_number) : "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(buildProductLineFingerprint(getProductSkuOptions(product), product.product_bundle)),
|
|
902
904
|
// Rules 内部 getProductTotalPrice / getProductOriginTotalPrice 会各自再叠加 bundle + option,
|
|
903
905
|
// 所以这里必须喂 source-level(不含 option、不含 bundle、不含折扣)单价,避免双加 option。
|
|
904
|
-
|
|
906
|
+
// 赠品基础价不再参与卡券;source 元数据保留原价,供后续与赠送优惠相抵。
|
|
907
|
+
price: metadataAny._giftInfo ? '0.00' : sourcePrice,
|
|
905
908
|
// total / origin_total 使用 composite × num,跟 Rules 内部产出的 total 对齐(含 option + bundle)。
|
|
906
909
|
total: new Decimal(product.selling_price || 0).times(product.num || 1).toNumber(),
|
|
907
910
|
origin_total: new Decimal(product.original_price || product.selling_price || 0).times(product.num || 1).toNumber(),
|
|
@@ -1102,6 +1105,7 @@ function normalizeSubmitPlatform(platform) {
|
|
|
1102
1105
|
var lower = value.toLowerCase();
|
|
1103
1106
|
if (lower === 'pc') return 'PC';
|
|
1104
1107
|
if (lower === 'h5') return 'H5';
|
|
1108
|
+
if (lower === 'webpos') return 'pos';
|
|
1105
1109
|
return value;
|
|
1106
1110
|
}
|
|
1107
1111
|
function normalizeSubmitProductionCode(value) {
|
|
@@ -1218,7 +1222,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1218
1222
|
* 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
|
|
1219
1223
|
*/
|
|
1220
1224
|
function normalizeSubmitProduct(product) {
|
|
1221
|
-
var _ref39, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
|
|
1225
|
+
var _ref39, _submitProduct$bundle, _rawMetadata$pricing_, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
|
|
1222
1226
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1223
1227
|
var _ref38 = product,
|
|
1224
1228
|
_runtimeUid = _ref38.unique_identification_number,
|
|
@@ -1252,6 +1256,17 @@ function normalizeSubmitProduct(product) {
|
|
|
1252
1256
|
cleanMetadata[key] = rawMetadata[key];
|
|
1253
1257
|
}
|
|
1254
1258
|
}
|
|
1259
|
+
// Persist only an applied pricing snapshot, so reopening a saved order can
|
|
1260
|
+
// compare it with the latest catalog without reinterpreting legacy duration.
|
|
1261
|
+
var pricingMethod = (_rawMetadata$pricing_ = rawMetadata.pricing_method) === null || _rawMetadata$pricing_ === void 0 ? void 0 : _rawMetadata$pricing_.type;
|
|
1262
|
+
if (pricingMethod === 'duration_based' || pricingMethod === 'fixed_price') {
|
|
1263
|
+
cleanMetadata.pricing_method = {
|
|
1264
|
+
type: pricingMethod
|
|
1265
|
+
};
|
|
1266
|
+
if (pricingMethod === 'duration_based' && rawMetadata.duration) {
|
|
1267
|
+
cleanMetadata.duration = _objectSpread({}, rawMetadata.duration);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1255
1270
|
cleanMetadata.product_discount_difference = (_rawMetadata$product_ = rawMetadata.product_discount_difference) !== null && _rawMetadata$product_ !== void 0 ? _rawMetadata$product_ : '';
|
|
1256
1271
|
if (rawMetadata.price_breakdown) {
|
|
1257
1272
|
cleanMetadata.price_breakdown = rawMetadata.price_breakdown;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -42,6 +42,9 @@ export interface ProductSettlementOption extends Record<string, any> {
|
|
|
42
42
|
available: boolean;
|
|
43
43
|
disabled_reason?: string;
|
|
44
44
|
}
|
|
45
|
+
export interface ProductPricingMethod {
|
|
46
|
+
type: 'fixed_price' | 'duration_based';
|
|
47
|
+
}
|
|
45
48
|
/**
|
|
46
49
|
* 商品基本信息接口
|
|
47
50
|
*/
|
|
@@ -74,6 +77,8 @@ export interface ProductData {
|
|
|
74
77
|
sum_stock: number;
|
|
75
78
|
/** 商品价格 */
|
|
76
79
|
price: string;
|
|
80
|
+
/** POS booking pricing; missing configuration retains existing fixed pricing. */
|
|
81
|
+
pricing_method?: ProductPricingMethod;
|
|
77
82
|
/** 当前上下文解析出的可选结算货币 */
|
|
78
83
|
available_settlement_options?: ProductSettlementOption[];
|
|
79
84
|
/** 商品原价 */
|
|
@@ -39,7 +39,9 @@ function collectReferencedRuleIds(products) {
|
|
|
39
39
|
variants.forEach(function (variant) {
|
|
40
40
|
var _variant$data_variant;
|
|
41
41
|
var id = String((_variant$data_variant = variant === null || variant === void 0 ? void 0 : variant.data_variant_rule_id) !== null && _variant$data_variant !== void 0 ? _variant$data_variant : '').trim();
|
|
42
|
-
|
|
42
|
+
// Rule 0 is the default-variant sentinel, not a strategy to load.
|
|
43
|
+
// Keep the evaluator responsible for its pricing/settlement semantics.
|
|
44
|
+
if (id && Number(id) !== 0) ids.add(id);
|
|
43
45
|
});
|
|
44
46
|
};
|
|
45
47
|
products.forEach(function (product) {
|
|
@@ -60,13 +62,15 @@ function isEvaluatorReady(evaluator, products) {
|
|
|
60
62
|
// A referenced Data Variant cannot be evaluated authoritatively until those
|
|
61
63
|
// configs have arrived. Evaluators without this capability remain compatible.
|
|
62
64
|
if (typeof evaluator.getStrategyConfigs === 'function') {
|
|
65
|
+
var referencedRuleIds = collectReferencedRuleIds(products);
|
|
66
|
+
if (referencedRuleIds.size === 0) return true;
|
|
63
67
|
var configs = evaluator.getStrategyConfigs();
|
|
64
68
|
if (!Array.isArray(configs) || configs.length === 0) return false;
|
|
65
69
|
var availableRuleIds = new Set(configs.map(function (config) {
|
|
66
70
|
var _config$metadata$id, _config$metadata;
|
|
67
71
|
return String((_config$metadata$id = config === null || config === void 0 || (_config$metadata = config.metadata) === null || _config$metadata === void 0 ? void 0 : _config$metadata.id) !== null && _config$metadata$id !== void 0 ? _config$metadata$id : '').trim();
|
|
68
72
|
}).filter(Boolean));
|
|
69
|
-
return Array.from(
|
|
73
|
+
return Array.from(referencedRuleIds).every(function (id) {
|
|
70
74
|
return availableRuleIds.has(id);
|
|
71
75
|
});
|
|
72
76
|
}
|
|
@@ -37,6 +37,8 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
37
37
|
schedule_date?: string;
|
|
38
38
|
channel?: string;
|
|
39
39
|
}): Promise<any>;
|
|
40
|
+
/** Venue-only raw, complete pool load. No date/customer evaluation and no shared catalog publication. */
|
|
41
|
+
loadVenueCatalogPool(params?: Pick<ProductListLoadProductsParams, 'product_ids' | 'collection' | 'category_ids' | 'extension_type' | 'cacheId'>): Promise<ProductData[]>;
|
|
40
42
|
/**
|
|
41
43
|
* Remember raw remote product records before client-side Data Variant
|
|
42
44
|
* evaluation. Quote-only reads can then always start from a clean baseline.
|