@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
|
@@ -26,23 +26,22 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
26
26
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
27
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
28
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
|
-
import {
|
|
29
|
+
import { BaseSalesImpl } from "../BaseSales";
|
|
30
30
|
import { ScanOrderHooks } from "./types";
|
|
31
31
|
import { OrderModule } from "../../modules/Order";
|
|
32
32
|
import { AccountHooks } from "../../modules/Account/types";
|
|
33
33
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
34
34
|
import Decimal from 'decimal.js';
|
|
35
|
-
import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, computeResourceIsFull,
|
|
35
|
+
import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, computeResourceIsFull, filterProductsForScanOrderMore, findReservationRuleProductByResourceId, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityDimensionId, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toPriceString, toBoolean, toPositiveString } from "./utils";
|
|
36
36
|
import { createModule } from "../BookingByStep/types";
|
|
37
37
|
import { ProductList } from "../../modules/ProductList";
|
|
38
|
-
import { ScheduleModule } from "../../modules/Schedule";
|
|
39
38
|
import { getDateIsInSchedule } from "../../modules/Schedule/getDateIsInSchedule";
|
|
40
|
-
import { composeLinePrice, createUuidV4, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
39
|
+
import { composeLinePrice, buildSubmitPayload, createUuidV4, getProductSkuOptions, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
41
40
|
import dayjs from 'dayjs';
|
|
42
41
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
43
42
|
export * from "./types";
|
|
44
|
-
export var ScanOrderImpl = /*#__PURE__*/function (
|
|
45
|
-
_inherits(ScanOrderImpl,
|
|
43
|
+
export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
44
|
+
_inherits(ScanOrderImpl, _BaseSalesImpl);
|
|
46
45
|
var _super = _createSuper(ScanOrderImpl);
|
|
47
46
|
function ScanOrderImpl(name, version) {
|
|
48
47
|
var _this;
|
|
@@ -83,8 +82,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
83
82
|
_defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
|
|
84
83
|
return _this;
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
88
85
|
_createClass(ScanOrderImpl, [{
|
|
89
86
|
key: "getScanOrderLoggerContext",
|
|
90
87
|
value: function getScanOrderLoggerContext() {
|
|
@@ -165,7 +162,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
165
162
|
payload: payload,
|
|
166
163
|
extra: extra
|
|
167
164
|
});
|
|
168
|
-
} else {
|
|
165
|
+
} else {
|
|
166
|
+
console.log('[ScanOrder][log-fallback]', params.title, {
|
|
167
|
+
payload: payload,
|
|
168
|
+
extra: extra
|
|
169
|
+
});
|
|
170
|
+
}
|
|
169
171
|
return _context.abrupt("return");
|
|
170
172
|
case 6:
|
|
171
173
|
_context.next = 8;
|
|
@@ -430,70 +432,42 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
430
432
|
}
|
|
431
433
|
return refreshOrderMarketingAfterLogin;
|
|
432
434
|
}()
|
|
435
|
+
}, {
|
|
436
|
+
key: "getRegisteredModuleNames",
|
|
437
|
+
value: function getRegisteredModuleNames() {
|
|
438
|
+
return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'schedule'];
|
|
439
|
+
}
|
|
440
|
+
}, {
|
|
441
|
+
key: "createSubModule",
|
|
442
|
+
value: function createSubModule(moduleName) {
|
|
443
|
+
if (moduleName === 'scanOrderLogger') {
|
|
444
|
+
return createModule('scanOrderLogger', this.name);
|
|
445
|
+
}
|
|
446
|
+
return _get(_getPrototypeOf(ScanOrderImpl.prototype), "createSubModule", this).call(this, moduleName);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
433
450
|
}, {
|
|
434
451
|
key: "getCacheId",
|
|
435
452
|
value: function getCacheId() {
|
|
436
453
|
return this.cacheId;
|
|
437
454
|
}
|
|
438
|
-
}, {
|
|
439
|
-
key: "destroyRegisteredChildModules",
|
|
440
|
-
value: function () {
|
|
441
|
-
var _destroyRegisteredChildModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
442
|
-
var modules, _i3, _modules, mod;
|
|
443
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
444
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
445
|
-
case 0:
|
|
446
|
-
modules = [this.store.schedule, this.store.salesSummary, this.store.order, this.store.products, this.store.scanOrderLogger];
|
|
447
|
-
_i3 = 0, _modules = modules;
|
|
448
|
-
case 2:
|
|
449
|
-
if (!(_i3 < _modules.length)) {
|
|
450
|
-
_context6.next = 10;
|
|
451
|
-
break;
|
|
452
|
-
}
|
|
453
|
-
mod = _modules[_i3];
|
|
454
|
-
if (!(mod && typeof mod.destroy === 'function')) {
|
|
455
|
-
_context6.next = 7;
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
_context6.next = 7;
|
|
459
|
-
return Promise.resolve(mod.destroy());
|
|
460
|
-
case 7:
|
|
461
|
-
_i3++;
|
|
462
|
-
_context6.next = 2;
|
|
463
|
-
break;
|
|
464
|
-
case 10:
|
|
465
|
-
case "end":
|
|
466
|
-
return _context6.stop();
|
|
467
|
-
}
|
|
468
|
-
}, _callee6, this);
|
|
469
|
-
}));
|
|
470
|
-
function destroyRegisteredChildModules() {
|
|
471
|
-
return _destroyRegisteredChildModules.apply(this, arguments);
|
|
472
|
-
}
|
|
473
|
-
return destroyRegisteredChildModules;
|
|
474
|
-
}()
|
|
475
455
|
}, {
|
|
476
456
|
key: "initialize",
|
|
477
457
|
value: function () {
|
|
478
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
479
|
-
var _options$otherParams,
|
|
480
|
-
_this$otherParams,
|
|
481
|
-
_this$otherParams2,
|
|
482
|
-
_this$otherParams3,
|
|
483
|
-
_this4 = this;
|
|
458
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(core) {
|
|
459
|
+
var _options$otherParams, _this$otherParams, _this$otherParams2, _this$otherParams3;
|
|
484
460
|
var options,
|
|
485
|
-
|
|
486
|
-
|
|
461
|
+
_this$otherParams4,
|
|
462
|
+
_this$otherParams5,
|
|
487
463
|
_this$store$order,
|
|
488
464
|
_this$store$order2,
|
|
489
|
-
|
|
490
|
-
return _regeneratorRuntime().wrap(function
|
|
491
|
-
while (1) switch (
|
|
465
|
+
_args6 = arguments;
|
|
466
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
467
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
492
468
|
case 0:
|
|
493
|
-
options =
|
|
469
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
494
470
|
this.logMethodStart('initialize');
|
|
495
|
-
this.core = core;
|
|
496
|
-
this.initializeOptions = options || {};
|
|
497
471
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store);
|
|
498
472
|
this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
|
|
499
473
|
this.store.status = 'initializing';
|
|
@@ -509,120 +483,76 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
509
483
|
passed: null,
|
|
510
484
|
failures: []
|
|
511
485
|
};
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
_context7.next = 21;
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
this.logMethodError('initialize', 'window plugin missing');
|
|
519
|
-
throw new Error('scanOrder解决方案需要 window 插件支持');
|
|
520
|
-
case 21:
|
|
521
|
-
if (this.request) {
|
|
522
|
-
_context7.next = 24;
|
|
523
|
-
break;
|
|
524
|
-
}
|
|
525
|
-
this.logMethodError('initialize', 'request plugin missing');
|
|
526
|
-
throw new Error('scanOrder解决方案需要 request 插件支持');
|
|
527
|
-
case 24:
|
|
528
|
-
moduleArr = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
|
|
529
|
-
moduleArr.forEach(function (step) {
|
|
530
|
-
var targetModule = createModule(step, _this4.name);
|
|
531
|
-
if (targetModule) {
|
|
532
|
-
var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
|
|
533
|
-
_this4.store[step] = targetModule;
|
|
534
|
-
var initialState = step === 'salesSummary' ? {
|
|
535
|
-
summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
|
|
536
|
-
} : {};
|
|
537
|
-
var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.scanOrderLoggerProvider) || 'feishu';
|
|
538
|
-
var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.scanOrderLoggerConfig) || {
|
|
539
|
-
feishu: {
|
|
540
|
-
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
|
|
541
|
-
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
_this4.core.registerModule(targetModule, {
|
|
545
|
-
initialState: initialState,
|
|
546
|
-
otherParams: _objectSpread(_objectSpread({}, _this4.otherParams), {}, {
|
|
547
|
-
fatherModule: _this4.name,
|
|
548
|
-
openCache: (_this4$otherParams3 = _this4.otherParams) !== null && _this4$otherParams3 !== void 0 && _this4$otherParams3.cacheId ? true : false,
|
|
549
|
-
cacheId: (_this4$otherParams4 = _this4.otherParams) === null || _this4$otherParams4 === void 0 ? void 0 : _this4$otherParams4.cacheId,
|
|
550
|
-
salesSummaryModuleName: "".concat(_this4.name, "_salesSummary"),
|
|
551
|
-
provider: loggerProvider,
|
|
552
|
-
providerConfig: loggerConfig,
|
|
553
|
-
context: _this4.getScanOrderLoggerContext()
|
|
554
|
-
})
|
|
555
|
-
});
|
|
556
|
-
} else {
|
|
557
|
-
_this4.logMethodError('initialize', "module ".concat(step, " missing"));
|
|
558
|
-
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
559
|
-
}
|
|
560
|
-
});
|
|
486
|
+
_context6.next = 16;
|
|
487
|
+
return _get(_getPrototypeOf(ScanOrderImpl.prototype), "initialize", this).call(this, core, options);
|
|
488
|
+
case 16:
|
|
561
489
|
if (this.store.scanOrderLogger) {
|
|
490
|
+
this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.scanOrderLoggerProvider) || 'feishu');
|
|
491
|
+
this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.scanOrderLoggerConfig) || {
|
|
492
|
+
feishu: {
|
|
493
|
+
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
|
|
494
|
+
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
|
|
495
|
+
}
|
|
496
|
+
});
|
|
562
497
|
this.store.scanOrderLogger.setContext(this.getScanOrderLoggerContext());
|
|
563
498
|
}
|
|
564
|
-
scheduleModule = new ScheduleModule("".concat(this.name, "_schedule"));
|
|
565
|
-
this.store.schedule = scheduleModule;
|
|
566
|
-
this.core.registerModule(scheduleModule, {
|
|
567
|
-
otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
|
|
568
|
-
fatherModule: this.name
|
|
569
|
-
})
|
|
570
|
-
});
|
|
571
499
|
this.registerCustomerLoginListeners();
|
|
572
|
-
|
|
573
|
-
|
|
500
|
+
console.log('[ScanOrder] 初始化开始');
|
|
501
|
+
_context6.prev = 19;
|
|
502
|
+
_context6.next = 22;
|
|
574
503
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
575
504
|
createIfMissing: false
|
|
576
505
|
});
|
|
577
|
-
case
|
|
506
|
+
case 22:
|
|
578
507
|
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
579
|
-
|
|
508
|
+
_context6.next = 25;
|
|
580
509
|
return this.loadRuntimeConfigs();
|
|
581
|
-
case
|
|
510
|
+
case 25:
|
|
582
511
|
if (!this.store.schedule) {
|
|
583
|
-
|
|
512
|
+
_context6.next = 34;
|
|
584
513
|
break;
|
|
585
514
|
}
|
|
586
|
-
|
|
587
|
-
|
|
515
|
+
_context6.prev = 26;
|
|
516
|
+
_context6.next = 29;
|
|
588
517
|
return this.store.schedule.loadAllSchedule();
|
|
589
|
-
case
|
|
590
|
-
|
|
518
|
+
case 29:
|
|
519
|
+
_context6.next = 34;
|
|
591
520
|
break;
|
|
592
|
-
case
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过',
|
|
596
|
-
case
|
|
597
|
-
|
|
521
|
+
case 31:
|
|
522
|
+
_context6.prev = 31;
|
|
523
|
+
_context6.t0 = _context6["catch"](26);
|
|
524
|
+
console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过', _context6.t0);
|
|
525
|
+
case 34:
|
|
526
|
+
_context6.next = 36;
|
|
598
527
|
return this.refreshItemRuleQuantityLimits();
|
|
599
|
-
case
|
|
528
|
+
case 36:
|
|
600
529
|
this.store.status = 'ready';
|
|
601
|
-
|
|
530
|
+
console.log('[ScanOrder] 初始化完成');
|
|
531
|
+
_context6.next = 40;
|
|
602
532
|
return this.core.effects.emit(ScanOrderHooks.onInited, {
|
|
603
533
|
status: this.store.status
|
|
604
534
|
});
|
|
605
|
-
case
|
|
535
|
+
case 40:
|
|
606
536
|
this.logMethodSuccess('initialize', {
|
|
607
537
|
status: this.store.status
|
|
608
538
|
});
|
|
609
|
-
|
|
539
|
+
_context6.next = 50;
|
|
610
540
|
break;
|
|
611
|
-
case
|
|
612
|
-
|
|
613
|
-
|
|
541
|
+
case 43:
|
|
542
|
+
_context6.prev = 43;
|
|
543
|
+
_context6.t1 = _context6["catch"](19);
|
|
614
544
|
this.store.status = 'error';
|
|
615
|
-
this.store.error =
|
|
616
|
-
console.error('[ScanOrder] 初始化失败',
|
|
617
|
-
this.logMethodError('initialize',
|
|
545
|
+
this.store.error = _context6.t1 instanceof Error ? _context6.t1.message : '初始化失败';
|
|
546
|
+
console.error('[ScanOrder] 初始化失败', _context6.t1);
|
|
547
|
+
this.logMethodError('initialize', _context6.t1, {
|
|
618
548
|
status: this.store.status
|
|
619
549
|
});
|
|
620
|
-
throw
|
|
621
|
-
case
|
|
550
|
+
throw _context6.t1;
|
|
551
|
+
case 50:
|
|
622
552
|
case "end":
|
|
623
|
-
return
|
|
553
|
+
return _context6.stop();
|
|
624
554
|
}
|
|
625
|
-
},
|
|
555
|
+
}, _callee6, this, [[19, 43], [26, 31]]);
|
|
626
556
|
}));
|
|
627
557
|
function initialize(_x5) {
|
|
628
558
|
return _initialize.apply(this, arguments);
|
|
@@ -632,25 +562,23 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
632
562
|
}, {
|
|
633
563
|
key: "destroy",
|
|
634
564
|
value: function () {
|
|
635
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
636
|
-
return _regeneratorRuntime().wrap(function
|
|
637
|
-
while (1) switch (
|
|
565
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
566
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
567
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
638
568
|
case 0:
|
|
639
569
|
this.logMethodStart('destroy');
|
|
640
570
|
this.clearLoginEffectListeners();
|
|
641
|
-
|
|
571
|
+
_context7.next = 4;
|
|
642
572
|
return this.core.effects.emit(ScanOrderHooks.onDestroy, {});
|
|
643
573
|
case 4:
|
|
644
|
-
_context8.next = 6;
|
|
645
|
-
return this.destroyRegisteredChildModules();
|
|
646
|
-
case 6:
|
|
647
574
|
_get(_getPrototypeOf(ScanOrderImpl.prototype), "destroy", this).call(this);
|
|
575
|
+
console.log('[ScanOrder] 已销毁');
|
|
648
576
|
this.logMethodSuccess('destroy');
|
|
649
|
-
case
|
|
577
|
+
case 7:
|
|
650
578
|
case "end":
|
|
651
|
-
return
|
|
579
|
+
return _context7.stop();
|
|
652
580
|
}
|
|
653
|
-
},
|
|
581
|
+
}, _callee7, this);
|
|
654
582
|
}));
|
|
655
583
|
function destroy() {
|
|
656
584
|
return _destroy.apply(this, arguments);
|
|
@@ -660,32 +588,33 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
660
588
|
}, {
|
|
661
589
|
key: "retryInit",
|
|
662
590
|
value: function () {
|
|
663
|
-
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
664
|
-
return _regeneratorRuntime().wrap(function
|
|
665
|
-
while (1) switch (
|
|
591
|
+
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
592
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
593
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
666
594
|
case 0:
|
|
667
595
|
this.logMethodStart('retryInit');
|
|
668
596
|
// TODO: 细化重试策略(指数退避、最大重试次数)后替换当前实现
|
|
669
|
-
|
|
597
|
+
console.log('[ScanOrder] retryInit 调用');
|
|
598
|
+
_context8.next = 4;
|
|
670
599
|
return this.core.effects.emit(ScanOrderHooks.onRetryInit, {});
|
|
671
|
-
case
|
|
672
|
-
|
|
673
|
-
|
|
600
|
+
case 4:
|
|
601
|
+
_context8.prev = 4;
|
|
602
|
+
_context8.next = 7;
|
|
674
603
|
return this.initialize(this.core, this.initializeOptions);
|
|
675
|
-
case
|
|
604
|
+
case 7:
|
|
676
605
|
this.logMethodSuccess('retryInit');
|
|
677
|
-
|
|
606
|
+
_context8.next = 14;
|
|
678
607
|
break;
|
|
679
|
-
case
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
this.logMethodError('retryInit',
|
|
683
|
-
throw
|
|
684
|
-
case
|
|
608
|
+
case 10:
|
|
609
|
+
_context8.prev = 10;
|
|
610
|
+
_context8.t0 = _context8["catch"](4);
|
|
611
|
+
this.logMethodError('retryInit', _context8.t0);
|
|
612
|
+
throw _context8.t0;
|
|
613
|
+
case 14:
|
|
685
614
|
case "end":
|
|
686
|
-
return
|
|
615
|
+
return _context8.stop();
|
|
687
616
|
}
|
|
688
|
-
},
|
|
617
|
+
}, _callee8, this, [[4, 10]]);
|
|
689
618
|
}));
|
|
690
619
|
function retryInit() {
|
|
691
620
|
return _retryInit.apply(this, arguments);
|
|
@@ -695,41 +624,42 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
695
624
|
}, {
|
|
696
625
|
key: "refresh",
|
|
697
626
|
value: function () {
|
|
698
|
-
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
699
|
-
return _regeneratorRuntime().wrap(function
|
|
700
|
-
while (1) switch (
|
|
627
|
+
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
628
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
629
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
701
630
|
case 0:
|
|
702
631
|
this.logMethodStart('refresh');
|
|
703
632
|
// TODO: 接入真实刷新逻辑(资源重拉取、流程重建)后替换当前实现
|
|
704
|
-
|
|
633
|
+
console.log('[ScanOrder] refresh 调用');
|
|
634
|
+
_context9.prev = 2;
|
|
705
635
|
this.store.status = 'initializing';
|
|
706
|
-
|
|
636
|
+
_context9.next = 6;
|
|
707
637
|
return this.loadRuntimeConfigs();
|
|
708
|
-
case
|
|
709
|
-
|
|
638
|
+
case 6:
|
|
639
|
+
_context9.next = 8;
|
|
710
640
|
return this.refreshItemRuleQuantityLimits();
|
|
711
|
-
case
|
|
641
|
+
case 8:
|
|
712
642
|
this.store.status = 'ready';
|
|
713
|
-
|
|
643
|
+
_context9.next = 11;
|
|
714
644
|
return this.core.effects.emit(ScanOrderHooks.onRefresh, {
|
|
715
645
|
status: this.store.status
|
|
716
646
|
});
|
|
717
|
-
case
|
|
647
|
+
case 11:
|
|
718
648
|
this.logMethodSuccess('refresh', {
|
|
719
649
|
status: this.store.status
|
|
720
650
|
});
|
|
721
|
-
|
|
651
|
+
_context9.next = 18;
|
|
722
652
|
break;
|
|
723
|
-
case
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
this.logMethodError('refresh',
|
|
727
|
-
throw
|
|
728
|
-
case
|
|
653
|
+
case 14:
|
|
654
|
+
_context9.prev = 14;
|
|
655
|
+
_context9.t0 = _context9["catch"](2);
|
|
656
|
+
this.logMethodError('refresh', _context9.t0);
|
|
657
|
+
throw _context9.t0;
|
|
658
|
+
case 18:
|
|
729
659
|
case "end":
|
|
730
|
-
return
|
|
660
|
+
return _context9.stop();
|
|
731
661
|
}
|
|
732
|
-
},
|
|
662
|
+
}, _callee9, this, [[2, 14]]);
|
|
733
663
|
}));
|
|
734
664
|
function refresh() {
|
|
735
665
|
return _refresh.apply(this, arguments);
|
|
@@ -817,16 +747,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
817
747
|
}, {
|
|
818
748
|
key: "updateTempOrderNote",
|
|
819
749
|
value: function updateTempOrderNote(note) {
|
|
750
|
+
var _this4 = this;
|
|
751
|
+
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
820
752
|
this.logMethodStart('updateTempOrderNote', {
|
|
821
753
|
noteLength: String(note || '').length
|
|
822
754
|
});
|
|
823
755
|
try {
|
|
824
756
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
825
|
-
var result = this.store.order.updateTempOrderNote(note);
|
|
757
|
+
var result = this.store.order.updateTempOrderNote(note, sync);
|
|
758
|
+
if (result && typeof result.then === 'function') {
|
|
759
|
+
return result.then(function (nextNote) {
|
|
760
|
+
_this4.logMethodSuccess('updateTempOrderNote', {
|
|
761
|
+
noteLength: nextNote.length
|
|
762
|
+
});
|
|
763
|
+
return nextNote;
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
var nextNote = result;
|
|
826
767
|
this.logMethodSuccess('updateTempOrderNote', {
|
|
827
|
-
noteLength:
|
|
768
|
+
noteLength: nextNote.length
|
|
828
769
|
});
|
|
829
|
-
return
|
|
770
|
+
return nextNote;
|
|
830
771
|
} catch (error) {
|
|
831
772
|
this.logMethodError('updateTempOrderNote', error);
|
|
832
773
|
throw error;
|
|
@@ -842,12 +783,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
842
783
|
mode: mode
|
|
843
784
|
});
|
|
844
785
|
try {
|
|
845
|
-
var _this$
|
|
786
|
+
var _this$otherParams6;
|
|
846
787
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
847
788
|
var tempOrder = this.store.order.ensureTempOrder();
|
|
848
789
|
tempOrder.metadata = _objectSpread(_objectSpread({}, tempOrder.metadata || {}), {}, {
|
|
849
790
|
shop_service_data: _objectSpread(_objectSpread({}, (tempOrder.metadata || {}).shop_service_data || {}), {}, {
|
|
850
|
-
service_type: ((_this$
|
|
791
|
+
service_type: ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) === 'dine_in' ? 'dine_in' : '',
|
|
851
792
|
pickup_reference_mode: mode
|
|
852
793
|
})
|
|
853
794
|
});
|
|
@@ -884,8 +825,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
884
825
|
}
|
|
885
826
|
}
|
|
886
827
|
}, {
|
|
887
|
-
key: "
|
|
888
|
-
value: function
|
|
828
|
+
key: "ensureScanOrderTempOrder",
|
|
829
|
+
value: function ensureScanOrderTempOrder() {
|
|
889
830
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
890
831
|
return this.store.order.ensureTempOrder();
|
|
891
832
|
}
|
|
@@ -894,37 +835,37 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
894
835
|
}, {
|
|
895
836
|
key: "addNewOrder",
|
|
896
837
|
value: function () {
|
|
897
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
838
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
898
839
|
var tempOrder;
|
|
899
|
-
return _regeneratorRuntime().wrap(function
|
|
900
|
-
while (1) switch (
|
|
840
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
841
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
901
842
|
case 0:
|
|
902
843
|
this.logMethodStart('addNewOrder');
|
|
903
|
-
|
|
844
|
+
_context10.prev = 1;
|
|
904
845
|
if (this.store.order) {
|
|
905
|
-
|
|
846
|
+
_context10.next = 4;
|
|
906
847
|
break;
|
|
907
848
|
}
|
|
908
849
|
throw new Error('order 模块未初始化');
|
|
909
850
|
case 4:
|
|
910
|
-
|
|
851
|
+
_context10.next = 6;
|
|
911
852
|
return this.store.order.addNewOrder();
|
|
912
853
|
case 6:
|
|
913
|
-
tempOrder =
|
|
854
|
+
tempOrder = _context10.sent;
|
|
914
855
|
this.logMethodSuccess('addNewOrder', {
|
|
915
856
|
productCount: tempOrder.products.length
|
|
916
857
|
});
|
|
917
|
-
return
|
|
858
|
+
return _context10.abrupt("return", tempOrder);
|
|
918
859
|
case 11:
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
this.logMethodError('addNewOrder',
|
|
922
|
-
throw
|
|
860
|
+
_context10.prev = 11;
|
|
861
|
+
_context10.t0 = _context10["catch"](1);
|
|
862
|
+
this.logMethodError('addNewOrder', _context10.t0);
|
|
863
|
+
throw _context10.t0;
|
|
923
864
|
case 15:
|
|
924
865
|
case "end":
|
|
925
|
-
return
|
|
866
|
+
return _context10.stop();
|
|
926
867
|
}
|
|
927
|
-
},
|
|
868
|
+
}, _callee10, this, [[1, 11]]);
|
|
928
869
|
}));
|
|
929
870
|
function addNewOrder() {
|
|
930
871
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -935,15 +876,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
935
876
|
}, {
|
|
936
877
|
key: "restoreOrder",
|
|
937
878
|
value: function () {
|
|
938
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
879
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
939
880
|
var tempOrder;
|
|
940
|
-
return _regeneratorRuntime().wrap(function
|
|
941
|
-
while (1) switch (
|
|
881
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
882
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
942
883
|
case 0:
|
|
943
884
|
this.logMethodStart('restoreOrder');
|
|
944
|
-
|
|
885
|
+
_context11.prev = 1;
|
|
945
886
|
if (this.store.order) {
|
|
946
|
-
|
|
887
|
+
_context11.next = 4;
|
|
947
888
|
break;
|
|
948
889
|
}
|
|
949
890
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
@@ -953,17 +894,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
953
894
|
this.enabledReservationRuleProducts = [];
|
|
954
895
|
tempOrder = this.store.order.restoreOrder();
|
|
955
896
|
this.logMethodSuccess('restoreOrder');
|
|
956
|
-
return
|
|
897
|
+
return _context11.abrupt("return", tempOrder);
|
|
957
898
|
case 12:
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
this.logMethodError('restoreOrder',
|
|
961
|
-
throw
|
|
899
|
+
_context11.prev = 12;
|
|
900
|
+
_context11.t0 = _context11["catch"](1);
|
|
901
|
+
this.logMethodError('restoreOrder', _context11.t0);
|
|
902
|
+
throw _context11.t0;
|
|
962
903
|
case 16:
|
|
963
904
|
case "end":
|
|
964
|
-
return
|
|
905
|
+
return _context11.stop();
|
|
965
906
|
}
|
|
966
|
-
},
|
|
907
|
+
}, _callee11, this, [[1, 12]]);
|
|
967
908
|
}));
|
|
968
909
|
function restoreOrder() {
|
|
969
910
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -984,37 +925,37 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
984
925
|
}, {
|
|
985
926
|
key: "getSummary",
|
|
986
927
|
value: function () {
|
|
987
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
928
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
988
929
|
var summary;
|
|
989
|
-
return _regeneratorRuntime().wrap(function
|
|
990
|
-
while (1) switch (
|
|
930
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
931
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
991
932
|
case 0:
|
|
992
933
|
this.logMethodStart('getSummary');
|
|
993
|
-
|
|
934
|
+
_context12.prev = 1;
|
|
994
935
|
if (this.store.order) {
|
|
995
|
-
|
|
936
|
+
_context12.next = 4;
|
|
996
937
|
break;
|
|
997
938
|
}
|
|
998
939
|
throw new Error('order 模块未初始化');
|
|
999
940
|
case 4:
|
|
1000
|
-
|
|
1001
|
-
return this.store.order.
|
|
941
|
+
_context12.next = 6;
|
|
942
|
+
return this.store.order.getOrderSummary();
|
|
1002
943
|
case 6:
|
|
1003
|
-
summary =
|
|
944
|
+
summary = _context12.sent;
|
|
1004
945
|
this.logMethodSuccess('getSummary', {
|
|
1005
946
|
totalAmount: summary.total_amount
|
|
1006
947
|
});
|
|
1007
|
-
return
|
|
948
|
+
return _context12.abrupt("return", summary);
|
|
1008
949
|
case 11:
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
this.logMethodError('getSummary',
|
|
1012
|
-
throw
|
|
950
|
+
_context12.prev = 11;
|
|
951
|
+
_context12.t0 = _context12["catch"](1);
|
|
952
|
+
this.logMethodError('getSummary', _context12.t0);
|
|
953
|
+
throw _context12.t0;
|
|
1013
954
|
case 15:
|
|
1014
955
|
case "end":
|
|
1015
|
-
return
|
|
956
|
+
return _context12.stop();
|
|
1016
957
|
}
|
|
1017
|
-
},
|
|
958
|
+
}, _callee12, this, [[1, 11]]);
|
|
1018
959
|
}));
|
|
1019
960
|
function getSummary() {
|
|
1020
961
|
return _getSummary.apply(this, arguments);
|
|
@@ -1030,30 +971,30 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1030
971
|
}, {
|
|
1031
972
|
key: "scanCode",
|
|
1032
973
|
value: function () {
|
|
1033
|
-
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
974
|
+
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(code, customerId) {
|
|
1034
975
|
var raw;
|
|
1035
|
-
return _regeneratorRuntime().wrap(function
|
|
1036
|
-
while (1) switch (
|
|
976
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
977
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1037
978
|
case 0:
|
|
1038
979
|
this.logMethodStart('scanCode', {
|
|
1039
980
|
code: code
|
|
1040
981
|
});
|
|
1041
|
-
|
|
982
|
+
_context13.prev = 1;
|
|
1042
983
|
if (this.store.order) {
|
|
1043
|
-
|
|
984
|
+
_context13.next = 4;
|
|
1044
985
|
break;
|
|
1045
986
|
}
|
|
1046
987
|
throw new Error('order 模块未初始化');
|
|
1047
988
|
case 4:
|
|
1048
|
-
|
|
989
|
+
_context13.next = 6;
|
|
1049
990
|
return this.store.order.scanCode(code, customerId);
|
|
1050
991
|
case 6:
|
|
1051
|
-
raw =
|
|
992
|
+
raw = _context13.sent;
|
|
1052
993
|
if (!raw.isAvailable) {
|
|
1053
|
-
|
|
994
|
+
_context13.next = 11;
|
|
1054
995
|
break;
|
|
1055
996
|
}
|
|
1056
|
-
|
|
997
|
+
_context13.next = 10;
|
|
1057
998
|
return this.store.order.recalculateSummary({
|
|
1058
999
|
createIfMissing: true
|
|
1059
1000
|
});
|
|
@@ -1063,21 +1004,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1063
1004
|
this.logMethodSuccess('scanCode', {
|
|
1064
1005
|
isAvailable: raw.isAvailable
|
|
1065
1006
|
});
|
|
1066
|
-
return
|
|
1007
|
+
return _context13.abrupt("return", {
|
|
1067
1008
|
isAvailable: raw.isAvailable,
|
|
1068
1009
|
type: raw.type,
|
|
1069
1010
|
unavailableReason: raw.unavailableReason
|
|
1070
1011
|
});
|
|
1071
1012
|
case 15:
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
this.logMethodError('scanCode',
|
|
1075
|
-
throw
|
|
1013
|
+
_context13.prev = 15;
|
|
1014
|
+
_context13.t0 = _context13["catch"](1);
|
|
1015
|
+
this.logMethodError('scanCode', _context13.t0);
|
|
1016
|
+
throw _context13.t0;
|
|
1076
1017
|
case 19:
|
|
1077
1018
|
case "end":
|
|
1078
|
-
return
|
|
1019
|
+
return _context13.stop();
|
|
1079
1020
|
}
|
|
1080
|
-
},
|
|
1021
|
+
}, _callee13, this, [[1, 15]]);
|
|
1081
1022
|
}));
|
|
1082
1023
|
function scanCode(_x6, _x7) {
|
|
1083
1024
|
return _scanCode.apply(this, arguments);
|
|
@@ -1087,15 +1028,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1087
1028
|
}, {
|
|
1088
1029
|
key: "setDiscountSelected",
|
|
1089
1030
|
value: function () {
|
|
1090
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1091
|
-
var _tempOrder$holder, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3,
|
|
1092
|
-
return _regeneratorRuntime().wrap(function
|
|
1093
|
-
while (1) switch (
|
|
1031
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
1032
|
+
var _tempOrder$holder, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _origin, _product$metadata$sou, _product$metadata, _product$metadata2, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1033
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1034
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1094
1035
|
case 0:
|
|
1095
1036
|
this.logMethodStart('setDiscountSelected', params);
|
|
1096
|
-
|
|
1037
|
+
_context14.prev = 1;
|
|
1097
1038
|
if (this.store.order) {
|
|
1098
|
-
|
|
1039
|
+
_context14.next = 4;
|
|
1099
1040
|
break;
|
|
1100
1041
|
}
|
|
1101
1042
|
throw new Error('order 模块未初始化');
|
|
@@ -1115,7 +1056,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1115
1056
|
form_record_id: tempOrder.holder.form_record_id
|
|
1116
1057
|
}] : [];
|
|
1117
1058
|
nextDiscountList = updated;
|
|
1118
|
-
|
|
1059
|
+
_context14.next = 14;
|
|
1119
1060
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1120
1061
|
case 14:
|
|
1121
1062
|
if (rulesModule) {
|
|
@@ -1164,19 +1105,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1164
1105
|
return d.id;
|
|
1165
1106
|
}));
|
|
1166
1107
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
1167
|
-
|
|
1108
|
+
_context14.prev = 17;
|
|
1168
1109
|
_iterator3.s();
|
|
1169
1110
|
case 19:
|
|
1170
1111
|
if ((_step3 = _iterator3.n()).done) {
|
|
1171
|
-
|
|
1112
|
+
_context14.next = 33;
|
|
1172
1113
|
break;
|
|
1173
1114
|
}
|
|
1174
1115
|
product = _step3.value;
|
|
1175
|
-
if (!((
|
|
1176
|
-
|
|
1116
|
+
if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
|
|
1117
|
+
_context14.next = 23;
|
|
1177
1118
|
break;
|
|
1178
1119
|
}
|
|
1179
|
-
return
|
|
1120
|
+
return _context14.abrupt("continue", 31);
|
|
1180
1121
|
case 23:
|
|
1181
1122
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
1182
1123
|
var _pd$discount$resource, _pd$discount;
|
|
@@ -1189,7 +1130,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1189
1130
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1190
1131
|
return sum + (pd.amount || 0);
|
|
1191
1132
|
}, 0);
|
|
1192
|
-
optionSum = sumOptionUnitPrice(product
|
|
1133
|
+
optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
1193
1134
|
sourcePrice = (_product$metadata$sou = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
1194
1135
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1195
1136
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
@@ -1202,46 +1143,46 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1202
1143
|
bundle: product.product_bundle
|
|
1203
1144
|
});
|
|
1204
1145
|
case 31:
|
|
1205
|
-
|
|
1146
|
+
_context14.next = 19;
|
|
1206
1147
|
break;
|
|
1207
1148
|
case 33:
|
|
1208
|
-
|
|
1149
|
+
_context14.next = 38;
|
|
1209
1150
|
break;
|
|
1210
1151
|
case 35:
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
_iterator3.e(
|
|
1152
|
+
_context14.prev = 35;
|
|
1153
|
+
_context14.t0 = _context14["catch"](17);
|
|
1154
|
+
_iterator3.e(_context14.t0);
|
|
1214
1155
|
case 38:
|
|
1215
|
-
|
|
1156
|
+
_context14.prev = 38;
|
|
1216
1157
|
_iterator3.f();
|
|
1217
|
-
return
|
|
1158
|
+
return _context14.finish(38);
|
|
1218
1159
|
case 41:
|
|
1219
1160
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1220
|
-
|
|
1161
|
+
_context14.next = 44;
|
|
1221
1162
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1222
1163
|
case 44:
|
|
1223
1164
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1224
1165
|
return d.isSelected;
|
|
1225
1166
|
});
|
|
1226
|
-
|
|
1167
|
+
_context14.next = 47;
|
|
1227
1168
|
return this.store.order.recalculateSummary({
|
|
1228
1169
|
createIfMissing: true
|
|
1229
1170
|
});
|
|
1230
1171
|
case 47:
|
|
1231
1172
|
this.store.order.persistTempOrder();
|
|
1232
1173
|
this.logMethodSuccess('setDiscountSelected', params);
|
|
1233
|
-
|
|
1174
|
+
_context14.next = 55;
|
|
1234
1175
|
break;
|
|
1235
1176
|
case 51:
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
this.logMethodError('setDiscountSelected',
|
|
1239
|
-
throw
|
|
1177
|
+
_context14.prev = 51;
|
|
1178
|
+
_context14.t1 = _context14["catch"](1);
|
|
1179
|
+
this.logMethodError('setDiscountSelected', _context14.t1);
|
|
1180
|
+
throw _context14.t1;
|
|
1240
1181
|
case 55:
|
|
1241
1182
|
case "end":
|
|
1242
|
-
return
|
|
1183
|
+
return _context14.stop();
|
|
1243
1184
|
}
|
|
1244
|
-
},
|
|
1185
|
+
}, _callee14, this, [[1, 51], [17, 35, 38, 41]]);
|
|
1245
1186
|
}));
|
|
1246
1187
|
function setDiscountSelected(_x8) {
|
|
1247
1188
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -1251,15 +1192,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1251
1192
|
}, {
|
|
1252
1193
|
key: "onCustomerLogin",
|
|
1253
1194
|
value: function () {
|
|
1254
|
-
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1255
|
-
return _regeneratorRuntime().wrap(function
|
|
1256
|
-
while (1) switch (
|
|
1195
|
+
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1196
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1197
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1257
1198
|
case 0:
|
|
1258
1199
|
this.logMethodStart('onCustomerLogin', {
|
|
1259
1200
|
customerId: params.customerId
|
|
1260
1201
|
});
|
|
1261
|
-
|
|
1262
|
-
|
|
1202
|
+
_context15.prev = 1;
|
|
1203
|
+
_context15.next = 4;
|
|
1263
1204
|
return this.refreshOrderMarketingAfterLogin({
|
|
1264
1205
|
customerId: params.customerId
|
|
1265
1206
|
});
|
|
@@ -1267,18 +1208,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1267
1208
|
this.logMethodSuccess('onCustomerLogin', {
|
|
1268
1209
|
customerId: params.customerId
|
|
1269
1210
|
});
|
|
1270
|
-
|
|
1211
|
+
_context15.next = 11;
|
|
1271
1212
|
break;
|
|
1272
1213
|
case 7:
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
this.logMethodError('onCustomerLogin',
|
|
1276
|
-
throw
|
|
1214
|
+
_context15.prev = 7;
|
|
1215
|
+
_context15.t0 = _context15["catch"](1);
|
|
1216
|
+
this.logMethodError('onCustomerLogin', _context15.t0);
|
|
1217
|
+
throw _context15.t0;
|
|
1277
1218
|
case 11:
|
|
1278
1219
|
case "end":
|
|
1279
|
-
return
|
|
1220
|
+
return _context15.stop();
|
|
1280
1221
|
}
|
|
1281
|
-
},
|
|
1222
|
+
}, _callee15, this, [[1, 7]]);
|
|
1282
1223
|
}));
|
|
1283
1224
|
function onCustomerLogin(_x9) {
|
|
1284
1225
|
return _onCustomerLogin.apply(this, arguments);
|
|
@@ -1329,11 +1270,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1329
1270
|
}, {
|
|
1330
1271
|
key: "prepareRetailAvailability",
|
|
1331
1272
|
value: function () {
|
|
1332
|
-
var _prepareRetailAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1333
|
-
var _this$store$order4, _this$
|
|
1273
|
+
var _prepareRetailAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1274
|
+
var _this$store$order4, _this$otherParams7;
|
|
1334
1275
|
var tempOrder, hasOrderId, resourceId, reason, resourceState, availabilityInfo;
|
|
1335
|
-
return _regeneratorRuntime().wrap(function
|
|
1336
|
-
while (1) switch (
|
|
1276
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1277
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1337
1278
|
case 0:
|
|
1338
1279
|
tempOrder = params.tempOrder, hasOrderId = params.hasOrderId, resourceId = params.resourceId, reason = params.reason;
|
|
1339
1280
|
this.enabledReservationRuleProducts = [];
|
|
@@ -1356,12 +1297,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1356
1297
|
};
|
|
1357
1298
|
this.store.resource = resourceState;
|
|
1358
1299
|
(_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || _this$store$order4.persistTempOrder();
|
|
1359
|
-
|
|
1300
|
+
_context16.next = 15;
|
|
1360
1301
|
return this.addNewOrder();
|
|
1361
1302
|
case 15:
|
|
1362
|
-
|
|
1303
|
+
_context16.next = 17;
|
|
1363
1304
|
return this.setItemRuleRuntimeConfig({
|
|
1364
|
-
serviceType: (_this$
|
|
1305
|
+
serviceType: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode,
|
|
1365
1306
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
1366
1307
|
historicalItems: []
|
|
1367
1308
|
});
|
|
@@ -1375,15 +1316,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1375
1316
|
mode: availabilityInfo.mode,
|
|
1376
1317
|
retailMode: true,
|
|
1377
1318
|
retailReason: reason,
|
|
1378
|
-
|
|
1379
|
-
persistedResourceId:
|
|
1319
|
+
relationId: resourceState.relationId,
|
|
1320
|
+
persistedResourceId: resourceState.relationId
|
|
1380
1321
|
});
|
|
1381
|
-
return
|
|
1322
|
+
return _context16.abrupt("return", availabilityInfo);
|
|
1382
1323
|
case 20:
|
|
1383
1324
|
case "end":
|
|
1384
|
-
return
|
|
1325
|
+
return _context16.stop();
|
|
1385
1326
|
}
|
|
1386
|
-
},
|
|
1327
|
+
}, _callee16, this);
|
|
1387
1328
|
}));
|
|
1388
1329
|
function prepareRetailAvailability(_x10) {
|
|
1389
1330
|
return _prepareRetailAvailability.apply(this, arguments);
|
|
@@ -1414,11 +1355,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1414
1355
|
return 1;
|
|
1415
1356
|
};
|
|
1416
1357
|
return function (payload, _ref3) {
|
|
1417
|
-
var
|
|
1358
|
+
var _resourceState$relati, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati2, _pickFirstCustomCapac;
|
|
1418
1359
|
var bookingUuid = _ref3.bookingUuid,
|
|
1419
1360
|
tempOrder = _ref3.tempOrder;
|
|
1420
|
-
var resourceId = String((
|
|
1421
|
-
var hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId &&
|
|
1361
|
+
var resourceId = String((_resourceState$relati = resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : '').trim();
|
|
1362
|
+
var hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId && resourceState.relationId && resourceState.tableFormId);
|
|
1422
1363
|
if (!hasReservationBookingContext) {
|
|
1423
1364
|
return _objectSpread(_objectSpread({}, payload), {}, {
|
|
1424
1365
|
bookings: [],
|
|
@@ -1435,14 +1376,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1435
1376
|
}
|
|
1436
1377
|
return undefined;
|
|
1437
1378
|
};
|
|
1438
|
-
var mainField = (
|
|
1379
|
+
var mainField = (_ref4 = (_pickOriginal = pickOriginal(tempOrder.table_number)) !== null && _pickOriginal !== void 0 ? _pickOriginal : pickOriginal(resourceState === null || resourceState === void 0 || (_resourceState$table_2 = resourceState.table_form_record) === null || _resourceState$table_2 === void 0 ? void 0 : _resourceState$table_2.name)) !== null && _ref4 !== void 0 ? _ref4 : '';
|
|
1439
1380
|
var resourceEntry = resourceState && resourceId ? {
|
|
1440
1381
|
relation_type: 'form',
|
|
1441
1382
|
like_status: 'common',
|
|
1442
1383
|
id: Number(resourceId),
|
|
1443
1384
|
main_field: mainField,
|
|
1444
1385
|
form_id: resourceState.tableFormId,
|
|
1445
|
-
relation_id: (_resourceState$
|
|
1386
|
+
relation_id: (_resourceState$relati2 = resourceState.relationId) !== null && _resourceState$relati2 !== void 0 ? _resourceState$relati2 : resourceId,
|
|
1446
1387
|
capacity: bookingCapacityValue,
|
|
1447
1388
|
metadata: _this5.buildScanOrderResourceMetadata({
|
|
1448
1389
|
resourceState: resourceState,
|
|
@@ -1479,9 +1420,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1479
1420
|
var nextProducts = _toConsumableArray(payload.products || []);
|
|
1480
1421
|
// 加餐(已有 order_id)走 scanOrderMore,原单已含 booking 规则行,勿再追加虚拟规则商品
|
|
1481
1422
|
if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
|
|
1482
|
-
var _ruleProduct$price,
|
|
1423
|
+
var _ruleProduct$price, _ref5, _ruleProduct$original, _ruleProduct$is_gst;
|
|
1483
1424
|
var sellingPrice = String((_ruleProduct$price = ruleProduct.price) !== null && _ruleProduct$price !== void 0 ? _ruleProduct$price : '0.00');
|
|
1484
|
-
var originalPrice = String((
|
|
1425
|
+
var originalPrice = String((_ref5 = (_ruleProduct$original = ruleProduct.original_price) !== null && _ruleProduct$original !== void 0 ? _ruleProduct$original : ruleProduct.price) !== null && _ref5 !== void 0 ? _ref5 : '0.00');
|
|
1485
1426
|
nextProducts.push({
|
|
1486
1427
|
product_id: ruleProduct.id,
|
|
1487
1428
|
product_variant_id: 0,
|
|
@@ -1490,7 +1431,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1490
1431
|
original_price: originalPrice,
|
|
1491
1432
|
payment_price: sellingPrice,
|
|
1492
1433
|
is_charge_tax: (_ruleProduct$is_gst = ruleProduct.is_gst) !== null && _ruleProduct$is_gst !== void 0 ? _ruleProduct$is_gst : 0,
|
|
1493
|
-
|
|
1434
|
+
product_sku: {
|
|
1435
|
+
option: []
|
|
1436
|
+
},
|
|
1494
1437
|
discount_list: [],
|
|
1495
1438
|
product_bundle: [],
|
|
1496
1439
|
booking_uid: bookingUuid,
|
|
@@ -1507,11 +1450,89 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1507
1450
|
});
|
|
1508
1451
|
};
|
|
1509
1452
|
}
|
|
1453
|
+
}, {
|
|
1454
|
+
key: "isScanOrderMoreMode",
|
|
1455
|
+
value: function isScanOrderMoreMode(tempOrder) {
|
|
1456
|
+
var _this$store$resource, _this$store$entryCont;
|
|
1457
|
+
var mode = (_this$store$resource = this.store.resource) === null || _this$store$resource === void 0 ? void 0 : _this$store$resource.mode;
|
|
1458
|
+
return Boolean(tempOrder.order_id && (mode === 'additional_order' || mode === 'additional_order_with_code' || ((_this$store$entryCont = this.store.entryContext) === null || _this$store$entryCont === void 0 ? void 0 : _this$store$entryCont.mode) === 'append'));
|
|
1459
|
+
}
|
|
1460
|
+
}, {
|
|
1461
|
+
key: "submitScanOrderMore",
|
|
1462
|
+
value: function () {
|
|
1463
|
+
var _submitScanOrderMore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
1464
|
+
var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12;
|
|
1465
|
+
var tempOrder, enhancePayload, latestSummary, payload, products, orderId, result;
|
|
1466
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1467
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1468
|
+
case 0:
|
|
1469
|
+
if (this.request) {
|
|
1470
|
+
_context17.next = 2;
|
|
1471
|
+
break;
|
|
1472
|
+
}
|
|
1473
|
+
throw new Error('scanOrder解决方案需要 request 插件支持');
|
|
1474
|
+
case 2:
|
|
1475
|
+
if (this.store.order) {
|
|
1476
|
+
_context17.next = 4;
|
|
1477
|
+
break;
|
|
1478
|
+
}
|
|
1479
|
+
throw new Error('scanOrder解决方案需要 order 模块支持');
|
|
1480
|
+
case 4:
|
|
1481
|
+
tempOrder = params.tempOrder, enhancePayload = params.enhancePayload;
|
|
1482
|
+
_context17.next = 7;
|
|
1483
|
+
return this.store.order.recalculateSummary({
|
|
1484
|
+
createIfMissing: true
|
|
1485
|
+
});
|
|
1486
|
+
case 7:
|
|
1487
|
+
latestSummary = _context17.sent;
|
|
1488
|
+
payload = buildSubmitPayload({
|
|
1489
|
+
tempOrder: tempOrder,
|
|
1490
|
+
cacheId: this.cacheId,
|
|
1491
|
+
platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
|
|
1492
|
+
businessCode: ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.business_code),
|
|
1493
|
+
channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel,
|
|
1494
|
+
type: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.type,
|
|
1495
|
+
summary: latestSummary,
|
|
1496
|
+
enhance: enhancePayload
|
|
1497
|
+
});
|
|
1498
|
+
products = filterProductsForScanOrderMore(payload.products);
|
|
1499
|
+
orderId = tempOrder.order_id;
|
|
1500
|
+
_context17.next = 13;
|
|
1501
|
+
return this.request.put("/order/order/product/".concat(orderId), {
|
|
1502
|
+
products: products,
|
|
1503
|
+
request_unique_idempotency_token: payload.request_unique_idempotency_token
|
|
1504
|
+
}, {
|
|
1505
|
+
customToast: function customToast() {}
|
|
1506
|
+
});
|
|
1507
|
+
case 13:
|
|
1508
|
+
result = _context17.sent;
|
|
1509
|
+
if (!((result === null || result === void 0 ? void 0 : result.code) === 200 && !(result !== null && result !== void 0 && result.data))) {
|
|
1510
|
+
_context17.next = 16;
|
|
1511
|
+
break;
|
|
1512
|
+
}
|
|
1513
|
+
return _context17.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
1514
|
+
data: {
|
|
1515
|
+
order_id: orderId
|
|
1516
|
+
}
|
|
1517
|
+
}));
|
|
1518
|
+
case 16:
|
|
1519
|
+
return _context17.abrupt("return", result);
|
|
1520
|
+
case 17:
|
|
1521
|
+
case "end":
|
|
1522
|
+
return _context17.stop();
|
|
1523
|
+
}
|
|
1524
|
+
}, _callee17, this);
|
|
1525
|
+
}));
|
|
1526
|
+
function submitScanOrderMore(_x11) {
|
|
1527
|
+
return _submitScanOrderMore.apply(this, arguments);
|
|
1528
|
+
}
|
|
1529
|
+
return submitScanOrderMore;
|
|
1530
|
+
}()
|
|
1510
1531
|
}, {
|
|
1511
1532
|
key: "submitScanOrder",
|
|
1512
1533
|
value: function () {
|
|
1513
1534
|
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1514
|
-
var _this$store$
|
|
1535
|
+
var _this$store$resource2, _tempOrder$products, pax, tempOrderForSubmit, resourceTableName, enhancePayload, result, tempOrder;
|
|
1515
1536
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1516
1537
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1517
1538
|
case 0:
|
|
@@ -1526,9 +1547,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1526
1547
|
}
|
|
1527
1548
|
throw new Error('scanOrder解决方案需要 order 模块支持');
|
|
1528
1549
|
case 6:
|
|
1550
|
+
pax = normalizeSubmitCollectPaxValue(this.store.entryPaxNumber);
|
|
1551
|
+
this.store.entryPaxNumber = pax;
|
|
1529
1552
|
tempOrderForSubmit = this.store.order.ensureTempOrder();
|
|
1553
|
+
tempOrderForSubmit.metadata = _objectSpread(_objectSpread({}, tempOrderForSubmit.metadata), {}, {
|
|
1554
|
+
collect_pax: pax
|
|
1555
|
+
});
|
|
1530
1556
|
tempOrderForSubmit.delivery_type = 'shop_service';
|
|
1531
|
-
resourceTableName = (_this$store$
|
|
1557
|
+
resourceTableName = (_this$store$resource2 = this.store.resource) === null || _this$store$resource2 === void 0 || (_this$store$resource2 = _this$store$resource2.table_form_record) === null || _this$store$resource2 === void 0 ? void 0 : _this$store$resource2.name;
|
|
1532
1558
|
if (resourceTableName && _typeof(resourceTableName) === 'object') {
|
|
1533
1559
|
tempOrderForSubmit.table_number = resourceTableName;
|
|
1534
1560
|
} else {
|
|
@@ -1536,32 +1562,43 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1536
1562
|
}
|
|
1537
1563
|
this.store.order.persistTempOrder();
|
|
1538
1564
|
enhancePayload = this.buildSubmitPayloadEnhancer();
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1565
|
+
if (!this.isScanOrderMoreMode(tempOrderForSubmit)) {
|
|
1566
|
+
_context18.next = 21;
|
|
1567
|
+
break;
|
|
1568
|
+
}
|
|
1569
|
+
_context18.next = 18;
|
|
1570
|
+
return this.submitScanOrderMore({
|
|
1571
|
+
tempOrder: tempOrderForSubmit,
|
|
1546
1572
|
enhancePayload: enhancePayload
|
|
1547
1573
|
});
|
|
1548
|
-
case
|
|
1549
|
-
|
|
1574
|
+
case 18:
|
|
1575
|
+
_context18.t0 = _context18.sent;
|
|
1576
|
+
_context18.next = 24;
|
|
1577
|
+
break;
|
|
1578
|
+
case 21:
|
|
1579
|
+
_context18.next = 23;
|
|
1580
|
+
return this.submitSalesOrder({
|
|
1581
|
+
enhancePayload: enhancePayload
|
|
1582
|
+
});
|
|
1583
|
+
case 23:
|
|
1584
|
+
_context18.t0 = _context18.sent;
|
|
1585
|
+
case 24:
|
|
1586
|
+
result = _context18.t0;
|
|
1550
1587
|
tempOrder = this.store.order.getTempOrder();
|
|
1551
1588
|
this.logMethodSuccess('submitScanOrder', {
|
|
1552
1589
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products = tempOrder.products) === null || _tempOrder$products === void 0 ? void 0 : _tempOrder$products.length) || 0
|
|
1553
1590
|
});
|
|
1554
1591
|
return _context18.abrupt("return", result);
|
|
1555
|
-
case
|
|
1556
|
-
_context18.prev =
|
|
1557
|
-
_context18.
|
|
1558
|
-
this.logMethodError('submitScanOrder', _context18.
|
|
1559
|
-
throw _context18.
|
|
1560
|
-
case
|
|
1592
|
+
case 30:
|
|
1593
|
+
_context18.prev = 30;
|
|
1594
|
+
_context18.t1 = _context18["catch"](1);
|
|
1595
|
+
this.logMethodError('submitScanOrder', _context18.t1);
|
|
1596
|
+
throw _context18.t1;
|
|
1597
|
+
case 34:
|
|
1561
1598
|
case "end":
|
|
1562
1599
|
return _context18.stop();
|
|
1563
1600
|
}
|
|
1564
|
-
}, _callee18, this, [[1,
|
|
1601
|
+
}, _callee18, this, [[1, 30]]);
|
|
1565
1602
|
}));
|
|
1566
1603
|
function submitScanOrder() {
|
|
1567
1604
|
return _submitScanOrder.apply(this, arguments);
|
|
@@ -1612,20 +1649,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1612
1649
|
}
|
|
1613
1650
|
}, _callee19, this, [[1, 15]]);
|
|
1614
1651
|
}));
|
|
1615
|
-
function addProductToOrder(
|
|
1652
|
+
function addProductToOrder(_x12) {
|
|
1616
1653
|
return _addProductToOrder.apply(this, arguments);
|
|
1617
1654
|
}
|
|
1618
1655
|
return addProductToOrder;
|
|
1619
1656
|
}()
|
|
1620
1657
|
}, {
|
|
1621
|
-
key: "
|
|
1658
|
+
key: "updateOrderProduct",
|
|
1622
1659
|
value: function () {
|
|
1623
|
-
var
|
|
1660
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
1624
1661
|
var products;
|
|
1625
1662
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1626
1663
|
while (1) switch (_context20.prev = _context20.next) {
|
|
1627
1664
|
case 0:
|
|
1628
|
-
this.logMethodStart('
|
|
1665
|
+
this.logMethodStart('updateOrderProduct', {
|
|
1629
1666
|
product_id: params.product_id,
|
|
1630
1667
|
product_variant_id: params.product_variant_id
|
|
1631
1668
|
});
|
|
@@ -1637,7 +1674,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1637
1674
|
throw new Error('order 模块未初始化');
|
|
1638
1675
|
case 4:
|
|
1639
1676
|
_context20.next = 6;
|
|
1640
|
-
return this.store.order.
|
|
1677
|
+
return this.store.order.updateOrderProduct(params);
|
|
1641
1678
|
case 6:
|
|
1642
1679
|
products = _context20.sent;
|
|
1643
1680
|
_context20.next = 9;
|
|
@@ -1646,14 +1683,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1646
1683
|
_context20.next = 11;
|
|
1647
1684
|
return this.refreshCartValidationPassed();
|
|
1648
1685
|
case 11:
|
|
1649
|
-
this.logMethodSuccess('
|
|
1686
|
+
this.logMethodSuccess('updateOrderProduct', {
|
|
1650
1687
|
productCount: products.length
|
|
1651
1688
|
});
|
|
1652
1689
|
return _context20.abrupt("return", products);
|
|
1653
1690
|
case 15:
|
|
1654
1691
|
_context20.prev = 15;
|
|
1655
1692
|
_context20.t0 = _context20["catch"](1);
|
|
1656
|
-
this.logMethodError('
|
|
1693
|
+
this.logMethodError('updateOrderProduct', _context20.t0);
|
|
1657
1694
|
throw _context20.t0;
|
|
1658
1695
|
case 19:
|
|
1659
1696
|
case "end":
|
|
@@ -1661,10 +1698,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1661
1698
|
}
|
|
1662
1699
|
}, _callee20, this, [[1, 15]]);
|
|
1663
1700
|
}));
|
|
1664
|
-
function
|
|
1665
|
-
return
|
|
1701
|
+
function updateOrderProduct(_x13) {
|
|
1702
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
1666
1703
|
}
|
|
1667
|
-
return
|
|
1704
|
+
return updateOrderProduct;
|
|
1668
1705
|
}()
|
|
1669
1706
|
/**
|
|
1670
1707
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
@@ -1691,12 +1728,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1691
1728
|
}
|
|
1692
1729
|
};
|
|
1693
1730
|
if (identity.identity_key !== undefined) params.identity_key = identity.identity_key;
|
|
1694
|
-
if (identity.
|
|
1695
|
-
params.
|
|
1731
|
+
if (identity.product_sku !== undefined) {
|
|
1732
|
+
params.product_sku = identity.product_sku;
|
|
1696
1733
|
}
|
|
1697
1734
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
1698
1735
|
_context21.next = 8;
|
|
1699
|
-
return this.
|
|
1736
|
+
return this.updateOrderProduct(params);
|
|
1700
1737
|
case 8:
|
|
1701
1738
|
products = _context21.sent;
|
|
1702
1739
|
this.logMethodSuccess('setOrderProductLineNote', {
|
|
@@ -1714,7 +1751,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1714
1751
|
}
|
|
1715
1752
|
}, _callee21, this, [[1, 13]]);
|
|
1716
1753
|
}));
|
|
1717
|
-
function setOrderProductLineNote(
|
|
1754
|
+
function setOrderProductLineNote(_x14, _x15) {
|
|
1718
1755
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
1719
1756
|
}
|
|
1720
1757
|
return setOrderProductLineNote;
|
|
@@ -1763,7 +1800,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1763
1800
|
}
|
|
1764
1801
|
}, _callee22, this, [[1, 15]]);
|
|
1765
1802
|
}));
|
|
1766
|
-
function removeProductFromOrder(
|
|
1803
|
+
function removeProductFromOrder(_x16) {
|
|
1767
1804
|
return _removeProductFromOrder.apply(this, arguments);
|
|
1768
1805
|
}
|
|
1769
1806
|
return removeProductFromOrder;
|
|
@@ -1840,7 +1877,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1840
1877
|
}
|
|
1841
1878
|
}, _callee24, this);
|
|
1842
1879
|
}));
|
|
1843
|
-
function syncItemRuleConfigsFromDineInConfig(
|
|
1880
|
+
function syncItemRuleConfigsFromDineInConfig(_x17) {
|
|
1844
1881
|
return _syncItemRuleConfigsFromDineInConfig.apply(this, arguments);
|
|
1845
1882
|
}
|
|
1846
1883
|
return syncItemRuleConfigsFromDineInConfig;
|
|
@@ -1897,7 +1934,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1897
1934
|
}
|
|
1898
1935
|
}, _callee25, this, [[3, 13]]);
|
|
1899
1936
|
}));
|
|
1900
|
-
function fetchItemRuleConfigsByModelIds(
|
|
1937
|
+
function fetchItemRuleConfigsByModelIds(_x18) {
|
|
1901
1938
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
1902
1939
|
}
|
|
1903
1940
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -1947,16 +1984,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1947
1984
|
var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
|
|
1948
1985
|
var productId = Number(rawProductId);
|
|
1949
1986
|
if (Number.isFinite(productId) && productId > 0) {
|
|
1950
|
-
var
|
|
1951
|
-
var productVariantId = Number((
|
|
1987
|
+
var _ref6, _node$product_variant;
|
|
1988
|
+
var productVariantId = Number((_ref6 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref6 !== void 0 ? _ref6 : 0);
|
|
1952
1989
|
var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
|
|
1953
1990
|
var key = buildProductKey(productId, normalizedVariantId);
|
|
1954
1991
|
if (!sourceMap.has(key)) {
|
|
1955
1992
|
sourceMap.set(key, node);
|
|
1956
1993
|
}
|
|
1957
1994
|
}
|
|
1958
|
-
for (var
|
|
1959
|
-
var childValue = _Object$values[
|
|
1995
|
+
for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
|
|
1996
|
+
var childValue = _Object$values[_i3];
|
|
1960
1997
|
if (childValue && _typeof(childValue) === 'object') {
|
|
1961
1998
|
collectFromValue(childValue);
|
|
1962
1999
|
}
|
|
@@ -2069,7 +2106,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2069
2106
|
return _context29.abrupt("return", []);
|
|
2070
2107
|
case 7:
|
|
2071
2108
|
businessData = buildItemRuleBusinessData({
|
|
2072
|
-
tempOrder: this.
|
|
2109
|
+
tempOrder: this.ensureScanOrderTempOrder(),
|
|
2073
2110
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2074
2111
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2075
2112
|
});
|
|
@@ -2100,7 +2137,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2100
2137
|
key: "applyPrefillByItemRule",
|
|
2101
2138
|
value: function () {
|
|
2102
2139
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2103
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator6, _step6, _prefillItem$product_,
|
|
2140
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator6, _step6, _prefillItem$product_, _origin2, _origin3, _origin4, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
|
|
2104
2141
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2105
2142
|
while (1) switch (_context30.prev = _context30.next) {
|
|
2106
2143
|
case 0:
|
|
@@ -2127,7 +2164,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2127
2164
|
return _context30.abrupt("return");
|
|
2128
2165
|
case 9:
|
|
2129
2166
|
businessData = buildItemRuleBusinessData({
|
|
2130
|
-
tempOrder: this.
|
|
2167
|
+
tempOrder: this.ensureScanOrderTempOrder(),
|
|
2131
2168
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2132
2169
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2133
2170
|
});
|
|
@@ -2143,7 +2180,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2143
2180
|
return this.buildPrefillProductSourceMap();
|
|
2144
2181
|
case 16:
|
|
2145
2182
|
productSourceMap = _context30.sent;
|
|
2146
|
-
tempOrder = this.
|
|
2183
|
+
tempOrder = this.ensureScanOrderTempOrder();
|
|
2147
2184
|
hasChanges = false;
|
|
2148
2185
|
_iterator6 = _createForOfIteratorHelper(prefillItems);
|
|
2149
2186
|
_context30.prev = 20;
|
|
@@ -2210,7 +2247,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2210
2247
|
_origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
|
|
2211
2248
|
});
|
|
2212
2249
|
hasQuantityChanged = delta > 0;
|
|
2213
|
-
hasOriginChanged = Boolean(sourceItem && (!targetProduct._origin || ((
|
|
2250
|
+
hasOriginChanged = Boolean(sourceItem && (!targetProduct._origin || ((_origin2 = targetProduct._origin) === null || _origin2 === void 0 ? void 0 : _origin2.name) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.name) || ((_origin3 = targetProduct._origin) === null || _origin3 === void 0 ? void 0 : _origin3.title) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.title) || ((_origin4 = targetProduct._origin) === null || _origin4 === void 0 ? void 0 : _origin4.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)));
|
|
2214
2251
|
if (hasQuantityChanged || hasOriginChanged) {
|
|
2215
2252
|
tempOrder.products[productIndex] = nextProduct;
|
|
2216
2253
|
hasChanges = true;
|
|
@@ -2318,7 +2355,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2318
2355
|
});
|
|
2319
2356
|
case 5:
|
|
2320
2357
|
businessData = buildItemRuleBusinessData({
|
|
2321
|
-
tempOrder: this.
|
|
2358
|
+
tempOrder: this.ensureScanOrderTempOrder(),
|
|
2322
2359
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2323
2360
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2324
2361
|
});
|
|
@@ -2472,14 +2509,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2472
2509
|
}, {
|
|
2473
2510
|
key: "normalizeResourceState",
|
|
2474
2511
|
value: function normalizeResourceState(detail, resourceSelectType, hasOrderId) {
|
|
2475
|
-
var _detail$form_record, _this$
|
|
2512
|
+
var _detail$form_record, _this$otherParams13, _detail$resource_capa, _detail$resource_capa2;
|
|
2476
2513
|
var currentOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.order_id);
|
|
2477
2514
|
var lastOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.last_order_id);
|
|
2478
2515
|
var relationId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_record_id);
|
|
2479
2516
|
var tableFormId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_id);
|
|
2480
2517
|
var formRecord = (_detail$form_record = detail === null || detail === void 0 ? void 0 : detail.form_record) !== null && _detail$form_record !== void 0 ? _detail$form_record : null;
|
|
2481
2518
|
// 是否允许加餐
|
|
2482
|
-
var allowSnack = ((_this$
|
|
2519
|
+
var allowSnack = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['sale.allow_add_items']) || false;
|
|
2483
2520
|
// 开启同桌验证 - 本期没有这个配置,默认关掉
|
|
2484
2521
|
var deskmateValid = false;
|
|
2485
2522
|
var isExclusive = resourceSelectType === 'single';
|
|
@@ -2562,7 +2599,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2562
2599
|
key: "fetchResourceOccupyDetailsByResourceId",
|
|
2563
2600
|
value: function () {
|
|
2564
2601
|
var _fetchResourceOccupyDetailsByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId) {
|
|
2565
|
-
var _this$
|
|
2602
|
+
var _this$otherParams14, _this$otherParams14$g, _response$data$occupy, _response$data;
|
|
2566
2603
|
var formRecordId, shopId, response;
|
|
2567
2604
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2568
2605
|
while (1) switch (_context36.prev = _context36.next) {
|
|
@@ -2574,7 +2611,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2574
2611
|
}
|
|
2575
2612
|
throw new Error("[ScanOrder] \u975E\u6CD5\u684C\u53F0 resourceId: ".concat(resourceId));
|
|
2576
2613
|
case 3:
|
|
2577
|
-
shopId = (_this$
|
|
2614
|
+
shopId = (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 || (_this$otherParams14$g = _this$otherParams14.getStateData) === null || _this$otherParams14$g === void 0 ? void 0 : _this$otherParams14$g.call(_this$otherParams14, 'shop_id');
|
|
2578
2615
|
if (shopId) {
|
|
2579
2616
|
_context36.next = 6;
|
|
2580
2617
|
break;
|
|
@@ -2604,7 +2641,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2604
2641
|
}
|
|
2605
2642
|
}, _callee36, this);
|
|
2606
2643
|
}));
|
|
2607
|
-
function fetchResourceOccupyDetailsByResourceId(
|
|
2644
|
+
function fetchResourceOccupyDetailsByResourceId(_x19) {
|
|
2608
2645
|
return _fetchResourceOccupyDetailsByResourceId.apply(this, arguments);
|
|
2609
2646
|
}
|
|
2610
2647
|
return fetchResourceOccupyDetailsByResourceId;
|
|
@@ -2668,19 +2705,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2668
2705
|
var hasOrderId,
|
|
2669
2706
|
normalizedResourceId,
|
|
2670
2707
|
_this$otherParams$bus,
|
|
2671
|
-
_this$
|
|
2708
|
+
_this$otherParams15,
|
|
2672
2709
|
_this$otherParams$cha,
|
|
2673
|
-
_this$
|
|
2674
|
-
_this$
|
|
2675
|
-
_this$
|
|
2710
|
+
_this$otherParams16,
|
|
2711
|
+
_this$otherParams17,
|
|
2712
|
+
_this$otherParams17$g,
|
|
2676
2713
|
_occupyDetails$,
|
|
2677
2714
|
_occupyDetail$form_re,
|
|
2678
2715
|
_occupyDetail$form_re2,
|
|
2679
|
-
_this$otherParams15,
|
|
2680
2716
|
_this$store$order6,
|
|
2681
2717
|
_this$store$order7,
|
|
2682
2718
|
_this$store$order7$ge,
|
|
2683
|
-
_this$
|
|
2719
|
+
_this$otherParams18,
|
|
2720
|
+
_this$store$resource3,
|
|
2721
|
+
_this$store$resource4,
|
|
2684
2722
|
businessCode,
|
|
2685
2723
|
channel,
|
|
2686
2724
|
openDataTarget,
|
|
@@ -2709,6 +2747,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2709
2747
|
occupancyMinutes,
|
|
2710
2748
|
paxBounds,
|
|
2711
2749
|
error,
|
|
2750
|
+
_occupancyMinutes,
|
|
2751
|
+
_paxBounds,
|
|
2752
|
+
_error,
|
|
2712
2753
|
occupyDetails,
|
|
2713
2754
|
occupyDetail,
|
|
2714
2755
|
resourceSelectType,
|
|
@@ -2733,11 +2774,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2733
2774
|
resourceId: normalizedResourceId
|
|
2734
2775
|
});
|
|
2735
2776
|
_context37.prev = 3;
|
|
2736
|
-
businessCode = String((_this$otherParams$bus = (_this$
|
|
2737
|
-
channel = String((_this$otherParams$cha = (_this$
|
|
2777
|
+
businessCode = String((_this$otherParams$bus = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
|
|
2778
|
+
channel = String((_this$otherParams$cha = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
|
|
2738
2779
|
openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
|
|
2739
2780
|
_context37.next = 9;
|
|
2740
|
-
return (_this$
|
|
2781
|
+
return (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 || (_this$otherParams17$g = _this$otherParams17.getOpenData) === null || _this$otherParams17$g === void 0 ? void 0 : _this$otherParams17$g.call(_this$otherParams17, {
|
|
2741
2782
|
scope: 'board',
|
|
2742
2783
|
target: openDataTarget,
|
|
2743
2784
|
section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
|
|
@@ -2808,7 +2849,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2808
2849
|
case 31:
|
|
2809
2850
|
// Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
|
|
2810
2851
|
// (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
|
|
2811
|
-
tempOrder = this.
|
|
2852
|
+
tempOrder = this.ensureScanOrderTempOrder();
|
|
2812
2853
|
reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
|
|
2813
2854
|
if (!(!normalizedResourceId || reservationLinkIds.length === 0)) {
|
|
2814
2855
|
_context37.next = 37;
|
|
@@ -2875,6 +2916,29 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2875
2916
|
scheduleDatetime: scheduleDatetime,
|
|
2876
2917
|
cacheId: this.cacheId
|
|
2877
2918
|
});
|
|
2919
|
+
if (Array.isArray(loaded)) {
|
|
2920
|
+
this.enabledReservationRuleProducts = loaded;
|
|
2921
|
+
_occupancyMinutes = pickFirstDurationMinutesFromProducts(loaded);
|
|
2922
|
+
if (_occupancyMinutes !== undefined) {
|
|
2923
|
+
tempOrder.metadata.table_occupancy_duration = _occupancyMinutes;
|
|
2924
|
+
}
|
|
2925
|
+
if (hasCustomCapacityProduct(loaded)) {
|
|
2926
|
+
pendingRequestEntryPax = 1;
|
|
2927
|
+
_paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
|
|
2928
|
+
if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.min) !== undefined) pendingRequestPaxMin = _paxBounds.min;
|
|
2929
|
+
if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.max) !== undefined) pendingRequestPaxMax = _paxBounds.max;
|
|
2930
|
+
}
|
|
2931
|
+
} else {
|
|
2932
|
+
this.enabledReservationRuleProducts = [];
|
|
2933
|
+
_error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
|
|
2934
|
+
this.logMethodError('loadReservationRuleProducts', _error, {
|
|
2935
|
+
resourceId: resourceId,
|
|
2936
|
+
reservationLinkIds: reservationLinkIds,
|
|
2937
|
+
scheduleDate: scheduleDate,
|
|
2938
|
+
scheduleDatetime: scheduleDatetime,
|
|
2939
|
+
cacheId: this.cacheId
|
|
2940
|
+
});
|
|
2941
|
+
}
|
|
2878
2942
|
}
|
|
2879
2943
|
|
|
2880
2944
|
// Step2: 请求新的资源占用详情接口。occupy_details 第一维是资源,不是订单。
|
|
@@ -2951,19 +3015,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2951
3015
|
} : {}), this.store.resource.requestPaxMax !== undefined ? {
|
|
2952
3016
|
requestPaxMax: this.store.resource.requestPaxMax
|
|
2953
3017
|
} : {});
|
|
2954
|
-
tempOrder.relation_id = normalizedResourceId || ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.relation_id);
|
|
2955
|
-
tempOrder.table_form_id = resourceState.tableFormId;
|
|
2956
|
-
tempOrder.resource_id = normalizedResourceId;
|
|
2957
3018
|
(_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || _this$store$order6.persistTempOrder();
|
|
2958
3019
|
|
|
2959
3020
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
2960
3021
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
2961
|
-
_context37.next =
|
|
3022
|
+
_context37.next = 73;
|
|
2962
3023
|
break;
|
|
2963
3024
|
}
|
|
2964
|
-
_context37.next =
|
|
3025
|
+
_context37.next = 73;
|
|
2965
3026
|
return this.addNewOrder();
|
|
2966
|
-
case
|
|
3027
|
+
case 73:
|
|
2967
3028
|
isAdditionalOrderMode = availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code'; // 如果是加单模式,tempOrder 里需要记录目标订单 id,提交的时候走加单接口
|
|
2968
3029
|
if (isAdditionalOrderMode) {
|
|
2969
3030
|
tempOrder.order_id = additionalOrderId;
|
|
@@ -2979,13 +3040,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2979
3040
|
} : {}));
|
|
2980
3041
|
return acc;
|
|
2981
3042
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
2982
|
-
_context37.next =
|
|
3043
|
+
_context37.next = 79;
|
|
2983
3044
|
return this.setItemRuleRuntimeConfig({
|
|
2984
|
-
serviceType: (_this$
|
|
3045
|
+
serviceType: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
|
|
2985
3046
|
submissionIndex: isAdditionalOrderMode ? 1 : 0,
|
|
2986
3047
|
historicalItems: historicalItems
|
|
2987
3048
|
});
|
|
2988
|
-
case
|
|
3049
|
+
case 79:
|
|
2989
3050
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
2990
3051
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
2991
3052
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -2999,28 +3060,28 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2999
3060
|
orderId: availabilityInfo.order_id,
|
|
3000
3061
|
relationId: availabilityInfo.relation_id,
|
|
3001
3062
|
tableFormId: availabilityInfo.table_form_id,
|
|
3002
|
-
persistedRelationId:
|
|
3003
|
-
persistedResourceId:
|
|
3063
|
+
persistedRelationId: (_this$store$resource3 = this.store.resource) === null || _this$store$resource3 === void 0 ? void 0 : _this$store$resource3.relationId,
|
|
3064
|
+
persistedResourceId: (_this$store$resource4 = this.store.resource) === null || _this$store$resource4 === void 0 ? void 0 : _this$store$resource4.relationId,
|
|
3004
3065
|
deskmateValid: availabilityInfo.deskmate_valid,
|
|
3005
3066
|
resourceSelectType: resourceState.resourceSelectType,
|
|
3006
3067
|
isExclusive: resourceState.isExclusive,
|
|
3007
3068
|
isFull: resourceState.isFull
|
|
3008
3069
|
});
|
|
3009
3070
|
return _context37.abrupt("return", availabilityInfo);
|
|
3010
|
-
case
|
|
3011
|
-
_context37.prev =
|
|
3071
|
+
case 84:
|
|
3072
|
+
_context37.prev = 84;
|
|
3012
3073
|
_context37.t0 = _context37["catch"](3);
|
|
3013
3074
|
this.logMethodError('checkResourceAvailable', _context37.t0.message, {
|
|
3014
3075
|
resourceId: normalizedResourceId
|
|
3015
3076
|
});
|
|
3016
3077
|
throw _context37.t0;
|
|
3017
|
-
case
|
|
3078
|
+
case 88:
|
|
3018
3079
|
case "end":
|
|
3019
3080
|
return _context37.stop();
|
|
3020
3081
|
}
|
|
3021
|
-
}, _callee37, this, [[3,
|
|
3082
|
+
}, _callee37, this, [[3, 84]]);
|
|
3022
3083
|
}));
|
|
3023
|
-
function checkResourceAvailable(
|
|
3084
|
+
function checkResourceAvailable(_x20) {
|
|
3024
3085
|
return _checkResourceAvailable.apply(this, arguments);
|
|
3025
3086
|
}
|
|
3026
3087
|
return checkResourceAvailable;
|
|
@@ -3029,18 +3090,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3029
3090
|
key: "restorePreviousOrderData",
|
|
3030
3091
|
value: function () {
|
|
3031
3092
|
var _restorePreviousOrderData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3032
|
-
var
|
|
3093
|
+
var orderModule, tempOrder, _res$data, res, entryPaxNumber;
|
|
3033
3094
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3034
3095
|
while (1) switch (_context38.prev = _context38.next) {
|
|
3035
3096
|
case 0:
|
|
3036
|
-
|
|
3097
|
+
orderModule = this.store.order;
|
|
3098
|
+
if (orderModule) {
|
|
3099
|
+
_context38.next = 3;
|
|
3100
|
+
break;
|
|
3101
|
+
}
|
|
3102
|
+
return _context38.abrupt("return");
|
|
3103
|
+
case 3:
|
|
3104
|
+
tempOrder = orderModule.ensureTempOrder();
|
|
3037
3105
|
if (!tempOrder.order_id) {
|
|
3038
|
-
_context38.next =
|
|
3106
|
+
_context38.next = 12;
|
|
3039
3107
|
break;
|
|
3040
3108
|
}
|
|
3041
|
-
_context38.next =
|
|
3042
|
-
return
|
|
3043
|
-
case
|
|
3109
|
+
_context38.next = 7;
|
|
3110
|
+
return orderModule.getOrderInfo(tempOrder.order_id);
|
|
3111
|
+
case 7:
|
|
3044
3112
|
res = _context38.sent;
|
|
3045
3113
|
// 找到下单的时候输入的 entryPaxNumber
|
|
3046
3114
|
entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
|
|
@@ -3048,12 +3116,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3048
3116
|
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
3049
3117
|
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
3050
3118
|
if (!entryPaxNumber) {
|
|
3051
|
-
_context38.next =
|
|
3119
|
+
_context38.next = 12;
|
|
3052
3120
|
break;
|
|
3053
3121
|
}
|
|
3054
|
-
_context38.next =
|
|
3122
|
+
_context38.next = 12;
|
|
3055
3123
|
return this.setEntryPaxNumber(entryPaxNumber);
|
|
3056
|
-
case
|
|
3124
|
+
case 12:
|
|
3057
3125
|
case "end":
|
|
3058
3126
|
return _context38.stop();
|
|
3059
3127
|
}
|
|
@@ -3100,31 +3168,32 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3100
3168
|
key: "getProductList",
|
|
3101
3169
|
value: function () {
|
|
3102
3170
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3103
|
-
var _this$
|
|
3104
|
-
var menu_list_ids, res, productList, formattedRes;
|
|
3171
|
+
var _this$otherParams19;
|
|
3172
|
+
var associatedMenus, menu_list_ids, res, productList, formattedRes;
|
|
3105
3173
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3106
3174
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3107
3175
|
case 0:
|
|
3108
3176
|
this.logMethodStart('getProductList');
|
|
3109
3177
|
// 可以直接通过配置里的 menu 读取
|
|
3110
|
-
|
|
3178
|
+
associatedMenus = (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 || (_this$otherParams19 = _this$otherParams19.dineInConfig) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19['menu.associated_menus'];
|
|
3179
|
+
menu_list_ids = associatedMenus.map(function (n) {
|
|
3111
3180
|
return Number(n.value);
|
|
3112
|
-
})
|
|
3113
|
-
_context40.prev =
|
|
3181
|
+
}) || [];
|
|
3182
|
+
_context40.prev = 3;
|
|
3114
3183
|
if (this.store.products) {
|
|
3115
|
-
_context40.next =
|
|
3184
|
+
_context40.next = 6;
|
|
3116
3185
|
break;
|
|
3117
3186
|
}
|
|
3118
3187
|
throw new Error('products 模块未初始化');
|
|
3119
|
-
case
|
|
3120
|
-
_context40.next =
|
|
3188
|
+
case 6:
|
|
3189
|
+
_context40.next = 8;
|
|
3121
3190
|
return this.store.products.loadProducts({
|
|
3122
3191
|
menu_list_ids: menu_list_ids,
|
|
3123
3192
|
cacheId: this.cacheId,
|
|
3124
3193
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
3125
3194
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3126
3195
|
});
|
|
3127
|
-
case
|
|
3196
|
+
case 8:
|
|
3128
3197
|
res = _context40.sent;
|
|
3129
3198
|
productList = this.assertProductListLoaded('getProductList', res, {
|
|
3130
3199
|
menu_list_ids: menu_list_ids,
|
|
@@ -3135,9 +3204,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3135
3204
|
menuCount: menu_list_ids.length
|
|
3136
3205
|
});
|
|
3137
3206
|
return _context40.abrupt("return", formattedRes);
|
|
3138
|
-
case
|
|
3139
|
-
_context40.prev =
|
|
3140
|
-
_context40.t0 = _context40["catch"](
|
|
3207
|
+
case 15:
|
|
3208
|
+
_context40.prev = 15;
|
|
3209
|
+
_context40.t0 = _context40["catch"](3);
|
|
3141
3210
|
if (!(_context40.t0 !== null && _context40.t0 !== void 0 && _context40.t0.__scanOrderLogged)) {
|
|
3142
3211
|
this.logMethodError('getProductList', _context40.t0, {
|
|
3143
3212
|
menu_list_ids: menu_list_ids,
|
|
@@ -3145,11 +3214,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3145
3214
|
});
|
|
3146
3215
|
}
|
|
3147
3216
|
throw _context40.t0;
|
|
3148
|
-
case
|
|
3217
|
+
case 19:
|
|
3149
3218
|
case "end":
|
|
3150
3219
|
return _context40.stop();
|
|
3151
3220
|
}
|
|
3152
|
-
}, _callee40, this, [[
|
|
3221
|
+
}, _callee40, this, [[3, 15]]);
|
|
3153
3222
|
}));
|
|
3154
3223
|
function getProductList() {
|
|
3155
3224
|
return _getProductList.apply(this, arguments);
|
|
@@ -3165,14 +3234,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3165
3234
|
key: "setOtherParams",
|
|
3166
3235
|
value: function () {
|
|
3167
3236
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3168
|
-
var
|
|
3169
|
-
|
|
3237
|
+
var _ref8,
|
|
3238
|
+
_ref8$cover,
|
|
3170
3239
|
cover,
|
|
3171
3240
|
_args41 = arguments;
|
|
3172
3241
|
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3173
3242
|
while (1) switch (_context41.prev = _context41.next) {
|
|
3174
3243
|
case 0:
|
|
3175
|
-
|
|
3244
|
+
_ref8 = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {}, _ref8$cover = _ref8.cover, cover = _ref8$cover === void 0 ? false : _ref8$cover;
|
|
3176
3245
|
if (cover) {
|
|
3177
3246
|
this.otherParams = params;
|
|
3178
3247
|
} else {
|
|
@@ -3184,7 +3253,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3184
3253
|
}
|
|
3185
3254
|
}, _callee41, this);
|
|
3186
3255
|
}));
|
|
3187
|
-
function setOtherParams(
|
|
3256
|
+
function setOtherParams(_x21) {
|
|
3188
3257
|
return _setOtherParams.apply(this, arguments);
|
|
3189
3258
|
}
|
|
3190
3259
|
return setOtherParams;
|
|
@@ -3309,7 +3378,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3309
3378
|
}
|
|
3310
3379
|
}, _callee42, this);
|
|
3311
3380
|
}));
|
|
3312
|
-
function setEntryPaxNumber(
|
|
3381
|
+
function setEntryPaxNumber(_x22) {
|
|
3313
3382
|
return _setEntryPaxNumber.apply(this, arguments);
|
|
3314
3383
|
}
|
|
3315
3384
|
return setEntryPaxNumber;
|
|
@@ -3323,18 +3392,24 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3323
3392
|
key: "syncAdditionalOrderFromResource",
|
|
3324
3393
|
value: function () {
|
|
3325
3394
|
var _syncAdditionalOrderFromResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(resourceId) {
|
|
3326
|
-
var _ref10, _ref11,
|
|
3395
|
+
var _ref9, _ref10, _ref11, _this$store$resource5, _this$store$resource6, _occupyDetails$2, _this$store$resource7, _this$otherParams20, _this$store$order8;
|
|
3327
3396
|
var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, allowAddItems, result;
|
|
3328
3397
|
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3329
3398
|
while (1) switch (_context43.prev = _context43.next) {
|
|
3330
3399
|
case 0:
|
|
3331
|
-
|
|
3332
|
-
|
|
3400
|
+
if (this.store.order) {
|
|
3401
|
+
_context43.next = 2;
|
|
3402
|
+
break;
|
|
3403
|
+
}
|
|
3404
|
+
throw new Error('order 模块未初始化');
|
|
3405
|
+
case 2:
|
|
3406
|
+
tempOrder = this.store.order.ensureTempOrder();
|
|
3407
|
+
normalizedResourceId = String((_ref9 = (_ref10 = (_ref11 = resourceId !== null && resourceId !== void 0 ? resourceId : tempOrder.resource_id) !== null && _ref11 !== void 0 ? _ref11 : (_this$store$resource5 = this.store.resource) === null || _this$store$resource5 === void 0 ? void 0 : _this$store$resource5.relationId) !== null && _ref10 !== void 0 ? _ref10 : (_this$store$resource6 = this.store.resource) === null || _this$store$resource6 === void 0 ? void 0 : _this$store$resource6.relation_id) !== null && _ref9 !== void 0 ? _ref9 : '').trim();
|
|
3333
3408
|
this.logMethodStart('syncAdditionalOrderFromResource', {
|
|
3334
3409
|
resourceId: normalizedResourceId
|
|
3335
3410
|
});
|
|
3336
3411
|
if (normalizedResourceId) {
|
|
3337
|
-
_context43.next =
|
|
3412
|
+
_context43.next = 9;
|
|
3338
3413
|
break;
|
|
3339
3414
|
}
|
|
3340
3415
|
_result = {
|
|
@@ -3343,17 +3418,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3343
3418
|
};
|
|
3344
3419
|
this.logMethodSuccess('syncAdditionalOrderFromResource', _result);
|
|
3345
3420
|
return _context43.abrupt("return", _result);
|
|
3346
|
-
case 7:
|
|
3347
|
-
_context43.next = 9;
|
|
3348
|
-
return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
3349
3421
|
case 9:
|
|
3422
|
+
_context43.next = 11;
|
|
3423
|
+
return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
3424
|
+
case 11:
|
|
3350
3425
|
occupyDetails = _context43.sent;
|
|
3351
3426
|
occupyDetail = (_occupyDetails$2 = occupyDetails[0]) !== null && _occupyDetails$2 !== void 0 ? _occupyDetails$2 : null;
|
|
3352
|
-
resourceSelectType = ((_this$store$
|
|
3353
|
-
allowAddItems = toBoolean((_this$
|
|
3427
|
+
resourceSelectType = ((_this$store$resource7 = this.store.resource) === null || _this$store$resource7 === void 0 ? void 0 : _this$store$resource7.resourceSelectType) || this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id));
|
|
3428
|
+
allowAddItems = toBoolean((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 || (_this$otherParams20 = _this$otherParams20.dineInConfig) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20['sale.allow_add_items']);
|
|
3354
3429
|
result = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType, allowAddItems);
|
|
3355
3430
|
if (!(!result.matched || !result.order_id)) {
|
|
3356
|
-
_context43.next =
|
|
3431
|
+
_context43.next = 19;
|
|
3357
3432
|
break;
|
|
3358
3433
|
}
|
|
3359
3434
|
this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
|
|
@@ -3362,25 +3437,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3362
3437
|
allowAddItems: allowAddItems
|
|
3363
3438
|
}));
|
|
3364
3439
|
return _context43.abrupt("return", result);
|
|
3365
|
-
case
|
|
3440
|
+
case 19:
|
|
3366
3441
|
tempOrder.order_id = result.order_id;
|
|
3367
3442
|
tempOrder.resource_id = normalizedResourceId;
|
|
3368
3443
|
tempOrder.relation_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
3369
3444
|
tempOrder.table_form_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
|
|
3370
|
-
(_this$store$
|
|
3445
|
+
(_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || _this$store$order8.persistTempOrder();
|
|
3371
3446
|
this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
|
|
3372
3447
|
resourceId: normalizedResourceId,
|
|
3373
3448
|
resourceSelectType: resourceSelectType,
|
|
3374
3449
|
allowAddItems: allowAddItems
|
|
3375
3450
|
}));
|
|
3376
3451
|
return _context43.abrupt("return", result);
|
|
3377
|
-
case
|
|
3452
|
+
case 26:
|
|
3378
3453
|
case "end":
|
|
3379
3454
|
return _context43.stop();
|
|
3380
3455
|
}
|
|
3381
3456
|
}, _callee43, this);
|
|
3382
3457
|
}));
|
|
3383
|
-
function syncAdditionalOrderFromResource(
|
|
3458
|
+
function syncAdditionalOrderFromResource(_x23) {
|
|
3384
3459
|
return _syncAdditionalOrderFromResource.apply(this, arguments);
|
|
3385
3460
|
}
|
|
3386
3461
|
return syncAdditionalOrderFromResource;
|
|
@@ -3389,9 +3464,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3389
3464
|
}, {
|
|
3390
3465
|
key: "getReservationResourceSelectType",
|
|
3391
3466
|
value: function getReservationResourceSelectType() {
|
|
3392
|
-
var _this$store$
|
|
3467
|
+
var _this$store$resource8;
|
|
3393
3468
|
this.logMethodStart('getReservationResourceSelectType');
|
|
3394
|
-
var resourceSelectType = (_this$store$
|
|
3469
|
+
var resourceSelectType = (_this$store$resource8 = this.store.resource) === null || _this$store$resource8 === void 0 ? void 0 : _this$store$resource8.resourceSelectType;
|
|
3395
3470
|
var result = _objectSpread(_objectSpread({}, resourceSelectType ? {
|
|
3396
3471
|
resourceSelectType: resourceSelectType
|
|
3397
3472
|
} : {}), {}, {
|
|
@@ -3408,9 +3483,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3408
3483
|
}, {
|
|
3409
3484
|
key: "checkAllowAddItems",
|
|
3410
3485
|
value: function checkAllowAddItems() {
|
|
3411
|
-
var _this$
|
|
3486
|
+
var _this$otherParams21;
|
|
3412
3487
|
this.logMethodStart('checkAllowAddItems');
|
|
3413
|
-
var dineInConfig = ((_this$
|
|
3488
|
+
var dineInConfig = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.dineInConfig) || {};
|
|
3414
3489
|
var result = {
|
|
3415
3490
|
enabled: toBoolean(dineInConfig['sale.allow_add_items'])
|
|
3416
3491
|
};
|
|
@@ -3423,9 +3498,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3423
3498
|
}, {
|
|
3424
3499
|
key: "getFulfillmentModes",
|
|
3425
3500
|
value: function getFulfillmentModes() {
|
|
3426
|
-
var _this$
|
|
3501
|
+
var _this$otherParams22;
|
|
3427
3502
|
this.logMethodStart('getFulfillmentModes');
|
|
3428
|
-
var dineInConfig = ((_this$
|
|
3503
|
+
var dineInConfig = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.dineInConfig) || {};
|
|
3429
3504
|
var result = {
|
|
3430
3505
|
enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
|
|
3431
3506
|
enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
|
|
@@ -3439,9 +3514,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3439
3514
|
}, {
|
|
3440
3515
|
key: "checkManualPickupRef",
|
|
3441
3516
|
value: function checkManualPickupRef() {
|
|
3442
|
-
var _this$
|
|
3517
|
+
var _this$otherParams23;
|
|
3443
3518
|
this.logMethodStart('checkManualPickupRef');
|
|
3444
|
-
var dineInConfig = ((_this$
|
|
3519
|
+
var dineInConfig = ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.dineInConfig) || {};
|
|
3445
3520
|
var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
|
|
3446
3521
|
var manualInputType = dineInConfig['fulfillment.manual_input_type'];
|
|
3447
3522
|
var enabled = refMode === 'manual_input';
|
|
@@ -3459,6 +3534,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3459
3534
|
}
|
|
3460
3535
|
}]);
|
|
3461
3536
|
return ScanOrderImpl;
|
|
3462
|
-
}(
|
|
3537
|
+
}(BaseSalesImpl);
|
|
3463
3538
|
_defineProperty(ScanOrderImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
|
|
3464
3539
|
_defineProperty(ScanOrderImpl, "UI_STATE_KEY_PREFIX", 'pisell.scanOrder.uiState:');
|