@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
|
@@ -117,19 +117,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
117
117
|
_context.next = 15;
|
|
118
118
|
return this.initializeSubModules(core, options);
|
|
119
119
|
case 15:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
// 预加载支付方式(利用缓存机制)
|
|
121
|
+
// await this.preloadPaymentMethods();
|
|
122
|
+
|
|
123
|
+
// 清理过期的已同步订单数据
|
|
124
|
+
// await this.cleanupExpiredOrdersAsync();
|
|
125
|
+
|
|
126
|
+
console.log('[Checkout] 初始化完成');
|
|
127
|
+
_context.next = 18;
|
|
127
128
|
return this.core.effects.emit("".concat(this.name, ":onCheckoutInitialized"), {
|
|
128
129
|
timestamp: Date.now()
|
|
129
130
|
});
|
|
130
|
-
case
|
|
131
|
+
case 18:
|
|
131
132
|
this.logInfo('CheckoutModule initialized successfully');
|
|
132
|
-
case
|
|
133
|
+
case 19:
|
|
133
134
|
case "end":
|
|
134
135
|
return _context.stop();
|
|
135
136
|
}
|
|
@@ -287,8 +288,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
287
288
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
288
289
|
while (1) switch (_context5.prev = _context5.next) {
|
|
289
290
|
case 0:
|
|
291
|
+
console.log('[Checkout] 收到支付方式加载完成事件:', methods.length);
|
|
290
292
|
_this2.store.paymentMethods = methods;
|
|
291
|
-
case
|
|
293
|
+
case 2:
|
|
292
294
|
case "end":
|
|
293
295
|
return _context5.stop();
|
|
294
296
|
}
|
|
@@ -305,8 +307,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
305
307
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
306
308
|
while (1) switch (_context6.prev = _context6.next) {
|
|
307
309
|
case 0:
|
|
310
|
+
console.log('[Checkout] 收到支付方式变更事件:', {
|
|
311
|
+
oldCount: data.oldMethods.length,
|
|
312
|
+
newCount: data.newMethods.length
|
|
313
|
+
});
|
|
308
314
|
_this2.store.paymentMethods = data.newMethods;
|
|
309
|
-
case
|
|
315
|
+
case 2:
|
|
310
316
|
case "end":
|
|
311
317
|
return _context6.stop();
|
|
312
318
|
}
|
|
@@ -346,20 +352,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
346
352
|
case 5:
|
|
347
353
|
// 保存购物车数据
|
|
348
354
|
this.store.cartItems = params.cartItems;
|
|
349
|
-
|
|
355
|
+
console.log('[Checkout] 结账流程初始化完成');
|
|
356
|
+
_context7.next = 14;
|
|
350
357
|
break;
|
|
351
|
-
case
|
|
352
|
-
_context7.prev =
|
|
358
|
+
case 9:
|
|
359
|
+
_context7.prev = 9;
|
|
353
360
|
_context7.t0 = _context7["catch"](1);
|
|
354
|
-
_context7.next =
|
|
361
|
+
_context7.next = 13;
|
|
355
362
|
return this.handleError(_context7.t0, CheckoutErrorType.UnknownError);
|
|
356
|
-
case 12:
|
|
357
|
-
throw _context7.t0;
|
|
358
363
|
case 13:
|
|
364
|
+
throw _context7.t0;
|
|
365
|
+
case 14:
|
|
359
366
|
case "end":
|
|
360
367
|
return _context7.stop();
|
|
361
368
|
}
|
|
362
|
-
}, _callee7, this, [[1,
|
|
369
|
+
}, _callee7, this, [[1, 9]]);
|
|
363
370
|
}));
|
|
364
371
|
function initializeCheckoutAsync(_x9) {
|
|
365
372
|
return _initializeCheckoutAsync.apply(this, arguments);
|
|
@@ -661,8 +668,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
661
668
|
}; // 只有在有客户信息时才存储
|
|
662
669
|
if (customerInfo.customer_id || customerInfo.customer_name) {
|
|
663
670
|
this.store.currentCustomer = customerInfo;
|
|
671
|
+
console.log('[Checkout] 保存客户信息:', customerInfo);
|
|
664
672
|
} else {
|
|
665
673
|
this.store.currentCustomer = undefined;
|
|
674
|
+
console.log('[Checkout] 未提供客户信息');
|
|
666
675
|
}
|
|
667
676
|
|
|
668
677
|
// 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
|
|
@@ -1088,26 +1097,28 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1088
1097
|
timestamp: Date.now()
|
|
1089
1098
|
});
|
|
1090
1099
|
case 11:
|
|
1100
|
+
console.log('[Checkout] 结账流程完成:', order.id);
|
|
1101
|
+
|
|
1091
1102
|
// 🔧 新增:自动重置 store 状态(同步执行)
|
|
1092
1103
|
this.resetStoreState();
|
|
1093
1104
|
return _context11.abrupt("return", {
|
|
1094
1105
|
success: true,
|
|
1095
1106
|
orderId: String(order.id)
|
|
1096
1107
|
});
|
|
1097
|
-
case
|
|
1098
|
-
_context11.prev =
|
|
1108
|
+
case 16:
|
|
1109
|
+
_context11.prev = 16;
|
|
1099
1110
|
_context11.t0 = _context11["catch"](0);
|
|
1100
|
-
_context11.next =
|
|
1111
|
+
_context11.next = 20;
|
|
1101
1112
|
return this.handleError(_context11.t0, CheckoutErrorType.UnknownError);
|
|
1102
|
-
case
|
|
1113
|
+
case 20:
|
|
1103
1114
|
return _context11.abrupt("return", {
|
|
1104
1115
|
success: false
|
|
1105
1116
|
});
|
|
1106
|
-
case
|
|
1117
|
+
case 21:
|
|
1107
1118
|
case "end":
|
|
1108
1119
|
return _context11.stop();
|
|
1109
1120
|
}
|
|
1110
|
-
}, _callee11, this, [[0,
|
|
1121
|
+
}, _callee11, this, [[0, 16]]);
|
|
1111
1122
|
}));
|
|
1112
1123
|
function completeCheckoutAsync() {
|
|
1113
1124
|
return _completeCheckoutAsync.apply(this, arguments);
|
|
@@ -1139,6 +1150,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1139
1150
|
cartItems = _this$store.cartItems,
|
|
1140
1151
|
localOrderData = _this$store.localOrderData;
|
|
1141
1152
|
if (!_currentOrder) {
|
|
1153
|
+
console.log('[Checkout] 当前没有活跃订单');
|
|
1142
1154
|
return null;
|
|
1143
1155
|
}
|
|
1144
1156
|
|
|
@@ -1184,26 +1196,27 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1184
1196
|
_context12.prev = 0;
|
|
1185
1197
|
_currentOrder2 = this.store.currentOrder;
|
|
1186
1198
|
if (_currentOrder2) {
|
|
1187
|
-
_context12.next =
|
|
1199
|
+
_context12.next = 5;
|
|
1188
1200
|
break;
|
|
1189
1201
|
}
|
|
1202
|
+
console.log('[Checkout] 当前没有活跃订单,无法获取支付项');
|
|
1190
1203
|
return _context12.abrupt("return", []);
|
|
1191
|
-
case
|
|
1192
|
-
_context12.next =
|
|
1204
|
+
case 5:
|
|
1205
|
+
_context12.next = 7;
|
|
1193
1206
|
return this.payment.getPaymentItemsAsync(_currentOrder2.uuid);
|
|
1194
|
-
case
|
|
1207
|
+
case 7:
|
|
1195
1208
|
paymentItems = _context12.sent;
|
|
1196
1209
|
return _context12.abrupt("return", paymentItems);
|
|
1197
|
-
case
|
|
1198
|
-
_context12.prev =
|
|
1210
|
+
case 11:
|
|
1211
|
+
_context12.prev = 11;
|
|
1199
1212
|
_context12.t0 = _context12["catch"](0);
|
|
1200
1213
|
console.error('[Checkout] 获取当前订单支付项失败:', _context12.t0);
|
|
1201
1214
|
return _context12.abrupt("return", []);
|
|
1202
|
-
case
|
|
1215
|
+
case 15:
|
|
1203
1216
|
case "end":
|
|
1204
1217
|
return _context12.stop();
|
|
1205
1218
|
}
|
|
1206
|
-
}, _callee12, this, [[0,
|
|
1219
|
+
}, _callee12, this, [[0, 11]]);
|
|
1207
1220
|
}));
|
|
1208
1221
|
function getCurrentOrderPaymentItemsAsync() {
|
|
1209
1222
|
return _getCurrentOrderPaymentItemsAsync.apply(this, arguments);
|
|
@@ -1260,7 +1273,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1260
1273
|
case 8:
|
|
1261
1274
|
updatedOrder = _context13.sent;
|
|
1262
1275
|
if (!updatedOrder) {
|
|
1263
|
-
_context13.next =
|
|
1276
|
+
_context13.next = 20;
|
|
1264
1277
|
break;
|
|
1265
1278
|
}
|
|
1266
1279
|
// 🔧 重要:Payment.replaceOrderIdByUuidAsync 返回的是 DB 快照(只保证 order_id 变化)
|
|
@@ -1285,27 +1298,32 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1285
1298
|
timestamp: Date.now()
|
|
1286
1299
|
});
|
|
1287
1300
|
case 16:
|
|
1301
|
+
console.log('[Checkout] 本地订单ID替换成功:', {
|
|
1302
|
+
uuid: updatedOrder.uuid,
|
|
1303
|
+
newOrderId: updatedOrder.id
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1288
1306
|
// 标记订单已同步(替换ID意味着订单已在后端创建)
|
|
1289
1307
|
this.store.isOrderSynced = true;
|
|
1290
1308
|
|
|
1291
1309
|
// 订单ID替换后更新 stateAmount
|
|
1292
|
-
_context13.next =
|
|
1310
|
+
_context13.next = 20;
|
|
1293
1311
|
return this.updateStateAmountToRemaining(false);
|
|
1294
|
-
case
|
|
1312
|
+
case 20:
|
|
1295
1313
|
return _context13.abrupt("return", updatedOrder);
|
|
1296
|
-
case
|
|
1297
|
-
_context13.prev =
|
|
1314
|
+
case 23:
|
|
1315
|
+
_context13.prev = 23;
|
|
1298
1316
|
_context13.t0 = _context13["catch"](0);
|
|
1299
1317
|
console.error('[Checkout] 替换订单ID失败:', _context13.t0);
|
|
1300
|
-
_context13.next =
|
|
1318
|
+
_context13.next = 28;
|
|
1301
1319
|
return this.handleError(_context13.t0, CheckoutErrorType.UnknownError);
|
|
1302
|
-
case 27:
|
|
1303
|
-
return _context13.abrupt("return", null);
|
|
1304
1320
|
case 28:
|
|
1321
|
+
return _context13.abrupt("return", null);
|
|
1322
|
+
case 29:
|
|
1305
1323
|
case "end":
|
|
1306
1324
|
return _context13.stop();
|
|
1307
1325
|
}
|
|
1308
|
-
}, _callee13, this, [[0,
|
|
1326
|
+
}, _callee13, this, [[0, 23]]);
|
|
1309
1327
|
}));
|
|
1310
1328
|
function replaceLocalOrderIdAsync(_x13) {
|
|
1311
1329
|
return _replaceLocalOrderIdAsync.apply(this, arguments);
|
|
@@ -1952,11 +1970,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1952
1970
|
newDepositValue = isDeposit;
|
|
1953
1971
|
oldDepositValue = this.store.currentOrder.is_deposit; // 如果状态没有变化,直接返回
|
|
1954
1972
|
if (!(oldDepositValue === newDepositValue)) {
|
|
1955
|
-
_context19.next =
|
|
1973
|
+
_context19.next = 10;
|
|
1956
1974
|
break;
|
|
1957
1975
|
}
|
|
1976
|
+
console.log('[Checkout] 定金状态无变化,跳过更新');
|
|
1958
1977
|
return _context19.abrupt("return");
|
|
1959
|
-
case
|
|
1978
|
+
case 10:
|
|
1960
1979
|
deposit_amount = this.store.currentOrder.deposit_amount || '0.00'; // 如果原来没有 deposit_amount,则默认把待付金额置为 deposit_amount
|
|
1961
1980
|
if (!deposit_amount || Number(deposit_amount) === 0) {
|
|
1962
1981
|
deposit_amount = this.store.currentOrder.expect_amount;
|
|
@@ -1975,9 +1994,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1975
1994
|
// this.logInfo('订单从定金改为全款,清空定金金额');
|
|
1976
1995
|
// }
|
|
1977
1996
|
// 调用 Payment 模块更新订单
|
|
1978
|
-
_context19.next =
|
|
1997
|
+
_context19.next = 15;
|
|
1979
1998
|
return this.payment.updateOrderAsync(this.store.currentOrder.uuid, updateParams);
|
|
1980
|
-
case
|
|
1999
|
+
case 15:
|
|
1981
2000
|
// 更新本地缓存的订单对象
|
|
1982
2001
|
this.store.currentOrder = _objectSpread(_objectSpread({}, this.store.currentOrder), updateParams);
|
|
1983
2002
|
|
|
@@ -1991,31 +2010,31 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1991
2010
|
this.updateStateAmountToRemaining(false);
|
|
1992
2011
|
|
|
1993
2012
|
// 触发订单更新事件
|
|
1994
|
-
_context19.next =
|
|
2013
|
+
_context19.next = 21;
|
|
1995
2014
|
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
1996
2015
|
order: this.store.currentOrder,
|
|
1997
2016
|
timestamp: Date.now()
|
|
1998
2017
|
});
|
|
1999
|
-
case
|
|
2018
|
+
case 21:
|
|
2000
2019
|
this.logInfo('订单定金状态更新成功:', {
|
|
2001
2020
|
isDeposit: newDepositValue,
|
|
2002
2021
|
depositAmount: this.store.currentOrder.deposit_amount
|
|
2003
2022
|
});
|
|
2004
|
-
_context19.next =
|
|
2023
|
+
_context19.next = 30;
|
|
2005
2024
|
break;
|
|
2006
|
-
case
|
|
2007
|
-
_context19.prev =
|
|
2025
|
+
case 24:
|
|
2026
|
+
_context19.prev = 24;
|
|
2008
2027
|
_context19.t0 = _context19["catch"](0);
|
|
2009
2028
|
this.logError('更新订单定金状态失败:', _context19.t0);
|
|
2010
|
-
_context19.next =
|
|
2029
|
+
_context19.next = 29;
|
|
2011
2030
|
return this.handleError(_context19.t0, CheckoutErrorType.ValidationFailed);
|
|
2012
|
-
case 28:
|
|
2013
|
-
throw _context19.t0;
|
|
2014
2031
|
case 29:
|
|
2032
|
+
throw _context19.t0;
|
|
2033
|
+
case 30:
|
|
2015
2034
|
case "end":
|
|
2016
2035
|
return _context19.stop();
|
|
2017
2036
|
}
|
|
2018
|
-
}, _callee19, this, [[0,
|
|
2037
|
+
}, _callee19, this, [[0, 24]]);
|
|
2019
2038
|
}));
|
|
2020
2039
|
function updateOrderDepositStatusAsync(_x19) {
|
|
2021
2040
|
return _updateOrderDepositStatusAsync.apply(this, arguments);
|
|
@@ -2170,6 +2189,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2170
2189
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2171
2190
|
while (1) switch (_context21.prev = _context21.next) {
|
|
2172
2191
|
case 0:
|
|
2192
|
+
console.log('manualSyncOrderAsync called');
|
|
2173
2193
|
this.logInfo('manualSyncOrderAsync called', {
|
|
2174
2194
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
2175
2195
|
currentOrderId: (_this$store$currentOr15 = this.store.currentOrder) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.order_id,
|
|
@@ -2178,16 +2198,16 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2178
2198
|
isOrderSynced: this.store.isOrderSynced,
|
|
2179
2199
|
isVirtualOrderId: this.store.currentOrder ? isVirtualOrderId(this.store.currentOrder.order_id) : false
|
|
2180
2200
|
});
|
|
2181
|
-
_context21.prev =
|
|
2201
|
+
_context21.prev = 2;
|
|
2182
2202
|
if (this.store.currentOrder) {
|
|
2183
|
-
_context21.next =
|
|
2203
|
+
_context21.next = 5;
|
|
2184
2204
|
break;
|
|
2185
2205
|
}
|
|
2186
2206
|
return _context21.abrupt("return", {
|
|
2187
2207
|
success: false,
|
|
2188
2208
|
message: '当前没有活跃订单,无法同步'
|
|
2189
2209
|
});
|
|
2190
|
-
case
|
|
2210
|
+
case 5:
|
|
2191
2211
|
orderUuid = this.store.currentOrder.uuid;
|
|
2192
2212
|
oldOrderId = this.store.currentOrder.order_id; // 检查订单是否已经同步
|
|
2193
2213
|
if (this.store.isOrderSynced) {
|
|
@@ -2197,9 +2217,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2197
2217
|
_context21.t1 = orderUuid;
|
|
2198
2218
|
_context21.t2 = oldOrderId;
|
|
2199
2219
|
_context21.t3 = this.store.currentOrder.total_amount;
|
|
2200
|
-
_context21.next =
|
|
2220
|
+
_context21.next = 14;
|
|
2201
2221
|
return this.calculateRemainingAmountAsync();
|
|
2202
|
-
case
|
|
2222
|
+
case 14:
|
|
2203
2223
|
_context21.t4 = _context21.sent;
|
|
2204
2224
|
_context21.t5 = {
|
|
2205
2225
|
orderUuid: _context21.t1,
|
|
@@ -2208,10 +2228,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2208
2228
|
remainingAmount: _context21.t4
|
|
2209
2229
|
};
|
|
2210
2230
|
_context21.t0.logInfo.call(_context21.t0, '开始手动同步订单到后端:', _context21.t5);
|
|
2211
|
-
|
|
2231
|
+
console.time('manualSyncOrderAsync');
|
|
2232
|
+
|
|
2233
|
+
// 强制同步订单到后端,并获取完整响应数据
|
|
2234
|
+
_context21.next = 20;
|
|
2212
2235
|
return this.syncOrderToBackendWithReturn(true);
|
|
2213
|
-
case
|
|
2236
|
+
case 20:
|
|
2214
2237
|
syncResult = _context21.sent;
|
|
2238
|
+
console.timeEnd('manualSyncOrderAsync');
|
|
2215
2239
|
this.logInfo('手动同步订单完成:', {
|
|
2216
2240
|
orderUuid: orderUuid,
|
|
2217
2241
|
syncResult: syncResult,
|
|
@@ -2232,13 +2256,13 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2232
2256
|
newRes = _objectSpread(_objectSpread({}, syncResult), {}, {
|
|
2233
2257
|
is_deposit: ((_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.is_deposit) || 0
|
|
2234
2258
|
});
|
|
2235
|
-
_context21.next =
|
|
2259
|
+
_context21.next = 30;
|
|
2236
2260
|
return this.updateStateAmountToRemaining(false);
|
|
2237
|
-
case 27:
|
|
2238
|
-
return _context21.abrupt("return", newRes);
|
|
2239
2261
|
case 30:
|
|
2240
|
-
_context21.
|
|
2241
|
-
|
|
2262
|
+
return _context21.abrupt("return", newRes);
|
|
2263
|
+
case 33:
|
|
2264
|
+
_context21.prev = 33;
|
|
2265
|
+
_context21.t6 = _context21["catch"](2);
|
|
2242
2266
|
this.logError('手动同步订单失败:', _context21.t6);
|
|
2243
2267
|
errorMessage = _context21.t6 instanceof Error ? _context21.t6.message : '同步失败';
|
|
2244
2268
|
return _context21.abrupt("return", {
|
|
@@ -2246,11 +2270,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2246
2270
|
message: "\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(errorMessage),
|
|
2247
2271
|
orderUuid: (_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.uuid
|
|
2248
2272
|
});
|
|
2249
|
-
case
|
|
2273
|
+
case 38:
|
|
2250
2274
|
case "end":
|
|
2251
2275
|
return _context21.stop();
|
|
2252
2276
|
}
|
|
2253
|
-
}, _callee21, this, [[
|
|
2277
|
+
}, _callee21, this, [[2, 33]]);
|
|
2254
2278
|
}));
|
|
2255
2279
|
function manualSyncOrderAsync() {
|
|
2256
2280
|
return _manualSyncOrderAsync.apply(this, arguments);
|
|
@@ -2267,6 +2291,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2267
2291
|
key: "getOrderNote",
|
|
2268
2292
|
value: function getOrderNote() {
|
|
2269
2293
|
if (!this.store.localOrderData) {
|
|
2294
|
+
console.log('[Checkout] 没有本地订单数据,无法获取备注');
|
|
2270
2295
|
return '';
|
|
2271
2296
|
}
|
|
2272
2297
|
return this.store.localOrderData.shop_note || '';
|
|
@@ -2296,9 +2321,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2296
2321
|
value: function isCurrentOrderSynced() {
|
|
2297
2322
|
// 如果没有当前订单,返回false
|
|
2298
2323
|
if (!this.store.currentOrder) {
|
|
2324
|
+
console.log('[Checkout] 没有当前订单,同步状态为false');
|
|
2299
2325
|
return false;
|
|
2300
2326
|
}
|
|
2301
2327
|
var syncStatus = this.store.isOrderSynced;
|
|
2328
|
+
console.log('[Checkout] 当前订单同步状态:', {
|
|
2329
|
+
orderUuid: this.store.currentOrder.uuid,
|
|
2330
|
+
orderId: this.store.currentOrder.order_id,
|
|
2331
|
+
isOrderSynced: syncStatus
|
|
2332
|
+
});
|
|
2302
2333
|
return syncStatus;
|
|
2303
2334
|
}
|
|
2304
2335
|
|
|
@@ -2517,7 +2548,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2517
2548
|
key: "updateOrderNoteAsync",
|
|
2518
2549
|
value: (function () {
|
|
2519
2550
|
var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(note) {
|
|
2520
|
-
var _this$store$currentOr23, oldNote, orderInPayment;
|
|
2551
|
+
var _this$store$currentOr23, _this$store$currentOr24, oldNote, orderInPayment;
|
|
2521
2552
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2522
2553
|
while (1) switch (_context24.prev = _context24.next) {
|
|
2523
2554
|
case 0:
|
|
@@ -2528,51 +2559,65 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2528
2559
|
}
|
|
2529
2560
|
throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有本地订单数据,无法更新备注');
|
|
2530
2561
|
case 3:
|
|
2562
|
+
console.log('[Checkout] 更新订单备注:', {
|
|
2563
|
+
orderUuid: (_this$store$currentOr23 = this.store.currentOrder) === null || _this$store$currentOr23 === void 0 ? void 0 : _this$store$currentOr23.uuid,
|
|
2564
|
+
oldNote: this.store.localOrderData.shop_note,
|
|
2565
|
+
newNote: note
|
|
2566
|
+
});
|
|
2567
|
+
|
|
2531
2568
|
// 更新备注
|
|
2532
2569
|
oldNote = this.store.localOrderData.shop_note;
|
|
2533
2570
|
this.store.localOrderData.shop_note = note;
|
|
2534
2571
|
|
|
2535
2572
|
// 如果有当前订单,也同步到Payment模块中的订单数据
|
|
2536
2573
|
if (!this.store.currentOrder) {
|
|
2537
|
-
_context24.next =
|
|
2574
|
+
_context24.next = 17;
|
|
2538
2575
|
break;
|
|
2539
2576
|
}
|
|
2540
|
-
_context24.prev =
|
|
2541
|
-
_context24.next =
|
|
2577
|
+
_context24.prev = 7;
|
|
2578
|
+
_context24.next = 10;
|
|
2542
2579
|
return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
|
|
2543
|
-
case
|
|
2580
|
+
case 10:
|
|
2544
2581
|
orderInPayment = _context24.sent;
|
|
2545
|
-
if (orderInPayment && orderInPayment.note !== undefined) {
|
|
2546
|
-
|
|
2582
|
+
if (orderInPayment && orderInPayment.note !== undefined) {
|
|
2583
|
+
// 使用Payment模块的更新方法(如果有的话)
|
|
2584
|
+
// 这里可能需要根据Payment模块的实际API来调整
|
|
2585
|
+
console.log('[Checkout] 同步备注到Payment模块的订单数据中');
|
|
2586
|
+
}
|
|
2587
|
+
_context24.next = 17;
|
|
2547
2588
|
break;
|
|
2548
|
-
case
|
|
2549
|
-
_context24.prev =
|
|
2550
|
-
_context24.t0 = _context24["catch"](
|
|
2589
|
+
case 14:
|
|
2590
|
+
_context24.prev = 14;
|
|
2591
|
+
_context24.t0 = _context24["catch"](7);
|
|
2551
2592
|
console.warn('[Checkout] 同步备注到Payment模块失败,但本地更新成功:', _context24.t0);
|
|
2552
|
-
case
|
|
2553
|
-
_context24.next =
|
|
2593
|
+
case 17:
|
|
2594
|
+
_context24.next = 19;
|
|
2554
2595
|
return this.core.effects.emit("".concat(this.name, ":onOrderNoteChanged"), {
|
|
2555
|
-
orderUuid: (_this$store$
|
|
2596
|
+
orderUuid: (_this$store$currentOr24 = this.store.currentOrder) === null || _this$store$currentOr24 === void 0 ? void 0 : _this$store$currentOr24.uuid,
|
|
2556
2597
|
oldNote: oldNote,
|
|
2557
2598
|
newNote: note,
|
|
2558
2599
|
timestamp: Date.now()
|
|
2559
2600
|
});
|
|
2560
|
-
case
|
|
2561
|
-
|
|
2601
|
+
case 19:
|
|
2602
|
+
console.log('[Checkout] 订单备注更新成功:', {
|
|
2603
|
+
oldNote: oldNote,
|
|
2604
|
+
newNote: note
|
|
2605
|
+
});
|
|
2606
|
+
_context24.next = 28;
|
|
2562
2607
|
break;
|
|
2563
|
-
case
|
|
2564
|
-
_context24.prev =
|
|
2608
|
+
case 22:
|
|
2609
|
+
_context24.prev = 22;
|
|
2565
2610
|
_context24.t1 = _context24["catch"](0);
|
|
2566
2611
|
console.error('[Checkout] 更新订单备注失败:', _context24.t1);
|
|
2567
|
-
_context24.next =
|
|
2612
|
+
_context24.next = 27;
|
|
2568
2613
|
return this.handleError(_context24.t1, CheckoutErrorType.ValidationFailed);
|
|
2569
|
-
case
|
|
2614
|
+
case 27:
|
|
2570
2615
|
throw _context24.t1;
|
|
2571
|
-
case
|
|
2616
|
+
case 28:
|
|
2572
2617
|
case "end":
|
|
2573
2618
|
return _context24.stop();
|
|
2574
2619
|
}
|
|
2575
|
-
}, _callee24, this, [[0,
|
|
2620
|
+
}, _callee24, this, [[0, 22], [7, 14]]);
|
|
2576
2621
|
}));
|
|
2577
2622
|
function updateOrderNoteAsync(_x22) {
|
|
2578
2623
|
return _updateOrderNoteAsync.apply(this, arguments);
|
|
@@ -2620,7 +2665,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2620
2665
|
key: "handlePaymentSuccess",
|
|
2621
2666
|
value: (function () {
|
|
2622
2667
|
var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(data) {
|
|
2623
|
-
var _this$store$
|
|
2668
|
+
var _this$store$currentOr25;
|
|
2624
2669
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2625
2670
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2626
2671
|
case 0:
|
|
@@ -2631,7 +2676,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2631
2676
|
return this.core.effects.emit("".concat(this.name, ":onPaymentSuccess"), {
|
|
2632
2677
|
orderUuid: data.orderUuid,
|
|
2633
2678
|
paymentMethodCode: '',
|
|
2634
|
-
amount: ((_this$store$
|
|
2679
|
+
amount: ((_this$store$currentOr25 = this.store.currentOrder) === null || _this$store$currentOr25 === void 0 ? void 0 : _this$store$currentOr25.total_amount) || '0',
|
|
2635
2680
|
timestamp: data.timestamp
|
|
2636
2681
|
});
|
|
2637
2682
|
case 4:
|
|
@@ -2656,7 +2701,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2656
2701
|
key: "handlePaymentError",
|
|
2657
2702
|
value: (function () {
|
|
2658
2703
|
var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data) {
|
|
2659
|
-
var _this$store$
|
|
2704
|
+
var _this$store$currentOr26;
|
|
2660
2705
|
var error;
|
|
2661
2706
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2662
2707
|
while (1) switch (_context27.prev = _context27.next) {
|
|
@@ -2669,7 +2714,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2669
2714
|
return this.core.effects.emit("".concat(this.name, ":onPaymentFailed"), {
|
|
2670
2715
|
orderUuid: data.orderUuid,
|
|
2671
2716
|
paymentMethodCode: '',
|
|
2672
|
-
amount: ((_this$store$
|
|
2717
|
+
amount: ((_this$store$currentOr26 = this.store.currentOrder) === null || _this$store$currentOr26 === void 0 ? void 0 : _this$store$currentOr26.total_amount) || '0',
|
|
2673
2718
|
timestamp: data.timestamp
|
|
2674
2719
|
});
|
|
2675
2720
|
case 5:
|
|
@@ -2703,7 +2748,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2703
2748
|
key: "processCashPaymentItem",
|
|
2704
2749
|
value: (function () {
|
|
2705
2750
|
var _processCashPaymentItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(paymentItem) {
|
|
2706
|
-
var cashPayment, remainingAmountStr, remainingAmount, cashAmount, changeAmount, processedPaymentItem;
|
|
2751
|
+
var cashPayment, remainingAmountStr, remainingAmount, cashAmount, roundingAmount, chargeAmount, changeAmount, processedPaymentItem;
|
|
2707
2752
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2708
2753
|
while (1) switch (_context28.prev = _context28.next) {
|
|
2709
2754
|
case 0:
|
|
@@ -2721,41 +2766,35 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2721
2766
|
case 6:
|
|
2722
2767
|
remainingAmountStr = _context28.sent;
|
|
2723
2768
|
remainingAmount = new Decimal(remainingAmountStr);
|
|
2724
|
-
cashAmount = new Decimal(String(paymentItem.amount));
|
|
2769
|
+
cashAmount = new Decimal(String(paymentItem.amount));
|
|
2770
|
+
roundingAmount = new Decimal(String(paymentItem.rounding_amount || '0')); // 如果现金金额小于等于剩余待付金额,无需找零
|
|
2725
2771
|
if (!cashAmount.lte(remainingAmount)) {
|
|
2726
|
-
_context28.next =
|
|
2772
|
+
_context28.next = 12;
|
|
2727
2773
|
break;
|
|
2728
2774
|
}
|
|
2729
2775
|
return _context28.abrupt("return", paymentItem);
|
|
2730
|
-
case
|
|
2731
|
-
//
|
|
2732
|
-
|
|
2733
|
-
if (!(
|
|
2734
|
-
_context28.next =
|
|
2735
|
-
break;
|
|
2736
|
-
}
|
|
2737
|
-
if (!(Number(paymentItem.rounding_amount) === changeAmount.toNumber())) {
|
|
2738
|
-
_context28.next = 17;
|
|
2776
|
+
case 12:
|
|
2777
|
+
// 超付场景使用 rounding 回算应收金额(兼容 UI 已做抹零 + 允许超付)
|
|
2778
|
+
chargeAmount = Decimal.max(remainingAmount.add(roundingAmount), new Decimal(0));
|
|
2779
|
+
if (!cashAmount.lte(chargeAmount)) {
|
|
2780
|
+
_context28.next = 15;
|
|
2739
2781
|
break;
|
|
2740
2782
|
}
|
|
2741
2783
|
return _context28.abrupt("return", paymentItem);
|
|
2742
|
-
case
|
|
2743
|
-
//
|
|
2744
|
-
remainingAmount = remainingAmount.add(new Decimal(paymentItem.rounding_amount || '0'));
|
|
2745
|
-
case 18:
|
|
2746
|
-
// 创建包含找零信息的支付项
|
|
2784
|
+
case 15:
|
|
2785
|
+
changeAmount = cashAmount.sub(chargeAmount); // 创建包含找零信息的支付项
|
|
2747
2786
|
processedPaymentItem = _objectSpread(_objectSpread({}, paymentItem), {}, {
|
|
2748
|
-
amount:
|
|
2749
|
-
// 将 amount 设置为剩余待付金额,保留2位小数
|
|
2787
|
+
amount: chargeAmount.toFixed(2),
|
|
2750
2788
|
metadata: _objectSpread(_objectSpread({}, paymentItem.metadata), {}, {
|
|
2751
2789
|
actual_paid_amount: cashAmount.toNumber(),
|
|
2752
|
-
|
|
2753
|
-
change_given_amount: changeAmount.toNumber() // 找零金额
|
|
2790
|
+
change_given_amount: changeAmount.toNumber()
|
|
2754
2791
|
})
|
|
2755
2792
|
});
|
|
2756
2793
|
this.logInfo('Cash payment with change processed', {
|
|
2757
2794
|
originalAmount: cashAmount.toFixed(2),
|
|
2758
|
-
|
|
2795
|
+
remainingAmount: remainingAmount.toFixed(2),
|
|
2796
|
+
roundingAmount: roundingAmount.toFixed(2),
|
|
2797
|
+
chargedAmount: chargeAmount.toFixed(2),
|
|
2759
2798
|
changeAmount: changeAmount.toFixed(2),
|
|
2760
2799
|
paymentCode: paymentItem.code,
|
|
2761
2800
|
paymentType: paymentItem.type,
|
|
@@ -2763,21 +2802,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2763
2802
|
decimalPrecisionCheck: {
|
|
2764
2803
|
cashAmountPrecise: cashAmount.toString(),
|
|
2765
2804
|
remainingAmountPrecise: remainingAmount.toString(),
|
|
2805
|
+
roundingAmountPrecise: roundingAmount.toString(),
|
|
2806
|
+
chargeAmountPrecise: chargeAmount.toString(),
|
|
2766
2807
|
changeAmountPrecise: changeAmount.toString()
|
|
2767
2808
|
}
|
|
2768
2809
|
});
|
|
2769
2810
|
return _context28.abrupt("return", processedPaymentItem);
|
|
2770
|
-
case
|
|
2771
|
-
_context28.prev =
|
|
2811
|
+
case 21:
|
|
2812
|
+
_context28.prev = 21;
|
|
2772
2813
|
_context28.t0 = _context28["catch"](3);
|
|
2773
2814
|
this.logError('处理现金支付项时出错:', _context28.t0);
|
|
2774
2815
|
// 出错时返回原始支付项,避免中断支付流程
|
|
2775
2816
|
return _context28.abrupt("return", paymentItem);
|
|
2776
|
-
case
|
|
2817
|
+
case 25:
|
|
2777
2818
|
case "end":
|
|
2778
2819
|
return _context28.stop();
|
|
2779
2820
|
}
|
|
2780
|
-
}, _callee28, this, [[3,
|
|
2821
|
+
}, _callee28, this, [[3, 21]]);
|
|
2781
2822
|
}));
|
|
2782
2823
|
function processCashPaymentItem(_x27) {
|
|
2783
2824
|
return _processCashPaymentItem.apply(this, arguments);
|
|
@@ -2797,23 +2838,25 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2797
2838
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2798
2839
|
case 0:
|
|
2799
2840
|
_context29.prev = 0;
|
|
2800
|
-
|
|
2841
|
+
console.log('[Checkout] 预加载支付方式...');
|
|
2842
|
+
_context29.next = 4;
|
|
2801
2843
|
return this.payment.getPayMethodListAsync();
|
|
2802
|
-
case
|
|
2844
|
+
case 4:
|
|
2803
2845
|
methods = _context29.sent;
|
|
2804
2846
|
this.store.paymentMethods = methods;
|
|
2805
|
-
|
|
2847
|
+
console.log("[Checkout] \u9884\u52A0\u8F7D\u5B8C\u6210\uFF0C\u5171 ".concat(methods.length, " \u79CD\u652F\u4ED8\u65B9\u5F0F"));
|
|
2848
|
+
_context29.next = 13;
|
|
2806
2849
|
break;
|
|
2807
|
-
case
|
|
2808
|
-
_context29.prev =
|
|
2850
|
+
case 9:
|
|
2851
|
+
_context29.prev = 9;
|
|
2809
2852
|
_context29.t0 = _context29["catch"](0);
|
|
2810
2853
|
console.error('[Checkout] 预加载支付方式失败:', _context29.t0);
|
|
2811
2854
|
this.store.paymentMethods = [];
|
|
2812
|
-
case
|
|
2855
|
+
case 13:
|
|
2813
2856
|
case "end":
|
|
2814
2857
|
return _context29.stop();
|
|
2815
2858
|
}
|
|
2816
|
-
}, _callee29, this, [[0,
|
|
2859
|
+
}, _callee29, this, [[0, 9]]);
|
|
2817
2860
|
}));
|
|
2818
2861
|
function preloadPaymentMethods() {
|
|
2819
2862
|
return _preloadPaymentMethods.apply(this, arguments);
|
|
@@ -2825,6 +2868,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2825
2868
|
*
|
|
2826
2869
|
* 删除本地 IndexDB 中超过指定天数且已同步到后端的订单数据
|
|
2827
2870
|
*/
|
|
2871
|
+
/** @deprecated */
|
|
2828
2872
|
)
|
|
2829
2873
|
}, {
|
|
2830
2874
|
key: "cleanupExpiredOrdersAsync",
|
|
@@ -2841,43 +2885,48 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2841
2885
|
retentionDays = cleanupConfig.retentionDays || 7; // 默认保留7天
|
|
2842
2886
|
maxOrdersToDelete = cleanupConfig.maxOrdersToDelete || 100; // 默认最多删除100个订单
|
|
2843
2887
|
if (isCleanupEnabled) {
|
|
2844
|
-
_context30.next =
|
|
2888
|
+
_context30.next = 8;
|
|
2845
2889
|
break;
|
|
2846
2890
|
}
|
|
2891
|
+
console.log('[Checkout] 订单数据清理功能已禁用');
|
|
2847
2892
|
return _context30.abrupt("return");
|
|
2848
|
-
case
|
|
2849
|
-
|
|
2893
|
+
case 8:
|
|
2894
|
+
console.log("[Checkout] \u5F00\u59CB\u6E05\u7406\u8FC7\u671F\u8BA2\u5355\u6570\u636E\uFF08\u4FDD\u7559 ".concat(retentionDays, " \u5929\u5185\u7684\u6570\u636E\uFF09..."));
|
|
2895
|
+
|
|
2896
|
+
// 获取所有订单
|
|
2897
|
+
_context30.next = 11;
|
|
2850
2898
|
return this.payment.getOrderListAsync();
|
|
2851
|
-
case
|
|
2899
|
+
case 11:
|
|
2852
2900
|
allOrders = _context30.sent;
|
|
2853
2901
|
if (!(!allOrders || allOrders.length === 0)) {
|
|
2854
|
-
_context30.next =
|
|
2902
|
+
_context30.next = 15;
|
|
2855
2903
|
break;
|
|
2856
2904
|
}
|
|
2905
|
+
console.log('[Checkout] 没有找到需要清理的订单数据');
|
|
2857
2906
|
return _context30.abrupt("return");
|
|
2858
|
-
case
|
|
2907
|
+
case 15:
|
|
2859
2908
|
thresholdDate = new Date();
|
|
2860
2909
|
thresholdDate.setDate(thresholdDate.getDate() - retentionDays);
|
|
2861
2910
|
deletedCount = 0;
|
|
2862
2911
|
ordersToDelete = [];
|
|
2863
2912
|
_iterator = _createForOfIteratorHelper(allOrders);
|
|
2864
|
-
_context30.prev =
|
|
2913
|
+
_context30.prev = 20;
|
|
2865
2914
|
_iterator.s();
|
|
2866
|
-
case
|
|
2915
|
+
case 22:
|
|
2867
2916
|
if ((_step = _iterator.n()).done) {
|
|
2868
|
-
_context30.next =
|
|
2917
|
+
_context30.next = 41;
|
|
2869
2918
|
break;
|
|
2870
2919
|
}
|
|
2871
2920
|
order = _step.value;
|
|
2872
|
-
_context30.prev =
|
|
2921
|
+
_context30.prev = 24;
|
|
2873
2922
|
// 检查订单是否已同步(订单ID不是虚拟ID)
|
|
2874
2923
|
isSynced = order.order_id && !isVirtualOrderId(order.order_id);
|
|
2875
2924
|
if (isSynced) {
|
|
2876
|
-
_context30.next =
|
|
2925
|
+
_context30.next = 28;
|
|
2877
2926
|
break;
|
|
2878
2927
|
}
|
|
2879
|
-
return _context30.abrupt("continue",
|
|
2880
|
-
case
|
|
2928
|
+
return _context30.abrupt("continue", 39);
|
|
2929
|
+
case 28:
|
|
2881
2930
|
// 检查创建时间
|
|
2882
2931
|
orderCreatedAt = null; // 尝试从 order_info.created_at 获取创建时间
|
|
2883
2932
|
if ((_order$order_info = order.order_info) !== null && _order$order_info !== void 0 && _order$order_info.created_at) {
|
|
@@ -2890,11 +2939,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2890
2939
|
|
|
2891
2940
|
// 如果无法获取创建时间,跳过此订单
|
|
2892
2941
|
if (!(!orderCreatedAt || isNaN(orderCreatedAt.getTime()))) {
|
|
2893
|
-
_context30.next =
|
|
2942
|
+
_context30.next = 32;
|
|
2894
2943
|
break;
|
|
2895
2944
|
}
|
|
2896
|
-
return _context30.abrupt("continue",
|
|
2897
|
-
case
|
|
2945
|
+
return _context30.abrupt("continue", 39);
|
|
2946
|
+
case 32:
|
|
2898
2947
|
// 检查是否超过指定天数
|
|
2899
2948
|
if (orderCreatedAt < thresholdDate) {
|
|
2900
2949
|
ordersToDelete.push({
|
|
@@ -2904,68 +2953,69 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2904
2953
|
daysSinceCreated: Math.floor((Date.now() - orderCreatedAt.getTime()) / (1000 * 60 * 60 * 24))
|
|
2905
2954
|
});
|
|
2906
2955
|
}
|
|
2907
|
-
_context30.next =
|
|
2956
|
+
_context30.next = 39;
|
|
2908
2957
|
break;
|
|
2909
|
-
case
|
|
2910
|
-
_context30.prev =
|
|
2911
|
-
_context30.t0 = _context30["catch"](
|
|
2958
|
+
case 35:
|
|
2959
|
+
_context30.prev = 35;
|
|
2960
|
+
_context30.t0 = _context30["catch"](24);
|
|
2912
2961
|
console.warn("[Checkout] \u5904\u7406\u8BA2\u5355 ".concat(order.uuid, " \u65F6\u51FA\u9519:"), _context30.t0);
|
|
2913
|
-
return _context30.abrupt("continue",
|
|
2914
|
-
case
|
|
2915
|
-
_context30.next =
|
|
2962
|
+
return _context30.abrupt("continue", 39);
|
|
2963
|
+
case 39:
|
|
2964
|
+
_context30.next = 22;
|
|
2916
2965
|
break;
|
|
2917
|
-
case
|
|
2918
|
-
_context30.next =
|
|
2966
|
+
case 41:
|
|
2967
|
+
_context30.next = 46;
|
|
2919
2968
|
break;
|
|
2920
|
-
case 40:
|
|
2921
|
-
_context30.prev = 40;
|
|
2922
|
-
_context30.t1 = _context30["catch"](17);
|
|
2923
|
-
_iterator.e(_context30.t1);
|
|
2924
2969
|
case 43:
|
|
2925
2970
|
_context30.prev = 43;
|
|
2926
|
-
|
|
2927
|
-
|
|
2971
|
+
_context30.t1 = _context30["catch"](20);
|
|
2972
|
+
_iterator.e(_context30.t1);
|
|
2928
2973
|
case 46:
|
|
2974
|
+
_context30.prev = 46;
|
|
2975
|
+
_iterator.f();
|
|
2976
|
+
return _context30.finish(46);
|
|
2977
|
+
case 49:
|
|
2929
2978
|
// 按创建时间排序(最老的先删除)并限制删除数量
|
|
2930
2979
|
ordersToDelete.sort(function (a, b) {
|
|
2931
2980
|
return new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime();
|
|
2932
2981
|
});
|
|
2933
2982
|
actualOrdersToDelete = ordersToDelete.slice(0, maxOrdersToDelete); // 删除符合条件的订单
|
|
2934
2983
|
_iterator2 = _createForOfIteratorHelper(actualOrdersToDelete);
|
|
2935
|
-
_context30.prev =
|
|
2984
|
+
_context30.prev = 52;
|
|
2936
2985
|
_iterator2.s();
|
|
2937
|
-
case
|
|
2986
|
+
case 54:
|
|
2938
2987
|
if ((_step2 = _iterator2.n()).done) {
|
|
2939
|
-
_context30.next =
|
|
2988
|
+
_context30.next = 68;
|
|
2940
2989
|
break;
|
|
2941
2990
|
}
|
|
2942
2991
|
orderInfo = _step2.value;
|
|
2943
|
-
_context30.prev =
|
|
2944
|
-
_context30.next =
|
|
2992
|
+
_context30.prev = 56;
|
|
2993
|
+
_context30.next = 59;
|
|
2945
2994
|
return this.payment.deletePaymentOrderAsync(orderInfo.uuid);
|
|
2946
|
-
case
|
|
2995
|
+
case 59:
|
|
2947
2996
|
deletedCount++;
|
|
2948
|
-
|
|
2997
|
+
console.log("[Checkout] \u5DF2\u5220\u9664\u8FC7\u671F\u8BA2\u5355: ".concat(orderInfo.orderId, " (").concat(orderInfo.daysSinceCreated, " \u5929\u524D\u521B\u5EFA)"));
|
|
2998
|
+
_context30.next = 66;
|
|
2949
2999
|
break;
|
|
2950
|
-
case
|
|
2951
|
-
_context30.prev =
|
|
2952
|
-
_context30.t2 = _context30["catch"](
|
|
3000
|
+
case 63:
|
|
3001
|
+
_context30.prev = 63;
|
|
3002
|
+
_context30.t2 = _context30["catch"](56);
|
|
2953
3003
|
console.error("[Checkout] \u5220\u9664\u8BA2\u5355 ".concat(orderInfo.uuid, " \u5931\u8D25:"), _context30.t2);
|
|
2954
|
-
case
|
|
2955
|
-
_context30.next =
|
|
3004
|
+
case 66:
|
|
3005
|
+
_context30.next = 54;
|
|
2956
3006
|
break;
|
|
2957
|
-
case
|
|
2958
|
-
_context30.next =
|
|
3007
|
+
case 68:
|
|
3008
|
+
_context30.next = 73;
|
|
2959
3009
|
break;
|
|
2960
|
-
case
|
|
2961
|
-
_context30.prev =
|
|
2962
|
-
_context30.t3 = _context30["catch"](
|
|
3010
|
+
case 70:
|
|
3011
|
+
_context30.prev = 70;
|
|
3012
|
+
_context30.t3 = _context30["catch"](52);
|
|
2963
3013
|
_iterator2.e(_context30.t3);
|
|
2964
|
-
case
|
|
2965
|
-
_context30.prev =
|
|
3014
|
+
case 73:
|
|
3015
|
+
_context30.prev = 73;
|
|
2966
3016
|
_iterator2.f();
|
|
2967
|
-
return _context30.finish(
|
|
2968
|
-
case
|
|
3017
|
+
return _context30.finish(73);
|
|
3018
|
+
case 76:
|
|
2969
3019
|
summary = {
|
|
2970
3020
|
totalOrders: allOrders.length,
|
|
2971
3021
|
expiredSyncedOrders: ordersToDelete.length,
|
|
@@ -2977,22 +3027,26 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2977
3027
|
skippedOrders: Math.max(0, ordersToDelete.length - maxOrdersToDelete)
|
|
2978
3028
|
}; // 记录清理结果
|
|
2979
3029
|
this.logInfo('Expired orders cleanup completed', summary);
|
|
2980
|
-
if (ordersToDelete.length > maxOrdersToDelete) {
|
|
2981
|
-
|
|
3030
|
+
if (ordersToDelete.length > maxOrdersToDelete) {
|
|
3031
|
+
console.log("[Checkout] \u8FC7\u671F\u8BA2\u5355\u6E05\u7406\u5B8C\u6210: \u603B\u8BA1 ".concat(allOrders.length, " \u4E2A\u8BA2\u5355\uFF0C\u53D1\u73B0 ").concat(ordersToDelete.length, " \u4E2A\u8FC7\u671F\u5DF2\u540C\u6B65\u8BA2\u5355\uFF0C\u5220\u9664\u4E86 ").concat(deletedCount, " \u4E2A\uFF08\u9650\u5236\u4E3A ").concat(maxOrdersToDelete, " \u4E2A\uFF09"));
|
|
3032
|
+
} else {
|
|
3033
|
+
console.log("[Checkout] \u8FC7\u671F\u8BA2\u5355\u6E05\u7406\u5B8C\u6210: \u603B\u8BA1 ".concat(allOrders.length, " \u4E2A\u8BA2\u5355\uFF0C\u5220\u9664\u4E86 ").concat(deletedCount, " \u4E2A\u8FC7\u671F\u5DF2\u540C\u6B65\u8BA2\u5355"));
|
|
3034
|
+
}
|
|
3035
|
+
_context30.next = 86;
|
|
2982
3036
|
break;
|
|
2983
|
-
case
|
|
2984
|
-
_context30.prev =
|
|
3037
|
+
case 81:
|
|
3038
|
+
_context30.prev = 81;
|
|
2985
3039
|
_context30.t4 = _context30["catch"](0);
|
|
2986
3040
|
errorMessage = _context30.t4 instanceof Error ? _context30.t4.message : String(_context30.t4);
|
|
2987
3041
|
console.error('[Checkout] 清理过期订单数据失败:', _context30.t4);
|
|
2988
3042
|
this.logError('Expired orders cleanup failed', {
|
|
2989
3043
|
error: errorMessage
|
|
2990
3044
|
});
|
|
2991
|
-
case
|
|
3045
|
+
case 86:
|
|
2992
3046
|
case "end":
|
|
2993
3047
|
return _context30.stop();
|
|
2994
3048
|
}
|
|
2995
|
-
}, _callee30, this, [[0,
|
|
3049
|
+
}, _callee30, this, [[0, 81], [20, 43, 46, 49], [24, 35], [52, 70, 73, 76], [56, 63]]);
|
|
2996
3050
|
}));
|
|
2997
3051
|
function cleanupExpiredOrdersAsync() {
|
|
2998
3052
|
return _cleanupExpiredOrdersAsync.apply(this, arguments);
|
|
@@ -3390,19 +3444,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3390
3444
|
}
|
|
3391
3445
|
return _context36.abrupt("return");
|
|
3392
3446
|
case 4:
|
|
3393
|
-
|
|
3447
|
+
console.time('updateStateAmountToRemaining');
|
|
3448
|
+
// 🚀 性能优化:一次性批量获取所有需要的数据
|
|
3449
|
+
_context36.next = 7;
|
|
3394
3450
|
return this.fetchOrderDataBatch();
|
|
3395
|
-
case
|
|
3451
|
+
case 7:
|
|
3396
3452
|
_yield$this$fetchOrde3 = _context36.sent;
|
|
3397
3453
|
paymentItems = _yield$this$fetchOrde3.paymentItems;
|
|
3398
3454
|
_currentOrder3 = _yield$this$fetchOrde3.currentOrder;
|
|
3455
|
+
console.timeEnd('updateStateAmountToRemaining');
|
|
3399
3456
|
if (_currentOrder3) {
|
|
3400
|
-
_context36.next =
|
|
3457
|
+
_context36.next = 14;
|
|
3401
3458
|
break;
|
|
3402
3459
|
}
|
|
3403
3460
|
this.logWarning('updateStateAmountToRemaining: 未找到当前订单');
|
|
3404
3461
|
return _context36.abrupt("return");
|
|
3405
|
-
case
|
|
3462
|
+
case 14:
|
|
3406
3463
|
// 🚀 性能优化:一次性计算所有金额(纯计算,不查询数据库)
|
|
3407
3464
|
paidAmount = this.calculatePaidAmountFromItems(paymentItems); // 缓存已支付金额,供其他方法使用
|
|
3408
3465
|
this.calculationCache.paidAmount = paidAmount;
|
|
@@ -3438,19 +3495,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3438
3495
|
currentBalanceDueAmount = this.store.balanceDueAmount; // 批量更新状态,减少操作次数
|
|
3439
3496
|
hasStateChanged = false; // 如果需要更新定金状态
|
|
3440
3497
|
if (!needUpdateDepositStatus) {
|
|
3441
|
-
_context36.next =
|
|
3498
|
+
_context36.next = 28;
|
|
3442
3499
|
break;
|
|
3443
3500
|
}
|
|
3444
3501
|
this.store.currentOrder = _objectSpread(_objectSpread({}, this.store.currentOrder), {}, {
|
|
3445
3502
|
is_deposit: 0
|
|
3446
3503
|
});
|
|
3447
|
-
_context36.next =
|
|
3504
|
+
_context36.next = 27;
|
|
3448
3505
|
return this.payment.updateOrderAsync(this.store.currentOrder.uuid, {
|
|
3449
3506
|
is_deposit: 0
|
|
3450
3507
|
});
|
|
3451
|
-
case
|
|
3508
|
+
case 27:
|
|
3452
3509
|
hasStateChanged = true;
|
|
3453
|
-
case
|
|
3510
|
+
case 28:
|
|
3511
|
+
console.time('updateStateAmountToRemaining: remainingAmount');
|
|
3454
3512
|
// 更新 stateAmount
|
|
3455
3513
|
if (remainingAmount !== currentStateAmount) {
|
|
3456
3514
|
this.store.stateAmount = remainingAmount;
|
|
@@ -3469,6 +3527,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3469
3527
|
newAmount: remainingAmount
|
|
3470
3528
|
});
|
|
3471
3529
|
}
|
|
3530
|
+
console.timeEnd('updateStateAmountToRemaining: remainingAmount');
|
|
3531
|
+
console.time('updateStateAmountToRemaining: updateStateAmountToRemaining');
|
|
3472
3532
|
// 更新 balanceDueAmount
|
|
3473
3533
|
if (remainingAmount !== currentBalanceDueAmount) {
|
|
3474
3534
|
this.store.balanceDueAmount = remainingAmount;
|
|
@@ -3488,6 +3548,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3488
3548
|
newAmount: remainingAmount
|
|
3489
3549
|
});
|
|
3490
3550
|
}
|
|
3551
|
+
console.timeEnd('updateStateAmountToRemaining: updateStateAmountToRemaining');
|
|
3491
3552
|
if (!hasStateChanged) {
|
|
3492
3553
|
this.logInfo('状态无需更新,当前值已是最新:', {
|
|
3493
3554
|
stateAmount: currentStateAmount,
|
|
@@ -3497,28 +3558,28 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3497
3558
|
|
|
3498
3559
|
// 检查订单支付完成(复用已获取的数据)
|
|
3499
3560
|
if (!checkOrder) {
|
|
3500
|
-
_context36.next =
|
|
3561
|
+
_context36.next = 40;
|
|
3501
3562
|
break;
|
|
3502
3563
|
}
|
|
3503
|
-
_context36.next =
|
|
3564
|
+
_context36.next = 38;
|
|
3504
3565
|
return this.checkOrderPaymentCompletionOptimized(paymentItems, remainingAmount);
|
|
3505
|
-
case
|
|
3506
|
-
_context36.next =
|
|
3566
|
+
case 38:
|
|
3567
|
+
_context36.next = 41;
|
|
3507
3568
|
break;
|
|
3508
|
-
case
|
|
3569
|
+
case 40:
|
|
3509
3570
|
this.logInfo('外部传入无需 checkOrder,不执行订单支付完成检测和同步');
|
|
3510
|
-
case
|
|
3511
|
-
_context36.next =
|
|
3571
|
+
case 41:
|
|
3572
|
+
_context36.next = 46;
|
|
3512
3573
|
break;
|
|
3513
|
-
case
|
|
3514
|
-
_context36.prev =
|
|
3574
|
+
case 43:
|
|
3575
|
+
_context36.prev = 43;
|
|
3515
3576
|
_context36.t0 = _context36["catch"](1);
|
|
3516
3577
|
this.logError('更新 stateAmount 为剩余金额失败:', _context36.t0);
|
|
3517
|
-
case
|
|
3578
|
+
case 46:
|
|
3518
3579
|
case "end":
|
|
3519
3580
|
return _context36.stop();
|
|
3520
3581
|
}
|
|
3521
|
-
}, _callee36, this, [[1,
|
|
3582
|
+
}, _callee36, this, [[1, 43]]);
|
|
3522
3583
|
}));
|
|
3523
3584
|
function updateStateAmountToRemaining() {
|
|
3524
3585
|
return _updateStateAmountToRemaining.apply(this, arguments);
|
|
@@ -4149,11 +4210,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4149
4210
|
resolveInFlight,
|
|
4150
4211
|
rejectInFlight,
|
|
4151
4212
|
inFlightPromise,
|
|
4152
|
-
_this$store$currentOr26,
|
|
4153
4213
|
_this$store$currentOr27,
|
|
4214
|
+
_this$store$currentOr28,
|
|
4154
4215
|
_this$store$currentCu2,
|
|
4155
4216
|
_this$otherParams2,
|
|
4156
|
-
_this$store$
|
|
4217
|
+
_this$store$currentOr29,
|
|
4157
4218
|
_this$store$localOrde,
|
|
4158
4219
|
_this$store$localOrde2,
|
|
4159
4220
|
_checkoutResponse12,
|
|
@@ -4270,7 +4331,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4270
4331
|
})
|
|
4271
4332
|
});
|
|
4272
4333
|
}); // 确定最终的定金金额:优先使用手动设置的值,否则从支付项中计算
|
|
4273
|
-
manualDepositAmount = ((_this$store$
|
|
4334
|
+
manualDepositAmount = ((_this$store$currentOr27 = this.store.currentOrder) === null || _this$store$currentOr27 === void 0 ? void 0 : _this$store$currentOr27.deposit_amount) || '0.00'; // 优先级逻辑:手动设置的定金金额 > 从支付项计算的金额
|
|
4274
4335
|
manualDepositValue = new Decimal(manualDepositAmount);
|
|
4275
4336
|
if (manualDepositValue.gt(0)) {
|
|
4276
4337
|
// 如果手动设置了定金金额且大于0,使用手动设置的值
|
|
@@ -4330,7 +4391,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4330
4391
|
}),
|
|
4331
4392
|
manualDepositAmount: manualDepositAmount,
|
|
4332
4393
|
finalDepositAmount: finalDepositAmount,
|
|
4333
|
-
isDeposit: ((_this$store$
|
|
4394
|
+
isDeposit: ((_this$store$currentOr28 = this.store.currentOrder) === null || _this$store$currentOr28 === void 0 ? void 0 : _this$store$currentOr28.is_deposit) || 0
|
|
4334
4395
|
});
|
|
4335
4396
|
|
|
4336
4397
|
// 计算订单状态,优先读取外面传递的,如果没有则根据订单支付数据来
|
|
@@ -4378,7 +4439,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4378
4439
|
currency_symbol: this.otherParams.currency_symbol,
|
|
4379
4440
|
currency_format: this.otherParams.currency_format,
|
|
4380
4441
|
business_code: ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.business_code) || undefined,
|
|
4381
|
-
is_deposit: ((_this$store$
|
|
4442
|
+
is_deposit: ((_this$store$currentOr29 = this.store.currentOrder) !== null && _this$store$currentOr29 !== void 0 && _this$store$currentOr29.is_deposit || Number(finalDepositAmount) > 0 ? 1 : 0) || 0,
|
|
4382
4443
|
deposit_amount: finalDepositAmount,
|
|
4383
4444
|
// 使用最终确定的定金金额(手动设置优先)
|
|
4384
4445
|
product_tax_fee: this.store.localOrderData.tax_fee,
|
|
@@ -5021,7 +5082,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5021
5082
|
case 6:
|
|
5022
5083
|
// 取消注册模块
|
|
5023
5084
|
this.core.unregisterModule(this);
|
|
5024
|
-
|
|
5085
|
+
console.log('[Checkout] 已销毁');
|
|
5086
|
+
case 8:
|
|
5025
5087
|
case "end":
|
|
5026
5088
|
return _context46.stop();
|
|
5027
5089
|
}
|
|
@@ -5048,6 +5110,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5048
5110
|
uuid: this.store.currentOrder.uuid,
|
|
5049
5111
|
orderId: this.store.currentOrder.order_id
|
|
5050
5112
|
} : null;
|
|
5113
|
+
console.log('[Checkout] 重置 store 状态,准备创建新订单', prevOrderInfo);
|
|
5114
|
+
|
|
5051
5115
|
// 重置订单相关的 store 状态(保留 paymentMethods,因为支付方式数据变更不频繁)
|
|
5052
5116
|
this.store.currentOrder = undefined;
|
|
5053
5117
|
this.store.localOrderData = undefined;
|
|
@@ -5069,6 +5133,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5069
5133
|
|
|
5070
5134
|
// 注意:故意保留 this.store.paymentMethods,因为支付方式数据不易变更,保留在内存中提高性能
|
|
5071
5135
|
|
|
5136
|
+
console.log('[Checkout] Store 状态重置完成');
|
|
5137
|
+
|
|
5072
5138
|
// 🚀 性能优化:异步触发订单清理事件(不阻塞主流程)
|
|
5073
5139
|
// 使用 setTimeout 确保事件处理不会阻塞状态重置
|
|
5074
5140
|
if (prevOrderInfo) {
|