@pisell/pisellos 0.0.569 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +1 -1
- package/dist/modules/BaseModule.js +8 -10
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +7 -22
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -0
- package/dist/modules/Order/index.js +70 -40
- package/dist/modules/Payment/index.js +162 -97
- package/dist/modules/Payment/types.d.ts +4 -8
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +5 -4
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +3 -12
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +126 -427
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
- package/dist/modules/Schedule/index.js +1 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.js +129 -97
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.js +4 -2
- package/dist/server/modules/products/index.js +42 -24
- package/dist/server/modules/quotation/index.js +38 -29
- package/dist/server/modules/resource/index.js +4 -3
- package/dist/server/modules/schedule/index.js +35 -27
- package/dist/server/utils/product.js +1 -0
- package/dist/solution/BaseSales/index.js +41 -38
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
- package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.js +252 -177
- package/dist/solution/Checkout/utils/index.js +16 -4
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/ScanOrder/index.js +60 -50
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/VenueBooking/index.d.ts +3 -31
- package/dist/solution/VenueBooking/index.js +496 -651
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +49 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +1 -1
- package/lib/modules/BaseModule.js +46 -25
- package/lib/modules/BookingContext/index.js +136 -158
- package/lib/modules/BookingContext/types.js +32 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
- package/lib/modules/BookingContext/utils/flexible.js +55 -38
- package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
- package/lib/modules/BookingContext/utils/index.js +41 -124
- package/lib/modules/BookingContext/utils/noResource.js +70 -58
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
- package/lib/modules/BookingContext/utils/productExtend.js +155 -202
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
- package/lib/modules/BookingContext/utils/resources.js +167 -209
- package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
- package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +251 -321
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +50 -28
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.js +169 -232
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +128 -130
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.js +76 -69
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.js +1909 -1572
- package/lib/modules/Order/types.js +35 -78
- package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
- package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
- package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
- package/lib/modules/Order/utils.js +634 -799
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.js +378 -518
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +4 -8
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.js +48 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +211 -226
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +117 -117
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.js +100 -66
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.js +61 -60
- package/lib/modules/ResourcePlanner/planner.js +384 -346
- package/lib/modules/ResourcePlanner/types.js +16 -4
- package/lib/modules/Rules/index.js +903 -1475
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.js +90 -85
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.js +427 -351
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
- package/lib/modules/Schedule/index.js +114 -100
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.js +60 -46
- package/lib/modules/SurchargeList/types.js +16 -4
- package/lib/modules/index.js +63 -245
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.js +2337 -2675
- package/lib/server/modules/floor-plan/index.js +123 -102
- package/lib/server/modules/floor-plan/types.js +30 -15
- package/lib/server/modules/index.js +68 -106
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.js +642 -567
- package/lib/server/modules/order/types.js +32 -117
- package/lib/server/modules/order/utils/filterBookings.js +194 -219
- package/lib/server/modules/order/utils/filterOrders.js +92 -118
- package/lib/server/modules/payment/index.js +83 -59
- package/lib/server/modules/payment/types.js +16 -4
- package/lib/server/modules/products/index.js +459 -575
- package/lib/server/modules/products/types.js +34 -44
- package/lib/server/modules/quotation/index.js +172 -137
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.js +184 -213
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.js +123 -135
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +139 -196
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.js +456 -478
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.js +1016 -850
- package/lib/solution/BaseSales/types.js +37 -41
- package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
- package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
- package/lib/solution/BaseSales/utils.js +140 -155
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +459 -543
- package/lib/solution/BookingTicket/types.js +77 -99
- package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
- package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
- package/lib/solution/BookingTicket/utils/cartView.js +94 -110
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
- package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
- package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.js +1158 -1451
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +460 -493
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.js +320 -317
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.js +862 -831
- package/lib/solution/ScanOrder/types.js +34 -33
- package/lib/solution/ScanOrder/utils.js +371 -406
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.js +405 -379
- package/lib/solution/UnifiedBookingSales/types.js +31 -12
- package/lib/solution/VenueBooking/index.d.ts +3 -31
- package/lib/solution/VenueBooking/index.js +916 -967
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.js +41 -124
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -1,179 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Object.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.createDefaultOrderRulesHooks = createDefaultOrderRulesHooks;
|
|
17
|
-
exports.createDefaultTempOrder = createDefaultTempOrder;
|
|
18
|
-
Object.defineProperty(exports, "createEmptySummary", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _utils2.createEmptySummary;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "createUuidV4", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _orderCollectionIdentity.createUuidV4;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
exports.ensureCartItemOriginHolder = ensureCartItemOriginHolder;
|
|
31
|
-
Object.defineProperty(exports, "ensureManualProductDiscountList", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _manualProductDiscount.ensureManualProductDiscountList;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
exports.ensureProductSku = ensureProductSku;
|
|
38
|
-
Object.defineProperty(exports, "findManualProductDiscountItem", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _manualProductDiscount.findManualProductDiscountItem;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
exports.formatDateTime = formatDateTime;
|
|
45
|
-
exports.formatV1Product = formatV1Product;
|
|
46
|
-
exports.getAllDiscountList = exports.generateDuration = void 0;
|
|
47
|
-
exports.getBundleSellingMagnitude = getBundleSellingMagnitude;
|
|
48
|
-
exports.getBundleSignedUnit = getBundleSignedUnit;
|
|
49
|
-
exports.getOrderProductLineUid = getOrderProductLineUid;
|
|
50
|
-
exports.getProductSkuOptions = getProductSkuOptions;
|
|
51
|
-
exports.getRuntimeProductOrigin = getRuntimeProductOrigin;
|
|
52
|
-
exports.hasAssignedHolderId = hasAssignedHolderId;
|
|
53
|
-
exports.indexOrderProductsByUid = indexOrderProductsByUid;
|
|
54
|
-
exports.isEmptyOrderProductDisplayValue = isEmptyOrderProductDisplayValue;
|
|
55
|
-
exports.isHolderConfigRequired = isHolderConfigRequired;
|
|
56
|
-
exports.isMarkdownBundle = isMarkdownBundle;
|
|
57
|
-
exports.isTempOrder = isTempOrder;
|
|
58
|
-
exports.mapPaymentItemToOrderPayment = mapPaymentItemToOrderPayment;
|
|
59
|
-
exports.mapPaymentItemsToOrderPayments = mapPaymentItemsToOrderPayments;
|
|
60
|
-
Object.defineProperty(exports, "mergeManualProductDiscountIntoList", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _manualProductDiscount.mergeManualProductDiscountIntoList;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
exports.mergeOrderProductDisplayFields = mergeOrderProductDisplayFields;
|
|
67
|
-
exports.mergeRelationForms = void 0;
|
|
68
|
-
exports.normalizeBookingIsAll = normalizeBookingIsAll;
|
|
69
|
-
exports.normalizeBookingSubType = normalizeBookingSubType;
|
|
70
|
-
exports.normalizeOrderProductDiscountList = normalizeOrderProductDiscountList;
|
|
71
|
-
exports.normalizeProductSkuOptions = normalizeProductSkuOptions;
|
|
72
|
-
exports.normalizeSubmitBooking = normalizeSubmitBooking;
|
|
73
|
-
exports.normalizeSubmitCollectPaxValue = normalizeSubmitCollectPaxValue;
|
|
74
|
-
exports.productRequiresFormSubject = productRequiresFormSubject;
|
|
75
|
-
exports.resolveEffectivePerUnitDiscount = resolveEffectivePerUnitDiscount;
|
|
76
|
-
exports.resolveIsFormSubject = resolveIsFormSubject;
|
|
77
|
-
Object.defineProperty(exports, "resolveManualDiscountMessage", {
|
|
78
|
-
enumerable: true,
|
|
79
|
-
get: function () {
|
|
80
|
-
return _manualProductDiscount.resolveManualDiscountMessage;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(exports, "resolveManualDiscountOriginTotal", {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
get: function () {
|
|
86
|
-
return _manualProductDiscount.resolveManualDiscountOriginTotal;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(exports, "resolveManualDiscountReasonFromSources", {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
get: function () {
|
|
92
|
-
return _manualProductDiscount.resolveManualDiscountReasonFromSources;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
exports.resolveManualOverrideLineOriginalPrice = resolveManualOverrideLineOriginalPrice;
|
|
96
|
-
exports.resolveRulesManualDiscountFlag = resolveRulesManualDiscountFlag;
|
|
97
|
-
Object.defineProperty(exports, "resolveSafeProductNum", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
get: function () {
|
|
100
|
-
return _manualProductDiscount.resolveSafeProductNum;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
exports.resolveSubmitCollectPax = resolveSubmitCollectPax;
|
|
104
|
-
Object.defineProperty(exports, "shouldBuildManualProductDiscount", {
|
|
105
|
-
enumerable: true,
|
|
106
|
-
get: function () {
|
|
107
|
-
return _manualProductDiscount.shouldBuildManualProductDiscount;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
Object.defineProperty(exports, "stripManualProductDiscountItems", {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function () {
|
|
113
|
-
return _manualProductDiscount.stripManualProductDiscountItems;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
exports.sumOptionUnitPrice = sumOptionUnitPrice;
|
|
117
|
-
Object.defineProperty(exports, "syncManualProductDiscountProductNum", {
|
|
118
|
-
enumerable: true,
|
|
119
|
-
get: function () {
|
|
120
|
-
return _manualProductDiscount.syncManualProductDiscountProductNum;
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
121
16
|
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/modules/Order/utils.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
buildManualProductDiscountItem: () => import_manualProductDiscount.buildManualProductDiscountItem,
|
|
33
|
+
buildSubmitPayload: () => buildSubmitPayload,
|
|
34
|
+
calculateOrderProductsDeposit: () => calculateOrderProductsDeposit,
|
|
35
|
+
clearTempOrderHolderAssignments: () => clearTempOrderHolderAssignments,
|
|
36
|
+
composeLinePrice: () => composeLinePrice,
|
|
37
|
+
createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
|
|
38
|
+
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
39
|
+
createEmptySummary: () => import_utils3.createEmptySummary,
|
|
40
|
+
createUuidV4: () => import_orderCollectionIdentity.createUuidV4,
|
|
41
|
+
ensureCartItemOriginHolder: () => ensureCartItemOriginHolder,
|
|
42
|
+
ensureManualProductDiscountList: () => import_manualProductDiscount.ensureManualProductDiscountList,
|
|
43
|
+
ensureProductSku: () => ensureProductSku,
|
|
44
|
+
findManualProductDiscountItem: () => import_manualProductDiscount.findManualProductDiscountItem,
|
|
45
|
+
formatDateTime: () => formatDateTime,
|
|
46
|
+
formatV1Product: () => formatV1Product,
|
|
47
|
+
generateDuration: () => generateDuration,
|
|
48
|
+
getAllDiscountList: () => getAllDiscountList,
|
|
49
|
+
getBundleSellingMagnitude: () => getBundleSellingMagnitude,
|
|
50
|
+
getBundleSignedUnit: () => getBundleSignedUnit,
|
|
51
|
+
getOrderProductLineUid: () => getOrderProductLineUid,
|
|
52
|
+
getProductSkuOptions: () => getProductSkuOptions,
|
|
53
|
+
getRuntimeProductOrigin: () => getRuntimeProductOrigin,
|
|
54
|
+
hasAssignedHolderId: () => hasAssignedHolderId,
|
|
55
|
+
indexOrderProductsByUid: () => indexOrderProductsByUid,
|
|
56
|
+
isEmptyOrderProductDisplayValue: () => isEmptyOrderProductDisplayValue,
|
|
57
|
+
isHolderConfigRequired: () => isHolderConfigRequired,
|
|
58
|
+
isMarkdownBundle: () => isMarkdownBundle,
|
|
59
|
+
isTempOrder: () => isTempOrder,
|
|
60
|
+
mapPaymentItemToOrderPayment: () => mapPaymentItemToOrderPayment,
|
|
61
|
+
mapPaymentItemsToOrderPayments: () => mapPaymentItemsToOrderPayments,
|
|
62
|
+
mergeManualProductDiscountIntoList: () => import_manualProductDiscount.mergeManualProductDiscountIntoList,
|
|
63
|
+
mergeOrderProductDisplayFields: () => mergeOrderProductDisplayFields,
|
|
64
|
+
mergeRelationForms: () => mergeRelationForms,
|
|
65
|
+
normalizeBookingIsAll: () => normalizeBookingIsAll,
|
|
66
|
+
normalizeBookingSubType: () => normalizeBookingSubType,
|
|
67
|
+
normalizeOrderProductDiscountList: () => normalizeOrderProductDiscountList,
|
|
68
|
+
normalizeProductSkuOptions: () => normalizeProductSkuOptions,
|
|
69
|
+
normalizeSubmitBooking: () => normalizeSubmitBooking,
|
|
70
|
+
normalizeSubmitCollectPaxValue: () => normalizeSubmitCollectPaxValue,
|
|
71
|
+
productRequiresFormSubject: () => productRequiresFormSubject,
|
|
72
|
+
resolveEffectivePerUnitDiscount: () => resolveEffectivePerUnitDiscount,
|
|
73
|
+
resolveIsFormSubject: () => resolveIsFormSubject,
|
|
74
|
+
resolveManualDiscountMessage: () => import_manualProductDiscount.resolveManualDiscountMessage,
|
|
75
|
+
resolveManualDiscountOriginTotal: () => import_manualProductDiscount.resolveManualDiscountOriginTotal,
|
|
76
|
+
resolveManualDiscountReasonFromSources: () => import_manualProductDiscount.resolveManualDiscountReasonFromSources,
|
|
77
|
+
resolveManualOverrideLineOriginalPrice: () => resolveManualOverrideLineOriginalPrice,
|
|
78
|
+
resolveRulesManualDiscountFlag: () => resolveRulesManualDiscountFlag,
|
|
79
|
+
resolveSafeProductNum: () => import_manualProductDiscount.resolveSafeProductNum,
|
|
80
|
+
resolveSubmitCollectPax: () => resolveSubmitCollectPax,
|
|
81
|
+
shouldBuildManualProductDiscount: () => import_manualProductDiscount.shouldBuildManualProductDiscount,
|
|
82
|
+
stripManualProductDiscountItems: () => import_manualProductDiscount.stripManualProductDiscountItems,
|
|
83
|
+
sumOptionUnitPrice: () => sumOptionUnitPrice,
|
|
84
|
+
syncManualProductDiscountProductNum: () => import_manualProductDiscount.syncManualProductDiscountProductNum
|
|
122
85
|
});
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
var
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
132
|
-
*
|
|
133
|
-
* 新语义 v2 约定:
|
|
134
|
-
* - `mainPrice` 必须是**已经包含 option 的主商品单价**(即 `metadata.main_product_selling_price`
|
|
135
|
-
* 或 `metadata.main_product_original_price`),option 价格不由本函数叠加。
|
|
136
|
-
* - 套餐价:Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? bundle.quantity ?? 1))
|
|
137
|
-
* 当 `useOriginalBundle=true` 时,改用 `bundle.original_price ?? bundle.product_price ?? bundle.price`。
|
|
138
|
-
* - 返回值:保留 2 位小数的字符串,方便直接写回 `selling_price` / `original_price` 字段。
|
|
139
|
-
*
|
|
140
|
-
* 被 `normalizeOrderProduct`、Rules setProduct 钩子、各 Solution 的 setDiscountSelected 共用,
|
|
141
|
-
* 保证合成逻辑单点来源。
|
|
142
|
-
*/
|
|
86
|
+
module.exports = __toCommonJS(utils_exports);
|
|
87
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
88
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
89
|
+
var import_utils = require("../Holder/utils");
|
|
90
|
+
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
91
|
+
var import_orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
92
|
+
var import_utils3 = require("../../solution/ScanOrder/utils");
|
|
93
|
+
var import_manualProductDiscount = require("./utils/manualProductDiscount");
|
|
143
94
|
function composeLinePrice(params) {
|
|
144
|
-
const {
|
|
145
|
-
|
|
146
|
-
bundle,
|
|
147
|
-
useOriginalBundle
|
|
148
|
-
} = params;
|
|
149
|
-
let total = new _decimal.default(Number(mainPrice) || 0);
|
|
95
|
+
const { mainPrice, bundle, useOriginalBundle } = params;
|
|
96
|
+
let total = new import_decimal.default(Number(mainPrice) || 0);
|
|
150
97
|
if (Array.isArray(bundle)) {
|
|
151
98
|
for (const item of bundle) {
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
const rawNum = item?.num ?? item?.quantity ?? 1;
|
|
157
|
-
const num = new _decimal.default(Number(rawNum) || 0);
|
|
99
|
+
const signedUnit = getBundleSignedUnit(item, { useOriginal: useOriginalBundle });
|
|
100
|
+
const rawNum = (item == null ? void 0 : item.num) ?? (item == null ? void 0 : item.quantity) ?? 1;
|
|
101
|
+
const num = new import_decimal.default(Number(rawNum) || 0);
|
|
158
102
|
total = total.plus(signedUnit.times(num));
|
|
159
103
|
}
|
|
160
104
|
}
|
|
161
105
|
return total.toDecimalPlaces(2).toFixed(2);
|
|
162
106
|
}
|
|
163
107
|
function normalizeProductSkuOptions(options) {
|
|
164
|
-
if (!Array.isArray(options))
|
|
165
|
-
|
|
108
|
+
if (!Array.isArray(options))
|
|
109
|
+
return [];
|
|
110
|
+
return options.map((option) => {
|
|
166
111
|
const normalized = {
|
|
167
|
-
...
|
|
112
|
+
...option && typeof option === "object" ? option : {}
|
|
168
113
|
};
|
|
169
114
|
const addPrice = normalized.add_price ?? normalized.price;
|
|
170
|
-
if (addPrice !==
|
|
115
|
+
if (addPrice !== void 0)
|
|
116
|
+
normalized.add_price = addPrice;
|
|
171
117
|
delete normalized.price;
|
|
172
118
|
return normalized;
|
|
173
119
|
});
|
|
174
120
|
}
|
|
175
121
|
function ensureProductSku(product) {
|
|
176
|
-
const rawSku = product
|
|
122
|
+
const rawSku = (product == null ? void 0 : product.product_sku) && typeof product.product_sku === "object" ? product.product_sku : {};
|
|
177
123
|
return {
|
|
178
124
|
...rawSku,
|
|
179
125
|
option: normalizeProductSkuOptions(rawSku.option)
|
|
@@ -182,25 +128,21 @@ function ensureProductSku(product) {
|
|
|
182
128
|
function getProductSkuOptions(product) {
|
|
183
129
|
return ensureProductSku(product).option;
|
|
184
130
|
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* 计算 option 单价合计:Σ(option.add_price × option.num)。
|
|
188
|
-
* 兼容入参仍带旧 `price` 的调用方,但运行时归一化后只维护 `add_price`。
|
|
189
|
-
* 在新语义 v2 下,main_product_original_price = source_product_price + 本函数结果。
|
|
190
|
-
*/
|
|
191
131
|
function sumOptionUnitPrice(options) {
|
|
192
|
-
let total = new
|
|
193
|
-
if (!Array.isArray(options))
|
|
132
|
+
let total = new import_decimal.default(0);
|
|
133
|
+
if (!Array.isArray(options))
|
|
134
|
+
return total;
|
|
194
135
|
for (const opt of options) {
|
|
195
|
-
const price = new
|
|
196
|
-
const num = new
|
|
136
|
+
const price = new import_decimal.default(Number((opt == null ? void 0 : opt.add_price) ?? (opt == null ? void 0 : opt.price)) || 0);
|
|
137
|
+
const num = new import_decimal.default(Number(opt == null ? void 0 : opt.num) || 0);
|
|
197
138
|
total = total.plus(price.times(num));
|
|
198
139
|
}
|
|
199
140
|
return total;
|
|
200
141
|
}
|
|
201
142
|
function getSafeOrderProductNum(num) {
|
|
202
143
|
const parsedNum = Number(num ?? 1);
|
|
203
|
-
if (!Number.isFinite(parsedNum) || parsedNum < 1)
|
|
144
|
+
if (!Number.isFinite(parsedNum) || parsedNum < 1)
|
|
145
|
+
return 1;
|
|
204
146
|
return Math.floor(parsedNum);
|
|
205
147
|
}
|
|
206
148
|
function getOrderProductDepositUnitTotal(product) {
|
|
@@ -208,57 +150,48 @@ function getOrderProductDepositUnitTotal(product) {
|
|
|
208
150
|
const paymentPrice = metadata.main_product_attached_bundle_payment_price;
|
|
209
151
|
const mainSellingPrice = metadata.main_product_selling_price;
|
|
210
152
|
const fallbackPrice = product.selling_price;
|
|
211
|
-
return new
|
|
153
|
+
return new import_decimal.default(Number(paymentPrice ?? mainSellingPrice ?? fallbackPrice) || 0);
|
|
212
154
|
}
|
|
213
155
|
function normalizeDepositProtocols(protocols) {
|
|
214
|
-
if (!Array.isArray(protocols))
|
|
156
|
+
if (!Array.isArray(protocols))
|
|
157
|
+
return [];
|
|
215
158
|
return protocols.reduce((result, protocol) => {
|
|
216
|
-
const id = Number(protocol
|
|
217
|
-
if (!Number.isFinite(id))
|
|
159
|
+
const id = Number(protocol == null ? void 0 : protocol.id);
|
|
160
|
+
if (!Number.isFinite(id))
|
|
161
|
+
return result;
|
|
218
162
|
result.push({
|
|
219
163
|
id: Math.floor(id),
|
|
220
|
-
title: String(protocol
|
|
164
|
+
title: String((protocol == null ? void 0 : protocol.title) || "")
|
|
221
165
|
});
|
|
222
166
|
return result;
|
|
223
167
|
}, []);
|
|
224
168
|
}
|
|
225
169
|
function getDepositPolicyIds(depositData) {
|
|
226
|
-
const ids = [
|
|
170
|
+
const ids = [
|
|
171
|
+
...Array.isArray(depositData == null ? void 0 : depositData.self_deposit_policy_ids) ? depositData.self_deposit_policy_ids : [],
|
|
172
|
+
...Array.isArray(depositData == null ? void 0 : depositData.deposit_policy_ids) ? depositData.deposit_policy_ids : []
|
|
173
|
+
];
|
|
227
174
|
return ids.reduce((result, id) => {
|
|
228
175
|
const normalizedId = Number(id);
|
|
229
|
-
if (!Number.isFinite(normalizedId))
|
|
176
|
+
if (!Number.isFinite(normalizedId))
|
|
177
|
+
return result;
|
|
230
178
|
result.push(Math.floor(normalizedId));
|
|
231
179
|
return result;
|
|
232
180
|
}, []);
|
|
233
181
|
}
|
|
234
182
|
function handleOrderProductDeposit(params) {
|
|
235
|
-
const {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
result: false,
|
|
242
|
-
depositTotal: new _decimal.default(0)
|
|
243
|
-
};
|
|
244
|
-
const {
|
|
245
|
-
deposit_fixed,
|
|
246
|
-
deposit_percentage
|
|
247
|
-
} = depositData;
|
|
248
|
-
if (typeof deposit_fixed !== 'string' || typeof deposit_percentage !== 'string') {
|
|
249
|
-
return {
|
|
250
|
-
result: false,
|
|
251
|
-
depositTotal: new _decimal.default(0)
|
|
252
|
-
};
|
|
183
|
+
const { depositData, total, num } = params;
|
|
184
|
+
if (!depositData)
|
|
185
|
+
return { result: false, depositTotal: new import_decimal.default(0) };
|
|
186
|
+
const { deposit_fixed, deposit_percentage } = depositData;
|
|
187
|
+
if (typeof deposit_fixed !== "string" || typeof deposit_percentage !== "string") {
|
|
188
|
+
return { result: false, depositTotal: new import_decimal.default(0) };
|
|
253
189
|
}
|
|
254
|
-
const depositFixed = new
|
|
255
|
-
const depositPercent = new
|
|
256
|
-
const productTotalPrice = new
|
|
190
|
+
const depositFixed = new import_decimal.default(deposit_fixed || 0);
|
|
191
|
+
const depositPercent = new import_decimal.default(deposit_percentage || 0);
|
|
192
|
+
const productTotalPrice = new import_decimal.default(total || 0);
|
|
257
193
|
const deposit = depositFixed.plus(depositPercent.times(productTotalPrice));
|
|
258
|
-
return {
|
|
259
|
-
depositTotal: deposit.times(num),
|
|
260
|
-
result: true
|
|
261
|
-
};
|
|
194
|
+
return { depositTotal: deposit.times(num), result: true };
|
|
262
195
|
}
|
|
263
196
|
function resolveOrderProductDepositSource(product, runtimeOrigin) {
|
|
264
197
|
const record = product;
|
|
@@ -275,14 +208,15 @@ function resolveOrderProductDepositSource(product, runtimeOrigin) {
|
|
|
275
208
|
function getOrderProductDeposit(product, runtimeOrigin) {
|
|
276
209
|
const depositProduct = resolveOrderProductDepositSource(product, runtimeOrigin);
|
|
277
210
|
const depositData = depositProduct.custom_deposit_data;
|
|
278
|
-
if (depositData
|
|
211
|
+
if ((depositData == null ? void 0 : depositData.has_deposit) != 1)
|
|
212
|
+
return null;
|
|
279
213
|
const num = getSafeOrderProductNum(product.num);
|
|
280
214
|
const total = getOrderProductDepositUnitTotal(product).times(num);
|
|
281
215
|
const allProtocols = normalizeDepositProtocols(depositData.deposit_policy_data);
|
|
282
216
|
const protocolIds = [];
|
|
283
|
-
let depositTotal = new
|
|
217
|
+
let depositTotal = new import_decimal.default(0);
|
|
284
218
|
let hasDeposit = false;
|
|
285
|
-
if (typeof depositData.deposit_fixed ===
|
|
219
|
+
if (typeof depositData.deposit_fixed === "string" && typeof depositData.deposit_percentage === "string") {
|
|
286
220
|
const result = handleOrderProductDeposit({
|
|
287
221
|
depositData,
|
|
288
222
|
total,
|
|
@@ -298,8 +232,10 @@ function getOrderProductDeposit(product, runtimeOrigin) {
|
|
|
298
232
|
} else {
|
|
299
233
|
const productVariantId = depositProduct.product_variant_id ?? product.product_variant_id;
|
|
300
234
|
if (productVariantId) {
|
|
301
|
-
const variantProduct = (depositProduct.variant || []).find(
|
|
302
|
-
|
|
235
|
+
const variantProduct = (depositProduct.variant || []).find(
|
|
236
|
+
(item) => (item == null ? void 0 : item.id) === productVariantId
|
|
237
|
+
);
|
|
238
|
+
const variantDepositData = variantProduct == null ? void 0 : variantProduct.custom_deposit_data;
|
|
303
239
|
const result = handleOrderProductDeposit({
|
|
304
240
|
depositData: variantDepositData,
|
|
305
241
|
total,
|
|
@@ -308,285 +244,216 @@ function getOrderProductDeposit(product, runtimeOrigin) {
|
|
|
308
244
|
if (result.result) {
|
|
309
245
|
depositTotal = result.depositTotal;
|
|
310
246
|
protocolIds.push(...getDepositPolicyIds({
|
|
311
|
-
self_deposit_policy_ids: variantDepositData
|
|
247
|
+
self_deposit_policy_ids: variantDepositData == null ? void 0 : variantDepositData.self_deposit_policy_ids
|
|
312
248
|
}));
|
|
313
249
|
hasDeposit = true;
|
|
314
250
|
}
|
|
315
251
|
}
|
|
316
252
|
if (Array.isArray(product.product_bundle) && product.product_bundle.length) {
|
|
317
253
|
depositTotal = product.product_bundle.reduce((accumulator, bundleProduct) => {
|
|
318
|
-
const bundleDepositData = bundleProduct
|
|
254
|
+
const bundleDepositData = bundleProduct == null ? void 0 : bundleProduct.custom_deposit_data;
|
|
319
255
|
const result = handleOrderProductDeposit({
|
|
320
256
|
depositData: bundleDepositData,
|
|
321
|
-
total: bundleProduct
|
|
322
|
-
num: getSafeOrderProductNum(bundleProduct
|
|
257
|
+
total: bundleProduct == null ? void 0 : bundleProduct.price,
|
|
258
|
+
num: getSafeOrderProductNum((bundleProduct == null ? void 0 : bundleProduct.num) || 1)
|
|
323
259
|
});
|
|
324
|
-
if (!result.result)
|
|
260
|
+
if (!result.result)
|
|
261
|
+
return accumulator;
|
|
325
262
|
protocolIds.push(...getDepositPolicyIds({
|
|
326
|
-
self_deposit_policy_ids: bundleDepositData
|
|
263
|
+
self_deposit_policy_ids: bundleDepositData == null ? void 0 : bundleDepositData.self_deposit_policy_ids
|
|
327
264
|
}));
|
|
328
265
|
hasDeposit = true;
|
|
329
266
|
return accumulator.plus(result.depositTotal);
|
|
330
|
-
}, new
|
|
267
|
+
}, new import_decimal.default(0));
|
|
331
268
|
}
|
|
332
269
|
}
|
|
333
|
-
if (!hasDeposit)
|
|
270
|
+
if (!hasDeposit)
|
|
271
|
+
return null;
|
|
334
272
|
const protocolIdSet = new Set(protocolIds);
|
|
335
|
-
const protocols = allProtocols.filter(protocol => protocolIdSet.has(protocol.id));
|
|
273
|
+
const protocols = allProtocols.filter((protocol) => protocolIdSet.has(protocol.id));
|
|
336
274
|
return {
|
|
337
275
|
total: depositTotal.toNumber(),
|
|
338
276
|
protocols
|
|
339
277
|
};
|
|
340
278
|
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* 仅基于 tempOrder.products 重算整单定金。
|
|
344
|
-
*
|
|
345
|
-
* 商品折扣在进入定金计算前已体现在商品行价格字段中,
|
|
346
|
-
* 因此这里只按商品定金规则汇总,不再扣减 discount_list;tempOrder.bookings 不参与这里的计算。
|
|
347
|
-
*/
|
|
348
279
|
function calculateOrderProductsDeposit(products = [], options) {
|
|
349
|
-
|
|
350
|
-
|
|
280
|
+
var _a, _b, _c;
|
|
281
|
+
const protocolMap = /* @__PURE__ */ new Map();
|
|
282
|
+
let total = new import_decimal.default(0);
|
|
351
283
|
let hasDeposit = false;
|
|
352
284
|
for (const product of products || []) {
|
|
353
|
-
const productUid = product.metadata
|
|
354
|
-
const runtimeOrigin = productUid ? options
|
|
285
|
+
const productUid = (_a = product.metadata) == null ? void 0 : _a.unique_identification_number;
|
|
286
|
+
const runtimeOrigin = productUid ? (_c = (_b = options == null ? void 0 : options.productsByUid) == null ? void 0 : _b[productUid]) == null ? void 0 : _c.origin : void 0;
|
|
355
287
|
const deposit = getOrderProductDeposit(product, runtimeOrigin);
|
|
356
288
|
product.deposit = deposit;
|
|
357
|
-
if (!deposit
|
|
289
|
+
if (!(deposit == null ? void 0 : deposit.total) || Number(deposit.total) <= 0)
|
|
290
|
+
continue;
|
|
358
291
|
total = total.plus(deposit.total);
|
|
359
292
|
for (const protocol of deposit.protocols || []) {
|
|
360
|
-
if (!protocolMap.has(protocol.id))
|
|
293
|
+
if (!protocolMap.has(protocol.id))
|
|
294
|
+
protocolMap.set(protocol.id, protocol);
|
|
361
295
|
}
|
|
362
296
|
hasDeposit = true;
|
|
363
297
|
}
|
|
364
|
-
const roundedTotal = total.toDecimalPlaces(2,
|
|
298
|
+
const roundedTotal = total.toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP);
|
|
365
299
|
const protocols = [...protocolMap.values()];
|
|
366
300
|
return {
|
|
367
301
|
total: roundedTotal.toNumber(),
|
|
368
302
|
totalText: roundedTotal.toFixed(2),
|
|
369
303
|
protocols,
|
|
370
|
-
deposit_policy_ids: protocols.map(protocol => protocol.id),
|
|
304
|
+
deposit_policy_ids: protocols.map((protocol) => protocol.id),
|
|
371
305
|
hasDeposit
|
|
372
306
|
};
|
|
373
307
|
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* 判定套餐子商品是否为 markdown(减价)类型。
|
|
377
|
-
* 与后端口径一致:price_type='markdown' 且 price_type_ext 非 'product_price'(原价子商品)。
|
|
378
|
-
*/
|
|
379
308
|
function isMarkdownBundle(bundle) {
|
|
380
|
-
if (!bundle || typeof bundle !==
|
|
309
|
+
if (!bundle || typeof bundle !== "object")
|
|
310
|
+
return false;
|
|
381
311
|
const ext = bundle.price_type_ext ?? bundle.custom_price_type_ext;
|
|
382
312
|
const type = bundle.price_type ?? bundle.custom_price_type;
|
|
383
|
-
return type ===
|
|
313
|
+
return type === "markdown" && ext !== "product_price";
|
|
384
314
|
}
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* 套餐子商品对「行价」的带符号单位贡献(与后端 markdown 口径对齐)。
|
|
388
|
-
*
|
|
389
|
-
* - markdown(减价):净额 = |catalog 毛价| − Σ(option.add_price×num),**取负**(行内减)。
|
|
390
|
-
* catalog 毛价优先 `price`/`custom_price`(避免读已落净额的 `bundle_selling_price` 造成 option 二次扣减);
|
|
391
|
-
* 仅当毛价缺失(历史/hydrate 仅剩净额)时退回 `bundle_selling_price`,且此时不再扣 option。
|
|
392
|
-
* - markup(加价)/原价子商品:维持 `+(bundle_selling_price ?? price)`,行为不变。
|
|
393
|
-
*/
|
|
394
315
|
function getBundleSignedUnit(bundle, options) {
|
|
395
|
-
if (!bundle || typeof bundle !==
|
|
396
|
-
|
|
316
|
+
if (!bundle || typeof bundle !== "object")
|
|
317
|
+
return new import_decimal.default(0);
|
|
318
|
+
const useOriginal = (options == null ? void 0 : options.useOriginal) ?? false;
|
|
397
319
|
if (isMarkdownBundle(bundle)) {
|
|
398
320
|
const catalog = useOriginal ? bundle.original_price ?? bundle.product_price ?? bundle.custom_price ?? bundle.base_price ?? bundle.price : bundle.custom_price ?? bundle.product_price ?? bundle.original_price ?? bundle.base_price ?? bundle.price;
|
|
399
|
-
if (catalog !==
|
|
400
|
-
const raw = new
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
if (raw.lt(0)) return raw;
|
|
321
|
+
if (catalog !== void 0 && catalog !== null && catalog !== "") {
|
|
322
|
+
const raw = new import_decimal.default(Number(catalog) || 0);
|
|
323
|
+
if (raw.lt(0))
|
|
324
|
+
return raw;
|
|
404
325
|
return raw.minus(sumOptionUnitPrice(bundle.option)).negated();
|
|
405
326
|
}
|
|
406
|
-
|
|
407
|
-
return new _decimal.default(Number(bundle.bundle_selling_price) || 0).abs().negated();
|
|
327
|
+
return new import_decimal.default(Number(bundle.bundle_selling_price) || 0).abs().negated();
|
|
408
328
|
}
|
|
409
329
|
const rawPrice = useOriginal ? bundle.original_price ?? bundle.product_price ?? bundle.price : bundle.bundle_selling_price ?? bundle.price;
|
|
410
|
-
return new
|
|
330
|
+
return new import_decimal.default(Number(rawPrice) || 0);
|
|
411
331
|
}
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* 套餐子商品 `bundle_selling_price` 的存储净额(正值幅度)。
|
|
415
|
-
* markdown 取净额绝对值(3.70);markup/原价维持原值。
|
|
416
|
-
*/
|
|
417
332
|
function getBundleSellingMagnitude(bundle) {
|
|
418
333
|
return getBundleSignedUnit(bundle).abs();
|
|
419
334
|
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* OrderModule 默认 Rules 钩子工厂。
|
|
423
|
-
*
|
|
424
|
-
* 价格语义约定(订单域,v2 composite 口径):
|
|
425
|
-
* - `selling_price`:券后 **行 composite 单价**
|
|
426
|
-
* = `metadata.main_product_selling_price` + Σ(bundle_selling_price × num)。
|
|
427
|
-
* - `original_price`:券前 **行 composite 单价**
|
|
428
|
-
* = `metadata.main_product_original_price` + Σ(bundle 原价 × num)。
|
|
429
|
-
* - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),不含 option、
|
|
430
|
-
* 不含折扣。**权威源**。
|
|
431
|
-
* - `metadata.main_product_original_price` = source + Σ(option.price × option.num)(含 option、不含折扣)。
|
|
432
|
-
* - `metadata.main_product_selling_price` = main_original − 主商品券 per-unit amount(含 option、含折扣)。
|
|
433
|
-
* - `payment_price`:出站 payload 中为行 composite 已减整单折扣均摊价(无折扣时与 `selling_price` 同义)。
|
|
434
|
-
*
|
|
435
|
-
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
436
|
-
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
437
|
-
* (`metadata.source_product_price`)。Rules 内部 `getProductTotalPrice` /
|
|
438
|
-
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
439
|
-
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
440
|
-
* total(source + option + bundle)对齐。
|
|
441
|
-
* - `setProduct` 反向流程:把 Rules 返回的 source-level `main_product_selling_price` / `price`
|
|
442
|
-
* 加回 Σoptions,重新合成含 option 的 main_product_* 并派生 composite。
|
|
443
|
-
* 优先级:
|
|
444
|
-
* 1. `values.main_product_selling_price`(券应用分支,per-unit 券后 source-level 主价)
|
|
445
|
-
* 2. `values.price`(还原分支 `restoredPrice`、good_pass 归零)
|
|
446
|
-
* 3. `values.total / num`(仅当 Rules 只给出总价时的兜底)
|
|
447
|
-
*
|
|
448
|
-
* 导出为纯函数方便单测直接驱动钩子,不依赖 OrderModule 实例。
|
|
449
|
-
*/
|
|
450
|
-
|
|
451
|
-
/** Rules calcDiscount 用手动价标记;undefined 表示交给 Rules 用 total/origin_total 推断 */
|
|
452
335
|
function resolveRulesManualDiscountFlag(metadata) {
|
|
453
|
-
if (!metadata)
|
|
336
|
+
if (!metadata)
|
|
337
|
+
return void 0;
|
|
454
338
|
if (metadata.is_manual_discount === true || metadata.is_manual_discount === 1) {
|
|
455
339
|
return true;
|
|
456
340
|
}
|
|
457
341
|
const priceOverride = metadata.price_override;
|
|
458
|
-
if (priceOverride !==
|
|
342
|
+
if (priceOverride !== void 0 && priceOverride !== null && priceOverride !== "") {
|
|
459
343
|
return true;
|
|
460
344
|
}
|
|
461
|
-
return
|
|
345
|
+
return void 0;
|
|
462
346
|
}
|
|
463
347
|
function normalizeOrderProductDiscountAmount(amount) {
|
|
464
|
-
if (amount ===
|
|
348
|
+
if (amount === void 0 || amount === null)
|
|
349
|
+
return void 0;
|
|
465
350
|
return String(amount);
|
|
466
351
|
}
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* 商品行折扣只保留后端 OrderProductDiscountItem 协议字段。
|
|
470
|
-
* Rules/券计算过程中的 `_num`、`config` 等运行态字段不应进入 tempOrder 或提交 payload。
|
|
471
|
-
*/
|
|
472
352
|
function normalizeOrderProductDiscountList(discountList) {
|
|
473
|
-
if (!Array.isArray(discountList))
|
|
474
|
-
|
|
353
|
+
if (!Array.isArray(discountList))
|
|
354
|
+
return [];
|
|
355
|
+
return discountList.filter((item) => !!item && typeof item === "object").map((item) => {
|
|
475
356
|
const normalized = {
|
|
476
357
|
discount_id: Number.isFinite(Number(item.discount_id)) ? Number(item.discount_id) : 0
|
|
477
358
|
};
|
|
478
359
|
if (item.order_discount_id === null) {
|
|
479
360
|
normalized.order_discount_id = null;
|
|
480
|
-
} else if (item.order_discount_id !==
|
|
361
|
+
} else if (item.order_discount_id !== void 0) {
|
|
481
362
|
const orderDiscountId = Number(item.order_discount_id);
|
|
482
363
|
if (Number.isFinite(orderDiscountId)) {
|
|
483
364
|
normalized.order_discount_id = orderDiscountId;
|
|
484
365
|
}
|
|
485
366
|
}
|
|
486
|
-
if (item.type !==
|
|
367
|
+
if (item.type !== void 0)
|
|
368
|
+
normalized.type = item.type;
|
|
487
369
|
const amount = normalizeOrderProductDiscountAmount(item.amount);
|
|
488
|
-
if (amount !==
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
};
|
|
370
|
+
if (amount !== void 0)
|
|
371
|
+
normalized.amount = amount;
|
|
372
|
+
if (item.discount && typeof item.discount === "object") {
|
|
373
|
+
normalized.discount = { ...item.discount };
|
|
493
374
|
}
|
|
494
375
|
if (item.metadata === null) {
|
|
495
376
|
normalized.metadata = null;
|
|
496
|
-
} else if (item.metadata && typeof item.metadata ===
|
|
497
|
-
normalized.metadata = {
|
|
498
|
-
...item.metadata
|
|
499
|
-
};
|
|
377
|
+
} else if (item.metadata && typeof item.metadata === "object") {
|
|
378
|
+
normalized.metadata = { ...item.metadata };
|
|
500
379
|
}
|
|
501
380
|
return normalized;
|
|
502
381
|
});
|
|
503
382
|
}
|
|
504
383
|
function resolveSubmitBundleMapId(bundle) {
|
|
505
|
-
|
|
506
|
-
|
|
384
|
+
var _a;
|
|
385
|
+
const metadataMapId = (_a = bundle.metadata) == null ? void 0 : _a.custom_product_bundle_map_id;
|
|
386
|
+
if (metadataMapId !== void 0 && metadataMapId !== null && metadataMapId !== "") {
|
|
507
387
|
return metadataMapId;
|
|
508
388
|
}
|
|
509
|
-
if (bundle._id !==
|
|
389
|
+
if (bundle._id !== void 0 && bundle._id !== null && bundle._id !== "") {
|
|
510
390
|
return bundle._id;
|
|
511
391
|
}
|
|
512
|
-
return
|
|
392
|
+
return void 0;
|
|
513
393
|
}
|
|
514
394
|
function collectSubmitProductDiscountList(product) {
|
|
515
|
-
const submitDiscountList = Array.isArray(product
|
|
516
|
-
for (const bundle of product
|
|
517
|
-
if (!bundle || typeof bundle !==
|
|
395
|
+
const submitDiscountList = Array.isArray(product == null ? void 0 : product.discount_list) ? [...product.discount_list] : [];
|
|
396
|
+
for (const bundle of (product == null ? void 0 : product.product_bundle) || []) {
|
|
397
|
+
if (!bundle || typeof bundle !== "object")
|
|
398
|
+
continue;
|
|
518
399
|
const bundleMapId = resolveSubmitBundleMapId(bundle);
|
|
519
400
|
const bundleDiscountList = Array.isArray(bundle.discount_list) ? bundle.discount_list : [];
|
|
520
401
|
for (const discount of bundleDiscountList) {
|
|
521
|
-
if (!discount || typeof discount !==
|
|
522
|
-
|
|
523
|
-
const
|
|
402
|
+
if (!discount || typeof discount !== "object")
|
|
403
|
+
continue;
|
|
404
|
+
const discountMetadata = discount.metadata && typeof discount.metadata === "object" ? discount.metadata : {};
|
|
405
|
+
const discountMapId = discountMetadata.custom_product_bundle_map_id !== void 0 && discountMetadata.custom_product_bundle_map_id !== null && discountMetadata.custom_product_bundle_map_id !== "" ? discountMetadata.custom_product_bundle_map_id : bundleMapId;
|
|
524
406
|
submitDiscountList.push({
|
|
525
407
|
...discount,
|
|
526
|
-
...
|
|
408
|
+
...discountMapId !== void 0 ? {
|
|
527
409
|
metadata: {
|
|
528
410
|
...discountMetadata,
|
|
529
411
|
custom_product_bundle_map_id: discountMapId
|
|
530
412
|
}
|
|
531
|
-
} : {}
|
|
413
|
+
} : {}
|
|
532
414
|
});
|
|
533
415
|
}
|
|
534
416
|
}
|
|
535
417
|
return normalizeOrderProductDiscountList(submitDiscountList);
|
|
536
418
|
}
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* 手动改价(price_override)时行级 original_price(composite 单价):
|
|
540
|
-
* 购物车划线价应对齐 metadata.origin._extend.origin_total(改价前单价 composite,如 40),
|
|
541
|
-
* 而非 bundle 子项 catalog 原价合成的 composedOriginalPrice(如 30)。
|
|
542
|
-
*
|
|
543
|
-
* origin_total 与 SkuDetailModal / cacheItem._extend 一致,为单价语义,不再除以 num。
|
|
544
|
-
*/
|
|
545
419
|
function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOriginal) {
|
|
420
|
+
var _a, _b;
|
|
546
421
|
const metadata = params.metadata || {};
|
|
547
422
|
const priceOverride = metadata.price_override;
|
|
548
|
-
if (priceOverride ===
|
|
423
|
+
if (priceOverride === void 0 || priceOverride === null || priceOverride === "") {
|
|
549
424
|
return fallbackCompositeOriginal;
|
|
550
425
|
}
|
|
551
|
-
const refTotal = metadata.origin
|
|
552
|
-
if (refTotal !==
|
|
426
|
+
const refTotal = (_b = (_a = metadata.origin) == null ? void 0 : _a._extend) == null ? void 0 : _b.origin_total;
|
|
427
|
+
if (refTotal !== void 0 && refTotal !== null && refTotal !== "") {
|
|
553
428
|
const parsed = Number(refTotal);
|
|
554
429
|
if (Number.isFinite(parsed)) {
|
|
555
|
-
return new
|
|
430
|
+
return new import_decimal.default(parsed).toDecimalPlaces(2).toFixed(2);
|
|
556
431
|
}
|
|
557
432
|
}
|
|
558
433
|
const lineOriginal = params.lineOriginalPrice;
|
|
559
|
-
if (lineOriginal !==
|
|
434
|
+
if (lineOriginal !== void 0 && lineOriginal !== null && lineOriginal !== "") {
|
|
560
435
|
const parsedLine = Number(lineOriginal);
|
|
561
436
|
const parsedFallback = Number(fallbackCompositeOriginal);
|
|
562
437
|
if (Number.isFinite(parsedLine) && Number.isFinite(parsedFallback) && parsedLine > parsedFallback) {
|
|
563
|
-
return new
|
|
438
|
+
return new import_decimal.default(parsedLine).toDecimalPlaces(2).toFixed(2);
|
|
564
439
|
}
|
|
565
440
|
}
|
|
566
441
|
return fallbackCompositeOriginal;
|
|
567
442
|
}
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* 计算商品行「每单位有效折扣」:discount_list 合计 + 被 Rules 剥离但仍 inPromotion 的差额。
|
|
571
|
-
*
|
|
572
|
-
* Rules.calcDiscount 会把 type=promotion 从 discount_list 去掉,但 metadata._promotion 仍保留;
|
|
573
|
-
* applyProductDiscountPrices 必须回读 _promotion,否则抬价/降价都会在第二步被 source 原价覆盖。
|
|
574
|
-
*
|
|
575
|
-
* @example
|
|
576
|
-
* resolveEffectivePerUnitDiscount({ metadata: { _promotion: { inPromotion: true, originalPrice: 1, finalPrice: 5 } }, discount_list: [] });
|
|
577
|
-
* // => -4
|
|
578
|
-
*/
|
|
579
443
|
function resolveEffectivePerUnitDiscount(product) {
|
|
580
|
-
const discountList = Array.isArray(product
|
|
581
|
-
const fromList = discountList.reduce(
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
444
|
+
const discountList = Array.isArray(product == null ? void 0 : product.discount_list) ? product.discount_list : [];
|
|
445
|
+
const fromList = discountList.reduce(
|
|
446
|
+
(sum, discount) => sum + Number((discount == null ? void 0 : discount.amount) || 0),
|
|
447
|
+
0
|
|
448
|
+
);
|
|
449
|
+
const hasPromoDiscountItem = discountList.some((item) => (item == null ? void 0 : item.type) === "promotion");
|
|
450
|
+
if (hasPromoDiscountItem)
|
|
451
|
+
return fromList;
|
|
452
|
+
const metadata = (product == null ? void 0 : product.metadata) || {};
|
|
585
453
|
const promo = metadata._promotion;
|
|
586
|
-
if (promo
|
|
454
|
+
if ((promo == null ? void 0 : promo.inPromotion) !== true)
|
|
455
|
+
return fromList;
|
|
587
456
|
const optionSum = sumOptionUnitPrice(getProductSkuOptions(product)).toNumber();
|
|
588
|
-
|
|
589
|
-
// applyPromotion 写价后、Rules 剥离 promotion discount 的兜底
|
|
590
457
|
if (!discountList.length && metadata.source_product_price != null && metadata.main_product_selling_price != null) {
|
|
591
458
|
const source = Number(metadata.source_product_price);
|
|
592
459
|
const selling = Number(metadata.main_product_selling_price) - optionSum;
|
|
@@ -596,70 +463,77 @@ function resolveEffectivePerUnitDiscount(product) {
|
|
|
596
463
|
}
|
|
597
464
|
const originalPrice = Number(promo.originalPrice);
|
|
598
465
|
const finalPrice = Number(promo.finalPrice);
|
|
599
|
-
if (!Number.isFinite(originalPrice) || !Number.isFinite(finalPrice))
|
|
466
|
+
if (!Number.isFinite(originalPrice) || !Number.isFinite(finalPrice))
|
|
467
|
+
return fromList;
|
|
600
468
|
return fromList + (originalPrice - finalPrice);
|
|
601
469
|
}
|
|
602
470
|
function createDefaultOrderRulesHooks() {
|
|
603
471
|
const toUnitPriceString = (totalLike, num) => {
|
|
604
472
|
const effectiveNum = Number(num) > 0 ? Number(num) : 1;
|
|
605
|
-
return new
|
|
473
|
+
return new import_decimal.default(Number(totalLike) || 0).dividedBy(effectiveNum).toDecimalPlaces(2).toString();
|
|
606
474
|
};
|
|
607
|
-
const getBundleIdentity = bundle => {
|
|
608
|
-
return [
|
|
475
|
+
const getBundleIdentity = (bundle) => {
|
|
476
|
+
return [
|
|
477
|
+
bundle.bundle_id ?? bundle.id ?? "",
|
|
478
|
+
bundle.bundle_product_id ?? bundle._bundle_product_id ?? bundle.product_id ?? "",
|
|
479
|
+
bundle.bundle_variant_id ?? bundle.variant_id ?? bundle.product_variant_id ?? 0,
|
|
480
|
+
bundle.bundle_group_id ?? bundle.group_id ?? ""
|
|
481
|
+
].join("|");
|
|
609
482
|
};
|
|
610
483
|
const mergeRulesBundlePrices = (currentBundle, rulesBundle) => {
|
|
611
|
-
if (!Array.isArray(rulesBundle))
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
484
|
+
if (!Array.isArray(rulesBundle))
|
|
485
|
+
return rulesBundle;
|
|
486
|
+
const currentByIdentity = /* @__PURE__ */ new Map();
|
|
487
|
+
(currentBundle || []).forEach((bundle) => {
|
|
488
|
+
if (!bundle || typeof bundle !== "object")
|
|
489
|
+
return;
|
|
615
490
|
currentByIdentity.set(getBundleIdentity(bundle), bundle);
|
|
616
491
|
});
|
|
617
|
-
return rulesBundle.map(bundle => {
|
|
618
|
-
if (!bundle || typeof bundle !==
|
|
492
|
+
return rulesBundle.map((bundle) => {
|
|
493
|
+
if (!bundle || typeof bundle !== "object")
|
|
494
|
+
return bundle;
|
|
619
495
|
const current = currentByIdentity.get(getBundleIdentity(bundle));
|
|
620
|
-
if (!current)
|
|
496
|
+
if (!current)
|
|
497
|
+
return bundle;
|
|
621
498
|
const bundleWithDisplayFields = {
|
|
622
499
|
...bundle,
|
|
623
|
-
...
|
|
624
|
-
cover: current.cover
|
|
625
|
-
} : {})
|
|
500
|
+
...isEmptyOrderProductDisplayValue(bundle.cover) && !isEmptyOrderProductDisplayValue(current.cover) ? { cover: current.cover } : {}
|
|
626
501
|
};
|
|
627
|
-
const isProductPriceBundle = (bundle.price_type_ext ?? current.price_type_ext) ===
|
|
628
|
-
if (!isProductPriceBundle)
|
|
502
|
+
const isProductPriceBundle = (bundle.price_type_ext ?? current.price_type_ext) === "product_price";
|
|
503
|
+
if (!isProductPriceBundle)
|
|
504
|
+
return bundleWithDisplayFields;
|
|
629
505
|
const sourcePrice = current.price ?? current.custom_price ?? current.original_price ?? current.bundle_selling_price;
|
|
630
506
|
const originalPrice = current.original_price ?? current.product_price ?? current.price ?? current.custom_price ?? sourcePrice;
|
|
631
507
|
return {
|
|
632
508
|
...bundleWithDisplayFields,
|
|
633
|
-
...
|
|
634
|
-
|
|
635
|
-
} : {}
|
|
636
|
-
...(originalPrice !== undefined ? {
|
|
637
|
-
original_price: originalPrice
|
|
638
|
-
} : {}),
|
|
639
|
-
...(current.original_total !== undefined ? {
|
|
640
|
-
original_total: current.original_total
|
|
641
|
-
} : {})
|
|
509
|
+
...sourcePrice !== void 0 ? { price: sourcePrice } : {},
|
|
510
|
+
...originalPrice !== void 0 ? { original_price: originalPrice } : {},
|
|
511
|
+
...current.original_total !== void 0 ? { original_total: current.original_total } : {}
|
|
642
512
|
};
|
|
643
513
|
});
|
|
644
514
|
};
|
|
645
515
|
return {
|
|
646
|
-
getProduct: product => {
|
|
647
|
-
|
|
516
|
+
getProduct: (product) => {
|
|
517
|
+
var _a, _b, _c, _d, _e, _f;
|
|
648
518
|
const metadataAny = product.metadata || {};
|
|
649
519
|
const optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
650
520
|
let sourcePrice;
|
|
651
|
-
if (metadataAny.source_product_price !==
|
|
521
|
+
if (metadataAny.source_product_price !== void 0) {
|
|
652
522
|
sourcePrice = String(metadataAny.source_product_price);
|
|
653
|
-
} else if (metadataAny.main_product_selling_price !==
|
|
654
|
-
sourcePrice = new
|
|
523
|
+
} else if (metadataAny.main_product_selling_price !== void 0) {
|
|
524
|
+
sourcePrice = new import_decimal.default(
|
|
525
|
+
Number(metadataAny.main_product_selling_price) || 0
|
|
526
|
+
).minus(optionSum).toDecimalPlaces(2).toString();
|
|
655
527
|
} else {
|
|
656
528
|
sourcePrice = String(product.selling_price ?? 0);
|
|
657
529
|
}
|
|
658
530
|
let sourceOriginalPrice;
|
|
659
|
-
if (metadataAny.source_product_price !==
|
|
531
|
+
if (metadataAny.source_product_price !== void 0) {
|
|
660
532
|
sourceOriginalPrice = String(metadataAny.source_product_price);
|
|
661
|
-
} else if (metadataAny.main_product_original_price !==
|
|
662
|
-
sourceOriginalPrice = new
|
|
533
|
+
} else if (metadataAny.main_product_original_price !== void 0) {
|
|
534
|
+
sourceOriginalPrice = new import_decimal.default(
|
|
535
|
+
Number(metadataAny.main_product_original_price) || 0
|
|
536
|
+
).minus(optionSum).toDecimalPlaces(2).toString();
|
|
663
537
|
} else {
|
|
664
538
|
sourceOriginalPrice = sourcePrice;
|
|
665
539
|
}
|
|
@@ -669,50 +543,46 @@ function createDefaultOrderRulesHooks() {
|
|
|
669
543
|
// 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
|
|
670
544
|
// 不透明 identity 契约下,normalizeOrderProduct / hydrate 已保证唯一值存在;
|
|
671
545
|
// 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
|
|
672
|
-
_id: product.metadata
|
|
546
|
+
_id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils2.buildProductLineFingerprint)(
|
|
547
|
+
getProductSkuOptions(product),
|
|
548
|
+
product.product_bundle
|
|
549
|
+
)}`,
|
|
673
550
|
// Rules 内部 getProductTotalPrice / getProductOriginTotalPrice 会各自再叠加 bundle + option,
|
|
674
551
|
// 所以这里必须喂 source-level(不含 option、不含 bundle、不含折扣)单价,避免双加 option。
|
|
675
552
|
price: sourcePrice,
|
|
676
553
|
// total / origin_total 使用 composite × num,跟 Rules 内部产出的 total 对齐(含 option + bundle)。
|
|
677
|
-
total: new
|
|
678
|
-
origin_total: new
|
|
554
|
+
total: new import_decimal.default(product.selling_price || 0).times(product.num || 1).toNumber(),
|
|
555
|
+
origin_total: new import_decimal.default(
|
|
556
|
+
product.original_price || product.selling_price || 0
|
|
557
|
+
).times(product.num || 1).toNumber(),
|
|
679
558
|
original_price: sourceOriginalPrice,
|
|
680
559
|
quantity: product.num || 1,
|
|
681
560
|
num: product.num || 1,
|
|
682
561
|
discount_list: product.discount_list || [],
|
|
683
562
|
bundle: product.product_bundle || [],
|
|
684
|
-
booking_id: product.metadata
|
|
563
|
+
booking_id: ((_b = product.metadata) == null ? void 0 : _b.booking_id) || null,
|
|
685
564
|
isClient: false,
|
|
686
565
|
// 勿写死 false:否则 Rules 不会走 total≠origin_total 的手动价推断,
|
|
687
566
|
// 无券时会把 bundle 价还原成 original_price(手动改价套餐会从 20 回到 30)。
|
|
688
567
|
isManualDiscount: resolveRulesManualDiscountFlag(metadataAny),
|
|
689
|
-
holder_id: product.metadata
|
|
690
|
-
startDate: product.metadata
|
|
691
|
-
main_product_selling_price: metadataAny.main_product_selling_price !==
|
|
692
|
-
inPromotion: metadataAny._promotion
|
|
568
|
+
holder_id: (_c = product.metadata) == null ? void 0 : _c.holder_id,
|
|
569
|
+
startDate: ((_d = product.metadata) == null ? void 0 : _d.start_date) || ((_e = product.metadata) == null ? void 0 : _e.startDate),
|
|
570
|
+
main_product_selling_price: metadataAny.main_product_selling_price !== void 0 ? new import_decimal.default(Number(metadataAny.main_product_selling_price) || 0).minus(optionSum).toDecimalPlaces(2).toString() : void 0,
|
|
571
|
+
inPromotion: ((_f = metadataAny._promotion) == null ? void 0 : _f.inPromotion) === true,
|
|
693
572
|
_promotion: metadataAny._promotion
|
|
694
573
|
};
|
|
695
574
|
},
|
|
696
575
|
setProduct: (product, values) => {
|
|
697
576
|
const nextNum = Number(values.quantity ?? product.num ?? 1) || 1;
|
|
698
577
|
const metadataAny = product.metadata || {};
|
|
699
|
-
const existedSource = metadataAny.source_product_price ?? product.selling_price ??
|
|
578
|
+
const existedSource = metadataAny.source_product_price ?? product.selling_price ?? "0";
|
|
700
579
|
const nextOptions = getProductSkuOptions(product);
|
|
701
580
|
const optionSum = sumOptionUnitPrice(nextOptions);
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
const
|
|
707
|
-
|
|
708
|
-
// 券前 source:values.original_price 是 source-level(Rules 层本就不含 option),
|
|
709
|
-
// 缺省时保留现有 source(券前 = 当前 source)。
|
|
710
|
-
const nextSourceOriginalPrice = values.original_price !== undefined ? String(values.original_price) : String(existedSource);
|
|
711
|
-
|
|
712
|
-
// 含 option 的 main_product_*
|
|
713
|
-
const nextMainSellingPrice = new _decimal.default(Number(nextSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
714
|
-
const nextMainOriginalPrice = new _decimal.default(Number(nextSourceOriginalPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
715
|
-
const nextBundle = values.bundle !== undefined ? mergeRulesBundlePrices(product.product_bundle, values.bundle) : product.product_bundle;
|
|
581
|
+
const nextSourceSellingPrice = values.main_product_selling_price !== void 0 ? String(values.main_product_selling_price) : values.price !== void 0 ? String(values.price) : values.total !== void 0 ? toUnitPriceString(values.total, nextNum) : String(existedSource);
|
|
582
|
+
const nextSourceOriginalPrice = values.original_price !== void 0 ? String(values.original_price) : String(existedSource);
|
|
583
|
+
const nextMainSellingPrice = new import_decimal.default(Number(nextSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
584
|
+
const nextMainOriginalPrice = new import_decimal.default(Number(nextSourceOriginalPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
585
|
+
const nextBundle = values.bundle !== void 0 ? mergeRulesBundlePrices(product.product_bundle, values.bundle) : product.product_bundle;
|
|
716
586
|
const composedSellingPrice = composeLinePrice({
|
|
717
587
|
mainPrice: nextMainSellingPrice,
|
|
718
588
|
bundle: nextBundle
|
|
@@ -722,11 +592,10 @@ function createDefaultOrderRulesHooks() {
|
|
|
722
592
|
bundle: nextBundle,
|
|
723
593
|
useOriginalBundle: true
|
|
724
594
|
});
|
|
725
|
-
const finalOriginalPrice = resolveManualOverrideLineOriginalPrice(
|
|
726
|
-
num: nextNum,
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
}, composedOriginalPrice);
|
|
595
|
+
const finalOriginalPrice = resolveManualOverrideLineOriginalPrice(
|
|
596
|
+
{ num: nextNum, metadata: metadataAny, lineOriginalPrice: product.original_price },
|
|
597
|
+
composedOriginalPrice
|
|
598
|
+
);
|
|
730
599
|
return {
|
|
731
600
|
...product,
|
|
732
601
|
selling_price: composedSellingPrice,
|
|
@@ -745,73 +614,47 @@ function createDefaultOrderRulesHooks() {
|
|
|
745
614
|
}
|
|
746
615
|
};
|
|
747
616
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
*/
|
|
754
|
-
const generateDuration = cartItem => {
|
|
755
|
-
const startDate = (0, _dayjs.default)(`${cartItem.start_date} ${cartItem.start_time}`);
|
|
756
|
-
const endDate = (0, _dayjs.default)(`${cartItem.end_date} ${cartItem.end_time}`);
|
|
757
|
-
const duration = endDate.diff(startDate, 'minutes');
|
|
758
|
-
return {
|
|
759
|
-
duration,
|
|
760
|
-
durationType: 'minutes'
|
|
761
|
-
};
|
|
617
|
+
var generateDuration = (cartItem) => {
|
|
618
|
+
const startDate = (0, import_dayjs.default)(`${cartItem.start_date} ${cartItem.start_time}`);
|
|
619
|
+
const endDate = (0, import_dayjs.default)(`${cartItem.end_date} ${cartItem.end_time}`);
|
|
620
|
+
const duration = endDate.diff(startDate, "minutes");
|
|
621
|
+
return { duration, durationType: "minutes" };
|
|
762
622
|
};
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
form_id
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
if (!acc[form_id]) {
|
|
778
|
-
acc[form_id] = {
|
|
779
|
-
form_id,
|
|
780
|
-
form_record_ids: []
|
|
781
|
-
};
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
// 兼容 form_record_id 可能是数组或单个数字
|
|
785
|
-
const ids = Array.isArray(form_record_ids) ? form_record_ids : [form_record_ids];
|
|
786
|
-
// 过滤掉空值(null、undefined等)
|
|
787
|
-
const validIds = ids.filter(id => id != null);
|
|
788
|
-
acc[form_id].form_record_ids.push(...validIds);
|
|
789
|
-
// 去重
|
|
790
|
-
acc[form_id].form_record_ids = [...new Set(acc[form_id].form_record_ids)];
|
|
791
|
-
return acc;
|
|
792
|
-
}, {})).filter(item => item.form_record_ids.length > 0); // 过滤掉没有有效记录的表单
|
|
623
|
+
var mergeRelationForms = (relationForms) => {
|
|
624
|
+
return Object.values(
|
|
625
|
+
relationForms.reduce((acc, cur) => {
|
|
626
|
+
const { form_id, form_record_ids } = cur;
|
|
627
|
+
if (!acc[form_id]) {
|
|
628
|
+
acc[form_id] = { form_id, form_record_ids: [] };
|
|
629
|
+
}
|
|
630
|
+
const ids = Array.isArray(form_record_ids) ? form_record_ids : [form_record_ids];
|
|
631
|
+
const validIds = ids.filter((id) => id != null);
|
|
632
|
+
acc[form_id].form_record_ids.push(...validIds);
|
|
633
|
+
acc[form_id].form_record_ids = [...new Set(acc[form_id].form_record_ids)];
|
|
634
|
+
return acc;
|
|
635
|
+
}, {})
|
|
636
|
+
).filter((item) => item.form_record_ids.length > 0);
|
|
793
637
|
};
|
|
794
|
-
exports.mergeRelationForms = mergeRelationForms;
|
|
795
638
|
function getCustomerIdFromStorage(window) {
|
|
639
|
+
var _a;
|
|
796
640
|
try {
|
|
797
|
-
const customer = JSON.parse(window
|
|
798
|
-
const customerId = Number(customer
|
|
799
|
-
return Number.isFinite(customerId) && customerId > 0 ? customerId :
|
|
641
|
+
const customer = JSON.parse(((_a = window == null ? void 0 : window.getLocalStorage) == null ? void 0 : _a.call(window, "customer")) || "{}");
|
|
642
|
+
const customerId = Number(customer == null ? void 0 : customer.id);
|
|
643
|
+
return Number.isFinite(customerId) && customerId > 0 ? customerId : void 0;
|
|
800
644
|
} catch {
|
|
801
|
-
return
|
|
645
|
+
return void 0;
|
|
802
646
|
}
|
|
803
647
|
}
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
807
|
-
*/
|
|
808
648
|
function ensureCartItemOriginHolder(cartItem, window) {
|
|
809
|
-
|
|
649
|
+
var _a;
|
|
650
|
+
if ((_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.holder) {
|
|
810
651
|
return;
|
|
811
652
|
}
|
|
812
|
-
const holderConfig = (0,
|
|
813
|
-
|
|
814
|
-
|
|
653
|
+
const holderConfig = (0, import_utils.getProductHolderConfig)(
|
|
654
|
+
(cartItem == null ? void 0 : cartItem._productInit) ?? (cartItem == null ? void 0 : cartItem._productOrigin)
|
|
655
|
+
);
|
|
656
|
+
const formRecordId = cartItem == null ? void 0 : cartItem.holder_id;
|
|
657
|
+
if (!(holderConfig == null ? void 0 : holderConfig.resource_id) || formRecordId == null) {
|
|
815
658
|
return;
|
|
816
659
|
}
|
|
817
660
|
cartItem._origin.holder = {
|
|
@@ -820,25 +663,24 @@ function ensureCartItemOriginHolder(cartItem, window) {
|
|
|
820
663
|
form_record: [formRecordId]
|
|
821
664
|
};
|
|
822
665
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
let discountList = cartItem
|
|
826
|
-
(cartItem
|
|
827
|
-
discountList = [...discountList, ...(item
|
|
828
|
-
item.discount_list =
|
|
666
|
+
var getAllDiscountList = (cartItem) => {
|
|
667
|
+
var _a, _b, _c, _d;
|
|
668
|
+
let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
|
|
669
|
+
(((_d = (_c = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.product_bundle) || []).forEach((item) => {
|
|
670
|
+
discountList = [...discountList, ...(item == null ? void 0 : item.discount_list) || []];
|
|
671
|
+
item.discount_list = void 0;
|
|
829
672
|
});
|
|
830
673
|
return discountList;
|
|
831
674
|
};
|
|
832
|
-
|
|
833
|
-
// ─── 以下为从 ScanOrder/utils.ts 迁入的 Order 专属工具函数 ───
|
|
834
|
-
exports.getAllDiscountList = getAllDiscountList;
|
|
835
675
|
function isTempOrder(data) {
|
|
836
|
-
if (!data || typeof data !==
|
|
837
|
-
|
|
676
|
+
if (!data || typeof data !== "object")
|
|
677
|
+
return false;
|
|
678
|
+
if (!Array.isArray(data.products))
|
|
679
|
+
return false;
|
|
838
680
|
return true;
|
|
839
681
|
}
|
|
840
682
|
function formatDateTime(date) {
|
|
841
|
-
const pad = value => value.toString().padStart(2,
|
|
683
|
+
const pad = (value) => value.toString().padStart(2, "0");
|
|
842
684
|
const year = date.getFullYear();
|
|
843
685
|
const month = pad(date.getMonth() + 1);
|
|
844
686
|
const day = pad(date.getDate());
|
|
@@ -848,26 +690,29 @@ function formatDateTime(date) {
|
|
|
848
690
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
849
691
|
}
|
|
850
692
|
function normalizeSubmitPlatform(platform) {
|
|
851
|
-
const value = String(platform ||
|
|
852
|
-
if (!value)
|
|
693
|
+
const value = String(platform || "").trim();
|
|
694
|
+
if (!value)
|
|
695
|
+
return "H5";
|
|
853
696
|
const lower = value.toLowerCase();
|
|
854
|
-
if (lower ===
|
|
855
|
-
|
|
697
|
+
if (lower === "pc")
|
|
698
|
+
return "PC";
|
|
699
|
+
if (lower === "h5")
|
|
700
|
+
return "H5";
|
|
856
701
|
return value;
|
|
857
702
|
}
|
|
858
|
-
|
|
859
|
-
// 后端 checkout 协议字段 option_group_item_id;tempOrder 内部也保持同一字段名。
|
|
860
703
|
function formatSubmitOptionItems(options) {
|
|
861
|
-
if (!Array.isArray(options))
|
|
862
|
-
|
|
704
|
+
if (!Array.isArray(options))
|
|
705
|
+
return [];
|
|
706
|
+
return options.map((d) => {
|
|
863
707
|
const option = {
|
|
864
|
-
...
|
|
865
|
-
num: d
|
|
866
|
-
option_group_item_id: d
|
|
867
|
-
option_group_id: d
|
|
708
|
+
...d && typeof d === "object" ? d : {},
|
|
709
|
+
num: d == null ? void 0 : d.num,
|
|
710
|
+
option_group_item_id: d == null ? void 0 : d.option_group_item_id,
|
|
711
|
+
option_group_id: d == null ? void 0 : d.option_group_id
|
|
868
712
|
};
|
|
869
|
-
const addPrice = d
|
|
870
|
-
if (addPrice !==
|
|
713
|
+
const addPrice = (d == null ? void 0 : d.add_price) ?? (d == null ? void 0 : d.price);
|
|
714
|
+
if (addPrice !== void 0)
|
|
715
|
+
option.add_price = String(addPrice);
|
|
871
716
|
delete option.price;
|
|
872
717
|
return option;
|
|
873
718
|
});
|
|
@@ -878,31 +723,33 @@ function toBundleNumber(value, fallback = 0) {
|
|
|
878
723
|
}
|
|
879
724
|
function toMoneyString(value) {
|
|
880
725
|
const parsed = Number(value);
|
|
881
|
-
if (Number.isFinite(parsed))
|
|
882
|
-
|
|
726
|
+
if (Number.isFinite(parsed))
|
|
727
|
+
return parsed.toFixed(2);
|
|
728
|
+
if (value === null || value === void 0 || value === "")
|
|
729
|
+
return "0.00";
|
|
883
730
|
return String(value);
|
|
884
731
|
}
|
|
885
|
-
|
|
886
|
-
// 出站补齐:只输出后端 checkout 协议字段,运行时/详情展示字段不进入 bundle payload。
|
|
887
732
|
function formatSubmitBundleItems(bundle) {
|
|
888
|
-
if (!Array.isArray(bundle))
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
const
|
|
733
|
+
if (!Array.isArray(bundle))
|
|
734
|
+
return [];
|
|
735
|
+
return bundle.map((b) => {
|
|
736
|
+
const rawBundle = b && typeof b === "object" ? b : {};
|
|
737
|
+
const existedMetadata = rawBundle.metadata && typeof rawBundle.metadata === "object" ? rawBundle.metadata : {};
|
|
892
738
|
const {
|
|
893
739
|
custom_product_bundle_map_id: _customProductBundleMapId,
|
|
894
740
|
...submitMetadata
|
|
895
741
|
} = existedMetadata;
|
|
896
|
-
|
|
897
|
-
// bundle_selling_price 出站存「正净额」:markdown 为 |price| − Σoptions(如 3.70),
|
|
898
|
-
// markup/原价维持原值;与后端口径一致(price 仍为毛价)。
|
|
899
742
|
const sellingPrice = getBundleSellingMagnitude(rawBundle).toFixed(2);
|
|
900
|
-
|
|
901
|
-
const paymentPrice = rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
|
|
743
|
+
const paymentPrice = rawBundle.bundle_payment_price !== void 0 && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== "" ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
|
|
902
744
|
const priceValue = rawBundle.price ?? rawBundle.custom_price ?? rawBundle.bundle_selling_price;
|
|
903
745
|
const relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
|
|
904
|
-
const surchargeFee = toMoneyString(
|
|
905
|
-
|
|
746
|
+
const surchargeFee = toMoneyString(
|
|
747
|
+
rawBundle.surcharge_fee ?? existedMetadata.surcharge_fee
|
|
748
|
+
);
|
|
749
|
+
const productDiscountDifference = toBundleNumber(
|
|
750
|
+
existedMetadata.product_discount_difference,
|
|
751
|
+
0
|
|
752
|
+
);
|
|
906
753
|
const num = toBundleNumber(rawBundle.num ?? rawBundle.quantity, 1);
|
|
907
754
|
const bundleMapId = resolveSubmitBundleMapId(rawBundle);
|
|
908
755
|
const hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
|
|
@@ -912,22 +759,20 @@ function formatSubmitBundleItems(bundle) {
|
|
|
912
759
|
num,
|
|
913
760
|
quantity: toBundleNumber(rawBundle.quantity ?? rawBundle.num, num),
|
|
914
761
|
extension_id: rawBundle.extension_id ?? 0,
|
|
915
|
-
extension_type: rawBundle.extension_type ??
|
|
762
|
+
extension_type: rawBundle.extension_type ?? "normal",
|
|
916
763
|
price: priceValue,
|
|
917
|
-
price_type: rawBundle.price_type ?? rawBundle.custom_price_type ??
|
|
918
|
-
price_type_ext: rawBundle.price_type_ext ?? rawBundle.custom_price_type_ext ??
|
|
764
|
+
price_type: rawBundle.price_type ?? rawBundle.custom_price_type ?? "",
|
|
765
|
+
price_type_ext: rawBundle.price_type_ext ?? rawBundle.custom_price_type_ext ?? "",
|
|
919
766
|
bundle_selling_price: sellingPrice,
|
|
920
767
|
bundle_payment_price: paymentPrice,
|
|
921
768
|
option: formatSubmitOptionItems(rawBundle.option),
|
|
922
|
-
bundle_group_id: rawBundle
|
|
923
|
-
bundle_id: rawBundle
|
|
924
|
-
bundle_product_id: rawBundle
|
|
769
|
+
bundle_group_id: (rawBundle == null ? void 0 : rawBundle.bundle_group_id) ?? (rawBundle == null ? void 0 : rawBundle.group_id),
|
|
770
|
+
bundle_id: (rawBundle == null ? void 0 : rawBundle.bundle_id) ?? (rawBundle == null ? void 0 : rawBundle.id),
|
|
771
|
+
bundle_product_id: (rawBundle == null ? void 0 : rawBundle.bundle_product_id) ?? (rawBundle == null ? void 0 : rawBundle._bundle_product_id),
|
|
925
772
|
cover: rawBundle.cover,
|
|
926
773
|
metadata: {
|
|
927
774
|
...submitMetadata,
|
|
928
|
-
...
|
|
929
|
-
custom_product_bundle_map_id: bundleMapId
|
|
930
|
-
} : {}),
|
|
775
|
+
...hasSubmitBundleDiscounts && bundleMapId !== void 0 ? { custom_product_bundle_map_id: bundleMapId } : {},
|
|
931
776
|
surcharge_fee: surchargeFee,
|
|
932
777
|
relation_surcharge_ids: relationSurchargeIds,
|
|
933
778
|
product_discount_difference: productDiscountDifference
|
|
@@ -935,28 +780,9 @@ function formatSubmitBundleItems(bundle) {
|
|
|
935
780
|
};
|
|
936
781
|
});
|
|
937
782
|
}
|
|
938
|
-
|
|
939
|
-
/**
|
|
940
|
-
* 把 tempOrder product 打包成出站 submit payload。
|
|
941
|
-
*
|
|
942
|
-
* 价格字段语义(出站口径,v2 composite):
|
|
943
|
-
* - `selling_price`:**行 composite 券后单价**
|
|
944
|
-
* = `metadata.main_product_selling_price` + Σ(bundle_selling_price × num)。
|
|
945
|
-
* - `original_price`:**行 composite 券前单价**
|
|
946
|
-
* = `metadata.main_product_original_price` + Σ(bundle 原价 × num)。
|
|
947
|
-
* - `payment_price`:兼容后端的出站字段,行 composite 已减整单折扣均摊(无折扣时与 `selling_price` 同义)。
|
|
948
|
-
* - `metadata.source_product_price`:主商品/variant 基础价(不含 option、不含折扣),权威源。
|
|
949
|
-
* - `metadata.main_product_original_price`:含 option、不含折扣。
|
|
950
|
-
* - `metadata.main_product_selling_price`:含 option、含主商品折扣。
|
|
951
|
-
* - `metadata.price_schema_version`:schema 版本号(当前 = 2),用于跨端协商价格口径。
|
|
952
|
-
*
|
|
953
|
-
* 本函数不再改造价格字段形状,仅做字段/metadata 裁剪。
|
|
954
|
-
*/
|
|
955
783
|
function normalizeSubmitProduct(product) {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
...submitProduct
|
|
959
|
-
} = product;
|
|
784
|
+
var _a;
|
|
785
|
+
const { unique_identification_number: _runtimeUid, ...submitProduct } = product;
|
|
960
786
|
const {
|
|
961
787
|
num,
|
|
962
788
|
surcharge_fee: _productSurchargeFee,
|
|
@@ -967,38 +793,51 @@ function normalizeSubmitProduct(product) {
|
|
|
967
793
|
discount_per: _deprecatedDiscountPer,
|
|
968
794
|
...productRest
|
|
969
795
|
} = submitProduct;
|
|
970
|
-
delete productRest[`product_${
|
|
796
|
+
delete productRest[`product_${"option"}_item`];
|
|
971
797
|
const rawMetadata = submitProduct.metadata || {};
|
|
972
798
|
const bookingUid = rawMetadata.booking_uid;
|
|
973
799
|
const cleanMetadata = {};
|
|
974
800
|
if (rawMetadata.unique_identification_number) {
|
|
975
801
|
cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
|
|
976
802
|
}
|
|
977
|
-
const priceMetaKeys = [
|
|
803
|
+
const priceMetaKeys = [
|
|
804
|
+
"main_product_original_price",
|
|
805
|
+
"main_product_selling_price",
|
|
806
|
+
"main_product_attached_bundle_selling_price",
|
|
807
|
+
"main_product_attached_bundle_payment_price",
|
|
808
|
+
"average_discount_amount_rate",
|
|
809
|
+
"source_product_price",
|
|
810
|
+
"main_product_attached_bundle_surcharge_fee",
|
|
811
|
+
"main_product_attached_bundle_tax_fee",
|
|
812
|
+
"surcharge_rounding_remainder",
|
|
813
|
+
"tax_fee_rounding_remainder",
|
|
814
|
+
"relation_surcharge_ids",
|
|
815
|
+
"discountable_flag",
|
|
816
|
+
"parent_unique_identification_number",
|
|
817
|
+
"product_add_schedule_time"
|
|
818
|
+
];
|
|
978
819
|
for (const key of priceMetaKeys) {
|
|
979
|
-
if (rawMetadata[key] !==
|
|
820
|
+
if (rawMetadata[key] !== void 0) {
|
|
980
821
|
cleanMetadata[key] = rawMetadata[key];
|
|
981
822
|
}
|
|
982
823
|
}
|
|
983
|
-
cleanMetadata.product_discount_difference = rawMetadata.product_discount_difference ??
|
|
824
|
+
cleanMetadata.product_discount_difference = rawMetadata.product_discount_difference ?? "";
|
|
984
825
|
if (rawMetadata.price_breakdown) {
|
|
985
826
|
cleanMetadata.price_breakdown = rawMetadata.price_breakdown;
|
|
986
827
|
}
|
|
987
|
-
if (rawMetadata.is_rule !==
|
|
828
|
+
if (rawMetadata.is_rule !== void 0) {
|
|
988
829
|
cleanMetadata.is_rule = rawMetadata.is_rule;
|
|
989
830
|
}
|
|
990
|
-
if (rawMetadata.holder_config !==
|
|
831
|
+
if (rawMetadata.holder_config !== void 0) {
|
|
991
832
|
cleanMetadata.holder_config = rawMetadata.holder_config;
|
|
992
833
|
}
|
|
993
834
|
const productSku = {
|
|
994
|
-
...
|
|
995
|
-
option: formatSubmitOptionItems(submitProduct.product_sku
|
|
835
|
+
...submitProduct.product_sku && typeof submitProduct.product_sku === "object" ? submitProduct.product_sku : {},
|
|
836
|
+
option: formatSubmitOptionItems((_a = submitProduct.product_sku) == null ? void 0 : _a.option)
|
|
996
837
|
};
|
|
997
838
|
return {
|
|
998
839
|
...productRest,
|
|
999
|
-
...
|
|
1000
|
-
booking_uid: bookingUid
|
|
1001
|
-
} : {}),
|
|
840
|
+
...bookingUid ? { booking_uid: bookingUid } : {},
|
|
1002
841
|
product_quantity: toBundleNumber(num ?? submitProduct.product_quantity, 1),
|
|
1003
842
|
product_sku: productSku,
|
|
1004
843
|
discount_list: collectSubmitProductDiscountList(submitProduct),
|
|
@@ -1009,98 +848,90 @@ function normalizeSubmitProduct(product) {
|
|
|
1009
848
|
payment_price: submitProduct.payment_price ?? submitProduct.selling_price
|
|
1010
849
|
};
|
|
1011
850
|
}
|
|
1012
|
-
|
|
851
|
+
var SUBMIT_BOOKING_METADATA_WHITELIST = [
|
|
852
|
+
"unique_identification_number",
|
|
853
|
+
"collect_pax",
|
|
854
|
+
"capacity",
|
|
855
|
+
"holder_id",
|
|
856
|
+
"resource_select_type",
|
|
857
|
+
"holder"
|
|
858
|
+
];
|
|
1013
859
|
function normalizeBookingIsAll(booking) {
|
|
1014
|
-
return booking.is_all === true || booking.is_all === 1 || booking.is_all ===
|
|
860
|
+
return booking.is_all === true || booking.is_all === 1 || booking.is_all === "1" || booking.is_all === "true" ? 1 : 0;
|
|
1015
861
|
}
|
|
1016
862
|
function normalizeBookingSubType(booking) {
|
|
1017
|
-
if (normalizeBookingIsAll(booking) === 1)
|
|
1018
|
-
|
|
863
|
+
if (normalizeBookingIsAll(booking) === 1)
|
|
864
|
+
return "days";
|
|
865
|
+
if (booking.sub_type !== void 0 && booking.sub_type !== null && booking.sub_type !== "") {
|
|
1019
866
|
return String(booking.sub_type);
|
|
1020
867
|
}
|
|
1021
|
-
return
|
|
868
|
+
return "minutes";
|
|
1022
869
|
}
|
|
1023
870
|
function normalizeSubmitBooking(booking) {
|
|
1024
871
|
const rawMetadata = booking.metadata || {};
|
|
1025
872
|
const cleanMetadata = {};
|
|
1026
873
|
for (const key of SUBMIT_BOOKING_METADATA_WHITELIST) {
|
|
1027
|
-
if (rawMetadata[key] !==
|
|
874
|
+
if (rawMetadata[key] !== void 0) {
|
|
1028
875
|
cleanMetadata[key] = rawMetadata[key];
|
|
1029
876
|
}
|
|
1030
877
|
}
|
|
1031
|
-
if (cleanMetadata.holder_id ===
|
|
878
|
+
if (cleanMetadata.holder_id === void 0)
|
|
879
|
+
cleanMetadata.holder_id = null;
|
|
1032
880
|
const bookingRecord = booking;
|
|
1033
881
|
const startDate = bookingRecord.start_date;
|
|
1034
|
-
const shouldRestoreSelectDate = bookingRecord.select_date ===
|
|
1035
|
-
const selectDateFromStartDate = typeof startDate ===
|
|
882
|
+
const shouldRestoreSelectDate = bookingRecord.select_date === void 0 || bookingRecord.select_date === null || bookingRecord.select_date === "";
|
|
883
|
+
const selectDateFromStartDate = typeof startDate === "string" ? startDate.split(/\s+/)[0] : startDate;
|
|
1036
884
|
return {
|
|
1037
885
|
...booking,
|
|
1038
|
-
...
|
|
1039
|
-
select_date: selectDateFromStartDate
|
|
1040
|
-
} : {}),
|
|
886
|
+
...shouldRestoreSelectDate && selectDateFromStartDate ? { select_date: selectDateFromStartDate } : {},
|
|
1041
887
|
is_all: normalizeBookingIsAll(bookingRecord),
|
|
1042
888
|
sub_type: normalizeBookingSubType(bookingRecord),
|
|
1043
889
|
metadata: cleanMetadata
|
|
1044
890
|
};
|
|
1045
891
|
}
|
|
1046
|
-
const DEFAULT_TABLE_OCCUPANCY_DURATION = 20;
|
|
1047
|
-
function resolveTableOccupancyDuration(tempOrder) {
|
|
1048
|
-
const metadata = tempOrder.metadata || {};
|
|
1049
|
-
const candidates = [metadata.table_occupancy_duration, metadata.booking_duration, metadata.table_duration, metadata.duration, metadata.table_config?.occupancy_duration, metadata.tableConfig?.occupancy_duration, metadata.resource_config?.occupancy_duration, metadata.resourceConfig?.occupancy_duration];
|
|
1050
|
-
for (const value of candidates) {
|
|
1051
|
-
const duration = Number(value);
|
|
1052
|
-
if (Number.isFinite(duration) && duration > 0) {
|
|
1053
|
-
return Math.floor(duration);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
return DEFAULT_TABLE_OCCUPANCY_DURATION;
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
/** 提交用人数:有限且为正则向下取整,否则为 1 */
|
|
1060
892
|
function normalizeSubmitCollectPaxValue(value) {
|
|
1061
893
|
const n = Number(value);
|
|
1062
894
|
return Number.isFinite(n) && n > 0 ? Math.floor(n) : 1;
|
|
1063
895
|
}
|
|
1064
|
-
|
|
1065
|
-
/** 从临时订单 metadata 解析合成 booking 的 collect_pax */
|
|
1066
896
|
function resolveSubmitCollectPax(tempOrder) {
|
|
1067
|
-
|
|
897
|
+
var _a;
|
|
898
|
+
return normalizeSubmitCollectPaxValue((_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax);
|
|
1068
899
|
}
|
|
1069
900
|
function createDefaultTempOrder(params) {
|
|
1070
901
|
return {
|
|
1071
902
|
order_id: null,
|
|
1072
|
-
external_sale_number:
|
|
903
|
+
external_sale_number: "",
|
|
1073
904
|
order_number: null,
|
|
1074
905
|
shop_order_number: null,
|
|
1075
906
|
shop_full_order_number: null,
|
|
1076
|
-
type:
|
|
1077
|
-
business_code:
|
|
1078
|
-
platform:
|
|
1079
|
-
sales_channel:
|
|
1080
|
-
order_sales_channel:
|
|
1081
|
-
status:
|
|
1082
|
-
payment_status:
|
|
1083
|
-
shipping_status:
|
|
907
|
+
type: "",
|
|
908
|
+
business_code: void 0,
|
|
909
|
+
platform: "h5",
|
|
910
|
+
sales_channel: "my_pisel",
|
|
911
|
+
order_sales_channel: "online_store",
|
|
912
|
+
status: "normal",
|
|
913
|
+
payment_status: "payment_processing",
|
|
914
|
+
shipping_status: "unfulfilled",
|
|
1084
915
|
customer_id: 0,
|
|
1085
|
-
customer_name:
|
|
1086
|
-
country_calling_code:
|
|
1087
|
-
phone:
|
|
1088
|
-
email:
|
|
916
|
+
customer_name: "",
|
|
917
|
+
country_calling_code: "",
|
|
918
|
+
phone: "",
|
|
919
|
+
email: "",
|
|
1089
920
|
customer: null,
|
|
1090
921
|
is_price_include_tax: 1,
|
|
1091
|
-
tax_title:
|
|
1092
|
-
tax_country_code:
|
|
1093
|
-
currency_code:
|
|
1094
|
-
currency_symbol:
|
|
1095
|
-
currency_format:
|
|
922
|
+
tax_title: "",
|
|
923
|
+
tax_country_code: "",
|
|
924
|
+
currency_code: "",
|
|
925
|
+
currency_symbol: "",
|
|
926
|
+
currency_format: "symbol_first",
|
|
1096
927
|
is_deposit: 0,
|
|
1097
|
-
deposit_amount:
|
|
1098
|
-
shop_discount:
|
|
1099
|
-
surcharge_fee:
|
|
1100
|
-
note:
|
|
928
|
+
deposit_amount: "0.00",
|
|
929
|
+
shop_discount: "0.00",
|
|
930
|
+
surcharge_fee: "0.00",
|
|
931
|
+
note: "",
|
|
1101
932
|
schedule_date: params.now,
|
|
1102
|
-
created_at:
|
|
1103
|
-
request_unique_idempotency_token:
|
|
933
|
+
created_at: void 0,
|
|
934
|
+
request_unique_idempotency_token: "",
|
|
1104
935
|
vouchers: [],
|
|
1105
936
|
products: [],
|
|
1106
937
|
bookings: [],
|
|
@@ -1117,10 +948,11 @@ function createDefaultTempOrder(params) {
|
|
|
1117
948
|
};
|
|
1118
949
|
}
|
|
1119
950
|
function buildSubmitPayload(params) {
|
|
951
|
+
var _a;
|
|
1120
952
|
const {
|
|
1121
953
|
tempOrder,
|
|
1122
954
|
cacheId,
|
|
1123
|
-
now = new Date(),
|
|
955
|
+
now = /* @__PURE__ */ new Date(),
|
|
1124
956
|
platform,
|
|
1125
957
|
businessCode,
|
|
1126
958
|
channel,
|
|
@@ -1129,9 +961,9 @@ function buildSubmitPayload(params) {
|
|
|
1129
961
|
enhance
|
|
1130
962
|
} = params;
|
|
1131
963
|
const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
1132
|
-
const bookingUuid = (0,
|
|
964
|
+
const bookingUuid = (0, import_orderCollectionIdentity.createUuidV4)();
|
|
1133
965
|
const {
|
|
1134
|
-
_extend
|
|
966
|
+
_extend,
|
|
1135
967
|
relation_id: _relationId,
|
|
1136
968
|
table_form_id: _tableFormId,
|
|
1137
969
|
resource_id: _resourceId,
|
|
@@ -1153,64 +985,62 @@ function buildSubmitPayload(params) {
|
|
|
1153
985
|
} = tempOrder;
|
|
1154
986
|
let submitType = type ?? tempOrder.type;
|
|
1155
987
|
if (!submitType) {
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
submitType = 'appointment_booking';
|
|
988
|
+
if ((_a = tempOrder == null ? void 0 : tempOrder.bookings) == null ? void 0 : _a.length) {
|
|
989
|
+
submitType = "appointment_booking";
|
|
1159
990
|
} else {
|
|
1160
|
-
submitType =
|
|
991
|
+
submitType = "virtual";
|
|
1161
992
|
}
|
|
1162
993
|
}
|
|
1163
994
|
const payload = {
|
|
1164
995
|
...tempOrderRest,
|
|
1165
996
|
customer_id: tempOrder.customer_id ?? 1,
|
|
1166
|
-
customer_name: tempOrder.customer_name ||
|
|
997
|
+
customer_name: tempOrder.customer_name || "Walk-In",
|
|
1167
998
|
order_number: tempOrder.order_number ?? null,
|
|
1168
999
|
shop_order_number: tempOrder.shop_order_number ?? null,
|
|
1169
1000
|
shop_full_order_number: tempOrder.shop_full_order_number ?? null,
|
|
1170
1001
|
platform: normalizeSubmitPlatform(platform),
|
|
1171
|
-
request_unique_idempotency_token: params
|
|
1002
|
+
request_unique_idempotency_token: (params == null ? void 0 : params.request_unique_idempotency_token) || tempOrder.request_unique_idempotency_token || `${tempOrder.external_sale_number}_${now.getTime()}`,
|
|
1172
1003
|
type: submitType,
|
|
1173
1004
|
business_code: businessCode ?? tempOrder.business_code,
|
|
1174
|
-
sales_channel: tempOrder.sales_channel ||
|
|
1175
|
-
order_sales_channel: channel ?? tempOrder.order_sales_channel ??
|
|
1176
|
-
status: tempOrder.status ||
|
|
1177
|
-
payment_status: tempOrder.payment_status ||
|
|
1005
|
+
sales_channel: tempOrder.sales_channel || "my_pisel",
|
|
1006
|
+
order_sales_channel: channel ?? tempOrder.order_sales_channel ?? "online_store",
|
|
1007
|
+
status: tempOrder.status || "normal",
|
|
1008
|
+
payment_status: tempOrder.payment_status || "payment_processing",
|
|
1178
1009
|
// shipping_status: tempOrder.shipping_status || 'unfulfilled',
|
|
1179
1010
|
is_price_include_tax: tempOrder.is_price_include_tax ?? 1,
|
|
1180
|
-
currency_format: tempOrder.currency_format ||
|
|
1011
|
+
currency_format: tempOrder.currency_format || "symbol_first",
|
|
1181
1012
|
is_deposit: tempOrder.is_deposit ?? 0,
|
|
1182
|
-
deposit_amount: tempOrder.deposit_amount ||
|
|
1183
|
-
shop_discount: tempOrder.shop_discount ||
|
|
1184
|
-
surcharge_fee: tempOrder.surcharge_fee ||
|
|
1185
|
-
note: tempOrder.note ||
|
|
1186
|
-
delivery_type: tempOrder.delivery_type ||
|
|
1013
|
+
deposit_amount: tempOrder.deposit_amount || "0.00",
|
|
1014
|
+
shop_discount: tempOrder.shop_discount || "0.00",
|
|
1015
|
+
surcharge_fee: tempOrder.surcharge_fee || "0.00",
|
|
1016
|
+
note: tempOrder.note || "",
|
|
1017
|
+
delivery_type: tempOrder.delivery_type || "nil",
|
|
1187
1018
|
schedule_date: scheduleDate,
|
|
1188
1019
|
// created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
|
|
1189
|
-
bookings: (tempOrder.bookings || []).filter(
|
|
1020
|
+
bookings: (tempOrder.bookings || []).filter(
|
|
1021
|
+
(booking) => Number(booking.parent_id) !== 0
|
|
1022
|
+
).map((booking) => normalizeSubmitBooking(booking)),
|
|
1190
1023
|
payments: tempOrder.payments || [],
|
|
1191
1024
|
relation_forms: tempOrder.relation_forms || [],
|
|
1192
1025
|
// contacts: tempOrder.contacts || [],
|
|
1193
1026
|
contacts_info: tempOrder.contacts_info && !Array.isArray(tempOrder.contacts_info) ? tempOrder.contacts_info : null,
|
|
1194
1027
|
// holder: tempOrder.holder || null,
|
|
1195
|
-
summary: summary || tempOrder.summary || (0,
|
|
1028
|
+
summary: summary || tempOrder.summary || (0, import_utils2.createEmptySummary)(),
|
|
1196
1029
|
metadata: (() => {
|
|
1197
1030
|
const {
|
|
1198
1031
|
collect_pax: _collectPax,
|
|
1199
1032
|
table_occupancy_duration: _tableOccupancyDuration,
|
|
1200
1033
|
...rest
|
|
1201
1034
|
} = tempOrder.metadata || {};
|
|
1202
|
-
return {
|
|
1203
|
-
...rest
|
|
1204
|
-
};
|
|
1035
|
+
return { ...rest };
|
|
1205
1036
|
})(),
|
|
1206
|
-
products: (tempOrder.products || []).map(
|
|
1037
|
+
products: (tempOrder.products || []).map(
|
|
1038
|
+
(product) => normalizeSubmitProduct(product)
|
|
1039
|
+
)
|
|
1207
1040
|
};
|
|
1208
|
-
if (!enhance)
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
bookingUuid,
|
|
1212
|
-
now
|
|
1213
|
-
});
|
|
1041
|
+
if (!enhance)
|
|
1042
|
+
return payload;
|
|
1043
|
+
const enhancedPayload = enhance(payload, { tempOrder, bookingUuid, now });
|
|
1214
1044
|
return {
|
|
1215
1045
|
...enhancedPayload,
|
|
1216
1046
|
summary: enhancedPayload.summary ?? payload.summary
|
|
@@ -1219,244 +1049,200 @@ function buildSubmitPayload(params) {
|
|
|
1219
1049
|
function mapPaymentItemToOrderPayment(paymentItem) {
|
|
1220
1050
|
const item = paymentItem;
|
|
1221
1051
|
const customPaymentId = item.custom_payment_id ?? item.id;
|
|
1222
|
-
const metadata = item.metadata && typeof item.metadata ===
|
|
1223
|
-
...item.metadata
|
|
1224
|
-
} : {};
|
|
1052
|
+
const metadata = item.metadata && typeof item.metadata === "object" ? { ...item.metadata } : {};
|
|
1225
1053
|
if (item.uuid && !metadata.unique_payment_number) {
|
|
1226
1054
|
metadata.unique_payment_number = String(item.uuid);
|
|
1227
1055
|
}
|
|
1228
|
-
const paymentMetadataKeys = [
|
|
1056
|
+
const paymentMetadataKeys = [
|
|
1057
|
+
"rounding_rule",
|
|
1058
|
+
"shop_wallet_pass_id",
|
|
1059
|
+
"actual_paid_amount",
|
|
1060
|
+
"change_given_amount"
|
|
1061
|
+
];
|
|
1229
1062
|
for (const key of paymentMetadataKeys) {
|
|
1230
|
-
if (item[key] !==
|
|
1063
|
+
if (item[key] !== void 0 && metadata[key] === void 0) {
|
|
1231
1064
|
metadata[key] = item[key];
|
|
1232
1065
|
}
|
|
1233
1066
|
}
|
|
1234
|
-
const timestamp = (0,
|
|
1067
|
+
const timestamp = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
1235
1068
|
const paymentTime = item.payment_time ?? timestamp;
|
|
1236
1069
|
const createdAt = item.created_at ?? timestamp;
|
|
1237
1070
|
return {
|
|
1238
|
-
...
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
amount: String(item.amount ?? '0.00'),
|
|
1242
|
-
code: String(item.code || ''),
|
|
1071
|
+
...item.order_payment_id !== void 0 ? { order_payment_id: item.order_payment_id } : {},
|
|
1072
|
+
amount: String(item.amount ?? "0.00"),
|
|
1073
|
+
code: String(item.code || ""),
|
|
1243
1074
|
custom_payment_id: Number(customPaymentId ?? 0),
|
|
1244
|
-
...
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
...
|
|
1250
|
-
|
|
1251
|
-
} : {}),
|
|
1252
|
-
...(item.origin_amount !== undefined ? {
|
|
1253
|
-
origin_amount: String(item.origin_amount)
|
|
1254
|
-
} : {}),
|
|
1255
|
-
...(item.service_fee !== undefined ? {
|
|
1256
|
-
service_fee: String(item.service_fee)
|
|
1257
|
-
} : {}),
|
|
1258
|
-
...(item.status !== undefined ? {
|
|
1259
|
-
status: item.status
|
|
1260
|
-
} : {}),
|
|
1075
|
+
...item.custom_payment_type !== void 0 ? { custom_payment_type: String(item.custom_payment_type) } : {},
|
|
1076
|
+
name: String(item.name || ""),
|
|
1077
|
+
type: String(item.type || ""),
|
|
1078
|
+
...item.voucher_id !== void 0 ? { voucher_id: item.voucher_id } : {},
|
|
1079
|
+
...item.origin_amount !== void 0 ? { origin_amount: String(item.origin_amount) } : {},
|
|
1080
|
+
...item.service_fee !== void 0 ? { service_fee: String(item.service_fee) } : {},
|
|
1081
|
+
...item.status !== void 0 ? { status: item.status } : {},
|
|
1261
1082
|
payment_time: paymentTime,
|
|
1262
1083
|
created_at: createdAt,
|
|
1263
|
-
...
|
|
1264
|
-
|
|
1265
|
-
} : {}
|
|
1266
|
-
...(item.wallet_pass_use_value !== undefined ? {
|
|
1267
|
-
wallet_pass_use_value: item.wallet_pass_use_value
|
|
1268
|
-
} : {}),
|
|
1269
|
-
...(item.fund_record && typeof item.fund_record === 'object' && !Array.isArray(item.fund_record) ? {
|
|
1270
|
-
fund_record: {
|
|
1271
|
-
...item.fund_record
|
|
1272
|
-
}
|
|
1273
|
-
} : {}),
|
|
1084
|
+
...item.wallet_pass_usage_unit !== void 0 ? { wallet_pass_usage_unit: item.wallet_pass_usage_unit } : {},
|
|
1085
|
+
...item.wallet_pass_use_value !== void 0 ? { wallet_pass_use_value: item.wallet_pass_use_value } : {},
|
|
1086
|
+
...item.fund_record && typeof item.fund_record === "object" && !Array.isArray(item.fund_record) ? { fund_record: { ...item.fund_record } } : {},
|
|
1274
1087
|
metadata,
|
|
1275
|
-
...
|
|
1276
|
-
|
|
1277
|
-
} : {}
|
|
1278
|
-
...
|
|
1279
|
-
service_charge: item.service_charge
|
|
1280
|
-
} : {}),
|
|
1281
|
-
...(item.order_payment_type !== undefined ? {
|
|
1282
|
-
order_payment_type: item.order_payment_type
|
|
1283
|
-
} : {}),
|
|
1284
|
-
...(item.updated_at !== undefined ? {
|
|
1285
|
-
updated_at: item.updated_at
|
|
1286
|
-
} : {})
|
|
1088
|
+
...item.rounding_amount !== void 0 ? { rounding_amount: String(item.rounding_amount) } : {},
|
|
1089
|
+
...item.service_charge !== void 0 ? { service_charge: item.service_charge } : {},
|
|
1090
|
+
...item.order_payment_type !== void 0 ? { order_payment_type: item.order_payment_type } : {},
|
|
1091
|
+
...item.updated_at !== void 0 ? { updated_at: item.updated_at } : {}
|
|
1287
1092
|
};
|
|
1288
1093
|
}
|
|
1289
1094
|
function mapPaymentItemsToOrderPayments(paymentItems, options = {}) {
|
|
1290
|
-
if (!Array.isArray(paymentItems))
|
|
1291
|
-
|
|
1095
|
+
if (!Array.isArray(paymentItems))
|
|
1096
|
+
return [];
|
|
1097
|
+
return paymentItems.filter((item) => options.includeVoided || item.status !== "voided").map((item) => mapPaymentItemToOrderPayment(item));
|
|
1292
1098
|
}
|
|
1293
|
-
|
|
1294
|
-
/**
|
|
1295
|
-
* 历史 V1 加餐结构映射器。
|
|
1296
|
-
*
|
|
1297
|
-
* @deprecated 标准 Sales checkout 已统一提交结构。
|
|
1298
|
-
* 本函数仅保留以兼容历史接入方,未来会移除。新代码请勿再调用。
|
|
1299
|
-
*/
|
|
1300
1099
|
function formatV1Product(products) {
|
|
1301
|
-
return products.map(product => {
|
|
1100
|
+
return products.map((product) => {
|
|
1101
|
+
var _a;
|
|
1302
1102
|
return {
|
|
1303
1103
|
bundle: product.product_bundle,
|
|
1304
1104
|
key: product.product_id,
|
|
1305
|
-
option: product.product_sku
|
|
1105
|
+
option: ((_a = product.product_sku) == null ? void 0 : _a.option) || [],
|
|
1306
1106
|
product_id: product.product_id,
|
|
1307
1107
|
product_variant_id: product.product_variant_id,
|
|
1308
1108
|
num: product.product_quantity,
|
|
1309
|
-
note: String(product.note ??
|
|
1109
|
+
note: String(product.note ?? ""),
|
|
1310
1110
|
rowKey: product.product_id,
|
|
1311
1111
|
session: null,
|
|
1312
|
-
unique: (0,
|
|
1112
|
+
unique: (0, import_orderCollectionIdentity.createUuidV4)()
|
|
1313
1113
|
};
|
|
1314
1114
|
});
|
|
1315
1115
|
}
|
|
1316
|
-
|
|
1317
|
-
/**
|
|
1318
|
-
* 判断 holder_id 是否已分配(非空)。
|
|
1319
|
-
*
|
|
1320
|
-
* @example
|
|
1321
|
-
* hasAssignedHolderId(12); // true
|
|
1322
|
-
* hasAssignedHolderId([]); // false
|
|
1323
|
-
*/
|
|
1324
1116
|
function hasAssignedHolderId(value) {
|
|
1325
|
-
if (value ===
|
|
1326
|
-
|
|
1117
|
+
if (value === void 0 || value === null || value === "")
|
|
1118
|
+
return false;
|
|
1119
|
+
if (Array.isArray(value))
|
|
1120
|
+
return value.length > 0;
|
|
1327
1121
|
return true;
|
|
1328
1122
|
}
|
|
1329
|
-
|
|
1330
|
-
/**
|
|
1331
|
-
* 清空 tempOrder 购物车行上的 holder 分配(products / bookings / runtime origin)。
|
|
1332
|
-
* 移除或更换下单客户时调用,与 booking 页换客户清 holder 行为对齐。
|
|
1333
|
-
*
|
|
1334
|
-
* @example
|
|
1335
|
-
* clearTempOrderHolderAssignments(tempOrder);
|
|
1336
|
-
*/
|
|
1337
1123
|
function clearTempOrderHolderAssignments(tempOrder) {
|
|
1124
|
+
var _a;
|
|
1338
1125
|
let changed = false;
|
|
1339
|
-
const resetHolderField = (target, key =
|
|
1340
|
-
if (!hasAssignedHolderId(target[key]))
|
|
1126
|
+
const resetHolderField = (target, key = "holder_id") => {
|
|
1127
|
+
if (!hasAssignedHolderId(target[key]))
|
|
1128
|
+
return;
|
|
1341
1129
|
target[key] = null;
|
|
1342
1130
|
changed = true;
|
|
1343
1131
|
};
|
|
1344
1132
|
for (const product of tempOrder.products || []) {
|
|
1345
|
-
if (product.metadata && typeof product.metadata ===
|
|
1133
|
+
if (product.metadata && typeof product.metadata === "object") {
|
|
1346
1134
|
resetHolderField(product.metadata);
|
|
1347
1135
|
}
|
|
1348
1136
|
}
|
|
1349
1137
|
for (const booking of tempOrder.bookings || []) {
|
|
1350
1138
|
const bookingRecord = booking;
|
|
1351
|
-
if (booking.metadata && typeof booking.metadata ===
|
|
1139
|
+
if (booking.metadata && typeof booking.metadata === "object") {
|
|
1352
1140
|
resetHolderField(booking.metadata);
|
|
1353
1141
|
}
|
|
1354
|
-
if (bookingRecord.holder !==
|
|
1142
|
+
if (bookingRecord.holder !== void 0 && bookingRecord.holder !== null) {
|
|
1355
1143
|
delete bookingRecord.holder;
|
|
1356
1144
|
changed = true;
|
|
1357
1145
|
}
|
|
1358
1146
|
}
|
|
1359
|
-
const productsByUid = tempOrder._extend
|
|
1360
|
-
if (productsByUid && typeof productsByUid ===
|
|
1147
|
+
const productsByUid = (_a = tempOrder._extend) == null ? void 0 : _a.productsByUid;
|
|
1148
|
+
if (productsByUid && typeof productsByUid === "object") {
|
|
1361
1149
|
for (const entry of Object.values(productsByUid)) {
|
|
1362
|
-
const origin = entry
|
|
1363
|
-
if (!origin || typeof origin !==
|
|
1364
|
-
|
|
1150
|
+
const origin = entry == null ? void 0 : entry.origin;
|
|
1151
|
+
if (!origin || typeof origin !== "object")
|
|
1152
|
+
continue;
|
|
1153
|
+
if (origin.metadata && typeof origin.metadata === "object") {
|
|
1365
1154
|
resetHolderField(origin.metadata);
|
|
1366
1155
|
}
|
|
1367
|
-
if (origin._extend && typeof origin._extend ===
|
|
1156
|
+
if (origin._extend && typeof origin._extend === "object") {
|
|
1368
1157
|
resetHolderField(origin._extend);
|
|
1369
1158
|
}
|
|
1370
1159
|
}
|
|
1371
1160
|
}
|
|
1372
1161
|
return changed;
|
|
1373
1162
|
}
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* 读取购物车行的 stable uid(优先 metadata.unique_identification_number)。
|
|
1377
|
-
*
|
|
1378
|
-
* @example
|
|
1379
|
-
* getOrderProductLineUid({ metadata: { unique_identification_number: 'line-1' } }); // 'line-1'
|
|
1380
|
-
*/
|
|
1381
1163
|
function getOrderProductLineUid(product) {
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1164
|
+
var _a;
|
|
1165
|
+
if (!product || typeof product !== "object")
|
|
1166
|
+
return null;
|
|
1167
|
+
const uid = ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ?? product.unique_identification_number;
|
|
1168
|
+
if (uid === void 0 || uid === null || uid === "")
|
|
1169
|
+
return null;
|
|
1385
1170
|
return String(uid);
|
|
1386
1171
|
}
|
|
1387
1172
|
function getRuntimeProductOrigin(tempOrder, product) {
|
|
1173
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1388
1174
|
const uid = getOrderProductLineUid(product);
|
|
1389
|
-
if (uid && tempOrder
|
|
1175
|
+
if (uid && ((_c = (_b = (_a = tempOrder == null ? void 0 : tempOrder._extend) == null ? void 0 : _a.productsByUid) == null ? void 0 : _b[uid]) == null ? void 0 : _c.origin)) {
|
|
1390
1176
|
return tempOrder._extend.productsByUid[uid].origin;
|
|
1391
1177
|
}
|
|
1392
|
-
const matchedProduct = (tempOrder
|
|
1393
|
-
const matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) :
|
|
1394
|
-
return matchedUid ? tempOrder
|
|
1178
|
+
const matchedProduct = ((tempOrder == null ? void 0 : tempOrder.products) || []).find((item) => item === product || getOrderProductLineUid(item) === uid || String((item == null ? void 0 : item.product_id) ?? (item == null ? void 0 : item.id) ?? "") === String((product == null ? void 0 : product.product_id) ?? (product == null ? void 0 : product.id) ?? ""));
|
|
1179
|
+
const matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : "";
|
|
1180
|
+
return matchedUid ? ((_f = (_e = (_d = tempOrder == null ? void 0 : tempOrder._extend) == null ? void 0 : _d.productsByUid) == null ? void 0 : _e[matchedUid]) == null ? void 0 : _f.origin) || null : null;
|
|
1395
1181
|
}
|
|
1396
1182
|
function isHolderConfigRequired(holderConfig) {
|
|
1397
|
-
if (!holderConfig || typeof holderConfig !==
|
|
1398
|
-
|
|
1183
|
+
if (!holderConfig || typeof holderConfig !== "object")
|
|
1184
|
+
return false;
|
|
1185
|
+
if (holderConfig.status === "disable")
|
|
1186
|
+
return false;
|
|
1399
1187
|
return Number(holderConfig.required) === 1;
|
|
1400
1188
|
}
|
|
1401
1189
|
function productRequiresFormSubject(tempOrder, product) {
|
|
1402
|
-
|
|
1190
|
+
var _a, _b;
|
|
1191
|
+
const _orderProduct = (_a = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _a.find((item) => {
|
|
1403
1192
|
return item.metadata.unique_identification_number === product._id || item.product_id === product.id;
|
|
1404
1193
|
});
|
|
1405
1194
|
const runtimeOrigin = getRuntimeProductOrigin(tempOrder, product);
|
|
1406
|
-
return isHolderConfigRequired(_orderProduct
|
|
1195
|
+
return isHolderConfigRequired((_b = _orderProduct == null ? void 0 : _orderProduct.metadata) == null ? void 0 : _b.holder_config) || isHolderConfigRequired(runtimeOrigin == null ? void 0 : runtimeOrigin.holder_config) || isHolderConfigRequired(product == null ? void 0 : product.holder_config);
|
|
1407
1196
|
}
|
|
1408
1197
|
function resolveIsFormSubject(tempOrder, product) {
|
|
1198
|
+
var _a;
|
|
1409
1199
|
debugger;
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
if (product)
|
|
1413
|
-
|
|
1200
|
+
if (((_a = tempOrder == null ? void 0 : tempOrder.holder) == null ? void 0 : _a.type) === "form")
|
|
1201
|
+
return true;
|
|
1202
|
+
if (product)
|
|
1203
|
+
return productRequiresFormSubject(tempOrder, product);
|
|
1204
|
+
return ((tempOrder == null ? void 0 : tempOrder.products) || []).some(
|
|
1205
|
+
(item) => productRequiresFormSubject(tempOrder, item)
|
|
1206
|
+
);
|
|
1414
1207
|
}
|
|
1415
|
-
|
|
1416
|
-
/**
|
|
1417
|
-
* 判断展示字段是否为空(含 i18n 对象全空)。
|
|
1418
|
-
*
|
|
1419
|
-
* @example
|
|
1420
|
-
* isEmptyOrderProductDisplayValue(''); // true
|
|
1421
|
-
* isEmptyOrderProductDisplayValue({ auto: '桌台费' }); // false
|
|
1422
|
-
*/
|
|
1423
1208
|
function isEmptyOrderProductDisplayValue(value) {
|
|
1424
|
-
if (value ===
|
|
1425
|
-
|
|
1426
|
-
if (typeof value ===
|
|
1209
|
+
if (value === void 0 || value === null)
|
|
1210
|
+
return true;
|
|
1211
|
+
if (typeof value === "string")
|
|
1212
|
+
return value.trim() === "";
|
|
1213
|
+
if (typeof value === "object") {
|
|
1427
1214
|
const record = value;
|
|
1428
|
-
return !Object.values(record).some(
|
|
1215
|
+
return !Object.values(record).some(
|
|
1216
|
+
(item) => typeof item === "string" && item.trim() !== ""
|
|
1217
|
+
);
|
|
1429
1218
|
}
|
|
1430
1219
|
return false;
|
|
1431
1220
|
}
|
|
1432
|
-
|
|
1433
|
-
/**
|
|
1434
|
-
* calcDiscount / applyDiscount 回写时 Rules 往往不带 product_title 等展示字段;
|
|
1435
|
-
* 用旧行补齐,避免编辑态 hydrate 后标题被冲掉。
|
|
1436
|
-
*
|
|
1437
|
-
* @example
|
|
1438
|
-
* mergeOrderProductDisplayFields(
|
|
1439
|
-
* { product_title: { auto: '桌台费' }, metadata: { unique_identification_number: 'u1' } },
|
|
1440
|
-
* { selling_price: '10.00', metadata: { unique_identification_number: 'u1' } },
|
|
1441
|
-
* );
|
|
1442
|
-
*/
|
|
1443
1221
|
function mergeOrderProductDisplayFields(previous, next) {
|
|
1444
|
-
const merged = {
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1222
|
+
const merged = { ...next };
|
|
1223
|
+
const displayFields = [
|
|
1224
|
+
"product_title",
|
|
1225
|
+
"product_name",
|
|
1226
|
+
"product_cover",
|
|
1227
|
+
"cover",
|
|
1228
|
+
"product_cover",
|
|
1229
|
+
"variant_title",
|
|
1230
|
+
"product_sku",
|
|
1231
|
+
"payment_price"
|
|
1232
|
+
];
|
|
1233
|
+
displayFields.forEach((field) => {
|
|
1449
1234
|
if (isEmptyOrderProductDisplayValue(merged[field]) && !isEmptyOrderProductDisplayValue(previous[field])) {
|
|
1450
1235
|
merged[field] = previous[field];
|
|
1451
1236
|
}
|
|
1452
1237
|
});
|
|
1453
1238
|
if (previous.metadata || next.metadata) {
|
|
1454
1239
|
merged.metadata = {
|
|
1455
|
-
...
|
|
1456
|
-
...
|
|
1240
|
+
...previous.metadata || {},
|
|
1241
|
+
...next.metadata || {}
|
|
1457
1242
|
};
|
|
1458
|
-
[
|
|
1459
|
-
|
|
1243
|
+
["product_title", "product_name"].forEach((field) => {
|
|
1244
|
+
var _a;
|
|
1245
|
+
if (isEmptyOrderProductDisplayValue(merged.metadata[field]) && !isEmptyOrderProductDisplayValue((_a = previous.metadata) == null ? void 0 : _a[field])) {
|
|
1460
1246
|
merged.metadata[field] = previous.metadata[field];
|
|
1461
1247
|
}
|
|
1462
1248
|
});
|
|
@@ -1466,15 +1252,8 @@ function mergeOrderProductDisplayFields(previous, next) {
|
|
|
1466
1252
|
}
|
|
1467
1253
|
return merged;
|
|
1468
1254
|
}
|
|
1469
|
-
|
|
1470
|
-
/**
|
|
1471
|
-
* 按 uid 索引 tempOrder.products,供 applyDiscount 合并展示字段。
|
|
1472
|
-
*
|
|
1473
|
-
* @example
|
|
1474
|
-
* indexOrderProductsByUid([{ metadata: { unique_identification_number: 'u1' } }]);
|
|
1475
|
-
*/
|
|
1476
1255
|
function indexOrderProductsByUid(products) {
|
|
1477
|
-
const map = new Map();
|
|
1256
|
+
const map = /* @__PURE__ */ new Map();
|
|
1478
1257
|
(products || []).forEach((product, index) => {
|
|
1479
1258
|
const uid = getOrderProductLineUid(product);
|
|
1480
1259
|
if (uid) {
|
|
@@ -1484,4 +1263,60 @@ function indexOrderProductsByUid(products) {
|
|
|
1484
1263
|
map.set(`__index__:${index}`, product);
|
|
1485
1264
|
});
|
|
1486
1265
|
return map;
|
|
1487
|
-
}
|
|
1266
|
+
}
|
|
1267
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1268
|
+
0 && (module.exports = {
|
|
1269
|
+
buildManualProductDiscountItem,
|
|
1270
|
+
buildSubmitPayload,
|
|
1271
|
+
calculateOrderProductsDeposit,
|
|
1272
|
+
clearTempOrderHolderAssignments,
|
|
1273
|
+
composeLinePrice,
|
|
1274
|
+
createDefaultOrderRulesHooks,
|
|
1275
|
+
createDefaultTempOrder,
|
|
1276
|
+
createEmptySummary,
|
|
1277
|
+
createUuidV4,
|
|
1278
|
+
ensureCartItemOriginHolder,
|
|
1279
|
+
ensureManualProductDiscountList,
|
|
1280
|
+
ensureProductSku,
|
|
1281
|
+
findManualProductDiscountItem,
|
|
1282
|
+
formatDateTime,
|
|
1283
|
+
formatV1Product,
|
|
1284
|
+
generateDuration,
|
|
1285
|
+
getAllDiscountList,
|
|
1286
|
+
getBundleSellingMagnitude,
|
|
1287
|
+
getBundleSignedUnit,
|
|
1288
|
+
getOrderProductLineUid,
|
|
1289
|
+
getProductSkuOptions,
|
|
1290
|
+
getRuntimeProductOrigin,
|
|
1291
|
+
hasAssignedHolderId,
|
|
1292
|
+
indexOrderProductsByUid,
|
|
1293
|
+
isEmptyOrderProductDisplayValue,
|
|
1294
|
+
isHolderConfigRequired,
|
|
1295
|
+
isMarkdownBundle,
|
|
1296
|
+
isTempOrder,
|
|
1297
|
+
mapPaymentItemToOrderPayment,
|
|
1298
|
+
mapPaymentItemsToOrderPayments,
|
|
1299
|
+
mergeManualProductDiscountIntoList,
|
|
1300
|
+
mergeOrderProductDisplayFields,
|
|
1301
|
+
mergeRelationForms,
|
|
1302
|
+
normalizeBookingIsAll,
|
|
1303
|
+
normalizeBookingSubType,
|
|
1304
|
+
normalizeOrderProductDiscountList,
|
|
1305
|
+
normalizeProductSkuOptions,
|
|
1306
|
+
normalizeSubmitBooking,
|
|
1307
|
+
normalizeSubmitCollectPaxValue,
|
|
1308
|
+
productRequiresFormSubject,
|
|
1309
|
+
resolveEffectivePerUnitDiscount,
|
|
1310
|
+
resolveIsFormSubject,
|
|
1311
|
+
resolveManualDiscountMessage,
|
|
1312
|
+
resolveManualDiscountOriginTotal,
|
|
1313
|
+
resolveManualDiscountReasonFromSources,
|
|
1314
|
+
resolveManualOverrideLineOriginalPrice,
|
|
1315
|
+
resolveRulesManualDiscountFlag,
|
|
1316
|
+
resolveSafeProductNum,
|
|
1317
|
+
resolveSubmitCollectPax,
|
|
1318
|
+
shouldBuildManualProductDiscount,
|
|
1319
|
+
stripManualProductDiscountItems,
|
|
1320
|
+
sumOptionUnitPrice,
|
|
1321
|
+
syncManualProductDiscountProductNum
|
|
1322
|
+
});
|