@pisell/pisellos 0.0.568 → 0.10.1
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/evaluator.js +3 -2
- 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 +24 -96
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +12 -14
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +27 -5
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +43 -30
- package/dist/modules/Discount/types.d.ts +1 -1
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +38 -16
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5460 -574
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +573 -746
- package/dist/modules/Payment/types.d.ts +44 -24
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +49 -33
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +182 -81
- package/dist/modules/ProductList/types.d.ts +16 -0
- package/dist/modules/Quotation/index.d.ts +22 -2
- package/dist/modules/Quotation/index.js +108 -42
- package/dist/modules/Quotation/types.d.ts +19 -0
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +8 -10
- package/dist/modules/Rules/index.js +324 -513
- package/dist/modules/Rules/types.d.ts +14 -3
- package/dist/modules/SalesSummary/index.d.ts +23 -26
- package/dist/modules/SalesSummary/index.js +152 -46
- package/dist/modules/SalesSummary/types.d.ts +9 -1
- package/dist/modules/SalesSummary/utils.d.ts +3 -22
- package/dist/modules/SalesSummary/utils.js +804 -165
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -12
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +79 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/modules/SurchargeList/index.d.ts +18 -0
- package/dist/modules/SurchargeList/index.js +185 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +4 -1
- package/dist/plugins/app.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6168 -680
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2328 -379
- package/dist/server/modules/order/types.d.ts +76 -5
- package/dist/server/modules/order/types.js +14 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +118 -11
- package/dist/server/modules/order/utils/filterOrders.js +242 -14
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +105 -14
- package/dist/server/modules/products/index.js +1416 -521
- package/dist/server/modules/products/types.d.ts +34 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +298 -77
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +109 -86
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +145 -106
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +3 -2
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4009 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- 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 +393 -24
- package/dist/solution/BookingTicket/index.js +2508 -443
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +42 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +42 -28
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +30 -14
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +275 -209
- package/dist/solution/Checkout/utils/index.js +20 -8
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +519 -444
- package/dist/solution/ScanOrder/types.d.ts +33 -11
- package/dist/solution/ScanOrder/types.js +4 -5
- package/dist/solution/ScanOrder/utils.d.ts +4 -1
- package/dist/solution/ScanOrder/utils.js +109 -34
- package/dist/solution/ShopDiscount/index.js +18 -19
- 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/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +32 -51
- package/dist/solution/VenueBooking/index.js +741 -808
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- 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/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +12 -2
- 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 +233 -382
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +0 -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 -676
- 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 +2 -2
- package/lib/modules/BaseModule.js +50 -29
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +368 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +298 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +155 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +222 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- 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 +261 -309
- 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 +59 -31
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +207 -217
- package/lib/modules/Customer/types.d.ts +2 -0
- 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 +2 -2
- package/lib/modules/Discount/index.js +133 -119
- package/lib/modules/Discount/types.d.ts +1 -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.d.ts +8 -0
- package/lib/modules/OpenData/index.js +88 -63
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +4184 -514
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +35 -24
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +1085 -414
- 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.d.ts +10 -9
- package/lib/modules/Payment/index.js +402 -636
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +44 -24
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +50 -52
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +216 -221
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +161 -120
- package/lib/modules/ProductList/types.d.ts +16 -0
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +154 -64
- package/lib/modules/Quotation/types.d.ts +19 -0
- 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.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +960 -1440
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +134 -61
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +814 -233
- 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 +169 -338
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +153 -104
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- 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.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +109 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +63 -212
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.d.ts +1 -0
- 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.d.ts +462 -8
- package/lib/server/index.js +4520 -1162
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +327 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +34 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +67 -84
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1543 -285
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +32 -107
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +259 -176
- package/lib/server/modules/order/utils/filterOrders.js +293 -94
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +850 -475
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +34 -41
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +254 -75
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +240 -243
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +146 -147
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +140 -197
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +904 -0
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2533 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +43 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1004 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +289 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +256 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +244 -0
- 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 +393 -24
- package/lib/solution/BookingTicket/index.js +1374 -184
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +79 -40
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +184 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +58 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +97 -64
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -82
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +109 -91
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1169 -1463
- 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 +462 -503
- 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.d.ts +50 -5
- package/lib/solution/Sales/index.js +498 -238
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +936 -864
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +422 -385
- 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.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +32 -51
- package/lib/solution/VenueBooking/index.js +1008 -984
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- 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.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +109 -90
- 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.d.ts +2 -0
- package/lib/solution/index.js +41 -102
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +12 -2
- 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/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -1,133 +1,670 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
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 });
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
29
|
-
defaultName = 'bookingTicket';
|
|
30
|
-
defaultVersion = '1.0.0';
|
|
31
|
-
isSolution = true;
|
|
32
|
-
request;
|
|
33
|
-
window;
|
|
34
|
-
shopStore;
|
|
35
|
-
store;
|
|
36
|
-
otherParams = {};
|
|
37
|
-
cacheId;
|
|
38
|
-
platform; // 平台类型,用于判断是 PC / H5
|
|
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 });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
// src/solution/BookingTicket/index.ts
|
|
31
|
+
var BookingTicket_exports = {};
|
|
32
|
+
__export(BookingTicket_exports, {
|
|
33
|
+
BookingTicket: () => BookingTicketImpl,
|
|
34
|
+
BookingTicketImpl: () => BookingTicketImpl
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(BookingTicket_exports);
|
|
37
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
38
|
+
var import_types = require("./types");
|
|
39
|
+
var import_BookingContext = require("../../modules/BookingContext");
|
|
40
|
+
var import_BaseSales = require("../BaseSales");
|
|
41
|
+
var import_scan = __toESM(require("./utils/scan"));
|
|
42
|
+
var import_orderCustomer = require("./utils/orderCustomer");
|
|
43
|
+
var import_handleScan = require("./utils/scan/handleScan");
|
|
44
|
+
var import_scanCache = __toESM(require("./utils/scan/scanCache"));
|
|
45
|
+
var import_formatGlobalScan = require("./utils/scan/formatGlobalScan");
|
|
46
|
+
var import_applyGlobalScan = require("./utils/scan/applyGlobalScan");
|
|
47
|
+
var import_cartView = require("./utils/cartView");
|
|
48
|
+
var import_addProductDecision = require("./utils/addProductDecision");
|
|
49
|
+
var import_buildCacheItemFromOrderLine = require("../../modules/BookingContext/utils/buildCacheItemFromOrderLine");
|
|
50
|
+
var import_sessionCatalogStale = require("./utils/sessionCatalogStale");
|
|
51
|
+
var import_buildNormalProductCacheItemFromOrderLine = require("../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine");
|
|
52
|
+
var import_orderLineDisplay = require("../../modules/BookingContext/utils/orderLineDisplay");
|
|
53
|
+
var import_bookingStatus = require("./utils/bookingStatus");
|
|
54
|
+
var import_resolveBestAddTimePlan = require("./utils/resolveBestAddTimePlan");
|
|
55
|
+
var import_utils = require("../../modules/Order/utils");
|
|
56
|
+
__reExport(BookingTicket_exports, require("./types"), module.exports);
|
|
57
|
+
var OPEN_DATA_SECTION_CODES = ["sale", "reservation", "fulfillment", "menu", "workflow"];
|
|
58
|
+
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1e3;
|
|
59
|
+
function resolveBookingUidForAddTime(booking) {
|
|
60
|
+
var _a;
|
|
61
|
+
const uid = (_a = booking == null ? void 0 : booking.metadata) == null ? void 0 : _a.unique_identification_number;
|
|
62
|
+
return uid === void 0 || uid === null ? "" : String(uid);
|
|
63
|
+
}
|
|
64
|
+
function normalizeAddTimeQuantity(value) {
|
|
65
|
+
const parsed = Math.floor(Number(value));
|
|
66
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 1;
|
|
67
|
+
}
|
|
68
|
+
function resolveAddTimeScheduleMinutes(explicitValue, product) {
|
|
69
|
+
const raw = explicitValue ?? (product == null ? void 0 : product.product_add_schedule_time);
|
|
70
|
+
if (raw === void 0 || raw === null || raw === "")
|
|
71
|
+
return void 0;
|
|
72
|
+
const parsed = Number(raw);
|
|
73
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
74
|
+
}
|
|
75
|
+
function resolveAddTimeProductPrice(explicitValue, product) {
|
|
76
|
+
return explicitValue ?? (product == null ? void 0 : product.price) ?? (product == null ? void 0 : product.selling_price) ?? (product == null ? void 0 : product.base_price);
|
|
77
|
+
}
|
|
78
|
+
function normalizeCoveredMinutes(value) {
|
|
79
|
+
const parsed = Math.ceil(Number(value));
|
|
80
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
81
|
+
}
|
|
82
|
+
function buildAddTimeBookingTimePatch(booking, coveredMinutes) {
|
|
83
|
+
if (coveredMinutes <= 0)
|
|
84
|
+
return null;
|
|
85
|
+
const endDate = booking == null ? void 0 : booking.end_date;
|
|
86
|
+
const endTime = booking == null ? void 0 : booking.end_time;
|
|
87
|
+
if (!endDate || !endTime) {
|
|
88
|
+
throw new Error("[BookingTicket] addAddTimeProductsToBooking: booking.end_date/end_time 缺失");
|
|
89
|
+
}
|
|
90
|
+
const currentEnd = (0, import_dayjs.default)(`${endDate} ${endTime}`);
|
|
91
|
+
if (!currentEnd.isValid()) {
|
|
92
|
+
throw new Error("[BookingTicket] addAddTimeProductsToBooking: booking.end_date/end_time 无效");
|
|
93
|
+
}
|
|
94
|
+
const nextEnd = currentEnd.add(coveredMinutes, "minute");
|
|
95
|
+
const currentDuration = Number(booking == null ? void 0 : booking.duration);
|
|
96
|
+
let duration = Number.isFinite(currentDuration) ? currentDuration + coveredMinutes : coveredMinutes;
|
|
97
|
+
if ((booking == null ? void 0 : booking.start_date) && (booking == null ? void 0 : booking.start_time)) {
|
|
98
|
+
const start = (0, import_dayjs.default)(`${booking.start_date} ${booking.start_time}`);
|
|
99
|
+
if (start.isValid()) {
|
|
100
|
+
const diffMinutes = nextEnd.diff(start, "minute");
|
|
101
|
+
duration = diffMinutes > 0 ? diffMinutes : duration;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
end_date: nextEnd.format("YYYY-MM-DD"),
|
|
106
|
+
end_time: nextEnd.format("HH:mm"),
|
|
107
|
+
duration
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function withProductOptionString(cacheItem) {
|
|
111
|
+
var _a;
|
|
112
|
+
const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(cacheItem);
|
|
113
|
+
if (!productOptionString)
|
|
114
|
+
return cacheItem;
|
|
115
|
+
return {
|
|
116
|
+
...cacheItem,
|
|
117
|
+
product_option_string: (cacheItem == null ? void 0 : cacheItem.product_option_string) || productOptionString,
|
|
118
|
+
_extend: {
|
|
119
|
+
...(cacheItem == null ? void 0 : cacheItem._extend) || {},
|
|
120
|
+
product_option_string: ((_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.product_option_string) || productOptionString
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
125
|
+
constructor() {
|
|
126
|
+
super(...arguments);
|
|
127
|
+
this.defaultName = "bookingTicket";
|
|
128
|
+
this.defaultVersion = "1.0.0";
|
|
129
|
+
/**
|
|
130
|
+
* 子类覆盖 store 类型为 BookingTicket 子模块清单(在父类基础上追加 customer)。
|
|
131
|
+
* 父类按 `getRegisteredModuleNames` 注入成员到该 store。
|
|
132
|
+
*/
|
|
133
|
+
this.store = {};
|
|
134
|
+
this.productCatalog = [];
|
|
135
|
+
this.addTimeProductsCatalog = [];
|
|
136
|
+
this.orderCustomerDiscountRefreshInFlight = null;
|
|
137
|
+
this.orderCustomerDiscountRefreshCustomerId = null;
|
|
138
|
+
this.loadOpenDataConfigInFlight = null;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext。
|
|
142
|
+
* bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
|
|
143
|
+
*/
|
|
144
|
+
getRegisteredModuleNames() {
|
|
145
|
+
return [...super.getRegisteredModuleNames(), "customer", "bookingContext", "openData"];
|
|
146
|
+
}
|
|
147
|
+
getSubmitOrderSalesChannel() {
|
|
148
|
+
var _a, _b, _c;
|
|
149
|
+
const channel = (_c = (_b = (_a = this.core) == null ? void 0 : _a.context) == null ? void 0 : _b.getChannel) == null ? void 0 : _c.call(_b);
|
|
150
|
+
return !channel || channel === "system" ? "pos" : channel;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* 业务侧子模块工厂:BookingTicket 自带的 createBookingTicketModule 优先匹配;
|
|
154
|
+
* 未识别的模块名(如 BookingByStep 公共类型)回退到父类工厂。
|
|
155
|
+
*/
|
|
156
|
+
createSubModule(moduleName) {
|
|
157
|
+
const localModule = (0, import_types.createBookingTicketModule)(
|
|
158
|
+
moduleName,
|
|
159
|
+
this.name
|
|
160
|
+
);
|
|
161
|
+
if (localModule)
|
|
162
|
+
return localModule;
|
|
163
|
+
return super.createSubModule(moduleName);
|
|
164
|
+
}
|
|
165
|
+
async initialize(core, options = {}) {
|
|
166
|
+
var _a;
|
|
167
|
+
this.scan = new import_scan.default(this, `BOOKING_TICKET_SCAN:${this.name}`);
|
|
168
|
+
await super.initialize(core, options);
|
|
49
169
|
if (!this.request) {
|
|
50
|
-
throw new Error(
|
|
170
|
+
throw new Error("bookingTicket解决方案需要 request 插件支持");
|
|
51
171
|
}
|
|
52
|
-
|
|
53
|
-
|
|
172
|
+
this.platform = (_a = this.otherParams) == null ? void 0 : _a.platform;
|
|
173
|
+
await this.configureIdGeneratorFromOpenData();
|
|
174
|
+
console.log("[BookingTicket] 初始化完成");
|
|
175
|
+
}
|
|
176
|
+
getBookingTicketBusinessCode() {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
const businessCode = ((_a = this.otherParams) == null ? void 0 : _a.businessCode) ?? ((_b = this.otherParams) == null ? void 0 : _b.business_code);
|
|
179
|
+
if (businessCode === void 0 || businessCode === null)
|
|
180
|
+
return null;
|
|
181
|
+
const normalized = String(businessCode).trim();
|
|
182
|
+
return normalized || null;
|
|
183
|
+
}
|
|
184
|
+
getIdGeneratorPlugin() {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
const appPlugin = this.core.getPlugin("app");
|
|
187
|
+
const app = (_a = appPlugin == null ? void 0 : appPlugin.getApp) == null ? void 0 : _a.call(appPlugin);
|
|
188
|
+
return ((_b = app == null ? void 0 : app.getPlugin) == null ? void 0 : _b.call(app, "idGenerator")) || null;
|
|
189
|
+
}
|
|
190
|
+
async loadOpenDataConfig() {
|
|
191
|
+
if (!this.store.openData)
|
|
192
|
+
throw new Error("openData 模块未初始化");
|
|
193
|
+
const businessCode = this.getBookingTicketBusinessCode();
|
|
194
|
+
if (!businessCode) {
|
|
195
|
+
console.warn("[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ", this.name);
|
|
196
|
+
return null;
|
|
54
197
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
198
|
+
const lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
199
|
+
const cachedData = this.store.openData.getOpenData();
|
|
200
|
+
if (cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL) {
|
|
201
|
+
this.otherParams.openData = cachedData;
|
|
202
|
+
return cachedData;
|
|
203
|
+
}
|
|
204
|
+
if (this.loadOpenDataConfigInFlight)
|
|
205
|
+
return await this.loadOpenDataConfigInFlight;
|
|
206
|
+
const channel = this.getSubmitOrderSalesChannel();
|
|
207
|
+
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
208
|
+
scope: "board",
|
|
209
|
+
target: `${businessCode}+${channel}`,
|
|
210
|
+
// target: `dine_in+pos`,
|
|
211
|
+
section_code: [...OPEN_DATA_SECTION_CODES]
|
|
212
|
+
});
|
|
213
|
+
try {
|
|
214
|
+
const openDataConfig = await this.loadOpenDataConfigInFlight;
|
|
215
|
+
this.otherParams.openData = openDataConfig;
|
|
216
|
+
return openDataConfig;
|
|
217
|
+
} finally {
|
|
218
|
+
this.loadOpenDataConfigInFlight = null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
async getOpenData() {
|
|
222
|
+
var _a;
|
|
223
|
+
return (_a = this.store.openData) == null ? void 0 : _a.getOpenData();
|
|
224
|
+
}
|
|
225
|
+
async getShortNumberOrDeviceId() {
|
|
226
|
+
const getAsyncIotDeviceInfo = this.getAppData("async_iot_device_info");
|
|
227
|
+
if (getAsyncIotDeviceInfo) {
|
|
228
|
+
const res = await (getAsyncIotDeviceInfo == null ? void 0 : getAsyncIotDeviceInfo());
|
|
229
|
+
if (res == null ? void 0 : res.short_number) {
|
|
230
|
+
return res == null ? void 0 : res.short_number;
|
|
66
231
|
}
|
|
67
232
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
233
|
+
return String(this.getAppData("device_id") || 0).slice(-2);
|
|
234
|
+
}
|
|
235
|
+
async configureIdGeneratorFromOpenData() {
|
|
236
|
+
let openDataConfig = null;
|
|
237
|
+
try {
|
|
238
|
+
openDataConfig = await this.loadOpenDataConfig();
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.warn("[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置", error);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const idGenerator = this.getIdGeneratorPlugin();
|
|
244
|
+
if (!(idGenerator == null ? void 0 : idGenerator.configure)) {
|
|
245
|
+
console.warn("[BookingTicket] idGenerator 插件不可用,跳过配置");
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const receiptSequenceLength = this.normalizePositiveInteger(
|
|
249
|
+
openDataConfig == null ? void 0 : openDataConfig["sale.short_number_digits"],
|
|
250
|
+
5
|
|
251
|
+
);
|
|
252
|
+
const receiptSequenceStart = this.normalizePositiveInteger(
|
|
253
|
+
openDataConfig == null ? void 0 : openDataConfig["sale.short_number_start_number"],
|
|
254
|
+
1
|
|
255
|
+
);
|
|
256
|
+
const prefix = this.normalizeIdPrefix(
|
|
257
|
+
openDataConfig == null ? void 0 : openDataConfig["sale.short_number_prefix"],
|
|
258
|
+
""
|
|
259
|
+
);
|
|
260
|
+
const shopOrderPrefix = this.normalizeIdPrefix(
|
|
261
|
+
openDataConfig == null ? void 0 : openDataConfig["sale.sale_number_prefix"],
|
|
262
|
+
""
|
|
263
|
+
);
|
|
264
|
+
const resetReceiptSequenceDaily = typeof (openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"]) === "boolean" ? openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"] : false;
|
|
265
|
+
const operatingDayBoundary = this.getAppData("operating_day_boundary");
|
|
266
|
+
const deviceId = await this.getShortNumberOrDeviceId();
|
|
267
|
+
const businessCode = this.getBookingTicketBusinessCode();
|
|
268
|
+
if (!businessCode) {
|
|
269
|
+
console.warn("[BookingTicket] businessCode 缺失,跳过 idGenerator 配置");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
await idGenerator.configure({
|
|
274
|
+
biz: businessCode,
|
|
275
|
+
config: {
|
|
276
|
+
prefix,
|
|
277
|
+
deviceCode: deviceId,
|
|
278
|
+
// TODO 现在 picoding 没这个配置的 key
|
|
279
|
+
padReceiptSequence: false,
|
|
280
|
+
receiptSequenceLength,
|
|
281
|
+
resetReceiptSequenceDaily,
|
|
282
|
+
receiptSequenceResetTime: operatingDayBoundary.time,
|
|
283
|
+
receiptSequenceStart,
|
|
284
|
+
shopOrderPrefix
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
} catch (error) {
|
|
288
|
+
console.warn("[BookingTicket] idGenerator 配置失败", error);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
normalizePositiveInteger(value, fallback) {
|
|
292
|
+
const numeric = Number(value);
|
|
293
|
+
if (!Number.isInteger(numeric) || numeric <= 0)
|
|
294
|
+
return fallback;
|
|
295
|
+
return numeric;
|
|
296
|
+
}
|
|
297
|
+
normalizeIdPrefix(value, fallback) {
|
|
298
|
+
if (value === void 0 || value === null)
|
|
299
|
+
return fallback;
|
|
300
|
+
const normalized = String(value).trim().toUpperCase();
|
|
301
|
+
return normalized || fallback;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* 加载销售详情,并在父类基础上把 customer 信息装配到 CustomerModule。
|
|
305
|
+
*
|
|
306
|
+
* 业务上 ticketBooking 进入「编辑/查看」时需要 active customer 状态,因此从
|
|
307
|
+
* sales.customer / sales.header / tempOrder 顶层字段中拼装 ICustomer 后调 setSelectedCustomer,
|
|
308
|
+
* 让现有 setActiveCustomer / getActiveCustomer 调用方零成本拿到详情态客户。
|
|
309
|
+
*/
|
|
310
|
+
async loadSalesDetail(orderIdOrParams) {
|
|
311
|
+
const sales = await super.loadSalesDetail(orderIdOrParams);
|
|
312
|
+
const customerModule = this.store.customer;
|
|
313
|
+
const detailCustomer = sales == null ? void 0 : sales.customer;
|
|
314
|
+
const orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
315
|
+
const protocolCustomerId = sales == null ? void 0 : sales.customer_id;
|
|
316
|
+
const protocolCustomer = protocolCustomerId !== void 0 && protocolCustomerId !== null ? {
|
|
317
|
+
id: protocolCustomerId,
|
|
318
|
+
name: String((sales == null ? void 0 : sales.customer_name) || ""),
|
|
319
|
+
phone: sales == null ? void 0 : sales.phone,
|
|
320
|
+
email: sales == null ? void 0 : sales.email,
|
|
321
|
+
country_calling_code: sales == null ? void 0 : sales.country_calling_code
|
|
322
|
+
} : null;
|
|
323
|
+
const selectedCustomer = detailCustomer ?? orderCustomerSnapshot ?? protocolCustomer;
|
|
324
|
+
if (customerModule && selectedCustomer) {
|
|
325
|
+
const { id: detailCustomerId, ...detailCustomerRest } = selectedCustomer ?? {};
|
|
326
|
+
const rawId = detailCustomerId ?? "";
|
|
327
|
+
const customer = {
|
|
328
|
+
...detailCustomerRest,
|
|
329
|
+
id: rawId == null ? "" : rawId,
|
|
330
|
+
name: (selectedCustomer == null ? void 0 : selectedCustomer.name) ?? "",
|
|
331
|
+
phone: selectedCustomer == null ? void 0 : selectedCustomer.phone,
|
|
332
|
+
email: selectedCustomer == null ? void 0 : selectedCustomer.email,
|
|
333
|
+
country_calling_code: selectedCustomer == null ? void 0 : selectedCustomer.country_calling_code
|
|
334
|
+
};
|
|
335
|
+
customerModule.setSelectedCustomer(customer);
|
|
336
|
+
this.setOrderCustomer(customer);
|
|
337
|
+
}
|
|
338
|
+
return sales;
|
|
339
|
+
}
|
|
340
|
+
async scanPromotionCode(code, customerId) {
|
|
341
|
+
if (!this.store.order)
|
|
342
|
+
throw new Error("order 模块未初始化");
|
|
343
|
+
const raw = await this.store.order.scanCode(code, customerId);
|
|
344
|
+
const scannedList = raw.scannedDiscountList || [];
|
|
345
|
+
const extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
346
|
+
const hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
347
|
+
if (!hasOrderCustomer && extractedCustomerId) {
|
|
348
|
+
await this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
349
|
+
}
|
|
350
|
+
if (raw.isAvailable) {
|
|
351
|
+
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
352
|
+
this.store.order.persistTempOrder();
|
|
353
|
+
const tempOrder = this.store.order.ensureTempOrder();
|
|
354
|
+
await this.effectsEmit("onDiscountApplied", {
|
|
355
|
+
productList: tempOrder.products || [],
|
|
356
|
+
discountList: this.store.order.getDiscountList(),
|
|
357
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
358
|
+
tempOrder
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return {
|
|
362
|
+
isAvailable: raw.isAvailable,
|
|
363
|
+
type: raw.type,
|
|
364
|
+
unavailableReason: raw.unavailableReason,
|
|
365
|
+
scannedDiscountList: raw.scannedDiscountList
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async hydrateOrderCustomerFromScanDiscounts(discounts) {
|
|
369
|
+
const currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
370
|
+
if (currentOrderCustomer)
|
|
371
|
+
return;
|
|
372
|
+
const customerId = this.getDiscountCustomerId(discounts);
|
|
373
|
+
if (!customerId)
|
|
374
|
+
return;
|
|
375
|
+
const customer = await this.resolveCustomerByDiscountCustomerId(customerId);
|
|
376
|
+
if (!customer)
|
|
377
|
+
return;
|
|
378
|
+
this.store.customer.setSelectedCustomer(customer);
|
|
379
|
+
this.setOrderCustomer(customer);
|
|
380
|
+
}
|
|
381
|
+
getDiscountCustomerId(discounts) {
|
|
382
|
+
for (const item of discounts) {
|
|
383
|
+
const topLevelId = Number(item.customer_id);
|
|
384
|
+
if (Number.isFinite(topLevelId) && topLevelId > 0) {
|
|
385
|
+
return topLevelId;
|
|
84
386
|
}
|
|
387
|
+
}
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
async resolveCustomerByDiscountCustomerId(customerId) {
|
|
391
|
+
var _a;
|
|
392
|
+
const localCustomers = this.store.customer.getCustomers();
|
|
393
|
+
const localCustomer = this.findCustomerById(localCustomers, customerId);
|
|
394
|
+
const normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
|
|
395
|
+
if (normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer)) {
|
|
396
|
+
return normalizedLocalCustomer;
|
|
397
|
+
}
|
|
398
|
+
const result = await this.store.customer.queryCustomerList({
|
|
399
|
+
ids: [customerId],
|
|
400
|
+
skip: 1,
|
|
401
|
+
num: 1
|
|
402
|
+
});
|
|
403
|
+
const remoteCustomer = this.findCustomerById((result == null ? void 0 : result.list) || [], customerId) || ((_a = result == null ? void 0 : result.list) == null ? void 0 : _a[0]) || null;
|
|
404
|
+
return remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null;
|
|
405
|
+
}
|
|
406
|
+
findCustomerById(customers = [], customerId) {
|
|
407
|
+
return customers.find((customer) => {
|
|
408
|
+
const rawId = this.getRawCustomerId(customer);
|
|
409
|
+
return rawId !== null && String(rawId) === String(customerId);
|
|
410
|
+
}) || null;
|
|
411
|
+
}
|
|
412
|
+
normalizeCustomer(customer) {
|
|
413
|
+
const raw = customer;
|
|
414
|
+
const rawId = this.getRawCustomerId(customer);
|
|
415
|
+
const name = customer.name || raw.display_name || raw.nickname || raw.customer_name || [raw.first_name, raw.last_name].filter(Boolean).join(" ") || "";
|
|
416
|
+
return {
|
|
417
|
+
...customer,
|
|
418
|
+
id: rawId ?? customer.id,
|
|
419
|
+
name,
|
|
420
|
+
phone: customer.phone ?? raw.phone ?? raw.mobile ?? "",
|
|
421
|
+
email: customer.email ?? raw.email ?? "",
|
|
422
|
+
country_calling_code: customer.country_calling_code ?? raw.country_calling_code ?? ""
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
getRawCustomerId(customer) {
|
|
426
|
+
const raw = customer;
|
|
427
|
+
return customer.id ?? raw.customer_id ?? raw.customerId ?? null;
|
|
428
|
+
}
|
|
429
|
+
hasUsableCustomerDetails(customer) {
|
|
430
|
+
return !!(customer.name || customer.phone || customer.email || customer.display_name || customer.customer_name);
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* 更新当前预约的 appointment_status。
|
|
434
|
+
*
|
|
435
|
+
* 数据源:从 OrderModule.tempOrder 内部读取,调用方无需传 orderId / scheduleId。
|
|
436
|
+
* schedule id 解析优先级:
|
|
437
|
+
* 1. `tempOrder.metadata.appointment_booking_parent_schedule_id`
|
|
438
|
+
* 2. `tempOrder.bookings` 中 `parent_id === 0` 的 `schedule_event_id`
|
|
439
|
+
*
|
|
440
|
+
* 流程:先乐观更新本地 bookings 的 appointment_status,再调 PUT 接口,
|
|
441
|
+
* 接口成功后强制刷新销售详情;任一步失败都回滚本地状态并抛错。
|
|
442
|
+
*
|
|
443
|
+
* @param status 目标状态(如 'confirmed')
|
|
444
|
+
* @returns 接口返回的 data
|
|
445
|
+
*/
|
|
446
|
+
async setBookingStatus(status) {
|
|
447
|
+
var _a, _b;
|
|
448
|
+
const tempOrder = (_b = (_a = this.store.order) == null ? void 0 : _a.getTempOrder) == null ? void 0 : _b.call(_a);
|
|
449
|
+
if (!tempOrder) {
|
|
450
|
+
throw new Error("setBookingStatus: tempOrder 未加载");
|
|
451
|
+
}
|
|
452
|
+
const orderId = tempOrder.order_id;
|
|
453
|
+
if (orderId === void 0 || orderId === null) {
|
|
454
|
+
throw new Error("setBookingStatus: tempOrder.order_id 缺失");
|
|
455
|
+
}
|
|
456
|
+
const scheduleId = (0, import_bookingStatus.resolveScheduleId)(tempOrder);
|
|
457
|
+
if (scheduleId === null) {
|
|
458
|
+
throw new Error(
|
|
459
|
+
"setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)"
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
const bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
463
|
+
const previous = (0, import_bookingStatus.applyBookingsStatus)(bookings, status);
|
|
464
|
+
try {
|
|
465
|
+
const res = await this.request.put(
|
|
466
|
+
`/schedule/booking/appointment-status/${scheduleId}`,
|
|
467
|
+
{ appointment_status: status }
|
|
468
|
+
);
|
|
469
|
+
await this.refreshSalesDetail();
|
|
470
|
+
this.core.effects.emit(`${this.name}:onBookingStatusChange`, {
|
|
471
|
+
orderId,
|
|
472
|
+
status
|
|
473
|
+
});
|
|
474
|
+
return (res == null ? void 0 : res.data) ?? res;
|
|
475
|
+
} catch (error) {
|
|
476
|
+
(0, import_bookingStatus.restoreBookingsStatus)(bookings, previous);
|
|
477
|
+
throw error;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* 子预约状态机转移(POST /schedule/booking-transition/{schedule_event_id})。
|
|
482
|
+
*
|
|
483
|
+
* 与 `setBookingStatus`(父预约 PUT appointment-status)不同,本方法按子预约
|
|
484
|
+
* `schedule_event_id` 调用状态转移接口,body 为 `{ action }`。
|
|
485
|
+
*
|
|
486
|
+
* 流程:能解析出目标状态时先乐观更新对应子预约的 `appointment_status`,
|
|
487
|
+
* 再调 POST;成功后强制刷新销售详情;失败则回滚该子预约本地状态并抛错。
|
|
488
|
+
* `reschedule` 暂未启用状态矩阵,跳过乐观更新仅调接口。
|
|
489
|
+
*
|
|
490
|
+
* @param params.schedule_event_id 子预约 schedule_event_id
|
|
491
|
+
* @param params.action 转移动作:confirm | reject | arrive | start | complete | cancel | no_show | reschedule
|
|
492
|
+
* @returns 接口返回的 data
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* await bookingTicket.transitionChildBooking({
|
|
496
|
+
* schedule_event_id: 301,
|
|
497
|
+
* action: 'confirm',
|
|
498
|
+
* });
|
|
499
|
+
*/
|
|
500
|
+
async transitionChildBooking(params) {
|
|
501
|
+
var _a, _b;
|
|
502
|
+
const { schedule_event_id, action } = params;
|
|
503
|
+
if (schedule_event_id === void 0 || schedule_event_id === null || schedule_event_id === "") {
|
|
504
|
+
throw new Error("transitionChildBooking: schedule_event_id 不能为空");
|
|
505
|
+
}
|
|
506
|
+
if (!action) {
|
|
507
|
+
throw new Error("transitionChildBooking: action 不能为空");
|
|
508
|
+
}
|
|
509
|
+
const tempOrder = (_b = (_a = this.store.order) == null ? void 0 : _a.getTempOrder) == null ? void 0 : _b.call(_a);
|
|
510
|
+
if (!tempOrder) {
|
|
511
|
+
throw new Error("transitionChildBooking: tempOrder 未加载");
|
|
512
|
+
}
|
|
513
|
+
const orderId = tempOrder.order_id;
|
|
514
|
+
if (orderId === void 0 || orderId === null) {
|
|
515
|
+
throw new Error("transitionChildBooking: tempOrder.order_id 缺失");
|
|
516
|
+
}
|
|
517
|
+
const bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
518
|
+
const targetStatus = (0, import_bookingStatus.resolveStatusAfterTransition)(action);
|
|
519
|
+
const previous = targetStatus !== null ? (0, import_bookingStatus.applyChildBookingStatus)(bookings, schedule_event_id, targetStatus) : void 0;
|
|
520
|
+
try {
|
|
521
|
+
const res = await this.request.post(
|
|
522
|
+
`/schedule/booking-transition/${schedule_event_id}`,
|
|
523
|
+
{ action }
|
|
524
|
+
);
|
|
525
|
+
await this.refreshSalesDetail();
|
|
526
|
+
this.core.effects.emit(`${this.name}:onChildBookingStatusChange`, {
|
|
527
|
+
orderId,
|
|
528
|
+
schedule_event_id,
|
|
529
|
+
action,
|
|
530
|
+
status: targetStatus
|
|
531
|
+
});
|
|
532
|
+
return (res == null ? void 0 : res.data) ?? res;
|
|
533
|
+
} catch (error) {
|
|
534
|
+
if (previous !== void 0) {
|
|
535
|
+
(0, import_bookingStatus.restoreChildBookingStatus)(bookings, schedule_event_id, previous);
|
|
536
|
+
}
|
|
537
|
+
throw error;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* 基于当前 tempOrder.order_id 强制从远端重新拉取销售详情。
|
|
542
|
+
*
|
|
543
|
+
* 适用场景:在 BookingTicket 内执行了「修改服务端订单状态」的动作(如改预约状态、
|
|
544
|
+
* 改下单客户、改商品行等)后,统一刷新本地销售详情,保证 UI 与服务端一致。
|
|
545
|
+
*
|
|
546
|
+
* 约束:调用前必须已有 tempOrder 且 order_id 存在,否则视为非法调用并抛错。
|
|
547
|
+
*
|
|
548
|
+
* @returns loadSalesDetail 的返回值
|
|
549
|
+
*/
|
|
550
|
+
async refreshSalesDetail(params = {}) {
|
|
551
|
+
var _a, _b;
|
|
552
|
+
const tempOrder = (_b = (_a = this.store.order) == null ? void 0 : _a.getTempOrder) == null ? void 0 : _b.call(_a);
|
|
553
|
+
if (!tempOrder) {
|
|
554
|
+
throw new Error("refreshSalesDetail: tempOrder 未加载");
|
|
555
|
+
}
|
|
556
|
+
debugger;
|
|
557
|
+
const orderId = tempOrder.order_id || tempOrder.external_sale_number;
|
|
558
|
+
if (orderId === void 0 || orderId === null) {
|
|
559
|
+
return {};
|
|
560
|
+
}
|
|
561
|
+
return this.loadSalesDetail({
|
|
562
|
+
orderId,
|
|
563
|
+
// merge: true
|
|
564
|
+
forceRemote: params.forceRemote
|
|
85
565
|
});
|
|
86
|
-
this.core.effects.emit(`${this.name}:onInited`, {});
|
|
87
566
|
}
|
|
88
|
-
|
|
89
567
|
/**
|
|
90
568
|
* 获取商品列表
|
|
91
569
|
* @param params 包含 schedule_date 的参数
|
|
92
570
|
* @returns 商品列表
|
|
93
571
|
*/
|
|
94
572
|
async loadProducts(params = {}, options) {
|
|
95
|
-
const {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
} = params;
|
|
573
|
+
const { schedule_date, customer_id, menu_list_ids, schedule_datetime } = params;
|
|
574
|
+
const bookingDate = schedule_datetime || schedule_date || "";
|
|
575
|
+
if (bookingDate) {
|
|
576
|
+
this.setBookingDate(bookingDate);
|
|
577
|
+
}
|
|
101
578
|
try {
|
|
102
579
|
const result = await this.store.products.loadProducts({
|
|
103
|
-
with_count: [
|
|
580
|
+
with_count: ["bundleGroup", "optionGroup"],
|
|
104
581
|
with_schedule: 1,
|
|
105
582
|
...params,
|
|
106
583
|
cacheId: this.cacheId
|
|
107
584
|
}, options);
|
|
585
|
+
this.productCatalog = Array.isArray(result) ? [...result] : [];
|
|
108
586
|
this.core.effects.emit(`${this.name}:onProductsLoaded`, result);
|
|
109
587
|
return result;
|
|
110
588
|
} catch (error) {
|
|
111
|
-
console.error(
|
|
589
|
+
console.error("Failed to load products:", error);
|
|
112
590
|
throw error;
|
|
113
591
|
}
|
|
114
592
|
}
|
|
115
|
-
|
|
593
|
+
/**
|
|
594
|
+
* 获取加时商品列表。
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* const products = await bookingTicket.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
598
|
+
*/
|
|
599
|
+
async getAddTimeProducts(params = {}) {
|
|
600
|
+
const result = await this.store.products.getAddTimeProducts({
|
|
601
|
+
...params,
|
|
602
|
+
cacheId: this.cacheId
|
|
603
|
+
});
|
|
604
|
+
this.addTimeProductsCatalog = Array.isArray(result) ? [...result] : [];
|
|
605
|
+
return result;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* 只读查询单商品详情:走 ProductList 报价查询,但不写 productCatalog、
|
|
609
|
+
* 不 emit onProductsLoaded、不修改 BookingDate。
|
|
610
|
+
*
|
|
611
|
+
* 供「列表已 loadProducts、仅需补 product_resource / capacity」等场景使用,
|
|
612
|
+
* 避免 loadProductDetail 覆盖左侧商品列表。
|
|
613
|
+
*
|
|
614
|
+
* @example
|
|
615
|
+
* const detail = await bookingTicket.queryProductDetail({
|
|
616
|
+
* product_id: 2,
|
|
617
|
+
* schedule_date: '2030-01-15',
|
|
618
|
+
* schedule_datetime: '2030-01-15 10:00:00',
|
|
619
|
+
* });
|
|
620
|
+
*/
|
|
621
|
+
async queryProductDetail(params, options) {
|
|
622
|
+
const { product_id, ...queryParams } = params;
|
|
623
|
+
try {
|
|
624
|
+
const result = await this.store.products.loadProducts({
|
|
625
|
+
with_count: ["bundleGroup", "optionGroup"],
|
|
626
|
+
with_schedule: 1,
|
|
627
|
+
...queryParams,
|
|
628
|
+
product_ids: [product_id],
|
|
629
|
+
cacheId: this.cacheId
|
|
630
|
+
}, options);
|
|
631
|
+
const list = Array.isArray(result) ? result : [];
|
|
632
|
+
return list.find(
|
|
633
|
+
(product) => Number(product.id) === Number(product_id)
|
|
634
|
+
);
|
|
635
|
+
} catch (error) {
|
|
636
|
+
console.error("Failed to query product detail:", error);
|
|
637
|
+
throw error;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* 按预约时间加载单个商品详情。
|
|
642
|
+
* 价格仍由 server products 的报价单桥接统一计算,避免 solution 实例重复请求报价单。
|
|
643
|
+
*/
|
|
644
|
+
async loadProductDetail(params, options) {
|
|
645
|
+
const { product_id, ...queryParams } = params;
|
|
646
|
+
const products = await this.loadProducts({
|
|
647
|
+
...queryParams,
|
|
648
|
+
product_ids: [product_id]
|
|
649
|
+
}, options);
|
|
650
|
+
return products.find(
|
|
651
|
+
(product) => Number(product.id) === Number(product_id)
|
|
652
|
+
);
|
|
653
|
+
}
|
|
116
654
|
/**
|
|
117
655
|
* 取消商品查询订阅
|
|
118
656
|
* @param subscriberId 订阅时传入的 subscriberId
|
|
119
657
|
*/
|
|
120
658
|
unsubscribeProductQuery(subscriberId) {
|
|
121
|
-
|
|
659
|
+
var _a;
|
|
660
|
+
(_a = this.core.server) == null ? void 0 : _a.removeProductQuerySubscriber(subscriberId);
|
|
122
661
|
}
|
|
123
|
-
|
|
124
662
|
/**
|
|
125
663
|
* 初始化外设扫码结果监听
|
|
126
664
|
*/
|
|
127
665
|
initPeripheralsListener() {
|
|
128
666
|
this.scan.initPeripheralsListener();
|
|
129
667
|
}
|
|
130
|
-
|
|
131
668
|
/**
|
|
132
669
|
* 获取商品列表(不加载到模块中)
|
|
133
670
|
* @returns 商品列表
|
|
@@ -135,21 +672,67 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
135
672
|
async getProducts() {
|
|
136
673
|
return this.store.products.getProducts();
|
|
137
674
|
}
|
|
138
|
-
|
|
675
|
+
/**
|
|
676
|
+
* 获取当前已加载的商品池 UI 视图。
|
|
677
|
+
*
|
|
678
|
+
* ProductList.getProducts 是异步 API;BookingTicket 维护最近一次 loadProducts 结果,
|
|
679
|
+
* 供 UI 同步 getter 使用。未加载时返回空列表。
|
|
680
|
+
*/
|
|
681
|
+
getProductCatalog() {
|
|
682
|
+
return {
|
|
683
|
+
products: [...this.productCatalog]
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* 获取购物车 UI 视图。
|
|
688
|
+
*
|
|
689
|
+
* tempOrder 仍是 checkout 协议对象;商品行直接透传 products,bookings 附带关联商品。
|
|
690
|
+
*/
|
|
691
|
+
getCart() {
|
|
692
|
+
var _a, _b;
|
|
693
|
+
const tempOrder = ((_a = this.store.order) == null ? void 0 : _a.getTempOrder()) ?? null;
|
|
694
|
+
const salesDetail = this.getSalesOrder();
|
|
695
|
+
const bookings = (salesDetail == null ? void 0 : salesDetail.bookings) ?? ((tempOrder == null ? void 0 : tempOrder.bookings) || []);
|
|
696
|
+
let operatingDayBoundary;
|
|
697
|
+
try {
|
|
698
|
+
operatingDayBoundary = this.getAppData("operating_day_boundary");
|
|
699
|
+
} catch {
|
|
700
|
+
operatingDayBoundary = void 0;
|
|
701
|
+
}
|
|
702
|
+
const shopOpeningHours = (operatingDayBoundary == null ? void 0 : operatingDayBoundary.type) === "start_time" ? "23:59" : operatingDayBoundary == null ? void 0 : operatingDayBoundary.time;
|
|
703
|
+
return (0, import_cartView.buildCartView)((tempOrder == null ? void 0 : tempOrder.products) || [], bookings, {
|
|
704
|
+
addTimeProducts: this.addTimeProductsCatalog,
|
|
705
|
+
bookingConfig: this.getBookingConfig(),
|
|
706
|
+
productsByUid: (_b = tempOrder == null ? void 0 : tempOrder._extend) == null ? void 0 : _b.productsByUid,
|
|
707
|
+
shopOpeningHours
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* 获取当前下单客户(与 OrderModule.tempOrder snapshot 一致)。
|
|
712
|
+
*/
|
|
713
|
+
getCustomer() {
|
|
714
|
+
return this.getOrderCustomerSnapshot();
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* 通过 ids 获取商品列表(不加载到模块中)
|
|
718
|
+
* @returns 商品列表
|
|
719
|
+
*/
|
|
720
|
+
async getProductByIds(ids) {
|
|
721
|
+
return this.store.products.getProductByIds(ids);
|
|
722
|
+
}
|
|
139
723
|
/**
|
|
140
724
|
* 获取日程时间段点
|
|
141
725
|
* @param params 参数
|
|
142
726
|
* @returns 日程时间段点
|
|
143
727
|
*/
|
|
144
728
|
async getScheduleTimePoints(params) {
|
|
145
|
-
const result = await this.request.post(
|
|
729
|
+
const result = await this.request.post("/menu/schedule-time-points", {
|
|
146
730
|
menu_list_ids: params.menu_list_ids
|
|
147
731
|
}, {
|
|
148
732
|
osServer: true
|
|
149
733
|
});
|
|
150
734
|
return result.data || [];
|
|
151
735
|
}
|
|
152
|
-
|
|
153
736
|
/**
|
|
154
737
|
* 获取客户列表
|
|
155
738
|
* @param params 查询参数
|
|
@@ -160,11 +743,10 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
160
743
|
const result = await this.store.customer.getCustomerList(params);
|
|
161
744
|
return result;
|
|
162
745
|
} catch (error) {
|
|
163
|
-
console.error(
|
|
746
|
+
console.error("Failed to get customer list:", error);
|
|
164
747
|
throw error;
|
|
165
748
|
}
|
|
166
749
|
}
|
|
167
|
-
|
|
168
750
|
/**
|
|
169
751
|
* 设置活跃客户
|
|
170
752
|
* @param customer 客户信息
|
|
@@ -175,7 +757,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
175
757
|
customer
|
|
176
758
|
});
|
|
177
759
|
}
|
|
178
|
-
|
|
179
760
|
/**
|
|
180
761
|
* 获取当前活跃客户
|
|
181
762
|
* @returns 当前活跃客户
|
|
@@ -183,7 +764,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
183
764
|
getActiveCustomer() {
|
|
184
765
|
return this.store.customer.getSelectedCustomer();
|
|
185
766
|
}
|
|
186
|
-
|
|
187
767
|
/**
|
|
188
768
|
* 根据ID设置选中的客户
|
|
189
769
|
* @param customerId 客户ID
|
|
@@ -197,7 +777,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
197
777
|
});
|
|
198
778
|
}
|
|
199
779
|
}
|
|
200
|
-
|
|
201
780
|
/**
|
|
202
781
|
* 获取所有客户
|
|
203
782
|
* @returns 客户列表
|
|
@@ -205,7 +784,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
205
784
|
getCustomers() {
|
|
206
785
|
return this.store.customer.getCustomers();
|
|
207
786
|
}
|
|
208
|
-
|
|
209
787
|
/**
|
|
210
788
|
* 根据ID获取客户
|
|
211
789
|
* @param customerId 客户ID
|
|
@@ -214,14 +792,12 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
214
792
|
getCustomerById(customerId) {
|
|
215
793
|
return this.store.customer.getCustomerById(customerId);
|
|
216
794
|
}
|
|
217
|
-
|
|
218
795
|
/**
|
|
219
796
|
* 清空客户列表
|
|
220
797
|
*/
|
|
221
798
|
clearCustomers() {
|
|
222
799
|
this.store.customer.clearCustomers();
|
|
223
800
|
}
|
|
224
|
-
|
|
225
801
|
/**
|
|
226
802
|
* 添加客户到列表第一位
|
|
227
803
|
* @param customer 要添加的客户信息
|
|
@@ -229,7 +805,147 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
229
805
|
addCustomerToFirst(customer) {
|
|
230
806
|
this.store.customer.addCustomerToFirst(customer);
|
|
231
807
|
}
|
|
232
|
-
|
|
808
|
+
// ─── 下单客户(基于 OrderModule.tempOrder,单一真源)───
|
|
809
|
+
// 与老的 setActiveCustomer/getActiveCustomer 解耦:
|
|
810
|
+
// - 老路:写入 CustomerModule.selectedCustomer(保留兼容,存量调用方不动)
|
|
811
|
+
// - 新路:写入 tempOrder 的 customer 协议字段 + _extend.customerSnapshot
|
|
812
|
+
// 新业务(如 SalesSdk)应优先使用本组方法。
|
|
813
|
+
/**
|
|
814
|
+
* 设置当前下单客户。
|
|
815
|
+
*
|
|
816
|
+
* @param customer 完整客户对象;null 表示清空
|
|
817
|
+
*
|
|
818
|
+
* 内部将 customer 格式化为 tempOrder 协议字段后写入 OrderModule,
|
|
819
|
+
* 并以 customer 作为 snapshot 保存富字段。
|
|
820
|
+
*
|
|
821
|
+
* 同时透传 OrderModule 内部 emit 的 `order:onOrderCustomerChange` 之外,
|
|
822
|
+
* 在 BookingTicket 命名空间也 emit 一次,方便上层统一从 Solution 订阅。
|
|
823
|
+
*/
|
|
824
|
+
setOrderCustomer(customer) {
|
|
825
|
+
var _a;
|
|
826
|
+
if (!customer) {
|
|
827
|
+
this.clearOrderCustomer();
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
const previousCustomerId = (_a = this.store.order.getOrderCustomer()) == null ? void 0 : _a.customer_id;
|
|
831
|
+
const snapshotBeforeSet = this.store.order.getOrderCustomerSnapshot();
|
|
832
|
+
const patch = (0, import_orderCustomer.formatOrderCustomerPatch)(customer);
|
|
833
|
+
const customerUnchanged = Number(previousCustomerId || 0) === Number(patch.customer_id || 0);
|
|
834
|
+
if (!customerUnchanged) {
|
|
835
|
+
this.discountConfigCacheKey = null;
|
|
836
|
+
this.hasManualDiscountSelection = false;
|
|
837
|
+
}
|
|
838
|
+
this.store.order.setOrderCustomer(patch, customer);
|
|
839
|
+
const snapshotAfterOrderSet = this.store.order.getOrderCustomerSnapshot();
|
|
840
|
+
if (customerUnchanged) {
|
|
841
|
+
const snapshotReplenished = !snapshotBeforeSet && Boolean(snapshotAfterOrderSet);
|
|
842
|
+
if (snapshotReplenished) {
|
|
843
|
+
const next2 = this.buildOrderCustomerPayload();
|
|
844
|
+
this.core.effects.emit(`${this.name}:onOrderCustomerChange`, next2);
|
|
845
|
+
}
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
const next = this.buildOrderCustomerPayload();
|
|
849
|
+
this.core.effects.emit(`${this.name}:onOrderCustomerChange`, next);
|
|
850
|
+
this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
851
|
+
void this.store.order.applyPromotion().catch((error) => {
|
|
852
|
+
console.error("[BookingTicket] applyPromotion after customer change failed", error);
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* 读取 tempOrder 上的下单客户协议字段;customer_id 缺失时返回 null。
|
|
857
|
+
*/
|
|
858
|
+
getOrderCustomer() {
|
|
859
|
+
return this.store.order.getOrderCustomer();
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* 读取 tempOrder._extend.customerSnapshot 中的完整客户对象。
|
|
863
|
+
*/
|
|
864
|
+
getOrderCustomerSnapshot() {
|
|
865
|
+
return this.store.order.getOrderCustomerSnapshot();
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* 清空下单客户(协议字段 + snapshot)。
|
|
869
|
+
*/
|
|
870
|
+
clearOrderCustomer() {
|
|
871
|
+
var _a, _b;
|
|
872
|
+
this.store.order.clearOrderCustomer();
|
|
873
|
+
this.discountConfigCacheKey = null;
|
|
874
|
+
this.hasManualDiscountSelection = false;
|
|
875
|
+
const orderStore = this.store.order.store || {};
|
|
876
|
+
const discountModule = orderStore.discount;
|
|
877
|
+
void ((_a = discountModule == null ? void 0 : discountModule.setOriginalDiscountList) == null ? void 0 : _a.call(discountModule, []));
|
|
878
|
+
void ((_b = discountModule == null ? void 0 : discountModule.setDiscountList) == null ? void 0 : _b.call(discountModule, []));
|
|
879
|
+
this.store.order.applyDiscount();
|
|
880
|
+
void this.store.order.recalculateSummary({ createIfMissing: true }).then(() => {
|
|
881
|
+
var _a2;
|
|
882
|
+
const tempOrder = this.store.order.ensureTempOrder();
|
|
883
|
+
this.store.order.persistTempOrder();
|
|
884
|
+
return this.effectsEmit("onDiscountApplied", {
|
|
885
|
+
productList: tempOrder.products || [],
|
|
886
|
+
discountList: ((_a2 = discountModule == null ? void 0 : discountModule.getDiscountList) == null ? void 0 : _a2.call(discountModule)) || [],
|
|
887
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
888
|
+
tempOrder
|
|
889
|
+
});
|
|
890
|
+
}).catch((error) => {
|
|
891
|
+
console.error("Failed to recalculate summary after clearing customer:", error);
|
|
892
|
+
});
|
|
893
|
+
this.core.effects.emit(`${this.name}:onOrderCustomerChange`, null);
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* 重置 tempOrder,并同步清空下单客户运行态。
|
|
897
|
+
*
|
|
898
|
+
* OrderModule.restoreOrder 会重建空单(customer_id 已为 null),但不会:
|
|
899
|
+
* - emit BookingTicket `onOrderCustomerChange`
|
|
900
|
+
* - 重置 CustomerModule.selectedCustomer(老路 getActiveCustomer)
|
|
901
|
+
*
|
|
902
|
+
* 因此在 super.restoreOrder 之后显式清客户,保证 SalesSdk / ticketBooking 订阅方与 tempOrder 一致。
|
|
903
|
+
*/
|
|
904
|
+
async restoreOrder() {
|
|
905
|
+
var _a;
|
|
906
|
+
const tempOrder = await super.restoreOrder();
|
|
907
|
+
this.clearOrderCustomer();
|
|
908
|
+
(_a = this.store.customer) == null ? void 0 : _a.setSelectedCustomer(null);
|
|
909
|
+
return tempOrder;
|
|
910
|
+
}
|
|
911
|
+
/** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
|
|
912
|
+
buildOrderCustomerPayload() {
|
|
913
|
+
const patch = this.store.order.getOrderCustomer();
|
|
914
|
+
if (!patch)
|
|
915
|
+
return null;
|
|
916
|
+
return {
|
|
917
|
+
patch,
|
|
918
|
+
snapshot: this.store.order.getOrderCustomerSnapshot()
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
922
|
+
if (!customerId || customerId === 1)
|
|
923
|
+
return;
|
|
924
|
+
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
const previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
928
|
+
const refreshTask = (async () => {
|
|
929
|
+
if (previousRefresh) {
|
|
930
|
+
await previousRefresh.catch(() => void 0);
|
|
931
|
+
}
|
|
932
|
+
const currentCustomer = this.store.order.getOrderCustomer();
|
|
933
|
+
if (!currentCustomer || Number(currentCustomer.customer_id) !== customerId) {
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
await this.loadDiscountConfig({ customerId });
|
|
937
|
+
})();
|
|
938
|
+
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
939
|
+
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
940
|
+
refreshTask.catch((error) => {
|
|
941
|
+
console.error("Failed to load discount config after customer change:", error);
|
|
942
|
+
}).finally(() => {
|
|
943
|
+
if (this.orderCustomerDiscountRefreshInFlight !== refreshTask)
|
|
944
|
+
return;
|
|
945
|
+
this.orderCustomerDiscountRefreshInFlight = null;
|
|
946
|
+
this.orderCustomerDiscountRefreshCustomerId = null;
|
|
947
|
+
});
|
|
948
|
+
}
|
|
233
949
|
/**
|
|
234
950
|
* 获取客户分页信息
|
|
235
951
|
* @returns 分页信息
|
|
@@ -237,7 +953,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
237
953
|
getCustomerPaginationInfo() {
|
|
238
954
|
return this.store.customer.getPaginationInfo();
|
|
239
955
|
}
|
|
240
|
-
|
|
241
956
|
/**
|
|
242
957
|
* 获取客户列表总数
|
|
243
958
|
* @returns 总数
|
|
@@ -245,7 +960,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
245
960
|
getCustomerTotal() {
|
|
246
961
|
return this.store.customer.getState().total;
|
|
247
962
|
}
|
|
248
|
-
|
|
249
963
|
/**
|
|
250
964
|
* 设置客户分页信息
|
|
251
965
|
* @param page 页码
|
|
@@ -254,7 +968,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
254
968
|
setCustomerPaginationInfo(page, pageSize) {
|
|
255
969
|
this.store.customer.setPaginationInfo(page, pageSize);
|
|
256
970
|
}
|
|
257
|
-
|
|
258
971
|
/**
|
|
259
972
|
* 便捷方法:切换客户分页并自动获取数据
|
|
260
973
|
* @param page 页码
|
|
@@ -263,14 +976,16 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
263
976
|
*/
|
|
264
977
|
async changeCustomerPage(page, pageSize) {
|
|
265
978
|
try {
|
|
266
|
-
const result = await this.store.customer.changeCustomerPage(
|
|
979
|
+
const result = await this.store.customer.changeCustomerPage(
|
|
980
|
+
page,
|
|
981
|
+
pageSize
|
|
982
|
+
);
|
|
267
983
|
return result;
|
|
268
984
|
} catch (error) {
|
|
269
|
-
console.error(
|
|
985
|
+
console.error("Failed to change customer page:", error);
|
|
270
986
|
throw error;
|
|
271
987
|
}
|
|
272
988
|
}
|
|
273
|
-
|
|
274
989
|
/**
|
|
275
990
|
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
276
991
|
* @returns 客户列表响应
|
|
@@ -281,11 +996,10 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
281
996
|
this.core.effects.emit(`${this.name}:onCustomerListUpdate`, result);
|
|
282
997
|
return result;
|
|
283
998
|
} catch (error) {
|
|
284
|
-
console.error(
|
|
999
|
+
console.error("Failed to load more customers:", error);
|
|
285
1000
|
throw error;
|
|
286
1001
|
}
|
|
287
1002
|
}
|
|
288
|
-
|
|
289
1003
|
/**
|
|
290
1004
|
* 重置并重新开始滚动加载客户数据
|
|
291
1005
|
* @param params 查询参数
|
|
@@ -297,11 +1011,10 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
297
1011
|
this.core.effects.emit(`${this.name}:onCustomerListReset`, result);
|
|
298
1012
|
return result;
|
|
299
1013
|
} catch (error) {
|
|
300
|
-
console.error(
|
|
1014
|
+
console.error("Failed to reset and load customers:", error);
|
|
301
1015
|
throw error;
|
|
302
1016
|
}
|
|
303
1017
|
}
|
|
304
|
-
|
|
305
1018
|
/**
|
|
306
1019
|
* 检查是否还有更多客户数据可以加载
|
|
307
1020
|
* @returns 是否还有更多数据
|
|
@@ -309,7 +1022,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
309
1022
|
hasMoreCustomers() {
|
|
310
1023
|
return this.store.customer.hasMoreCustomers();
|
|
311
1024
|
}
|
|
312
|
-
|
|
313
1025
|
/**
|
|
314
1026
|
* 获取当前的客户搜索条件
|
|
315
1027
|
* @returns 当前搜索条件
|
|
@@ -317,7 +1029,6 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
317
1029
|
getCurrentCustomerSearchParams() {
|
|
318
1030
|
return this.store.customer.getCurrentSearchParams();
|
|
319
1031
|
}
|
|
320
|
-
|
|
321
1032
|
/**
|
|
322
1033
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
323
1034
|
* @returns 客户状态
|
|
@@ -325,123 +1036,96 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
325
1036
|
getCustomerState() {
|
|
326
1037
|
return this.store.customer.getState();
|
|
327
1038
|
}
|
|
328
|
-
|
|
329
1039
|
/**
|
|
330
1040
|
* 全局扫描监听
|
|
331
1041
|
* @param callback 回调
|
|
332
1042
|
*/
|
|
333
1043
|
scanGlobalListener(callback) {
|
|
334
|
-
const localSearch = v => this.store.products.findProductsByCodeOrBarcode(v);
|
|
335
|
-
const scanCallback = (0,
|
|
336
|
-
|
|
1044
|
+
const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
|
|
1045
|
+
const scanCallback = (0, import_handleScan.handleGlobalScan)(
|
|
1046
|
+
this.request,
|
|
1047
|
+
localSearch,
|
|
1048
|
+
this.getSubmitOrderSalesChannel()
|
|
1049
|
+
);
|
|
1050
|
+
const safeCallback = (d) => {
|
|
337
1051
|
try {
|
|
338
1052
|
callback(d);
|
|
339
1053
|
} catch (error) {
|
|
340
|
-
console.error(
|
|
1054
|
+
console.error("scanGlobalListener传入的回调函数异常", error);
|
|
341
1055
|
}
|
|
342
1056
|
};
|
|
343
|
-
const listener = {
|
|
344
|
-
key: 'global',
|
|
345
|
-
callback: safeCallback
|
|
346
|
-
};
|
|
1057
|
+
const listener = { key: "global", callback: safeCallback };
|
|
347
1058
|
const removeListener = this.scan.addListener(listener, scanCallback);
|
|
348
1059
|
return removeListener;
|
|
349
1060
|
}
|
|
350
|
-
|
|
351
1061
|
/**
|
|
352
1062
|
* 客户扫描监听
|
|
353
1063
|
* @param callback 回调
|
|
354
1064
|
*/
|
|
355
1065
|
scanCustomerListener(callback) {
|
|
356
|
-
const scanCallback = (0,
|
|
357
|
-
const safeCallback = d => {
|
|
1066
|
+
const scanCallback = (0, import_handleScan.handleCustomerScan)();
|
|
1067
|
+
const safeCallback = (d) => {
|
|
358
1068
|
try {
|
|
359
1069
|
callback(d);
|
|
360
1070
|
} catch (error) {
|
|
361
|
-
console.error(
|
|
1071
|
+
console.error("scanCustomerListener传入的回调函数异常", error);
|
|
362
1072
|
}
|
|
363
1073
|
};
|
|
364
|
-
const listener = {
|
|
365
|
-
key: 'customer',
|
|
366
|
-
callback: safeCallback
|
|
367
|
-
};
|
|
1074
|
+
const listener = { key: "customer", callback: safeCallback };
|
|
368
1075
|
const removeListener = this.scan.addListener(listener, scanCallback);
|
|
369
1076
|
return removeListener;
|
|
370
1077
|
}
|
|
371
|
-
|
|
372
1078
|
/**
|
|
373
1079
|
* @title 通用扫描监听
|
|
374
1080
|
* @description 直接将扫描结果返回给调用方
|
|
375
1081
|
* @param callback 回调
|
|
376
1082
|
*/
|
|
377
1083
|
scanUniversalListener(callback, key) {
|
|
378
|
-
const scanCallback = (0,
|
|
379
|
-
const safeCallback = d => {
|
|
1084
|
+
const scanCallback = (0, import_handleScan.handleUniversalScan)();
|
|
1085
|
+
const safeCallback = (d) => {
|
|
380
1086
|
try {
|
|
381
1087
|
callback(d);
|
|
382
1088
|
} catch (error) {
|
|
383
|
-
console.error(
|
|
1089
|
+
console.error(
|
|
1090
|
+
`scanUniversalListener传入的回调函数异常, key: ${key}`,
|
|
1091
|
+
error
|
|
1092
|
+
);
|
|
384
1093
|
}
|
|
385
1094
|
};
|
|
386
|
-
const listener = {
|
|
387
|
-
key,
|
|
388
|
-
callback: safeCallback
|
|
389
|
-
};
|
|
1095
|
+
const listener = { key, callback: safeCallback };
|
|
390
1096
|
const removeListener = this.scan.addListener(listener, scanCallback);
|
|
391
1097
|
return removeListener;
|
|
392
1098
|
}
|
|
393
|
-
|
|
394
1099
|
/**
|
|
395
1100
|
* 调用摄像头
|
|
396
1101
|
* @param data 用户自定义数据
|
|
397
1102
|
*/
|
|
398
1103
|
activateCamera(data) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
1104
|
+
var _a, _b, _c, _d;
|
|
1105
|
+
(_d = (_c = (_b = (_a = this.window) == null ? void 0 : _a.interaction) == null ? void 0 : _b.utils) == null ? void 0 : _c.postMessageToApp) == null ? void 0 : _d.call(_c, {
|
|
1106
|
+
module: "global",
|
|
1107
|
+
key: "active_native_scanner",
|
|
402
1108
|
data
|
|
403
1109
|
});
|
|
404
1110
|
}
|
|
405
|
-
|
|
406
1111
|
/**
|
|
407
1112
|
* 禁用所有扫描监听
|
|
408
1113
|
*/
|
|
409
1114
|
disableAllScanListeners() {
|
|
410
1115
|
this.scan.disableAllListeners();
|
|
411
1116
|
}
|
|
412
|
-
|
|
413
1117
|
/**
|
|
414
1118
|
* 启用所有扫描监听
|
|
415
1119
|
*/
|
|
416
1120
|
enableAllScanListeners() {
|
|
417
1121
|
this.scan.enableAllListeners();
|
|
418
1122
|
}
|
|
419
|
-
|
|
420
1123
|
/**
|
|
421
1124
|
* 清空所有扫描监听对应的任务执行队列
|
|
422
1125
|
*/
|
|
423
1126
|
clearAllScanListenersTaskQueue() {
|
|
424
1127
|
this.scan.clearTaskQueue();
|
|
425
1128
|
}
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* 设置其他参数
|
|
429
|
-
* @param params 参数
|
|
430
|
-
* @param options 选项
|
|
431
|
-
*/
|
|
432
|
-
async setOtherParams(params, {
|
|
433
|
-
cover = false
|
|
434
|
-
} = {}) {
|
|
435
|
-
if (cover) {
|
|
436
|
-
this.otherParams = params;
|
|
437
|
-
} else {
|
|
438
|
-
this.otherParams = {
|
|
439
|
-
...this.otherParams,
|
|
440
|
-
...params
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
1129
|
/**
|
|
446
1130
|
* 获取其他参数
|
|
447
1131
|
* @returns 其他参数
|
|
@@ -449,24 +1133,530 @@ class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
|
449
1133
|
async getOtherParams() {
|
|
450
1134
|
return this.otherParams;
|
|
451
1135
|
}
|
|
452
|
-
|
|
1136
|
+
// ─── BookingContext API(透传给 BookingContextModule) ──────────────────────
|
|
1137
|
+
// SalesSdkProvider 挂载时默认调 initBookingContext;也可由 UI 显式 set* 灌入已有数据。
|
|
1138
|
+
/** 拉取 board config 并写入 BookingContext。 */
|
|
1139
|
+
loadBookingConfig(params) {
|
|
1140
|
+
return this.store.bookingContext.loadBookingConfig(params);
|
|
1141
|
+
}
|
|
1142
|
+
/** 拉取资源全集并写入 BookingContext。 */
|
|
1143
|
+
loadBookingResources(params) {
|
|
1144
|
+
return this.store.bookingContext.loadResources(params);
|
|
1145
|
+
}
|
|
1146
|
+
/** 初始化 BookingContext(date + config + resources)。 */
|
|
1147
|
+
initBookingContext(params) {
|
|
1148
|
+
return this.store.bookingContext.initBookingContext(params);
|
|
1149
|
+
}
|
|
1150
|
+
/** 当前 store 是否已具备与入参等价的 config / resources(无需再请求接口)。 */
|
|
1151
|
+
isBookingContextReady(params) {
|
|
1152
|
+
return this.store.bookingContext.isBookingContextReady(params);
|
|
1153
|
+
}
|
|
1154
|
+
/** 写入 booking config(来源:`/core/board/management/config`)。 */
|
|
1155
|
+
setBookingConfig(config) {
|
|
1156
|
+
this.store.bookingContext.setBookingConfig(config);
|
|
1157
|
+
}
|
|
1158
|
+
/** 读取当前 booking config。 */
|
|
1159
|
+
getBookingConfig() {
|
|
1160
|
+
return this.store.bookingContext.getBookingConfig();
|
|
1161
|
+
}
|
|
1162
|
+
/** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
|
|
1163
|
+
setResources(resources) {
|
|
1164
|
+
this.store.bookingContext.setResources(resources);
|
|
1165
|
+
}
|
|
1166
|
+
/** 读取资源全集(浅克隆)。 */
|
|
1167
|
+
getResourcesOrigin() {
|
|
1168
|
+
return this.store.bookingContext.getResourcesOrigin();
|
|
1169
|
+
}
|
|
1170
|
+
/** 读取资源全集 map(id → resource)。 */
|
|
1171
|
+
getResourcesOriginMap() {
|
|
1172
|
+
return this.store.bookingContext.getResourcesOriginMap();
|
|
1173
|
+
}
|
|
1174
|
+
/** 写入当前选择的日期;支持 dayjs / Date / string。 */
|
|
1175
|
+
setBookingDate(date) {
|
|
1176
|
+
this.store.bookingContext.setDate(date);
|
|
1177
|
+
}
|
|
1178
|
+
/** 读取当前选择的日期(统一 string)。 */
|
|
1179
|
+
getBookingDate() {
|
|
1180
|
+
return this.store.bookingContext.getDate();
|
|
1181
|
+
}
|
|
1182
|
+
/** 读取 BookingContext 完整 store(调试 / 测试 / 透传给 SDK 使用)。 */
|
|
1183
|
+
getBookingContextState() {
|
|
1184
|
+
return this.store.bookingContext.getState();
|
|
1185
|
+
}
|
|
1186
|
+
/** 清空 BookingContext(切租户 / destroy 场景)。 */
|
|
1187
|
+
clearBookingContext() {
|
|
1188
|
+
this.store.bookingContext.clear();
|
|
1189
|
+
}
|
|
453
1190
|
/**
|
|
454
|
-
*
|
|
455
|
-
*/
|
|
456
|
-
|
|
457
|
-
this.store.
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
_scanCache.default.clear();
|
|
1191
|
+
* 构造 BookingContext 计算上下文(供 getProductExtend / getResourceByIds 等读 API 复用)。
|
|
1192
|
+
*/
|
|
1193
|
+
buildBookingCalcContext(extra) {
|
|
1194
|
+
const state = this.store.bookingContext.getState();
|
|
1195
|
+
const date = (extra == null ? void 0 : extra.date) ?? state.date;
|
|
1196
|
+
return {
|
|
1197
|
+
bookingConfig: state.bookingConfig,
|
|
1198
|
+
resourcesOrigin: state.resourcesOrigin,
|
|
1199
|
+
resourcesOriginMap: state.resourcesOriginMap,
|
|
1200
|
+
date,
|
|
1201
|
+
presetStartTime: (extra == null ? void 0 : extra.presetStartTime) ?? (0, import_BookingContext.derivePresetStartTimeFromDate)(date),
|
|
1202
|
+
...extra || {}
|
|
1203
|
+
};
|
|
468
1204
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
1205
|
+
/**
|
|
1206
|
+
* 取商品当前可选资源列表(透传 OS BookingContext utils#getResourceByIds)。
|
|
1207
|
+
* `extraResources` 用于把拖入未绑定的资源也展示出来。
|
|
1208
|
+
*/
|
|
1209
|
+
getResourcesForProduct(product, options) {
|
|
1210
|
+
var _a, _b;
|
|
1211
|
+
const ctx = this.buildBookingCalcContext();
|
|
1212
|
+
return (0, import_BookingContext.getResourceByIds)(ctx.resourcesOriginMap || {}, product, {
|
|
1213
|
+
resourceTab: (_b = (_a = ctx.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.resource_tab,
|
|
1214
|
+
resourcesOrigin: ctx.resourcesOrigin,
|
|
1215
|
+
extraResources: (options == null ? void 0 : options.extraResources) || []
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* 拼装 cacheItem 的 _extend / _data(资源 / 容量 / timeObj),与 info2 `getProductExtend` 等价。
|
|
1220
|
+
*/
|
|
1221
|
+
getProductExtend(cacheItem, extra) {
|
|
1222
|
+
const preparedCacheItem = withProductOptionString(cacheItem);
|
|
1223
|
+
const result = (0, import_BookingContext.getProductExtend)({
|
|
1224
|
+
cacheItem: preparedCacheItem,
|
|
1225
|
+
ctx: this.buildBookingCalcContext(extra)
|
|
1226
|
+
});
|
|
1227
|
+
return result;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
|
|
1231
|
+
*/
|
|
1232
|
+
getResourceErrors(resource, cacheItem) {
|
|
1233
|
+
return (0, import_BookingContext.getResourceErrors)(resource, cacheItem);
|
|
1234
|
+
}
|
|
1235
|
+
// ─── addProduct 决策 / 转换 API(SDK 加车下沉所需) ─────────────────────────
|
|
1236
|
+
// 这一组方法是 SalesSdkCartContext.addProduct / confirmDetail 的 OS 后端。
|
|
1237
|
+
// 调用方传入 ProductData,OS 自取 bookingContext / customer / date 等上下文,
|
|
1238
|
+
// 输出 (a) autoClose 决策结果或 (b) `{ product, booking }` 协议入参。
|
|
1239
|
+
/**
|
|
1240
|
+
* session 商品 catalog 日期与 TimeBar 不一致时写业务日志。
|
|
1241
|
+
*
|
|
1242
|
+
* @example
|
|
1243
|
+
* this.logSessionCatalogDateMismatch(product, ctx.date);
|
|
1244
|
+
*/
|
|
1245
|
+
logSessionCatalogDateMismatch(item, bookingDate) {
|
|
1246
|
+
var _a, _b;
|
|
1247
|
+
const logger = this.logger;
|
|
1248
|
+
if (!(logger == null ? void 0 : logger.addLog))
|
|
1249
|
+
return;
|
|
1250
|
+
const tempOrder = (_a = this.getTempOrder) == null ? void 0 : _a.call(this);
|
|
1251
|
+
const staleInfo = (0, import_sessionCatalogStale.buildSessionCatalogStaleInfo)(item, bookingDate);
|
|
1252
|
+
logger.addLog({
|
|
1253
|
+
type: "warning",
|
|
1254
|
+
title: `[BookingTicket] session catalog date mismatch, reload products`,
|
|
1255
|
+
metadata: {
|
|
1256
|
+
order_id: (tempOrder == null ? void 0 : tempOrder.order_id) ?? null,
|
|
1257
|
+
external_sale_number: (tempOrder == null ? void 0 : tempOrder.external_sale_number) ?? null,
|
|
1258
|
+
...staleInfo,
|
|
1259
|
+
cartDetailValueSession: ((_b = item == null ? void 0 : item.cartDetailValue) == null ? void 0 : _b.session) ?? null
|
|
1260
|
+
}
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* 加车前:session 商品 catalog 日历日与 bookingDate 不一致时中断加购,交由 SDK reload products。
|
|
1265
|
+
*/
|
|
1266
|
+
resolveSessionCatalogBeforeAdd(item, ctx) {
|
|
1267
|
+
if (!(0, import_sessionCatalogStale.isSessionCatalogDateStale)(item, ctx.date)) {
|
|
1268
|
+
return null;
|
|
1269
|
+
}
|
|
1270
|
+
this.logSessionCatalogDateMismatch(item, ctx.date);
|
|
1271
|
+
return { action: "reloadCatalog" };
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* 拼装 addProductDecision 通用上下文(从 store 自取)。
|
|
1275
|
+
*/
|
|
1276
|
+
buildAddProductCtx(extra) {
|
|
1277
|
+
var _a, _b;
|
|
1278
|
+
const bookingContextState = this.store.bookingContext.getState();
|
|
1279
|
+
const date = (extra == null ? void 0 : extra.date) ?? bookingContextState.date;
|
|
1280
|
+
const orderCustomerId = ((_a = this.getOrderCustomerSnapshot()) == null ? void 0 : _a.id) ?? ((_b = this.store.order.getTempOrder()) == null ? void 0 : _b.customer_id) ?? void 0;
|
|
1281
|
+
return {
|
|
1282
|
+
bookingConfig: bookingContextState.bookingConfig,
|
|
1283
|
+
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
1284
|
+
resourcesOriginMap: bookingContextState.resourcesOriginMap,
|
|
1285
|
+
date,
|
|
1286
|
+
presetStartTime: (extra == null ? void 0 : extra.presetStartTime) ?? (0, import_BookingContext.derivePresetStartTimeFromDate)(date),
|
|
1287
|
+
customerId: orderCustomerId,
|
|
1288
|
+
...extra || {}
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
1293
|
+
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
1294
|
+
*/
|
|
1295
|
+
decideAddProduct(item, options) {
|
|
1296
|
+
const ctx = this.buildAddProductCtx(options);
|
|
1297
|
+
const staleDecision = this.resolveSessionCatalogBeforeAdd(item, ctx);
|
|
1298
|
+
if (staleDecision) {
|
|
1299
|
+
return staleDecision;
|
|
1300
|
+
}
|
|
1301
|
+
return (0, import_addProductDecision.decideAddProduct)(item, ctx);
|
|
1302
|
+
}
|
|
1303
|
+
/** 规格弹窗 callback 后的第二段决策。 */
|
|
1304
|
+
decideAfterDetail(cacheItem, options) {
|
|
1305
|
+
return (0, import_addProductDecision.decideAfterDetail)(cacheItem, this.buildAddProductCtx(options));
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* @deprecated 请用 `decideAddProduct`;`autoClose=true` 仅当 action=add。
|
|
1309
|
+
*/
|
|
1310
|
+
decideAutoClose(item, options) {
|
|
1311
|
+
return (0, import_addProductDecision.decideAutoClose)(item, this.buildAddProductCtx(options));
|
|
1312
|
+
}
|
|
1313
|
+
/** 替代 info2 `getIsEject`:商品是否需要弹窗(0/1)。 */
|
|
1314
|
+
getIsEject(item, type = "select") {
|
|
1315
|
+
return (0, import_addProductDecision.getIsEject)(item, type);
|
|
1316
|
+
}
|
|
1317
|
+
/** 仅 session 商品(无 variant/option/package)→ true。 */
|
|
1318
|
+
getIsOnlySession(item) {
|
|
1319
|
+
return (0, import_addProductDecision.getIsOnlySession)(item);
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* 拼装 requiresDetail payload(给 SDK 直接 return 给 UI 用)。
|
|
1323
|
+
*/
|
|
1324
|
+
buildRequiresDetailPayload(item, options) {
|
|
1325
|
+
const ctx = this.buildAddProductCtx(options);
|
|
1326
|
+
return (0, import_addProductDecision.buildRequiresDetailPayload)(item, ctx);
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* 把 detail 弹窗回调结果(e, extension_type, detail)转换为 `(product, booking)` 入参。
|
|
1330
|
+
* 内部会先拼 cacheItem,再走 cacheItemToBookingInput 严格协议对齐。
|
|
1331
|
+
*/
|
|
1332
|
+
transformDetailToProductAndBooking(input) {
|
|
1333
|
+
const { item, cacheItem: preparedCacheItem, detailResult, options } = input;
|
|
1334
|
+
const ctx = this.buildAddProductCtx(options);
|
|
1335
|
+
const cacheItem = preparedCacheItem || (detailResult ? (0, import_addProductDecision.buildCacheItemFromDetail)(item, detailResult, ctx) : (0, import_addProductDecision.buildCacheItemFromCartDetail)(item, ctx));
|
|
1336
|
+
return (0, import_addProductDecision.transformDetailToProductAndBooking)(cacheItem, ctx);
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* 从已加车的 order line + booking 反查资源编辑抽屉所需的 cacheItem。
|
|
1340
|
+
* 供 SalesSdk「编辑资源」等场景使用;字段语义与 buildCacheItemFromDetail 产出对齐。
|
|
1341
|
+
*/
|
|
1342
|
+
buildCacheItemFromOrderLine(input) {
|
|
1343
|
+
return (0, import_buildCacheItemFromOrderLine.buildCacheItemFromOrderLine)(input);
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
1347
|
+
*/
|
|
1348
|
+
buildNormalProductCacheItemFromOrderLine(input) {
|
|
1349
|
+
return (0, import_buildNormalProductCacheItemFromOrderLine.buildNormalProductCacheItemFromOrderLine)(input);
|
|
1350
|
+
}
|
|
1351
|
+
/** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
|
|
1352
|
+
async updateProductInOrder(params) {
|
|
1353
|
+
return this.updateOrderProduct(params);
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* 全局扫码 pubsub 入口:解析码值 → 搜索 → 业务分发(客户 / 加车 / 开单)。
|
|
1357
|
+
* UI 层在 pubsub 订阅回调里注入 `bridge`(uiHosts / action / cart.confirm*)。
|
|
1358
|
+
*
|
|
1359
|
+
* @example
|
|
1360
|
+
* ```ts
|
|
1361
|
+
* await bookingTicket.handleGlobalScanCode(payload.data, {
|
|
1362
|
+
* openProductDetail: uiHosts.openProductDetail,
|
|
1363
|
+
* confirmDetail: cart.confirmDetail,
|
|
1364
|
+
* openOrder: ({ order_id }) => action({ type: 'pisell1.handleOpenCachedBigSale', data: { order_id } }),
|
|
1365
|
+
* });
|
|
1366
|
+
* ```
|
|
1367
|
+
*/
|
|
1368
|
+
async handleGlobalScanCode(code, bridge) {
|
|
1369
|
+
var _a, _b, _c, _d;
|
|
1370
|
+
const trimmed = typeof code === "string" ? code.trim() : "";
|
|
1371
|
+
if (!trimmed) {
|
|
1372
|
+
(_a = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _a.call(bridge, "fail", "pisell2.text.scan-global-failed");
|
|
1373
|
+
return { status: "failed", reason: "empty_code" };
|
|
1374
|
+
}
|
|
1375
|
+
try {
|
|
1376
|
+
const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
|
|
1377
|
+
const scanCallback = (0, import_handleScan.handleGlobalScan)(
|
|
1378
|
+
this.request,
|
|
1379
|
+
localSearch,
|
|
1380
|
+
this.getSubmitOrderSalesChannel()
|
|
1381
|
+
);
|
|
1382
|
+
const raw = await scanCallback({ type: "nativeScanner", value: trimmed });
|
|
1383
|
+
const formatted = (0, import_formatGlobalScan.formatGlobalScanResult)(raw, trimmed);
|
|
1384
|
+
if (!formatted) {
|
|
1385
|
+
(_b = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _b.call(bridge, "fail", "pisell2.text.scan-global-failed");
|
|
1386
|
+
return { status: "failed", reason: "not_found" };
|
|
1387
|
+
}
|
|
1388
|
+
const result = await (0, import_applyGlobalScan.applyGlobalScan)(
|
|
1389
|
+
{
|
|
1390
|
+
setOrderCustomer: (customer) => this.setOrderCustomer(customer),
|
|
1391
|
+
getOrderCustomerSnapshot: () => this.getOrderCustomerSnapshot(),
|
|
1392
|
+
getBusinessCode: () => {
|
|
1393
|
+
var _a2;
|
|
1394
|
+
return (_a2 = this.otherParams) == null ? void 0 : _a2.businessCode;
|
|
1395
|
+
},
|
|
1396
|
+
buildAddProductCtx: (extra) => this.buildAddProductCtx(extra),
|
|
1397
|
+
decideAddProduct: (item, options) => this.decideAddProduct(item, options),
|
|
1398
|
+
decideAfterDetail: (cacheItem, options) => this.decideAfterDetail(cacheItem, options),
|
|
1399
|
+
transformDetailToProductAndBooking: (input) => this.transformDetailToProductAndBooking(input),
|
|
1400
|
+
addProductToOrder: (product, booking) => this.addProductToOrder(product, booking)
|
|
1401
|
+
},
|
|
1402
|
+
formatted,
|
|
1403
|
+
bridge
|
|
1404
|
+
);
|
|
1405
|
+
(_c = bridge == null ? void 0 : bridge.refresh) == null ? void 0 : _c.call(bridge);
|
|
1406
|
+
return result;
|
|
1407
|
+
} catch (error) {
|
|
1408
|
+
console.error("[BookingTicket] handleGlobalScanCode failed", error);
|
|
1409
|
+
(_d = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _d.call(bridge, "fail", "pisell2.text.scan-global-failed");
|
|
1410
|
+
return { status: "failed", reason: "not_found" };
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
resolveBestAddTimePlan(addTimeProducts, targetMinutes) {
|
|
1414
|
+
return (0, import_resolveBestAddTimePlan.resolveBestAddTimePlan)(addTimeProducts, targetMinutes);
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* 构造一条绑定到已有 booking 的加时商品行。
|
|
1418
|
+
*
|
|
1419
|
+
* @example
|
|
1420
|
+
* const line = this.buildAddTimeOrderLine({ product, product_add_schedule_time: 30 }, 'booking-1');
|
|
1421
|
+
*/
|
|
1422
|
+
buildAddTimeOrderLine(input, bookingUid) {
|
|
1423
|
+
var _a;
|
|
1424
|
+
const product = input == null ? void 0 : input.product;
|
|
1425
|
+
if (!product || typeof product !== "object") {
|
|
1426
|
+
throw new Error("[BookingTicket] addAddTimeProductToBooking: product 不能为空");
|
|
1427
|
+
}
|
|
1428
|
+
const quantity = normalizeAddTimeQuantity(input.num ?? product.num);
|
|
1429
|
+
const price = resolveAddTimeProductPrice(input.price, product);
|
|
1430
|
+
const addScheduleTime = resolveAddTimeScheduleMinutes(
|
|
1431
|
+
input.product_add_schedule_time,
|
|
1432
|
+
product
|
|
1433
|
+
);
|
|
1434
|
+
const payload = {
|
|
1435
|
+
id: product.id ?? product.product_id,
|
|
1436
|
+
product_id: product.product_id ?? product.id,
|
|
1437
|
+
product_variant_id: product.product_variant_id ?? product.variant_id ?? 0,
|
|
1438
|
+
variant_id: product.variant_id ?? product.product_variant_id ?? 0,
|
|
1439
|
+
quantity,
|
|
1440
|
+
num: quantity,
|
|
1441
|
+
price,
|
|
1442
|
+
selling_price: price,
|
|
1443
|
+
original_price: product.original_price ?? price,
|
|
1444
|
+
line_total: price,
|
|
1445
|
+
total: price,
|
|
1446
|
+
product_sku: product.product_sku,
|
|
1447
|
+
option: product.option ?? product.options ?? ((_a = product.product_sku) == null ? void 0 : _a.option) ?? [],
|
|
1448
|
+
bundle: product.bundle ?? product.bundles ?? product.product_bundle ?? []
|
|
1449
|
+
};
|
|
1450
|
+
const orderLine = this.transformBaseProductToOrderProduct({
|
|
1451
|
+
payload,
|
|
1452
|
+
fallbackProductId: product.id ?? product.product_id,
|
|
1453
|
+
sourceProduct: product,
|
|
1454
|
+
sourceItem: product
|
|
1455
|
+
});
|
|
1456
|
+
if (!orderLine) {
|
|
1457
|
+
throw new Error(
|
|
1458
|
+
"[BookingTicket] addAddTimeProductToBooking: product transform failed"
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1461
|
+
const metadata = {
|
|
1462
|
+
...orderLine.metadata || {},
|
|
1463
|
+
...addScheduleTime !== void 0 ? { product_add_schedule_time: addScheduleTime } : {},
|
|
1464
|
+
booking_uid: bookingUid
|
|
1465
|
+
};
|
|
1466
|
+
return {
|
|
1467
|
+
...orderLine,
|
|
1468
|
+
booking_uid: bookingUid,
|
|
1469
|
+
metadata
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* 将加时商品作为独立商品行绑定到已有 booking。
|
|
1474
|
+
*
|
|
1475
|
+
* 与预约商品加车不同,本方法不会把当前 booking 作为 `addProductToOrder` 第二参数传入,
|
|
1476
|
+
* 避免 OrderModule 新建 booking 或重写已有 booking.product_uid。
|
|
1477
|
+
*
|
|
1478
|
+
* @example
|
|
1479
|
+
* await bookingTicket.addAddTimeProductToBooking({
|
|
1480
|
+
* booking,
|
|
1481
|
+
* product,
|
|
1482
|
+
* num: 1,
|
|
1483
|
+
* price: '10.00',
|
|
1484
|
+
* product_add_schedule_time: 30,
|
|
1485
|
+
* });
|
|
1486
|
+
*/
|
|
1487
|
+
async addAddTimeProductToBooking(input) {
|
|
1488
|
+
return this.addAddTimeProductsToBooking({
|
|
1489
|
+
booking: input.booking,
|
|
1490
|
+
products: [input],
|
|
1491
|
+
coveredMinutes: input.coveredMinutes,
|
|
1492
|
+
bookingPatch: input.bookingPatch
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* 批量将加时商品作为独立商品行绑定到已有 booking,并只触发一次购物车重算。
|
|
1497
|
+
*
|
|
1498
|
+
* @example
|
|
1499
|
+
* await bookingTicket.addAddTimeProductsToBooking({
|
|
1500
|
+
* booking,
|
|
1501
|
+
* products: [{ product, product_add_schedule_time: 30 }],
|
|
1502
|
+
* });
|
|
1503
|
+
*/
|
|
1504
|
+
async addAddTimeProductsToBooking(input) {
|
|
1505
|
+
const bookingUid = resolveBookingUidForAddTime(input == null ? void 0 : input.booking);
|
|
1506
|
+
if (!bookingUid) {
|
|
1507
|
+
throw new Error(
|
|
1508
|
+
"[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失"
|
|
1509
|
+
);
|
|
1510
|
+
}
|
|
1511
|
+
const orderLines = (input.products || []).map((line) => ({
|
|
1512
|
+
product: this.buildAddTimeOrderLine(line, bookingUid)
|
|
1513
|
+
}));
|
|
1514
|
+
if (!this.store.order)
|
|
1515
|
+
throw new Error("order 模块未初始化");
|
|
1516
|
+
const coveredMinutes = normalizeCoveredMinutes(input.coveredMinutes);
|
|
1517
|
+
const bookingTimePatch = input.bookingPatch ?? buildAddTimeBookingTimePatch(input.booking, coveredMinutes);
|
|
1518
|
+
if (bookingTimePatch) {
|
|
1519
|
+
this.store.order.updateOrderBooking({
|
|
1520
|
+
unique_identification_number: bookingUid,
|
|
1521
|
+
updates: bookingTimePatch
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1524
|
+
if (typeof this.store.order.addProductsToOrder === "function") {
|
|
1525
|
+
return this.store.order.addProductsToOrder(orderLines, {
|
|
1526
|
+
skipEditDiscountConfigRefresh: true,
|
|
1527
|
+
skipDiscountRecalculation: true
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
const result = [];
|
|
1531
|
+
for (const line of orderLines) {
|
|
1532
|
+
result.splice(0, result.length, ...await this.addProductToOrder(line.product));
|
|
1533
|
+
}
|
|
1534
|
+
return result;
|
|
1535
|
+
}
|
|
1536
|
+
async setOtherParams(params, { cover = false } = {}) {
|
|
1537
|
+
super.setOtherParams(params, { cover });
|
|
1538
|
+
if (params == null ? void 0 : params.businessCode) {
|
|
1539
|
+
await this.configureIdGeneratorFromOpenData();
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
getDeviceTaskPlugin() {
|
|
1543
|
+
var _a;
|
|
1544
|
+
const app = this.core.getPlugin("app");
|
|
1545
|
+
return ((_a = app == null ? void 0 : app.getApp()) == null ? void 0 : _a.getPlugin("deviceTask")) || null;
|
|
1546
|
+
}
|
|
1547
|
+
// 打印手环,单个或批量都可以
|
|
1548
|
+
async handlePrintWristband(params) {
|
|
1549
|
+
var _a;
|
|
1550
|
+
const deviceTask = this.getDeviceTaskPlugin();
|
|
1551
|
+
if (!(deviceTask == null ? void 0 : deviceTask.dispatch)) {
|
|
1552
|
+
this.logger.addLog({
|
|
1553
|
+
type: "info",
|
|
1554
|
+
title: "[BookingTicket] handlePrintWristband: deviceTask.dispatch 不可用",
|
|
1555
|
+
metadata: {
|
|
1556
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1561
|
+
this.logger.addLog({
|
|
1562
|
+
type: "info",
|
|
1563
|
+
title: "[BookingTicket] handlePrintWristband",
|
|
1564
|
+
metadata: {
|
|
1565
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
1566
|
+
}
|
|
1567
|
+
});
|
|
1568
|
+
const deviceId = await this.getShortNumberOrDeviceId();
|
|
1569
|
+
const idempotencyKey = (0, import_utils.createUuidV4)();
|
|
1570
|
+
deviceTask.dispatch({
|
|
1571
|
+
action: "print_all",
|
|
1572
|
+
device_id: deviceId,
|
|
1573
|
+
payload: {
|
|
1574
|
+
type: "WRISTBAND",
|
|
1575
|
+
data: {
|
|
1576
|
+
order_id: (_a = this.getOrderIdentity()) == null ? void 0 : _a.orderId,
|
|
1577
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1580
|
+
idempotency_key: idempotencyKey,
|
|
1581
|
+
name: "PRINT_WRISTBAND",
|
|
1582
|
+
source: "bookingTicket",
|
|
1583
|
+
source_type: "handlePrintWristband",
|
|
1584
|
+
source_id: idempotencyKey
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
// 触发核销
|
|
1588
|
+
async handleRedeem(params) {
|
|
1589
|
+
var _a, _b, _c;
|
|
1590
|
+
const voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
1591
|
+
const status = params.is_checkin ? "used" : "unused";
|
|
1592
|
+
this.logger.addLog({
|
|
1593
|
+
type: "info",
|
|
1594
|
+
title: "[BookingTicket] handleRedeem",
|
|
1595
|
+
metadata: {
|
|
1596
|
+
voucher_ids: voucherIds,
|
|
1597
|
+
status
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
const voucherIdSet = new Set(voucherIds);
|
|
1601
|
+
const tempOrder = (_b = (_a = this.store.order) == null ? void 0 : _a.getTempOrder) == null ? void 0 : _b.call(_a);
|
|
1602
|
+
const vouchers = (tempOrder == null ? void 0 : tempOrder.vouchers) || ((_c = this.store.order) == null ? void 0 : _c.getVouchers()) || [];
|
|
1603
|
+
let hasUpdatedVoucher = false;
|
|
1604
|
+
const nextVouchers = vouchers.map((voucher) => {
|
|
1605
|
+
if (!voucherIdSet.has(voucher.voucher_id))
|
|
1606
|
+
return voucher;
|
|
1607
|
+
hasUpdatedVoucher = true;
|
|
1608
|
+
return {
|
|
1609
|
+
...voucher,
|
|
1610
|
+
status
|
|
1611
|
+
};
|
|
1612
|
+
});
|
|
1613
|
+
if (tempOrder && hasUpdatedVoucher) {
|
|
1614
|
+
await this.replaceTempOrder({
|
|
1615
|
+
...tempOrder,
|
|
1616
|
+
vouchers: nextVouchers
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
this.core.effects.emit(`${this.name}:onVouchersChange`, {});
|
|
1620
|
+
if (voucherIds.length === 0) {
|
|
1621
|
+
return {
|
|
1622
|
+
code: 200,
|
|
1623
|
+
status: true,
|
|
1624
|
+
message: "",
|
|
1625
|
+
data: []
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
const identity = this.getOrderIdentity();
|
|
1629
|
+
const externalSaleNumber = (tempOrder == null ? void 0 : tempOrder.external_sale_number) || (identity == null ? void 0 : identity.externalSaleNumber) || void 0;
|
|
1630
|
+
const orderId = (tempOrder == null ? void 0 : tempOrder.order_id) ?? (identity == null ? void 0 : identity.orderId) ?? void 0;
|
|
1631
|
+
const orderLookup = externalSaleNumber || orderId || (identity == null ? void 0 : identity.orderNumber) || (identity == null ? void 0 : identity.shopOrderNumber) || (identity == null ? void 0 : identity.shopFullOrderNumber) || void 0;
|
|
1632
|
+
return this.request.post("/machinecode/batch", {
|
|
1633
|
+
ids: voucherIds,
|
|
1634
|
+
status,
|
|
1635
|
+
order_lookup: orderLookup,
|
|
1636
|
+
order_id: orderId,
|
|
1637
|
+
external_sale_number: externalSaleNumber
|
|
1638
|
+
}, {
|
|
1639
|
+
osServer: true
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
1644
|
+
* 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
|
|
1645
|
+
*/
|
|
1646
|
+
async destroy() {
|
|
1647
|
+
var _a;
|
|
1648
|
+
await super.destroy();
|
|
1649
|
+
try {
|
|
1650
|
+
(_a = this.scan) == null ? void 0 : _a.removeAllListeners();
|
|
1651
|
+
} catch (error) {
|
|
1652
|
+
console.warn("[BookingTicket] scan removeAllListeners 失败", error);
|
|
1653
|
+
}
|
|
1654
|
+
import_scanCache.default.clear();
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1658
|
+
0 && (module.exports = {
|
|
1659
|
+
BookingTicket,
|
|
1660
|
+
BookingTicketImpl,
|
|
1661
|
+
...require("./types")
|
|
1662
|
+
});
|