@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
|
@@ -32,6 +32,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
32
32
|
* - 基础生命周期占位
|
|
33
33
|
*
|
|
34
34
|
* 不提前实现 store 编排、初始化流程细节、状态计算逻辑。
|
|
35
|
+
* TIPS:这块应该改名叫 ReservationModule 更合适一些,目前这边只服务于 Reservation 的 floormap 展示。
|
|
35
36
|
*/
|
|
36
37
|
class SalesImpl extends _BaseModule.BaseModule {
|
|
37
38
|
defaultName = 'sales';
|
|
@@ -42,6 +43,8 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
42
43
|
options = {};
|
|
43
44
|
otherParams = {};
|
|
44
45
|
request;
|
|
46
|
+
logger; // LoggerManager 实例
|
|
47
|
+
|
|
45
48
|
constructor(name, version) {
|
|
46
49
|
super(name, version);
|
|
47
50
|
}
|
|
@@ -65,6 +68,7 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
65
68
|
// TODO(Rolo): 等领导提供 reservationList 的目标结构后,
|
|
66
69
|
// 在这里补充从 Server/Order 读取 currentDay 原始数据并转换为预约列表。
|
|
67
70
|
|
|
71
|
+
this.logger = appPlugin?.getApp().logger;
|
|
68
72
|
await this.core.effects.emit(`${this.name}:onInited`, {});
|
|
69
73
|
}
|
|
70
74
|
|
|
@@ -116,6 +120,22 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
116
120
|
});
|
|
117
121
|
return [];
|
|
118
122
|
}
|
|
123
|
+
async cancelOrder(orderIds) {
|
|
124
|
+
const orderModule = this.core.getModule('order');
|
|
125
|
+
if (!orderModule) {
|
|
126
|
+
throw new Error('Sales 取消订单失败:Order 模块未注册');
|
|
127
|
+
}
|
|
128
|
+
return orderModule.cancelOrder({
|
|
129
|
+
order_ids: orderIds
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async changeBookingStatus(params) {
|
|
133
|
+
const orderModule = this.core.getModule('order');
|
|
134
|
+
if (!orderModule) {
|
|
135
|
+
throw new Error('Sales 变更预约状态失败:Order 模块未注册');
|
|
136
|
+
}
|
|
137
|
+
return orderModule.changeBookingStatus(params);
|
|
138
|
+
}
|
|
119
139
|
|
|
120
140
|
// -------------------------------------------------------------------------
|
|
121
141
|
// 生命周期
|
|
@@ -197,6 +217,8 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
197
217
|
const diff = new Int32Array(slotCount + 1);
|
|
198
218
|
for (let i = 0; i < bookingList.length; i++) {
|
|
199
219
|
const booking = bookingList[i];
|
|
220
|
+
const appointmentStatus = String(booking.appointment_status ?? booking.status ?? '');
|
|
221
|
+
if (appointmentStatus === 'new' || appointmentStatus === 'rejected' || appointmentStatus === 'cancelled') continue;
|
|
200
222
|
const bookingStartAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
201
223
|
const bookingEndAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
202
224
|
if (!bookingStartAt.isValid() || !bookingEndAt.isValid()) continue;
|
|
@@ -247,7 +269,7 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
247
269
|
*/
|
|
248
270
|
getBookingStatus(appointmentStatus) {
|
|
249
271
|
if (appointmentStatus === 'started') return 'occupied';
|
|
250
|
-
if (appointmentStatus === '
|
|
272
|
+
if (appointmentStatus === 'confirmed' || appointmentStatus === 'arrived') {
|
|
251
273
|
return 'reserved';
|
|
252
274
|
}
|
|
253
275
|
// TODO: locked 的业务规则后续补充。
|
|
@@ -257,6 +279,58 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
257
279
|
getResourceId(resource) {
|
|
258
280
|
return resource.id ?? resource.form_record_id ?? '';
|
|
259
281
|
}
|
|
282
|
+
getBookingAppointmentStatus(booking) {
|
|
283
|
+
return String(booking.appointment_status ?? booking.status ?? '');
|
|
284
|
+
}
|
|
285
|
+
isBookingIncludedInStats(booking) {
|
|
286
|
+
const appointmentStatus = this.getBookingAppointmentStatus(booking);
|
|
287
|
+
return appointmentStatus !== 'new' && appointmentStatus !== 'rejected' && appointmentStatus !== 'cancelled';
|
|
288
|
+
}
|
|
289
|
+
getBookingOrderPaymentStatus(booking) {
|
|
290
|
+
return String(booking.order?.payment_status ?? '');
|
|
291
|
+
}
|
|
292
|
+
countBookingOrders(bookings) {
|
|
293
|
+
const orderIds = new Set();
|
|
294
|
+
bookings.forEach(booking => {
|
|
295
|
+
const orderId = booking.order_id ?? booking.order?.order_id;
|
|
296
|
+
if (orderId === undefined || orderId === null) return;
|
|
297
|
+
orderIds.add(String(orderId));
|
|
298
|
+
});
|
|
299
|
+
return orderIds.size;
|
|
300
|
+
}
|
|
301
|
+
countCompletedBookings(bookings) {
|
|
302
|
+
return bookings.filter(booking => this.getBookingAppointmentStatus(booking) === 'completed').length;
|
|
303
|
+
}
|
|
304
|
+
groupBookingsByResource(bookingList) {
|
|
305
|
+
const bookingMap = new Map();
|
|
306
|
+
bookingList.forEach(booking => {
|
|
307
|
+
if (!Array.isArray(booking.resources)) return;
|
|
308
|
+
booking.resources.forEach(resource => {
|
|
309
|
+
const relationId = resource?.relation_id;
|
|
310
|
+
if (relationId === undefined || relationId === null) return;
|
|
311
|
+
const key = String(relationId);
|
|
312
|
+
const list = bookingMap.get(key) || [];
|
|
313
|
+
list.push(booking);
|
|
314
|
+
bookingMap.set(key, list);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
return bookingMap;
|
|
318
|
+
}
|
|
319
|
+
isBookingMatchedResource(booking, resourceId) {
|
|
320
|
+
if (!Array.isArray(booking.resources)) return false;
|
|
321
|
+
return booking.resources.some(resource => {
|
|
322
|
+
const relationId = resource?.relation_id;
|
|
323
|
+
if (relationId === undefined || relationId === null) return false;
|
|
324
|
+
return String(relationId) === String(resourceId);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
sortMatchedBookings(bookings) {
|
|
328
|
+
return [...bookings].sort((left, right) => {
|
|
329
|
+
const leftStartAt = this.toBookingDateTime(left.start_date, left.start_time).valueOf();
|
|
330
|
+
const rightStartAt = this.toBookingDateTime(right.start_date, right.start_time).valueOf();
|
|
331
|
+
return leftStartAt - rightStartAt;
|
|
332
|
+
});
|
|
333
|
+
}
|
|
260
334
|
|
|
261
335
|
/**
|
|
262
336
|
* 资源下 bookings 的返回裁剪策略:
|
|
@@ -295,6 +369,9 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
295
369
|
return startAt.isValid() && startAt.valueOf() === nextStartAt;
|
|
296
370
|
});
|
|
297
371
|
if (nextStartGroup.length === 0) return selectedBookings;
|
|
372
|
+
nextStartGroup.forEach(booking => {
|
|
373
|
+
booking.isNext = true;
|
|
374
|
+
});
|
|
298
375
|
return [...selectedBookings, ...nextStartGroup];
|
|
299
376
|
};
|
|
300
377
|
|
|
@@ -331,30 +408,82 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
331
408
|
}
|
|
332
409
|
|
|
333
410
|
/**
|
|
334
|
-
*
|
|
335
|
-
* -
|
|
336
|
-
* -
|
|
411
|
+
* 计算 booking 在 current 时刻的执行进度百分比(0-100)。
|
|
412
|
+
* - startAt/endAt 非法或 totalMinutes <= 0 返回 0
|
|
413
|
+
* - current 早于 startAt 返回 0,晚于 endAt 返回 100
|
|
337
414
|
*/
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
415
|
+
calcProgressPercent(current, startAt, endAt) {
|
|
416
|
+
if (!startAt.isValid() || !endAt.isValid()) return 0;
|
|
417
|
+
const totalMinutes = endAt.diff(startAt, 'minute');
|
|
418
|
+
if (totalMinutes <= 0) return 0;
|
|
419
|
+
const elapsedMinutes = current.diff(startAt, 'minute');
|
|
420
|
+
if (elapsedMinutes <= 0) return 0;
|
|
421
|
+
if (elapsedMinutes >= totalMinutes) return 100;
|
|
422
|
+
return Math.floor(elapsedMinutes / totalMinutes * 100);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* 标准化单条 booking 的分发入口:
|
|
427
|
+
* - 统一过滤 rejected / cancelled(视为没来过)
|
|
428
|
+
* - current === deviceCurrent 走实时分支(信任 appointment_status)
|
|
429
|
+
* - 否则走快照分支(纯时间窗判定,忽略 appointment_status 的 arrived/started/completed 差异)
|
|
430
|
+
*/
|
|
431
|
+
normalizeMatchedBooking(current, deviceCurrent, booking, options = {}) {
|
|
432
|
+
const appointmentStatus = this.getBookingAppointmentStatus(booking);
|
|
433
|
+
if (appointmentStatus === 'rejected' || appointmentStatus === 'cancelled') return null;
|
|
434
|
+
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
435
|
+
const endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
436
|
+
if (appointmentStatus === 'completed' && options.includeCompleted) {
|
|
437
|
+
return this.buildCompletedBooking(current, booking, startAt, endAt);
|
|
438
|
+
}
|
|
439
|
+
if (current.isSame(deviceCurrent)) {
|
|
440
|
+
return this.buildRealtimeBooking(current, booking, appointmentStatus, startAt, endAt);
|
|
342
441
|
}
|
|
442
|
+
return this.buildSnapshotBooking(current, booking, appointmentStatus, startAt, endAt);
|
|
443
|
+
}
|
|
444
|
+
normalizeResourceBookings(current, deviceCurrent, bookingList, options = {}) {
|
|
445
|
+
const normalizedBookings = bookingList.map(booking => this.normalizeMatchedBooking(current, deviceCurrent, booking, options)).filter(booking => Boolean(booking)).filter(booking => booking.status);
|
|
446
|
+
return this.sortMatchedBookings(normalizedBookings);
|
|
447
|
+
}
|
|
448
|
+
buildCompletedBooking(current, booking, startAt, endAt) {
|
|
449
|
+
if (!startAt.isValid() || !endAt.isValid()) return null;
|
|
450
|
+
if (current.isBefore(startAt)) {
|
|
451
|
+
return {
|
|
452
|
+
...booking,
|
|
453
|
+
status: 'reserved',
|
|
454
|
+
isTimeout: false,
|
|
455
|
+
timeoutTime: undefined,
|
|
456
|
+
progressPercent: 0,
|
|
457
|
+
lateTime: undefined,
|
|
458
|
+
reserved_status: 'not_arrived',
|
|
459
|
+
remainingReserveTime: Math.max(startAt.diff(current, 'minute'), 0)
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
...booking,
|
|
464
|
+
status: 'occupied',
|
|
465
|
+
isTimeout: false,
|
|
466
|
+
timeoutTime: undefined,
|
|
467
|
+
progressPercent: this.isSameOrAfter(current, endAt) ? 100 : this.calcProgressPercent(current, startAt, endAt),
|
|
468
|
+
lateTime: undefined,
|
|
469
|
+
reserved_status: undefined,
|
|
470
|
+
remainingReserveTime: undefined
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* 实时模式(current === deviceCurrent):信任 appointment_status
|
|
476
|
+
* - 过滤 new / completed(实时视角下视为非活跃数据)
|
|
477
|
+
* - status 由 getBookingStatus 映射
|
|
478
|
+
* - occupied 且 current > endAt 标记 isTimeout + timeoutTime
|
|
479
|
+
* - reserved 且 current < startAt 标记 not_arrived,否则标记 late
|
|
480
|
+
*/
|
|
481
|
+
buildRealtimeBooking(current, booking, appointmentStatus, startAt, endAt) {
|
|
482
|
+
if (appointmentStatus === 'new' || appointmentStatus === 'completed') return null;
|
|
343
483
|
const bookingStatus = this.getBookingStatus(appointmentStatus);
|
|
344
|
-
const endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
345
|
-
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
346
484
|
const isTimeout = bookingStatus === 'occupied' && endAt.isValid() && current.isAfter(endAt);
|
|
347
485
|
const timeoutTime = isTimeout ? current.diff(endAt, 'minute') : undefined;
|
|
348
|
-
const progressPercent = (
|
|
349
|
-
if (bookingStatus !== 'occupied') return 0;
|
|
350
|
-
if (!startAt.isValid() || !endAt.isValid()) return 0;
|
|
351
|
-
const totalMinutes = endAt.diff(startAt, 'minute');
|
|
352
|
-
if (totalMinutes <= 0) return 0;
|
|
353
|
-
const elapsedMinutes = current.diff(startAt, 'minute');
|
|
354
|
-
if (elapsedMinutes <= 0) return 0;
|
|
355
|
-
if (elapsedMinutes >= totalMinutes) return 100;
|
|
356
|
-
return Math.floor(elapsedMinutes / totalMinutes * 100);
|
|
357
|
-
})();
|
|
486
|
+
const progressPercent = bookingStatus === 'occupied' ? this.calcProgressPercent(current, startAt, endAt) : 0;
|
|
358
487
|
let reservedStatus;
|
|
359
488
|
let lateTime;
|
|
360
489
|
let remainingReserveTime;
|
|
@@ -378,10 +507,66 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
378
507
|
remainingReserveTime
|
|
379
508
|
};
|
|
380
509
|
}
|
|
381
|
-
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* 快照模式(current !== deviceCurrent,过去或未来):忽略 appointment_status
|
|
513
|
+
* 的实时态差异,仅按 booking 时间窗判定,为 current 提供时间点快照视图。
|
|
514
|
+
*
|
|
515
|
+
* - new:视作尚未成为真实预约,过滤
|
|
516
|
+
* - locked:保留 status=locked,不计算 timeout/late/progress
|
|
517
|
+
* - 其他非终态:
|
|
518
|
+
* - startAt/endAt 非法 → 过滤
|
|
519
|
+
* - current > endAt → 过滤(已结束,不入池)
|
|
520
|
+
* - current ∈ [startAt, endAt] → occupied,附带 progressPercent
|
|
521
|
+
* - current < startAt → reserved + not_arrived,附带 remainingReserveTime
|
|
522
|
+
*
|
|
523
|
+
* 快照模式下 isTimeout 恒为 false,lateTime / timeoutTime 始终置空。
|
|
524
|
+
*/
|
|
525
|
+
buildSnapshotBooking(current, booking, appointmentStatus, startAt, endAt) {
|
|
526
|
+
if (appointmentStatus === 'new') return null;
|
|
527
|
+
if (appointmentStatus === 'locked') {
|
|
528
|
+
return {
|
|
529
|
+
...booking,
|
|
530
|
+
status: 'locked',
|
|
531
|
+
isTimeout: false,
|
|
532
|
+
timeoutTime: undefined,
|
|
533
|
+
progressPercent: 0,
|
|
534
|
+
lateTime: undefined,
|
|
535
|
+
reserved_status: undefined,
|
|
536
|
+
remainingReserveTime: undefined
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
if (!startAt.isValid() || !endAt.isValid()) return null;
|
|
540
|
+
if (current.isAfter(endAt)) return null;
|
|
541
|
+
if (this.isSameOrAfter(current, startAt) && this.isSameOrBefore(current, endAt)) {
|
|
542
|
+
return {
|
|
543
|
+
...booking,
|
|
544
|
+
status: 'occupied',
|
|
545
|
+
isTimeout: false,
|
|
546
|
+
timeoutTime: undefined,
|
|
547
|
+
progressPercent: this.calcProgressPercent(current, startAt, endAt),
|
|
548
|
+
lateTime: undefined,
|
|
549
|
+
reserved_status: undefined,
|
|
550
|
+
remainingReserveTime: undefined
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
return {
|
|
554
|
+
...booking,
|
|
555
|
+
status: 'reserved',
|
|
556
|
+
isTimeout: false,
|
|
557
|
+
timeoutTime: undefined,
|
|
558
|
+
progressPercent: 0,
|
|
559
|
+
lateTime: undefined,
|
|
560
|
+
reserved_status: 'not_arrived',
|
|
561
|
+
remainingReserveTime: Math.max(startAt.diff(current, 'minute'), 0)
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
async getResourceBookingList(currentTime, bookingList = [], deviceTime = currentTime) {
|
|
382
565
|
// currentTime 约定为完整 datetime;非法值直接返回空,避免误判
|
|
383
566
|
const current = (0, _dayjs.default)(currentTime);
|
|
384
567
|
if (!current.isValid()) return [];
|
|
568
|
+
const deviceCurrent = (0, _dayjs.default)(deviceTime);
|
|
569
|
+
if (!deviceCurrent.isValid()) return [];
|
|
385
570
|
|
|
386
571
|
// 资源列表来源:Server 路由 /shop/form/resource/page
|
|
387
572
|
const resourceResponse = await this.request.get('/shop/form/resource/page', {
|
|
@@ -397,37 +582,109 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
397
582
|
if (!Array.isArray(resourceList) || resourceList.length === 0) return [];
|
|
398
583
|
|
|
399
584
|
// 全局先做 booking 标准化 + start_time 升序,后续映射直接复用
|
|
400
|
-
const normalizedBookings =
|
|
401
|
-
const leftStartAt = this.toBookingDateTime(left.start_date, left.start_time).valueOf();
|
|
402
|
-
const rightStartAt = this.toBookingDateTime(right.start_date, right.start_time).valueOf();
|
|
403
|
-
return leftStartAt - rightStartAt;
|
|
404
|
-
});
|
|
585
|
+
const normalizedBookings = this.normalizeResourceBookings(current, deviceCurrent, bookingList);
|
|
405
586
|
|
|
406
587
|
// 建立 resourceId -> bookings[] 倒排索引,加速资源匹配
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
if (!Array.isArray(booking.resources)) return;
|
|
410
|
-
booking.resources.forEach(resource => {
|
|
411
|
-
const relationId = resource?.relation_id;
|
|
412
|
-
if (relationId === undefined || relationId === null) return;
|
|
413
|
-
const key = String(relationId);
|
|
414
|
-
const list = bookingMap.get(key) || [];
|
|
415
|
-
list.push(booking);
|
|
416
|
-
bookingMap.set(key, list);
|
|
417
|
-
});
|
|
418
|
-
});
|
|
588
|
+
const rawBookingMap = this.groupBookingsByResource(bookingList);
|
|
589
|
+
const bookingMap = this.groupBookingsByResource(normalizedBookings);
|
|
419
590
|
|
|
420
591
|
// 输出:每个资源都返回;bookings 可能是 0 / 1 / 多条(并发场景)
|
|
421
|
-
|
|
592
|
+
const list = resourceList.map(resource => {
|
|
422
593
|
const resourceId = this.getResourceId(resource);
|
|
594
|
+
const rawMatchedBookings = rawBookingMap.get(String(resourceId)) || [];
|
|
423
595
|
const matchedBookings = bookingMap.get(String(resourceId)) || [];
|
|
596
|
+
const statsBookings = rawMatchedBookings.filter(booking => this.isBookingIncludedInStats(booking));
|
|
597
|
+
const orderCount = this.countBookingOrders(statsBookings);
|
|
598
|
+
const bookingCount = statsBookings.length;
|
|
599
|
+
const compeleteBookingCount = this.countCompletedBookings(statsBookings);
|
|
424
600
|
const bookings = this.pickBookingsForCurrentPoint(current, matchedBookings);
|
|
425
601
|
return {
|
|
426
602
|
...resource,
|
|
427
603
|
resource_id: resourceId,
|
|
604
|
+
orderCount,
|
|
605
|
+
bookingCount,
|
|
606
|
+
compeleteBookingCount,
|
|
428
607
|
bookings
|
|
429
608
|
};
|
|
430
609
|
});
|
|
610
|
+
this.logger.addLog({
|
|
611
|
+
type: 'info',
|
|
612
|
+
title: 'getResourceBookingList',
|
|
613
|
+
metadata: {
|
|
614
|
+
currentTime,
|
|
615
|
+
bookingList: bookingList?.length,
|
|
616
|
+
deviceTime,
|
|
617
|
+
list: list?.length
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
return list;
|
|
621
|
+
}
|
|
622
|
+
async getResourceBookingItem(params) {
|
|
623
|
+
const current = (0, _dayjs.default)(params.currentTime);
|
|
624
|
+
if (!current.isValid()) return null;
|
|
625
|
+
const deviceCurrent = (0, _dayjs.default)(params.deviceTime || params.currentTime);
|
|
626
|
+
if (!deviceCurrent.isValid()) return null;
|
|
627
|
+
const resourceResponse = await this.request.get('/shop/form/resource/page', {
|
|
628
|
+
skip: 1,
|
|
629
|
+
num: 999
|
|
630
|
+
},
|
|
631
|
+
// @ts-ignore
|
|
632
|
+
{
|
|
633
|
+
osServer: true,
|
|
634
|
+
isShopApi: true
|
|
635
|
+
});
|
|
636
|
+
const resourceList = resourceResponse?.data?.list ?? [];
|
|
637
|
+
if (!Array.isArray(resourceList) || resourceList.length === 0) return null;
|
|
638
|
+
const targetResource = resourceList.find(resource => String(this.getResourceId(resource)) === String(params.resourceId));
|
|
639
|
+
if (!targetResource) return null;
|
|
640
|
+
const resourceId = this.getResourceId(targetResource);
|
|
641
|
+
const matchedBookingList = params.bookingList.filter(booking => this.isBookingMatchedResource(booking, resourceId));
|
|
642
|
+
const statsBookingList = matchedBookingList.filter(booking => this.isBookingIncludedInStats(booking));
|
|
643
|
+
const completedBookingList = matchedBookingList.filter(booking => this.getBookingAppointmentStatus(booking) === 'completed');
|
|
644
|
+
const unpaidBookingList = matchedBookingList.filter(booking => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing');
|
|
645
|
+
const bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
|
|
646
|
+
const completedBookings = completedBookingList.map(booking => {
|
|
647
|
+
return {
|
|
648
|
+
...booking,
|
|
649
|
+
status: 'compelete',
|
|
650
|
+
isTimeout: false,
|
|
651
|
+
timeoutTime: undefined,
|
|
652
|
+
progressPercent: 100,
|
|
653
|
+
lateTime: undefined,
|
|
654
|
+
reserved_status: undefined,
|
|
655
|
+
remainingReserveTime: undefined
|
|
656
|
+
};
|
|
657
|
+
});
|
|
658
|
+
const unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList));
|
|
659
|
+
const orderCount = this.countBookingOrders(statsBookingList);
|
|
660
|
+
const bookingCount = statsBookingList.length;
|
|
661
|
+
const compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
662
|
+
this.logger.addLog({
|
|
663
|
+
type: 'info',
|
|
664
|
+
title: 'getResourceBookingItem',
|
|
665
|
+
metadata: {
|
|
666
|
+
currentTime: params.currentTime,
|
|
667
|
+
deviceTime: params.deviceTime || params.currentTime,
|
|
668
|
+
resourceId,
|
|
669
|
+
bookingList: params.bookingList?.length,
|
|
670
|
+
bookings: bookings.length,
|
|
671
|
+
completedBookings: completedBookings.length,
|
|
672
|
+
unpaidBookings: unpaidBookings.length,
|
|
673
|
+
orderCount,
|
|
674
|
+
bookingCount,
|
|
675
|
+
compeleteBookingCount
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
return {
|
|
679
|
+
...targetResource,
|
|
680
|
+
resource_id: resourceId,
|
|
681
|
+
orderCount,
|
|
682
|
+
bookingCount,
|
|
683
|
+
compeleteBookingCount,
|
|
684
|
+
bookings,
|
|
685
|
+
completedBookings,
|
|
686
|
+
unpaidBookings
|
|
687
|
+
};
|
|
431
688
|
}
|
|
432
689
|
}
|
|
433
690
|
exports.Sales = exports.SalesImpl = SalesImpl;
|
|
@@ -15,11 +15,12 @@ export declare enum SalesHooks {
|
|
|
15
15
|
* 将 Server/Order 原始数据转换为真正的 Reservation DTO,
|
|
16
16
|
* 当前不要直接把 OrderData 当作最终 UI 数据结构。
|
|
17
17
|
*/
|
|
18
|
-
export type Reservation = OrderData;
|
|
19
|
-
export type SalesBookingStatus = 'reserved' | 'occupied' | 'locked' | undefined;
|
|
20
|
-
export type SalesReservedStatus = 'not_arrived' | 'late' | undefined;
|
|
18
|
+
export declare type Reservation = OrderData;
|
|
19
|
+
export declare type SalesBookingStatus = 'reserved' | 'occupied' | 'locked' | 'completed' | undefined;
|
|
20
|
+
export declare type SalesReservedStatus = 'not_arrived' | 'late' | undefined;
|
|
21
21
|
export interface SalesResourceMatchedBooking extends Omit<BookingData, 'status'> {
|
|
22
22
|
status: SalesBookingStatus;
|
|
23
|
+
isNext?: boolean;
|
|
23
24
|
isTimeout: boolean;
|
|
24
25
|
timeoutTime?: number;
|
|
25
26
|
progressPercent?: number;
|
|
@@ -29,9 +30,26 @@ export interface SalesResourceMatchedBooking extends Omit<BookingData, 'status'>
|
|
|
29
30
|
}
|
|
30
31
|
export interface SalesResourceBookingItem extends Omit<ResourceData, 'bookings'> {
|
|
31
32
|
resource_id: ResourceId;
|
|
33
|
+
orderCount: number;
|
|
34
|
+
bookingCount: number;
|
|
35
|
+
compeleteBookingCount: number;
|
|
32
36
|
bookings: SalesResourceMatchedBooking[];
|
|
33
37
|
}
|
|
34
|
-
export
|
|
38
|
+
export interface SalesResourceBookingItemWithGroups extends SalesResourceBookingItem {
|
|
39
|
+
completedBookings: SalesResourceMatchedBooking[];
|
|
40
|
+
unpaidBookings: SalesResourceMatchedBooking[];
|
|
41
|
+
}
|
|
42
|
+
export declare type SalesTimelineHighlights = number[];
|
|
43
|
+
export interface ChangeBookingStatusParams {
|
|
44
|
+
booking_id: number | string;
|
|
45
|
+
appointment_status: string;
|
|
46
|
+
}
|
|
47
|
+
export interface GetResourceBookingItemParams {
|
|
48
|
+
resourceId: ResourceId;
|
|
49
|
+
currentTime: string;
|
|
50
|
+
bookingList: BookingData[];
|
|
51
|
+
deviceTime?: string;
|
|
52
|
+
}
|
|
35
53
|
/**
|
|
36
54
|
* Sales 解决方案状态
|
|
37
55
|
*
|
|
@@ -60,8 +78,14 @@ export interface SalesModuleAPI {
|
|
|
60
78
|
setReservationList: (reservationList: Reservation[]) => Reservation[];
|
|
61
79
|
/** 重置预约列表为空 */
|
|
62
80
|
resetReservationList: () => Reservation[];
|
|
81
|
+
/** 取消订单 */
|
|
82
|
+
cancelOrder: (orderIds: Array<number | string>) => Promise<any>;
|
|
83
|
+
/** 变更预约状态 */
|
|
84
|
+
changeBookingStatus: (params: ChangeBookingStatusParams) => Promise<any>;
|
|
63
85
|
/** 获取资源维度的预约占用列表 */
|
|
64
|
-
getResourceBookingList: (currentTime: string, bookingList: BookingData[]) => Promise<SalesResourceBookingItem[]>;
|
|
86
|
+
getResourceBookingList: (currentTime: string, bookingList: BookingData[], deviceTime?: string) => Promise<SalesResourceBookingItem[]>;
|
|
87
|
+
/** 获取单个资源维度的预约占用、已完成、未支付列表 */
|
|
88
|
+
getResourceBookingItem: (params: GetResourceBookingItemParams) => Promise<SalesResourceBookingItemWithGroups | null>;
|
|
65
89
|
/** 获取时间轴每个时间片的预约数量 */
|
|
66
90
|
getTimelineHighlights: (bookingList: BookingData[], startDateTime?: string, endDateTime?: string) => SalesTimelineHighlights;
|
|
67
91
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
-
import {
|
|
3
|
-
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult
|
|
4
|
-
import type {
|
|
2
|
+
import { BaseSalesImpl } from '../BaseSales';
|
|
3
|
+
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderState, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult } from './types';
|
|
4
|
+
import type { UpdateOrderProductParams } from '../../modules/Order/types';
|
|
5
5
|
import type { Discount } from '../../modules/Discount/types';
|
|
6
|
+
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
6
7
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
7
8
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
8
9
|
import type { ProductData } from '../../modules/Product/types';
|
|
@@ -15,16 +16,16 @@ interface ScanOrderItemRuleRuntimeConfig {
|
|
|
15
16
|
submissionIndex?: number;
|
|
16
17
|
custom?: Record<string, any>;
|
|
17
18
|
}
|
|
18
|
-
export declare class ScanOrderImpl extends
|
|
19
|
+
export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
|
|
19
20
|
protected defaultName: string;
|
|
20
21
|
protected defaultVersion: string;
|
|
21
22
|
isSolution: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
protected initializeOptions: ModuleOptions;
|
|
24
|
+
protected store: ScanOrderState;
|
|
25
|
+
protected otherParams: Record<string, any>;
|
|
26
|
+
protected cacheId: string | undefined;
|
|
27
|
+
window: WindowPlugin;
|
|
28
|
+
request: RequestPlugin;
|
|
28
29
|
private itemRuleEvaluator;
|
|
29
30
|
private itemRuleConfigs;
|
|
30
31
|
private itemRuleConfigsPromise;
|
|
@@ -53,9 +54,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
53
54
|
private registerCustomerLoginListeners;
|
|
54
55
|
private refreshOrderMarketingAfterLogin;
|
|
55
56
|
constructor(name?: string, version?: string);
|
|
57
|
+
protected getRegisteredModuleNames(): readonly string[];
|
|
58
|
+
protected createSubModule(moduleName: string): Module | null;
|
|
56
59
|
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
57
60
|
getCacheId(): string | undefined;
|
|
58
|
-
private destroyRegisteredChildModules;
|
|
59
61
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
60
62
|
destroy(): Promise<void>;
|
|
61
63
|
retryInit(): Promise<void>;
|
|
@@ -69,18 +71,20 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
69
71
|
passed: boolean | null;
|
|
70
72
|
failures: QuantityCheckResult[];
|
|
71
73
|
};
|
|
72
|
-
getTempOrder():
|
|
74
|
+
getTempOrder(): import("../../modules/Order/types").OrderTempOrder | null;
|
|
73
75
|
updateTempOrderNote(note: string): string;
|
|
76
|
+
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
77
|
+
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
74
78
|
setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
|
|
75
79
|
service_type: 'dine_in' | '';
|
|
76
80
|
pickup_reference_mode: 'counter_pickup' | 'table_service';
|
|
77
81
|
};
|
|
78
82
|
setPickupRef(buzzer: string): string;
|
|
79
|
-
private
|
|
80
|
-
addNewOrder(): Promise<
|
|
81
|
-
restoreOrder(): Promise<
|
|
82
|
-
getOrderProducts():
|
|
83
|
-
getSummary(): Promise<import("
|
|
83
|
+
private ensureScanOrderTempOrder;
|
|
84
|
+
addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
85
|
+
restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
86
|
+
getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
|
|
87
|
+
getSummary(): Promise<import("../../modules/Order/types").OrderSummary>;
|
|
84
88
|
getDiscountList(): Discount[];
|
|
85
89
|
scanCode(code: string, customerId?: number): Promise<ScanOrderScanCodeResult>;
|
|
86
90
|
setDiscountSelected(params: {
|
|
@@ -94,15 +98,17 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
94
98
|
private buildScanOrderResourceMetadata;
|
|
95
99
|
private prepareRetailAvailability;
|
|
96
100
|
private buildSubmitPayloadEnhancer;
|
|
101
|
+
private isScanOrderMoreMode;
|
|
102
|
+
private submitScanOrderMore;
|
|
97
103
|
submitScanOrder<T = any>(): Promise<T>;
|
|
98
|
-
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<
|
|
99
|
-
|
|
104
|
+
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
105
|
+
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
100
106
|
/**
|
|
101
107
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
102
108
|
* 多行同 SKU 时必须传入与删除/更新一致的 identity(如 `identity_key`)。
|
|
103
109
|
*/
|
|
104
|
-
setOrderProductLineNote(identity: ScanOrderOrderProductIdentity, note: string): Promise<
|
|
105
|
-
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<
|
|
110
|
+
setOrderProductLineNote(identity: ScanOrderOrderProductIdentity, note: string): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
111
|
+
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
106
112
|
private loadRuntimeConfigs;
|
|
107
113
|
private syncItemRuleConfigsFromDineInConfig;
|
|
108
114
|
private fetchItemRuleConfigsByModelIds;
|