@pisell/pisellos 2.3.73 → 2.3.75
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.d.ts +7 -0
- package/dist/core/index.js +111 -71
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +2 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +36 -64
- package/dist/modules/Payment/index.js +97 -162
- package/dist/modules/Quotation/index.d.ts +6 -0
- package/dist/modules/Quotation/index.js +75 -19
- package/dist/modules/Rules/index.js +1 -4
- package/dist/modules/Schedule/index.js +0 -1
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +8 -2
- package/dist/server/index.js +303 -269
- package/dist/server/modules/floor-plan/index.d.ts +4 -0
- package/dist/server/modules/floor-plan/index.js +240 -98
- package/dist/server/modules/menu/index.js +75 -59
- package/dist/server/modules/order/index.d.ts +17 -7
- package/dist/server/modules/order/index.js +421 -211
- package/dist/server/modules/products/index.d.ts +8 -2
- package/dist/server/modules/products/index.js +191 -117
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +24 -17
- package/dist/server/modules/schedule/index.js +27 -35
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BaseSales/index.js +38 -41
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.js +0 -2
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -252
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.js +45 -55
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.d.ts +7 -0
- package/lib/core/index.js +149 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +82 -49
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
- package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
- package/lib/model/strategy/adapter/promotion/examples.js +222 -234
- package/lib/model/strategy/adapter/promotion/index.js +1 -0
- package/lib/model/strategy/adapter/promotion/type.js +243 -36
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +23 -42
- package/lib/modules/BookingContext/index.js +158 -136
- package/lib/modules/BookingContext/types.js +46 -32
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
- package/lib/modules/BookingContext/utils/flexible.js +38 -55
- package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
- package/lib/modules/BookingContext/utils/index.js +124 -41
- package/lib/modules/BookingContext/utils/noResource.js +58 -70
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
- package/lib/modules/BookingContext/utils/productExtend.js +202 -155
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
- package/lib/modules/BookingContext/utils/resources.js +209 -167
- package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
- package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +321 -251
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +70 -78
- package/lib/modules/Cart/utils/changePrice.js +22 -50
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +235 -172
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +122 -127
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +70 -76
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +1713 -2118
- package/lib/modules/Order/payment-utils.js +77 -120
- package/lib/modules/Order/types.js +88 -35
- package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
- package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
- package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
- package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
- package/lib/modules/Order/utils.js +814 -647
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +532 -399
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +230 -108
- package/lib/modules/Payment/utils.js +52 -51
- package/lib/modules/Payment/walletpass.js +485 -660
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +113 -123
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.d.ts +6 -0
- package/lib/modules/Quotation/index.js +110 -103
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.js +25 -23
- package/lib/modules/ResourcePlanner/localClock.js +54 -119
- package/lib/modules/ResourcePlanner/planner.js +589 -770
- package/lib/modules/ResourcePlanner/types.js +10 -29
- package/lib/modules/Rules/index.js +1218 -959
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +85 -90
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +355 -430
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
- package/lib/modules/Schedule/index.js +100 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -71
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +773 -418
- package/lib/modules/SurchargeList/index.js +46 -60
- package/lib/modules/SurchargeList/types.js +4 -16
- package/lib/modules/index.js +245 -63
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +8 -2
- package/lib/server/index.js +3083 -2663
- package/lib/server/modules/floor-plan/index.d.ts +4 -0
- package/lib/server/modules/floor-plan/index.js +159 -127
- package/lib/server/modules/floor-plan/types.js +15 -30
- package/lib/server/modules/index.js +106 -68
- package/lib/server/modules/menu/index.js +170 -124
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +17 -7
- package/lib/server/modules/order/index.js +916 -977
- package/lib/server/modules/order/types.js +122 -33
- package/lib/server/modules/order/utils/filterBookings.js +219 -194
- package/lib/server/modules/order/utils/filterOrders.js +118 -92
- package/lib/server/modules/payment/index.js +59 -83
- package/lib/server/modules/payment/types.js +4 -16
- package/lib/server/modules/products/index.d.ts +8 -2
- package/lib/server/modules/products/index.js +656 -471
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.js +137 -172
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +225 -186
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +135 -123
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.js +479 -456
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.js +1186 -1410
- package/lib/solution/BaseSales/types.js +42 -38
- package/lib/solution/BaseSales/utils/cartPromotion.js +642 -498
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
- package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
- package/lib/solution/BaseSales/utils.js +158 -143
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1527 -1340
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.js +607 -522
- package/lib/solution/BookingTicket/types.js +99 -77
- package/lib/solution/BookingTicket/utils/addProductDecision.js +226 -189
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
- package/lib/solution/BookingTicket/utils/cartView.js +114 -99
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -156
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +328 -324
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +832 -864
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.js +409 -374
- package/lib/solution/ShopDiscount/index.js +226 -232
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +300 -172
- package/lib/solution/UnifiedBookingSales/index.js +1035 -1201
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
- package/lib/solution/UnifiedBookingSales/types.js +10 -32
- package/lib/solution/VenueBooking/index.js +811 -879
- package/lib/solution/VenueBooking/types.js +19 -39
- package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
- package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +124 -41
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/payment-number.js +26 -46
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -117,20 +117,13 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
117
117
|
_context.next = 15;
|
|
118
118
|
return this.initializeSubModules(core, options);
|
|
119
119
|
case 15:
|
|
120
|
-
|
|
121
|
-
// await this.preloadPaymentMethods();
|
|
122
|
-
|
|
123
|
-
// 清理过期的已同步订单数据
|
|
124
|
-
// await this.cleanupExpiredOrdersAsync();
|
|
125
|
-
|
|
126
|
-
console.log('[Checkout] 初始化完成');
|
|
127
|
-
_context.next = 18;
|
|
120
|
+
_context.next = 17;
|
|
128
121
|
return this.core.effects.emit("".concat(this.name, ":onCheckoutInitialized"), {
|
|
129
122
|
timestamp: Date.now()
|
|
130
123
|
});
|
|
131
|
-
case
|
|
124
|
+
case 17:
|
|
132
125
|
this.logInfo('CheckoutModule initialized successfully');
|
|
133
|
-
case
|
|
126
|
+
case 18:
|
|
134
127
|
case "end":
|
|
135
128
|
return _context.stop();
|
|
136
129
|
}
|
|
@@ -288,9 +281,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
288
281
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
289
282
|
while (1) switch (_context5.prev = _context5.next) {
|
|
290
283
|
case 0:
|
|
291
|
-
console.log('[Checkout] 收到支付方式加载完成事件:', methods.length);
|
|
292
284
|
_this2.store.paymentMethods = methods;
|
|
293
|
-
case
|
|
285
|
+
case 1:
|
|
294
286
|
case "end":
|
|
295
287
|
return _context5.stop();
|
|
296
288
|
}
|
|
@@ -307,12 +299,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
307
299
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
308
300
|
while (1) switch (_context6.prev = _context6.next) {
|
|
309
301
|
case 0:
|
|
310
|
-
console.log('[Checkout] 收到支付方式变更事件:', {
|
|
311
|
-
oldCount: data.oldMethods.length,
|
|
312
|
-
newCount: data.newMethods.length
|
|
313
|
-
});
|
|
314
302
|
_this2.store.paymentMethods = data.newMethods;
|
|
315
|
-
case
|
|
303
|
+
case 1:
|
|
316
304
|
case "end":
|
|
317
305
|
return _context6.stop();
|
|
318
306
|
}
|
|
@@ -352,21 +340,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
352
340
|
case 5:
|
|
353
341
|
// 保存购物车数据
|
|
354
342
|
this.store.cartItems = params.cartItems;
|
|
355
|
-
|
|
356
|
-
_context7.next = 14;
|
|
343
|
+
_context7.next = 13;
|
|
357
344
|
break;
|
|
358
|
-
case
|
|
359
|
-
_context7.prev =
|
|
345
|
+
case 8:
|
|
346
|
+
_context7.prev = 8;
|
|
360
347
|
_context7.t0 = _context7["catch"](1);
|
|
361
|
-
_context7.next =
|
|
348
|
+
_context7.next = 12;
|
|
362
349
|
return this.handleError(_context7.t0, CheckoutErrorType.UnknownError);
|
|
363
|
-
case
|
|
350
|
+
case 12:
|
|
364
351
|
throw _context7.t0;
|
|
365
|
-
case
|
|
352
|
+
case 13:
|
|
366
353
|
case "end":
|
|
367
354
|
return _context7.stop();
|
|
368
355
|
}
|
|
369
|
-
}, _callee7, this, [[1,
|
|
356
|
+
}, _callee7, this, [[1, 8]]);
|
|
370
357
|
}));
|
|
371
358
|
function initializeCheckoutAsync(_x9) {
|
|
372
359
|
return _initializeCheckoutAsync.apply(this, arguments);
|
|
@@ -668,10 +655,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
668
655
|
}; // 只有在有客户信息时才存储
|
|
669
656
|
if (customerInfo.customer_id || customerInfo.customer_name) {
|
|
670
657
|
this.store.currentCustomer = customerInfo;
|
|
671
|
-
console.log('[Checkout] 保存客户信息:', customerInfo);
|
|
672
658
|
} else {
|
|
673
659
|
this.store.currentCustomer = undefined;
|
|
674
|
-
console.log('[Checkout] 未提供客户信息');
|
|
675
660
|
}
|
|
676
661
|
|
|
677
662
|
// 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
|
|
@@ -1097,28 +1082,26 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1097
1082
|
timestamp: Date.now()
|
|
1098
1083
|
});
|
|
1099
1084
|
case 11:
|
|
1100
|
-
console.log('[Checkout] 结账流程完成:', order.id);
|
|
1101
|
-
|
|
1102
1085
|
// 🔧 新增:自动重置 store 状态(同步执行)
|
|
1103
1086
|
this.resetStoreState();
|
|
1104
1087
|
return _context11.abrupt("return", {
|
|
1105
1088
|
success: true,
|
|
1106
1089
|
orderId: String(order.id)
|
|
1107
1090
|
});
|
|
1108
|
-
case
|
|
1109
|
-
_context11.prev =
|
|
1091
|
+
case 15:
|
|
1092
|
+
_context11.prev = 15;
|
|
1110
1093
|
_context11.t0 = _context11["catch"](0);
|
|
1111
|
-
_context11.next =
|
|
1094
|
+
_context11.next = 19;
|
|
1112
1095
|
return this.handleError(_context11.t0, CheckoutErrorType.UnknownError);
|
|
1113
|
-
case
|
|
1096
|
+
case 19:
|
|
1114
1097
|
return _context11.abrupt("return", {
|
|
1115
1098
|
success: false
|
|
1116
1099
|
});
|
|
1117
|
-
case
|
|
1100
|
+
case 20:
|
|
1118
1101
|
case "end":
|
|
1119
1102
|
return _context11.stop();
|
|
1120
1103
|
}
|
|
1121
|
-
}, _callee11, this, [[0,
|
|
1104
|
+
}, _callee11, this, [[0, 15]]);
|
|
1122
1105
|
}));
|
|
1123
1106
|
function completeCheckoutAsync() {
|
|
1124
1107
|
return _completeCheckoutAsync.apply(this, arguments);
|
|
@@ -1150,7 +1133,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1150
1133
|
cartItems = _this$store.cartItems,
|
|
1151
1134
|
localOrderData = _this$store.localOrderData;
|
|
1152
1135
|
if (!_currentOrder) {
|
|
1153
|
-
console.log('[Checkout] 当前没有活跃订单');
|
|
1154
1136
|
return null;
|
|
1155
1137
|
}
|
|
1156
1138
|
|
|
@@ -1196,27 +1178,26 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1196
1178
|
_context12.prev = 0;
|
|
1197
1179
|
_currentOrder2 = this.store.currentOrder;
|
|
1198
1180
|
if (_currentOrder2) {
|
|
1199
|
-
_context12.next =
|
|
1181
|
+
_context12.next = 4;
|
|
1200
1182
|
break;
|
|
1201
1183
|
}
|
|
1202
|
-
console.log('[Checkout] 当前没有活跃订单,无法获取支付项');
|
|
1203
1184
|
return _context12.abrupt("return", []);
|
|
1204
|
-
case
|
|
1205
|
-
_context12.next =
|
|
1185
|
+
case 4:
|
|
1186
|
+
_context12.next = 6;
|
|
1206
1187
|
return this.payment.getPaymentItemsAsync(_currentOrder2.uuid);
|
|
1207
|
-
case
|
|
1188
|
+
case 6:
|
|
1208
1189
|
paymentItems = _context12.sent;
|
|
1209
1190
|
return _context12.abrupt("return", paymentItems);
|
|
1210
|
-
case
|
|
1211
|
-
_context12.prev =
|
|
1191
|
+
case 10:
|
|
1192
|
+
_context12.prev = 10;
|
|
1212
1193
|
_context12.t0 = _context12["catch"](0);
|
|
1213
1194
|
console.error('[Checkout] 获取当前订单支付项失败:', _context12.t0);
|
|
1214
1195
|
return _context12.abrupt("return", []);
|
|
1215
|
-
case
|
|
1196
|
+
case 14:
|
|
1216
1197
|
case "end":
|
|
1217
1198
|
return _context12.stop();
|
|
1218
1199
|
}
|
|
1219
|
-
}, _callee12, this, [[0,
|
|
1200
|
+
}, _callee12, this, [[0, 10]]);
|
|
1220
1201
|
}));
|
|
1221
1202
|
function getCurrentOrderPaymentItemsAsync() {
|
|
1222
1203
|
return _getCurrentOrderPaymentItemsAsync.apply(this, arguments);
|
|
@@ -1273,7 +1254,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1273
1254
|
case 8:
|
|
1274
1255
|
updatedOrder = _context13.sent;
|
|
1275
1256
|
if (!updatedOrder) {
|
|
1276
|
-
_context13.next =
|
|
1257
|
+
_context13.next = 19;
|
|
1277
1258
|
break;
|
|
1278
1259
|
}
|
|
1279
1260
|
// 🔧 重要:Payment.replaceOrderIdByUuidAsync 返回的是 DB 快照(只保证 order_id 变化)
|
|
@@ -1298,32 +1279,27 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1298
1279
|
timestamp: Date.now()
|
|
1299
1280
|
});
|
|
1300
1281
|
case 16:
|
|
1301
|
-
console.log('[Checkout] 本地订单ID替换成功:', {
|
|
1302
|
-
uuid: updatedOrder.uuid,
|
|
1303
|
-
newOrderId: updatedOrder.id
|
|
1304
|
-
});
|
|
1305
|
-
|
|
1306
1282
|
// 标记订单已同步(替换ID意味着订单已在后端创建)
|
|
1307
1283
|
this.store.isOrderSynced = true;
|
|
1308
1284
|
|
|
1309
1285
|
// 订单ID替换后更新 stateAmount
|
|
1310
|
-
_context13.next =
|
|
1286
|
+
_context13.next = 19;
|
|
1311
1287
|
return this.updateStateAmountToRemaining(false);
|
|
1312
|
-
case
|
|
1288
|
+
case 19:
|
|
1313
1289
|
return _context13.abrupt("return", updatedOrder);
|
|
1314
|
-
case
|
|
1315
|
-
_context13.prev =
|
|
1290
|
+
case 22:
|
|
1291
|
+
_context13.prev = 22;
|
|
1316
1292
|
_context13.t0 = _context13["catch"](0);
|
|
1317
1293
|
console.error('[Checkout] 替换订单ID失败:', _context13.t0);
|
|
1318
|
-
_context13.next =
|
|
1294
|
+
_context13.next = 27;
|
|
1319
1295
|
return this.handleError(_context13.t0, CheckoutErrorType.UnknownError);
|
|
1320
|
-
case
|
|
1296
|
+
case 27:
|
|
1321
1297
|
return _context13.abrupt("return", null);
|
|
1322
|
-
case
|
|
1298
|
+
case 28:
|
|
1323
1299
|
case "end":
|
|
1324
1300
|
return _context13.stop();
|
|
1325
1301
|
}
|
|
1326
|
-
}, _callee13, this, [[0,
|
|
1302
|
+
}, _callee13, this, [[0, 22]]);
|
|
1327
1303
|
}));
|
|
1328
1304
|
function replaceLocalOrderIdAsync(_x13) {
|
|
1329
1305
|
return _replaceLocalOrderIdAsync.apply(this, arguments);
|
|
@@ -1970,12 +1946,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1970
1946
|
newDepositValue = isDeposit;
|
|
1971
1947
|
oldDepositValue = this.store.currentOrder.is_deposit; // 如果状态没有变化,直接返回
|
|
1972
1948
|
if (!(oldDepositValue === newDepositValue)) {
|
|
1973
|
-
_context19.next =
|
|
1949
|
+
_context19.next = 9;
|
|
1974
1950
|
break;
|
|
1975
1951
|
}
|
|
1976
|
-
console.log('[Checkout] 定金状态无变化,跳过更新');
|
|
1977
1952
|
return _context19.abrupt("return");
|
|
1978
|
-
case
|
|
1953
|
+
case 9:
|
|
1979
1954
|
deposit_amount = this.store.currentOrder.deposit_amount || '0.00'; // 如果原来没有 deposit_amount,则默认把待付金额置为 deposit_amount
|
|
1980
1955
|
if (!deposit_amount || Number(deposit_amount) === 0) {
|
|
1981
1956
|
deposit_amount = this.store.currentOrder.expect_amount;
|
|
@@ -1994,9 +1969,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1994
1969
|
// this.logInfo('订单从定金改为全款,清空定金金额');
|
|
1995
1970
|
// }
|
|
1996
1971
|
// 调用 Payment 模块更新订单
|
|
1997
|
-
_context19.next =
|
|
1972
|
+
_context19.next = 14;
|
|
1998
1973
|
return this.payment.updateOrderAsync(this.store.currentOrder.uuid, updateParams);
|
|
1999
|
-
case
|
|
1974
|
+
case 14:
|
|
2000
1975
|
// 更新本地缓存的订单对象
|
|
2001
1976
|
this.store.currentOrder = _objectSpread(_objectSpread({}, this.store.currentOrder), updateParams);
|
|
2002
1977
|
|
|
@@ -2010,31 +1985,31 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2010
1985
|
this.updateStateAmountToRemaining(false);
|
|
2011
1986
|
|
|
2012
1987
|
// 触发订单更新事件
|
|
2013
|
-
_context19.next =
|
|
1988
|
+
_context19.next = 20;
|
|
2014
1989
|
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
2015
1990
|
order: this.store.currentOrder,
|
|
2016
1991
|
timestamp: Date.now()
|
|
2017
1992
|
});
|
|
2018
|
-
case
|
|
1993
|
+
case 20:
|
|
2019
1994
|
this.logInfo('订单定金状态更新成功:', {
|
|
2020
1995
|
isDeposit: newDepositValue,
|
|
2021
1996
|
depositAmount: this.store.currentOrder.deposit_amount
|
|
2022
1997
|
});
|
|
2023
|
-
_context19.next =
|
|
1998
|
+
_context19.next = 29;
|
|
2024
1999
|
break;
|
|
2025
|
-
case
|
|
2026
|
-
_context19.prev =
|
|
2000
|
+
case 23:
|
|
2001
|
+
_context19.prev = 23;
|
|
2027
2002
|
_context19.t0 = _context19["catch"](0);
|
|
2028
2003
|
this.logError('更新订单定金状态失败:', _context19.t0);
|
|
2029
|
-
_context19.next =
|
|
2004
|
+
_context19.next = 28;
|
|
2030
2005
|
return this.handleError(_context19.t0, CheckoutErrorType.ValidationFailed);
|
|
2031
|
-
case
|
|
2006
|
+
case 28:
|
|
2032
2007
|
throw _context19.t0;
|
|
2033
|
-
case
|
|
2008
|
+
case 29:
|
|
2034
2009
|
case "end":
|
|
2035
2010
|
return _context19.stop();
|
|
2036
2011
|
}
|
|
2037
|
-
}, _callee19, this, [[0,
|
|
2012
|
+
}, _callee19, this, [[0, 23]]);
|
|
2038
2013
|
}));
|
|
2039
2014
|
function updateOrderDepositStatusAsync(_x19) {
|
|
2040
2015
|
return _updateOrderDepositStatusAsync.apply(this, arguments);
|
|
@@ -2189,7 +2164,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2189
2164
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2190
2165
|
while (1) switch (_context21.prev = _context21.next) {
|
|
2191
2166
|
case 0:
|
|
2192
|
-
console.log('manualSyncOrderAsync called');
|
|
2193
2167
|
this.logInfo('manualSyncOrderAsync called', {
|
|
2194
2168
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
2195
2169
|
currentOrderId: (_this$store$currentOr15 = this.store.currentOrder) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.order_id,
|
|
@@ -2198,16 +2172,16 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2198
2172
|
isOrderSynced: this.store.isOrderSynced,
|
|
2199
2173
|
isVirtualOrderId: this.store.currentOrder ? isVirtualOrderId(this.store.currentOrder.order_id) : false
|
|
2200
2174
|
});
|
|
2201
|
-
_context21.prev =
|
|
2175
|
+
_context21.prev = 1;
|
|
2202
2176
|
if (this.store.currentOrder) {
|
|
2203
|
-
_context21.next =
|
|
2177
|
+
_context21.next = 4;
|
|
2204
2178
|
break;
|
|
2205
2179
|
}
|
|
2206
2180
|
return _context21.abrupt("return", {
|
|
2207
2181
|
success: false,
|
|
2208
2182
|
message: '当前没有活跃订单,无法同步'
|
|
2209
2183
|
});
|
|
2210
|
-
case
|
|
2184
|
+
case 4:
|
|
2211
2185
|
orderUuid = this.store.currentOrder.uuid;
|
|
2212
2186
|
oldOrderId = this.store.currentOrder.order_id; // 检查订单是否已经同步
|
|
2213
2187
|
if (this.store.isOrderSynced) {
|
|
@@ -2217,9 +2191,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2217
2191
|
_context21.t1 = orderUuid;
|
|
2218
2192
|
_context21.t2 = oldOrderId;
|
|
2219
2193
|
_context21.t3 = this.store.currentOrder.total_amount;
|
|
2220
|
-
_context21.next =
|
|
2194
|
+
_context21.next = 13;
|
|
2221
2195
|
return this.calculateRemainingAmountAsync();
|
|
2222
|
-
case
|
|
2196
|
+
case 13:
|
|
2223
2197
|
_context21.t4 = _context21.sent;
|
|
2224
2198
|
_context21.t5 = {
|
|
2225
2199
|
orderUuid: _context21.t1,
|
|
@@ -2228,14 +2202,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2228
2202
|
remainingAmount: _context21.t4
|
|
2229
2203
|
};
|
|
2230
2204
|
_context21.t0.logInfo.call(_context21.t0, '开始手动同步订单到后端:', _context21.t5);
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
// 强制同步订单到后端,并获取完整响应数据
|
|
2234
|
-
_context21.next = 20;
|
|
2205
|
+
_context21.next = 18;
|
|
2235
2206
|
return this.syncOrderToBackendWithReturn(true);
|
|
2236
|
-
case
|
|
2207
|
+
case 18:
|
|
2237
2208
|
syncResult = _context21.sent;
|
|
2238
|
-
console.timeEnd('manualSyncOrderAsync');
|
|
2239
2209
|
this.logInfo('手动同步订单完成:', {
|
|
2240
2210
|
orderUuid: orderUuid,
|
|
2241
2211
|
syncResult: syncResult,
|
|
@@ -2256,13 +2226,13 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2256
2226
|
newRes = _objectSpread(_objectSpread({}, syncResult), {}, {
|
|
2257
2227
|
is_deposit: ((_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.is_deposit) || 0
|
|
2258
2228
|
});
|
|
2259
|
-
_context21.next =
|
|
2229
|
+
_context21.next = 27;
|
|
2260
2230
|
return this.updateStateAmountToRemaining(false);
|
|
2261
|
-
case
|
|
2231
|
+
case 27:
|
|
2262
2232
|
return _context21.abrupt("return", newRes);
|
|
2263
|
-
case
|
|
2264
|
-
_context21.prev =
|
|
2265
|
-
_context21.t6 = _context21["catch"](
|
|
2233
|
+
case 30:
|
|
2234
|
+
_context21.prev = 30;
|
|
2235
|
+
_context21.t6 = _context21["catch"](1);
|
|
2266
2236
|
this.logError('手动同步订单失败:', _context21.t6);
|
|
2267
2237
|
errorMessage = _context21.t6 instanceof Error ? _context21.t6.message : '同步失败';
|
|
2268
2238
|
return _context21.abrupt("return", {
|
|
@@ -2270,11 +2240,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2270
2240
|
message: "\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(errorMessage),
|
|
2271
2241
|
orderUuid: (_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.uuid
|
|
2272
2242
|
});
|
|
2273
|
-
case
|
|
2243
|
+
case 35:
|
|
2274
2244
|
case "end":
|
|
2275
2245
|
return _context21.stop();
|
|
2276
2246
|
}
|
|
2277
|
-
}, _callee21, this, [[
|
|
2247
|
+
}, _callee21, this, [[1, 30]]);
|
|
2278
2248
|
}));
|
|
2279
2249
|
function manualSyncOrderAsync() {
|
|
2280
2250
|
return _manualSyncOrderAsync.apply(this, arguments);
|
|
@@ -2291,7 +2261,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2291
2261
|
key: "getOrderNote",
|
|
2292
2262
|
value: function getOrderNote() {
|
|
2293
2263
|
if (!this.store.localOrderData) {
|
|
2294
|
-
console.log('[Checkout] 没有本地订单数据,无法获取备注');
|
|
2295
2264
|
return '';
|
|
2296
2265
|
}
|
|
2297
2266
|
return this.store.localOrderData.shop_note || '';
|
|
@@ -2321,15 +2290,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2321
2290
|
value: function isCurrentOrderSynced() {
|
|
2322
2291
|
// 如果没有当前订单,返回false
|
|
2323
2292
|
if (!this.store.currentOrder) {
|
|
2324
|
-
console.log('[Checkout] 没有当前订单,同步状态为false');
|
|
2325
2293
|
return false;
|
|
2326
2294
|
}
|
|
2327
2295
|
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
|
-
});
|
|
2333
2296
|
return syncStatus;
|
|
2334
2297
|
}
|
|
2335
2298
|
|
|
@@ -2548,7 +2511,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2548
2511
|
key: "updateOrderNoteAsync",
|
|
2549
2512
|
value: (function () {
|
|
2550
2513
|
var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(note) {
|
|
2551
|
-
var _this$store$currentOr23,
|
|
2514
|
+
var _this$store$currentOr23, oldNote, orderInPayment;
|
|
2552
2515
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2553
2516
|
while (1) switch (_context24.prev = _context24.next) {
|
|
2554
2517
|
case 0:
|
|
@@ -2559,65 +2522,51 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2559
2522
|
}
|
|
2560
2523
|
throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有本地订单数据,无法更新备注');
|
|
2561
2524
|
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
|
-
|
|
2568
2525
|
// 更新备注
|
|
2569
2526
|
oldNote = this.store.localOrderData.shop_note;
|
|
2570
2527
|
this.store.localOrderData.shop_note = note;
|
|
2571
2528
|
|
|
2572
2529
|
// 如果有当前订单,也同步到Payment模块中的订单数据
|
|
2573
2530
|
if (!this.store.currentOrder) {
|
|
2574
|
-
_context24.next =
|
|
2531
|
+
_context24.next = 16;
|
|
2575
2532
|
break;
|
|
2576
2533
|
}
|
|
2577
|
-
_context24.prev =
|
|
2578
|
-
_context24.next =
|
|
2534
|
+
_context24.prev = 6;
|
|
2535
|
+
_context24.next = 9;
|
|
2579
2536
|
return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
|
|
2580
|
-
case
|
|
2537
|
+
case 9:
|
|
2581
2538
|
orderInPayment = _context24.sent;
|
|
2582
|
-
if (orderInPayment && orderInPayment.note !== undefined) {
|
|
2583
|
-
|
|
2584
|
-
// 这里可能需要根据Payment模块的实际API来调整
|
|
2585
|
-
console.log('[Checkout] 同步备注到Payment模块的订单数据中');
|
|
2586
|
-
}
|
|
2587
|
-
_context24.next = 17;
|
|
2539
|
+
if (orderInPayment && orderInPayment.note !== undefined) {}
|
|
2540
|
+
_context24.next = 16;
|
|
2588
2541
|
break;
|
|
2589
|
-
case
|
|
2590
|
-
_context24.prev =
|
|
2591
|
-
_context24.t0 = _context24["catch"](
|
|
2542
|
+
case 13:
|
|
2543
|
+
_context24.prev = 13;
|
|
2544
|
+
_context24.t0 = _context24["catch"](6);
|
|
2592
2545
|
console.warn('[Checkout] 同步备注到Payment模块失败,但本地更新成功:', _context24.t0);
|
|
2593
|
-
case
|
|
2594
|
-
_context24.next =
|
|
2546
|
+
case 16:
|
|
2547
|
+
_context24.next = 18;
|
|
2595
2548
|
return this.core.effects.emit("".concat(this.name, ":onOrderNoteChanged"), {
|
|
2596
|
-
orderUuid: (_this$store$
|
|
2549
|
+
orderUuid: (_this$store$currentOr23 = this.store.currentOrder) === null || _this$store$currentOr23 === void 0 ? void 0 : _this$store$currentOr23.uuid,
|
|
2597
2550
|
oldNote: oldNote,
|
|
2598
2551
|
newNote: note,
|
|
2599
2552
|
timestamp: Date.now()
|
|
2600
2553
|
});
|
|
2601
|
-
case
|
|
2602
|
-
|
|
2603
|
-
oldNote: oldNote,
|
|
2604
|
-
newNote: note
|
|
2605
|
-
});
|
|
2606
|
-
_context24.next = 28;
|
|
2554
|
+
case 18:
|
|
2555
|
+
_context24.next = 26;
|
|
2607
2556
|
break;
|
|
2608
|
-
case
|
|
2609
|
-
_context24.prev =
|
|
2557
|
+
case 20:
|
|
2558
|
+
_context24.prev = 20;
|
|
2610
2559
|
_context24.t1 = _context24["catch"](0);
|
|
2611
2560
|
console.error('[Checkout] 更新订单备注失败:', _context24.t1);
|
|
2612
|
-
_context24.next =
|
|
2561
|
+
_context24.next = 25;
|
|
2613
2562
|
return this.handleError(_context24.t1, CheckoutErrorType.ValidationFailed);
|
|
2614
|
-
case
|
|
2563
|
+
case 25:
|
|
2615
2564
|
throw _context24.t1;
|
|
2616
|
-
case
|
|
2565
|
+
case 26:
|
|
2617
2566
|
case "end":
|
|
2618
2567
|
return _context24.stop();
|
|
2619
2568
|
}
|
|
2620
|
-
}, _callee24, this, [[0,
|
|
2569
|
+
}, _callee24, this, [[0, 20], [6, 13]]);
|
|
2621
2570
|
}));
|
|
2622
2571
|
function updateOrderNoteAsync(_x22) {
|
|
2623
2572
|
return _updateOrderNoteAsync.apply(this, arguments);
|
|
@@ -2665,7 +2614,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2665
2614
|
key: "handlePaymentSuccess",
|
|
2666
2615
|
value: (function () {
|
|
2667
2616
|
var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(data) {
|
|
2668
|
-
var _this$store$
|
|
2617
|
+
var _this$store$currentOr24;
|
|
2669
2618
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2670
2619
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2671
2620
|
case 0:
|
|
@@ -2676,7 +2625,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2676
2625
|
return this.core.effects.emit("".concat(this.name, ":onPaymentSuccess"), {
|
|
2677
2626
|
orderUuid: data.orderUuid,
|
|
2678
2627
|
paymentMethodCode: '',
|
|
2679
|
-
amount: ((_this$store$
|
|
2628
|
+
amount: ((_this$store$currentOr24 = this.store.currentOrder) === null || _this$store$currentOr24 === void 0 ? void 0 : _this$store$currentOr24.total_amount) || '0',
|
|
2680
2629
|
timestamp: data.timestamp
|
|
2681
2630
|
});
|
|
2682
2631
|
case 4:
|
|
@@ -2701,7 +2650,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2701
2650
|
key: "handlePaymentError",
|
|
2702
2651
|
value: (function () {
|
|
2703
2652
|
var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data) {
|
|
2704
|
-
var _this$store$
|
|
2653
|
+
var _this$store$currentOr25;
|
|
2705
2654
|
var error;
|
|
2706
2655
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2707
2656
|
while (1) switch (_context27.prev = _context27.next) {
|
|
@@ -2714,7 +2663,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2714
2663
|
return this.core.effects.emit("".concat(this.name, ":onPaymentFailed"), {
|
|
2715
2664
|
orderUuid: data.orderUuid,
|
|
2716
2665
|
paymentMethodCode: '',
|
|
2717
|
-
amount: ((_this$store$
|
|
2666
|
+
amount: ((_this$store$currentOr25 = this.store.currentOrder) === null || _this$store$currentOr25 === void 0 ? void 0 : _this$store$currentOr25.total_amount) || '0',
|
|
2718
2667
|
timestamp: data.timestamp
|
|
2719
2668
|
});
|
|
2720
2669
|
case 5:
|
|
@@ -2838,25 +2787,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2838
2787
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2839
2788
|
case 0:
|
|
2840
2789
|
_context29.prev = 0;
|
|
2841
|
-
|
|
2842
|
-
_context29.next = 4;
|
|
2790
|
+
_context29.next = 3;
|
|
2843
2791
|
return this.payment.getPayMethodListAsync();
|
|
2844
|
-
case
|
|
2792
|
+
case 3:
|
|
2845
2793
|
methods = _context29.sent;
|
|
2846
2794
|
this.store.paymentMethods = methods;
|
|
2847
|
-
|
|
2848
|
-
_context29.next = 13;
|
|
2795
|
+
_context29.next = 11;
|
|
2849
2796
|
break;
|
|
2850
|
-
case
|
|
2851
|
-
_context29.prev =
|
|
2797
|
+
case 7:
|
|
2798
|
+
_context29.prev = 7;
|
|
2852
2799
|
_context29.t0 = _context29["catch"](0);
|
|
2853
2800
|
console.error('[Checkout] 预加载支付方式失败:', _context29.t0);
|
|
2854
2801
|
this.store.paymentMethods = [];
|
|
2855
|
-
case
|
|
2802
|
+
case 11:
|
|
2856
2803
|
case "end":
|
|
2857
2804
|
return _context29.stop();
|
|
2858
2805
|
}
|
|
2859
|
-
}, _callee29, this, [[0,
|
|
2806
|
+
}, _callee29, this, [[0, 7]]);
|
|
2860
2807
|
}));
|
|
2861
2808
|
function preloadPaymentMethods() {
|
|
2862
2809
|
return _preloadPaymentMethods.apply(this, arguments);
|
|
@@ -2885,48 +2832,43 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2885
2832
|
retentionDays = cleanupConfig.retentionDays || 7; // 默认保留7天
|
|
2886
2833
|
maxOrdersToDelete = cleanupConfig.maxOrdersToDelete || 100; // 默认最多删除100个订单
|
|
2887
2834
|
if (isCleanupEnabled) {
|
|
2888
|
-
_context30.next =
|
|
2835
|
+
_context30.next = 7;
|
|
2889
2836
|
break;
|
|
2890
2837
|
}
|
|
2891
|
-
console.log('[Checkout] 订单数据清理功能已禁用');
|
|
2892
2838
|
return _context30.abrupt("return");
|
|
2893
|
-
case
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
// 获取所有订单
|
|
2897
|
-
_context30.next = 11;
|
|
2839
|
+
case 7:
|
|
2840
|
+
_context30.next = 9;
|
|
2898
2841
|
return this.payment.getOrderListAsync();
|
|
2899
|
-
case
|
|
2842
|
+
case 9:
|
|
2900
2843
|
allOrders = _context30.sent;
|
|
2901
2844
|
if (!(!allOrders || allOrders.length === 0)) {
|
|
2902
|
-
_context30.next =
|
|
2845
|
+
_context30.next = 12;
|
|
2903
2846
|
break;
|
|
2904
2847
|
}
|
|
2905
|
-
console.log('[Checkout] 没有找到需要清理的订单数据');
|
|
2906
2848
|
return _context30.abrupt("return");
|
|
2907
|
-
case
|
|
2849
|
+
case 12:
|
|
2908
2850
|
thresholdDate = new Date();
|
|
2909
2851
|
thresholdDate.setDate(thresholdDate.getDate() - retentionDays);
|
|
2910
2852
|
deletedCount = 0;
|
|
2911
2853
|
ordersToDelete = [];
|
|
2912
2854
|
_iterator = _createForOfIteratorHelper(allOrders);
|
|
2913
|
-
_context30.prev =
|
|
2855
|
+
_context30.prev = 17;
|
|
2914
2856
|
_iterator.s();
|
|
2915
|
-
case
|
|
2857
|
+
case 19:
|
|
2916
2858
|
if ((_step = _iterator.n()).done) {
|
|
2917
|
-
_context30.next =
|
|
2859
|
+
_context30.next = 38;
|
|
2918
2860
|
break;
|
|
2919
2861
|
}
|
|
2920
2862
|
order = _step.value;
|
|
2921
|
-
_context30.prev =
|
|
2863
|
+
_context30.prev = 21;
|
|
2922
2864
|
// 检查订单是否已同步(订单ID不是虚拟ID)
|
|
2923
2865
|
isSynced = order.order_id && !isVirtualOrderId(order.order_id);
|
|
2924
2866
|
if (isSynced) {
|
|
2925
|
-
_context30.next =
|
|
2867
|
+
_context30.next = 25;
|
|
2926
2868
|
break;
|
|
2927
2869
|
}
|
|
2928
|
-
return _context30.abrupt("continue",
|
|
2929
|
-
case
|
|
2870
|
+
return _context30.abrupt("continue", 36);
|
|
2871
|
+
case 25:
|
|
2930
2872
|
// 检查创建时间
|
|
2931
2873
|
orderCreatedAt = null; // 尝试从 order_info.created_at 获取创建时间
|
|
2932
2874
|
if ((_order$order_info = order.order_info) !== null && _order$order_info !== void 0 && _order$order_info.created_at) {
|
|
@@ -2939,11 +2881,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2939
2881
|
|
|
2940
2882
|
// 如果无法获取创建时间,跳过此订单
|
|
2941
2883
|
if (!(!orderCreatedAt || isNaN(orderCreatedAt.getTime()))) {
|
|
2942
|
-
_context30.next =
|
|
2884
|
+
_context30.next = 29;
|
|
2943
2885
|
break;
|
|
2944
2886
|
}
|
|
2945
|
-
return _context30.abrupt("continue",
|
|
2946
|
-
case
|
|
2887
|
+
return _context30.abrupt("continue", 36);
|
|
2888
|
+
case 29:
|
|
2947
2889
|
// 检查是否超过指定天数
|
|
2948
2890
|
if (orderCreatedAt < thresholdDate) {
|
|
2949
2891
|
ordersToDelete.push({
|
|
@@ -2953,69 +2895,68 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2953
2895
|
daysSinceCreated: Math.floor((Date.now() - orderCreatedAt.getTime()) / (1000 * 60 * 60 * 24))
|
|
2954
2896
|
});
|
|
2955
2897
|
}
|
|
2956
|
-
_context30.next =
|
|
2898
|
+
_context30.next = 36;
|
|
2957
2899
|
break;
|
|
2958
|
-
case
|
|
2959
|
-
_context30.prev =
|
|
2960
|
-
_context30.t0 = _context30["catch"](
|
|
2900
|
+
case 32:
|
|
2901
|
+
_context30.prev = 32;
|
|
2902
|
+
_context30.t0 = _context30["catch"](21);
|
|
2961
2903
|
console.warn("[Checkout] \u5904\u7406\u8BA2\u5355 ".concat(order.uuid, " \u65F6\u51FA\u9519:"), _context30.t0);
|
|
2962
|
-
return _context30.abrupt("continue",
|
|
2963
|
-
case
|
|
2964
|
-
_context30.next =
|
|
2904
|
+
return _context30.abrupt("continue", 36);
|
|
2905
|
+
case 36:
|
|
2906
|
+
_context30.next = 19;
|
|
2965
2907
|
break;
|
|
2966
|
-
case
|
|
2967
|
-
_context30.next =
|
|
2908
|
+
case 38:
|
|
2909
|
+
_context30.next = 43;
|
|
2968
2910
|
break;
|
|
2911
|
+
case 40:
|
|
2912
|
+
_context30.prev = 40;
|
|
2913
|
+
_context30.t1 = _context30["catch"](17);
|
|
2914
|
+
_iterator.e(_context30.t1);
|
|
2969
2915
|
case 43:
|
|
2970
2916
|
_context30.prev = 43;
|
|
2971
|
-
_context30.t1 = _context30["catch"](20);
|
|
2972
|
-
_iterator.e(_context30.t1);
|
|
2973
|
-
case 46:
|
|
2974
|
-
_context30.prev = 46;
|
|
2975
2917
|
_iterator.f();
|
|
2976
|
-
return _context30.finish(
|
|
2977
|
-
case
|
|
2918
|
+
return _context30.finish(43);
|
|
2919
|
+
case 46:
|
|
2978
2920
|
// 按创建时间排序(最老的先删除)并限制删除数量
|
|
2979
2921
|
ordersToDelete.sort(function (a, b) {
|
|
2980
2922
|
return new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime();
|
|
2981
2923
|
});
|
|
2982
2924
|
actualOrdersToDelete = ordersToDelete.slice(0, maxOrdersToDelete); // 删除符合条件的订单
|
|
2983
2925
|
_iterator2 = _createForOfIteratorHelper(actualOrdersToDelete);
|
|
2984
|
-
_context30.prev =
|
|
2926
|
+
_context30.prev = 49;
|
|
2985
2927
|
_iterator2.s();
|
|
2986
|
-
case
|
|
2928
|
+
case 51:
|
|
2987
2929
|
if ((_step2 = _iterator2.n()).done) {
|
|
2988
|
-
_context30.next =
|
|
2930
|
+
_context30.next = 64;
|
|
2989
2931
|
break;
|
|
2990
2932
|
}
|
|
2991
2933
|
orderInfo = _step2.value;
|
|
2992
|
-
_context30.prev =
|
|
2993
|
-
_context30.next =
|
|
2934
|
+
_context30.prev = 53;
|
|
2935
|
+
_context30.next = 56;
|
|
2994
2936
|
return this.payment.deletePaymentOrderAsync(orderInfo.uuid);
|
|
2995
|
-
case
|
|
2937
|
+
case 56:
|
|
2996
2938
|
deletedCount++;
|
|
2997
|
-
|
|
2998
|
-
_context30.next = 66;
|
|
2939
|
+
_context30.next = 62;
|
|
2999
2940
|
break;
|
|
3000
|
-
case
|
|
3001
|
-
_context30.prev =
|
|
3002
|
-
_context30.t2 = _context30["catch"](
|
|
2941
|
+
case 59:
|
|
2942
|
+
_context30.prev = 59;
|
|
2943
|
+
_context30.t2 = _context30["catch"](53);
|
|
3003
2944
|
console.error("[Checkout] \u5220\u9664\u8BA2\u5355 ".concat(orderInfo.uuid, " \u5931\u8D25:"), _context30.t2);
|
|
3004
|
-
case
|
|
3005
|
-
_context30.next =
|
|
2945
|
+
case 62:
|
|
2946
|
+
_context30.next = 51;
|
|
3006
2947
|
break;
|
|
3007
|
-
case
|
|
3008
|
-
_context30.next =
|
|
2948
|
+
case 64:
|
|
2949
|
+
_context30.next = 69;
|
|
3009
2950
|
break;
|
|
3010
|
-
case
|
|
3011
|
-
_context30.prev =
|
|
3012
|
-
_context30.t3 = _context30["catch"](
|
|
2951
|
+
case 66:
|
|
2952
|
+
_context30.prev = 66;
|
|
2953
|
+
_context30.t3 = _context30["catch"](49);
|
|
3013
2954
|
_iterator2.e(_context30.t3);
|
|
3014
|
-
case
|
|
3015
|
-
_context30.prev =
|
|
2955
|
+
case 69:
|
|
2956
|
+
_context30.prev = 69;
|
|
3016
2957
|
_iterator2.f();
|
|
3017
|
-
return _context30.finish(
|
|
3018
|
-
case
|
|
2958
|
+
return _context30.finish(69);
|
|
2959
|
+
case 72:
|
|
3019
2960
|
summary = {
|
|
3020
2961
|
totalOrders: allOrders.length,
|
|
3021
2962
|
expiredSyncedOrders: ordersToDelete.length,
|
|
@@ -3027,26 +2968,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3027
2968
|
skippedOrders: Math.max(0, ordersToDelete.length - maxOrdersToDelete)
|
|
3028
2969
|
}; // 记录清理结果
|
|
3029
2970
|
this.logInfo('Expired orders cleanup completed', summary);
|
|
3030
|
-
if (ordersToDelete.length > maxOrdersToDelete) {
|
|
3031
|
-
|
|
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;
|
|
2971
|
+
if (ordersToDelete.length > maxOrdersToDelete) {} else {}
|
|
2972
|
+
_context30.next = 82;
|
|
3036
2973
|
break;
|
|
3037
|
-
case
|
|
3038
|
-
_context30.prev =
|
|
2974
|
+
case 77:
|
|
2975
|
+
_context30.prev = 77;
|
|
3039
2976
|
_context30.t4 = _context30["catch"](0);
|
|
3040
2977
|
errorMessage = _context30.t4 instanceof Error ? _context30.t4.message : String(_context30.t4);
|
|
3041
2978
|
console.error('[Checkout] 清理过期订单数据失败:', _context30.t4);
|
|
3042
2979
|
this.logError('Expired orders cleanup failed', {
|
|
3043
2980
|
error: errorMessage
|
|
3044
2981
|
});
|
|
3045
|
-
case
|
|
2982
|
+
case 82:
|
|
3046
2983
|
case "end":
|
|
3047
2984
|
return _context30.stop();
|
|
3048
2985
|
}
|
|
3049
|
-
}, _callee30, this, [[0,
|
|
2986
|
+
}, _callee30, this, [[0, 77], [17, 40, 43, 46], [21, 32], [49, 66, 69, 72], [53, 59]]);
|
|
3050
2987
|
}));
|
|
3051
2988
|
function cleanupExpiredOrdersAsync() {
|
|
3052
2989
|
return _cleanupExpiredOrdersAsync.apply(this, arguments);
|
|
@@ -3444,22 +3381,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3444
3381
|
}
|
|
3445
3382
|
return _context36.abrupt("return");
|
|
3446
3383
|
case 4:
|
|
3447
|
-
|
|
3448
|
-
// 🚀 性能优化:一次性批量获取所有需要的数据
|
|
3449
|
-
_context36.next = 7;
|
|
3384
|
+
_context36.next = 6;
|
|
3450
3385
|
return this.fetchOrderDataBatch();
|
|
3451
|
-
case
|
|
3386
|
+
case 6:
|
|
3452
3387
|
_yield$this$fetchOrde3 = _context36.sent;
|
|
3453
3388
|
paymentItems = _yield$this$fetchOrde3.paymentItems;
|
|
3454
3389
|
_currentOrder3 = _yield$this$fetchOrde3.currentOrder;
|
|
3455
|
-
console.timeEnd('updateStateAmountToRemaining');
|
|
3456
3390
|
if (_currentOrder3) {
|
|
3457
|
-
_context36.next =
|
|
3391
|
+
_context36.next = 12;
|
|
3458
3392
|
break;
|
|
3459
3393
|
}
|
|
3460
3394
|
this.logWarning('updateStateAmountToRemaining: 未找到当前订单');
|
|
3461
3395
|
return _context36.abrupt("return");
|
|
3462
|
-
case
|
|
3396
|
+
case 12:
|
|
3463
3397
|
// 🚀 性能优化:一次性计算所有金额(纯计算,不查询数据库)
|
|
3464
3398
|
paidAmount = this.calculatePaidAmountFromItems(paymentItems); // 缓存已支付金额,供其他方法使用
|
|
3465
3399
|
this.calculationCache.paidAmount = paidAmount;
|
|
@@ -3495,20 +3429,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3495
3429
|
currentBalanceDueAmount = this.store.balanceDueAmount; // 批量更新状态,减少操作次数
|
|
3496
3430
|
hasStateChanged = false; // 如果需要更新定金状态
|
|
3497
3431
|
if (!needUpdateDepositStatus) {
|
|
3498
|
-
_context36.next =
|
|
3432
|
+
_context36.next = 26;
|
|
3499
3433
|
break;
|
|
3500
3434
|
}
|
|
3501
3435
|
this.store.currentOrder = _objectSpread(_objectSpread({}, this.store.currentOrder), {}, {
|
|
3502
3436
|
is_deposit: 0
|
|
3503
3437
|
});
|
|
3504
|
-
_context36.next =
|
|
3438
|
+
_context36.next = 25;
|
|
3505
3439
|
return this.payment.updateOrderAsync(this.store.currentOrder.uuid, {
|
|
3506
3440
|
is_deposit: 0
|
|
3507
3441
|
});
|
|
3508
|
-
case
|
|
3442
|
+
case 25:
|
|
3509
3443
|
hasStateChanged = true;
|
|
3510
|
-
case
|
|
3511
|
-
console.time('updateStateAmountToRemaining: remainingAmount');
|
|
3444
|
+
case 26:
|
|
3512
3445
|
// 更新 stateAmount
|
|
3513
3446
|
if (remainingAmount !== currentStateAmount) {
|
|
3514
3447
|
this.store.stateAmount = remainingAmount;
|
|
@@ -3527,8 +3460,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3527
3460
|
newAmount: remainingAmount
|
|
3528
3461
|
});
|
|
3529
3462
|
}
|
|
3530
|
-
console.timeEnd('updateStateAmountToRemaining: remainingAmount');
|
|
3531
|
-
console.time('updateStateAmountToRemaining: updateStateAmountToRemaining');
|
|
3532
3463
|
// 更新 balanceDueAmount
|
|
3533
3464
|
if (remainingAmount !== currentBalanceDueAmount) {
|
|
3534
3465
|
this.store.balanceDueAmount = remainingAmount;
|
|
@@ -3548,7 +3479,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3548
3479
|
newAmount: remainingAmount
|
|
3549
3480
|
});
|
|
3550
3481
|
}
|
|
3551
|
-
console.timeEnd('updateStateAmountToRemaining: updateStateAmountToRemaining');
|
|
3552
3482
|
if (!hasStateChanged) {
|
|
3553
3483
|
this.logInfo('状态无需更新,当前值已是最新:', {
|
|
3554
3484
|
stateAmount: currentStateAmount,
|
|
@@ -3558,28 +3488,28 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3558
3488
|
|
|
3559
3489
|
// 检查订单支付完成(复用已获取的数据)
|
|
3560
3490
|
if (!checkOrder) {
|
|
3561
|
-
_context36.next =
|
|
3491
|
+
_context36.next = 34;
|
|
3562
3492
|
break;
|
|
3563
3493
|
}
|
|
3564
|
-
_context36.next =
|
|
3494
|
+
_context36.next = 32;
|
|
3565
3495
|
return this.checkOrderPaymentCompletionOptimized(paymentItems, remainingAmount);
|
|
3566
|
-
case
|
|
3567
|
-
_context36.next =
|
|
3496
|
+
case 32:
|
|
3497
|
+
_context36.next = 35;
|
|
3568
3498
|
break;
|
|
3569
|
-
case
|
|
3499
|
+
case 34:
|
|
3570
3500
|
this.logInfo('外部传入无需 checkOrder,不执行订单支付完成检测和同步');
|
|
3571
|
-
case
|
|
3572
|
-
_context36.next =
|
|
3501
|
+
case 35:
|
|
3502
|
+
_context36.next = 40;
|
|
3573
3503
|
break;
|
|
3574
|
-
case
|
|
3575
|
-
_context36.prev =
|
|
3504
|
+
case 37:
|
|
3505
|
+
_context36.prev = 37;
|
|
3576
3506
|
_context36.t0 = _context36["catch"](1);
|
|
3577
3507
|
this.logError('更新 stateAmount 为剩余金额失败:', _context36.t0);
|
|
3578
|
-
case
|
|
3508
|
+
case 40:
|
|
3579
3509
|
case "end":
|
|
3580
3510
|
return _context36.stop();
|
|
3581
3511
|
}
|
|
3582
|
-
}, _callee36, this, [[1,
|
|
3512
|
+
}, _callee36, this, [[1, 37]]);
|
|
3583
3513
|
}));
|
|
3584
3514
|
function updateStateAmountToRemaining() {
|
|
3585
3515
|
return _updateStateAmountToRemaining.apply(this, arguments);
|
|
@@ -4210,11 +4140,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4210
4140
|
resolveInFlight,
|
|
4211
4141
|
rejectInFlight,
|
|
4212
4142
|
inFlightPromise,
|
|
4143
|
+
_this$store$currentOr26,
|
|
4213
4144
|
_this$store$currentOr27,
|
|
4214
|
-
_this$store$currentOr28,
|
|
4215
4145
|
_this$store$currentCu2,
|
|
4216
4146
|
_this$otherParams2,
|
|
4217
|
-
_this$store$
|
|
4147
|
+
_this$store$currentOr28,
|
|
4218
4148
|
_this$store$localOrde,
|
|
4219
4149
|
_this$store$localOrde2,
|
|
4220
4150
|
_checkoutResponse12,
|
|
@@ -4331,7 +4261,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4331
4261
|
})
|
|
4332
4262
|
});
|
|
4333
4263
|
}); // 确定最终的定金金额:优先使用手动设置的值,否则从支付项中计算
|
|
4334
|
-
manualDepositAmount = ((_this$store$
|
|
4264
|
+
manualDepositAmount = ((_this$store$currentOr26 = this.store.currentOrder) === null || _this$store$currentOr26 === void 0 ? void 0 : _this$store$currentOr26.deposit_amount) || '0.00'; // 优先级逻辑:手动设置的定金金额 > 从支付项计算的金额
|
|
4335
4265
|
manualDepositValue = new Decimal(manualDepositAmount);
|
|
4336
4266
|
if (manualDepositValue.gt(0)) {
|
|
4337
4267
|
// 如果手动设置了定金金额且大于0,使用手动设置的值
|
|
@@ -4391,7 +4321,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4391
4321
|
}),
|
|
4392
4322
|
manualDepositAmount: manualDepositAmount,
|
|
4393
4323
|
finalDepositAmount: finalDepositAmount,
|
|
4394
|
-
isDeposit: ((_this$store$
|
|
4324
|
+
isDeposit: ((_this$store$currentOr27 = this.store.currentOrder) === null || _this$store$currentOr27 === void 0 ? void 0 : _this$store$currentOr27.is_deposit) || 0
|
|
4395
4325
|
});
|
|
4396
4326
|
|
|
4397
4327
|
// 计算订单状态,优先读取外面传递的,如果没有则根据订单支付数据来
|
|
@@ -4439,7 +4369,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4439
4369
|
currency_symbol: this.otherParams.currency_symbol,
|
|
4440
4370
|
currency_format: this.otherParams.currency_format,
|
|
4441
4371
|
business_code: ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.business_code) || undefined,
|
|
4442
|
-
is_deposit: ((_this$store$
|
|
4372
|
+
is_deposit: ((_this$store$currentOr28 = this.store.currentOrder) !== null && _this$store$currentOr28 !== void 0 && _this$store$currentOr28.is_deposit || Number(finalDepositAmount) > 0 ? 1 : 0) || 0,
|
|
4443
4373
|
deposit_amount: finalDepositAmount,
|
|
4444
4374
|
// 使用最终确定的定金金额(手动设置优先)
|
|
4445
4375
|
product_tax_fee: this.store.localOrderData.tax_fee,
|
|
@@ -5082,8 +5012,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5082
5012
|
case 6:
|
|
5083
5013
|
// 取消注册模块
|
|
5084
5014
|
this.core.unregisterModule(this);
|
|
5085
|
-
|
|
5086
|
-
case 8:
|
|
5015
|
+
case 7:
|
|
5087
5016
|
case "end":
|
|
5088
5017
|
return _context46.stop();
|
|
5089
5018
|
}
|
|
@@ -5110,8 +5039,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5110
5039
|
uuid: this.store.currentOrder.uuid,
|
|
5111
5040
|
orderId: this.store.currentOrder.order_id
|
|
5112
5041
|
} : null;
|
|
5113
|
-
console.log('[Checkout] 重置 store 状态,准备创建新订单', prevOrderInfo);
|
|
5114
|
-
|
|
5115
5042
|
// 重置订单相关的 store 状态(保留 paymentMethods,因为支付方式数据变更不频繁)
|
|
5116
5043
|
this.store.currentOrder = undefined;
|
|
5117
5044
|
this.store.localOrderData = undefined;
|
|
@@ -5133,8 +5060,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5133
5060
|
|
|
5134
5061
|
// 注意:故意保留 this.store.paymentMethods,因为支付方式数据不易变更,保留在内存中提高性能
|
|
5135
5062
|
|
|
5136
|
-
console.log('[Checkout] Store 状态重置完成');
|
|
5137
|
-
|
|
5138
5063
|
// 🚀 性能优化:异步触发订单清理事件(不阻塞主流程)
|
|
5139
5064
|
// 使用 setTimeout 确保事件处理不会阻塞状态重置
|
|
5140
5065
|
if (prevOrderInfo) {
|