@pisell/pisellos 2.3.16 → 2.3.18
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/Order/index.d.ts +4 -1
- package/dist/modules/Order/index.js +135 -75
- package/dist/modules/SalesSummary/index.d.ts +7 -3
- package/dist/modules/SalesSummary/index.js +67 -39
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +2 -1
- package/dist/modules/SurchargeList/index.d.ts +6 -4
- package/dist/modules/SurchargeList/index.js +62 -39
- package/dist/modules/SurchargeList/types.d.ts +6 -2
- package/dist/solution/BaseSales/index.js +11 -8
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +2 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/lib/modules/Order/index.d.ts +4 -1
- package/lib/modules/Order/index.js +62 -7
- package/lib/modules/SalesSummary/index.d.ts +7 -3
- package/lib/modules/SalesSummary/index.js +28 -11
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +2 -0
- package/lib/modules/SurchargeList/index.d.ts +6 -4
- package/lib/modules/SurchargeList/index.js +41 -21
- package/lib/modules/SurchargeList/types.d.ts +6 -2
- package/lib/solution/BaseSales/index.js +7 -5
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +2 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/package.json +1 -1
|
@@ -197,6 +197,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
197
197
|
private clearManualDepositOverride;
|
|
198
198
|
private getOriginalSalesSnapshot;
|
|
199
199
|
private isSnapshotPayableAmountUnchanged;
|
|
200
|
+
private hasShopDiscountChangedFromSnapshot;
|
|
200
201
|
private restoreOriginalSnapshotIfProductsUnchanged;
|
|
201
202
|
private clearPersistedAmountFieldsForFullRecalc;
|
|
202
203
|
private getPaymentTargetAmount;
|
|
@@ -230,6 +231,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
230
231
|
* const ids = this.collectBookingHolderRecords(booking);
|
|
231
232
|
*/
|
|
232
233
|
private collectBookingHolderRecords;
|
|
234
|
+
private setProductHolderFromBooking;
|
|
235
|
+
private syncLinkedBookingHoldersToProducts;
|
|
233
236
|
/**
|
|
234
237
|
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
235
238
|
*
|
|
@@ -458,7 +461,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
458
461
|
generateIdempotencyToken(): string;
|
|
459
462
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
460
463
|
createOrder(params: CommitOrderParams['query']): {
|
|
461
|
-
type: "
|
|
464
|
+
type: "virtual" | "appointment_booking";
|
|
462
465
|
platform: string;
|
|
463
466
|
sales_channel: string;
|
|
464
467
|
order_sales_channel: string;
|
|
@@ -712,6 +712,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
712
712
|
// 也需要让 Rules.calcDiscount 把 DiscountModule 的 isSelected / isAvailable /
|
|
713
713
|
// appliedProductDetails / savedAmount 复位。
|
|
714
714
|
if (!tempOrder) return;
|
|
715
|
+
this.syncLinkedBookingHoldersToProducts(tempOrder);
|
|
715
716
|
delete tempOrder.discount_list;
|
|
716
717
|
var discountList = ((_this$store$discount9 = this.store.discount) === null || _this$store$discount9 === void 0 ? void 0 : _this$store$discount9.getDiscountList()) || [];
|
|
717
718
|
var shouldSkipDiscountCalculation = this.shouldSkipDiscountCalculation(tempOrder);
|
|
@@ -1994,11 +1995,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1994
1995
|
});
|
|
1995
1996
|
return currentAmountGap === snapshotAmountGap;
|
|
1996
1997
|
}
|
|
1998
|
+
}, {
|
|
1999
|
+
key: "hasShopDiscountChangedFromSnapshot",
|
|
2000
|
+
value: function hasShopDiscountChangedFromSnapshot(tempOrder, snapshot) {
|
|
2001
|
+
var _snapshot$shop_discou;
|
|
2002
|
+
var snapshotSummary = snapshot.summary && _typeof(snapshot.summary) === 'object' ? snapshot.summary : {};
|
|
2003
|
+
var snapshotShopDiscount = (_snapshot$shop_discou = snapshot.shop_discount) !== null && _snapshot$shop_discou !== void 0 ? _snapshot$shop_discou : snapshotSummary.shop_discount;
|
|
2004
|
+
if (snapshotShopDiscount === undefined || snapshotShopDiscount === null || snapshotShopDiscount === '') {
|
|
2005
|
+
return !new Decimal(tempOrder.shop_discount || 0).equals(0);
|
|
2006
|
+
}
|
|
2007
|
+
return !new Decimal(tempOrder.shop_discount || 0).equals(snapshotShopDiscount || 0);
|
|
2008
|
+
}
|
|
1997
2009
|
}, {
|
|
1998
2010
|
key: "restoreOriginalSnapshotIfProductsUnchanged",
|
|
1999
|
-
value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder) {
|
|
2000
|
-
var snapshot = this.getOriginalSalesSnapshot(tempOrder);
|
|
2001
|
-
if (!snapshot) return null;
|
|
2011
|
+
value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder, snapshot) {
|
|
2002
2012
|
var currentFingerprint = this.buildOrderProductsFingerprint(tempOrder.products);
|
|
2003
2013
|
if (currentFingerprint !== snapshot.productFingerprint) {
|
|
2004
2014
|
var currentStructuralFingerprint = this.buildOrderProductsStructuralFingerprint(tempOrder.products);
|
|
@@ -2431,6 +2441,48 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2431
2441
|
return record !== undefined && record !== null && record !== '';
|
|
2432
2442
|
});
|
|
2433
2443
|
}
|
|
2444
|
+
}, {
|
|
2445
|
+
key: "setProductHolderFromBooking",
|
|
2446
|
+
value: function setProductHolderFromBooking(product, booking) {
|
|
2447
|
+
if (!product || !booking) return;
|
|
2448
|
+
var holderRecords = this.collectBookingHolderRecords(booking);
|
|
2449
|
+
if (!product.metadata || _typeof(product.metadata) !== 'object') {
|
|
2450
|
+
product.metadata = {};
|
|
2451
|
+
}
|
|
2452
|
+
product.metadata.holder_id = holderRecords.length > 0 ? holderRecords : null;
|
|
2453
|
+
}
|
|
2454
|
+
}, {
|
|
2455
|
+
key: "syncLinkedBookingHoldersToProducts",
|
|
2456
|
+
value: function syncLinkedBookingHoldersToProducts(tempOrder) {
|
|
2457
|
+
var _this13 = this;
|
|
2458
|
+
var bookings = tempOrder.bookings || [];
|
|
2459
|
+
var products = tempOrder.products || [];
|
|
2460
|
+
if (!bookings.length || !products.length) return;
|
|
2461
|
+
var bookingByProductUid = new Map();
|
|
2462
|
+
var bookingByBookingUid = new Map();
|
|
2463
|
+
bookings.forEach(function (booking) {
|
|
2464
|
+
var _booking$metadata2, _booking$metadata3;
|
|
2465
|
+
if (!booking || _typeof(booking) !== 'object') return;
|
|
2466
|
+
var productUid = booking.product_uid || ((_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid);
|
|
2467
|
+
if (productUid !== undefined && productUid !== null && String(productUid) !== '') {
|
|
2468
|
+
bookingByProductUid.set(String(productUid), booking);
|
|
2469
|
+
}
|
|
2470
|
+
var bookingUid = ((_booking$metadata3 = booking.metadata) === null || _booking$metadata3 === void 0 ? void 0 : _booking$metadata3.unique_identification_number) || booking.booking_uid;
|
|
2471
|
+
if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
|
|
2472
|
+
bookingByBookingUid.set(String(bookingUid), booking);
|
|
2473
|
+
}
|
|
2474
|
+
});
|
|
2475
|
+
products.forEach(function (product) {
|
|
2476
|
+
var _product$metadata5, _product$metadata6;
|
|
2477
|
+
if (!product || _typeof(product) !== 'object') return;
|
|
2478
|
+
var productUid = ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) || product.unique_identification_number;
|
|
2479
|
+
var bookingUid = product.booking_uid || ((_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid);
|
|
2480
|
+
var linkedBooking = (productUid !== undefined && productUid !== null && String(productUid) !== '' ? bookingByProductUid.get(String(productUid)) : undefined) || (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '' ? bookingByBookingUid.get(String(bookingUid)) : undefined);
|
|
2481
|
+
if (linkedBooking) {
|
|
2482
|
+
_this13.setProductHolderFromBooking(product, linkedBooking);
|
|
2483
|
+
}
|
|
2484
|
+
});
|
|
2485
|
+
}
|
|
2434
2486
|
|
|
2435
2487
|
/**
|
|
2436
2488
|
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
@@ -2535,41 +2587,42 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2535
2587
|
value: function syncTempOrderHolderFromBookings(tempOrder) {
|
|
2536
2588
|
var bookings = tempOrder.bookings || [];
|
|
2537
2589
|
var hasHolderSource = bookings.some(function (booking) {
|
|
2538
|
-
var _booking$
|
|
2539
|
-
return (booking === null || booking === void 0 ? void 0 : booking.holder) !== undefined || (booking === null || booking === void 0 || (_booking$
|
|
2590
|
+
var _booking$metadata4;
|
|
2591
|
+
return (booking === null || booking === void 0 ? void 0 : booking.holder) !== undefined || (booking === null || booking === void 0 || (_booking$metadata4 = booking.metadata) === null || _booking$metadata4 === void 0 ? void 0 : _booking$metadata4.holder_id) !== undefined;
|
|
2540
2592
|
});
|
|
2541
2593
|
var nextHolder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
2542
2594
|
if (nextHolder || hasHolderSource || bookings.length === 0) {
|
|
2543
2595
|
tempOrder.holder = nextHolder;
|
|
2544
2596
|
}
|
|
2597
|
+
this.syncLinkedBookingHoldersToProducts(tempOrder);
|
|
2545
2598
|
}
|
|
2546
2599
|
}, {
|
|
2547
2600
|
key: "getBookingUniqueIdentificationNumber",
|
|
2548
2601
|
value: function getBookingUniqueIdentificationNumber(booking) {
|
|
2549
|
-
var _booking$
|
|
2550
|
-
var uid = booking === null || booking === void 0 || (_booking$
|
|
2602
|
+
var _booking$metadata5;
|
|
2603
|
+
var uid = booking === null || booking === void 0 || (_booking$metadata5 = booking.metadata) === null || _booking$metadata5 === void 0 ? void 0 : _booking$metadata5.unique_identification_number;
|
|
2551
2604
|
if (uid === undefined || uid === null || uid === '') return null;
|
|
2552
2605
|
return String(uid);
|
|
2553
2606
|
}
|
|
2554
2607
|
}, {
|
|
2555
2608
|
key: "findBookingIndexByUniqueIdentificationNumber",
|
|
2556
2609
|
value: function findBookingIndexByUniqueIdentificationNumber(tempOrder, uniqueIdentificationNumber) {
|
|
2557
|
-
var
|
|
2610
|
+
var _this14 = this;
|
|
2558
2611
|
return (tempOrder.bookings || []).findIndex(function (booking) {
|
|
2559
|
-
return
|
|
2612
|
+
return _this14.getBookingUniqueIdentificationNumber(booking) === uniqueIdentificationNumber;
|
|
2560
2613
|
});
|
|
2561
2614
|
}
|
|
2562
2615
|
}, {
|
|
2563
2616
|
key: "removeLinkedBookingsForProduct",
|
|
2564
2617
|
value: function removeLinkedBookingsForProduct(tempOrder, product) {
|
|
2565
|
-
var _product$
|
|
2566
|
-
_product$
|
|
2567
|
-
|
|
2568
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
2569
|
-
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$
|
|
2618
|
+
var _product$metadata7,
|
|
2619
|
+
_product$metadata8,
|
|
2620
|
+
_this15 = this;
|
|
2621
|
+
var productUid = (product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
2622
|
+
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_uid);
|
|
2570
2623
|
if (!productUid && !bookingUid) return;
|
|
2571
2624
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
2572
|
-
var currentBookingUid =
|
|
2625
|
+
var currentBookingUid = _this15.getBookingUniqueIdentificationNumber(booking);
|
|
2573
2626
|
if (bookingUid && currentBookingUid === String(bookingUid)) return false;
|
|
2574
2627
|
if (productUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) return false;
|
|
2575
2628
|
return true;
|
|
@@ -2616,8 +2669,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2616
2669
|
key: "recalculateSummary",
|
|
2617
2670
|
value: function () {
|
|
2618
2671
|
var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(options) {
|
|
2619
|
-
var _ref47, _salesSummaryResult$e;
|
|
2620
|
-
var tempOrder, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
|
|
2672
|
+
var _this$otherParams2, _ref47, _salesSummaryResult$e;
|
|
2673
|
+
var tempOrder, originalSnapshot, hasShopDiscountChanged, shouldReuseOriginalSnapshot, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
|
|
2621
2674
|
return _regeneratorRuntime().wrap(function _callee11$(_context13) {
|
|
2622
2675
|
while (1) switch (_context13.prev = _context13.next) {
|
|
2623
2676
|
case 0:
|
|
@@ -2629,14 +2682,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2629
2682
|
return _context13.abrupt("return", null);
|
|
2630
2683
|
case 3:
|
|
2631
2684
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
2632
|
-
|
|
2685
|
+
originalSnapshot = this.getOriginalSalesSnapshot(tempOrder);
|
|
2686
|
+
hasShopDiscountChanged = originalSnapshot ? this.hasShopDiscountChangedFromSnapshot(tempOrder, originalSnapshot) : false;
|
|
2687
|
+
shouldReuseOriginalSnapshot = originalSnapshot && !hasShopDiscountChanged;
|
|
2688
|
+
snapshotSummary = shouldReuseOriginalSnapshot ? this.restoreOriginalSnapshotIfProductsUnchanged(tempOrder, originalSnapshot) : null;
|
|
2633
2689
|
if (!snapshotSummary) {
|
|
2634
|
-
_context13.next =
|
|
2690
|
+
_context13.next = 10;
|
|
2635
2691
|
break;
|
|
2636
2692
|
}
|
|
2637
2693
|
return _context13.abrupt("return", snapshotSummary);
|
|
2638
|
-
case
|
|
2639
|
-
shouldFullRecalculateFromSnapshot = Boolean(
|
|
2694
|
+
case 10:
|
|
2695
|
+
shouldFullRecalculateFromSnapshot = Boolean(originalSnapshot);
|
|
2640
2696
|
summaryProducts = shouldFullRecalculateFromSnapshot ? cloneDeep(tempOrder.products || []) : tempOrder.products;
|
|
2641
2697
|
if (shouldFullRecalculateFromSnapshot) {
|
|
2642
2698
|
this.clearPersistedAmountFieldsForFullRecalc(summaryProducts || []);
|
|
@@ -2646,7 +2702,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2646
2702
|
totalRefundAmount = existedSummary.total_refund_amount || '0.00';
|
|
2647
2703
|
paidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
|
|
2648
2704
|
if (salesSummary) {
|
|
2649
|
-
_context13.next =
|
|
2705
|
+
_context13.next = 26;
|
|
2650
2706
|
break;
|
|
2651
2707
|
}
|
|
2652
2708
|
emptyBaseSummary = _objectSpread(_objectSpread(_objectSpread({}, createEmptySummary()), existedSummary), {}, {
|
|
@@ -2673,14 +2729,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2673
2729
|
summary: emptySummary
|
|
2674
2730
|
});
|
|
2675
2731
|
return _context13.abrupt("return", this.store.summary);
|
|
2676
|
-
case
|
|
2677
|
-
_context13.next =
|
|
2678
|
-
return salesSummary.getSummary({
|
|
2732
|
+
case 26:
|
|
2733
|
+
_context13.next = 28;
|
|
2734
|
+
return salesSummary.getSummary(_objectSpread({
|
|
2679
2735
|
products: summaryProducts,
|
|
2680
2736
|
isPriceIncludeTax: tempOrder.is_price_include_tax,
|
|
2681
2737
|
shopDiscount: tempOrder.shop_discount
|
|
2682
|
-
})
|
|
2683
|
-
|
|
2738
|
+
}, (_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.channel ? {
|
|
2739
|
+
channel: this.otherParams.channel
|
|
2740
|
+
} : {}));
|
|
2741
|
+
case 28:
|
|
2684
2742
|
salesSummaryResult = _context13.sent;
|
|
2685
2743
|
if (shouldFullRecalculateFromSnapshot) {
|
|
2686
2744
|
tempOrder.products = summaryProducts;
|
|
@@ -2727,7 +2785,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2727
2785
|
summary: summary
|
|
2728
2786
|
});
|
|
2729
2787
|
return _context13.abrupt("return", this.store.summary);
|
|
2730
|
-
case
|
|
2788
|
+
case 46:
|
|
2731
2789
|
case "end":
|
|
2732
2790
|
return _context13.stop();
|
|
2733
2791
|
}
|
|
@@ -2892,15 +2950,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2892
2950
|
}, {
|
|
2893
2951
|
key: "productHasCustomerBoundDiscount",
|
|
2894
2952
|
value: function productHasCustomerBoundDiscount(product) {
|
|
2895
|
-
var
|
|
2953
|
+
var _this16 = this;
|
|
2896
2954
|
if (((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (discount) {
|
|
2897
|
-
return
|
|
2955
|
+
return _this16.isCustomerBoundDiscount(discount);
|
|
2898
2956
|
})) {
|
|
2899
2957
|
return true;
|
|
2900
2958
|
}
|
|
2901
2959
|
return ((product === null || product === void 0 ? void 0 : product.product_bundle) || []).some(function (bundle) {
|
|
2902
2960
|
return ((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []).some(function (discount) {
|
|
2903
|
-
return
|
|
2961
|
+
return _this16.isCustomerBoundDiscount(discount);
|
|
2904
2962
|
});
|
|
2905
2963
|
});
|
|
2906
2964
|
}
|
|
@@ -2909,18 +2967,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2909
2967
|
value: function shouldSkipDiscountCalculation(tempOrder) {
|
|
2910
2968
|
var _this$store$discount13,
|
|
2911
2969
|
_this$store$discount14,
|
|
2912
|
-
|
|
2970
|
+
_this17 = this;
|
|
2913
2971
|
if (this.hasActiveCustomerBoundDiscount) return false;
|
|
2914
2972
|
var discountList = ((_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 || (_this$store$discount14 = _this$store$discount13.getDiscountList) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.call(_this$store$discount13)) || [];
|
|
2915
2973
|
if (discountList.length > 0) return false;
|
|
2916
2974
|
return !(tempOrder.products || []).some(function (product) {
|
|
2917
|
-
return
|
|
2975
|
+
return _this17.productHasCustomerBoundDiscount(product);
|
|
2918
2976
|
});
|
|
2919
2977
|
}
|
|
2920
2978
|
}, {
|
|
2921
2979
|
key: "clearCustomerBoundDiscounts",
|
|
2922
2980
|
value: function clearCustomerBoundDiscounts(tempOrder) {
|
|
2923
|
-
var
|
|
2981
|
+
var _this18 = this,
|
|
2924
2982
|
_discountModule$getDi,
|
|
2925
2983
|
_discountModule$getOr,
|
|
2926
2984
|
_discountModule$setDi,
|
|
@@ -2929,7 +2987,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2929
2987
|
var filterDiscountList = function filterDiscountList(discountList) {
|
|
2930
2988
|
if (!Array.isArray(discountList)) return [];
|
|
2931
2989
|
return discountList.filter(function (discount) {
|
|
2932
|
-
var shouldRemove =
|
|
2990
|
+
var shouldRemove = _this18.isCustomerBoundDiscount(discount);
|
|
2933
2991
|
if (shouldRemove) didRemoveCustomerBoundDiscount = true;
|
|
2934
2992
|
return !shouldRemove;
|
|
2935
2993
|
});
|
|
@@ -2957,11 +3015,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2957
3015
|
var currentOriginalDiscounts = ((_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
|
|
2958
3016
|
var nextDiscounts = currentDiscounts.filter(function (discount) {
|
|
2959
3017
|
if (discount !== null && discount !== void 0 && discount.isEditMode) return true;
|
|
2960
|
-
return !
|
|
3018
|
+
return !_this18.isCustomerBoundDiscount(discount);
|
|
2961
3019
|
});
|
|
2962
3020
|
var nextOriginalDiscounts = currentOriginalDiscounts.filter(function (discount) {
|
|
2963
3021
|
if (discount !== null && discount !== void 0 && discount.isEditMode) return true;
|
|
2964
|
-
return !
|
|
3022
|
+
return !_this18.isCustomerBoundDiscount(discount);
|
|
2965
3023
|
});
|
|
2966
3024
|
void ((_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, nextDiscounts));
|
|
2967
3025
|
void ((_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, nextOriginalDiscounts));
|
|
@@ -3129,7 +3187,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3129
3187
|
}, {
|
|
3130
3188
|
key: "addOrderPayment",
|
|
3131
3189
|
value: function addOrderPayment(payment) {
|
|
3132
|
-
var
|
|
3190
|
+
var _this19 = this;
|
|
3133
3191
|
this.logInfo('addOrderPayment', {
|
|
3134
3192
|
payment: payment
|
|
3135
3193
|
});
|
|
@@ -3146,7 +3204,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3146
3204
|
void this.recalculateSummary({
|
|
3147
3205
|
createIfMissing: true
|
|
3148
3206
|
}).catch(function (error) {
|
|
3149
|
-
|
|
3207
|
+
_this19.logError('recalculate summary after addOrderPayment failed', {
|
|
3150
3208
|
error: error instanceof Error ? error.message : String(error)
|
|
3151
3209
|
});
|
|
3152
3210
|
});
|
|
@@ -3228,7 +3286,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3228
3286
|
}, {
|
|
3229
3287
|
key: "applyPaymentLifecycleChange",
|
|
3230
3288
|
value: function applyPaymentLifecycleChange(tempOrder, options) {
|
|
3231
|
-
var
|
|
3289
|
+
var _this20 = this;
|
|
3232
3290
|
this.updateTempOrderPaymentStatus(tempOrder);
|
|
3233
3291
|
if ((options === null || options === void 0 ? void 0 : options.persist) !== false) {
|
|
3234
3292
|
this.persistTempOrder();
|
|
@@ -3238,7 +3296,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3238
3296
|
void this.recalculateSummary({
|
|
3239
3297
|
createIfMissing: true
|
|
3240
3298
|
}).catch(function (error) {
|
|
3241
|
-
|
|
3299
|
+
_this20.logError("recalculate summary after ".concat(logContext, " failed"), {
|
|
3242
3300
|
error: error instanceof Error ? error.message : String(error)
|
|
3243
3301
|
});
|
|
3244
3302
|
});
|
|
@@ -3282,7 +3340,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3282
3340
|
}, {
|
|
3283
3341
|
key: "updateVoucherOrderPayments",
|
|
3284
3342
|
value: function updateVoucherOrderPayments(payments, options) {
|
|
3285
|
-
var
|
|
3343
|
+
var _this21 = this;
|
|
3286
3344
|
var tempOrder = this.ensureTempOrder();
|
|
3287
3345
|
var isOrderPaymentType = function isOrderPaymentType(value) {
|
|
3288
3346
|
return value === 'normal' || value === 'deposit';
|
|
@@ -3317,7 +3375,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3317
3375
|
});
|
|
3318
3376
|
};
|
|
3319
3377
|
var mappedVouchers = mapPaymentItemsToOrderPayments(payments.map(function (payment) {
|
|
3320
|
-
return
|
|
3378
|
+
return _this21.normalizePaymentSource(normalizeVoucherPaymentStatus(withVoucherPaymentType(payment)), {
|
|
3321
3379
|
defaultPaid: false
|
|
3322
3380
|
});
|
|
3323
3381
|
})).filter(function (payment) {
|
|
@@ -3366,7 +3424,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3366
3424
|
void this.recalculateSummary({
|
|
3367
3425
|
createIfMissing: true
|
|
3368
3426
|
}).catch(function (error) {
|
|
3369
|
-
|
|
3427
|
+
_this21.logError('recalculate summary after updateVoucherOrderPayments failed', {
|
|
3370
3428
|
error: error instanceof Error ? error.message : String(error)
|
|
3371
3429
|
});
|
|
3372
3430
|
});
|
|
@@ -3433,8 +3491,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3433
3491
|
}, {
|
|
3434
3492
|
key: "hasLinkedBookingUid",
|
|
3435
3493
|
value: function hasLinkedBookingUid(product) {
|
|
3436
|
-
var _product$booking_uid, _product$
|
|
3437
|
-
var bookingUid = (_product$booking_uid = product === null || product === void 0 ? void 0 : product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : product === null || product === void 0 || (_product$
|
|
3494
|
+
var _product$booking_uid, _product$metadata9;
|
|
3495
|
+
var bookingUid = (_product$booking_uid = product === null || product === void 0 ? void 0 : product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : product === null || product === void 0 || (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.booking_uid;
|
|
3438
3496
|
return bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '';
|
|
3439
3497
|
}
|
|
3440
3498
|
|
|
@@ -3502,7 +3560,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3502
3560
|
var _appendProductLineToTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(tempOrder, product, booking) {
|
|
3503
3561
|
var _booking_uid,
|
|
3504
3562
|
_metadata,
|
|
3505
|
-
|
|
3563
|
+
_this22 = this;
|
|
3506
3564
|
var linked, productToAdd, incomingFingerprint, normalizedIncoming, incomingBookingUid, hasIncomingGoodPass, hasIncomingProductNote, hasIncomingBookingUid, shouldForceNewLine, matchedIndex, matchedProduct, existedFingerprint, shouldMerge, _targetProduct$metada, targetProduct, targetUid, normalizedProduct, nextNum, targetIsManualProductDiscount, nextDiscountList;
|
|
3507
3565
|
return _regeneratorRuntime().wrap(function _callee16$(_context18) {
|
|
3508
3566
|
while (1) switch (_context18.prev = _context18.next) {
|
|
@@ -3527,8 +3585,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3527
3585
|
hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
|
|
3528
3586
|
shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingBookingUid;
|
|
3529
3587
|
matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
|
|
3530
|
-
if (
|
|
3531
|
-
if (
|
|
3588
|
+
if (_this22.hasGoodPassDiscount(item)) return false;
|
|
3589
|
+
if (_this22.hasOrderProductLineNote(item)) return false;
|
|
3532
3590
|
if (item.order_detail_id !== undefined && item.order_detail_id !== null) return false;
|
|
3533
3591
|
if (item.product_id !== productToAdd.product_id) return false;
|
|
3534
3592
|
if (item.product_variant_id !== productToAdd.product_variant_id) return false;
|
|
@@ -3825,17 +3883,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3825
3883
|
}, {
|
|
3826
3884
|
key: "preservePersistedBundlePriceFields",
|
|
3827
3885
|
value: function preservePersistedBundlePriceFields(previousBundles, nextBundles) {
|
|
3828
|
-
var
|
|
3886
|
+
var _this23 = this;
|
|
3829
3887
|
if (!Array.isArray(nextBundles)) return nextBundles;
|
|
3830
3888
|
if (!Array.isArray(previousBundles) || previousBundles.length === 0) return nextBundles;
|
|
3831
3889
|
var previousByIdentity = new Map();
|
|
3832
3890
|
previousBundles.forEach(function (bundle) {
|
|
3833
|
-
var identity =
|
|
3891
|
+
var identity = _this23.getBundleRuntimeIdentity(bundle);
|
|
3834
3892
|
if (identity) previousByIdentity.set(identity, bundle);
|
|
3835
3893
|
});
|
|
3836
3894
|
return nextBundles.map(function (bundle, index) {
|
|
3837
3895
|
if (!bundle || _typeof(bundle) !== 'object') return bundle;
|
|
3838
|
-
var previous = previousByIdentity.get(
|
|
3896
|
+
var previous = previousByIdentity.get(_this23.getBundleRuntimeIdentity(bundle)) || previousBundles[index];
|
|
3839
3897
|
if (!previous || _typeof(previous) !== 'object') return bundle;
|
|
3840
3898
|
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
3841
3899
|
price: previous.price,
|
|
@@ -4022,7 +4080,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4022
4080
|
key: "updateOrderProducts",
|
|
4023
4081
|
value: function () {
|
|
4024
4082
|
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(paramsList) {
|
|
4025
|
-
var
|
|
4083
|
+
var _this24 = this;
|
|
4026
4084
|
var tempOrder;
|
|
4027
4085
|
return _regeneratorRuntime().wrap(function _callee20$(_context22) {
|
|
4028
4086
|
while (1) switch (_context22.prev = _context22.next) {
|
|
@@ -4035,7 +4093,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4035
4093
|
return _context22.abrupt("return", tempOrder.products);
|
|
4036
4094
|
case 3:
|
|
4037
4095
|
paramsList.forEach(function (params) {
|
|
4038
|
-
|
|
4096
|
+
_this24.applyOrderProductUpdateToTempOrder(tempOrder, params);
|
|
4039
4097
|
});
|
|
4040
4098
|
_context22.next = 6;
|
|
4041
4099
|
return this.finalizeAfterProductsMutation(tempOrder);
|
|
@@ -4205,7 +4263,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4205
4263
|
key: "removeProductsFromOrder",
|
|
4206
4264
|
value: (function () {
|
|
4207
4265
|
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(identities) {
|
|
4208
|
-
var
|
|
4266
|
+
var _this25 = this;
|
|
4209
4267
|
var tempOrder, productsBeforeRemove, bookingsBeforeRemove, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator21, _step21, _loop3;
|
|
4210
4268
|
return _regeneratorRuntime().wrap(function _callee23$(_context26) {
|
|
4211
4269
|
while (1) switch (_context26.prev = _context26.next) {
|
|
@@ -4260,7 +4318,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4260
4318
|
}
|
|
4261
4319
|
if (productUid !== undefined && productUid !== null && productUid !== '') {
|
|
4262
4320
|
bookingsBeforeRemove.forEach(function (booking) {
|
|
4263
|
-
var bookingUid =
|
|
4321
|
+
var bookingUid = _this25.getBookingUniqueIdentificationNumber(booking);
|
|
4264
4322
|
if (bookingUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) {
|
|
4265
4323
|
linkedBookingUidsToRemove.add(bookingUid);
|
|
4266
4324
|
}
|
|
@@ -4395,14 +4453,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4395
4453
|
}, {
|
|
4396
4454
|
key: "buildCurrentSubmitPayloadForLocalPrint",
|
|
4397
4455
|
value: function buildCurrentSubmitPayloadForLocalPrint(params) {
|
|
4398
|
-
var _params$cacheId, _this$
|
|
4456
|
+
var _params$cacheId, _this$otherParams3, _ref68, _params$businessCode, _this$otherParams4, _this$otherParams5;
|
|
4399
4457
|
var tempOrder = this.ensureTempOrder();
|
|
4400
4458
|
this.persistTempOrder();
|
|
4401
4459
|
var payload = buildSubmitPayload({
|
|
4402
4460
|
tempOrder: tempOrder,
|
|
4403
4461
|
cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
|
|
4404
|
-
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$
|
|
4405
|
-
businessCode: (_ref68 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$
|
|
4462
|
+
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.platform),
|
|
4463
|
+
businessCode: (_ref68 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.businessCode) !== null && _ref68 !== void 0 ? _ref68 : (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.business_code,
|
|
4406
4464
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
4407
4465
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
4408
4466
|
summary: this.store.summary || createEmptySummary(),
|
|
@@ -4508,7 +4566,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4508
4566
|
key: "runSubmitTempOrder",
|
|
4509
4567
|
value: function () {
|
|
4510
4568
|
var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
4511
|
-
var _params$cacheId2, _this$
|
|
4569
|
+
var _params$cacheId2, _this$otherParams6, _ref72, _ref73, _submitSnapshot$busin, _this$otherParams7, _this$otherParams8, _submitSnapshot$type;
|
|
4512
4570
|
var tempOrder, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
4513
4571
|
return _regeneratorRuntime().wrap(function _callee29$(_context32) {
|
|
4514
4572
|
while (1) switch (_context32.prev = _context32.next) {
|
|
@@ -4569,8 +4627,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4569
4627
|
payload = buildSubmitPayload({
|
|
4570
4628
|
tempOrder: tempOrder,
|
|
4571
4629
|
cacheId: effectiveCacheId,
|
|
4572
|
-
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$
|
|
4573
|
-
businessCode: (_ref72 = (_ref73 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref73 !== void 0 ? _ref73 : (_this$
|
|
4630
|
+
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform),
|
|
4631
|
+
businessCode: (_ref72 = (_ref73 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref73 !== void 0 ? _ref73 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) !== null && _ref72 !== void 0 ? _ref72 : (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code,
|
|
4574
4632
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
4575
4633
|
type: (_submitSnapshot$type = submitSnapshot.type) !== null && _submitSnapshot$type !== void 0 ? _submitSnapshot$type : params === null || params === void 0 ? void 0 : params.type,
|
|
4576
4634
|
summary: latestSummary,
|
|
@@ -4739,10 +4797,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4739
4797
|
value: function extractSubmitErrorResponse(error) {
|
|
4740
4798
|
var _error$response,
|
|
4741
4799
|
_error$response2,
|
|
4742
|
-
|
|
4800
|
+
_this26 = this;
|
|
4743
4801
|
var candidates = [error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.body, error === null || error === void 0 ? void 0 : error.body];
|
|
4744
4802
|
return candidates.find(function (candidate) {
|
|
4745
|
-
return
|
|
4803
|
+
return _this26.isSubmitErrorResponse(candidate);
|
|
4746
4804
|
}) || null;
|
|
4747
4805
|
}
|
|
4748
4806
|
}, {
|
|
@@ -5327,6 +5385,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5327
5385
|
products: cloneDeep(nextTempOrder.products || []),
|
|
5328
5386
|
payments: cloneDeep(nextTempOrder.payments || []),
|
|
5329
5387
|
surcharges: cloneDeep(nextTempOrder.surcharges || []),
|
|
5388
|
+
shop_discount: nextTempOrder.shop_discount || '0.00',
|
|
5330
5389
|
productFingerprint: this.buildOrderProductsFingerprint(nextTempOrder.products || [])
|
|
5331
5390
|
}
|
|
5332
5391
|
});
|
|
@@ -5403,7 +5462,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5403
5462
|
}, {
|
|
5404
5463
|
key: "normalizeTempOrderForRuntime",
|
|
5405
5464
|
value: function normalizeTempOrderForRuntime(raw, options) {
|
|
5406
|
-
var
|
|
5465
|
+
var _this27 = this;
|
|
5407
5466
|
var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), raw || {});
|
|
5408
5467
|
// ES 列表详情使用 id 表示订单主键;OS 详情态统一依赖 order_id 驱动操作按钮。
|
|
5409
5468
|
if ((nextTempOrder.order_id === undefined || nextTempOrder.order_id === null) && (raw === null || raw === void 0 ? void 0 : raw.id) !== undefined && (raw === null || raw === void 0 ? void 0 : raw.id) !== null) {
|
|
@@ -5426,10 +5485,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5426
5485
|
nextTempOrder.holder = raw.holder && _typeof(raw.holder) === 'object' ? _objectSpread({}, raw.holder) : null;
|
|
5427
5486
|
var rawProducts = Array.isArray(raw.products) ? raw.products : [];
|
|
5428
5487
|
nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map(function (p) {
|
|
5429
|
-
return
|
|
5488
|
+
return _this27.normalizeHydratedOrderProduct(p);
|
|
5430
5489
|
}) : [];
|
|
5431
5490
|
nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
|
|
5432
|
-
var booking =
|
|
5491
|
+
var booking = _this27.normalizeHydratedBookingHolder(b || {});
|
|
5433
5492
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
5434
5493
|
is_all: normalizeBookingIsAll(booking),
|
|
5435
5494
|
sub_type: normalizeBookingSubType(booking)
|
|
@@ -5459,11 +5518,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5459
5518
|
_step22;
|
|
5460
5519
|
try {
|
|
5461
5520
|
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
|
5462
|
-
var _product$
|
|
5521
|
+
var _product$metadata10, _ref74, _ref75, _existed$origin, _rawProduct$metadata;
|
|
5463
5522
|
var _step22$value = _slicedToArray(_step22.value, 2),
|
|
5464
5523
|
index = _step22$value[0],
|
|
5465
5524
|
product = _step22$value[1];
|
|
5466
|
-
var uid = (_product$
|
|
5525
|
+
var uid = (_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number;
|
|
5467
5526
|
if (!uid) continue;
|
|
5468
5527
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
5469
5528
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
@@ -5501,8 +5560,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5501
5560
|
var bookingUidByProductUid = new Map();
|
|
5502
5561
|
var productByUid = new Map();
|
|
5503
5562
|
(tempOrder.products || []).forEach(function (product) {
|
|
5504
|
-
var _product$
|
|
5505
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
5563
|
+
var _product$metadata11;
|
|
5564
|
+
var productUid = (product === null || product === void 0 || (_product$metadata11 = product.metadata) === null || _product$metadata11 === void 0 ? void 0 : _product$metadata11.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
5506
5565
|
if (productUid !== undefined && productUid !== null && String(productUid) !== '') {
|
|
5507
5566
|
productByUid.set(String(productUid), product);
|
|
5508
5567
|
}
|
|
@@ -5523,8 +5582,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5523
5582
|
bookingUidByProductUid.set(String(productUid), bookingUid);
|
|
5524
5583
|
});
|
|
5525
5584
|
(tempOrder.products || []).forEach(function (product) {
|
|
5526
|
-
var _product$
|
|
5527
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
5585
|
+
var _product$metadata12;
|
|
5586
|
+
var productUid = (product === null || product === void 0 || (_product$metadata12 = product.metadata) === null || _product$metadata12 === void 0 ? void 0 : _product$metadata12.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
5528
5587
|
if (productUid === undefined || productUid === null || String(productUid) === '') return;
|
|
5529
5588
|
var bookingUid = bookingUidByProductUid.get(String(productUid));
|
|
5530
5589
|
if (!bookingUid) return;
|
|
@@ -5535,6 +5594,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5535
5594
|
product.booking_uid = linkedBookingUid;
|
|
5536
5595
|
product.metadata.booking_uid = linkedBookingUid;
|
|
5537
5596
|
});
|
|
5597
|
+
this.syncLinkedBookingHoldersToProducts(tempOrder);
|
|
5538
5598
|
}
|
|
5539
5599
|
}, {
|
|
5540
5600
|
key: "pickHydratedDisplayText",
|
|
@@ -5597,7 +5657,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5597
5657
|
}, {
|
|
5598
5658
|
key: "normalizeHydratedOrderProduct",
|
|
5599
5659
|
value: function normalizeHydratedOrderProduct(product) {
|
|
5600
|
-
var
|
|
5660
|
+
var _this28 = this;
|
|
5601
5661
|
var row = _objectSpread({}, product || {});
|
|
5602
5662
|
if (row.num === undefined && row.product_quantity !== undefined) {
|
|
5603
5663
|
row.num = row.product_quantity;
|
|
@@ -5605,7 +5665,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5605
5665
|
var productSku = ensureProductSku(row);
|
|
5606
5666
|
row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
|
|
5607
5667
|
option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
|
|
5608
|
-
return
|
|
5668
|
+
return _this28.normalizeHydratedProductOptionItem(optionItem || {});
|
|
5609
5669
|
}))
|
|
5610
5670
|
});
|
|
5611
5671
|
delete row["product_".concat('option', "_item")];
|
|
@@ -9,16 +9,19 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
9
9
|
private store;
|
|
10
10
|
private request;
|
|
11
11
|
private surchargeListModuleName;
|
|
12
|
+
private otherParams;
|
|
13
|
+
private surchargeListChannel;
|
|
12
14
|
constructor(name?: string, version?: string);
|
|
13
15
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
14
16
|
/**
|
|
15
|
-
* 更新父级解决方案透传的运行态参数,并在 surcharge
|
|
17
|
+
* 更新父级解决方案透传的运行态参数,并在 surcharge 模块名或渠道变化时刷新附加费列表。
|
|
16
18
|
*
|
|
17
19
|
* @example
|
|
18
|
-
* await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
|
|
20
|
+
* await salesSummaryModule.updateOtherParams({ channel: 'pos', surchargeListModuleName: 'custom_surchargeList' });
|
|
19
21
|
*/
|
|
20
22
|
updateOtherParams(params: Record<string, any>): Promise<void>;
|
|
21
|
-
|
|
23
|
+
private resolveChannel;
|
|
24
|
+
getSurchargeList(channel?: string): Promise<void>;
|
|
22
25
|
private getAppData;
|
|
23
26
|
private getTaxConfig;
|
|
24
27
|
getSummary(params: {
|
|
@@ -26,6 +29,7 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
26
29
|
isPriceIncludeTax?: number;
|
|
27
30
|
taxRate?: number;
|
|
28
31
|
shopDiscount?: string | number;
|
|
32
|
+
channel?: string;
|
|
29
33
|
}): Promise<{
|
|
30
34
|
tax_title: string;
|
|
31
35
|
tax_rate: number | undefined;
|