@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
|
@@ -31,15 +31,20 @@ export interface ScanOrderOrderProductIdentity {
|
|
|
31
31
|
product_id: number | null;
|
|
32
32
|
product_variant_id: number;
|
|
33
33
|
identity_key?: string;
|
|
34
|
+
unique_identification_number?: string;
|
|
34
35
|
/** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
|
|
35
|
-
|
|
36
|
+
product_sku?: ScanOrderProductSku;
|
|
36
37
|
product_bundle?: any[];
|
|
37
38
|
shop_id?: number | string;
|
|
38
39
|
}
|
|
40
|
+
export interface ScanOrderProductSku {
|
|
41
|
+
option: any[];
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}
|
|
39
44
|
export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
40
45
|
order_detail_id: number | null;
|
|
41
46
|
num: number;
|
|
42
|
-
|
|
47
|
+
product_sku: ScanOrderProductSku;
|
|
43
48
|
/**
|
|
44
49
|
* 券后 **行 composite 单价** = `metadata.main_product_selling_price`
|
|
45
50
|
* + Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? 1))
|
|
@@ -61,6 +66,8 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
|
61
66
|
is_charge_tax: number;
|
|
62
67
|
discount_list: any[];
|
|
63
68
|
product_bundle: any[];
|
|
69
|
+
/** 关联 booking.metadata.unique_identification_number */
|
|
70
|
+
booking_uid?: string;
|
|
64
71
|
/**
|
|
65
72
|
* 行级扩展 metadata。价格相关的权威字段:
|
|
66
73
|
*
|
|
@@ -76,19 +83,19 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
|
76
83
|
metadata: Record<string, any>;
|
|
77
84
|
/** 商品行备注(如顾客对单品的特殊要求) */
|
|
78
85
|
note?: string;
|
|
86
|
+
/** @deprecated UI/SDK 运行态数据迁移到 tempOrder._extend */
|
|
79
87
|
_origin?: Record<string, any>;
|
|
80
88
|
}
|
|
81
89
|
/**
|
|
82
90
|
* 出站 payload 版本的商品行。
|
|
83
91
|
*
|
|
84
92
|
* 与 tempOrder 内部 `ScanOrderOrderProduct` 的字段差异:
|
|
85
|
-
* - `
|
|
86
|
-
*
|
|
87
|
-
* (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
|
|
93
|
+
* - `product_sku.option[*]`:内部直接维护统一 Sales 协议字段;
|
|
94
|
+
* 提交时仅规范 `add_price`,保留传入/恢复得到的展示字段。
|
|
88
95
|
* - `product_bundle[*].option[*]`:同上重命名规则。
|
|
89
96
|
*
|
|
90
|
-
* 运行时(UI
|
|
91
|
-
*
|
|
97
|
+
* 运行时(UI 显示、加购合并、指纹、持久化)与提交边界统一消费字段名
|
|
98
|
+
* `option_group_item_id`,保持 tempOrder 与后端协议一致。
|
|
92
99
|
*/
|
|
93
100
|
export interface ScanOrderSubmitProduct extends Omit<ScanOrderOrderProduct, '_origin' | 'identity_key'> {
|
|
94
101
|
/**
|
|
@@ -109,6 +116,7 @@ export interface ScanOrderSummary {
|
|
|
109
116
|
shipping_tax_fee: string;
|
|
110
117
|
tax_fee: string;
|
|
111
118
|
surcharge_fee: string;
|
|
119
|
+
surcharges: any[];
|
|
112
120
|
discount_amount: string;
|
|
113
121
|
deposit_amount: string;
|
|
114
122
|
deposit?: {
|
|
@@ -118,6 +126,9 @@ export interface ScanOrderSummary {
|
|
|
118
126
|
};
|
|
119
127
|
expect_amount: string;
|
|
120
128
|
total_amount: string;
|
|
129
|
+
total_refund_amount: string;
|
|
130
|
+
customer_paid_amount: string;
|
|
131
|
+
order_paid_amount: string;
|
|
121
132
|
amount_gap: string;
|
|
122
133
|
rounding_amount: string;
|
|
123
134
|
pay_service_charge_amount: string;
|
|
@@ -130,11 +141,15 @@ export interface ScanOrderSummary {
|
|
|
130
141
|
*/
|
|
131
142
|
export interface ScanOrderTempOrder {
|
|
132
143
|
order_id: number | null;
|
|
144
|
+
/** @deprecated 资源运行态迁移到 ScanOrder store;仅旧缓存兼容 */
|
|
133
145
|
relation_id?: string;
|
|
146
|
+
/** @deprecated 资源运行态迁移到 ScanOrder store;仅旧缓存兼容 */
|
|
134
147
|
table_form_id?: string;
|
|
148
|
+
/** @deprecated 资源运行态迁移到 ScanOrder store;仅旧缓存兼容 */
|
|
135
149
|
resource_id?: string;
|
|
136
150
|
order_number: string;
|
|
137
151
|
shop_order_number: string;
|
|
152
|
+
shop_full_order_number: string;
|
|
138
153
|
type: string;
|
|
139
154
|
business_code: string;
|
|
140
155
|
platform: string;
|
|
@@ -164,6 +179,7 @@ export interface ScanOrderTempOrder {
|
|
|
164
179
|
table_number?: Record<string, any>;
|
|
165
180
|
schedule_date: string;
|
|
166
181
|
created_at: string;
|
|
182
|
+
request_unique_idempotency_token?: string;
|
|
167
183
|
products: ScanOrderOrderProduct[];
|
|
168
184
|
bookings: any[];
|
|
169
185
|
payments: any[];
|
|
@@ -171,14 +187,20 @@ export interface ScanOrderTempOrder {
|
|
|
171
187
|
discount_list: any[];
|
|
172
188
|
relation_forms: any[];
|
|
173
189
|
contacts: any[];
|
|
174
|
-
contacts_info: any
|
|
190
|
+
contacts_info: Record<string, any> | null;
|
|
175
191
|
holder: Record<string, any> | null;
|
|
176
|
-
summary: ScanOrderSummary;
|
|
177
192
|
metadata: Record<string, any>;
|
|
193
|
+
_extend?: {
|
|
194
|
+
productsByUid?: Record<string, Record<string, any>>;
|
|
195
|
+
[key: string]: any;
|
|
196
|
+
};
|
|
197
|
+
/** @deprecated summary 是 OrderState 派生状态,不属于可提交 tempOrder */
|
|
198
|
+
summary?: ScanOrderSummary;
|
|
199
|
+
/** @deprecated lastOrderInfo 迁移到 OrderState 同层级 */
|
|
178
200
|
lastOrderInfo?: Record<string, any>;
|
|
179
201
|
}
|
|
180
|
-
export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platform' | 'products' | '
|
|
181
|
-
platform:
|
|
202
|
+
export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platform' | 'products' | 'summary' | 'surcharges'> {
|
|
203
|
+
platform: string;
|
|
182
204
|
request_unique_idempotency_token?: string;
|
|
183
205
|
form_record_ids?: Array<{
|
|
184
206
|
form_id: number | string;
|
|
@@ -14,13 +14,12 @@ export var ScanOrderHooks = /*#__PURE__*/function (ScanOrderHooks) {
|
|
|
14
14
|
* 出站 payload 版本的商品行。
|
|
15
15
|
*
|
|
16
16
|
* 与 tempOrder 内部 `ScanOrderOrderProduct` 的字段差异:
|
|
17
|
-
* - `
|
|
18
|
-
*
|
|
19
|
-
* (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
|
|
17
|
+
* - `product_sku.option[*]`:内部直接维护统一 Sales 协议字段;
|
|
18
|
+
* 提交时仅规范 `add_price`,保留传入/恢复得到的展示字段。
|
|
20
19
|
* - `product_bundle[*].option[*]`:同上重命名规则。
|
|
21
20
|
*
|
|
22
|
-
* 运行时(UI
|
|
23
|
-
*
|
|
21
|
+
* 运行时(UI 显示、加购合并、指纹、持久化)与提交边界统一消费字段名
|
|
22
|
+
* `option_group_item_id`,保持 tempOrder 与后端协议一致。
|
|
24
23
|
*/
|
|
25
24
|
|
|
26
25
|
/**
|
|
@@ -2,6 +2,7 @@ import { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderResource
|
|
|
2
2
|
import type { CartItemSummary, ItemRuleBusinessData, PaxInfo, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
3
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
4
4
|
import type { ProductData } from '../../modules/Product/types';
|
|
5
|
+
import type { OrderSubmitProduct } from '../../modules/Order/types';
|
|
5
6
|
/**
|
|
6
7
|
* 构建金额全为 0 的空 summary。
|
|
7
8
|
* 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
|
|
@@ -42,6 +43,8 @@ export declare function toNonNegativeNumber(value: unknown): number;
|
|
|
42
43
|
export declare function toNonNegativeInt(value: unknown): number;
|
|
43
44
|
export declare function toPriceString(value: unknown, fallback?: string): string;
|
|
44
45
|
export declare function buildProductKey(productId: number, productVariantId: number): string;
|
|
46
|
+
/** 加餐接口只提交本次新增商品,过滤掉首单预约占位规则行。 */
|
|
47
|
+
export declare function filterProductsForScanOrderMore<T extends OrderSubmitProduct>(products?: T[]): T[];
|
|
45
48
|
export declare function getTopLevelProductId(product: Record<string, any>): number | null;
|
|
46
49
|
export declare function getTopLevelVariantId(product: Record<string, any>): number | null;
|
|
47
50
|
export declare function buildQuantityLimitIndex(limits: QuantityLimitResult[]): {
|
|
@@ -88,7 +91,7 @@ export declare function attachItemRuleLimitsToTopLevelProducts<T>(productList: T
|
|
|
88
91
|
export declare function buildProductLineFingerprint(productOptionItem?: unknown, productBundle?: unknown): string;
|
|
89
92
|
/**
|
|
90
93
|
* removeProductFromOrder 仅传 SKU 时的通配 identity(对象上未声明选项键)。
|
|
91
|
-
* 与显式 `
|
|
94
|
+
* 与显式 `product_sku: { option: [] }` 区分:后者只匹配「无选项」行。
|
|
92
95
|
*/
|
|
93
96
|
export declare function isSkuOnlyDeleteIdentity(x: ScanOrderOrderProductIdentity): boolean;
|
|
94
97
|
/**
|
|
@@ -13,7 +13,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
15
|
import Decimal from 'decimal.js';
|
|
16
|
-
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
16
|
+
import { composeLinePrice, createUuidV4, ensureProductSku, getBundleSellingMagnitude, getProductSkuOptions, normalizeProductSkuOptions, resolveManualOverrideLineOriginalPrice, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
17
|
+
import { ensureManualProductDiscountList } from "../../modules/Order/utils/manualProductDiscount";
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* 构建金额全为 0 的空 summary。
|
|
@@ -30,10 +31,14 @@ export function createEmptySummary() {
|
|
|
30
31
|
shipping_tax_fee: '0.00',
|
|
31
32
|
tax_fee: '0.00',
|
|
32
33
|
surcharge_fee: '0.00',
|
|
34
|
+
surcharges: [],
|
|
33
35
|
discount_amount: '0.00',
|
|
34
36
|
deposit_amount: '0.00',
|
|
35
37
|
expect_amount: '0.00',
|
|
36
38
|
total_amount: '0.00',
|
|
39
|
+
total_refund_amount: '0.00',
|
|
40
|
+
customer_paid_amount: '0.00',
|
|
41
|
+
order_paid_amount: '0.00',
|
|
37
42
|
amount_gap: '0.00',
|
|
38
43
|
rounding_amount: '0.00',
|
|
39
44
|
pay_service_charge_amount: '0.00'
|
|
@@ -149,6 +154,15 @@ export function toPriceString(value) {
|
|
|
149
154
|
export function buildProductKey(productId, productVariantId) {
|
|
150
155
|
return "".concat(productId, "_").concat(productVariantId);
|
|
151
156
|
}
|
|
157
|
+
|
|
158
|
+
/** 加餐接口只提交本次新增商品,过滤掉首单预约占位规则行。 */
|
|
159
|
+
export function filterProductsForScanOrderMore() {
|
|
160
|
+
var products = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
161
|
+
return products.filter(function (product) {
|
|
162
|
+
var _product$metadata;
|
|
163
|
+
return ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.is_rule) !== true;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
152
166
|
export function getTopLevelProductId(product) {
|
|
153
167
|
var _product$product_id;
|
|
154
168
|
var rawProductId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id;
|
|
@@ -376,16 +390,16 @@ export function attachItemRuleLimitsToTopLevelProducts(productList, limits) {
|
|
|
376
390
|
export function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
377
391
|
var optArr = Array.isArray(productOptionItem) ? productOptionItem : [];
|
|
378
392
|
var normalizedOpts = optArr.map(function (item) {
|
|
379
|
-
var _item$
|
|
393
|
+
var _ref, _item$add_price;
|
|
380
394
|
return {
|
|
381
|
-
|
|
395
|
+
option_group_item_id: Number(item === null || item === void 0 ? void 0 : item.option_group_item_id) || 0,
|
|
382
396
|
option_group_id: Number(item === null || item === void 0 ? void 0 : item.option_group_id) || 0,
|
|
383
397
|
num: typeof (item === null || item === void 0 ? void 0 : item.num) === 'number' && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
384
|
-
price: String((_item$
|
|
398
|
+
price: String((_ref = (_item$add_price = item === null || item === void 0 ? void 0 : item.add_price) !== null && _item$add_price !== void 0 ? _item$add_price : item === null || item === void 0 ? void 0 : item.price) !== null && _ref !== void 0 ? _ref : '')
|
|
385
399
|
};
|
|
386
400
|
}).sort(function (p, q) {
|
|
387
|
-
if (p.
|
|
388
|
-
return p.
|
|
401
|
+
if (p.option_group_item_id !== q.option_group_item_id) {
|
|
402
|
+
return p.option_group_item_id - q.option_group_item_id;
|
|
389
403
|
}
|
|
390
404
|
if (p.option_group_id !== q.option_group_id) return p.option_group_id - q.option_group_id;
|
|
391
405
|
if (p.num !== q.num) return p.num - q.num;
|
|
@@ -393,9 +407,9 @@ export function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
|
393
407
|
});
|
|
394
408
|
var bundleArr = Array.isArray(productBundle) ? productBundle : [];
|
|
395
409
|
var normalizedBundles = bundleArr.map(function (item) {
|
|
396
|
-
var
|
|
410
|
+
var _ref2, _item$bundle_id;
|
|
397
411
|
return {
|
|
398
|
-
bundle_id: Number((
|
|
412
|
+
bundle_id: Number((_ref2 = (_item$bundle_id = item === null || item === void 0 ? void 0 : item.bundle_id) !== null && _item$bundle_id !== void 0 ? _item$bundle_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref2 !== void 0 ? _ref2 : 0) || 0,
|
|
399
413
|
product_id: Number(item === null || item === void 0 ? void 0 : item.product_id) || 0,
|
|
400
414
|
num: typeof (item === null || item === void 0 ? void 0 : item.num) === 'number' && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1
|
|
401
415
|
};
|
|
@@ -409,15 +423,15 @@ export function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
|
409
423
|
|
|
410
424
|
/**
|
|
411
425
|
* removeProductFromOrder 仅传 SKU 时的通配 identity(对象上未声明选项键)。
|
|
412
|
-
* 与显式 `
|
|
426
|
+
* 与显式 `product_sku: { option: [] }` 区分:后者只匹配「无选项」行。
|
|
413
427
|
*/
|
|
414
428
|
export function isSkuOnlyDeleteIdentity(x) {
|
|
415
|
-
if (x.identity_key) return false;
|
|
416
|
-
return !('
|
|
429
|
+
if (x.unique_identification_number || x.identity_key) return false;
|
|
430
|
+
return !('product_sku' in x) && !('product_bundle' in x);
|
|
417
431
|
}
|
|
418
432
|
function fingerprintForIdentityWithOptionKeys(x) {
|
|
419
433
|
var row = x;
|
|
420
|
-
var opts = '
|
|
434
|
+
var opts = 'product_sku' in row ? getProductSkuOptions(row) : [];
|
|
421
435
|
var buds = 'product_bundle' in row ? Array.isArray(row.product_bundle) ? row.product_bundle : [] : [];
|
|
422
436
|
return buildProductLineFingerprint(opts, buds);
|
|
423
437
|
}
|
|
@@ -433,10 +447,13 @@ function fingerprintForIdentityWithOptionKeys(x) {
|
|
|
433
447
|
* 忽略线侧 identity_key,按内容语义匹配。这给「行已 opaque、调用方却想按 SKU 通配 / 选项指纹删除」留兼容入口。
|
|
434
448
|
*/
|
|
435
449
|
export function isIdentityMatch(a, b) {
|
|
450
|
+
var _ref3, _metadata$unique_iden, _metadata2, _ref4, _metadata$unique_iden2, _metadata3;
|
|
436
451
|
if (a.product_id !== b.product_id || a.product_variant_id !== b.product_variant_id) return false;
|
|
437
|
-
var
|
|
438
|
-
var
|
|
439
|
-
|
|
452
|
+
var aUid = (_ref3 = (_metadata$unique_iden = (_metadata2 = a.metadata) === null || _metadata2 === void 0 ? void 0 : _metadata2.unique_identification_number) !== null && _metadata$unique_iden !== void 0 ? _metadata$unique_iden : a.unique_identification_number) !== null && _ref3 !== void 0 ? _ref3 : a.identity_key;
|
|
453
|
+
var bUid = (_ref4 = (_metadata$unique_iden2 = (_metadata3 = b.metadata) === null || _metadata3 === void 0 ? void 0 : _metadata3.unique_identification_number) !== null && _metadata$unique_iden2 !== void 0 ? _metadata$unique_iden2 : b.unique_identification_number) !== null && _ref4 !== void 0 ? _ref4 : b.identity_key;
|
|
454
|
+
var aHasKey = typeof aUid === 'string' && aUid.length > 0;
|
|
455
|
+
var bHasKey = typeof bUid === 'string' && bUid.length > 0;
|
|
456
|
+
if (aHasKey && bHasKey) return aUid === bUid;
|
|
440
457
|
if (isSkuOnlyDeleteIdentity(a) || isSkuOnlyDeleteIdentity(b)) return true;
|
|
441
458
|
return fingerprintForIdentityWithOptionKeys(a) === fingerprintForIdentityWithOptionKeys(b);
|
|
442
459
|
}
|
|
@@ -474,23 +491,67 @@ export function getProductIdentityIndex(products, identity) {
|
|
|
474
491
|
* - 因此多次 normalize 不会重复叠加 option/bundle。
|
|
475
492
|
*/
|
|
476
493
|
export function normalizeOrderProduct(product) {
|
|
477
|
-
var _metadata$origin, _variantList$find, _product$is_charge_ta;
|
|
494
|
+
var _product$metadata2, _metadata$origin, _product$product_sku, _metadata$origin2, _variantList$find, _product$is_charge_ta;
|
|
478
495
|
var metadata = _objectSpread({}, product.metadata || {});
|
|
479
496
|
// 不透明 identity 契约:每条订单行必须带 identity_key。
|
|
480
497
|
// 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
|
|
481
|
-
var resolvedIdentityKey = product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
|
|
482
|
-
|
|
483
|
-
|
|
498
|
+
var resolvedIdentityKey = (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
|
|
499
|
+
metadata.unique_identification_number = resolvedIdentityKey;
|
|
500
|
+
var priceOverride = metadata.price_override;
|
|
501
|
+
var originOtherBundle = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin._extend) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin.other) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.bundle;
|
|
502
|
+
var bundleInput = product.product_bundle || [];
|
|
503
|
+
if (priceOverride !== undefined && priceOverride !== null && priceOverride !== '' && Array.isArray(originOtherBundle) && originOtherBundle.length > 0) {
|
|
504
|
+
var priceById = new Map();
|
|
505
|
+
originOtherBundle.forEach(function (item) {
|
|
506
|
+
var _item$price;
|
|
507
|
+
if ((item === null || item === void 0 ? void 0 : item.id) == null) return;
|
|
508
|
+
var unit = (_item$price = item.price) !== null && _item$price !== void 0 ? _item$price : item.bundle_selling_price;
|
|
509
|
+
if (unit === undefined || unit === null) return;
|
|
510
|
+
priceById.set(String(item.id), String(unit));
|
|
511
|
+
});
|
|
512
|
+
var base = Array.isArray(bundleInput) && bundleInput.length > 0 ? bundleInput : originOtherBundle;
|
|
513
|
+
bundleInput = base.map(function (item) {
|
|
514
|
+
var unit = priceById.get(String(item === null || item === void 0 ? void 0 : item.id));
|
|
515
|
+
if (unit === undefined) return item;
|
|
516
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
517
|
+
price: unit,
|
|
518
|
+
bundle_selling_price: unit
|
|
519
|
+
});
|
|
520
|
+
});
|
|
484
521
|
}
|
|
485
|
-
var normalizedBundle =
|
|
486
|
-
var
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
//
|
|
522
|
+
var normalizedBundle = bundleInput.map(function (item) {
|
|
523
|
+
var _item$price2, _item$bundle_id2, _item$bundle_product_, _item$bundle_group_id, _ref5, _ref6, _item$price3, _ref7, _item$price_type, _ref8, _item$price_type_ext;
|
|
524
|
+
var magnitudeSource = _objectSpread(_objectSpread({}, item), {}, {
|
|
525
|
+
// 计算 markdown 净额时,只把真实毛价交给 helper;若只有 bundle_selling_price,
|
|
526
|
+
// helper 会按历史净额兜底,避免 option 二次扣减。
|
|
527
|
+
price: (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.custom_price
|
|
528
|
+
});
|
|
529
|
+
var normalizedItem = _objectSpread(_objectSpread({}, item), {}, {
|
|
530
|
+
bundle_id: (_item$bundle_id2 = item.bundle_id) !== null && _item$bundle_id2 !== void 0 ? _item$bundle_id2 : item.id,
|
|
531
|
+
bundle_product_id: (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id,
|
|
532
|
+
bundle_group_id: (_item$bundle_group_id = item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item.group_id,
|
|
533
|
+
// price 保留毛价(markdown 仍为 5),由 price_type 决定符号。
|
|
534
|
+
price: (_ref5 = (_ref6 = (_item$price3 = item.price) !== null && _item$price3 !== void 0 ? _item$price3 : item.custom_price) !== null && _ref6 !== void 0 ? _ref6 : item.bundle_selling_price) !== null && _ref5 !== void 0 ? _ref5 : '0.00',
|
|
535
|
+
price_type: (_ref7 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref7 !== void 0 ? _ref7 : '',
|
|
536
|
+
price_type_ext: (_ref8 = (_item$price_type_ext = item.price_type_ext) !== null && _item$price_type_ext !== void 0 ? _item$price_type_ext : item.custom_price_type_ext) !== null && _ref8 !== void 0 ? _ref8 : ''
|
|
490
537
|
});
|
|
538
|
+
// bundle_selling_price 落「正净额」:markdown = |price| − Σoptions;markup/原价维持原值。
|
|
539
|
+
normalizedItem.bundle_selling_price = getBundleSellingMagnitude(magnitudeSource).toFixed(2);
|
|
540
|
+
if (normalizedItem.price_type === 'markdown' && (normalizedItem.price_type_ext === '' || normalizedItem.price_type_ext === undefined || normalizedItem.price_type_ext === null)) {
|
|
541
|
+
var _normalizedItem$custo;
|
|
542
|
+
normalizedItem.custom_price = (_normalizedItem$custo = normalizedItem.custom_price) !== null && _normalizedItem$custo !== void 0 ? _normalizedItem$custo : normalizedItem.price;
|
|
543
|
+
normalizedItem.price = normalizedItem.bundle_selling_price;
|
|
544
|
+
}
|
|
545
|
+
if ((normalizedItem.price_type === 'markdown' || normalizedItem.price_type === 'markup') && (normalizedItem.price_type_ext === '' || normalizedItem.price_type_ext === undefined || normalizedItem.price_type_ext === null)) {
|
|
546
|
+
delete normalizedItem.original_total;
|
|
547
|
+
}
|
|
548
|
+
return normalizedItem;
|
|
491
549
|
});
|
|
492
|
-
var normalizedOptions = product.
|
|
550
|
+
var normalizedOptions = normalizeProductSkuOptions((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option);
|
|
493
551
|
var optionSum = sumOptionUnitPrice(normalizedOptions);
|
|
552
|
+
var productSku = _objectSpread(_objectSpread({}, ensureProductSku(product)), {}, {
|
|
553
|
+
option: normalizedOptions
|
|
554
|
+
});
|
|
494
555
|
|
|
495
556
|
// 1) 解析 source_product_price。
|
|
496
557
|
// 优先级:
|
|
@@ -502,11 +563,11 @@ export function normalizeOrderProduct(product) {
|
|
|
502
563
|
// 6) 入参 selling_price(最末兜底,新添加路径 caller 只给 selling_price)
|
|
503
564
|
var isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === '2';
|
|
504
565
|
var variantId = Number(product.product_variant_id || 0);
|
|
505
|
-
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$
|
|
566
|
+
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$origin2 = metadata.origin) === null || _metadata$origin2 === void 0 ? void 0 : _metadata$origin2.variant : null;
|
|
506
567
|
var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
|
|
507
568
|
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
508
569
|
})) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
|
|
509
|
-
var resolvedSource = function (_product$_origin, _product$_origin2,
|
|
570
|
+
var resolvedSource = function (_product$_origin, _product$_origin2, _ref9, _product$original_pri) {
|
|
510
571
|
if (metadata.source_product_price !== undefined) {
|
|
511
572
|
return String(metadata.source_product_price);
|
|
512
573
|
}
|
|
@@ -524,7 +585,7 @@ export function normalizeOrderProduct(product) {
|
|
|
524
585
|
if (!isV2 && metadata.main_product_original_price !== undefined) {
|
|
525
586
|
return String(metadata.main_product_original_price);
|
|
526
587
|
}
|
|
527
|
-
return (
|
|
588
|
+
return (_ref9 = (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product.selling_price) !== null && _ref9 !== void 0 ? _ref9 : '0.00';
|
|
528
589
|
}();
|
|
529
590
|
|
|
530
591
|
// 2) 派生 main_product_original_price(含 option、不含折扣)
|
|
@@ -572,22 +633,36 @@ export function normalizeOrderProduct(product) {
|
|
|
572
633
|
bundle: normalizedBundle,
|
|
573
634
|
useOriginalBundle: true
|
|
574
635
|
});
|
|
636
|
+
var finalOriginalPrice = resolveManualOverrideLineOriginalPrice({
|
|
637
|
+
num: product.num,
|
|
638
|
+
metadata: metadata,
|
|
639
|
+
lineOriginalPrice: product.original_price
|
|
640
|
+
}, composedOriginalPrice);
|
|
641
|
+
var hasManualProductDiscount = (product.discount_list || []).some(function (item) {
|
|
642
|
+
return (item === null || item === void 0 ? void 0 : item.type) === 'product';
|
|
643
|
+
});
|
|
644
|
+
var manualOriginalPrice = hasManualProductDiscount && product.original_price != null ? String(product.original_price) : finalOriginalPrice;
|
|
645
|
+
var discountList = ensureManualProductDiscountList({
|
|
646
|
+
discountList: product.discount_list,
|
|
647
|
+
metadata: metadata,
|
|
648
|
+
originalPrice: manualOriginalPrice,
|
|
649
|
+
sellingPrice: composedSellingPrice,
|
|
650
|
+
quantity: getSafeProductNum(product.num)
|
|
651
|
+
});
|
|
575
652
|
return {
|
|
576
653
|
order_detail_id: product.order_detail_id || null,
|
|
577
654
|
product_id: product.product_id,
|
|
578
655
|
num: getSafeProductNum(product.num),
|
|
579
656
|
product_variant_id: product.product_variant_id,
|
|
580
|
-
|
|
581
|
-
product_option_item: normalizedOptions,
|
|
657
|
+
product_sku: productSku,
|
|
582
658
|
selling_price: composedSellingPrice,
|
|
583
|
-
original_price:
|
|
659
|
+
original_price: manualOriginalPrice,
|
|
584
660
|
tax_fee: product.tax_fee || '0.00',
|
|
585
661
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
586
|
-
discount_list:
|
|
662
|
+
discount_list: discountList,
|
|
587
663
|
product_bundle: normalizedBundle,
|
|
588
664
|
metadata: metadata,
|
|
589
|
-
note: product.note != null ? String(product.note) : ''
|
|
590
|
-
_origin: product._origin
|
|
665
|
+
note: product.note != null ? String(product.note) : ''
|
|
591
666
|
};
|
|
592
667
|
}
|
|
593
668
|
|
|
@@ -52,12 +52,12 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
52
52
|
productList: [],
|
|
53
53
|
discount: null,
|
|
54
54
|
rules: null,
|
|
55
|
+
holders: [],
|
|
55
56
|
originalDiscountList: [],
|
|
56
57
|
currentBookingTime: "",
|
|
57
58
|
filteredDiscountList: [],
|
|
58
|
-
orderTotalAmount: 0,
|
|
59
|
-
holders: [],
|
|
60
59
|
bookingSubject: undefined,
|
|
60
|
+
orderTotalAmount: 0,
|
|
61
61
|
orderId: undefined
|
|
62
62
|
};
|
|
63
63
|
return _this;
|
|
@@ -76,6 +76,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
76
76
|
this.options = options;
|
|
77
77
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store || {});
|
|
78
78
|
this.hooks = (_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 || (_options$otherParams = _options$otherParams.rules) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.hooks;
|
|
79
|
+
console.log('[ShopDiscount] 初始化完成');
|
|
80
|
+
|
|
79
81
|
// 获取依赖的插件
|
|
80
82
|
this.initializePlugins();
|
|
81
83
|
|
|
@@ -84,7 +86,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
84
86
|
|
|
85
87
|
// 注册事件监听
|
|
86
88
|
this.registerEventListeners();
|
|
87
|
-
case
|
|
89
|
+
case 8:
|
|
88
90
|
case "end":
|
|
89
91
|
return _context.stop();
|
|
90
92
|
}
|
|
@@ -111,6 +113,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
111
113
|
_context2.next = 7;
|
|
112
114
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
113
115
|
case 7:
|
|
116
|
+
console.log('[ShopDiscount] 已销毁');
|
|
117
|
+
case 8:
|
|
114
118
|
case "end":
|
|
115
119
|
return _context2.stop();
|
|
116
120
|
}
|
|
@@ -133,7 +137,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
133
137
|
this.store.customer = null;
|
|
134
138
|
(_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 || _this$store$discount2.clear();
|
|
135
139
|
(_this$store$rules2 = this.store.rules) === null || _this$store$rules2 === void 0 || _this$store$rules2.clear();
|
|
136
|
-
|
|
140
|
+
console.log('[ShopDiscount] clear');
|
|
141
|
+
case 5:
|
|
137
142
|
case "end":
|
|
138
143
|
return _context3.stop();
|
|
139
144
|
}
|
|
@@ -529,7 +534,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
529
534
|
this.setDiscountList(newDiscountList || []);
|
|
530
535
|
this.store.originalDiscountList = newDiscountList || [];
|
|
531
536
|
this.setProductList(newProductList || []);
|
|
532
|
-
if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop')) {
|
|
537
|
+
if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop' && !((resultDiscountList[0].customer_id || 1) === 1))) {
|
|
533
538
|
_context6.next = 25;
|
|
534
539
|
break;
|
|
535
540
|
}
|
|
@@ -628,27 +633,21 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
628
633
|
return n.id === (((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id);
|
|
629
634
|
});
|
|
630
635
|
if (index !== -1) {
|
|
631
|
-
var
|
|
636
|
+
var _discount$metadata;
|
|
632
637
|
editModeDiscountList[index] = _objectSpread(_objectSpread({}, editModeDiscountList[index]), {}, {
|
|
633
|
-
metadata: _objectSpread(_objectSpread({}, discount.metadata || {}), {}, {
|
|
634
|
-
num: ((editModeDiscountList === null || editModeDiscountList === void 0 || (_editModeDiscountList = editModeDiscountList[index]) === null || _editModeDiscountList === void 0 || (_editModeDiscountList = _editModeDiscountList.metadata) === null || _editModeDiscountList === void 0 ? void 0 : _editModeDiscountList.num) || 1) + (((_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.num) || 1)
|
|
635
|
-
}),
|
|
636
638
|
amount: new Decimal(discount.amount || 0).plus(new Decimal(editModeDiscountList[index].amount || 0)).toNumber(),
|
|
637
|
-
savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$
|
|
639
|
+
savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0).plus(new Decimal(editModeDiscountList[index].savedAmount || 0)).toNumber()
|
|
638
640
|
});
|
|
639
641
|
} else {
|
|
640
|
-
var _discount$
|
|
642
|
+
var _discount$metadata2, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
641
643
|
if (discount.type && !discount.tag) {
|
|
642
644
|
discount.tag = discount.type;
|
|
643
645
|
}
|
|
644
646
|
editModeDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
|
|
645
|
-
metadata: _objectSpread(_objectSpread({}, discount.metadata || {}), {}, {
|
|
646
|
-
num: ((_discount$metadata3 = discount.metadata) === null || _discount$metadata3 === void 0 ? void 0 : _discount$metadata3.num) || 1
|
|
647
|
-
}),
|
|
648
647
|
name: discount.name || discount.discount.title.auto,
|
|
649
648
|
isEditMode: true,
|
|
650
649
|
limited_relation_product_data: {},
|
|
651
|
-
savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$
|
|
650
|
+
savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.product_discount_difference) || 0).toNumber(),
|
|
652
651
|
isAvailable: true,
|
|
653
652
|
id: ((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) || discount.id,
|
|
654
653
|
format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
|
|
@@ -795,7 +794,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
795
794
|
key: "loadPrepareConfig",
|
|
796
795
|
value: function () {
|
|
797
796
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
798
|
-
var _this$getCustomer2, _this$store$discount8, _this$getDiscountList, _this$store$discount9, _this$store$productLi2, orderId, customerId,
|
|
797
|
+
var _this$getCustomer2, _this$store$discount8, _this$getDiscountList, _this$store$discount9, _this$store$productLi2, orderId, customerId, prepareConfigResult, goodPassList, scanDiscount, scanDiscountIds, newGoodPassList, newDiscountList, filteredDiscountList, _result3;
|
|
799
798
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
800
799
|
while (1) switch (_context10.prev = _context10.next) {
|
|
801
800
|
case 0:
|
|
@@ -816,15 +815,15 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
816
815
|
order_id: orderId
|
|
817
816
|
} : {}));
|
|
818
817
|
case 5:
|
|
819
|
-
|
|
820
|
-
goodPassList = (
|
|
818
|
+
prepareConfigResult = _context10.sent;
|
|
819
|
+
goodPassList = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.discountList) || [];
|
|
821
820
|
scanDiscount = (_this$getDiscountList = this.getDiscountList()) === null || _this$getDiscountList === void 0 ? void 0 : _this$getDiscountList.filter(function (item) {
|
|
822
821
|
return item.isScan;
|
|
823
822
|
}); // goodPassList 里可能有 scanDiscount 重合的部分,goodPassList 需要剔除
|
|
824
823
|
scanDiscountIds = scanDiscount.map(function (n) {
|
|
825
824
|
return n.id;
|
|
826
825
|
});
|
|
827
|
-
newGoodPassList = goodPassList.filter(function (n) {
|
|
826
|
+
newGoodPassList = goodPassList === null || goodPassList === void 0 ? void 0 : goodPassList.filter(function (n) {
|
|
828
827
|
return !scanDiscountIds.includes(n.id);
|
|
829
828
|
});
|
|
830
829
|
newDiscountList = [].concat(_toConsumableArray(scanDiscount), _toConsumableArray(newGoodPassList || [])); // 存储原始优惠券列表
|
|
@@ -23,15 +23,15 @@ export interface ShopDiscountState {
|
|
|
23
23
|
discount: DiscountModule | null;
|
|
24
24
|
rules: RulesModule | null;
|
|
25
25
|
productList: Record<string, any>[];
|
|
26
|
-
originalDiscountList: Discount[];
|
|
27
|
-
currentBookingTime: string | null;
|
|
28
|
-
filteredDiscountList: Discount[];
|
|
29
|
-
orderTotalAmount?: number;
|
|
30
26
|
holders?: {
|
|
31
27
|
form_record_id: number;
|
|
32
28
|
form_id?: number;
|
|
33
29
|
main_field?: string;
|
|
34
30
|
}[];
|
|
31
|
+
originalDiscountList: Discount[];
|
|
32
|
+
currentBookingTime: string | null;
|
|
33
|
+
filteredDiscountList: Discount[];
|
|
34
|
+
orderTotalAmount?: number;
|
|
35
35
|
bookingSubject?: {
|
|
36
36
|
type?: 'form' | 'customer';
|
|
37
37
|
[key: string]: any;
|
|
@@ -49,5 +49,4 @@ export interface SetDiscountSelectedParams {
|
|
|
49
49
|
type?: 'form' | 'customer';
|
|
50
50
|
[key: string]: any;
|
|
51
51
|
};
|
|
52
|
-
orderId?: number;
|
|
53
52
|
}
|
|
@@ -2,15 +2,6 @@ import { Discount } from "../../modules/Discount/types";
|
|
|
2
2
|
export declare const uniqueById: <T>(arr: T[], key?: string) => T[];
|
|
3
3
|
export declare const isNormalProductByDurationSchedule: (item: any) => boolean;
|
|
4
4
|
export declare const isAllNormalProduct: (items: any[]) => boolean;
|
|
5
|
-
/**
|
|
6
|
-
* 获取折扣金额 基于折扣卡类型计算
|
|
7
|
-
* 商品券:直接返回商品价格
|
|
8
|
-
* 折扣卡:根据折扣卡类型计算 固定金额:直接返回折扣卡金额 百分比:根据折扣卡金额计算
|
|
9
|
-
* @param discount
|
|
10
|
-
* @param total
|
|
11
|
-
* @param price
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
5
|
/**
|
|
15
6
|
* 获取折扣金额 基于折扣卡类型计算
|
|
16
7
|
* 商品券:直接返回商品价格
|
|
@@ -30,15 +30,6 @@ export var isAllNormalProduct = function isAllNormalProduct(items) {
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* 获取折扣金额 基于折扣卡类型计算
|
|
35
|
-
* 商品券:直接返回商品价格
|
|
36
|
-
* 折扣卡:根据折扣卡类型计算 固定金额:直接返回折扣卡金额 百分比:根据折扣卡金额计算
|
|
37
|
-
* @param discount
|
|
38
|
-
* @param total
|
|
39
|
-
* @param price
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
33
|
/**
|
|
43
34
|
* 获取折扣金额 基于折扣卡类型计算
|
|
44
35
|
* 商品券:直接返回商品价格
|