@pisell/pisellos 0.0.568 → 0.0.570
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/effects/index.d.ts +2 -2
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +3 -3
- package/dist/model/strategy/adapter/itemRule/type.d.ts +6 -6
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/promotion/type.d.ts +5 -5
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/model/strategy/type.d.ts +1 -1
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +4 -4
- 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/utils/cartProduct.js +26 -5
- package/dist/modules/Cart/utils/changePrice.js +27 -20
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +3 -1
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -9
- package/dist/modules/Discount/types.d.ts +2 -1
- package/dist/modules/Holder/types.d.ts +1 -1
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +36 -16
- package/dist/modules/OpenData/types.d.ts +1 -1
- package/dist/modules/Order/index.d.ts +448 -23
- package/dist/modules/Order/index.js +5417 -561
- 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 +465 -703
- package/dist/modules/Payment/types.d.ts +47 -23
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.js +44 -29
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +184 -74
- package/dist/modules/ProductList/types.d.ts +17 -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 +222 -109
- package/dist/modules/Rules/types.d.ts +15 -4
- 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 +803 -163
- package/dist/modules/ScanOrderLogger/types.d.ts +2 -2
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +78 -24
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +11 -9
- package/dist/modules/Summary/index.js +4 -3
- 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 +3 -2
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6112 -656
- 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/types.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2326 -379
- package/dist/server/modules/order/types.d.ts +91 -20
- 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 +1393 -516
- package/dist/server/modules/products/types.d.ts +35 -2
- 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 +278 -66
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +108 -86
- package/dist/server/modules/resource/types.d.ts +1 -1
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +116 -85
- package/dist/server/modules/schedule/utils.d.ts +1 -1
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +6 -4
- package/dist/server/utils/product.js +2 -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 +4006 -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 +2 -2
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +382 -25
- package/dist/solution/BookingTicket/index.js +2506 -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 +41 -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 +11 -3
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- 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/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +25 -34
- package/dist/solution/Checkout/utils/index.js +4 -4
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +29 -5
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +499 -434
- package/dist/solution/ScanOrder/types.d.ts +38 -16
- 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 +4 -4
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.d.ts +2 -2
- 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 +29 -20
- package/dist/solution/VenueBooking/index.js +301 -213
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/types.d.ts +1 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- 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.d.ts +2 -2
- package/dist/utils/watch.d.ts +2 -2
- package/lib/effects/index.d.ts +2 -2
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +3 -3
- package/lib/model/strategy/adapter/itemRule/type.d.ts +6 -6
- package/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +5 -5
- package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
- package/lib/model/strategy/type.d.ts +1 -1
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +4 -4
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +390 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +48 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +63 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +126 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +78 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +330 -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 +24 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +419 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
- package/lib/modules/Cart/utils/cartProduct.js +27 -5
- package/lib/modules/Cart/utils/changePrice.js +20 -14
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +63 -10
- package/lib/modules/Customer/types.d.ts +3 -1
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +18 -2
- package/lib/modules/Discount/types.d.ts +2 -1
- package/lib/modules/Holder/types.d.ts +1 -1
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +21 -3
- package/lib/modules/OpenData/types.d.ts +1 -1
- package/lib/modules/Order/index.d.ts +448 -23
- package/lib/modules/Order/index.js +3641 -308
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +55 -1
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +974 -138
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +30 -124
- package/lib/modules/Payment/types.d.ts +47 -23
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +4 -3
- package/lib/modules/Payment/walletpass.js +16 -6
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +92 -51
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +76 -20
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +147 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +895 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +5 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +153 -61
- package/lib/modules/Rules/types.d.ts +15 -4
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +84 -16
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +616 -111
- package/lib/modules/ScanOrderLogger/types.d.ts +2 -2
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/lib/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +49 -14
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +11 -9
- package/lib/modules/Summary/index.js +2 -2
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +95 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +5 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +33 -0
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/request.d.ts +3 -2
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +3901 -205
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +306 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +19 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +21 -0
- package/lib/server/modules/menu/types.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1324 -141
- package/lib/server/modules/order/types.d.ts +91 -20
- package/lib/server/modules/order/types.js +11 -1
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +119 -11
- package/lib/server/modules/order/utils/filterOrders.js +238 -13
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +168 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +5 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +588 -97
- package/lib/server/modules/products/types.d.ts +35 -2
- package/lib/server/modules/products/types.js +3 -0
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +145 -1
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +71 -45
- package/lib/server/modules/resource/types.d.ts +1 -1
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +55 -44
- package/lib/server/modules/schedule/utils.d.ts +1 -1
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +6 -4
- package/lib/server/utils/product.js +2 -2
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2367 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +47 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +259 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +382 -25
- package/lib/solution/BookingTicket/index.js +1350 -76
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +71 -10
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +200 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +24 -3
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +4 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +14 -2
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +18 -19
- package/lib/solution/Checkout/utils/index.js +4 -4
- package/lib/solution/RegisterAndLogin/config.js +2 -10
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +296 -39
- package/lib/solution/Sales/types.d.ts +29 -5
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +144 -103
- package/lib/solution/ScanOrder/types.d.ts +38 -16
- package/lib/solution/ScanOrder/types.js +4 -5
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +98 -26
- package/lib/solution/ShopDiscount/index.js +3 -3
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1050 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +14 -0
- package/lib/solution/VenueBooking/index.d.ts +29 -20
- package/lib/solution/VenueBooking/index.js +169 -94
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.d.ts +1 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +22 -0
- package/lib/types/index.d.ts +12 -2
- package/lib/utils/task.d.ts +2 -2
- package/lib/utils/watch.d.ts +2 -2
- package/package.json +18 -19
- package/dist/model/strategy/adapter/promotion/index.d.ts +0 -4
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/model/strategy/adapter/promotion/index.d.ts +0 -4
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -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() {
|
|
@@ -430,70 +427,42 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
430
427
|
}
|
|
431
428
|
return refreshOrderMarketingAfterLogin;
|
|
432
429
|
}()
|
|
430
|
+
}, {
|
|
431
|
+
key: "getRegisteredModuleNames",
|
|
432
|
+
value: function getRegisteredModuleNames() {
|
|
433
|
+
return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'schedule'];
|
|
434
|
+
}
|
|
435
|
+
}, {
|
|
436
|
+
key: "createSubModule",
|
|
437
|
+
value: function createSubModule(moduleName) {
|
|
438
|
+
if (moduleName === 'scanOrderLogger') {
|
|
439
|
+
return createModule('scanOrderLogger', this.name);
|
|
440
|
+
}
|
|
441
|
+
return _get(_getPrototypeOf(ScanOrderImpl.prototype), "createSubModule", this).call(this, moduleName);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
433
445
|
}, {
|
|
434
446
|
key: "getCacheId",
|
|
435
447
|
value: function getCacheId() {
|
|
436
448
|
return this.cacheId;
|
|
437
449
|
}
|
|
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
450
|
}, {
|
|
476
451
|
key: "initialize",
|
|
477
452
|
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;
|
|
453
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(core) {
|
|
454
|
+
var _options$otherParams, _this$otherParams, _this$otherParams2, _this$otherParams3;
|
|
484
455
|
var options,
|
|
485
|
-
|
|
486
|
-
|
|
456
|
+
_this$otherParams4,
|
|
457
|
+
_this$otherParams5,
|
|
487
458
|
_this$store$order,
|
|
488
459
|
_this$store$order2,
|
|
489
|
-
|
|
490
|
-
return _regeneratorRuntime().wrap(function
|
|
491
|
-
while (1) switch (
|
|
460
|
+
_args6 = arguments;
|
|
461
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
462
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
492
463
|
case 0:
|
|
493
|
-
options =
|
|
464
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
494
465
|
this.logMethodStart('initialize');
|
|
495
|
-
this.core = core;
|
|
496
|
-
this.initializeOptions = options || {};
|
|
497
466
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store);
|
|
498
467
|
this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
|
|
499
468
|
this.store.status = 'initializing';
|
|
@@ -509,120 +478,74 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
509
478
|
passed: null,
|
|
510
479
|
failures: []
|
|
511
480
|
};
|
|
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
|
-
});
|
|
481
|
+
_context6.next = 16;
|
|
482
|
+
return _get(_getPrototypeOf(ScanOrderImpl.prototype), "initialize", this).call(this, core, options);
|
|
483
|
+
case 16:
|
|
561
484
|
if (this.store.scanOrderLogger) {
|
|
485
|
+
this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.scanOrderLoggerProvider) || 'feishu');
|
|
486
|
+
this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.scanOrderLoggerConfig) || {
|
|
487
|
+
feishu: {
|
|
488
|
+
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
|
|
489
|
+
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
|
|
490
|
+
}
|
|
491
|
+
});
|
|
562
492
|
this.store.scanOrderLogger.setContext(this.getScanOrderLoggerContext());
|
|
563
493
|
}
|
|
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
494
|
this.registerCustomerLoginListeners();
|
|
572
|
-
|
|
573
|
-
|
|
495
|
+
_context6.prev = 18;
|
|
496
|
+
_context6.next = 21;
|
|
574
497
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
575
498
|
createIfMissing: false
|
|
576
499
|
});
|
|
577
|
-
case
|
|
500
|
+
case 21:
|
|
578
501
|
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
579
|
-
|
|
502
|
+
_context6.next = 24;
|
|
580
503
|
return this.loadRuntimeConfigs();
|
|
581
|
-
case
|
|
504
|
+
case 24:
|
|
582
505
|
if (!this.store.schedule) {
|
|
583
|
-
|
|
506
|
+
_context6.next = 33;
|
|
584
507
|
break;
|
|
585
508
|
}
|
|
586
|
-
|
|
587
|
-
|
|
509
|
+
_context6.prev = 25;
|
|
510
|
+
_context6.next = 28;
|
|
588
511
|
return this.store.schedule.loadAllSchedule();
|
|
589
|
-
case
|
|
590
|
-
|
|
512
|
+
case 28:
|
|
513
|
+
_context6.next = 33;
|
|
591
514
|
break;
|
|
592
|
-
case
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过',
|
|
596
|
-
case
|
|
597
|
-
|
|
515
|
+
case 30:
|
|
516
|
+
_context6.prev = 30;
|
|
517
|
+
_context6.t0 = _context6["catch"](25);
|
|
518
|
+
console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过', _context6.t0);
|
|
519
|
+
case 33:
|
|
520
|
+
_context6.next = 35;
|
|
598
521
|
return this.refreshItemRuleQuantityLimits();
|
|
599
|
-
case
|
|
522
|
+
case 35:
|
|
600
523
|
this.store.status = 'ready';
|
|
601
|
-
|
|
524
|
+
_context6.next = 38;
|
|
602
525
|
return this.core.effects.emit(ScanOrderHooks.onInited, {
|
|
603
526
|
status: this.store.status
|
|
604
527
|
});
|
|
605
|
-
case
|
|
528
|
+
case 38:
|
|
606
529
|
this.logMethodSuccess('initialize', {
|
|
607
530
|
status: this.store.status
|
|
608
531
|
});
|
|
609
|
-
|
|
532
|
+
_context6.next = 48;
|
|
610
533
|
break;
|
|
611
|
-
case
|
|
612
|
-
|
|
613
|
-
|
|
534
|
+
case 41:
|
|
535
|
+
_context6.prev = 41;
|
|
536
|
+
_context6.t1 = _context6["catch"](18);
|
|
614
537
|
this.store.status = 'error';
|
|
615
|
-
this.store.error =
|
|
616
|
-
console.error('[ScanOrder] 初始化失败',
|
|
617
|
-
this.logMethodError('initialize',
|
|
538
|
+
this.store.error = _context6.t1 instanceof Error ? _context6.t1.message : '初始化失败';
|
|
539
|
+
console.error('[ScanOrder] 初始化失败', _context6.t1);
|
|
540
|
+
this.logMethodError('initialize', _context6.t1, {
|
|
618
541
|
status: this.store.status
|
|
619
542
|
});
|
|
620
|
-
throw
|
|
621
|
-
case
|
|
543
|
+
throw _context6.t1;
|
|
544
|
+
case 48:
|
|
622
545
|
case "end":
|
|
623
|
-
return
|
|
546
|
+
return _context6.stop();
|
|
624
547
|
}
|
|
625
|
-
},
|
|
548
|
+
}, _callee6, this, [[18, 41], [25, 30]]);
|
|
626
549
|
}));
|
|
627
550
|
function initialize(_x5) {
|
|
628
551
|
return _initialize.apply(this, arguments);
|
|
@@ -632,25 +555,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
632
555
|
}, {
|
|
633
556
|
key: "destroy",
|
|
634
557
|
value: function () {
|
|
635
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
636
|
-
return _regeneratorRuntime().wrap(function
|
|
637
|
-
while (1) switch (
|
|
558
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
559
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
560
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
638
561
|
case 0:
|
|
639
562
|
this.logMethodStart('destroy');
|
|
640
563
|
this.clearLoginEffectListeners();
|
|
641
|
-
|
|
564
|
+
_context7.next = 4;
|
|
642
565
|
return this.core.effects.emit(ScanOrderHooks.onDestroy, {});
|
|
643
566
|
case 4:
|
|
644
|
-
_context8.next = 6;
|
|
645
|
-
return this.destroyRegisteredChildModules();
|
|
646
|
-
case 6:
|
|
647
567
|
_get(_getPrototypeOf(ScanOrderImpl.prototype), "destroy", this).call(this);
|
|
648
568
|
this.logMethodSuccess('destroy');
|
|
649
|
-
case
|
|
569
|
+
case 6:
|
|
650
570
|
case "end":
|
|
651
|
-
return
|
|
571
|
+
return _context7.stop();
|
|
652
572
|
}
|
|
653
|
-
},
|
|
573
|
+
}, _callee7, this);
|
|
654
574
|
}));
|
|
655
575
|
function destroy() {
|
|
656
576
|
return _destroy.apply(this, arguments);
|
|
@@ -660,32 +580,32 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
660
580
|
}, {
|
|
661
581
|
key: "retryInit",
|
|
662
582
|
value: function () {
|
|
663
|
-
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
664
|
-
return _regeneratorRuntime().wrap(function
|
|
665
|
-
while (1) switch (
|
|
583
|
+
var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
584
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
585
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
666
586
|
case 0:
|
|
667
587
|
this.logMethodStart('retryInit');
|
|
668
588
|
// TODO: 细化重试策略(指数退避、最大重试次数)后替换当前实现
|
|
669
|
-
|
|
589
|
+
_context8.next = 3;
|
|
670
590
|
return this.core.effects.emit(ScanOrderHooks.onRetryInit, {});
|
|
671
591
|
case 3:
|
|
672
|
-
|
|
673
|
-
|
|
592
|
+
_context8.prev = 3;
|
|
593
|
+
_context8.next = 6;
|
|
674
594
|
return this.initialize(this.core, this.initializeOptions);
|
|
675
595
|
case 6:
|
|
676
596
|
this.logMethodSuccess('retryInit');
|
|
677
|
-
|
|
597
|
+
_context8.next = 13;
|
|
678
598
|
break;
|
|
679
599
|
case 9:
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
this.logMethodError('retryInit',
|
|
683
|
-
throw
|
|
600
|
+
_context8.prev = 9;
|
|
601
|
+
_context8.t0 = _context8["catch"](3);
|
|
602
|
+
this.logMethodError('retryInit', _context8.t0);
|
|
603
|
+
throw _context8.t0;
|
|
684
604
|
case 13:
|
|
685
605
|
case "end":
|
|
686
|
-
return
|
|
606
|
+
return _context8.stop();
|
|
687
607
|
}
|
|
688
|
-
},
|
|
608
|
+
}, _callee8, this, [[3, 9]]);
|
|
689
609
|
}));
|
|
690
610
|
function retryInit() {
|
|
691
611
|
return _retryInit.apply(this, arguments);
|
|
@@ -695,22 +615,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
695
615
|
}, {
|
|
696
616
|
key: "refresh",
|
|
697
617
|
value: function () {
|
|
698
|
-
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
699
|
-
return _regeneratorRuntime().wrap(function
|
|
700
|
-
while (1) switch (
|
|
618
|
+
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
619
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
620
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
701
621
|
case 0:
|
|
702
622
|
this.logMethodStart('refresh');
|
|
703
623
|
// TODO: 接入真实刷新逻辑(资源重拉取、流程重建)后替换当前实现
|
|
704
|
-
|
|
624
|
+
_context9.prev = 1;
|
|
705
625
|
this.store.status = 'initializing';
|
|
706
|
-
|
|
626
|
+
_context9.next = 5;
|
|
707
627
|
return this.loadRuntimeConfigs();
|
|
708
628
|
case 5:
|
|
709
|
-
|
|
629
|
+
_context9.next = 7;
|
|
710
630
|
return this.refreshItemRuleQuantityLimits();
|
|
711
631
|
case 7:
|
|
712
632
|
this.store.status = 'ready';
|
|
713
|
-
|
|
633
|
+
_context9.next = 10;
|
|
714
634
|
return this.core.effects.emit(ScanOrderHooks.onRefresh, {
|
|
715
635
|
status: this.store.status
|
|
716
636
|
});
|
|
@@ -718,18 +638,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
718
638
|
this.logMethodSuccess('refresh', {
|
|
719
639
|
status: this.store.status
|
|
720
640
|
});
|
|
721
|
-
|
|
641
|
+
_context9.next = 17;
|
|
722
642
|
break;
|
|
723
643
|
case 13:
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
this.logMethodError('refresh',
|
|
727
|
-
throw
|
|
644
|
+
_context9.prev = 13;
|
|
645
|
+
_context9.t0 = _context9["catch"](1);
|
|
646
|
+
this.logMethodError('refresh', _context9.t0);
|
|
647
|
+
throw _context9.t0;
|
|
728
648
|
case 17:
|
|
729
649
|
case "end":
|
|
730
|
-
return
|
|
650
|
+
return _context9.stop();
|
|
731
651
|
}
|
|
732
|
-
},
|
|
652
|
+
}, _callee9, this, [[1, 13]]);
|
|
733
653
|
}));
|
|
734
654
|
function refresh() {
|
|
735
655
|
return _refresh.apply(this, arguments);
|
|
@@ -817,16 +737,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
817
737
|
}, {
|
|
818
738
|
key: "updateTempOrderNote",
|
|
819
739
|
value: function updateTempOrderNote(note) {
|
|
740
|
+
var _this4 = this;
|
|
741
|
+
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
820
742
|
this.logMethodStart('updateTempOrderNote', {
|
|
821
743
|
noteLength: String(note || '').length
|
|
822
744
|
});
|
|
823
745
|
try {
|
|
824
746
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
825
|
-
var result = this.store.order.updateTempOrderNote(note);
|
|
747
|
+
var result = this.store.order.updateTempOrderNote(note, sync);
|
|
748
|
+
if (result && typeof result.then === 'function') {
|
|
749
|
+
return result.then(function (nextNote) {
|
|
750
|
+
_this4.logMethodSuccess('updateTempOrderNote', {
|
|
751
|
+
noteLength: nextNote.length
|
|
752
|
+
});
|
|
753
|
+
return nextNote;
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
var nextNote = result;
|
|
826
757
|
this.logMethodSuccess('updateTempOrderNote', {
|
|
827
|
-
noteLength:
|
|
758
|
+
noteLength: nextNote.length
|
|
828
759
|
});
|
|
829
|
-
return
|
|
760
|
+
return nextNote;
|
|
830
761
|
} catch (error) {
|
|
831
762
|
this.logMethodError('updateTempOrderNote', error);
|
|
832
763
|
throw error;
|
|
@@ -842,12 +773,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
842
773
|
mode: mode
|
|
843
774
|
});
|
|
844
775
|
try {
|
|
845
|
-
var _this$
|
|
776
|
+
var _this$otherParams6;
|
|
846
777
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
847
778
|
var tempOrder = this.store.order.ensureTempOrder();
|
|
848
779
|
tempOrder.metadata = _objectSpread(_objectSpread({}, tempOrder.metadata || {}), {}, {
|
|
849
780
|
shop_service_data: _objectSpread(_objectSpread({}, (tempOrder.metadata || {}).shop_service_data || {}), {}, {
|
|
850
|
-
service_type: ((_this$
|
|
781
|
+
service_type: ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) === 'dine_in' ? 'dine_in' : '',
|
|
851
782
|
pickup_reference_mode: mode
|
|
852
783
|
})
|
|
853
784
|
});
|
|
@@ -884,8 +815,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
884
815
|
}
|
|
885
816
|
}
|
|
886
817
|
}, {
|
|
887
|
-
key: "
|
|
888
|
-
value: function
|
|
818
|
+
key: "ensureScanOrderTempOrder",
|
|
819
|
+
value: function ensureScanOrderTempOrder() {
|
|
889
820
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
890
821
|
return this.store.order.ensureTempOrder();
|
|
891
822
|
}
|
|
@@ -894,37 +825,37 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
894
825
|
}, {
|
|
895
826
|
key: "addNewOrder",
|
|
896
827
|
value: function () {
|
|
897
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
828
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
898
829
|
var tempOrder;
|
|
899
|
-
return _regeneratorRuntime().wrap(function
|
|
900
|
-
while (1) switch (
|
|
830
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
831
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
901
832
|
case 0:
|
|
902
833
|
this.logMethodStart('addNewOrder');
|
|
903
|
-
|
|
834
|
+
_context10.prev = 1;
|
|
904
835
|
if (this.store.order) {
|
|
905
|
-
|
|
836
|
+
_context10.next = 4;
|
|
906
837
|
break;
|
|
907
838
|
}
|
|
908
839
|
throw new Error('order 模块未初始化');
|
|
909
840
|
case 4:
|
|
910
|
-
|
|
841
|
+
_context10.next = 6;
|
|
911
842
|
return this.store.order.addNewOrder();
|
|
912
843
|
case 6:
|
|
913
|
-
tempOrder =
|
|
844
|
+
tempOrder = _context10.sent;
|
|
914
845
|
this.logMethodSuccess('addNewOrder', {
|
|
915
846
|
productCount: tempOrder.products.length
|
|
916
847
|
});
|
|
917
|
-
return
|
|
848
|
+
return _context10.abrupt("return", tempOrder);
|
|
918
849
|
case 11:
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
this.logMethodError('addNewOrder',
|
|
922
|
-
throw
|
|
850
|
+
_context10.prev = 11;
|
|
851
|
+
_context10.t0 = _context10["catch"](1);
|
|
852
|
+
this.logMethodError('addNewOrder', _context10.t0);
|
|
853
|
+
throw _context10.t0;
|
|
923
854
|
case 15:
|
|
924
855
|
case "end":
|
|
925
|
-
return
|
|
856
|
+
return _context10.stop();
|
|
926
857
|
}
|
|
927
|
-
},
|
|
858
|
+
}, _callee10, this, [[1, 11]]);
|
|
928
859
|
}));
|
|
929
860
|
function addNewOrder() {
|
|
930
861
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -935,15 +866,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
935
866
|
}, {
|
|
936
867
|
key: "restoreOrder",
|
|
937
868
|
value: function () {
|
|
938
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
869
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
939
870
|
var tempOrder;
|
|
940
|
-
return _regeneratorRuntime().wrap(function
|
|
941
|
-
while (1) switch (
|
|
871
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
872
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
942
873
|
case 0:
|
|
943
874
|
this.logMethodStart('restoreOrder');
|
|
944
|
-
|
|
875
|
+
_context11.prev = 1;
|
|
945
876
|
if (this.store.order) {
|
|
946
|
-
|
|
877
|
+
_context11.next = 4;
|
|
947
878
|
break;
|
|
948
879
|
}
|
|
949
880
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
@@ -953,17 +884,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
953
884
|
this.enabledReservationRuleProducts = [];
|
|
954
885
|
tempOrder = this.store.order.restoreOrder();
|
|
955
886
|
this.logMethodSuccess('restoreOrder');
|
|
956
|
-
return
|
|
887
|
+
return _context11.abrupt("return", tempOrder);
|
|
957
888
|
case 12:
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
this.logMethodError('restoreOrder',
|
|
961
|
-
throw
|
|
889
|
+
_context11.prev = 12;
|
|
890
|
+
_context11.t0 = _context11["catch"](1);
|
|
891
|
+
this.logMethodError('restoreOrder', _context11.t0);
|
|
892
|
+
throw _context11.t0;
|
|
962
893
|
case 16:
|
|
963
894
|
case "end":
|
|
964
|
-
return
|
|
895
|
+
return _context11.stop();
|
|
965
896
|
}
|
|
966
|
-
},
|
|
897
|
+
}, _callee11, this, [[1, 12]]);
|
|
967
898
|
}));
|
|
968
899
|
function restoreOrder() {
|
|
969
900
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -984,37 +915,37 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
984
915
|
}, {
|
|
985
916
|
key: "getSummary",
|
|
986
917
|
value: function () {
|
|
987
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
918
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
988
919
|
var summary;
|
|
989
|
-
return _regeneratorRuntime().wrap(function
|
|
990
|
-
while (1) switch (
|
|
920
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
921
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
991
922
|
case 0:
|
|
992
923
|
this.logMethodStart('getSummary');
|
|
993
|
-
|
|
924
|
+
_context12.prev = 1;
|
|
994
925
|
if (this.store.order) {
|
|
995
|
-
|
|
926
|
+
_context12.next = 4;
|
|
996
927
|
break;
|
|
997
928
|
}
|
|
998
929
|
throw new Error('order 模块未初始化');
|
|
999
930
|
case 4:
|
|
1000
|
-
|
|
1001
|
-
return this.store.order.
|
|
931
|
+
_context12.next = 6;
|
|
932
|
+
return this.store.order.getOrderSummary();
|
|
1002
933
|
case 6:
|
|
1003
|
-
summary =
|
|
934
|
+
summary = _context12.sent;
|
|
1004
935
|
this.logMethodSuccess('getSummary', {
|
|
1005
936
|
totalAmount: summary.total_amount
|
|
1006
937
|
});
|
|
1007
|
-
return
|
|
938
|
+
return _context12.abrupt("return", summary);
|
|
1008
939
|
case 11:
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
this.logMethodError('getSummary',
|
|
1012
|
-
throw
|
|
940
|
+
_context12.prev = 11;
|
|
941
|
+
_context12.t0 = _context12["catch"](1);
|
|
942
|
+
this.logMethodError('getSummary', _context12.t0);
|
|
943
|
+
throw _context12.t0;
|
|
1013
944
|
case 15:
|
|
1014
945
|
case "end":
|
|
1015
|
-
return
|
|
946
|
+
return _context12.stop();
|
|
1016
947
|
}
|
|
1017
|
-
},
|
|
948
|
+
}, _callee12, this, [[1, 11]]);
|
|
1018
949
|
}));
|
|
1019
950
|
function getSummary() {
|
|
1020
951
|
return _getSummary.apply(this, arguments);
|
|
@@ -1030,30 +961,30 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1030
961
|
}, {
|
|
1031
962
|
key: "scanCode",
|
|
1032
963
|
value: function () {
|
|
1033
|
-
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
964
|
+
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(code, customerId) {
|
|
1034
965
|
var raw;
|
|
1035
|
-
return _regeneratorRuntime().wrap(function
|
|
1036
|
-
while (1) switch (
|
|
966
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
967
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1037
968
|
case 0:
|
|
1038
969
|
this.logMethodStart('scanCode', {
|
|
1039
970
|
code: code
|
|
1040
971
|
});
|
|
1041
|
-
|
|
972
|
+
_context13.prev = 1;
|
|
1042
973
|
if (this.store.order) {
|
|
1043
|
-
|
|
974
|
+
_context13.next = 4;
|
|
1044
975
|
break;
|
|
1045
976
|
}
|
|
1046
977
|
throw new Error('order 模块未初始化');
|
|
1047
978
|
case 4:
|
|
1048
|
-
|
|
979
|
+
_context13.next = 6;
|
|
1049
980
|
return this.store.order.scanCode(code, customerId);
|
|
1050
981
|
case 6:
|
|
1051
|
-
raw =
|
|
982
|
+
raw = _context13.sent;
|
|
1052
983
|
if (!raw.isAvailable) {
|
|
1053
|
-
|
|
984
|
+
_context13.next = 11;
|
|
1054
985
|
break;
|
|
1055
986
|
}
|
|
1056
|
-
|
|
987
|
+
_context13.next = 10;
|
|
1057
988
|
return this.store.order.recalculateSummary({
|
|
1058
989
|
createIfMissing: true
|
|
1059
990
|
});
|
|
@@ -1063,21 +994,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1063
994
|
this.logMethodSuccess('scanCode', {
|
|
1064
995
|
isAvailable: raw.isAvailable
|
|
1065
996
|
});
|
|
1066
|
-
return
|
|
997
|
+
return _context13.abrupt("return", {
|
|
1067
998
|
isAvailable: raw.isAvailable,
|
|
1068
999
|
type: raw.type,
|
|
1069
1000
|
unavailableReason: raw.unavailableReason
|
|
1070
1001
|
});
|
|
1071
1002
|
case 15:
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
this.logMethodError('scanCode',
|
|
1075
|
-
throw
|
|
1003
|
+
_context13.prev = 15;
|
|
1004
|
+
_context13.t0 = _context13["catch"](1);
|
|
1005
|
+
this.logMethodError('scanCode', _context13.t0);
|
|
1006
|
+
throw _context13.t0;
|
|
1076
1007
|
case 19:
|
|
1077
1008
|
case "end":
|
|
1078
|
-
return
|
|
1009
|
+
return _context13.stop();
|
|
1079
1010
|
}
|
|
1080
|
-
},
|
|
1011
|
+
}, _callee13, this, [[1, 15]]);
|
|
1081
1012
|
}));
|
|
1082
1013
|
function scanCode(_x6, _x7) {
|
|
1083
1014
|
return _scanCode.apply(this, arguments);
|
|
@@ -1087,15 +1018,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1087
1018
|
}, {
|
|
1088
1019
|
key: "setDiscountSelected",
|
|
1089
1020
|
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 (
|
|
1021
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
1022
|
+
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;
|
|
1023
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1024
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1094
1025
|
case 0:
|
|
1095
1026
|
this.logMethodStart('setDiscountSelected', params);
|
|
1096
|
-
|
|
1027
|
+
_context14.prev = 1;
|
|
1097
1028
|
if (this.store.order) {
|
|
1098
|
-
|
|
1029
|
+
_context14.next = 4;
|
|
1099
1030
|
break;
|
|
1100
1031
|
}
|
|
1101
1032
|
throw new Error('order 模块未初始化');
|
|
@@ -1115,7 +1046,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1115
1046
|
form_record_id: tempOrder.holder.form_record_id
|
|
1116
1047
|
}] : [];
|
|
1117
1048
|
nextDiscountList = updated;
|
|
1118
|
-
|
|
1049
|
+
_context14.next = 14;
|
|
1119
1050
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1120
1051
|
case 14:
|
|
1121
1052
|
if (rulesModule) {
|
|
@@ -1164,19 +1095,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1164
1095
|
return d.id;
|
|
1165
1096
|
}));
|
|
1166
1097
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
1167
|
-
|
|
1098
|
+
_context14.prev = 17;
|
|
1168
1099
|
_iterator3.s();
|
|
1169
1100
|
case 19:
|
|
1170
1101
|
if ((_step3 = _iterator3.n()).done) {
|
|
1171
|
-
|
|
1102
|
+
_context14.next = 33;
|
|
1172
1103
|
break;
|
|
1173
1104
|
}
|
|
1174
1105
|
product = _step3.value;
|
|
1175
|
-
if (!((
|
|
1176
|
-
|
|
1106
|
+
if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
|
|
1107
|
+
_context14.next = 23;
|
|
1177
1108
|
break;
|
|
1178
1109
|
}
|
|
1179
|
-
return
|
|
1110
|
+
return _context14.abrupt("continue", 31);
|
|
1180
1111
|
case 23:
|
|
1181
1112
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
1182
1113
|
var _pd$discount$resource, _pd$discount;
|
|
@@ -1189,7 +1120,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1189
1120
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1190
1121
|
return sum + (pd.amount || 0);
|
|
1191
1122
|
}, 0);
|
|
1192
|
-
optionSum = sumOptionUnitPrice(product
|
|
1123
|
+
optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
1193
1124
|
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
1125
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1195
1126
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
@@ -1202,46 +1133,46 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1202
1133
|
bundle: product.product_bundle
|
|
1203
1134
|
});
|
|
1204
1135
|
case 31:
|
|
1205
|
-
|
|
1136
|
+
_context14.next = 19;
|
|
1206
1137
|
break;
|
|
1207
1138
|
case 33:
|
|
1208
|
-
|
|
1139
|
+
_context14.next = 38;
|
|
1209
1140
|
break;
|
|
1210
1141
|
case 35:
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
_iterator3.e(
|
|
1142
|
+
_context14.prev = 35;
|
|
1143
|
+
_context14.t0 = _context14["catch"](17);
|
|
1144
|
+
_iterator3.e(_context14.t0);
|
|
1214
1145
|
case 38:
|
|
1215
|
-
|
|
1146
|
+
_context14.prev = 38;
|
|
1216
1147
|
_iterator3.f();
|
|
1217
|
-
return
|
|
1148
|
+
return _context14.finish(38);
|
|
1218
1149
|
case 41:
|
|
1219
1150
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1220
|
-
|
|
1151
|
+
_context14.next = 44;
|
|
1221
1152
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1222
1153
|
case 44:
|
|
1223
1154
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1224
1155
|
return d.isSelected;
|
|
1225
1156
|
});
|
|
1226
|
-
|
|
1157
|
+
_context14.next = 47;
|
|
1227
1158
|
return this.store.order.recalculateSummary({
|
|
1228
1159
|
createIfMissing: true
|
|
1229
1160
|
});
|
|
1230
1161
|
case 47:
|
|
1231
1162
|
this.store.order.persistTempOrder();
|
|
1232
1163
|
this.logMethodSuccess('setDiscountSelected', params);
|
|
1233
|
-
|
|
1164
|
+
_context14.next = 55;
|
|
1234
1165
|
break;
|
|
1235
1166
|
case 51:
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
this.logMethodError('setDiscountSelected',
|
|
1239
|
-
throw
|
|
1167
|
+
_context14.prev = 51;
|
|
1168
|
+
_context14.t1 = _context14["catch"](1);
|
|
1169
|
+
this.logMethodError('setDiscountSelected', _context14.t1);
|
|
1170
|
+
throw _context14.t1;
|
|
1240
1171
|
case 55:
|
|
1241
1172
|
case "end":
|
|
1242
|
-
return
|
|
1173
|
+
return _context14.stop();
|
|
1243
1174
|
}
|
|
1244
|
-
},
|
|
1175
|
+
}, _callee14, this, [[1, 51], [17, 35, 38, 41]]);
|
|
1245
1176
|
}));
|
|
1246
1177
|
function setDiscountSelected(_x8) {
|
|
1247
1178
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -1251,15 +1182,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1251
1182
|
}, {
|
|
1252
1183
|
key: "onCustomerLogin",
|
|
1253
1184
|
value: function () {
|
|
1254
|
-
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1255
|
-
return _regeneratorRuntime().wrap(function
|
|
1256
|
-
while (1) switch (
|
|
1185
|
+
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1186
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1187
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1257
1188
|
case 0:
|
|
1258
1189
|
this.logMethodStart('onCustomerLogin', {
|
|
1259
1190
|
customerId: params.customerId
|
|
1260
1191
|
});
|
|
1261
|
-
|
|
1262
|
-
|
|
1192
|
+
_context15.prev = 1;
|
|
1193
|
+
_context15.next = 4;
|
|
1263
1194
|
return this.refreshOrderMarketingAfterLogin({
|
|
1264
1195
|
customerId: params.customerId
|
|
1265
1196
|
});
|
|
@@ -1267,18 +1198,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1267
1198
|
this.logMethodSuccess('onCustomerLogin', {
|
|
1268
1199
|
customerId: params.customerId
|
|
1269
1200
|
});
|
|
1270
|
-
|
|
1201
|
+
_context15.next = 11;
|
|
1271
1202
|
break;
|
|
1272
1203
|
case 7:
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
this.logMethodError('onCustomerLogin',
|
|
1276
|
-
throw
|
|
1204
|
+
_context15.prev = 7;
|
|
1205
|
+
_context15.t0 = _context15["catch"](1);
|
|
1206
|
+
this.logMethodError('onCustomerLogin', _context15.t0);
|
|
1207
|
+
throw _context15.t0;
|
|
1277
1208
|
case 11:
|
|
1278
1209
|
case "end":
|
|
1279
|
-
return
|
|
1210
|
+
return _context15.stop();
|
|
1280
1211
|
}
|
|
1281
|
-
},
|
|
1212
|
+
}, _callee15, this, [[1, 7]]);
|
|
1282
1213
|
}));
|
|
1283
1214
|
function onCustomerLogin(_x9) {
|
|
1284
1215
|
return _onCustomerLogin.apply(this, arguments);
|
|
@@ -1329,11 +1260,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1329
1260
|
}, {
|
|
1330
1261
|
key: "prepareRetailAvailability",
|
|
1331
1262
|
value: function () {
|
|
1332
|
-
var _prepareRetailAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1333
|
-
var _this$store$order4, _this$
|
|
1263
|
+
var _prepareRetailAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1264
|
+
var _this$store$order4, _this$otherParams7;
|
|
1334
1265
|
var tempOrder, hasOrderId, resourceId, reason, resourceState, availabilityInfo;
|
|
1335
|
-
return _regeneratorRuntime().wrap(function
|
|
1336
|
-
while (1) switch (
|
|
1266
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1267
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1337
1268
|
case 0:
|
|
1338
1269
|
tempOrder = params.tempOrder, hasOrderId = params.hasOrderId, resourceId = params.resourceId, reason = params.reason;
|
|
1339
1270
|
this.enabledReservationRuleProducts = [];
|
|
@@ -1356,12 +1287,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1356
1287
|
};
|
|
1357
1288
|
this.store.resource = resourceState;
|
|
1358
1289
|
(_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || _this$store$order4.persistTempOrder();
|
|
1359
|
-
|
|
1290
|
+
_context16.next = 15;
|
|
1360
1291
|
return this.addNewOrder();
|
|
1361
1292
|
case 15:
|
|
1362
|
-
|
|
1293
|
+
_context16.next = 17;
|
|
1363
1294
|
return this.setItemRuleRuntimeConfig({
|
|
1364
|
-
serviceType: (_this$
|
|
1295
|
+
serviceType: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode,
|
|
1365
1296
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
1366
1297
|
historicalItems: []
|
|
1367
1298
|
});
|
|
@@ -1375,15 +1306,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1375
1306
|
mode: availabilityInfo.mode,
|
|
1376
1307
|
retailMode: true,
|
|
1377
1308
|
retailReason: reason,
|
|
1378
|
-
|
|
1379
|
-
persistedResourceId:
|
|
1309
|
+
relationId: resourceState.relationId,
|
|
1310
|
+
persistedResourceId: resourceState.relationId
|
|
1380
1311
|
});
|
|
1381
|
-
return
|
|
1312
|
+
return _context16.abrupt("return", availabilityInfo);
|
|
1382
1313
|
case 20:
|
|
1383
1314
|
case "end":
|
|
1384
|
-
return
|
|
1315
|
+
return _context16.stop();
|
|
1385
1316
|
}
|
|
1386
|
-
},
|
|
1317
|
+
}, _callee16, this);
|
|
1387
1318
|
}));
|
|
1388
1319
|
function prepareRetailAvailability(_x10) {
|
|
1389
1320
|
return _prepareRetailAvailability.apply(this, arguments);
|
|
@@ -1414,11 +1345,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1414
1345
|
return 1;
|
|
1415
1346
|
};
|
|
1416
1347
|
return function (payload, _ref3) {
|
|
1417
|
-
var
|
|
1348
|
+
var _resourceState$relati, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati2, _pickFirstCustomCapac;
|
|
1418
1349
|
var bookingUuid = _ref3.bookingUuid,
|
|
1419
1350
|
tempOrder = _ref3.tempOrder;
|
|
1420
|
-
var resourceId = String((
|
|
1421
|
-
var hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId &&
|
|
1351
|
+
var resourceId = String((_resourceState$relati = resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : '').trim();
|
|
1352
|
+
var hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId && resourceState.relationId && resourceState.tableFormId);
|
|
1422
1353
|
if (!hasReservationBookingContext) {
|
|
1423
1354
|
return _objectSpread(_objectSpread({}, payload), {}, {
|
|
1424
1355
|
bookings: [],
|
|
@@ -1435,14 +1366,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1435
1366
|
}
|
|
1436
1367
|
return undefined;
|
|
1437
1368
|
};
|
|
1438
|
-
var mainField = (
|
|
1369
|
+
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
1370
|
var resourceEntry = resourceState && resourceId ? {
|
|
1440
1371
|
relation_type: 'form',
|
|
1441
1372
|
like_status: 'common',
|
|
1442
1373
|
id: Number(resourceId),
|
|
1443
1374
|
main_field: mainField,
|
|
1444
1375
|
form_id: resourceState.tableFormId,
|
|
1445
|
-
relation_id: (_resourceState$
|
|
1376
|
+
relation_id: (_resourceState$relati2 = resourceState.relationId) !== null && _resourceState$relati2 !== void 0 ? _resourceState$relati2 : resourceId,
|
|
1446
1377
|
capacity: bookingCapacityValue,
|
|
1447
1378
|
metadata: _this5.buildScanOrderResourceMetadata({
|
|
1448
1379
|
resourceState: resourceState,
|
|
@@ -1479,9 +1410,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1479
1410
|
var nextProducts = _toConsumableArray(payload.products || []);
|
|
1480
1411
|
// 加餐(已有 order_id)走 scanOrderMore,原单已含 booking 规则行,勿再追加虚拟规则商品
|
|
1481
1412
|
if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
|
|
1482
|
-
var _ruleProduct$price,
|
|
1413
|
+
var _ruleProduct$price, _ref5, _ruleProduct$original, _ruleProduct$is_gst;
|
|
1483
1414
|
var sellingPrice = String((_ruleProduct$price = ruleProduct.price) !== null && _ruleProduct$price !== void 0 ? _ruleProduct$price : '0.00');
|
|
1484
|
-
var originalPrice = String((
|
|
1415
|
+
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
1416
|
nextProducts.push({
|
|
1486
1417
|
product_id: ruleProduct.id,
|
|
1487
1418
|
product_variant_id: 0,
|
|
@@ -1490,7 +1421,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1490
1421
|
original_price: originalPrice,
|
|
1491
1422
|
payment_price: sellingPrice,
|
|
1492
1423
|
is_charge_tax: (_ruleProduct$is_gst = ruleProduct.is_gst) !== null && _ruleProduct$is_gst !== void 0 ? _ruleProduct$is_gst : 0,
|
|
1493
|
-
|
|
1424
|
+
product_sku: {
|
|
1425
|
+
option: []
|
|
1426
|
+
},
|
|
1494
1427
|
discount_list: [],
|
|
1495
1428
|
product_bundle: [],
|
|
1496
1429
|
booking_uid: bookingUuid,
|
|
@@ -1507,11 +1440,89 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1507
1440
|
});
|
|
1508
1441
|
};
|
|
1509
1442
|
}
|
|
1443
|
+
}, {
|
|
1444
|
+
key: "isScanOrderMoreMode",
|
|
1445
|
+
value: function isScanOrderMoreMode(tempOrder) {
|
|
1446
|
+
var _this$store$resource, _this$store$entryCont;
|
|
1447
|
+
var mode = (_this$store$resource = this.store.resource) === null || _this$store$resource === void 0 ? void 0 : _this$store$resource.mode;
|
|
1448
|
+
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'));
|
|
1449
|
+
}
|
|
1450
|
+
}, {
|
|
1451
|
+
key: "submitScanOrderMore",
|
|
1452
|
+
value: function () {
|
|
1453
|
+
var _submitScanOrderMore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
1454
|
+
var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12;
|
|
1455
|
+
var tempOrder, enhancePayload, latestSummary, payload, products, orderId, result;
|
|
1456
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1457
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1458
|
+
case 0:
|
|
1459
|
+
if (this.request) {
|
|
1460
|
+
_context17.next = 2;
|
|
1461
|
+
break;
|
|
1462
|
+
}
|
|
1463
|
+
throw new Error('scanOrder解决方案需要 request 插件支持');
|
|
1464
|
+
case 2:
|
|
1465
|
+
if (this.store.order) {
|
|
1466
|
+
_context17.next = 4;
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
throw new Error('scanOrder解决方案需要 order 模块支持');
|
|
1470
|
+
case 4:
|
|
1471
|
+
tempOrder = params.tempOrder, enhancePayload = params.enhancePayload;
|
|
1472
|
+
_context17.next = 7;
|
|
1473
|
+
return this.store.order.recalculateSummary({
|
|
1474
|
+
createIfMissing: true
|
|
1475
|
+
});
|
|
1476
|
+
case 7:
|
|
1477
|
+
latestSummary = _context17.sent;
|
|
1478
|
+
payload = buildSubmitPayload({
|
|
1479
|
+
tempOrder: tempOrder,
|
|
1480
|
+
cacheId: this.cacheId,
|
|
1481
|
+
platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
|
|
1482
|
+
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),
|
|
1483
|
+
channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel,
|
|
1484
|
+
type: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.type,
|
|
1485
|
+
summary: latestSummary,
|
|
1486
|
+
enhance: enhancePayload
|
|
1487
|
+
});
|
|
1488
|
+
products = filterProductsForScanOrderMore(payload.products);
|
|
1489
|
+
orderId = tempOrder.order_id;
|
|
1490
|
+
_context17.next = 13;
|
|
1491
|
+
return this.request.put("/order/order/product/".concat(orderId), {
|
|
1492
|
+
products: products,
|
|
1493
|
+
request_unique_idempotency_token: payload.request_unique_idempotency_token
|
|
1494
|
+
}, {
|
|
1495
|
+
customToast: function customToast() {}
|
|
1496
|
+
});
|
|
1497
|
+
case 13:
|
|
1498
|
+
result = _context17.sent;
|
|
1499
|
+
if (!((result === null || result === void 0 ? void 0 : result.code) === 200 && !(result !== null && result !== void 0 && result.data))) {
|
|
1500
|
+
_context17.next = 16;
|
|
1501
|
+
break;
|
|
1502
|
+
}
|
|
1503
|
+
return _context17.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
1504
|
+
data: {
|
|
1505
|
+
order_id: orderId
|
|
1506
|
+
}
|
|
1507
|
+
}));
|
|
1508
|
+
case 16:
|
|
1509
|
+
return _context17.abrupt("return", result);
|
|
1510
|
+
case 17:
|
|
1511
|
+
case "end":
|
|
1512
|
+
return _context17.stop();
|
|
1513
|
+
}
|
|
1514
|
+
}, _callee17, this);
|
|
1515
|
+
}));
|
|
1516
|
+
function submitScanOrderMore(_x11) {
|
|
1517
|
+
return _submitScanOrderMore.apply(this, arguments);
|
|
1518
|
+
}
|
|
1519
|
+
return submitScanOrderMore;
|
|
1520
|
+
}()
|
|
1510
1521
|
}, {
|
|
1511
1522
|
key: "submitScanOrder",
|
|
1512
1523
|
value: function () {
|
|
1513
1524
|
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1514
|
-
var _this$store$
|
|
1525
|
+
var _this$store$resource2, _tempOrder$products, pax, tempOrderForSubmit, resourceTableName, enhancePayload, result, tempOrder;
|
|
1515
1526
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1516
1527
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1517
1528
|
case 0:
|
|
@@ -1526,9 +1537,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1526
1537
|
}
|
|
1527
1538
|
throw new Error('scanOrder解决方案需要 order 模块支持');
|
|
1528
1539
|
case 6:
|
|
1540
|
+
pax = normalizeSubmitCollectPaxValue(this.store.entryPaxNumber);
|
|
1541
|
+
this.store.entryPaxNumber = pax;
|
|
1529
1542
|
tempOrderForSubmit = this.store.order.ensureTempOrder();
|
|
1543
|
+
tempOrderForSubmit.metadata = _objectSpread(_objectSpread({}, tempOrderForSubmit.metadata), {}, {
|
|
1544
|
+
collect_pax: pax
|
|
1545
|
+
});
|
|
1530
1546
|
tempOrderForSubmit.delivery_type = 'shop_service';
|
|
1531
|
-
resourceTableName = (_this$store$
|
|
1547
|
+
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
1548
|
if (resourceTableName && _typeof(resourceTableName) === 'object') {
|
|
1533
1549
|
tempOrderForSubmit.table_number = resourceTableName;
|
|
1534
1550
|
} else {
|
|
@@ -1536,32 +1552,43 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1536
1552
|
}
|
|
1537
1553
|
this.store.order.persistTempOrder();
|
|
1538
1554
|
enhancePayload = this.buildSubmitPayloadEnhancer();
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1555
|
+
if (!this.isScanOrderMoreMode(tempOrderForSubmit)) {
|
|
1556
|
+
_context18.next = 21;
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
_context18.next = 18;
|
|
1560
|
+
return this.submitScanOrderMore({
|
|
1561
|
+
tempOrder: tempOrderForSubmit,
|
|
1546
1562
|
enhancePayload: enhancePayload
|
|
1547
1563
|
});
|
|
1548
|
-
case
|
|
1549
|
-
|
|
1564
|
+
case 18:
|
|
1565
|
+
_context18.t0 = _context18.sent;
|
|
1566
|
+
_context18.next = 24;
|
|
1567
|
+
break;
|
|
1568
|
+
case 21:
|
|
1569
|
+
_context18.next = 23;
|
|
1570
|
+
return this.submitSalesOrder({
|
|
1571
|
+
enhancePayload: enhancePayload
|
|
1572
|
+
});
|
|
1573
|
+
case 23:
|
|
1574
|
+
_context18.t0 = _context18.sent;
|
|
1575
|
+
case 24:
|
|
1576
|
+
result = _context18.t0;
|
|
1550
1577
|
tempOrder = this.store.order.getTempOrder();
|
|
1551
1578
|
this.logMethodSuccess('submitScanOrder', {
|
|
1552
1579
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products = tempOrder.products) === null || _tempOrder$products === void 0 ? void 0 : _tempOrder$products.length) || 0
|
|
1553
1580
|
});
|
|
1554
1581
|
return _context18.abrupt("return", result);
|
|
1555
|
-
case
|
|
1556
|
-
_context18.prev =
|
|
1557
|
-
_context18.
|
|
1558
|
-
this.logMethodError('submitScanOrder', _context18.
|
|
1559
|
-
throw _context18.
|
|
1560
|
-
case
|
|
1582
|
+
case 30:
|
|
1583
|
+
_context18.prev = 30;
|
|
1584
|
+
_context18.t1 = _context18["catch"](1);
|
|
1585
|
+
this.logMethodError('submitScanOrder', _context18.t1);
|
|
1586
|
+
throw _context18.t1;
|
|
1587
|
+
case 34:
|
|
1561
1588
|
case "end":
|
|
1562
1589
|
return _context18.stop();
|
|
1563
1590
|
}
|
|
1564
|
-
}, _callee18, this, [[1,
|
|
1591
|
+
}, _callee18, this, [[1, 30]]);
|
|
1565
1592
|
}));
|
|
1566
1593
|
function submitScanOrder() {
|
|
1567
1594
|
return _submitScanOrder.apply(this, arguments);
|
|
@@ -1612,20 +1639,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1612
1639
|
}
|
|
1613
1640
|
}, _callee19, this, [[1, 15]]);
|
|
1614
1641
|
}));
|
|
1615
|
-
function addProductToOrder(
|
|
1642
|
+
function addProductToOrder(_x12) {
|
|
1616
1643
|
return _addProductToOrder.apply(this, arguments);
|
|
1617
1644
|
}
|
|
1618
1645
|
return addProductToOrder;
|
|
1619
1646
|
}()
|
|
1620
1647
|
}, {
|
|
1621
|
-
key: "
|
|
1648
|
+
key: "updateOrderProduct",
|
|
1622
1649
|
value: function () {
|
|
1623
|
-
var
|
|
1650
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
1624
1651
|
var products;
|
|
1625
1652
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1626
1653
|
while (1) switch (_context20.prev = _context20.next) {
|
|
1627
1654
|
case 0:
|
|
1628
|
-
this.logMethodStart('
|
|
1655
|
+
this.logMethodStart('updateOrderProduct', {
|
|
1629
1656
|
product_id: params.product_id,
|
|
1630
1657
|
product_variant_id: params.product_variant_id
|
|
1631
1658
|
});
|
|
@@ -1637,7 +1664,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1637
1664
|
throw new Error('order 模块未初始化');
|
|
1638
1665
|
case 4:
|
|
1639
1666
|
_context20.next = 6;
|
|
1640
|
-
return this.store.order.
|
|
1667
|
+
return this.store.order.updateOrderProduct(params);
|
|
1641
1668
|
case 6:
|
|
1642
1669
|
products = _context20.sent;
|
|
1643
1670
|
_context20.next = 9;
|
|
@@ -1646,14 +1673,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1646
1673
|
_context20.next = 11;
|
|
1647
1674
|
return this.refreshCartValidationPassed();
|
|
1648
1675
|
case 11:
|
|
1649
|
-
this.logMethodSuccess('
|
|
1676
|
+
this.logMethodSuccess('updateOrderProduct', {
|
|
1650
1677
|
productCount: products.length
|
|
1651
1678
|
});
|
|
1652
1679
|
return _context20.abrupt("return", products);
|
|
1653
1680
|
case 15:
|
|
1654
1681
|
_context20.prev = 15;
|
|
1655
1682
|
_context20.t0 = _context20["catch"](1);
|
|
1656
|
-
this.logMethodError('
|
|
1683
|
+
this.logMethodError('updateOrderProduct', _context20.t0);
|
|
1657
1684
|
throw _context20.t0;
|
|
1658
1685
|
case 19:
|
|
1659
1686
|
case "end":
|
|
@@ -1661,10 +1688,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1661
1688
|
}
|
|
1662
1689
|
}, _callee20, this, [[1, 15]]);
|
|
1663
1690
|
}));
|
|
1664
|
-
function
|
|
1665
|
-
return
|
|
1691
|
+
function updateOrderProduct(_x13) {
|
|
1692
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
1666
1693
|
}
|
|
1667
|
-
return
|
|
1694
|
+
return updateOrderProduct;
|
|
1668
1695
|
}()
|
|
1669
1696
|
/**
|
|
1670
1697
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
@@ -1691,12 +1718,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1691
1718
|
}
|
|
1692
1719
|
};
|
|
1693
1720
|
if (identity.identity_key !== undefined) params.identity_key = identity.identity_key;
|
|
1694
|
-
if (identity.
|
|
1695
|
-
params.
|
|
1721
|
+
if (identity.product_sku !== undefined) {
|
|
1722
|
+
params.product_sku = identity.product_sku;
|
|
1696
1723
|
}
|
|
1697
1724
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
1698
1725
|
_context21.next = 8;
|
|
1699
|
-
return this.
|
|
1726
|
+
return this.updateOrderProduct(params);
|
|
1700
1727
|
case 8:
|
|
1701
1728
|
products = _context21.sent;
|
|
1702
1729
|
this.logMethodSuccess('setOrderProductLineNote', {
|
|
@@ -1714,7 +1741,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1714
1741
|
}
|
|
1715
1742
|
}, _callee21, this, [[1, 13]]);
|
|
1716
1743
|
}));
|
|
1717
|
-
function setOrderProductLineNote(
|
|
1744
|
+
function setOrderProductLineNote(_x14, _x15) {
|
|
1718
1745
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
1719
1746
|
}
|
|
1720
1747
|
return setOrderProductLineNote;
|
|
@@ -1763,7 +1790,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1763
1790
|
}
|
|
1764
1791
|
}, _callee22, this, [[1, 15]]);
|
|
1765
1792
|
}));
|
|
1766
|
-
function removeProductFromOrder(
|
|
1793
|
+
function removeProductFromOrder(_x16) {
|
|
1767
1794
|
return _removeProductFromOrder.apply(this, arguments);
|
|
1768
1795
|
}
|
|
1769
1796
|
return removeProductFromOrder;
|
|
@@ -1840,7 +1867,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1840
1867
|
}
|
|
1841
1868
|
}, _callee24, this);
|
|
1842
1869
|
}));
|
|
1843
|
-
function syncItemRuleConfigsFromDineInConfig(
|
|
1870
|
+
function syncItemRuleConfigsFromDineInConfig(_x17) {
|
|
1844
1871
|
return _syncItemRuleConfigsFromDineInConfig.apply(this, arguments);
|
|
1845
1872
|
}
|
|
1846
1873
|
return syncItemRuleConfigsFromDineInConfig;
|
|
@@ -1897,7 +1924,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1897
1924
|
}
|
|
1898
1925
|
}, _callee25, this, [[3, 13]]);
|
|
1899
1926
|
}));
|
|
1900
|
-
function fetchItemRuleConfigsByModelIds(
|
|
1927
|
+
function fetchItemRuleConfigsByModelIds(_x18) {
|
|
1901
1928
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
1902
1929
|
}
|
|
1903
1930
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -1947,16 +1974,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1947
1974
|
var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
|
|
1948
1975
|
var productId = Number(rawProductId);
|
|
1949
1976
|
if (Number.isFinite(productId) && productId > 0) {
|
|
1950
|
-
var
|
|
1951
|
-
var productVariantId = Number((
|
|
1977
|
+
var _ref6, _node$product_variant;
|
|
1978
|
+
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
1979
|
var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
|
|
1953
1980
|
var key = buildProductKey(productId, normalizedVariantId);
|
|
1954
1981
|
if (!sourceMap.has(key)) {
|
|
1955
1982
|
sourceMap.set(key, node);
|
|
1956
1983
|
}
|
|
1957
1984
|
}
|
|
1958
|
-
for (var
|
|
1959
|
-
var childValue = _Object$values[
|
|
1985
|
+
for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
|
|
1986
|
+
var childValue = _Object$values[_i3];
|
|
1960
1987
|
if (childValue && _typeof(childValue) === 'object') {
|
|
1961
1988
|
collectFromValue(childValue);
|
|
1962
1989
|
}
|
|
@@ -2069,7 +2096,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2069
2096
|
return _context29.abrupt("return", []);
|
|
2070
2097
|
case 7:
|
|
2071
2098
|
businessData = buildItemRuleBusinessData({
|
|
2072
|
-
tempOrder: this.
|
|
2099
|
+
tempOrder: this.ensureScanOrderTempOrder(),
|
|
2073
2100
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2074
2101
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2075
2102
|
});
|
|
@@ -2100,7 +2127,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2100
2127
|
key: "applyPrefillByItemRule",
|
|
2101
2128
|
value: function () {
|
|
2102
2129
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2103
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator6, _step6, _prefillItem$product_,
|
|
2130
|
+
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
2131
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2105
2132
|
while (1) switch (_context30.prev = _context30.next) {
|
|
2106
2133
|
case 0:
|
|
@@ -2127,7 +2154,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2127
2154
|
return _context30.abrupt("return");
|
|
2128
2155
|
case 9:
|
|
2129
2156
|
businessData = buildItemRuleBusinessData({
|
|
2130
|
-
tempOrder: this.
|
|
2157
|
+
tempOrder: this.ensureScanOrderTempOrder(),
|
|
2131
2158
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2132
2159
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2133
2160
|
});
|
|
@@ -2143,7 +2170,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2143
2170
|
return this.buildPrefillProductSourceMap();
|
|
2144
2171
|
case 16:
|
|
2145
2172
|
productSourceMap = _context30.sent;
|
|
2146
|
-
tempOrder = this.
|
|
2173
|
+
tempOrder = this.ensureScanOrderTempOrder();
|
|
2147
2174
|
hasChanges = false;
|
|
2148
2175
|
_iterator6 = _createForOfIteratorHelper(prefillItems);
|
|
2149
2176
|
_context30.prev = 20;
|
|
@@ -2210,7 +2237,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2210
2237
|
_origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
|
|
2211
2238
|
});
|
|
2212
2239
|
hasQuantityChanged = delta > 0;
|
|
2213
|
-
hasOriginChanged = Boolean(sourceItem && (!targetProduct._origin || ((
|
|
2240
|
+
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
2241
|
if (hasQuantityChanged || hasOriginChanged) {
|
|
2215
2242
|
tempOrder.products[productIndex] = nextProduct;
|
|
2216
2243
|
hasChanges = true;
|
|
@@ -2318,7 +2345,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2318
2345
|
});
|
|
2319
2346
|
case 5:
|
|
2320
2347
|
businessData = buildItemRuleBusinessData({
|
|
2321
|
-
tempOrder: this.
|
|
2348
|
+
tempOrder: this.ensureScanOrderTempOrder(),
|
|
2322
2349
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2323
2350
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2324
2351
|
});
|
|
@@ -2472,14 +2499,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2472
2499
|
}, {
|
|
2473
2500
|
key: "normalizeResourceState",
|
|
2474
2501
|
value: function normalizeResourceState(detail, resourceSelectType, hasOrderId) {
|
|
2475
|
-
var _detail$form_record, _this$
|
|
2502
|
+
var _detail$form_record, _this$otherParams13, _detail$resource_capa, _detail$resource_capa2;
|
|
2476
2503
|
var currentOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.order_id);
|
|
2477
2504
|
var lastOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.last_order_id);
|
|
2478
2505
|
var relationId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_record_id);
|
|
2479
2506
|
var tableFormId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_id);
|
|
2480
2507
|
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
2508
|
// 是否允许加餐
|
|
2482
|
-
var allowSnack = ((_this$
|
|
2509
|
+
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
2510
|
// 开启同桌验证 - 本期没有这个配置,默认关掉
|
|
2484
2511
|
var deskmateValid = false;
|
|
2485
2512
|
var isExclusive = resourceSelectType === 'single';
|
|
@@ -2562,7 +2589,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2562
2589
|
key: "fetchResourceOccupyDetailsByResourceId",
|
|
2563
2590
|
value: function () {
|
|
2564
2591
|
var _fetchResourceOccupyDetailsByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId) {
|
|
2565
|
-
var _this$
|
|
2592
|
+
var _this$otherParams14, _this$otherParams14$g, _response$data$occupy, _response$data;
|
|
2566
2593
|
var formRecordId, shopId, response;
|
|
2567
2594
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2568
2595
|
while (1) switch (_context36.prev = _context36.next) {
|
|
@@ -2574,7 +2601,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2574
2601
|
}
|
|
2575
2602
|
throw new Error("[ScanOrder] \u975E\u6CD5\u684C\u53F0 resourceId: ".concat(resourceId));
|
|
2576
2603
|
case 3:
|
|
2577
|
-
shopId = (_this$
|
|
2604
|
+
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
2605
|
if (shopId) {
|
|
2579
2606
|
_context36.next = 6;
|
|
2580
2607
|
break;
|
|
@@ -2604,7 +2631,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2604
2631
|
}
|
|
2605
2632
|
}, _callee36, this);
|
|
2606
2633
|
}));
|
|
2607
|
-
function fetchResourceOccupyDetailsByResourceId(
|
|
2634
|
+
function fetchResourceOccupyDetailsByResourceId(_x19) {
|
|
2608
2635
|
return _fetchResourceOccupyDetailsByResourceId.apply(this, arguments);
|
|
2609
2636
|
}
|
|
2610
2637
|
return fetchResourceOccupyDetailsByResourceId;
|
|
@@ -2668,19 +2695,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2668
2695
|
var hasOrderId,
|
|
2669
2696
|
normalizedResourceId,
|
|
2670
2697
|
_this$otherParams$bus,
|
|
2671
|
-
_this$
|
|
2698
|
+
_this$otherParams15,
|
|
2672
2699
|
_this$otherParams$cha,
|
|
2673
|
-
_this$
|
|
2674
|
-
_this$
|
|
2675
|
-
_this$
|
|
2700
|
+
_this$otherParams16,
|
|
2701
|
+
_this$otherParams17,
|
|
2702
|
+
_this$otherParams17$g,
|
|
2676
2703
|
_occupyDetails$,
|
|
2677
2704
|
_occupyDetail$form_re,
|
|
2678
2705
|
_occupyDetail$form_re2,
|
|
2679
|
-
_this$otherParams15,
|
|
2680
2706
|
_this$store$order6,
|
|
2681
2707
|
_this$store$order7,
|
|
2682
2708
|
_this$store$order7$ge,
|
|
2683
|
-
_this$
|
|
2709
|
+
_this$otherParams18,
|
|
2710
|
+
_this$store$resource3,
|
|
2711
|
+
_this$store$resource4,
|
|
2684
2712
|
businessCode,
|
|
2685
2713
|
channel,
|
|
2686
2714
|
openDataTarget,
|
|
@@ -2709,6 +2737,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2709
2737
|
occupancyMinutes,
|
|
2710
2738
|
paxBounds,
|
|
2711
2739
|
error,
|
|
2740
|
+
_occupancyMinutes,
|
|
2741
|
+
_paxBounds,
|
|
2742
|
+
_error,
|
|
2712
2743
|
occupyDetails,
|
|
2713
2744
|
occupyDetail,
|
|
2714
2745
|
resourceSelectType,
|
|
@@ -2733,11 +2764,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2733
2764
|
resourceId: normalizedResourceId
|
|
2734
2765
|
});
|
|
2735
2766
|
_context37.prev = 3;
|
|
2736
|
-
businessCode = String((_this$otherParams$bus = (_this$
|
|
2737
|
-
channel = String((_this$otherParams$cha = (_this$
|
|
2767
|
+
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();
|
|
2768
|
+
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
2769
|
openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
|
|
2739
2770
|
_context37.next = 9;
|
|
2740
|
-
return (_this$
|
|
2771
|
+
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
2772
|
scope: 'board',
|
|
2742
2773
|
target: openDataTarget,
|
|
2743
2774
|
section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
|
|
@@ -2808,7 +2839,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2808
2839
|
case 31:
|
|
2809
2840
|
// Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
|
|
2810
2841
|
// (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
|
|
2811
|
-
tempOrder = this.
|
|
2842
|
+
tempOrder = this.ensureScanOrderTempOrder();
|
|
2812
2843
|
reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
|
|
2813
2844
|
if (!(!normalizedResourceId || reservationLinkIds.length === 0)) {
|
|
2814
2845
|
_context37.next = 37;
|
|
@@ -2875,6 +2906,29 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2875
2906
|
scheduleDatetime: scheduleDatetime,
|
|
2876
2907
|
cacheId: this.cacheId
|
|
2877
2908
|
});
|
|
2909
|
+
if (Array.isArray(loaded)) {
|
|
2910
|
+
this.enabledReservationRuleProducts = loaded;
|
|
2911
|
+
_occupancyMinutes = pickFirstDurationMinutesFromProducts(loaded);
|
|
2912
|
+
if (_occupancyMinutes !== undefined) {
|
|
2913
|
+
tempOrder.metadata.table_occupancy_duration = _occupancyMinutes;
|
|
2914
|
+
}
|
|
2915
|
+
if (hasCustomCapacityProduct(loaded)) {
|
|
2916
|
+
pendingRequestEntryPax = 1;
|
|
2917
|
+
_paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
|
|
2918
|
+
if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.min) !== undefined) pendingRequestPaxMin = _paxBounds.min;
|
|
2919
|
+
if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.max) !== undefined) pendingRequestPaxMax = _paxBounds.max;
|
|
2920
|
+
}
|
|
2921
|
+
} else {
|
|
2922
|
+
this.enabledReservationRuleProducts = [];
|
|
2923
|
+
_error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
|
|
2924
|
+
this.logMethodError('loadReservationRuleProducts', _error, {
|
|
2925
|
+
resourceId: resourceId,
|
|
2926
|
+
reservationLinkIds: reservationLinkIds,
|
|
2927
|
+
scheduleDate: scheduleDate,
|
|
2928
|
+
scheduleDatetime: scheduleDatetime,
|
|
2929
|
+
cacheId: this.cacheId
|
|
2930
|
+
});
|
|
2931
|
+
}
|
|
2878
2932
|
}
|
|
2879
2933
|
|
|
2880
2934
|
// Step2: 请求新的资源占用详情接口。occupy_details 第一维是资源,不是订单。
|
|
@@ -2951,19 +3005,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2951
3005
|
} : {}), this.store.resource.requestPaxMax !== undefined ? {
|
|
2952
3006
|
requestPaxMax: this.store.resource.requestPaxMax
|
|
2953
3007
|
} : {});
|
|
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
3008
|
(_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || _this$store$order6.persistTempOrder();
|
|
2958
3009
|
|
|
2959
3010
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
2960
3011
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
2961
|
-
_context37.next =
|
|
3012
|
+
_context37.next = 73;
|
|
2962
3013
|
break;
|
|
2963
3014
|
}
|
|
2964
|
-
_context37.next =
|
|
3015
|
+
_context37.next = 73;
|
|
2965
3016
|
return this.addNewOrder();
|
|
2966
|
-
case
|
|
3017
|
+
case 73:
|
|
2967
3018
|
isAdditionalOrderMode = availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code'; // 如果是加单模式,tempOrder 里需要记录目标订单 id,提交的时候走加单接口
|
|
2968
3019
|
if (isAdditionalOrderMode) {
|
|
2969
3020
|
tempOrder.order_id = additionalOrderId;
|
|
@@ -2979,13 +3030,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2979
3030
|
} : {}));
|
|
2980
3031
|
return acc;
|
|
2981
3032
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
2982
|
-
_context37.next =
|
|
3033
|
+
_context37.next = 79;
|
|
2983
3034
|
return this.setItemRuleRuntimeConfig({
|
|
2984
|
-
serviceType: (_this$
|
|
3035
|
+
serviceType: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
|
|
2985
3036
|
submissionIndex: isAdditionalOrderMode ? 1 : 0,
|
|
2986
3037
|
historicalItems: historicalItems
|
|
2987
3038
|
});
|
|
2988
|
-
case
|
|
3039
|
+
case 79:
|
|
2989
3040
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
2990
3041
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
2991
3042
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -2999,28 +3050,28 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2999
3050
|
orderId: availabilityInfo.order_id,
|
|
3000
3051
|
relationId: availabilityInfo.relation_id,
|
|
3001
3052
|
tableFormId: availabilityInfo.table_form_id,
|
|
3002
|
-
persistedRelationId:
|
|
3003
|
-
persistedResourceId:
|
|
3053
|
+
persistedRelationId: (_this$store$resource3 = this.store.resource) === null || _this$store$resource3 === void 0 ? void 0 : _this$store$resource3.relationId,
|
|
3054
|
+
persistedResourceId: (_this$store$resource4 = this.store.resource) === null || _this$store$resource4 === void 0 ? void 0 : _this$store$resource4.relationId,
|
|
3004
3055
|
deskmateValid: availabilityInfo.deskmate_valid,
|
|
3005
3056
|
resourceSelectType: resourceState.resourceSelectType,
|
|
3006
3057
|
isExclusive: resourceState.isExclusive,
|
|
3007
3058
|
isFull: resourceState.isFull
|
|
3008
3059
|
});
|
|
3009
3060
|
return _context37.abrupt("return", availabilityInfo);
|
|
3010
|
-
case
|
|
3011
|
-
_context37.prev =
|
|
3061
|
+
case 84:
|
|
3062
|
+
_context37.prev = 84;
|
|
3012
3063
|
_context37.t0 = _context37["catch"](3);
|
|
3013
3064
|
this.logMethodError('checkResourceAvailable', _context37.t0.message, {
|
|
3014
3065
|
resourceId: normalizedResourceId
|
|
3015
3066
|
});
|
|
3016
3067
|
throw _context37.t0;
|
|
3017
|
-
case
|
|
3068
|
+
case 88:
|
|
3018
3069
|
case "end":
|
|
3019
3070
|
return _context37.stop();
|
|
3020
3071
|
}
|
|
3021
|
-
}, _callee37, this, [[3,
|
|
3072
|
+
}, _callee37, this, [[3, 84]]);
|
|
3022
3073
|
}));
|
|
3023
|
-
function checkResourceAvailable(
|
|
3074
|
+
function checkResourceAvailable(_x20) {
|
|
3024
3075
|
return _checkResourceAvailable.apply(this, arguments);
|
|
3025
3076
|
}
|
|
3026
3077
|
return checkResourceAvailable;
|
|
@@ -3029,18 +3080,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3029
3080
|
key: "restorePreviousOrderData",
|
|
3030
3081
|
value: function () {
|
|
3031
3082
|
var _restorePreviousOrderData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3032
|
-
var
|
|
3083
|
+
var orderModule, tempOrder, _res$data, res, entryPaxNumber;
|
|
3033
3084
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3034
3085
|
while (1) switch (_context38.prev = _context38.next) {
|
|
3035
3086
|
case 0:
|
|
3036
|
-
|
|
3087
|
+
orderModule = this.store.order;
|
|
3088
|
+
if (orderModule) {
|
|
3089
|
+
_context38.next = 3;
|
|
3090
|
+
break;
|
|
3091
|
+
}
|
|
3092
|
+
return _context38.abrupt("return");
|
|
3093
|
+
case 3:
|
|
3094
|
+
tempOrder = orderModule.ensureTempOrder();
|
|
3037
3095
|
if (!tempOrder.order_id) {
|
|
3038
|
-
_context38.next =
|
|
3096
|
+
_context38.next = 12;
|
|
3039
3097
|
break;
|
|
3040
3098
|
}
|
|
3041
|
-
_context38.next =
|
|
3042
|
-
return
|
|
3043
|
-
case
|
|
3099
|
+
_context38.next = 7;
|
|
3100
|
+
return orderModule.getOrderInfo(tempOrder.order_id);
|
|
3101
|
+
case 7:
|
|
3044
3102
|
res = _context38.sent;
|
|
3045
3103
|
// 找到下单的时候输入的 entryPaxNumber
|
|
3046
3104
|
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 +3106,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3048
3106
|
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
3049
3107
|
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
3050
3108
|
if (!entryPaxNumber) {
|
|
3051
|
-
_context38.next =
|
|
3109
|
+
_context38.next = 12;
|
|
3052
3110
|
break;
|
|
3053
3111
|
}
|
|
3054
|
-
_context38.next =
|
|
3112
|
+
_context38.next = 12;
|
|
3055
3113
|
return this.setEntryPaxNumber(entryPaxNumber);
|
|
3056
|
-
case
|
|
3114
|
+
case 12:
|
|
3057
3115
|
case "end":
|
|
3058
3116
|
return _context38.stop();
|
|
3059
3117
|
}
|
|
@@ -3100,31 +3158,32 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3100
3158
|
key: "getProductList",
|
|
3101
3159
|
value: function () {
|
|
3102
3160
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3103
|
-
var _this$
|
|
3104
|
-
var menu_list_ids, res, productList, formattedRes;
|
|
3161
|
+
var _this$otherParams19;
|
|
3162
|
+
var associatedMenus, menu_list_ids, res, productList, formattedRes;
|
|
3105
3163
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3106
3164
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3107
3165
|
case 0:
|
|
3108
3166
|
this.logMethodStart('getProductList');
|
|
3109
3167
|
// 可以直接通过配置里的 menu 读取
|
|
3110
|
-
|
|
3168
|
+
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'];
|
|
3169
|
+
menu_list_ids = associatedMenus.map(function (n) {
|
|
3111
3170
|
return Number(n.value);
|
|
3112
|
-
})
|
|
3113
|
-
_context40.prev =
|
|
3171
|
+
}) || [];
|
|
3172
|
+
_context40.prev = 3;
|
|
3114
3173
|
if (this.store.products) {
|
|
3115
|
-
_context40.next =
|
|
3174
|
+
_context40.next = 6;
|
|
3116
3175
|
break;
|
|
3117
3176
|
}
|
|
3118
3177
|
throw new Error('products 模块未初始化');
|
|
3119
|
-
case
|
|
3120
|
-
_context40.next =
|
|
3178
|
+
case 6:
|
|
3179
|
+
_context40.next = 8;
|
|
3121
3180
|
return this.store.products.loadProducts({
|
|
3122
3181
|
menu_list_ids: menu_list_ids,
|
|
3123
3182
|
cacheId: this.cacheId,
|
|
3124
3183
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
3125
3184
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3126
3185
|
});
|
|
3127
|
-
case
|
|
3186
|
+
case 8:
|
|
3128
3187
|
res = _context40.sent;
|
|
3129
3188
|
productList = this.assertProductListLoaded('getProductList', res, {
|
|
3130
3189
|
menu_list_ids: menu_list_ids,
|
|
@@ -3135,9 +3194,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3135
3194
|
menuCount: menu_list_ids.length
|
|
3136
3195
|
});
|
|
3137
3196
|
return _context40.abrupt("return", formattedRes);
|
|
3138
|
-
case
|
|
3139
|
-
_context40.prev =
|
|
3140
|
-
_context40.t0 = _context40["catch"](
|
|
3197
|
+
case 15:
|
|
3198
|
+
_context40.prev = 15;
|
|
3199
|
+
_context40.t0 = _context40["catch"](3);
|
|
3141
3200
|
if (!(_context40.t0 !== null && _context40.t0 !== void 0 && _context40.t0.__scanOrderLogged)) {
|
|
3142
3201
|
this.logMethodError('getProductList', _context40.t0, {
|
|
3143
3202
|
menu_list_ids: menu_list_ids,
|
|
@@ -3145,11 +3204,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3145
3204
|
});
|
|
3146
3205
|
}
|
|
3147
3206
|
throw _context40.t0;
|
|
3148
|
-
case
|
|
3207
|
+
case 19:
|
|
3149
3208
|
case "end":
|
|
3150
3209
|
return _context40.stop();
|
|
3151
3210
|
}
|
|
3152
|
-
}, _callee40, this, [[
|
|
3211
|
+
}, _callee40, this, [[3, 15]]);
|
|
3153
3212
|
}));
|
|
3154
3213
|
function getProductList() {
|
|
3155
3214
|
return _getProductList.apply(this, arguments);
|
|
@@ -3165,14 +3224,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3165
3224
|
key: "setOtherParams",
|
|
3166
3225
|
value: function () {
|
|
3167
3226
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3168
|
-
var
|
|
3169
|
-
|
|
3227
|
+
var _ref8,
|
|
3228
|
+
_ref8$cover,
|
|
3170
3229
|
cover,
|
|
3171
3230
|
_args41 = arguments;
|
|
3172
3231
|
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3173
3232
|
while (1) switch (_context41.prev = _context41.next) {
|
|
3174
3233
|
case 0:
|
|
3175
|
-
|
|
3234
|
+
_ref8 = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {}, _ref8$cover = _ref8.cover, cover = _ref8$cover === void 0 ? false : _ref8$cover;
|
|
3176
3235
|
if (cover) {
|
|
3177
3236
|
this.otherParams = params;
|
|
3178
3237
|
} else {
|
|
@@ -3184,7 +3243,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3184
3243
|
}
|
|
3185
3244
|
}, _callee41, this);
|
|
3186
3245
|
}));
|
|
3187
|
-
function setOtherParams(
|
|
3246
|
+
function setOtherParams(_x21) {
|
|
3188
3247
|
return _setOtherParams.apply(this, arguments);
|
|
3189
3248
|
}
|
|
3190
3249
|
return setOtherParams;
|
|
@@ -3309,7 +3368,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3309
3368
|
}
|
|
3310
3369
|
}, _callee42, this);
|
|
3311
3370
|
}));
|
|
3312
|
-
function setEntryPaxNumber(
|
|
3371
|
+
function setEntryPaxNumber(_x22) {
|
|
3313
3372
|
return _setEntryPaxNumber.apply(this, arguments);
|
|
3314
3373
|
}
|
|
3315
3374
|
return setEntryPaxNumber;
|
|
@@ -3323,18 +3382,24 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3323
3382
|
key: "syncAdditionalOrderFromResource",
|
|
3324
3383
|
value: function () {
|
|
3325
3384
|
var _syncAdditionalOrderFromResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(resourceId) {
|
|
3326
|
-
var _ref10, _ref11,
|
|
3385
|
+
var _ref9, _ref10, _ref11, _this$store$resource5, _this$store$resource6, _occupyDetails$2, _this$store$resource7, _this$otherParams20, _this$store$order8;
|
|
3327
3386
|
var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, allowAddItems, result;
|
|
3328
3387
|
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3329
3388
|
while (1) switch (_context43.prev = _context43.next) {
|
|
3330
3389
|
case 0:
|
|
3331
|
-
|
|
3332
|
-
|
|
3390
|
+
if (this.store.order) {
|
|
3391
|
+
_context43.next = 2;
|
|
3392
|
+
break;
|
|
3393
|
+
}
|
|
3394
|
+
throw new Error('order 模块未初始化');
|
|
3395
|
+
case 2:
|
|
3396
|
+
tempOrder = this.store.order.ensureTempOrder();
|
|
3397
|
+
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
3398
|
this.logMethodStart('syncAdditionalOrderFromResource', {
|
|
3334
3399
|
resourceId: normalizedResourceId
|
|
3335
3400
|
});
|
|
3336
3401
|
if (normalizedResourceId) {
|
|
3337
|
-
_context43.next =
|
|
3402
|
+
_context43.next = 9;
|
|
3338
3403
|
break;
|
|
3339
3404
|
}
|
|
3340
3405
|
_result = {
|
|
@@ -3343,17 +3408,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3343
3408
|
};
|
|
3344
3409
|
this.logMethodSuccess('syncAdditionalOrderFromResource', _result);
|
|
3345
3410
|
return _context43.abrupt("return", _result);
|
|
3346
|
-
case 7:
|
|
3347
|
-
_context43.next = 9;
|
|
3348
|
-
return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
3349
3411
|
case 9:
|
|
3412
|
+
_context43.next = 11;
|
|
3413
|
+
return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
3414
|
+
case 11:
|
|
3350
3415
|
occupyDetails = _context43.sent;
|
|
3351
3416
|
occupyDetail = (_occupyDetails$2 = occupyDetails[0]) !== null && _occupyDetails$2 !== void 0 ? _occupyDetails$2 : null;
|
|
3352
|
-
resourceSelectType = ((_this$store$
|
|
3353
|
-
allowAddItems = toBoolean((_this$
|
|
3417
|
+
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));
|
|
3418
|
+
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
3419
|
result = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType, allowAddItems);
|
|
3355
3420
|
if (!(!result.matched || !result.order_id)) {
|
|
3356
|
-
_context43.next =
|
|
3421
|
+
_context43.next = 19;
|
|
3357
3422
|
break;
|
|
3358
3423
|
}
|
|
3359
3424
|
this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
|
|
@@ -3362,25 +3427,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3362
3427
|
allowAddItems: allowAddItems
|
|
3363
3428
|
}));
|
|
3364
3429
|
return _context43.abrupt("return", result);
|
|
3365
|
-
case
|
|
3430
|
+
case 19:
|
|
3366
3431
|
tempOrder.order_id = result.order_id;
|
|
3367
3432
|
tempOrder.resource_id = normalizedResourceId;
|
|
3368
3433
|
tempOrder.relation_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
3369
3434
|
tempOrder.table_form_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
|
|
3370
|
-
(_this$store$
|
|
3435
|
+
(_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || _this$store$order8.persistTempOrder();
|
|
3371
3436
|
this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
|
|
3372
3437
|
resourceId: normalizedResourceId,
|
|
3373
3438
|
resourceSelectType: resourceSelectType,
|
|
3374
3439
|
allowAddItems: allowAddItems
|
|
3375
3440
|
}));
|
|
3376
3441
|
return _context43.abrupt("return", result);
|
|
3377
|
-
case
|
|
3442
|
+
case 26:
|
|
3378
3443
|
case "end":
|
|
3379
3444
|
return _context43.stop();
|
|
3380
3445
|
}
|
|
3381
3446
|
}, _callee43, this);
|
|
3382
3447
|
}));
|
|
3383
|
-
function syncAdditionalOrderFromResource(
|
|
3448
|
+
function syncAdditionalOrderFromResource(_x23) {
|
|
3384
3449
|
return _syncAdditionalOrderFromResource.apply(this, arguments);
|
|
3385
3450
|
}
|
|
3386
3451
|
return syncAdditionalOrderFromResource;
|
|
@@ -3389,9 +3454,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3389
3454
|
}, {
|
|
3390
3455
|
key: "getReservationResourceSelectType",
|
|
3391
3456
|
value: function getReservationResourceSelectType() {
|
|
3392
|
-
var _this$store$
|
|
3457
|
+
var _this$store$resource8;
|
|
3393
3458
|
this.logMethodStart('getReservationResourceSelectType');
|
|
3394
|
-
var resourceSelectType = (_this$store$
|
|
3459
|
+
var resourceSelectType = (_this$store$resource8 = this.store.resource) === null || _this$store$resource8 === void 0 ? void 0 : _this$store$resource8.resourceSelectType;
|
|
3395
3460
|
var result = _objectSpread(_objectSpread({}, resourceSelectType ? {
|
|
3396
3461
|
resourceSelectType: resourceSelectType
|
|
3397
3462
|
} : {}), {}, {
|
|
@@ -3408,9 +3473,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3408
3473
|
}, {
|
|
3409
3474
|
key: "checkAllowAddItems",
|
|
3410
3475
|
value: function checkAllowAddItems() {
|
|
3411
|
-
var _this$
|
|
3476
|
+
var _this$otherParams21;
|
|
3412
3477
|
this.logMethodStart('checkAllowAddItems');
|
|
3413
|
-
var dineInConfig = ((_this$
|
|
3478
|
+
var dineInConfig = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.dineInConfig) || {};
|
|
3414
3479
|
var result = {
|
|
3415
3480
|
enabled: toBoolean(dineInConfig['sale.allow_add_items'])
|
|
3416
3481
|
};
|
|
@@ -3423,9 +3488,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3423
3488
|
}, {
|
|
3424
3489
|
key: "getFulfillmentModes",
|
|
3425
3490
|
value: function getFulfillmentModes() {
|
|
3426
|
-
var _this$
|
|
3491
|
+
var _this$otherParams22;
|
|
3427
3492
|
this.logMethodStart('getFulfillmentModes');
|
|
3428
|
-
var dineInConfig = ((_this$
|
|
3493
|
+
var dineInConfig = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.dineInConfig) || {};
|
|
3429
3494
|
var result = {
|
|
3430
3495
|
enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
|
|
3431
3496
|
enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
|
|
@@ -3439,9 +3504,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3439
3504
|
}, {
|
|
3440
3505
|
key: "checkManualPickupRef",
|
|
3441
3506
|
value: function checkManualPickupRef() {
|
|
3442
|
-
var _this$
|
|
3507
|
+
var _this$otherParams23;
|
|
3443
3508
|
this.logMethodStart('checkManualPickupRef');
|
|
3444
|
-
var dineInConfig = ((_this$
|
|
3509
|
+
var dineInConfig = ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.dineInConfig) || {};
|
|
3445
3510
|
var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
|
|
3446
3511
|
var manualInputType = dineInConfig['fulfillment.manual_input_type'];
|
|
3447
3512
|
var enabled = refMode === 'manual_input';
|
|
@@ -3459,6 +3524,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3459
3524
|
}
|
|
3460
3525
|
}]);
|
|
3461
3526
|
return ScanOrderImpl;
|
|
3462
|
-
}(
|
|
3527
|
+
}(BaseSalesImpl);
|
|
3463
3528
|
_defineProperty(ScanOrderImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
|
|
3464
3529
|
_defineProperty(ScanOrderImpl, "UI_STATE_KEY_PREFIX", 'pisell.scanOrder.uiState:');
|