@pisell/pisellos 2.3.195 → 2.3.197
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/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 +6 -0
- package/dist/modules/BookingContext/utils/productExtend.js +21 -0
- package/dist/modules/Order/index.d.ts +3 -0
- package/dist/modules/Order/index.js +127 -46
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ResourcePlanner/planner.js +24 -0
- package/dist/modules/ResourcePlanner/types.d.ts +7 -0
- package/dist/server/index.js +207 -193
- package/dist/server/modules/order/index.js +2 -1
- package/dist/shared/receipt/small-ticket.d.ts +3 -0
- package/dist/shared/receipt/small-ticket.js +26 -3
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/dist/solution/BookingTicket/index.js +8 -4
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/OrderInvoicePreview/index.js +13 -8
- package/dist/solution/UnifiedBookingSales/index.d.ts +16 -2
- package/dist/solution/UnifiedBookingSales/index.js +1670 -1377
- package/dist/solution/UnifiedBookingSales/types.d.ts +1 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +11 -5
- 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 +6 -0
- package/lib/modules/BookingContext/utils/productExtend.js +23 -0
- package/lib/modules/Order/index.d.ts +3 -0
- package/lib/modules/Order/index.js +85 -16
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ResourcePlanner/planner.js +23 -0
- package/lib/modules/ResourcePlanner/types.d.ts +7 -0
- package/lib/server/index.js +21 -5
- package/lib/server/modules/order/index.js +2 -1
- package/lib/shared/receipt/small-ticket.d.ts +3 -0
- package/lib/shared/receipt/small-ticket.js +24 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/lib/solution/BookingTicket/index.js +4 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +33 -3
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/OrderInvoicePreview/index.js +6 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +16 -2
- package/lib/solution/UnifiedBookingSales/index.js +176 -36
- package/lib/solution/UnifiedBookingSales/types.d.ts +1 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +9 -5
- package/package.json +1 -1
|
@@ -2416,7 +2416,39 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2416
2416
|
}, {
|
|
2417
2417
|
key: "getDepositAmount",
|
|
2418
2418
|
value: function getDepositAmount(tempOrder, summary) {
|
|
2419
|
-
|
|
2419
|
+
var summaryAmount = summary.deposit_amount;
|
|
2420
|
+
var amount = summaryAmount === '' ? tempOrder.deposit_amount : summaryAmount !== null && summaryAmount !== void 0 ? summaryAmount : tempOrder.deposit_amount;
|
|
2421
|
+
return Decimal.min(Decimal.max(new Decimal(amount || 0), 0), this.getOrderExpectedAmount(summary));
|
|
2422
|
+
}
|
|
2423
|
+
}, {
|
|
2424
|
+
key: "isDepositSelectionDisabled",
|
|
2425
|
+
value: function isDepositSelectionDisabled(tempOrder) {
|
|
2426
|
+
var _tempOrder$_extend4;
|
|
2427
|
+
return ((_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.depositSelectionDisabled) === true || tempOrder.is_deposit === 0 && new Decimal(tempOrder.deposit_amount || 0).gt(0);
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
/** Cap only the active target; product rules, manual intent and saved snapshots stay raw. */
|
|
2431
|
+
}, {
|
|
2432
|
+
key: "applyEffectiveDepositSummary",
|
|
2433
|
+
value: function applyEffectiveDepositSummary(tempOrder, summary) {
|
|
2434
|
+
var disabled = this.isDepositSelectionDisabled(tempOrder);
|
|
2435
|
+
if (disabled) {
|
|
2436
|
+
tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend || {}), {}, {
|
|
2437
|
+
depositSelectionDisabled: true
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
var depositAmount = this.getDepositAmount(tempOrder, summary).toFixed(2);
|
|
2441
|
+
var hasDepositAmount = new Decimal(depositAmount).gt(0);
|
|
2442
|
+
var nextSummary = _objectSpread(_objectSpread({}, summary), {}, {
|
|
2443
|
+
deposit_amount: depositAmount,
|
|
2444
|
+
deposit: hasDepositAmount ? _objectSpread(_objectSpread({}, summary.deposit || {}), {}, {
|
|
2445
|
+
total: depositAmount,
|
|
2446
|
+
hasDeposit: true
|
|
2447
|
+
}) : undefined
|
|
2448
|
+
});
|
|
2449
|
+
tempOrder.deposit_amount = depositAmount;
|
|
2450
|
+
tempOrder.is_deposit = hasDepositAmount && tempOrder.is_deposit === 1 && !disabled ? 1 : 0;
|
|
2451
|
+
return nextSummary;
|
|
2420
2452
|
}
|
|
2421
2453
|
}, {
|
|
2422
2454
|
key: "normalizeDepositAmount",
|
|
@@ -2437,8 +2469,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2437
2469
|
if (!source || _typeof(source) !== 'object') return null;
|
|
2438
2470
|
var record = source;
|
|
2439
2471
|
var rawDepositAmount = (_record$deposit_amoun = record.deposit_amount) !== null && _record$deposit_amoun !== void 0 ? _record$deposit_amoun : (_record$summary = record.summary) === null || _record$summary === void 0 ? void 0 : _record$summary.deposit_amount;
|
|
2472
|
+
if (rawDepositAmount === undefined || rawDepositAmount === null || rawDepositAmount === '') return null;
|
|
2440
2473
|
var depositAmount = this.normalizeDepositAmount(rawDepositAmount !== null && rawDepositAmount !== void 0 ? rawDepositAmount : 0);
|
|
2441
|
-
if (!new Decimal(depositAmount).gt(0))
|
|
2474
|
+
if (!new Decimal(depositAmount).gt(0)) {
|
|
2475
|
+
var _record$_extend;
|
|
2476
|
+
// A saved zero is meaningful for an existing deposit product, but must not
|
|
2477
|
+
// freeze ordinary historical retail orders when a deposit product is added.
|
|
2478
|
+
var products = Array.isArray(record.products) ? record.products : [];
|
|
2479
|
+
var hasDepositContext = this.normalizeDepositFlag(record.is_deposit) === 1 || products.some(function (product) {
|
|
2480
|
+
var _product$deposit;
|
|
2481
|
+
return Number(product === null || product === void 0 || (_product$deposit = product.deposit) === null || _product$deposit === void 0 ? void 0 : _product$deposit.total) > 0;
|
|
2482
|
+
}) || calculateOrderProductsDeposit(products.map(function (product) {
|
|
2483
|
+
return _objectSpread({}, product);
|
|
2484
|
+
}), {
|
|
2485
|
+
productsByUid: (_record$_extend = record._extend) === null || _record$_extend === void 0 ? void 0 : _record$_extend.productsByUid
|
|
2486
|
+
}).hasDeposit;
|
|
2487
|
+
if (!hasDepositContext) return null;
|
|
2488
|
+
}
|
|
2442
2489
|
return {
|
|
2443
2490
|
// 兼容历史数据:旧快照缺少 is_deposit 时,沿用正定金金额的推导规则。
|
|
2444
2491
|
isDeposit: (_this$normalizeDeposi = this.normalizeDepositFlag(record.is_deposit)) !== null && _this$normalizeDeposi !== void 0 ? _this$normalizeDeposi : 1,
|
|
@@ -2507,7 +2554,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2507
2554
|
}, {
|
|
2508
2555
|
key: "getOrderExpectedAmount",
|
|
2509
2556
|
value: function getOrderExpectedAmount(summary) {
|
|
2510
|
-
|
|
2557
|
+
var expected = summary.expect_amount;
|
|
2558
|
+
var amount = expected === '' ? summary.total_amount : expected !== null && expected !== void 0 ? expected : summary.total_amount;
|
|
2559
|
+
return Decimal.max(new Decimal(amount || 0), 0);
|
|
2511
2560
|
}
|
|
2512
2561
|
}, {
|
|
2513
2562
|
key: "isDepositCovered",
|
|
@@ -2567,7 +2616,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2567
2616
|
}, {
|
|
2568
2617
|
key: "resolveNextOrderPaymentType",
|
|
2569
2618
|
value: function resolveNextOrderPaymentType(tempOrder) {
|
|
2570
|
-
var depositAmount =
|
|
2619
|
+
var depositAmount = this.getDepositAmount(tempOrder, this.store.summary || createEmptySummary());
|
|
2571
2620
|
if (!this.isDepositOrder(tempOrder, depositAmount)) return 'normal';
|
|
2572
2621
|
if (depositAmount.lte(0)) return 'normal';
|
|
2573
2622
|
if (this.hasPaidNormalPayment(tempOrder.payments || [])) return 'normal';
|
|
@@ -3149,8 +3198,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3149
3198
|
}, {
|
|
3150
3199
|
key: "getManualDepositOverride",
|
|
3151
3200
|
value: function getManualDepositOverride(tempOrder) {
|
|
3152
|
-
var _tempOrder$
|
|
3153
|
-
var override = (_tempOrder$
|
|
3201
|
+
var _tempOrder$_extend5;
|
|
3202
|
+
var override = (_tempOrder$_extend5 = tempOrder._extend) === null || _tempOrder$_extend5 === void 0 ? void 0 : _tempOrder$_extend5.manualDepositOverride;
|
|
3154
3203
|
if (!override || _typeof(override) !== 'object') return null;
|
|
3155
3204
|
if (typeof override.amount !== 'string') return null;
|
|
3156
3205
|
if (typeof override.productStructuralFingerprint !== 'string') return null;
|
|
@@ -3169,16 +3218,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3169
3218
|
}, {
|
|
3170
3219
|
key: "clearManualDepositOverride",
|
|
3171
3220
|
value: function clearManualDepositOverride(tempOrder) {
|
|
3172
|
-
var _tempOrder$
|
|
3173
|
-
if (!((_tempOrder$
|
|
3221
|
+
var _tempOrder$_extend6;
|
|
3222
|
+
if (!((_tempOrder$_extend6 = tempOrder._extend) !== null && _tempOrder$_extend6 !== void 0 && _tempOrder$_extend6.manualDepositOverride)) return;
|
|
3174
3223
|
tempOrder._extend = _objectSpread({}, tempOrder._extend);
|
|
3175
3224
|
delete tempOrder._extend.manualDepositOverride;
|
|
3176
3225
|
}
|
|
3177
3226
|
}, {
|
|
3178
3227
|
key: "getOriginalSalesSnapshot",
|
|
3179
3228
|
value: function getOriginalSalesSnapshot(tempOrder) {
|
|
3180
|
-
var _tempOrder$
|
|
3181
|
-
var snapshot = (_tempOrder$
|
|
3229
|
+
var _tempOrder$_extend7;
|
|
3230
|
+
var snapshot = (_tempOrder$_extend7 = tempOrder._extend) === null || _tempOrder$_extend7 === void 0 ? void 0 : _tempOrder$_extend7.originalSalesSnapshot;
|
|
3182
3231
|
if (!snapshot || _typeof(snapshot) !== 'object') return null;
|
|
3183
3232
|
if (typeof snapshot.productFingerprint !== 'string') return null;
|
|
3184
3233
|
return snapshot;
|
|
@@ -3218,7 +3267,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3218
3267
|
}, {
|
|
3219
3268
|
key: "restoreOriginalSnapshotIfProductsUnchanged",
|
|
3220
3269
|
value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder, snapshot) {
|
|
3221
|
-
var _historicalDepositSna;
|
|
3222
3270
|
// merge hydrate 的商品集合包含本地未提交行,但 summary 仍来自远端旧订单,不能复用。
|
|
3223
3271
|
if (snapshot.requiresFullSummaryRecalculation === true) return null;
|
|
3224
3272
|
var currentFingerprint = this.buildOrderProductsFingerprint(tempOrder.products);
|
|
@@ -3242,6 +3290,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3242
3290
|
tempOrder.is_deposit = historicalDepositSnapshot.isDeposit;
|
|
3243
3291
|
}
|
|
3244
3292
|
}
|
|
3293
|
+
summary = this.applyEffectiveDepositSummary(tempOrder, summary);
|
|
3245
3294
|
var isPayableAmountUnchanged = this.isSnapshotPayableAmountUnchanged(tempOrder, snapshot, summary);
|
|
3246
3295
|
if (!isPayableAmountUnchanged) return null;
|
|
3247
3296
|
var currentPaidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
|
|
@@ -3257,8 +3306,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3257
3306
|
tempOrder.surcharges = cloneDeep(snapshot.surcharges);
|
|
3258
3307
|
}
|
|
3259
3308
|
tempOrder.surcharge_fee = summary.surcharge_fee || tempOrder.surcharge_fee;
|
|
3260
|
-
tempOrder.deposit_amount = this.normalizeDepositAmount(summary.deposit_amount || 0);
|
|
3261
|
-
tempOrder.is_deposit = shouldUseManualDepositOverride ? new Decimal(tempOrder.deposit_amount).gt(0) ? 1 : 0 : (_historicalDepositSna = historicalDepositSnapshot === null || historicalDepositSnapshot === void 0 ? void 0 : historicalDepositSnapshot.isDeposit) !== null && _historicalDepositSna !== void 0 ? _historicalDepositSna : new Decimal(tempOrder.deposit_amount).gt(0) ? 1 : 0;
|
|
3262
3309
|
var previousSummary = this.store.summary;
|
|
3263
3310
|
this.store.summary = summary;
|
|
3264
3311
|
this.updateTempOrderPaymentStatus(tempOrder, {
|
|
@@ -3474,13 +3521,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3474
3521
|
}, {
|
|
3475
3522
|
key: "getOrderIdentity",
|
|
3476
3523
|
value: function getOrderIdentity() {
|
|
3477
|
-
var _ref50, _ref51, _tempOrder$order_id, _tempOrder$
|
|
3524
|
+
var _ref50, _ref51, _tempOrder$order_id, _tempOrder$_extend8;
|
|
3478
3525
|
var tempOrder = this.store.tempOrder;
|
|
3479
3526
|
if (!tempOrder) return null;
|
|
3480
3527
|
var lastOrderInfo = this.store.lastOrderInfo || {};
|
|
3481
3528
|
var orderId = (_ref50 = (_ref51 = (_tempOrder$order_id = tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : lastOrderInfo.order_id) !== null && _ref51 !== void 0 ? _ref51 : lastOrderInfo.id) !== null && _ref50 !== void 0 ? _ref50 : null;
|
|
3482
3529
|
return {
|
|
3483
|
-
localId: this.cacheId || ((_tempOrder$
|
|
3530
|
+
localId: this.cacheId || ((_tempOrder$_extend8 = tempOrder._extend) === null || _tempOrder$_extend8 === void 0 ? void 0 : _tempOrder$_extend8.localId),
|
|
3484
3531
|
orderId: orderId,
|
|
3485
3532
|
externalSaleNumber: tempOrder.external_sale_number || lastOrderInfo.external_sale_number || '',
|
|
3486
3533
|
orderNumber: tempOrder.order_number || lastOrderInfo.order_number || '',
|
|
@@ -3502,10 +3549,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3502
3549
|
}, {
|
|
3503
3550
|
key: "getOrderAmountSnapshot",
|
|
3504
3551
|
value: function getOrderAmountSnapshot() {
|
|
3552
|
+
var _summary$expect_amoun, _summary$total_amount;
|
|
3505
3553
|
var tempOrder = this.store.tempOrder;
|
|
3506
3554
|
if (!tempOrder) return null;
|
|
3507
3555
|
var summary = this.store.summary || createEmptySummary();
|
|
3508
|
-
var depositAmount = tempOrder
|
|
3556
|
+
var depositAmount = this.getDepositAmount(tempOrder, summary);
|
|
3509
3557
|
var paidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
|
|
3510
3558
|
var amountGap = this.calculateSummaryAmountGap({
|
|
3511
3559
|
tempOrder: tempOrder,
|
|
@@ -3513,10 +3561,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3513
3561
|
orderPaidAmount: paidPaymentSummary.gapPaidAmount
|
|
3514
3562
|
});
|
|
3515
3563
|
return {
|
|
3516
|
-
isDeposit: tempOrder
|
|
3517
|
-
depositAmount: depositAmount,
|
|
3518
|
-
expectAmount: summary.expect_amount
|
|
3519
|
-
totalAmount: summary.total_amount
|
|
3564
|
+
isDeposit: this.isDepositOrder(tempOrder, depositAmount),
|
|
3565
|
+
depositAmount: depositAmount.toFixed(2),
|
|
3566
|
+
expectAmount: String((_summary$expect_amoun = summary.expect_amount) !== null && _summary$expect_amoun !== void 0 ? _summary$expect_amoun : '0.00'),
|
|
3567
|
+
totalAmount: String((_summary$total_amount = summary.total_amount) !== null && _summary$total_amount !== void 0 ? _summary$total_amount : '0.00'),
|
|
3520
3568
|
amountGap: amountGap,
|
|
3521
3569
|
summary: summary
|
|
3522
3570
|
};
|
|
@@ -3642,8 +3690,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3642
3690
|
}, {
|
|
3643
3691
|
key: "repairDuplicateProductLineIdentities",
|
|
3644
3692
|
value: function repairDuplicateProductLineIdentities(tempOrder) {
|
|
3645
|
-
var _tempOrder$
|
|
3646
|
-
var result = repairDuplicateOrderProductLineIdentities(tempOrder.products, (_tempOrder$
|
|
3693
|
+
var _tempOrder$_extend9;
|
|
3694
|
+
var result = repairDuplicateOrderProductLineIdentities(tempOrder.products, (_tempOrder$_extend9 = tempOrder._extend) === null || _tempOrder$_extend9 === void 0 ? void 0 : _tempOrder$_extend9.productsByUid);
|
|
3647
3695
|
if (!result.repairs.length) return;
|
|
3648
3696
|
tempOrder.products = result.products;
|
|
3649
3697
|
if (result.productsByUid) {
|
|
@@ -3934,9 +3982,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3934
3982
|
}, {
|
|
3935
3983
|
key: "applyOrderProductsDepositSummary",
|
|
3936
3984
|
value: function applyOrderProductsDepositSummary(tempOrder, summary) {
|
|
3937
|
-
var _tempOrder$
|
|
3985
|
+
var _tempOrder$_extend10;
|
|
3986
|
+
var isExistingDepositDisabled = this.isDepositSelectionDisabled(tempOrder);
|
|
3987
|
+
if (isExistingDepositDisabled) {
|
|
3988
|
+
tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend || {}), {}, {
|
|
3989
|
+
depositSelectionDisabled: true
|
|
3990
|
+
});
|
|
3991
|
+
}
|
|
3938
3992
|
var depositSummary = calculateOrderProductsDeposit(tempOrder.products || [], {
|
|
3939
|
-
productsByUid: (_tempOrder$
|
|
3993
|
+
productsByUid: (_tempOrder$_extend10 = tempOrder._extend) === null || _tempOrder$_extend10 === void 0 ? void 0 : _tempOrder$_extend10.productsByUid
|
|
3940
3994
|
});
|
|
3941
3995
|
var manualDepositOverride = this.getManualDepositOverride(tempOrder);
|
|
3942
3996
|
var currentStructuralFingerprint = manualDepositOverride ? this.buildOrderProductsStructuralFingerprint(tempOrder.products) : '';
|
|
@@ -3955,10 +4009,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3955
4009
|
hasDeposit: true
|
|
3956
4010
|
} : undefined
|
|
3957
4011
|
});
|
|
3958
|
-
var isExistingDepositDisabled = tempOrder.is_deposit === 0 && new Decimal(tempOrder.deposit_amount || 0).gt(0);
|
|
3959
4012
|
tempOrder.deposit_amount = depositAmount;
|
|
3960
4013
|
tempOrder.is_deposit = hasDepositAmount && !isExistingDepositDisabled ? 1 : 0;
|
|
3961
|
-
return shouldUseManualDepositOverride ? nextSummary : this.applyLastOrderDepositSnapshot(tempOrder, nextSummary);
|
|
4014
|
+
return this.applyEffectiveDepositSummary(tempOrder, shouldUseManualDepositOverride ? nextSummary : this.applyLastOrderDepositSnapshot(tempOrder, nextSummary));
|
|
3962
4015
|
}
|
|
3963
4016
|
}, {
|
|
3964
4017
|
key: "recalculateSummary",
|
|
@@ -4479,8 +4532,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4479
4532
|
value: function updateTempOrderDepositAmount(amount) {
|
|
4480
4533
|
var tempOrder = this.ensureTempOrder();
|
|
4481
4534
|
var depositAmount = this.normalizeDepositAmount(amount);
|
|
4535
|
+
tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend || {}), {}, {
|
|
4536
|
+
depositSelectionDisabled: new Decimal(depositAmount).lte(0)
|
|
4537
|
+
});
|
|
4482
4538
|
var previousSummary = this.store.summary || createEmptySummary();
|
|
4483
|
-
var summaryWithDeposit = this.applyDepositAmountToSummary(tempOrder, _objectSpread(_objectSpread({}, createEmptySummary()), previousSummary), depositAmount);
|
|
4539
|
+
var summaryWithDeposit = this.applyEffectiveDepositSummary(tempOrder, this.applyDepositAmountToSummary(tempOrder, _objectSpread(_objectSpread({}, createEmptySummary()), previousSummary), depositAmount));
|
|
4484
4540
|
this.setManualDepositOverride(tempOrder, depositAmount);
|
|
4485
4541
|
var paidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
|
|
4486
4542
|
var summary = _objectSpread(_objectSpread({}, summaryWithDeposit), {}, {
|
|
@@ -5739,8 +5795,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5739
5795
|
key: "addProductToOrderDraft",
|
|
5740
5796
|
value: function () {
|
|
5741
5797
|
var _addProductToOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(product, booking, options) {
|
|
5742
|
-
var
|
|
5743
|
-
|
|
5798
|
+
var _product$_extend2,
|
|
5799
|
+
_this39 = this;
|
|
5800
|
+
var availabilityCommitGuard, liveTempOrder, beforeCommit, mutation, tempOrder, beforeAppend, guardedMutationFields, readGuardedMutationFields, guardedMutationBaseline, beforePublish, _tempOrder$_extend11, salesNoteDrafts, mutationSnapshot, attachSalesNoteDrafts, rollbackProductAndNotesMutation, insertAfterProductUid, anchorIndex, insertAtIndex, _ref72, _productRecord$num, productRecord, splitCount, i, splitLine, committedProduct, _committedProduct, _committedProduct2, committedIdentity, isCurrentOrder;
|
|
5744
5801
|
return _regeneratorRuntime().wrap(function _callee28$(_context29) {
|
|
5745
5802
|
while (1) switch (_context29.prev = _context29.next) {
|
|
5746
5803
|
case 0:
|
|
@@ -5751,7 +5808,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5751
5808
|
mutation = this.beginCartMutation(); // 库存/商品券校验与自动预约共用草稿,全部门禁通过后才发布完整批次。
|
|
5752
5809
|
tempOrder = availabilityCommitGuard && !mutation.commit ? cloneDeep(liveTempOrder) : mutation.draft;
|
|
5753
5810
|
beforeAppend = mutation.commit ? undefined : beforeCommit;
|
|
5754
|
-
guardedMutationFields = ['products', 'bookings', 'notes', '_extend', 'metadata', 'currency_code', 'currency_symbol', 'currency_format'];
|
|
5811
|
+
guardedMutationFields = ['products', 'bookings', 'notes', '_extend', 'metadata', 'currency_code', 'currency_symbol', 'currency_format'].concat(_toConsumableArray(!booking && Array.isArray((_product$_extend2 = product._extend) === null || _product$_extend2 === void 0 ? void 0 : _product$_extend2.holder_relations) ? ['holder_relations'] : []));
|
|
5755
5812
|
readGuardedMutationFields = function readGuardedMutationFields(order) {
|
|
5756
5813
|
return Object.fromEntries(guardedMutationFields.map(function (key) {
|
|
5757
5814
|
return [key, order[key]];
|
|
@@ -5772,7 +5829,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5772
5829
|
_context29.next = 15;
|
|
5773
5830
|
break;
|
|
5774
5831
|
}
|
|
5775
|
-
if ((_tempOrder$
|
|
5832
|
+
if ((_tempOrder$_extend11 = tempOrder._extend) !== null && _tempOrder$_extend11 !== void 0 && (_tempOrder$_extend11 = _tempOrder$_extend11.productVoucherGroups) !== null && _tempOrder$_extend11 !== void 0 && _tempOrder$_extend11.some(function (group) {
|
|
5776
5833
|
return group.key === options.productVoucherGroupKey;
|
|
5777
5834
|
})) {
|
|
5778
5835
|
_context29.next = 14;
|
|
@@ -6447,12 +6504,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6447
6504
|
}, {
|
|
6448
6505
|
key: "getFullCoveragePassDiscounts",
|
|
6449
6506
|
value: function getFullCoveragePassDiscounts(product) {
|
|
6450
|
-
var _product$
|
|
6507
|
+
var _product$_extend3;
|
|
6451
6508
|
var discountList = _toConsumableArray(product.discount_list || []);
|
|
6452
6509
|
(product.product_bundle || []).forEach(function (item) {
|
|
6453
6510
|
discountList.push.apply(discountList, _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
6454
6511
|
});
|
|
6455
|
-
((product === null || product === void 0 || (_product$
|
|
6512
|
+
((product === null || product === void 0 || (_product$_extend3 = product._extend) === null || _product$_extend3 === void 0 || (_product$_extend3 = _product$_extend3.other) === null || _product$_extend3 === void 0 ? void 0 : _product$_extend3.bundle) || []).forEach(function (item) {
|
|
6456
6513
|
discountList.push.apply(discountList, _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
6457
6514
|
});
|
|
6458
6515
|
return discountList.filter(function (item) {
|
|
@@ -6482,10 +6539,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6482
6539
|
}, {
|
|
6483
6540
|
key: "isRuntimeEntitlementAppend",
|
|
6484
6541
|
value: function isRuntimeEntitlementAppend(product, tempOrder) {
|
|
6485
|
-
var _product$metadata$uni, _product$metadata12, _tempOrder$
|
|
6542
|
+
var _product$metadata$uni, _product$metadata12, _tempOrder$_extend12, _product$_origin;
|
|
6486
6543
|
if (this.isPersistedProductLine(product)) return false;
|
|
6487
6544
|
var uid = (_product$metadata$uni = (_product$metadata12 = product.metadata) === null || _product$metadata12 === void 0 ? void 0 : _product$metadata12.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product.unique_identification_number;
|
|
6488
|
-
var storedOrigin = uid !== undefined && uid !== null && uid !== '' ? (_tempOrder$
|
|
6545
|
+
var storedOrigin = uid !== undefined && uid !== null && uid !== '' ? (_tempOrder$_extend12 = tempOrder._extend) === null || _tempOrder$_extend12 === void 0 || (_tempOrder$_extend12 = _tempOrder$_extend12.productsByUid) === null || _tempOrder$_extend12 === void 0 || (_tempOrder$_extend12 = _tempOrder$_extend12[String(uid)]) === null || _tempOrder$_extend12 === void 0 ? void 0 : _tempOrder$_extend12.origin : undefined;
|
|
6489
6546
|
return Boolean((product === null || product === void 0 || (_product$_origin = product._origin) === null || _product$_origin === void 0 ? void 0 : _product$_origin.__entitlementPassRuntimeAppend) === true || (storedOrigin === null || storedOrigin === void 0 ? void 0 : storedOrigin.__entitlementPassRuntimeAppend) === true);
|
|
6490
6547
|
}
|
|
6491
6548
|
}, {
|
|
@@ -8863,7 +8920,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
8863
8920
|
var _sourceRaw$_extend,
|
|
8864
8921
|
_this56 = this,
|
|
8865
8922
|
_this$store$discount26;
|
|
8866
|
-
var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, isMergedSalesDetailHydrate, nextTempOrder, _this$store$discount24, _this$store$discount25, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, historicalDepositSnapshot, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount27, _this$store$discount28;
|
|
8923
|
+
var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, isMergedSalesDetailHydrate, nextTempOrder, _this$store$discount24, _this$store$discount25, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, historicalDepositSnapshot, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount27, _this$store$discount28, previousSummary, summary;
|
|
8867
8924
|
return _regeneratorRuntime().wrap(function _callee62$(_context66) {
|
|
8868
8925
|
while (1) switch (_context66.prev = _context66.next) {
|
|
8869
8926
|
case 0:
|
|
@@ -8954,6 +9011,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
8954
9011
|
};
|
|
8955
9012
|
rawSummary = raw.summary && _typeof(raw.summary) === 'object' ? raw.summary : {};
|
|
8956
9013
|
historicalDepositSnapshot = this.getHistoricalDepositSnapshot(sourceLastOrderInfo);
|
|
9014
|
+
if (historicalDepositSnapshot && this.normalizeDepositFlag(raw.is_deposit) === null) {
|
|
9015
|
+
nextTempOrder.is_deposit = historicalDepositSnapshot.isDeposit;
|
|
9016
|
+
}
|
|
8957
9017
|
summarySurcharges = Array.isArray(rawSummary.surcharges) ? rawSummary.surcharges.map(function (s) {
|
|
8958
9018
|
return _objectSpread({}, s || {});
|
|
8959
9019
|
}) : cloneDeep(nextTempOrder.surcharges || []);
|
|
@@ -8996,33 +9056,54 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
8996
9056
|
nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
|
|
8997
9057
|
shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
|
|
8998
9058
|
if (shouldSkipEmptyDiscountSync) {
|
|
8999
|
-
_context66.next =
|
|
9059
|
+
_context66.next = 59;
|
|
9000
9060
|
break;
|
|
9001
9061
|
}
|
|
9002
9062
|
OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
|
|
9003
|
-
_context66.next =
|
|
9063
|
+
_context66.next = 55;
|
|
9004
9064
|
return (_this$store$discount27 = this.store.discount) === null || _this$store$discount27 === void 0 ? void 0 : _this$store$discount27.setOriginalDiscountList(nextDiscounts);
|
|
9005
|
-
case
|
|
9065
|
+
case 55:
|
|
9006
9066
|
this.assertOrderReplacementCurrent(replacement);
|
|
9007
|
-
_context66.next =
|
|
9067
|
+
_context66.next = 58;
|
|
9008
9068
|
return (_this$store$discount28 = this.store.discount) === null || _this$store$discount28 === void 0 ? void 0 : _this$store$discount28.setDiscountList(nextDiscounts);
|
|
9009
|
-
case 57:
|
|
9010
|
-
this.assertOrderReplacementCurrent(replacement);
|
|
9011
9069
|
case 58:
|
|
9070
|
+
this.assertOrderReplacementCurrent(replacement);
|
|
9071
|
+
case 59:
|
|
9012
9072
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
9013
|
-
_context66.next =
|
|
9073
|
+
_context66.next = 64;
|
|
9014
9074
|
break;
|
|
9015
9075
|
}
|
|
9016
|
-
_context66.next =
|
|
9076
|
+
_context66.next = 62;
|
|
9017
9077
|
return this.recalculateSummary({
|
|
9018
9078
|
createIfMissing: false,
|
|
9019
9079
|
isCurrentOrder: function isCurrentOrder() {
|
|
9020
9080
|
return _this56.orderReplacement === replacement;
|
|
9021
9081
|
}
|
|
9022
9082
|
});
|
|
9023
|
-
case 61:
|
|
9024
|
-
return _context66.abrupt("return", nextTempOrder);
|
|
9025
9083
|
case 62:
|
|
9084
|
+
_context66.next = 65;
|
|
9085
|
+
break;
|
|
9086
|
+
case 64:
|
|
9087
|
+
if (!isMergedSalesDetailHydrate && [rawSummary.expect_amount, rawSummary.total_amount].some(function (amount) {
|
|
9088
|
+
return amount !== undefined && amount !== null && amount !== '';
|
|
9089
|
+
})) {
|
|
9090
|
+
// Keep the remote baseline intact; only normalize the active priced order.
|
|
9091
|
+
previousSummary = this.store.summary;
|
|
9092
|
+
summary = this.applyEffectiveDepositSummary(nextTempOrder, previousSummary);
|
|
9093
|
+
summary.amount_gap = this.calculateSummaryAmountGap({
|
|
9094
|
+
tempOrder: nextTempOrder,
|
|
9095
|
+
summary: summary,
|
|
9096
|
+
orderPaidAmount: this.calculatePaidPaymentSummary(nextTempOrder.payments || []).gapPaidAmount
|
|
9097
|
+
});
|
|
9098
|
+
this.store.summary = summary;
|
|
9099
|
+
this.updateTempOrderPaymentStatus(nextTempOrder, {
|
|
9100
|
+
previousSummary: previousSummary,
|
|
9101
|
+
summary: summary
|
|
9102
|
+
});
|
|
9103
|
+
}
|
|
9104
|
+
case 65:
|
|
9105
|
+
return _context66.abrupt("return", nextTempOrder);
|
|
9106
|
+
case 66:
|
|
9026
9107
|
case "end":
|
|
9027
9108
|
return _context66.stop();
|
|
9028
9109
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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(): "duration" | "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -1191,6 +1191,20 @@ export function getDurationBusinessDate(projection, startAt) {
|
|
|
1191
1191
|
});
|
|
1192
1192
|
return (period === null || period === void 0 ? void 0 : period.businessDate) || startAt.slice(0, 10);
|
|
1193
1193
|
}
|
|
1194
|
+
function getRequestedProductRange(projection, product, request, runtimeOptions, fixedOffsetMinutes) {
|
|
1195
|
+
var _request$requestedRan;
|
|
1196
|
+
var range = (_request$requestedRan = request.requestedRangesByProductId) === null || _request$requestedRan === void 0 ? void 0 : _request$requestedRan[String(product.id)];
|
|
1197
|
+
if (!runtimeOptions.allowRequestedRanges || !range || product.kind !== 'duration' && product.kind !== 'session') return [];
|
|
1198
|
+
var start = toDateTime(range.startAt);
|
|
1199
|
+
var end = toDateTime(range.endAt);
|
|
1200
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || !Number.isInteger((end - start) / 60000) || end <= start) {
|
|
1201
|
+
throw availabilityError('INVALID_TARGET_FILTER', '手工预约范围必须包含有效起止时间和正整数分钟时长');
|
|
1202
|
+
}
|
|
1203
|
+
var candidate = createDurationTimeRangeWithEnd(product, start, end, projection, fixedOffsetMinutes);
|
|
1204
|
+
candidate.businessDate = getDurationBusinessDate(projection, candidate.startAt);
|
|
1205
|
+
assertRangesWithinProjection(projection, [candidate]);
|
|
1206
|
+
return [candidate];
|
|
1207
|
+
}
|
|
1194
1208
|
function getAlignedDurationRanges(params) {
|
|
1195
1209
|
var _request$rememberedSt, _request$rememberedTi, _request$editingStart;
|
|
1196
1210
|
var projection = params.projection,
|
|
@@ -1407,6 +1421,16 @@ export function getProductTimeRanges(projection) {
|
|
|
1407
1421
|
return projection.products.filter(function (product) {
|
|
1408
1422
|
return !filteredProductIdSet || filteredProductIdSet.has(String(product.id));
|
|
1409
1423
|
}).map(function (product) {
|
|
1424
|
+
var requestedRanges = getRequestedProductRange(projection, product, request, runtimeOptions, fixedOffsetMinutes);
|
|
1425
|
+
if (requestedRanges.length > 0) {
|
|
1426
|
+
return {
|
|
1427
|
+
productId: product.id,
|
|
1428
|
+
title: product.title,
|
|
1429
|
+
kind: product.kind,
|
|
1430
|
+
slotStepMinutes: slotStepMinutes,
|
|
1431
|
+
ranges: dedupeProductRanges(requestedRanges)
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1410
1434
|
if (product.kind === 'normal') {
|
|
1411
1435
|
return {
|
|
1412
1436
|
productId: product.id,
|
|
@@ -263,6 +263,11 @@ export interface GetProductTimeRangesRequest {
|
|
|
263
263
|
partySize?: number;
|
|
264
264
|
durationMinutesByProductId?: Record<string, number>;
|
|
265
265
|
durationStartTimesByProductId?: Record<string, string[]>;
|
|
266
|
+
/** Explicit POS manual interval. Endpoints are absolute datetimes, not business-day HH:mm. */
|
|
267
|
+
requestedRangesByProductId?: Record<string, {
|
|
268
|
+
startAt: string;
|
|
269
|
+
endAt: string;
|
|
270
|
+
}>;
|
|
266
271
|
/** Restore only the exact remembered start; recompute the end from current product/windows. */
|
|
267
272
|
rememberedStartAtByProductId?: Record<string, string>;
|
|
268
273
|
/** Order-scoped v2 memory preserves the complete actual booking interval. */
|
|
@@ -300,6 +305,8 @@ export interface GetProductTimeRangesRuntimeOptions {
|
|
|
300
305
|
* disabled.
|
|
301
306
|
*/
|
|
302
307
|
allowSessionCustomRanges?: boolean;
|
|
308
|
+
/** Internal POS manual capability; automatic/remembered selections must leave this disabled. */
|
|
309
|
+
allowRequestedRanges?: boolean;
|
|
303
310
|
/**
|
|
304
311
|
* Internal POS capability: materialize candidates whose schedule date was
|
|
305
312
|
* explicitly excluded, while availability evaluation keeps them unavailable.
|