@pisell/pisellos 0.0.568 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +24 -96
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +12 -14
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +27 -5
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +43 -30
- package/dist/modules/Discount/types.d.ts +1 -1
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +38 -16
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5460 -574
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +573 -746
- package/dist/modules/Payment/types.d.ts +44 -24
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +49 -33
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +182 -81
- package/dist/modules/ProductList/types.d.ts +16 -0
- package/dist/modules/Quotation/index.d.ts +22 -2
- package/dist/modules/Quotation/index.js +108 -42
- package/dist/modules/Quotation/types.d.ts +19 -0
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +8 -10
- package/dist/modules/Rules/index.js +324 -513
- package/dist/modules/Rules/types.d.ts +14 -3
- package/dist/modules/SalesSummary/index.d.ts +23 -26
- package/dist/modules/SalesSummary/index.js +152 -46
- package/dist/modules/SalesSummary/types.d.ts +9 -1
- package/dist/modules/SalesSummary/utils.d.ts +3 -22
- package/dist/modules/SalesSummary/utils.js +804 -165
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -12
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +79 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/modules/SurchargeList/index.d.ts +18 -0
- package/dist/modules/SurchargeList/index.js +185 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +4 -1
- package/dist/plugins/app.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6168 -680
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2328 -379
- package/dist/server/modules/order/types.d.ts +76 -5
- package/dist/server/modules/order/types.js +14 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +118 -11
- package/dist/server/modules/order/utils/filterOrders.js +242 -14
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +105 -14
- package/dist/server/modules/products/index.js +1416 -521
- package/dist/server/modules/products/types.d.ts +34 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +298 -77
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +109 -86
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +145 -106
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +3 -2
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4009 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +393 -24
- package/dist/solution/BookingTicket/index.js +2508 -443
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +42 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +42 -28
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +30 -14
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +275 -209
- package/dist/solution/Checkout/utils/index.js +20 -8
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +519 -444
- package/dist/solution/ScanOrder/types.d.ts +33 -11
- package/dist/solution/ScanOrder/types.js +4 -5
- package/dist/solution/ScanOrder/utils.d.ts +4 -1
- package/dist/solution/ScanOrder/utils.js +109 -34
- package/dist/solution/ShopDiscount/index.js +18 -19
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +32 -51
- package/dist/solution/VenueBooking/index.js +741 -808
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +12 -2
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +233 -382
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +0 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -676
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +50 -29
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +368 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +298 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +155 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +222 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +261 -309
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +59 -31
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +207 -217
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +133 -119
- package/lib/modules/Discount/types.d.ts +1 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +88 -63
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +4184 -514
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +35 -24
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +1085 -414
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +402 -636
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +44 -24
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +50 -52
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +216 -221
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +161 -120
- package/lib/modules/ProductList/types.d.ts +16 -0
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +154 -64
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +960 -1440
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +134 -61
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +814 -233
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +169 -338
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +153 -104
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +109 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +63 -212
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +4520 -1162
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +327 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +34 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +67 -84
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1543 -285
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +32 -107
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +259 -176
- package/lib/server/modules/order/utils/filterOrders.js +293 -94
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +850 -475
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +34 -41
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +254 -75
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +240 -243
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +146 -147
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +140 -197
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +904 -0
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2533 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +43 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1004 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +289 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +256 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +244 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +393 -24
- package/lib/solution/BookingTicket/index.js +1374 -184
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +79 -40
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +184 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +58 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +97 -64
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -82
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +109 -91
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1169 -1463
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +462 -503
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +498 -238
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +936 -864
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +422 -385
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +32 -51
- package/lib/solution/VenueBooking/index.js +1008 -984
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +109 -90
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +41 -102
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +12 -2
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -39,10 +39,13 @@ export * from "./types";
|
|
|
39
39
|
* - 基础生命周期占位
|
|
40
40
|
*
|
|
41
41
|
* 不提前实现 store 编排、初始化流程细节、状态计算逻辑。
|
|
42
|
+
* TIPS:这块应该改名叫 ReservationModule 更合适一些,目前这边只服务于 Reservation 的 floormap 展示。
|
|
42
43
|
*/
|
|
43
44
|
export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
44
45
|
_inherits(SalesImpl, _BaseModule);
|
|
45
46
|
var _super = _createSuper(SalesImpl);
|
|
47
|
+
// LoggerManager 实例
|
|
48
|
+
|
|
46
49
|
function SalesImpl(name, version) {
|
|
47
50
|
var _this;
|
|
48
51
|
_classCallCheck(this, SalesImpl);
|
|
@@ -55,6 +58,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
55
58
|
_defineProperty(_assertThisInitialized(_this), "options", {});
|
|
56
59
|
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
57
60
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
58
62
|
return _this;
|
|
59
63
|
}
|
|
60
64
|
_createClass(SalesImpl, [{
|
|
@@ -87,9 +91,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
87
91
|
|
|
88
92
|
// TODO(Rolo): 等领导提供 reservationList 的目标结构后,
|
|
89
93
|
// 在这里补充从 Server/Order 读取 currentDay 原始数据并转换为预约列表。
|
|
90
|
-
|
|
94
|
+
|
|
95
|
+
this.logger = appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp().logger;
|
|
96
|
+
_context.next = 12;
|
|
91
97
|
return this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
92
|
-
case
|
|
98
|
+
case 12:
|
|
93
99
|
case "end":
|
|
94
100
|
return _context.stop();
|
|
95
101
|
}
|
|
@@ -156,26 +162,80 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
156
162
|
});
|
|
157
163
|
return [];
|
|
158
164
|
}
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
}, {
|
|
166
|
+
key: "cancelOrder",
|
|
167
|
+
value: function () {
|
|
168
|
+
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderIds) {
|
|
169
|
+
var orderModule;
|
|
170
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
171
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
172
|
+
case 0:
|
|
173
|
+
orderModule = this.core.getModule('order');
|
|
174
|
+
if (orderModule) {
|
|
175
|
+
_context2.next = 3;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
throw new Error('Sales 取消订单失败:Order 模块未注册');
|
|
179
|
+
case 3:
|
|
180
|
+
return _context2.abrupt("return", orderModule.cancelOrder({
|
|
181
|
+
order_ids: orderIds
|
|
182
|
+
}));
|
|
183
|
+
case 4:
|
|
184
|
+
case "end":
|
|
185
|
+
return _context2.stop();
|
|
186
|
+
}
|
|
187
|
+
}, _callee2, this);
|
|
188
|
+
}));
|
|
189
|
+
function cancelOrder(_x2) {
|
|
190
|
+
return _cancelOrder.apply(this, arguments);
|
|
191
|
+
}
|
|
192
|
+
return cancelOrder;
|
|
193
|
+
}()
|
|
194
|
+
}, {
|
|
195
|
+
key: "changeBookingStatus",
|
|
196
|
+
value: function () {
|
|
197
|
+
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
198
|
+
var orderModule;
|
|
199
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
200
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
201
|
+
case 0:
|
|
202
|
+
orderModule = this.core.getModule('order');
|
|
203
|
+
if (orderModule) {
|
|
204
|
+
_context3.next = 3;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
throw new Error('Sales 变更预约状态失败:Order 模块未注册');
|
|
208
|
+
case 3:
|
|
209
|
+
return _context3.abrupt("return", orderModule.changeBookingStatus(params));
|
|
210
|
+
case 4:
|
|
211
|
+
case "end":
|
|
212
|
+
return _context3.stop();
|
|
213
|
+
}
|
|
214
|
+
}, _callee3, this);
|
|
215
|
+
}));
|
|
216
|
+
function changeBookingStatus(_x3) {
|
|
217
|
+
return _changeBookingStatus.apply(this, arguments);
|
|
218
|
+
}
|
|
219
|
+
return changeBookingStatus;
|
|
220
|
+
}() // -------------------------------------------------------------------------
|
|
161
221
|
// 生命周期
|
|
162
222
|
// -------------------------------------------------------------------------
|
|
163
223
|
}, {
|
|
164
224
|
key: "destroy",
|
|
165
225
|
value: function () {
|
|
166
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
167
|
-
return _regeneratorRuntime().wrap(function
|
|
168
|
-
while (1) switch (
|
|
226
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
227
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
228
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
169
229
|
case 0:
|
|
170
|
-
|
|
230
|
+
_context4.next = 2;
|
|
171
231
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
172
232
|
case 2:
|
|
173
233
|
_get(_getPrototypeOf(SalesImpl.prototype), "destroy", this).call(this);
|
|
174
234
|
case 3:
|
|
175
235
|
case "end":
|
|
176
|
-
return
|
|
236
|
+
return _context4.stop();
|
|
177
237
|
}
|
|
178
|
-
},
|
|
238
|
+
}, _callee4, this);
|
|
179
239
|
}));
|
|
180
240
|
function destroy() {
|
|
181
241
|
return _destroy.apply(this, arguments);
|
|
@@ -262,7 +322,10 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
262
322
|
if (slotCount <= 0) return [];
|
|
263
323
|
var diff = new Int32Array(slotCount + 1);
|
|
264
324
|
for (var i = 0; i < bookingList.length; i++) {
|
|
325
|
+
var _ref2, _booking$appointment_;
|
|
265
326
|
var booking = bookingList[i];
|
|
327
|
+
var appointmentStatus = String((_ref2 = (_booking$appointment_ = booking.appointment_status) !== null && _booking$appointment_ !== void 0 ? _booking$appointment_ : booking.status) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
328
|
+
if (appointmentStatus === 'new' || appointmentStatus === 'rejected' || appointmentStatus === 'cancelled') continue;
|
|
266
329
|
var bookingStartAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
267
330
|
var bookingEndAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
268
331
|
if (!bookingStartAt.isValid() || !bookingEndAt.isValid()) continue;
|
|
@@ -321,7 +384,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
321
384
|
key: "getBookingStatus",
|
|
322
385
|
value: function getBookingStatus(appointmentStatus) {
|
|
323
386
|
if (appointmentStatus === 'started') return 'occupied';
|
|
324
|
-
if (appointmentStatus === '
|
|
387
|
+
if (appointmentStatus === 'confirmed' || appointmentStatus === 'arrived') {
|
|
325
388
|
return 'reserved';
|
|
326
389
|
}
|
|
327
390
|
// TODO: locked 的业务规则后续补充。
|
|
@@ -331,8 +394,83 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
331
394
|
}, {
|
|
332
395
|
key: "getResourceId",
|
|
333
396
|
value: function getResourceId(resource) {
|
|
334
|
-
var
|
|
335
|
-
return (
|
|
397
|
+
var _ref3, _resource$id;
|
|
398
|
+
return (_ref3 = (_resource$id = resource.id) !== null && _resource$id !== void 0 ? _resource$id : resource.form_record_id) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
399
|
+
}
|
|
400
|
+
}, {
|
|
401
|
+
key: "getBookingAppointmentStatus",
|
|
402
|
+
value: function getBookingAppointmentStatus(booking) {
|
|
403
|
+
var _ref4, _booking$appointment_2;
|
|
404
|
+
return String((_ref4 = (_booking$appointment_2 = booking.appointment_status) !== null && _booking$appointment_2 !== void 0 ? _booking$appointment_2 : booking.status) !== null && _ref4 !== void 0 ? _ref4 : '');
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
key: "isBookingIncludedInStats",
|
|
408
|
+
value: function isBookingIncludedInStats(booking) {
|
|
409
|
+
var appointmentStatus = this.getBookingAppointmentStatus(booking);
|
|
410
|
+
return appointmentStatus !== 'new' && appointmentStatus !== 'rejected' && appointmentStatus !== 'cancelled';
|
|
411
|
+
}
|
|
412
|
+
}, {
|
|
413
|
+
key: "getBookingOrderPaymentStatus",
|
|
414
|
+
value: function getBookingOrderPaymentStatus(booking) {
|
|
415
|
+
var _booking$order$paymen, _booking$order;
|
|
416
|
+
return String((_booking$order$paymen = (_booking$order = booking.order) === null || _booking$order === void 0 ? void 0 : _booking$order.payment_status) !== null && _booking$order$paymen !== void 0 ? _booking$order$paymen : '');
|
|
417
|
+
}
|
|
418
|
+
}, {
|
|
419
|
+
key: "countBookingOrders",
|
|
420
|
+
value: function countBookingOrders(bookings) {
|
|
421
|
+
var orderIds = new Set();
|
|
422
|
+
bookings.forEach(function (booking) {
|
|
423
|
+
var _order_id, _booking$order2;
|
|
424
|
+
var orderId = (_order_id = booking.order_id) !== null && _order_id !== void 0 ? _order_id : (_booking$order2 = booking.order) === null || _booking$order2 === void 0 ? void 0 : _booking$order2.order_id;
|
|
425
|
+
if (orderId === undefined || orderId === null) return;
|
|
426
|
+
orderIds.add(String(orderId));
|
|
427
|
+
});
|
|
428
|
+
return orderIds.size;
|
|
429
|
+
}
|
|
430
|
+
}, {
|
|
431
|
+
key: "countCompletedBookings",
|
|
432
|
+
value: function countCompletedBookings(bookings) {
|
|
433
|
+
var _this2 = this;
|
|
434
|
+
return bookings.filter(function (booking) {
|
|
435
|
+
return _this2.getBookingAppointmentStatus(booking) === 'completed';
|
|
436
|
+
}).length;
|
|
437
|
+
}
|
|
438
|
+
}, {
|
|
439
|
+
key: "groupBookingsByResource",
|
|
440
|
+
value: function groupBookingsByResource(bookingList) {
|
|
441
|
+
var bookingMap = new Map();
|
|
442
|
+
bookingList.forEach(function (booking) {
|
|
443
|
+
if (!Array.isArray(booking.resources)) return;
|
|
444
|
+
booking.resources.forEach(function (resource) {
|
|
445
|
+
var relationId = resource === null || resource === void 0 ? void 0 : resource.relation_id;
|
|
446
|
+
if (relationId === undefined || relationId === null) return;
|
|
447
|
+
var key = String(relationId);
|
|
448
|
+
var list = bookingMap.get(key) || [];
|
|
449
|
+
list.push(booking);
|
|
450
|
+
bookingMap.set(key, list);
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
return bookingMap;
|
|
454
|
+
}
|
|
455
|
+
}, {
|
|
456
|
+
key: "isBookingMatchedResource",
|
|
457
|
+
value: function isBookingMatchedResource(booking, resourceId) {
|
|
458
|
+
if (!Array.isArray(booking.resources)) return false;
|
|
459
|
+
return booking.resources.some(function (resource) {
|
|
460
|
+
var relationId = resource === null || resource === void 0 ? void 0 : resource.relation_id;
|
|
461
|
+
if (relationId === undefined || relationId === null) return false;
|
|
462
|
+
return String(relationId) === String(resourceId);
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}, {
|
|
466
|
+
key: "sortMatchedBookings",
|
|
467
|
+
value: function sortMatchedBookings(bookings) {
|
|
468
|
+
var _this3 = this;
|
|
469
|
+
return _toConsumableArray(bookings).sort(function (left, right) {
|
|
470
|
+
var leftStartAt = _this3.toBookingDateTime(left.start_date, left.start_time).valueOf();
|
|
471
|
+
var rightStartAt = _this3.toBookingDateTime(right.start_date, right.start_time).valueOf();
|
|
472
|
+
return leftStartAt - rightStartAt;
|
|
473
|
+
});
|
|
336
474
|
}
|
|
337
475
|
|
|
338
476
|
/**
|
|
@@ -345,17 +483,17 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
345
483
|
}, {
|
|
346
484
|
key: "pickBookingsForCurrentPoint",
|
|
347
485
|
value: function pickBookingsForCurrentPoint(current, bookings) {
|
|
348
|
-
var
|
|
486
|
+
var _this4 = this;
|
|
349
487
|
if (bookings.length === 0) return [];
|
|
350
488
|
var currentDayStart = current.startOf('day');
|
|
351
489
|
var currentDayEnd = current.endOf('day');
|
|
352
490
|
|
|
353
491
|
// 仅保留与 current 当天有时间交集的预约,避免跨天误命中
|
|
354
492
|
var dayScopedBookings = bookings.filter(function (booking) {
|
|
355
|
-
var startAt =
|
|
356
|
-
var endAt =
|
|
493
|
+
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
494
|
+
var endAt = _this4.toBookingDateTime(booking.end_date, booking.end_time);
|
|
357
495
|
if (!startAt.isValid() || !endAt.isValid()) return false;
|
|
358
|
-
return
|
|
496
|
+
return _this4.isSameOrBefore(startAt, currentDayEnd) && _this4.isSameOrAfter(endAt, currentDayStart);
|
|
359
497
|
});
|
|
360
498
|
if (dayScopedBookings.length === 0) return [];
|
|
361
499
|
var appendNextStartGroupIfNeeded = function appendNextStartGroupIfNeeded(selectedBookings) {
|
|
@@ -365,33 +503,36 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
365
503
|
});
|
|
366
504
|
if (!shouldAppendNextGroup) return selectedBookings;
|
|
367
505
|
var selectedStartValues = new Set(selectedBookings.map(function (booking) {
|
|
368
|
-
return
|
|
506
|
+
return _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
369
507
|
}).filter(function (startAt) {
|
|
370
508
|
return startAt.isValid();
|
|
371
509
|
}).map(function (startAt) {
|
|
372
510
|
return startAt.valueOf();
|
|
373
511
|
}));
|
|
374
512
|
var futureCandidates = dayScopedBookings.filter(function (booking) {
|
|
375
|
-
var startAt =
|
|
513
|
+
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
376
514
|
if (!startAt.isValid()) return false;
|
|
377
515
|
return startAt.isAfter(current) && !selectedStartValues.has(startAt.valueOf());
|
|
378
516
|
});
|
|
379
517
|
if (futureCandidates.length === 0) return selectedBookings;
|
|
380
|
-
var nextStartAt =
|
|
518
|
+
var nextStartAt = _this4.toBookingDateTime(futureCandidates[0].start_date, futureCandidates[0].start_time).valueOf();
|
|
381
519
|
var nextStartGroup = futureCandidates.filter(function (booking) {
|
|
382
|
-
var startAt =
|
|
520
|
+
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
383
521
|
return startAt.isValid() && startAt.valueOf() === nextStartAt;
|
|
384
522
|
});
|
|
385
523
|
if (nextStartGroup.length === 0) return selectedBookings;
|
|
524
|
+
nextStartGroup.forEach(function (booking) {
|
|
525
|
+
booking.isNext = true;
|
|
526
|
+
});
|
|
386
527
|
return [].concat(_toConsumableArray(selectedBookings), _toConsumableArray(nextStartGroup));
|
|
387
528
|
};
|
|
388
529
|
|
|
389
530
|
// active: current 处于 [startAt, endAt] 区间
|
|
390
531
|
var activeBookings = dayScopedBookings.filter(function (booking) {
|
|
391
|
-
var startAt =
|
|
392
|
-
var endAt =
|
|
532
|
+
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
533
|
+
var endAt = _this4.toBookingDateTime(booking.end_date, booking.end_time);
|
|
393
534
|
if (!startAt.isValid() || !endAt.isValid()) return false;
|
|
394
|
-
return
|
|
535
|
+
return _this4.isSameOrAfter(current, startAt) && _this4.isSameOrBefore(current, endAt);
|
|
395
536
|
});
|
|
396
537
|
if (activeBookings.length > 0) return appendNextStartGroupIfNeeded(activeBookings);
|
|
397
538
|
|
|
@@ -403,13 +544,13 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
403
544
|
|
|
404
545
|
// upcoming: 从未来预约里只取最早那一组(同 start_time)
|
|
405
546
|
var upcoming = dayScopedBookings.filter(function (booking) {
|
|
406
|
-
var startAt =
|
|
547
|
+
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
407
548
|
return startAt.isValid() && startAt.isAfter(current) && startAt.isSame(current, 'day');
|
|
408
549
|
});
|
|
409
550
|
if (upcoming.length > 0) {
|
|
410
551
|
var firstStartAt = this.toBookingDateTime(upcoming[0].start_date, upcoming[0].start_time).valueOf();
|
|
411
552
|
var upcomingStartGroup = upcoming.filter(function (booking) {
|
|
412
|
-
var startAt =
|
|
553
|
+
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
413
554
|
return startAt.valueOf() === firstStartAt;
|
|
414
555
|
});
|
|
415
556
|
return appendNextStartGroupIfNeeded(upcomingStartGroup);
|
|
@@ -421,33 +562,99 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
421
562
|
}
|
|
422
563
|
|
|
423
564
|
/**
|
|
424
|
-
*
|
|
425
|
-
* -
|
|
426
|
-
* -
|
|
565
|
+
* 计算 booking 在 current 时刻的执行进度百分比(0-100)。
|
|
566
|
+
* - startAt/endAt 非法或 totalMinutes <= 0 返回 0
|
|
567
|
+
* - current 早于 startAt 返回 0,晚于 endAt 返回 100
|
|
568
|
+
*/
|
|
569
|
+
}, {
|
|
570
|
+
key: "calcProgressPercent",
|
|
571
|
+
value: function calcProgressPercent(current, startAt, endAt) {
|
|
572
|
+
if (!startAt.isValid() || !endAt.isValid()) return 0;
|
|
573
|
+
var totalMinutes = endAt.diff(startAt, 'minute');
|
|
574
|
+
if (totalMinutes <= 0) return 0;
|
|
575
|
+
var elapsedMinutes = current.diff(startAt, 'minute');
|
|
576
|
+
if (elapsedMinutes <= 0) return 0;
|
|
577
|
+
if (elapsedMinutes >= totalMinutes) return 100;
|
|
578
|
+
return Math.floor(elapsedMinutes / totalMinutes * 100);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* 标准化单条 booking 的分发入口:
|
|
583
|
+
* - 统一过滤 rejected / cancelled(视为没来过)
|
|
584
|
+
* - current === deviceCurrent 走实时分支(信任 appointment_status)
|
|
585
|
+
* - 否则走快照分支(纯时间窗判定,忽略 appointment_status 的 arrived/started/completed 差异)
|
|
427
586
|
*/
|
|
428
587
|
}, {
|
|
429
588
|
key: "normalizeMatchedBooking",
|
|
430
|
-
value: function normalizeMatchedBooking(current, booking) {
|
|
431
|
-
var
|
|
432
|
-
var appointmentStatus =
|
|
433
|
-
if (appointmentStatus === 'rejected' || appointmentStatus === 'cancelled'
|
|
434
|
-
|
|
589
|
+
value: function normalizeMatchedBooking(current, deviceCurrent, booking) {
|
|
590
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
591
|
+
var appointmentStatus = this.getBookingAppointmentStatus(booking);
|
|
592
|
+
if (appointmentStatus === 'rejected' || appointmentStatus === 'cancelled') return null;
|
|
593
|
+
var startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
594
|
+
var endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
595
|
+
if (appointmentStatus === 'completed' && options.includeCompleted) {
|
|
596
|
+
return this.buildCompletedBooking(current, booking, startAt, endAt);
|
|
597
|
+
}
|
|
598
|
+
if (current.isSame(deviceCurrent)) {
|
|
599
|
+
return this.buildRealtimeBooking(current, booking, appointmentStatus, startAt, endAt);
|
|
600
|
+
}
|
|
601
|
+
return this.buildSnapshotBooking(current, booking, appointmentStatus, startAt, endAt);
|
|
602
|
+
}
|
|
603
|
+
}, {
|
|
604
|
+
key: "normalizeResourceBookings",
|
|
605
|
+
value: function normalizeResourceBookings(current, deviceCurrent, bookingList) {
|
|
606
|
+
var _this5 = this;
|
|
607
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
608
|
+
var normalizedBookings = bookingList.map(function (booking) {
|
|
609
|
+
return _this5.normalizeMatchedBooking(current, deviceCurrent, booking, options);
|
|
610
|
+
}).filter(function (booking) {
|
|
611
|
+
return Boolean(booking);
|
|
612
|
+
}).filter(function (booking) {
|
|
613
|
+
return booking.status;
|
|
614
|
+
});
|
|
615
|
+
return this.sortMatchedBookings(normalizedBookings);
|
|
616
|
+
}
|
|
617
|
+
}, {
|
|
618
|
+
key: "buildCompletedBooking",
|
|
619
|
+
value: function buildCompletedBooking(current, booking, startAt, endAt) {
|
|
620
|
+
if (!startAt.isValid() || !endAt.isValid()) return null;
|
|
621
|
+
if (current.isBefore(startAt)) {
|
|
622
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
623
|
+
status: 'reserved',
|
|
624
|
+
isTimeout: false,
|
|
625
|
+
timeoutTime: undefined,
|
|
626
|
+
progressPercent: 0,
|
|
627
|
+
lateTime: undefined,
|
|
628
|
+
reserved_status: 'not_arrived',
|
|
629
|
+
remainingReserveTime: Math.max(startAt.diff(current, 'minute'), 0)
|
|
630
|
+
});
|
|
435
631
|
}
|
|
632
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
633
|
+
status: 'occupied',
|
|
634
|
+
isTimeout: false,
|
|
635
|
+
timeoutTime: undefined,
|
|
636
|
+
progressPercent: this.isSameOrAfter(current, endAt) ? 100 : this.calcProgressPercent(current, startAt, endAt),
|
|
637
|
+
lateTime: undefined,
|
|
638
|
+
reserved_status: undefined,
|
|
639
|
+
remainingReserveTime: undefined
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* 实时模式(current === deviceCurrent):信任 appointment_status
|
|
645
|
+
* - 过滤 new / completed(实时视角下视为非活跃数据)
|
|
646
|
+
* - status 由 getBookingStatus 映射
|
|
647
|
+
* - occupied 且 current > endAt 标记 isTimeout + timeoutTime
|
|
648
|
+
* - reserved 且 current < startAt 标记 not_arrived,否则标记 late
|
|
649
|
+
*/
|
|
650
|
+
}, {
|
|
651
|
+
key: "buildRealtimeBooking",
|
|
652
|
+
value: function buildRealtimeBooking(current, booking, appointmentStatus, startAt, endAt) {
|
|
653
|
+
if (appointmentStatus === 'new' || appointmentStatus === 'completed') return null;
|
|
436
654
|
var bookingStatus = this.getBookingStatus(appointmentStatus);
|
|
437
|
-
var endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
438
|
-
var startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
439
655
|
var isTimeout = bookingStatus === 'occupied' && endAt.isValid() && current.isAfter(endAt);
|
|
440
656
|
var timeoutTime = isTimeout ? current.diff(endAt, 'minute') : undefined;
|
|
441
|
-
var progressPercent =
|
|
442
|
-
if (bookingStatus !== 'occupied') return 0;
|
|
443
|
-
if (!startAt.isValid() || !endAt.isValid()) return 0;
|
|
444
|
-
var totalMinutes = endAt.diff(startAt, 'minute');
|
|
445
|
-
if (totalMinutes <= 0) return 0;
|
|
446
|
-
var elapsedMinutes = current.diff(startAt, 'minute');
|
|
447
|
-
if (elapsedMinutes <= 0) return 0;
|
|
448
|
-
if (elapsedMinutes >= totalMinutes) return 100;
|
|
449
|
-
return Math.floor(elapsedMinutes / totalMinutes * 100);
|
|
450
|
-
}();
|
|
657
|
+
var progressPercent = bookingStatus === 'occupied' ? this.calcProgressPercent(current, startAt, endAt) : 0;
|
|
451
658
|
var reservedStatus;
|
|
452
659
|
var lateTime;
|
|
453
660
|
var remainingReserveTime;
|
|
@@ -470,33 +677,98 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
470
677
|
remainingReserveTime: remainingReserveTime
|
|
471
678
|
});
|
|
472
679
|
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* 快照模式(current !== deviceCurrent,过去或未来):忽略 appointment_status
|
|
683
|
+
* 的实时态差异,仅按 booking 时间窗判定,为 current 提供时间点快照视图。
|
|
684
|
+
*
|
|
685
|
+
* - new:视作尚未成为真实预约,过滤
|
|
686
|
+
* - locked:保留 status=locked,不计算 timeout/late/progress
|
|
687
|
+
* - 其他非终态:
|
|
688
|
+
* - startAt/endAt 非法 → 过滤
|
|
689
|
+
* - current > endAt → 过滤(已结束,不入池)
|
|
690
|
+
* - current ∈ [startAt, endAt] → occupied,附带 progressPercent
|
|
691
|
+
* - current < startAt → reserved + not_arrived,附带 remainingReserveTime
|
|
692
|
+
*
|
|
693
|
+
* 快照模式下 isTimeout 恒为 false,lateTime / timeoutTime 始终置空。
|
|
694
|
+
*/
|
|
695
|
+
}, {
|
|
696
|
+
key: "buildSnapshotBooking",
|
|
697
|
+
value: function buildSnapshotBooking(current, booking, appointmentStatus, startAt, endAt) {
|
|
698
|
+
if (appointmentStatus === 'new') return null;
|
|
699
|
+
if (appointmentStatus === 'locked') {
|
|
700
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
701
|
+
status: 'locked',
|
|
702
|
+
isTimeout: false,
|
|
703
|
+
timeoutTime: undefined,
|
|
704
|
+
progressPercent: 0,
|
|
705
|
+
lateTime: undefined,
|
|
706
|
+
reserved_status: undefined,
|
|
707
|
+
remainingReserveTime: undefined
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
if (!startAt.isValid() || !endAt.isValid()) return null;
|
|
711
|
+
if (current.isAfter(endAt)) return null;
|
|
712
|
+
if (this.isSameOrAfter(current, startAt) && this.isSameOrBefore(current, endAt)) {
|
|
713
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
714
|
+
status: 'occupied',
|
|
715
|
+
isTimeout: false,
|
|
716
|
+
timeoutTime: undefined,
|
|
717
|
+
progressPercent: this.calcProgressPercent(current, startAt, endAt),
|
|
718
|
+
lateTime: undefined,
|
|
719
|
+
reserved_status: undefined,
|
|
720
|
+
remainingReserveTime: undefined
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
724
|
+
status: 'reserved',
|
|
725
|
+
isTimeout: false,
|
|
726
|
+
timeoutTime: undefined,
|
|
727
|
+
progressPercent: 0,
|
|
728
|
+
lateTime: undefined,
|
|
729
|
+
reserved_status: 'not_arrived',
|
|
730
|
+
remainingReserveTime: Math.max(startAt.diff(current, 'minute'), 0)
|
|
731
|
+
});
|
|
732
|
+
}
|
|
473
733
|
}, {
|
|
474
734
|
key: "getResourceBookingList",
|
|
475
735
|
value: function () {
|
|
476
|
-
var _getResourceBookingList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
736
|
+
var _getResourceBookingList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(currentTime) {
|
|
477
737
|
var _resourceResponse$dat,
|
|
478
738
|
_resourceResponse$dat2,
|
|
479
|
-
|
|
739
|
+
_this6 = this;
|
|
480
740
|
var bookingList,
|
|
741
|
+
deviceTime,
|
|
481
742
|
current,
|
|
743
|
+
deviceCurrent,
|
|
482
744
|
resourceResponse,
|
|
483
745
|
resourceList,
|
|
484
746
|
normalizedBookings,
|
|
747
|
+
rawBookingMap,
|
|
485
748
|
bookingMap,
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
749
|
+
list,
|
|
750
|
+
_args5 = arguments;
|
|
751
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
752
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
489
753
|
case 0:
|
|
490
|
-
bookingList =
|
|
754
|
+
bookingList = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : [];
|
|
755
|
+
deviceTime = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : currentTime;
|
|
491
756
|
// currentTime 约定为完整 datetime;非法值直接返回空,避免误判
|
|
492
757
|
current = dayjs(currentTime);
|
|
493
758
|
if (current.isValid()) {
|
|
494
|
-
|
|
759
|
+
_context5.next = 5;
|
|
495
760
|
break;
|
|
496
761
|
}
|
|
497
|
-
return
|
|
498
|
-
case
|
|
499
|
-
|
|
762
|
+
return _context5.abrupt("return", []);
|
|
763
|
+
case 5:
|
|
764
|
+
deviceCurrent = dayjs(deviceTime);
|
|
765
|
+
if (deviceCurrent.isValid()) {
|
|
766
|
+
_context5.next = 8;
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
return _context5.abrupt("return", []);
|
|
770
|
+
case 8:
|
|
771
|
+
_context5.next = 10;
|
|
500
772
|
return this.request.get('/shop/form/resource/page', {
|
|
501
773
|
skip: 1,
|
|
502
774
|
num: 999
|
|
@@ -506,59 +778,179 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
506
778
|
osServer: true,
|
|
507
779
|
isShopApi: true
|
|
508
780
|
});
|
|
509
|
-
case
|
|
510
|
-
resourceResponse =
|
|
781
|
+
case 10:
|
|
782
|
+
resourceResponse = _context5.sent;
|
|
511
783
|
resourceList = (_resourceResponse$dat = resourceResponse === null || resourceResponse === void 0 || (_resourceResponse$dat2 = resourceResponse.data) === null || _resourceResponse$dat2 === void 0 ? void 0 : _resourceResponse$dat2.list) !== null && _resourceResponse$dat !== void 0 ? _resourceResponse$dat : [];
|
|
512
784
|
if (!(!Array.isArray(resourceList) || resourceList.length === 0)) {
|
|
513
|
-
|
|
785
|
+
_context5.next = 14;
|
|
514
786
|
break;
|
|
515
787
|
}
|
|
516
|
-
return
|
|
517
|
-
case
|
|
788
|
+
return _context5.abrupt("return", []);
|
|
789
|
+
case 14:
|
|
518
790
|
// 全局先做 booking 标准化 + start_time 升序,后续映射直接复用
|
|
519
|
-
normalizedBookings =
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
var
|
|
525
|
-
var rightStartAt = _this3.toBookingDateTime(right.start_date, right.start_time).valueOf();
|
|
526
|
-
return leftStartAt - rightStartAt;
|
|
527
|
-
}); // 建立 resourceId -> bookings[] 倒排索引,加速资源匹配
|
|
528
|
-
bookingMap = new Map();
|
|
529
|
-
normalizedBookings.forEach(function (booking) {
|
|
530
|
-
if (!Array.isArray(booking.resources)) return;
|
|
531
|
-
booking.resources.forEach(function (resource) {
|
|
532
|
-
var relationId = resource === null || resource === void 0 ? void 0 : resource.relation_id;
|
|
533
|
-
if (relationId === undefined || relationId === null) return;
|
|
534
|
-
var key = String(relationId);
|
|
535
|
-
var list = bookingMap.get(key) || [];
|
|
536
|
-
list.push(booking);
|
|
537
|
-
bookingMap.set(key, list);
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
// 输出:每个资源都返回;bookings 可能是 0 / 1 / 多条(并发场景)
|
|
542
|
-
return _context3.abrupt("return", resourceList.map(function (resource) {
|
|
543
|
-
var resourceId = _this3.getResourceId(resource);
|
|
791
|
+
normalizedBookings = this.normalizeResourceBookings(current, deviceCurrent, bookingList); // 建立 resourceId -> bookings[] 倒排索引,加速资源匹配
|
|
792
|
+
rawBookingMap = this.groupBookingsByResource(bookingList);
|
|
793
|
+
bookingMap = this.groupBookingsByResource(normalizedBookings); // 输出:每个资源都返回;bookings 可能是 0 / 1 / 多条(并发场景)
|
|
794
|
+
list = resourceList.map(function (resource) {
|
|
795
|
+
var resourceId = _this6.getResourceId(resource);
|
|
796
|
+
var rawMatchedBookings = rawBookingMap.get(String(resourceId)) || [];
|
|
544
797
|
var matchedBookings = bookingMap.get(String(resourceId)) || [];
|
|
545
|
-
var
|
|
798
|
+
var statsBookings = rawMatchedBookings.filter(function (booking) {
|
|
799
|
+
return _this6.isBookingIncludedInStats(booking);
|
|
800
|
+
});
|
|
801
|
+
var orderCount = _this6.countBookingOrders(statsBookings);
|
|
802
|
+
var bookingCount = statsBookings.length;
|
|
803
|
+
var compeleteBookingCount = _this6.countCompletedBookings(statsBookings);
|
|
804
|
+
var bookings = _this6.pickBookingsForCurrentPoint(current, matchedBookings);
|
|
546
805
|
return _objectSpread(_objectSpread({}, resource), {}, {
|
|
547
806
|
resource_id: resourceId,
|
|
807
|
+
orderCount: orderCount,
|
|
808
|
+
bookingCount: bookingCount,
|
|
809
|
+
compeleteBookingCount: compeleteBookingCount,
|
|
548
810
|
bookings: bookings
|
|
549
811
|
});
|
|
550
|
-
})
|
|
551
|
-
|
|
812
|
+
});
|
|
813
|
+
this.logger.addLog({
|
|
814
|
+
type: 'info',
|
|
815
|
+
title: 'getResourceBookingList',
|
|
816
|
+
metadata: {
|
|
817
|
+
currentTime: currentTime,
|
|
818
|
+
bookingList: bookingList === null || bookingList === void 0 ? void 0 : bookingList.length,
|
|
819
|
+
deviceTime: deviceTime,
|
|
820
|
+
list: list === null || list === void 0 ? void 0 : list.length
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
return _context5.abrupt("return", list);
|
|
824
|
+
case 20:
|
|
552
825
|
case "end":
|
|
553
|
-
return
|
|
826
|
+
return _context5.stop();
|
|
554
827
|
}
|
|
555
|
-
},
|
|
828
|
+
}, _callee5, this);
|
|
556
829
|
}));
|
|
557
|
-
function getResourceBookingList(
|
|
830
|
+
function getResourceBookingList(_x4) {
|
|
558
831
|
return _getResourceBookingList.apply(this, arguments);
|
|
559
832
|
}
|
|
560
833
|
return getResourceBookingList;
|
|
561
834
|
}()
|
|
835
|
+
}, {
|
|
836
|
+
key: "getResourceBookingItem",
|
|
837
|
+
value: function () {
|
|
838
|
+
var _getResourceBookingItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
839
|
+
var _resourceResponse$dat3,
|
|
840
|
+
_resourceResponse$dat4,
|
|
841
|
+
_this7 = this,
|
|
842
|
+
_params$bookingList;
|
|
843
|
+
var current, deviceCurrent, resourceResponse, resourceList, targetResource, resourceId, matchedBookingList, statsBookingList, completedBookingList, unpaidBookingList, bookings, completedBookings, unpaidBookings, orderCount, bookingCount, compeleteBookingCount;
|
|
844
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
845
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
846
|
+
case 0:
|
|
847
|
+
current = dayjs(params.currentTime);
|
|
848
|
+
if (current.isValid()) {
|
|
849
|
+
_context6.next = 3;
|
|
850
|
+
break;
|
|
851
|
+
}
|
|
852
|
+
return _context6.abrupt("return", null);
|
|
853
|
+
case 3:
|
|
854
|
+
deviceCurrent = dayjs(params.deviceTime || params.currentTime);
|
|
855
|
+
if (deviceCurrent.isValid()) {
|
|
856
|
+
_context6.next = 6;
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
return _context6.abrupt("return", null);
|
|
860
|
+
case 6:
|
|
861
|
+
_context6.next = 8;
|
|
862
|
+
return this.request.get('/shop/form/resource/page', {
|
|
863
|
+
skip: 1,
|
|
864
|
+
num: 999
|
|
865
|
+
},
|
|
866
|
+
// @ts-ignore
|
|
867
|
+
{
|
|
868
|
+
osServer: true,
|
|
869
|
+
isShopApi: true
|
|
870
|
+
});
|
|
871
|
+
case 8:
|
|
872
|
+
resourceResponse = _context6.sent;
|
|
873
|
+
resourceList = (_resourceResponse$dat3 = resourceResponse === null || resourceResponse === void 0 || (_resourceResponse$dat4 = resourceResponse.data) === null || _resourceResponse$dat4 === void 0 ? void 0 : _resourceResponse$dat4.list) !== null && _resourceResponse$dat3 !== void 0 ? _resourceResponse$dat3 : [];
|
|
874
|
+
if (!(!Array.isArray(resourceList) || resourceList.length === 0)) {
|
|
875
|
+
_context6.next = 12;
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
return _context6.abrupt("return", null);
|
|
879
|
+
case 12:
|
|
880
|
+
targetResource = resourceList.find(function (resource) {
|
|
881
|
+
return String(_this7.getResourceId(resource)) === String(params.resourceId);
|
|
882
|
+
});
|
|
883
|
+
if (targetResource) {
|
|
884
|
+
_context6.next = 15;
|
|
885
|
+
break;
|
|
886
|
+
}
|
|
887
|
+
return _context6.abrupt("return", null);
|
|
888
|
+
case 15:
|
|
889
|
+
resourceId = this.getResourceId(targetResource);
|
|
890
|
+
matchedBookingList = params.bookingList.filter(function (booking) {
|
|
891
|
+
return _this7.isBookingMatchedResource(booking, resourceId);
|
|
892
|
+
});
|
|
893
|
+
statsBookingList = matchedBookingList.filter(function (booking) {
|
|
894
|
+
return _this7.isBookingIncludedInStats(booking);
|
|
895
|
+
});
|
|
896
|
+
completedBookingList = matchedBookingList.filter(function (booking) {
|
|
897
|
+
return _this7.getBookingAppointmentStatus(booking) === 'completed';
|
|
898
|
+
});
|
|
899
|
+
unpaidBookingList = matchedBookingList.filter(function (booking) {
|
|
900
|
+
return _this7.getBookingOrderPaymentStatus(booking) === 'unpaid' || _this7.getBookingOrderPaymentStatus(booking) === 'payment_processing';
|
|
901
|
+
});
|
|
902
|
+
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
|
|
903
|
+
completedBookings = completedBookingList.map(function (booking) {
|
|
904
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
905
|
+
status: 'compelete',
|
|
906
|
+
isTimeout: false,
|
|
907
|
+
timeoutTime: undefined,
|
|
908
|
+
progressPercent: 100,
|
|
909
|
+
lateTime: undefined,
|
|
910
|
+
reserved_status: undefined,
|
|
911
|
+
remainingReserveTime: undefined
|
|
912
|
+
});
|
|
913
|
+
});
|
|
914
|
+
unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList));
|
|
915
|
+
orderCount = this.countBookingOrders(statsBookingList);
|
|
916
|
+
bookingCount = statsBookingList.length;
|
|
917
|
+
compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
918
|
+
this.logger.addLog({
|
|
919
|
+
type: 'info',
|
|
920
|
+
title: 'getResourceBookingItem',
|
|
921
|
+
metadata: {
|
|
922
|
+
currentTime: params.currentTime,
|
|
923
|
+
deviceTime: params.deviceTime || params.currentTime,
|
|
924
|
+
resourceId: resourceId,
|
|
925
|
+
bookingList: (_params$bookingList = params.bookingList) === null || _params$bookingList === void 0 ? void 0 : _params$bookingList.length,
|
|
926
|
+
bookings: bookings.length,
|
|
927
|
+
completedBookings: completedBookings.length,
|
|
928
|
+
unpaidBookings: unpaidBookings.length,
|
|
929
|
+
orderCount: orderCount,
|
|
930
|
+
bookingCount: bookingCount,
|
|
931
|
+
compeleteBookingCount: compeleteBookingCount
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
return _context6.abrupt("return", _objectSpread(_objectSpread({}, targetResource), {}, {
|
|
935
|
+
resource_id: resourceId,
|
|
936
|
+
orderCount: orderCount,
|
|
937
|
+
bookingCount: bookingCount,
|
|
938
|
+
compeleteBookingCount: compeleteBookingCount,
|
|
939
|
+
bookings: bookings,
|
|
940
|
+
completedBookings: completedBookings,
|
|
941
|
+
unpaidBookings: unpaidBookings
|
|
942
|
+
}));
|
|
943
|
+
case 28:
|
|
944
|
+
case "end":
|
|
945
|
+
return _context6.stop();
|
|
946
|
+
}
|
|
947
|
+
}, _callee6, this);
|
|
948
|
+
}));
|
|
949
|
+
function getResourceBookingItem(_x5) {
|
|
950
|
+
return _getResourceBookingItem.apply(this, arguments);
|
|
951
|
+
}
|
|
952
|
+
return getResourceBookingItem;
|
|
953
|
+
}()
|
|
562
954
|
}]);
|
|
563
955
|
return SalesImpl;
|
|
564
956
|
}(BaseModule);
|