@pisell/pisellos 0.10.90 → 0.10.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +103 -112
- 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 +21 -0
- package/dist/modules/BookingContext/utils/productExtend.js +132 -33
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/Cart/index.js +4 -3
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +59 -32
- 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/OpenData/salesSettings.js +1 -1
- package/dist/modules/OpenData/types.d.ts +9 -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 +22 -7
- package/dist/modules/Order/index.js +1565 -1161
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/types.d.ts +33 -11
- package/dist/modules/Order/types.js +2 -2
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils.d.ts +4 -1
- package/dist/modules/Order/utils.js +75 -52
- package/dist/modules/Payment/walletpass.js +32 -6
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +16 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +383 -24
- package/dist/modules/ResourcePlanner/types.d.ts +42 -0
- package/dist/modules/Rules/index.js +86 -54
- 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 +9 -0
- package/dist/server/index.js +1928 -1462
- package/dist/server/modules/form/index.d.ts +19 -0
- package/dist/server/modules/form/index.js +205 -0
- package/dist/server/modules/form/types.d.ts +13 -0
- package/dist/server/modules/form/types.js +3 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/index.d.ts +21 -0
- package/dist/server/modules/order/index.js +1399 -831
- package/dist/server/modules/order/types.d.ts +3 -0
- package/dist/server/modules/order/utils/filterOrders.js +20 -0
- package/dist/server/modules/products/index.d.ts +28 -7
- package/dist/server/modules/products/index.js +1295 -769
- package/dist/server/modules/products/replication.d.ts +8 -0
- package/dist/server/modules/products/replication.js +69 -0
- package/dist/server/modules/products/types.d.ts +12 -1
- package/dist/server/modules/products/types.js +4 -0
- 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 +1 -0
- package/dist/shared/receipt/small-ticket.js +58 -26
- package/dist/shared/receipt/templateVisibility.d.ts +3 -0
- package/dist/shared/receipt/templateVisibility.js +6 -2
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +22 -6
- package/dist/solution/BaseSales/index.js +1881 -1347
- package/dist/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/dist/solution/BaseSales/pickupTiming.js +35 -8
- 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 +20 -4
- package/dist/solution/BookingByStep/index.js +681 -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 +10 -0
- package/dist/solution/BookingTicket/index.js +686 -598
- package/dist/solution/BookingTicket/types.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
- 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/applyGlobalScan.js +58 -94
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +33 -62
- package/dist/solution/OrderInvoicePreview/index.js +4 -3
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +230 -97
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/ScanOrder/types.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/dist/solution/UnifiedBookingSales/index.js +2493 -1496
- package/dist/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/dist/solution/UnifiedBookingSales/types.d.ts +20 -5
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +22 -21
- 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 +21 -0
- package/lib/modules/BookingContext/utils/productExtend.js +104 -5
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/Cart/index.js +4 -2
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +39 -20
- 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/OpenData/salesSettings.js +1 -1
- package/lib/modules/OpenData/types.d.ts +9 -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 +22 -7
- package/lib/modules/Order/index.js +457 -174
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/types.d.ts +33 -11
- package/lib/modules/Order/types.js +2 -2
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils.d.ts +4 -1
- package/lib/modules/Order/utils.js +29 -3
- package/lib/modules/Payment/walletpass.js +23 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +16 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +299 -9
- package/lib/modules/ResourcePlanner/types.d.ts +42 -0
- package/lib/modules/Rules/index.js +32 -3
- 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 +9 -0
- package/lib/server/index.js +279 -30
- package/lib/server/modules/form/index.d.ts +19 -0
- package/lib/server/modules/form/index.js +73 -0
- package/lib/server/modules/form/types.d.ts +13 -0
- package/lib/server/modules/form/types.js +9 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +15 -1
- package/lib/server/modules/order/index.d.ts +21 -0
- package/lib/server/modules/order/index.js +344 -35
- package/lib/server/modules/order/types.d.ts +3 -0
- package/lib/server/modules/order/utils/filterOrders.js +18 -0
- package/lib/server/modules/products/index.d.ts +28 -7
- package/lib/server/modules/products/index.js +224 -62
- package/lib/server/modules/products/replication.d.ts +8 -0
- package/lib/server/modules/products/replication.js +30 -0
- package/lib/server/modules/products/types.d.ts +12 -1
- package/lib/server/modules/products/types.js +3 -0
- 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 +1 -0
- package/lib/shared/receipt/small-ticket.js +53 -25
- package/lib/shared/receipt/templateVisibility.d.ts +3 -0
- package/lib/shared/receipt/templateVisibility.js +6 -2
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +22 -6
- package/lib/solution/BaseSales/index.js +347 -59
- package/lib/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/lib/solution/BaseSales/pickupTiming.js +24 -3
- 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 +20 -4
- package/lib/solution/BookingByStep/index.js +229 -17
- 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 +10 -0
- package/lib/solution/BookingTicket/index.js +57 -6
- package/lib/solution/BookingTicket/types.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +34 -4
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
- 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/applyGlobalScan.js +2 -14
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +17 -34
- package/lib/solution/OrderInvoicePreview/index.js +1 -0
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +131 -22
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/ScanOrder/types.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/lib/solution/UnifiedBookingSales/index.js +717 -144
- package/lib/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/lib/solution/UnifiedBookingSales/types.d.ts +20 -5
- 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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Local reconciliation state; never part of a cloud checkout payload. */
|
|
2
|
+
export declare const LOCAL_EFTPOS_REFRESH_REQUIRED = "_local_eftpos_refresh_required";
|
|
3
|
+
export declare const LOCAL_EFTPOS_FINALIZED = "_local_eftpos_finalized";
|
|
4
|
+
export declare const PAYMENT_REFRESH_MESSAGE = "\u8BA2\u5355\u9700\u8981\u5237\u65B0\uFF0C\u8BF7\u8054\u7F51\u5237\u65B0\u8BA2\u5355\u540E\u518D\u4ED8\u6B3E";
|
|
5
|
+
export interface LocalEftposFinalization {
|
|
6
|
+
saleId: string | number;
|
|
7
|
+
paymentNumber: string;
|
|
8
|
+
result: 'failed' | 'not_started';
|
|
9
|
+
failedTransactionNumbers: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function requiresLocalPaymentRefresh(order: any): boolean;
|
|
12
|
+
export declare function isLocalFinalizedPayment(payment: any): boolean;
|
|
13
|
+
export declare function stripLocalEftposState<T extends Record<string, any>>(order: T): T;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
/** Local reconciliation state; never part of a cloud checkout payload. */
|
|
8
|
+
export var LOCAL_EFTPOS_REFRESH_REQUIRED = '_local_eftpos_refresh_required';
|
|
9
|
+
export var LOCAL_EFTPOS_FINALIZED = '_local_eftpos_finalized';
|
|
10
|
+
export var PAYMENT_REFRESH_MESSAGE = '订单需要刷新,请联网刷新订单后再付款';
|
|
11
|
+
export function requiresLocalPaymentRefresh(order) {
|
|
12
|
+
var _order$metadata;
|
|
13
|
+
return (order === null || order === void 0 || (_order$metadata = order.metadata) === null || _order$metadata === void 0 ? void 0 : _order$metadata[LOCAL_EFTPOS_REFRESH_REQUIRED]) === true;
|
|
14
|
+
}
|
|
15
|
+
export function isLocalFinalizedPayment(payment) {
|
|
16
|
+
var _payment$metadata;
|
|
17
|
+
return (payment === null || payment === void 0 ? void 0 : payment.status) === 'voided' && (payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata[LOCAL_EFTPOS_FINALIZED]) === true;
|
|
18
|
+
}
|
|
19
|
+
export function stripLocalEftposState(order) {
|
|
20
|
+
var result = _objectSpread({}, order);
|
|
21
|
+
if (order.metadata) {
|
|
22
|
+
result.metadata = _objectSpread({}, order.metadata);
|
|
23
|
+
delete result.metadata[LOCAL_EFTPOS_REFRESH_REQUIRED];
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(order.payments)) {
|
|
26
|
+
result.payments = order.payments.filter(function (payment) {
|
|
27
|
+
return !isLocalFinalizedPayment(payment);
|
|
28
|
+
}).map(function (payment) {
|
|
29
|
+
var _payment$metadata2;
|
|
30
|
+
if (!((_payment$metadata2 = payment.metadata) !== null && _payment$metadata2 !== void 0 && _payment$metadata2[LOCAL_EFTPOS_FINALIZED])) return payment;
|
|
31
|
+
var metadata = _objectSpread({}, payment.metadata);
|
|
32
|
+
delete metadata[LOCAL_EFTPOS_FINALIZED];
|
|
33
|
+
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
34
|
+
metadata: metadata
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
@@ -71,8 +71,8 @@ export interface OrderGiftSelectResult {
|
|
|
71
71
|
/**
|
|
72
72
|
* 赠品解析回调签名(SDK → OS 的返回值)。
|
|
73
73
|
*
|
|
74
|
-
* -
|
|
75
|
-
* -
|
|
74
|
+
* - 唯一且无规格/套餐的候选:SDK 自动构造商品
|
|
75
|
+
* - 有规格/套餐或多个候选:SDK 弹窗等用户确认后构造
|
|
76
76
|
* - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
|
|
77
77
|
*
|
|
78
78
|
* 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
|
|
@@ -213,6 +213,7 @@ export interface VirtualCurrencySnapshotItem {
|
|
|
213
213
|
id: number | string;
|
|
214
214
|
tag: 'virtual_currency';
|
|
215
215
|
product_id?: number | string;
|
|
216
|
+
code?: string;
|
|
216
217
|
product_name: string;
|
|
217
218
|
par_value: string;
|
|
218
219
|
used_par_value: string;
|
|
@@ -448,6 +449,17 @@ export interface ReplaceTempOrderOptions {
|
|
|
448
449
|
recalculateSummary?: boolean;
|
|
449
450
|
persist?: boolean;
|
|
450
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;
|
|
451
463
|
}
|
|
452
464
|
export type AddProductBookingInput = Record<string, any>;
|
|
453
465
|
/**
|
|
@@ -459,13 +471,20 @@ export interface AddProductToOrderOptions {
|
|
|
459
471
|
/** Associates a selection with an existing runtime voucher group. */
|
|
460
472
|
productVoucherGroupKey?: string;
|
|
461
473
|
insertAfterProductUid?: string;
|
|
474
|
+
/** 新增商品行插入 products 首位,优先于 insertAfterProductUid。 */
|
|
475
|
+
insertAtStart?: boolean;
|
|
462
476
|
/** 跳过同商品/规格匹配,始终新增购物车行。 */
|
|
463
477
|
disableMerge?: boolean;
|
|
464
478
|
/** 商品行 UID 落定后,由 OrderModule 原子绑定到该行的 Sales Notes 草稿。 */
|
|
465
479
|
salesNotes?: SalesNoteDraftInput[];
|
|
466
|
-
/**
|
|
480
|
+
/**
|
|
481
|
+
* 自动预约加购的同步提交门禁;抛错时不发布本次新增。
|
|
482
|
+
* 带门禁时先在私有草稿中准备全部商品/booking,异步等待后及原子发布前重新调用。
|
|
483
|
+
* 门禁须校验当前订单身份/版本和真实时间;发布前不会因本次拆行改变订单版本。
|
|
484
|
+
* 不传时保留原有人工加购行为。
|
|
485
|
+
*/
|
|
467
486
|
availabilityCommitGuard?: () => void;
|
|
468
|
-
/**
|
|
487
|
+
/** 发布后的订单/业务归属检查;只用于阻止旧异步收尾写入新单,不再校验截止或 revision。 */
|
|
469
488
|
availabilityCommitTargetGuard?: () => boolean;
|
|
470
489
|
}
|
|
471
490
|
/** Atomic replacement of one unsubmitted Party booking and its explicitly confirmed retail children. */
|
|
@@ -482,9 +501,9 @@ export interface ReplaceBookingProductWithRelatedRetailParams {
|
|
|
482
501
|
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
483
502
|
*/
|
|
484
503
|
export interface RemoveProductsFromOrderOptions {
|
|
485
|
-
/**
|
|
504
|
+
/** Validate the selected row/cascade snapshot before mutation; may throw. Not called during finalization. */
|
|
486
505
|
beforeApply?: () => void;
|
|
487
|
-
/**
|
|
506
|
+
/** 自动购物车写入的订单归属检查;失效时不再变更或发布异步收尾结果。 */
|
|
488
507
|
isCurrentOrder?: () => boolean;
|
|
489
508
|
preserveDisplayPosition?: {
|
|
490
509
|
remainingProductUid: string;
|
|
@@ -879,6 +898,10 @@ export interface OrderModuleAPI {
|
|
|
879
898
|
salesSummaryModuleName?: string;
|
|
880
899
|
}) => void;
|
|
881
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;
|
|
882
905
|
ensureTempOrder: () => OrderTempOrder;
|
|
883
906
|
replaceTempOrder: (tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions) => Promise<OrderTempOrder>;
|
|
884
907
|
addNewOrder: () => Promise<OrderTempOrder>;
|
|
@@ -937,7 +960,9 @@ export interface OrderModuleAPI {
|
|
|
937
960
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
938
961
|
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
939
962
|
updateOrderProducts: (paramsList: UpdateOrderProductParams[], options?: UpdateOrderProductsOptions) => Promise<OrderProduct[]>;
|
|
940
|
-
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams
|
|
963
|
+
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams, options?: {
|
|
964
|
+
isCurrentOrder?: () => boolean;
|
|
965
|
+
}) => Promise<OrderProduct[]>;
|
|
941
966
|
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
942
967
|
removeProductFromOrder: (identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
943
968
|
/** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
@@ -1008,10 +1033,7 @@ export interface OrderModuleAPI {
|
|
|
1008
1033
|
}) => OrderPaymentData[];
|
|
1009
1034
|
sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
|
|
1010
1035
|
saveDraft: () => Promise<void>;
|
|
1011
|
-
hydrateTempOrderFromRecord: (record: Record<string, any>, options?:
|
|
1012
|
-
recalcOnHydrate?: boolean;
|
|
1013
|
-
source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
|
|
1014
|
-
}) => Promise<OrderTempOrder>;
|
|
1036
|
+
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: HydrateTempOrderOptions) => Promise<OrderTempOrder>;
|
|
1015
1037
|
syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
|
|
1016
1038
|
getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
|
|
1017
1039
|
getLastOrderInfo: () => Record<string, any> | undefined;
|
|
@@ -30,8 +30,8 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
30
30
|
/**
|
|
31
31
|
* 赠品解析回调签名(SDK → OS 的返回值)。
|
|
32
32
|
*
|
|
33
|
-
* -
|
|
34
|
-
* -
|
|
33
|
+
* - 唯一且无规格/套餐的候选:SDK 自动构造商品
|
|
34
|
+
* - 有规格/套餐或多个候选:SDK 弹窗等用户确认后构造
|
|
35
35
|
* - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
|
|
36
36
|
*
|
|
37
37
|
* 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
|
|
@@ -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
|
+
}
|
|
@@ -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)对齐。
|
|
@@ -217,6 +219,7 @@ export declare function normalizeBookingSubType(booking: Record<string, any>): s
|
|
|
217
219
|
export declare function normalizeSubmitBooking<T extends {
|
|
218
220
|
metadata?: Record<string, any>;
|
|
219
221
|
}>(booking: T): T;
|
|
222
|
+
export declare function resolveTableOccupancyDuration(tempOrder: OrderTempOrder): number;
|
|
220
223
|
/** 提交用人数:有限且为正则向下取整,否则为 1 */
|
|
221
224
|
export declare function normalizeSubmitCollectPaxValue(value: unknown): number;
|
|
222
225
|
/** 从临时订单 metadata 解析合成 booking 的 collect_pax */
|
|
@@ -190,6 +190,10 @@ export function normalizeVirtualCurrencySnapshotItem(value) {
|
|
|
190
190
|
if (productId !== undefined) {
|
|
191
191
|
snapshot.product_id = productId;
|
|
192
192
|
}
|
|
193
|
+
var code = normalizeSnapshotScalar(value.code);
|
|
194
|
+
if (code !== undefined) {
|
|
195
|
+
snapshot.code = String(code).trim();
|
|
196
|
+
}
|
|
193
197
|
return snapshot;
|
|
194
198
|
}
|
|
195
199
|
function normalizeVirtualCurrencySnapshotList(value) {
|
|
@@ -221,6 +225,10 @@ export function buildVirtualCurrencySnapshotFromList(value) {
|
|
|
221
225
|
if (productId !== undefined) {
|
|
222
226
|
snapshot.product_id = productId;
|
|
223
227
|
}
|
|
228
|
+
var code = normalizeSnapshotScalar(item.code);
|
|
229
|
+
if (code !== undefined) {
|
|
230
|
+
snapshot.code = String(code).trim();
|
|
231
|
+
}
|
|
224
232
|
result.push(snapshot);
|
|
225
233
|
return result;
|
|
226
234
|
}, []);
|
|
@@ -622,7 +630,9 @@ export function getBundleSellingMagnitude(bundle) {
|
|
|
622
630
|
*
|
|
623
631
|
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
624
632
|
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
625
|
-
* (`metadata.source_product_price
|
|
633
|
+
* (`metadata.source_product_price`);买赠行的 `price` 为 0,`original_price` 仍保留 source。
|
|
634
|
+
* 赠品基础价已被赠送优惠抵扣,只有收费 option / bundle 继续按卡券规则计算。
|
|
635
|
+
* Rules 内部 `getProductTotalPrice` /
|
|
626
636
|
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
627
637
|
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
628
638
|
* total(source + option + bundle)对齐。
|
|
@@ -926,7 +936,8 @@ export function createDefaultOrderRulesHooks(getBookings, getHolderRelations) {
|
|
|
926
936
|
_id: (_product$metadata9 = product.metadata) !== null && _product$metadata9 !== void 0 && _product$metadata9.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)),
|
|
927
937
|
// Rules 内部 getProductTotalPrice / getProductOriginTotalPrice 会各自再叠加 bundle + option,
|
|
928
938
|
// 所以这里必须喂 source-level(不含 option、不含 bundle、不含折扣)单价,避免双加 option。
|
|
929
|
-
|
|
939
|
+
// 赠品基础价不再参与卡券;source 元数据保留原价,供后续与赠送优惠相抵。
|
|
940
|
+
price: metadataAny._giftInfo ? '0.00' : sourcePrice,
|
|
930
941
|
// total / origin_total 使用 composite × num,跟 Rules 内部产出的 total 对齐(含 option + bundle)。
|
|
931
942
|
total: new Decimal(product.selling_price || 0).times(product.num || 1).toNumber(),
|
|
932
943
|
origin_total: new Decimal(product.original_price || product.selling_price || 0).times(product.num || 1).toNumber(),
|
|
@@ -1127,6 +1138,7 @@ function normalizeSubmitPlatform(platform) {
|
|
|
1127
1138
|
var lower = value.toLowerCase();
|
|
1128
1139
|
if (lower === 'pc') return 'PC';
|
|
1129
1140
|
if (lower === 'h5') return 'H5';
|
|
1141
|
+
if (lower === 'webpos') return 'pos';
|
|
1130
1142
|
return value;
|
|
1131
1143
|
}
|
|
1132
1144
|
function normalizeSubmitProductionCode(value) {
|
|
@@ -1140,10 +1152,10 @@ function formatSubmitOptionItems(options) {
|
|
|
1140
1152
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1141
1153
|
if (!Array.isArray(options)) return [];
|
|
1142
1154
|
return options.map(function (d) {
|
|
1143
|
-
var _d$add_price;
|
|
1155
|
+
var _ref35, _d$option_group_item_, _d$add_price;
|
|
1144
1156
|
var option = _objectSpread(_objectSpread({}, d && _typeof(d) === 'object' ? d : {}), {}, {
|
|
1145
1157
|
num: d === null || d === void 0 ? void 0 : d.num,
|
|
1146
|
-
option_group_item_id: d === null || d === void 0 ? void 0 : d.option_group_item_id,
|
|
1158
|
+
option_group_item_id: (_ref35 = (_d$option_group_item_ = d === null || d === void 0 ? void 0 : d.option_group_item_id) !== null && _d$option_group_item_ !== void 0 ? _d$option_group_item_ : d === null || d === void 0 ? void 0 : d.product_option_item_id) !== null && _ref35 !== void 0 ? _ref35 : d === null || d === void 0 ? void 0 : d.id,
|
|
1147
1159
|
option_group_id: d === null || d === void 0 ? void 0 : d.option_group_id
|
|
1148
1160
|
});
|
|
1149
1161
|
var productionCode = normalizeSubmitProductionCode(d === null || d === void 0 ? void 0 : d.production_code);
|
|
@@ -1176,7 +1188,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1176
1188
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1177
1189
|
if (!Array.isArray(bundle)) return [];
|
|
1178
1190
|
return bundle.map(function (b) {
|
|
1179
|
-
var
|
|
1191
|
+
var _ref36, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref37, _rawBundle$price_type, _ref38, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
|
|
1180
1192
|
var rawBundle = b && _typeof(b) === 'object' ? b : {};
|
|
1181
1193
|
var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
|
|
1182
1194
|
var _customProductBundleMapId = existedMetadata.custom_product_bundle_map_id,
|
|
@@ -1187,7 +1199,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1187
1199
|
var sellingPrice = formatOptions.virtualSettlementMode ? '0.00' : getBundleSellingMagnitude(rawBundle).toFixed(2);
|
|
1188
1200
|
// payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
|
|
1189
1201
|
var paymentPrice = formatOptions.virtualSettlementMode ? '0.00' : rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
|
|
1190
|
-
var priceValue = formatOptions.virtualSettlementMode ? 0 : (
|
|
1202
|
+
var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref36 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref36 !== void 0 ? _ref36 : rawBundle.bundle_selling_price;
|
|
1191
1203
|
var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
|
|
1192
1204
|
var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
|
|
1193
1205
|
var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
|
|
@@ -1206,8 +1218,8 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1206
1218
|
extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
|
|
1207
1219
|
extension_type: (_rawBundle$extension_2 = rawBundle.extension_type) !== null && _rawBundle$extension_2 !== void 0 ? _rawBundle$extension_2 : 'normal',
|
|
1208
1220
|
price: priceValue,
|
|
1209
|
-
price_type: (
|
|
1210
|
-
price_type_ext: (
|
|
1221
|
+
price_type: (_ref37 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref37 !== void 0 ? _ref37 : '',
|
|
1222
|
+
price_type_ext: (_ref38 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref38 !== void 0 ? _ref38 : '',
|
|
1211
1223
|
bundle_selling_price: sellingPrice,
|
|
1212
1224
|
bundle_payment_price: paymentPrice,
|
|
1213
1225
|
option: formatSubmitOptionItems(rawBundle.option, formatOptions),
|
|
@@ -1243,11 +1255,11 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1243
1255
|
* 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
|
|
1244
1256
|
*/
|
|
1245
1257
|
function normalizeSubmitProduct(product) {
|
|
1246
|
-
var
|
|
1258
|
+
var _ref40, _submitProduct$bundle, _rawMetadata$pricing_, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
|
|
1247
1259
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1248
|
-
var
|
|
1249
|
-
_runtimeUid =
|
|
1250
|
-
submitProduct = _objectWithoutProperties(
|
|
1260
|
+
var _ref39 = product,
|
|
1261
|
+
_runtimeUid = _ref39.unique_identification_number,
|
|
1262
|
+
submitProduct = _objectWithoutProperties(_ref39, _excluded2);
|
|
1251
1263
|
var num = submitProduct.num,
|
|
1252
1264
|
_productExtend = submitProduct._extend,
|
|
1253
1265
|
_productSurchargeFee = submitProduct.surcharge_fee,
|
|
@@ -1265,7 +1277,7 @@ function normalizeSubmitProduct(product) {
|
|
|
1265
1277
|
// 兼容历史 BigSale 编辑链路:bundle_edit 曾被写入 metadata,
|
|
1266
1278
|
// 出站时需提升到商品顶层;套餐未编辑时也必须显式提交 0。
|
|
1267
1279
|
var hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
|
|
1268
|
-
var bundleEdit = (
|
|
1280
|
+
var bundleEdit = (_ref40 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref40 !== void 0 ? _ref40 : hasProductBundle ? 0 : undefined;
|
|
1269
1281
|
var cleanMetadata = {};
|
|
1270
1282
|
if (rawMetadata.unique_identification_number) {
|
|
1271
1283
|
cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
|
|
@@ -1277,6 +1289,17 @@ function normalizeSubmitProduct(product) {
|
|
|
1277
1289
|
cleanMetadata[key] = rawMetadata[key];
|
|
1278
1290
|
}
|
|
1279
1291
|
}
|
|
1292
|
+
// Persist only an applied pricing snapshot, so reopening a saved order can
|
|
1293
|
+
// compare it with the latest catalog without reinterpreting legacy duration.
|
|
1294
|
+
var pricingMethod = (_rawMetadata$pricing_ = rawMetadata.pricing_method) === null || _rawMetadata$pricing_ === void 0 ? void 0 : _rawMetadata$pricing_.type;
|
|
1295
|
+
if (pricingMethod === 'duration_based' || pricingMethod === 'fixed_price') {
|
|
1296
|
+
cleanMetadata.pricing_method = {
|
|
1297
|
+
type: pricingMethod
|
|
1298
|
+
};
|
|
1299
|
+
if (pricingMethod === 'duration_based' && rawMetadata.duration) {
|
|
1300
|
+
cleanMetadata.duration = _objectSpread({}, rawMetadata.duration);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1280
1303
|
cleanMetadata.product_discount_difference = (_rawMetadata$product_ = rawMetadata.product_discount_difference) !== null && _rawMetadata$product_ !== void 0 ? _rawMetadata$product_ : '';
|
|
1281
1304
|
if (rawMetadata.price_breakdown) {
|
|
1282
1305
|
cleanMetadata.price_breakdown = rawMetadata.price_breakdown;
|
|
@@ -1370,10 +1393,10 @@ export function restoreRedeemVoucherTimes(order, vouchers) {
|
|
|
1370
1393
|
}), booking.end_date && {
|
|
1371
1394
|
expire_date: booking.end_date
|
|
1372
1395
|
});
|
|
1373
|
-
var timeChanged = Object.entries(times).some(function (
|
|
1374
|
-
var
|
|
1375
|
-
key =
|
|
1376
|
-
value =
|
|
1396
|
+
var timeChanged = Object.entries(times).some(function (_ref41) {
|
|
1397
|
+
var _ref42 = _slicedToArray(_ref41, 2),
|
|
1398
|
+
key = _ref42[0],
|
|
1399
|
+
value = _ref42[1];
|
|
1377
1400
|
return voucher[key] !== value;
|
|
1378
1401
|
});
|
|
1379
1402
|
if (!timeChanged) return;
|
|
@@ -1430,7 +1453,7 @@ export function normalizeSubmitBooking(booking) {
|
|
|
1430
1453
|
});
|
|
1431
1454
|
}
|
|
1432
1455
|
var DEFAULT_TABLE_OCCUPANCY_DURATION = 20;
|
|
1433
|
-
function resolveTableOccupancyDuration(tempOrder) {
|
|
1456
|
+
export function resolveTableOccupancyDuration(tempOrder) {
|
|
1434
1457
|
var _metadata$table_confi, _metadata$tableConfig, _metadata$resource_co, _metadata$resourceCon;
|
|
1435
1458
|
var metadata = tempOrder.metadata || {};
|
|
1436
1459
|
var candidates = [metadata.table_occupancy_duration, metadata.booking_duration, metadata.table_duration, metadata.duration, (_metadata$table_confi = metadata.table_config) === null || _metadata$table_confi === void 0 ? void 0 : _metadata$table_confi.occupancy_duration, (_metadata$tableConfig = metadata.tableConfig) === null || _metadata$tableConfig === void 0 ? void 0 : _metadata$tableConfig.occupancy_duration, (_metadata$resource_co = metadata.resource_config) === null || _metadata$resource_co === void 0 ? void 0 : _metadata$resource_co.occupancy_duration, (_metadata$resourceCon = metadata.resourceConfig) === null || _metadata$resourceCon === void 0 ? void 0 : _metadata$resourceCon.occupancy_duration];
|
|
@@ -1558,7 +1581,7 @@ export function resolveSubmitOrderType(params) {
|
|
|
1558
1581
|
return 'virtual';
|
|
1559
1582
|
}
|
|
1560
1583
|
export function buildSubmitPayload(params) {
|
|
1561
|
-
var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_,
|
|
1584
|
+
var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref44, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
|
|
1562
1585
|
var tempOrder = params.tempOrder,
|
|
1563
1586
|
cacheId = params.cacheId,
|
|
1564
1587
|
_params$now = params.now,
|
|
@@ -1573,29 +1596,29 @@ export function buildSubmitPayload(params) {
|
|
|
1573
1596
|
var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
1574
1597
|
var bookingUuid = createUuidV4();
|
|
1575
1598
|
var virtualSettlementMode = ((_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2.settlement_type) === 'virtual_currency';
|
|
1576
|
-
var
|
|
1577
|
-
_extend =
|
|
1578
|
-
_relationId =
|
|
1579
|
-
_tableFormId =
|
|
1580
|
-
_resourceId =
|
|
1581
|
-
_summary =
|
|
1582
|
-
_lastOrderInfo =
|
|
1583
|
-
_paidAmount =
|
|
1584
|
-
_shopId =
|
|
1585
|
-
_shopNote =
|
|
1586
|
-
_shopServiceType =
|
|
1587
|
-
_startTime =
|
|
1588
|
-
_customer =
|
|
1589
|
-
_discountList =
|
|
1590
|
-
_orderMetaList =
|
|
1591
|
-
_rootTaxFee =
|
|
1592
|
-
_totalAmount =
|
|
1593
|
-
_totalRefundAmount =
|
|
1594
|
-
_createDate =
|
|
1595
|
-
_holderId =
|
|
1596
|
-
_paymentStatus =
|
|
1597
|
-
_notes =
|
|
1598
|
-
tempOrderRest = _objectWithoutProperties(
|
|
1599
|
+
var _ref43 = tempOrder,
|
|
1600
|
+
_extend = _ref43._extend,
|
|
1601
|
+
_relationId = _ref43.relation_id,
|
|
1602
|
+
_tableFormId = _ref43.table_form_id,
|
|
1603
|
+
_resourceId = _ref43.resource_id,
|
|
1604
|
+
_summary = _ref43.summary,
|
|
1605
|
+
_lastOrderInfo = _ref43.lastOrderInfo,
|
|
1606
|
+
_paidAmount = _ref43.paid_amount,
|
|
1607
|
+
_shopId = _ref43.shop_id,
|
|
1608
|
+
_shopNote = _ref43.shop_note,
|
|
1609
|
+
_shopServiceType = _ref43.shop_service_type,
|
|
1610
|
+
_startTime = _ref43.start_time,
|
|
1611
|
+
_customer = _ref43.customer,
|
|
1612
|
+
_discountList = _ref43.discount_list,
|
|
1613
|
+
_orderMetaList = _ref43.order_meta_list,
|
|
1614
|
+
_rootTaxFee = _ref43.tax_fee,
|
|
1615
|
+
_totalAmount = _ref43.total_amount,
|
|
1616
|
+
_totalRefundAmount = _ref43.total_refund_amount,
|
|
1617
|
+
_createDate = _ref43.create_date,
|
|
1618
|
+
_holderId = _ref43.holder_id,
|
|
1619
|
+
_paymentStatus = _ref43.payment_status,
|
|
1620
|
+
_notes = _ref43.notes,
|
|
1621
|
+
tempOrderRest = _objectWithoutProperties(_ref43, _excluded4);
|
|
1599
1622
|
var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
|
|
1600
1623
|
var normalizedOrderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
|
|
1601
1624
|
var submitType = resolveSubmitOrderType({
|
|
@@ -1622,7 +1645,7 @@ export function buildSubmitPayload(params) {
|
|
|
1622
1645
|
type: submitType,
|
|
1623
1646
|
business_code: resolvedBusinessCode,
|
|
1624
1647
|
sales_channel: tempOrder.sales_channel || 'my_pisel',
|
|
1625
|
-
order_sales_channel: (
|
|
1648
|
+
order_sales_channel: (_ref44 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref44 !== void 0 ? _ref44 : 'online_store',
|
|
1626
1649
|
status: tempOrder.status || 'normal'
|
|
1627
1650
|
}, params.includePaymentStatus !== false ? {
|
|
1628
1651
|
payment_status: tempOrder.payment_status || 'payment_processing'
|
|
@@ -1650,13 +1673,13 @@ export function buildSubmitPayload(params) {
|
|
|
1650
1673
|
// holder: tempOrder.holder || null,
|
|
1651
1674
|
summary: summary || tempOrder.summary || createEmptySummary(),
|
|
1652
1675
|
metadata: function () {
|
|
1653
|
-
var
|
|
1654
|
-
_collectPax =
|
|
1655
|
-
_tableOccupancyDuration =
|
|
1656
|
-
_cartSettlementKey =
|
|
1657
|
-
_cartSettlementSnapshot =
|
|
1658
|
-
_legalCurrencySnapshot =
|
|
1659
|
-
rest = _objectWithoutProperties(
|
|
1676
|
+
var _ref45 = tempOrder.metadata || {},
|
|
1677
|
+
_collectPax = _ref45.collect_pax,
|
|
1678
|
+
_tableOccupancyDuration = _ref45.table_occupancy_duration,
|
|
1679
|
+
_cartSettlementKey = _ref45.cart_settlement_key,
|
|
1680
|
+
_cartSettlementSnapshot = _ref45.cart_settlement_snapshot,
|
|
1681
|
+
_legalCurrencySnapshot = _ref45.legal_currency_snapshot,
|
|
1682
|
+
rest = _objectWithoutProperties(_ref45, _excluded5);
|
|
1660
1683
|
return _objectSpread({}, rest);
|
|
1661
1684
|
}()
|
|
1662
1685
|
}, (_tempOrder$_extend = tempOrder._extend) !== null && _tempOrder$_extend !== void 0 && (_tempOrder$_extend = _tempOrder$_extend.salesNotesState) !== null && _tempOrder$_extend !== void 0 && _tempOrder$_extend.dirty ? {
|
|
@@ -1886,8 +1909,8 @@ export function getRuntimeProductOrigin(tempOrder, product) {
|
|
|
1886
1909
|
return tempOrder._extend.productsByUid[uid].origin;
|
|
1887
1910
|
}
|
|
1888
1911
|
var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
|
|
1889
|
-
var
|
|
1890
|
-
return item === product || getOrderProductLineUid(item) === uid || String((
|
|
1912
|
+
var _ref46, _item$product_id, _ref47, _product$product_id;
|
|
1913
|
+
return item === product || getOrderProductLineUid(item) === uid || String((_ref46 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref46 !== void 0 ? _ref46 : '') === String((_ref47 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref47 !== void 0 ? _ref47 : '');
|
|
1891
1914
|
});
|
|
1892
1915
|
var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
|
|
1893
1916
|
return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[matchedUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin) || null : null;
|
|
@@ -1525,7 +1525,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1525
1525
|
key: "scanWalletAssetAsync",
|
|
1526
1526
|
value: function () {
|
|
1527
1527
|
var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code) {
|
|
1528
|
-
var normalizedCode, selectedAsset, result, paymentAssets, asset, items, recalculatedState, assetId, recalculatedAsset, selected, isSelected, selectedStateAsset, resolvedAsset;
|
|
1528
|
+
var normalizedCode, selectedAsset, result, paymentAssets, matchedAsset, assetsToApply, asset, _items, assetIds, selectionSources, _selected, items, recalculatedState, assetId, recalculatedAsset, selected, isSelected, selectedStateAsset, resolvedAsset;
|
|
1529
1529
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1530
1530
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1531
1531
|
case 0:
|
|
@@ -1578,11 +1578,13 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1578
1578
|
if (paymentAssets.length > 0) {
|
|
1579
1579
|
this.searchResults = mergeWalletAssets(this.searchResults, paymentAssets);
|
|
1580
1580
|
}
|
|
1581
|
-
|
|
1581
|
+
matchedAsset = paymentAssets.find(function (item) {
|
|
1582
1582
|
return String((item === null || item === void 0 ? void 0 : item.code) || '') === normalizedCode;
|
|
1583
|
-
})
|
|
1583
|
+
}); // 精确命中券码时仅处理该券;未命中时处理接口返回的全部结果。
|
|
1584
|
+
assetsToApply = matchedAsset ? [matchedAsset] : paymentAssets;
|
|
1585
|
+
asset = assetsToApply[0];
|
|
1584
1586
|
if (asset) {
|
|
1585
|
-
_context9.next =
|
|
1587
|
+
_context9.next = 19;
|
|
1586
1588
|
break;
|
|
1587
1589
|
}
|
|
1588
1590
|
return _context9.abrupt("return", {
|
|
@@ -1591,7 +1593,31 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1591
1593
|
selected: false,
|
|
1592
1594
|
state: this.getWalletAssetsState()
|
|
1593
1595
|
});
|
|
1594
|
-
case
|
|
1596
|
+
case 19:
|
|
1597
|
+
if (!(!matchedAsset && assetsToApply.length > 1)) {
|
|
1598
|
+
_context9.next = 26;
|
|
1599
|
+
break;
|
|
1600
|
+
}
|
|
1601
|
+
_items = mergeWalletAssets(this.walletAssetsState.items, assetsToApply);
|
|
1602
|
+
assetIds = assetsToApply.map(function (item) {
|
|
1603
|
+
return getWalletAssetId(item);
|
|
1604
|
+
}).filter(function (id) {
|
|
1605
|
+
return id !== undefined && id !== null;
|
|
1606
|
+
});
|
|
1607
|
+
selectionSources = _objectSpread({}, this.walletAssetsState.selectionSources);
|
|
1608
|
+
assetIds.forEach(function (id) {
|
|
1609
|
+
selectionSources[String(id)] = 'scan';
|
|
1610
|
+
});
|
|
1611
|
+
_selected = this.walletAssetsBehavior.autoSelectAfterSearch ? this.recalculateWalletAssets(_items, Array.from(new Set([].concat(_toConsumableArray(this.walletAssetsState.selectedIds), _toConsumableArray(assetIds)))), selectionSources) : this.recalculateWalletAssets(_items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
|
|
1612
|
+
return _context9.abrupt("return", {
|
|
1613
|
+
type: result.type,
|
|
1614
|
+
asset: asset,
|
|
1615
|
+
selected: assetIds.some(function (id) {
|
|
1616
|
+
return _selected.selectedIds.includes(id);
|
|
1617
|
+
}),
|
|
1618
|
+
state: _selected
|
|
1619
|
+
});
|
|
1620
|
+
case 26:
|
|
1595
1621
|
items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
|
|
1596
1622
|
recalculatedState = this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
|
|
1597
1623
|
assetId = getWalletAssetId(asset);
|
|
@@ -1621,7 +1647,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1621
1647
|
selected: isSelected,
|
|
1622
1648
|
state: selected
|
|
1623
1649
|
});
|
|
1624
|
-
case
|
|
1650
|
+
case 36:
|
|
1625
1651
|
case "end":
|
|
1626
1652
|
return _context9.stop();
|
|
1627
1653
|
}
|
|
@@ -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" | "normal" | "session";
|
|
53
53
|
}
|