@pisell/pisellos 2.3.74 → 2.3.76

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.
Files changed (283) hide show
  1. package/dist/core/index.js +6 -10
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  4. package/dist/model/strategy/strategy-example.js +5 -19
  5. package/dist/modules/Cart/index.js +0 -3
  6. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  7. package/dist/modules/Date/index.js +1 -5
  8. package/dist/modules/Discount/index.js +2 -4
  9. package/dist/modules/OpenData/index.js +0 -2
  10. package/dist/modules/Order/index.d.ts +1 -1
  11. package/dist/modules/Order/index.js +75 -91
  12. package/dist/modules/Order/types.d.ts +3 -1
  13. package/dist/modules/Payment/index.js +97 -162
  14. package/dist/modules/Rules/index.js +1 -4
  15. package/dist/modules/Schedule/index.js +0 -1
  16. package/dist/modules/Schedule/utils.js +0 -1
  17. package/dist/modules/Step/index.js +0 -1
  18. package/dist/plugins/request.js +1 -4
  19. package/dist/plugins/window.js +2 -6
  20. package/dist/server/index.js +97 -129
  21. package/dist/server/modules/menu/index.js +32 -41
  22. package/dist/server/modules/order/index.js +2 -4
  23. package/dist/server/modules/products/index.js +24 -42
  24. package/dist/server/modules/quotation/index.js +29 -38
  25. package/dist/server/modules/resource/index.js +3 -4
  26. package/dist/server/modules/schedule/index.js +27 -35
  27. package/dist/server/utils/product.js +0 -1
  28. package/dist/solution/BaseSales/index.js +100 -72
  29. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  30. package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
  31. package/dist/solution/BookingByStep/index.js +7 -59
  32. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  33. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  34. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  35. package/dist/solution/BookingTicket/index.js +0 -2
  36. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  37. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  38. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  39. package/dist/solution/BuyTickets/index.js +9 -12
  40. package/dist/solution/Checkout/index.js +177 -252
  41. package/dist/solution/Checkout/utils/index.js +4 -16
  42. package/dist/solution/RegisterAndLogin/index.js +30 -76
  43. package/dist/solution/ScanOrder/index.js +50 -60
  44. package/dist/solution/ShopDiscount/index.js +2 -7
  45. package/dist/solution/VenueBooking/index.js +45 -55
  46. package/dist/utils/task.js +15 -18
  47. package/dist/utils/watch.js +0 -1
  48. package/lib/apis/picoding.js +2 -0
  49. package/lib/core/index.js +134 -134
  50. package/lib/effects/index.js +46 -57
  51. package/lib/index.js +82 -49
  52. package/lib/model/index.js +14 -21
  53. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  54. package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
  55. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  56. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  57. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  58. package/lib/model/strategy/adapter/index.js +100 -64
  59. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  60. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  61. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  62. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  63. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  64. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  65. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  66. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  67. package/lib/model/strategy/adapter/promotion/index.js +1 -0
  68. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  69. package/lib/model/strategy/adapter/type.js +4 -16
  70. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  71. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  72. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  73. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  74. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  75. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  76. package/lib/model/strategy/engine.js +270 -168
  77. package/lib/model/strategy/index.js +49 -34
  78. package/lib/model/strategy/strategy-example.js +243 -239
  79. package/lib/model/strategy/type.js +100 -40
  80. package/lib/modules/Account/index.js +39 -53
  81. package/lib/modules/Account/types.js +20 -33
  82. package/lib/modules/AccountList/index.js +116 -154
  83. package/lib/modules/AccountList/types.js +30 -31
  84. package/lib/modules/AccountList/utils.js +18 -30
  85. package/lib/modules/BaseModule.js +23 -42
  86. package/lib/modules/BookingContext/index.js +158 -136
  87. package/lib/modules/BookingContext/types.js +46 -32
  88. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  89. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  90. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  91. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  92. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  93. package/lib/modules/BookingContext/utils/index.js +124 -41
  94. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  95. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  96. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  97. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  98. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  99. package/lib/modules/BookingContext/utils/resources.js +209 -167
  100. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  101. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  102. package/lib/modules/Cart/index.js +170 -124
  103. package/lib/modules/Cart/types.js +46 -51
  104. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  105. package/lib/modules/Cart/utils/cartDate.js +56 -61
  106. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  107. package/lib/modules/Cart/utils/cartNote.js +27 -32
  108. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  109. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  110. package/lib/modules/Cart/utils/cartResource.js +70 -78
  111. package/lib/modules/Cart/utils/changePrice.js +22 -50
  112. package/lib/modules/Cart/utils/index.js +106 -48
  113. package/lib/modules/Customer/constants.js +13 -34
  114. package/lib/modules/Customer/index.js +235 -172
  115. package/lib/modules/Customer/types.js +38 -35
  116. package/lib/modules/Date/index.js +116 -115
  117. package/lib/modules/Date/types.js +16 -28
  118. package/lib/modules/Date/utils.js +174 -123
  119. package/lib/modules/Discount/index.js +122 -127
  120. package/lib/modules/Discount/types.js +9 -31
  121. package/lib/modules/Guests/index.js +30 -56
  122. package/lib/modules/Guests/types.js +23 -33
  123. package/lib/modules/Holder/index.js +209 -189
  124. package/lib/modules/Holder/types.js +4 -16
  125. package/lib/modules/Holder/utils.js +20 -49
  126. package/lib/modules/OpenData/index.js +70 -76
  127. package/lib/modules/OpenData/types.js +4 -16
  128. package/lib/modules/OpenData/utils.js +44 -78
  129. package/lib/modules/Order/index.d.ts +1 -1
  130. package/lib/modules/Order/index.js +1733 -2121
  131. package/lib/modules/Order/payment-utils.js +77 -120
  132. package/lib/modules/Order/types.d.ts +3 -1
  133. package/lib/modules/Order/types.js +88 -35
  134. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  135. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  136. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  137. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  138. package/lib/modules/Order/utils.js +814 -647
  139. package/lib/modules/Payment/cash.js +20 -33
  140. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  141. package/lib/modules/Payment/eftpos.js +16 -30
  142. package/lib/modules/Payment/index.js +532 -399
  143. package/lib/modules/Payment/mx51.js +1 -0
  144. package/lib/modules/Payment/types.js +230 -108
  145. package/lib/modules/Payment/utils.js +52 -51
  146. package/lib/modules/Payment/walletpass.js +485 -660
  147. package/lib/modules/Product/index.js +51 -46
  148. package/lib/modules/Product/types.js +4 -16
  149. package/lib/modules/Product/utils.js +32 -33
  150. package/lib/modules/ProductList/index.js +113 -123
  151. package/lib/modules/ProductList/types.js +9 -31
  152. package/lib/modules/Quotation/index.js +81 -118
  153. package/lib/modules/Quotation/types.js +4 -16
  154. package/lib/modules/Resource/index.js +27 -59
  155. package/lib/modules/Resource/types.js +22 -32
  156. package/lib/modules/Resource/utils.js +30 -38
  157. package/lib/modules/ResourcePlanner/index.js +25 -23
  158. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  159. package/lib/modules/ResourcePlanner/planner.js +589 -770
  160. package/lib/modules/ResourcePlanner/types.js +10 -29
  161. package/lib/modules/Rules/index.js +1218 -959
  162. package/lib/modules/Rules/types.js +17 -40
  163. package/lib/modules/SalesSummary/index.js +85 -90
  164. package/lib/modules/SalesSummary/types.js +4 -16
  165. package/lib/modules/SalesSummary/utils.js +355 -430
  166. package/lib/modules/ScanOrderLogger/index.js +59 -79
  167. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  168. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  169. package/lib/modules/ScanOrderLogger/types.js +4 -16
  170. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  171. package/lib/modules/Schedule/index.js +100 -114
  172. package/lib/modules/Schedule/type.js +4 -16
  173. package/lib/modules/Schedule/types.js +4 -16
  174. package/lib/modules/Schedule/utils.js +433 -291
  175. package/lib/modules/Step/index.js +40 -52
  176. package/lib/modules/Step/tyeps.js +4 -16
  177. package/lib/modules/Summary/index.js +66 -71
  178. package/lib/modules/Summary/types.js +4 -16
  179. package/lib/modules/Summary/utils.js +773 -418
  180. package/lib/modules/SurchargeList/index.js +46 -60
  181. package/lib/modules/SurchargeList/types.js +4 -16
  182. package/lib/modules/index.js +245 -63
  183. package/lib/plugins/app.js +4 -16
  184. package/lib/plugins/index.js +36 -25
  185. package/lib/plugins/request.js +137 -126
  186. package/lib/plugins/shopStore.js +4 -16
  187. package/lib/plugins/user.js +4 -16
  188. package/lib/plugins/window.js +171 -179
  189. package/lib/server/index.js +3050 -2665
  190. package/lib/server/modules/floor-plan/index.js +118 -134
  191. package/lib/server/modules/floor-plan/types.js +15 -30
  192. package/lib/server/modules/index.js +106 -68
  193. package/lib/server/modules/menu/index.js +142 -122
  194. package/lib/server/modules/menu/types.js +18 -31
  195. package/lib/server/modules/order/index.js +784 -1002
  196. package/lib/server/modules/order/types.js +122 -33
  197. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  198. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  199. package/lib/server/modules/payment/index.js +59 -83
  200. package/lib/server/modules/payment/types.js +4 -16
  201. package/lib/server/modules/products/index.js +583 -471
  202. package/lib/server/modules/products/types.js +44 -34
  203. package/lib/server/modules/quotation/index.js +137 -172
  204. package/lib/server/modules/quotation/types.js +21 -31
  205. package/lib/server/modules/resource/index.js +220 -186
  206. package/lib/server/modules/resource/types.js +42 -33
  207. package/lib/server/modules/schedule/index.js +135 -123
  208. package/lib/server/modules/schedule/types.js +14 -21
  209. package/lib/server/modules/schedule/utils.js +334 -163
  210. package/lib/server/types.js +4 -16
  211. package/lib/server/utils/index.js +25 -23
  212. package/lib/server/utils/product.js +196 -139
  213. package/lib/server/utils/schedule.js +34 -41
  214. package/lib/server/utils/small-ticket.js +479 -456
  215. package/lib/server/utils/time.js +40 -49
  216. package/lib/solution/BaseSales/index.js +1220 -1412
  217. package/lib/solution/BaseSales/types.js +42 -38
  218. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  219. package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
  220. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  221. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  222. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
  223. package/lib/solution/BaseSales/utils.js +158 -143
  224. package/lib/solution/BookingByStep/index.js +1527 -1340
  225. package/lib/solution/BookingByStep/types.js +40 -99
  226. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  227. package/lib/solution/BookingByStep/utils/products.js +42 -52
  228. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  229. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  230. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  231. package/lib/solution/BookingTicket/index.js +607 -522
  232. package/lib/solution/BookingTicket/types.js +99 -77
  233. package/lib/solution/BookingTicket/utils/addProductDecision.js +226 -189
  234. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  235. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  236. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  237. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  238. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  239. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  240. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  241. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  242. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  243. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  244. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  245. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  246. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  247. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  248. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  249. package/lib/solution/BuyTickets/index.js +67 -70
  250. package/lib/solution/BuyTickets/types.js +22 -38
  251. package/lib/solution/Checkout/index.js +1451 -1158
  252. package/lib/solution/Checkout/types.js +91 -61
  253. package/lib/solution/Checkout/utils/index.js +228 -156
  254. package/lib/solution/PlaceOrder/index.js +55 -0
  255. package/lib/solution/RegisterAndLogin/config.js +493 -460
  256. package/lib/solution/RegisterAndLogin/index.js +633 -630
  257. package/lib/solution/RegisterAndLogin/types.js +189 -76
  258. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  259. package/lib/solution/Sales/index.js +328 -324
  260. package/lib/solution/Sales/types.js +27 -33
  261. package/lib/solution/ScanOrder/index.js +832 -864
  262. package/lib/solution/ScanOrder/types.js +33 -34
  263. package/lib/solution/ScanOrder/utils.js +409 -374
  264. package/lib/solution/ShopDiscount/index.js +226 -232
  265. package/lib/solution/ShopDiscount/types.js +15 -37
  266. package/lib/solution/ShopDiscount/utils.js +300 -172
  267. package/lib/solution/UnifiedBookingSales/index.js +1035 -1201
  268. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  269. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  270. package/lib/solution/VenueBooking/index.js +811 -879
  271. package/lib/solution/VenueBooking/types.js +19 -39
  272. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  273. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  274. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  275. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  276. package/lib/solution/VenueBooking/utils.js +130 -67
  277. package/lib/solution/index.js +124 -41
  278. package/lib/store/createStore.js +32 -29
  279. package/lib/types/index.js +4 -16
  280. package/lib/utils/payment-number.js +26 -46
  281. package/lib/utils/task.js +36 -36
  282. package/lib/utils/watch.js +81 -47
  283. 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 18:
124
+ case 17:
132
125
  this.logInfo('CheckoutModule initialized successfully');
133
- case 19:
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 2:
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 2:
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
- console.log('[Checkout] 结账流程初始化完成');
356
- _context7.next = 14;
343
+ _context7.next = 13;
357
344
  break;
358
- case 9:
359
- _context7.prev = 9;
345
+ case 8:
346
+ _context7.prev = 8;
360
347
  _context7.t0 = _context7["catch"](1);
361
- _context7.next = 13;
348
+ _context7.next = 12;
362
349
  return this.handleError(_context7.t0, CheckoutErrorType.UnknownError);
363
- case 13:
350
+ case 12:
364
351
  throw _context7.t0;
365
- case 14:
352
+ case 13:
366
353
  case "end":
367
354
  return _context7.stop();
368
355
  }
369
- }, _callee7, this, [[1, 9]]);
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 16:
1109
- _context11.prev = 16;
1091
+ case 15:
1092
+ _context11.prev = 15;
1110
1093
  _context11.t0 = _context11["catch"](0);
1111
- _context11.next = 20;
1094
+ _context11.next = 19;
1112
1095
  return this.handleError(_context11.t0, CheckoutErrorType.UnknownError);
1113
- case 20:
1096
+ case 19:
1114
1097
  return _context11.abrupt("return", {
1115
1098
  success: false
1116
1099
  });
1117
- case 21:
1100
+ case 20:
1118
1101
  case "end":
1119
1102
  return _context11.stop();
1120
1103
  }
1121
- }, _callee11, this, [[0, 16]]);
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 = 5;
1181
+ _context12.next = 4;
1200
1182
  break;
1201
1183
  }
1202
- console.log('[Checkout] 当前没有活跃订单,无法获取支付项');
1203
1184
  return _context12.abrupt("return", []);
1204
- case 5:
1205
- _context12.next = 7;
1185
+ case 4:
1186
+ _context12.next = 6;
1206
1187
  return this.payment.getPaymentItemsAsync(_currentOrder2.uuid);
1207
- case 7:
1188
+ case 6:
1208
1189
  paymentItems = _context12.sent;
1209
1190
  return _context12.abrupt("return", paymentItems);
1210
- case 11:
1211
- _context12.prev = 11;
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 15:
1196
+ case 14:
1216
1197
  case "end":
1217
1198
  return _context12.stop();
1218
1199
  }
1219
- }, _callee12, this, [[0, 11]]);
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 = 20;
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 = 20;
1286
+ _context13.next = 19;
1311
1287
  return this.updateStateAmountToRemaining(false);
1312
- case 20:
1288
+ case 19:
1313
1289
  return _context13.abrupt("return", updatedOrder);
1314
- case 23:
1315
- _context13.prev = 23;
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 = 28;
1294
+ _context13.next = 27;
1319
1295
  return this.handleError(_context13.t0, CheckoutErrorType.UnknownError);
1320
- case 28:
1296
+ case 27:
1321
1297
  return _context13.abrupt("return", null);
1322
- case 29:
1298
+ case 28:
1323
1299
  case "end":
1324
1300
  return _context13.stop();
1325
1301
  }
1326
- }, _callee13, this, [[0, 23]]);
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 = 10;
1949
+ _context19.next = 9;
1974
1950
  break;
1975
1951
  }
1976
- console.log('[Checkout] 定金状态无变化,跳过更新');
1977
1952
  return _context19.abrupt("return");
1978
- case 10:
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 = 15;
1972
+ _context19.next = 14;
1998
1973
  return this.payment.updateOrderAsync(this.store.currentOrder.uuid, updateParams);
1999
- case 15:
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 = 21;
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 21:
1993
+ case 20:
2019
1994
  this.logInfo('订单定金状态更新成功:', {
2020
1995
  isDeposit: newDepositValue,
2021
1996
  depositAmount: this.store.currentOrder.deposit_amount
2022
1997
  });
2023
- _context19.next = 30;
1998
+ _context19.next = 29;
2024
1999
  break;
2025
- case 24:
2026
- _context19.prev = 24;
2000
+ case 23:
2001
+ _context19.prev = 23;
2027
2002
  _context19.t0 = _context19["catch"](0);
2028
2003
  this.logError('更新订单定金状态失败:', _context19.t0);
2029
- _context19.next = 29;
2004
+ _context19.next = 28;
2030
2005
  return this.handleError(_context19.t0, CheckoutErrorType.ValidationFailed);
2031
- case 29:
2006
+ case 28:
2032
2007
  throw _context19.t0;
2033
- case 30:
2008
+ case 29:
2034
2009
  case "end":
2035
2010
  return _context19.stop();
2036
2011
  }
2037
- }, _callee19, this, [[0, 24]]);
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 = 2;
2175
+ _context21.prev = 1;
2202
2176
  if (this.store.currentOrder) {
2203
- _context21.next = 5;
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 5:
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 = 14;
2194
+ _context21.next = 13;
2221
2195
  return this.calculateRemainingAmountAsync();
2222
- case 14:
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
- console.time('manualSyncOrderAsync');
2232
-
2233
- // 强制同步订单到后端,并获取完整响应数据
2234
- _context21.next = 20;
2205
+ _context21.next = 18;
2235
2206
  return this.syncOrderToBackendWithReturn(true);
2236
- case 20:
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 = 30;
2229
+ _context21.next = 27;
2260
2230
  return this.updateStateAmountToRemaining(false);
2261
- case 30:
2231
+ case 27:
2262
2232
  return _context21.abrupt("return", newRes);
2263
- case 33:
2264
- _context21.prev = 33;
2265
- _context21.t6 = _context21["catch"](2);
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 38:
2243
+ case 35:
2274
2244
  case "end":
2275
2245
  return _context21.stop();
2276
2246
  }
2277
- }, _callee21, this, [[2, 33]]);
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, _this$store$currentOr24, oldNote, orderInPayment;
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 = 17;
2531
+ _context24.next = 16;
2575
2532
  break;
2576
2533
  }
2577
- _context24.prev = 7;
2578
- _context24.next = 10;
2534
+ _context24.prev = 6;
2535
+ _context24.next = 9;
2579
2536
  return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
2580
- case 10:
2537
+ case 9:
2581
2538
  orderInPayment = _context24.sent;
2582
- if (orderInPayment && orderInPayment.note !== undefined) {
2583
- // 使用Payment模块的更新方法(如果有的话)
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 14:
2590
- _context24.prev = 14;
2591
- _context24.t0 = _context24["catch"](7);
2542
+ case 13:
2543
+ _context24.prev = 13;
2544
+ _context24.t0 = _context24["catch"](6);
2592
2545
  console.warn('[Checkout] 同步备注到Payment模块失败,但本地更新成功:', _context24.t0);
2593
- case 17:
2594
- _context24.next = 19;
2546
+ case 16:
2547
+ _context24.next = 18;
2595
2548
  return this.core.effects.emit("".concat(this.name, ":onOrderNoteChanged"), {
2596
- orderUuid: (_this$store$currentOr24 = this.store.currentOrder) === null || _this$store$currentOr24 === void 0 ? void 0 : _this$store$currentOr24.uuid,
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 19:
2602
- console.log('[Checkout] 订单备注更新成功:', {
2603
- oldNote: oldNote,
2604
- newNote: note
2605
- });
2606
- _context24.next = 28;
2554
+ case 18:
2555
+ _context24.next = 26;
2607
2556
  break;
2608
- case 22:
2609
- _context24.prev = 22;
2557
+ case 20:
2558
+ _context24.prev = 20;
2610
2559
  _context24.t1 = _context24["catch"](0);
2611
2560
  console.error('[Checkout] 更新订单备注失败:', _context24.t1);
2612
- _context24.next = 27;
2561
+ _context24.next = 25;
2613
2562
  return this.handleError(_context24.t1, CheckoutErrorType.ValidationFailed);
2614
- case 27:
2563
+ case 25:
2615
2564
  throw _context24.t1;
2616
- case 28:
2565
+ case 26:
2617
2566
  case "end":
2618
2567
  return _context24.stop();
2619
2568
  }
2620
- }, _callee24, this, [[0, 22], [7, 14]]);
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$currentOr25;
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$currentOr25 = this.store.currentOrder) === null || _this$store$currentOr25 === void 0 ? void 0 : _this$store$currentOr25.total_amount) || '0',
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$currentOr26;
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$currentOr26 = this.store.currentOrder) === null || _this$store$currentOr26 === void 0 ? void 0 : _this$store$currentOr26.total_amount) || '0',
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
- console.log('[Checkout] 预加载支付方式...');
2842
- _context29.next = 4;
2790
+ _context29.next = 3;
2843
2791
  return this.payment.getPayMethodListAsync();
2844
- case 4:
2792
+ case 3:
2845
2793
  methods = _context29.sent;
2846
2794
  this.store.paymentMethods = methods;
2847
- console.log("[Checkout] \u9884\u52A0\u8F7D\u5B8C\u6210\uFF0C\u5171 ".concat(methods.length, " \u79CD\u652F\u4ED8\u65B9\u5F0F"));
2848
- _context29.next = 13;
2795
+ _context29.next = 11;
2849
2796
  break;
2850
- case 9:
2851
- _context29.prev = 9;
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 13:
2802
+ case 11:
2856
2803
  case "end":
2857
2804
  return _context29.stop();
2858
2805
  }
2859
- }, _callee29, this, [[0, 9]]);
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 = 8;
2835
+ _context30.next = 7;
2889
2836
  break;
2890
2837
  }
2891
- console.log('[Checkout] 订单数据清理功能已禁用');
2892
2838
  return _context30.abrupt("return");
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;
2839
+ case 7:
2840
+ _context30.next = 9;
2898
2841
  return this.payment.getOrderListAsync();
2899
- case 11:
2842
+ case 9:
2900
2843
  allOrders = _context30.sent;
2901
2844
  if (!(!allOrders || allOrders.length === 0)) {
2902
- _context30.next = 15;
2845
+ _context30.next = 12;
2903
2846
  break;
2904
2847
  }
2905
- console.log('[Checkout] 没有找到需要清理的订单数据');
2906
2848
  return _context30.abrupt("return");
2907
- case 15:
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 = 20;
2855
+ _context30.prev = 17;
2914
2856
  _iterator.s();
2915
- case 22:
2857
+ case 19:
2916
2858
  if ((_step = _iterator.n()).done) {
2917
- _context30.next = 41;
2859
+ _context30.next = 38;
2918
2860
  break;
2919
2861
  }
2920
2862
  order = _step.value;
2921
- _context30.prev = 24;
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 = 28;
2867
+ _context30.next = 25;
2926
2868
  break;
2927
2869
  }
2928
- return _context30.abrupt("continue", 39);
2929
- case 28:
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 = 32;
2884
+ _context30.next = 29;
2943
2885
  break;
2944
2886
  }
2945
- return _context30.abrupt("continue", 39);
2946
- case 32:
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 = 39;
2898
+ _context30.next = 36;
2957
2899
  break;
2958
- case 35:
2959
- _context30.prev = 35;
2960
- _context30.t0 = _context30["catch"](24);
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", 39);
2963
- case 39:
2964
- _context30.next = 22;
2904
+ return _context30.abrupt("continue", 36);
2905
+ case 36:
2906
+ _context30.next = 19;
2965
2907
  break;
2966
- case 41:
2967
- _context30.next = 46;
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(46);
2977
- case 49:
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 = 52;
2926
+ _context30.prev = 49;
2985
2927
  _iterator2.s();
2986
- case 54:
2928
+ case 51:
2987
2929
  if ((_step2 = _iterator2.n()).done) {
2988
- _context30.next = 68;
2930
+ _context30.next = 64;
2989
2931
  break;
2990
2932
  }
2991
2933
  orderInfo = _step2.value;
2992
- _context30.prev = 56;
2993
- _context30.next = 59;
2934
+ _context30.prev = 53;
2935
+ _context30.next = 56;
2994
2936
  return this.payment.deletePaymentOrderAsync(orderInfo.uuid);
2995
- case 59:
2937
+ case 56:
2996
2938
  deletedCount++;
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;
2939
+ _context30.next = 62;
2999
2940
  break;
3000
- case 63:
3001
- _context30.prev = 63;
3002
- _context30.t2 = _context30["catch"](56);
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 66:
3005
- _context30.next = 54;
2945
+ case 62:
2946
+ _context30.next = 51;
3006
2947
  break;
3007
- case 68:
3008
- _context30.next = 73;
2948
+ case 64:
2949
+ _context30.next = 69;
3009
2950
  break;
3010
- case 70:
3011
- _context30.prev = 70;
3012
- _context30.t3 = _context30["catch"](52);
2951
+ case 66:
2952
+ _context30.prev = 66;
2953
+ _context30.t3 = _context30["catch"](49);
3013
2954
  _iterator2.e(_context30.t3);
3014
- case 73:
3015
- _context30.prev = 73;
2955
+ case 69:
2956
+ _context30.prev = 69;
3016
2957
  _iterator2.f();
3017
- return _context30.finish(73);
3018
- case 76:
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
- 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;
2971
+ if (ordersToDelete.length > maxOrdersToDelete) {} else {}
2972
+ _context30.next = 82;
3036
2973
  break;
3037
- case 81:
3038
- _context30.prev = 81;
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 86:
2982
+ case 82:
3046
2983
  case "end":
3047
2984
  return _context30.stop();
3048
2985
  }
3049
- }, _callee30, this, [[0, 81], [20, 43, 46, 49], [24, 35], [52, 70, 73, 76], [56, 63]]);
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
- console.time('updateStateAmountToRemaining');
3448
- // 🚀 性能优化:一次性批量获取所有需要的数据
3449
- _context36.next = 7;
3384
+ _context36.next = 6;
3450
3385
  return this.fetchOrderDataBatch();
3451
- case 7:
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 = 14;
3391
+ _context36.next = 12;
3458
3392
  break;
3459
3393
  }
3460
3394
  this.logWarning('updateStateAmountToRemaining: 未找到当前订单');
3461
3395
  return _context36.abrupt("return");
3462
- case 14:
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 = 28;
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 = 27;
3438
+ _context36.next = 25;
3505
3439
  return this.payment.updateOrderAsync(this.store.currentOrder.uuid, {
3506
3440
  is_deposit: 0
3507
3441
  });
3508
- case 27:
3442
+ case 25:
3509
3443
  hasStateChanged = true;
3510
- case 28:
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 = 40;
3491
+ _context36.next = 34;
3562
3492
  break;
3563
3493
  }
3564
- _context36.next = 38;
3494
+ _context36.next = 32;
3565
3495
  return this.checkOrderPaymentCompletionOptimized(paymentItems, remainingAmount);
3566
- case 38:
3567
- _context36.next = 41;
3496
+ case 32:
3497
+ _context36.next = 35;
3568
3498
  break;
3569
- case 40:
3499
+ case 34:
3570
3500
  this.logInfo('外部传入无需 checkOrder,不执行订单支付完成检测和同步');
3571
- case 41:
3572
- _context36.next = 46;
3501
+ case 35:
3502
+ _context36.next = 40;
3573
3503
  break;
3574
- case 43:
3575
- _context36.prev = 43;
3504
+ case 37:
3505
+ _context36.prev = 37;
3576
3506
  _context36.t0 = _context36["catch"](1);
3577
3507
  this.logError('更新 stateAmount 为剩余金额失败:', _context36.t0);
3578
- case 46:
3508
+ case 40:
3579
3509
  case "end":
3580
3510
  return _context36.stop();
3581
3511
  }
3582
- }, _callee36, this, [[1, 43]]);
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$currentOr29,
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$currentOr27 = this.store.currentOrder) === null || _this$store$currentOr27 === void 0 ? void 0 : _this$store$currentOr27.deposit_amount) || '0.00'; // 优先级逻辑:手动设置的定金金额 > 从支付项计算的金额
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$currentOr28 = this.store.currentOrder) === null || _this$store$currentOr28 === void 0 ? void 0 : _this$store$currentOr28.is_deposit) || 0
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$currentOr29 = this.store.currentOrder) !== null && _this$store$currentOr29 !== void 0 && _this$store$currentOr29.is_deposit || Number(finalDepositAmount) > 0 ? 1 : 0) || 0,
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
- console.log('[Checkout] 已销毁');
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) {