@pisell/pisellos 2.1.100 → 2.1.101

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 (80) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/modules/Customer/types.d.ts +1 -1
  3. package/dist/modules/Payment/types.d.ts +7 -7
  4. package/dist/modules/Rules/types.d.ts +1 -1
  5. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  6. package/dist/modules/Schedule/type.d.ts +7 -7
  7. package/dist/modules/Schedule/types.d.ts +9 -9
  8. package/dist/solution/BookingByStep/index.d.ts +1 -1
  9. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  10. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  11. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  12. package/dist/types/index.d.ts +1 -1
  13. package/dist/utils/task.d.ts +2 -2
  14. package/dist/utils/watch.d.ts +2 -2
  15. package/lib/core/index.js +28 -27
  16. package/lib/effects/index.d.ts +2 -2
  17. package/lib/effects/index.js +7 -3
  18. package/lib/modules/Account/index.js +10 -9
  19. package/lib/modules/AccountList/index.js +11 -14
  20. package/lib/modules/BaseModule.js +3 -6
  21. package/lib/modules/Cart/index.js +9 -14
  22. package/lib/modules/Cart/utils/cartProduct.js +6 -3
  23. package/lib/modules/Customer/constants.js +1 -1
  24. package/lib/modules/Customer/index.js +15 -18
  25. package/lib/modules/Customer/types.d.ts +1 -1
  26. package/lib/modules/Date/index.js +6 -10
  27. package/lib/modules/Date/types.js +0 -1
  28. package/lib/modules/Discount/index.js +6 -11
  29. package/lib/modules/Guests/index.js +15 -10
  30. package/lib/modules/Order/index.js +7 -10
  31. package/lib/modules/Payment/cash.js +1 -1
  32. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  33. package/lib/modules/Payment/eftpos.js +1 -1
  34. package/lib/modules/Payment/index.js +73 -84
  35. package/lib/modules/Payment/types.d.ts +7 -7
  36. package/lib/modules/Payment/utils.js +6 -3
  37. package/lib/modules/Payment/walletpass.js +31 -31
  38. package/lib/modules/Product/index.js +5 -6
  39. package/lib/modules/ProductList/index.js +3 -5
  40. package/lib/modules/Resource/index.js +12 -8
  41. package/lib/modules/Rules/index.js +35 -21
  42. package/lib/modules/Rules/types.d.ts +1 -1
  43. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  44. package/lib/modules/Schedule/index.js +5 -8
  45. package/lib/modules/Schedule/type.d.ts +7 -7
  46. package/lib/modules/Schedule/types.d.ts +9 -9
  47. package/lib/modules/Schedule/utils.js +4 -2
  48. package/lib/modules/Step/index.js +4 -7
  49. package/lib/modules/Summary/index.js +4 -9
  50. package/lib/modules/Summary/utils.js +16 -8
  51. package/lib/plugins/request.js +33 -34
  52. package/lib/plugins/window.js +113 -101
  53. package/lib/solution/BookingByStep/index.d.ts +1 -1
  54. package/lib/solution/BookingByStep/index.js +177 -110
  55. package/lib/solution/BookingByStep/utils/capacity.js +16 -11
  56. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  57. package/lib/solution/BookingByStep/utils/resources.js +8 -4
  58. package/lib/solution/BookingByStep/utils/stock.js +6 -3
  59. package/lib/solution/BookingByStep/utils/timeslots.js +27 -24
  60. package/lib/solution/BookingTicket/index.js +14 -19
  61. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
  62. package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
  63. package/lib/solution/BookingTicket/utils/scan/index.js +1 -3
  64. package/lib/solution/BookingTicket/utils/scan/scanCache.js +9 -10
  65. package/lib/solution/BuyTickets/index.js +15 -15
  66. package/lib/solution/Checkout/index.js +211 -216
  67. package/lib/solution/Checkout/utils/index.js +22 -18
  68. package/lib/solution/RegisterAndLogin/config.js +2 -2
  69. package/lib/solution/RegisterAndLogin/index.js +110 -114
  70. package/lib/solution/RegisterAndLogin/utils.js +9 -9
  71. package/lib/solution/ShopDiscount/index.js +13 -16
  72. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  73. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  74. package/lib/solution/ShopDiscount/utils.js +2 -1
  75. package/lib/types/index.d.ts +1 -1
  76. package/lib/utils/task.d.ts +2 -2
  77. package/lib/utils/task.js +3 -3
  78. package/lib/utils/watch.d.ts +2 -2
  79. package/lib/utils/watch.js +7 -5
  80. package/package.json +17 -16
@@ -43,32 +43,26 @@ var import_utils = require("./utils");
43
43
  var import_utils2 = require("../../modules/Cart/utils");
44
44
  __reExport(Checkout_exports, require("./types"), module.exports);
45
45
  var CheckoutImpl = class extends import_BaseModule.BaseModule {
46
- defaultName = "checkout";
47
- defaultVersion = "1.0.0";
48
- isSolution = true;
49
- request;
50
- store;
51
- otherParams = {};
52
- logger;
53
- // LoggerManager 实例
54
- // 计算缓存(用于性能优化)
55
- calculationCache = {};
56
- // 直接挂载的模块
57
- order;
58
- payment;
59
46
  constructor(name, version) {
60
47
  super(name || "checkout", version || "1.0.0");
48
+ this.defaultName = "checkout";
49
+ this.defaultVersion = "1.0.0";
50
+ this.isSolution = true;
51
+ this.otherParams = {};
52
+ // LoggerManager 实例
53
+ // 计算缓存(用于性能优化)
54
+ this.calculationCache = {};
61
55
  }
62
56
  async initialize(core, options) {
63
57
  this.core = core;
64
58
  this.otherParams = options.otherParams || {};
65
59
  this.request = core.getPlugin("request");
66
60
  if (!this.request) {
67
- throw new Error("Checkout \u89E3\u51B3\u65B9\u6848\u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
61
+ throw new Error("Checkout 解决方案需要 request 插件支持");
68
62
  }
69
63
  const appPlugin = core.getPlugin("app");
70
64
  if (!appPlugin) {
71
- throw new Error("Checkout \u89E3\u51B3\u65B9\u6848\u9700\u8981 app \u63D2\u4EF6\u652F\u6301");
65
+ throw new Error("Checkout 解决方案需要 app 插件支持");
72
66
  }
73
67
  const app = appPlugin.getApp();
74
68
  this.logger = app.logger;
@@ -86,7 +80,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
86
80
  await this.initializeSubModules(core, options);
87
81
  await this.preloadPaymentMethods();
88
82
  await this.cleanupExpiredOrdersAsync();
89
- console.log("[Checkout] \u521D\u59CB\u5316\u5B8C\u6210");
83
+ console.log("[Checkout] 初始化完成");
90
84
  await this.core.effects.emit(`${this.name}:onCheckoutInitialized`, {
91
85
  timestamp: Date.now()
92
86
  });
@@ -162,14 +156,14 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
162
156
  this.core.effects.on(
163
157
  import_types2.PaymentHooks.OnPaymentMethodsLoaded,
164
158
  async (methods) => {
165
- console.log("[Checkout] \u6536\u5230\u652F\u4ED8\u65B9\u5F0F\u52A0\u8F7D\u5B8C\u6210\u4E8B\u4EF6:", methods.length);
159
+ console.log("[Checkout] 收到支付方式加载完成事件:", methods.length);
166
160
  this.store.paymentMethods = methods;
167
161
  }
168
162
  );
169
163
  this.core.effects.on(
170
164
  import_types2.PaymentHooks.OnPaymentMethodsChanged,
171
165
  async (data) => {
172
- console.log("[Checkout] \u6536\u5230\u652F\u4ED8\u65B9\u5F0F\u53D8\u66F4\u4E8B\u4EF6:", {
166
+ console.log("[Checkout] 收到支付方式变更事件:", {
173
167
  oldCount: data.oldMethods.length,
174
168
  newCount: data.newMethods.length
175
169
  });
@@ -192,11 +186,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
192
186
  if (!validation.valid) {
193
187
  throw (0, import_utils.createCheckoutError)(
194
188
  import_types.CheckoutErrorType.ValidationFailed,
195
- `\u53C2\u6570\u9A8C\u8BC1\u5931\u8D25: ${validation.errors.join(", ")}`
189
+ `参数验证失败: ${validation.errors.join(", ")}`
196
190
  );
197
191
  }
198
192
  this.store.cartItems = params.cartItems;
199
- console.log("[Checkout] \u7ED3\u8D26\u6D41\u7A0B\u521D\u59CB\u5316\u5B8C\u6210");
193
+ console.log("[Checkout] 结账流程初始化完成");
200
194
  } catch (error) {
201
195
  await this.handleError(error, import_types.CheckoutErrorType.UnknownError);
202
196
  throw error;
@@ -204,7 +198,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
204
198
  }
205
199
  getHolderIdFromBooking(obj) {
206
200
  var _a;
207
- if (!obj) return void 0;
201
+ if (!obj)
202
+ return void 0;
208
203
  let ret = obj.holder_id || ((_a = obj.holder) == null ? void 0 : _a.form_record);
209
204
  if (Array.isArray(ret)) {
210
205
  return ret.length > 0 ? Number(ret[0]) : void 0;
@@ -315,13 +310,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
315
310
  if (this.store.isOrderSynced) {
316
311
  walletBusinessData.payment_order_id = (_f = this.store.currentOrder) == null ? void 0 : _f.order_id;
317
312
  }
318
- this.logInfo("\u5F00\u59CB\u62C9\u53D6:initializeWalletDataFromBusinessAsync", {
313
+ this.logInfo("开始拉取:initializeWalletDataFromBusinessAsync", {
319
314
  walletBusinessData
320
315
  });
321
316
  await this.payment.wallet.initializeWalletDataFromBusinessAsync(
322
317
  walletBusinessData
323
318
  );
324
- this.logInfo("\u8C03\u7528\u7ED3\u675F:initializeWalletDataFromBusinessAsync", {
319
+ this.logInfo("调用结束:initializeWalletDataFromBusinessAsync", {
325
320
  walletBusinessData
326
321
  });
327
322
  if (!this.store.currentOrder) {
@@ -417,7 +412,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
417
412
  if (!validation.valid) {
418
413
  throw (0, import_utils.createCheckoutError)(
419
414
  import_types.CheckoutErrorType.ValidationFailed,
420
- `\u8BA2\u5355\u6570\u636E\u9A8C\u8BC1\u5931\u8D25: ${validation.errors.join(", ")}`
415
+ `订单数据验证失败: ${validation.errors.join(", ")}`
421
416
  );
422
417
  }
423
418
  const localOrderId = (0, import_utils.generateLocalOrderId)();
@@ -436,10 +431,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
436
431
  };
437
432
  if (customerInfo.customer_id || customerInfo.customer_name) {
438
433
  this.store.currentCustomer = customerInfo;
439
- console.log("[Checkout] \u4FDD\u5B58\u5BA2\u6237\u4FE1\u606F:", customerInfo);
434
+ console.log("[Checkout] 保存客户信息:", customerInfo);
440
435
  } else {
441
436
  this.store.currentCustomer = void 0;
442
- console.log("[Checkout] \u672A\u63D0\u4F9B\u5BA2\u6237\u4FE1\u606F");
437
+ console.log("[Checkout] 未提供客户信息");
443
438
  }
444
439
  const isNeedDeposit = this.checkIsNeedDepositAsync(
445
440
  params.orderData.bookings,
@@ -476,7 +471,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
476
471
  duration: `${updateAmountDuration}ms`,
477
472
  performance: updateAmountDuration > 200 ? "slow" : updateAmountDuration > 100 ? "medium" : "fast"
478
473
  });
479
- this.logInfo("\u672C\u5730\u8BA2\u5355\u521B\u5EFA\u6210\u529F:", {
474
+ this.logInfo("本地订单创建成功:", {
480
475
  localOrderId,
481
476
  uuid: paymentOrder.uuid,
482
477
  totalAmount: amountInfo.totalAmount,
@@ -491,7 +486,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
491
486
  error,
492
487
  import_types.CheckoutErrorType.OrderCreationFailed
493
488
  );
494
- this.logError("\u672C\u5730\u8BA2\u5355\u521B\u5EFA\u5931\u8D25:", error);
489
+ this.logError("本地订单创建失败:", error);
495
490
  this.core.effects.emit(`${this.name}:onOrderCreationFailed`, {
496
491
  error: this.store.lastError,
497
492
  timestamp: Date.now()
@@ -518,7 +513,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
518
513
  if (!validation.valid) {
519
514
  throw (0, import_utils.createCheckoutError)(
520
515
  import_types.CheckoutErrorType.ValidationFailed,
521
- `\u8BA2\u5355\u6570\u636E\u9A8C\u8BC1\u5931\u8D25: ${validation.errors.join(", ")}`
516
+ `订单数据验证失败: ${validation.errors.join(", ")}`
522
517
  );
523
518
  }
524
519
  const amountInfo = (0, import_utils.extractAmountFromCartSummary)(params.cartSummary);
@@ -582,11 +577,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
582
577
  if (!updated)
583
578
  throw (0, import_utils.createCheckoutError)(
584
579
  import_types.CheckoutErrorType.UnknownError,
585
- "\u8BA2\u5355\u66F4\u65B0\u5931\u8D25"
580
+ "订单更新失败"
586
581
  );
587
582
  this.store.currentOrder = updated;
588
583
  await this.updateStateAmountToRemaining(false);
589
- this.logInfo("\u672C\u5730\u8BA2\u5355\u66F4\u65B0\u6210\u529F(\u4FDD\u7559\u652F\u4ED8\u9879):", {
584
+ this.logInfo("本地订单更新成功(保留支付项):", {
590
585
  orderId: params.orderId,
591
586
  uuid: updated.uuid,
592
587
  payments: ((_m = updated.payment) == null ? void 0 : _m.length) || 0,
@@ -646,7 +641,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
646
641
  if (!this.store.currentOrder) {
647
642
  throw (0, import_utils.createCheckoutError)(
648
643
  import_types.CheckoutErrorType.ValidationFailed,
649
- "\u672A\u627E\u5230\u5F53\u524D\u8BA2\u5355"
644
+ "未找到当前订单"
650
645
  );
651
646
  }
652
647
  const order = await this.payment.getPaymentOrderByUuidAsync(
@@ -655,7 +650,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
655
650
  if (!order || order.payment_status !== import_types2.PaymentStatus.Finished) {
656
651
  throw (0, import_utils.createCheckoutError)(
657
652
  import_types.CheckoutErrorType.ValidationFailed,
658
- "\u8BA2\u5355\u652F\u4ED8\u672A\u5B8C\u6210\uFF0C\u65E0\u6CD5\u5B8C\u6210\u7ED3\u8D26"
653
+ "订单支付未完成,无法完成结账"
659
654
  );
660
655
  }
661
656
  this.payment.wallet.clearAllCache();
@@ -663,7 +658,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
663
658
  orderId: order.id,
664
659
  timestamp: Date.now()
665
660
  });
666
- console.log("[Checkout] \u7ED3\u8D26\u6D41\u7A0B\u5B8C\u6210:", order.id);
661
+ console.log("[Checkout] 结账流程完成:", order.id);
667
662
  this.resetStoreState();
668
663
  return {
669
664
  success: true,
@@ -690,7 +685,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
690
685
  try {
691
686
  const { currentOrder, cartItems, localOrderData } = this.store;
692
687
  if (!currentOrder) {
693
- console.log("[Checkout] \u5F53\u524D\u6CA1\u6709\u6D3B\u8DC3\u8BA2\u5355");
688
+ console.log("[Checkout] 当前没有活跃订单");
694
689
  return null;
695
690
  }
696
691
  const orderInfo = currentOrder.order_info || {};
@@ -713,7 +708,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
713
708
  };
714
709
  return result;
715
710
  } catch (error) {
716
- console.error("[Checkout] \u83B7\u53D6\u5F53\u524D\u8BA2\u5355\u57FA\u7840\u4FE1\u606F\u5931\u8D25:", error);
711
+ console.error("[Checkout] 获取当前订单基础信息失败:", error);
717
712
  return null;
718
713
  }
719
714
  }
@@ -726,7 +721,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
726
721
  try {
727
722
  const { currentOrder } = this.store;
728
723
  if (!currentOrder) {
729
- console.log("[Checkout] \u5F53\u524D\u6CA1\u6709\u6D3B\u8DC3\u8BA2\u5355\uFF0C\u65E0\u6CD5\u83B7\u53D6\u652F\u4ED8\u9879");
724
+ console.log("[Checkout] 当前没有活跃订单,无法获取支付项");
730
725
  return [];
731
726
  }
732
727
  const paymentItems = await this.payment.getPaymentItemsAsync(
@@ -734,7 +729,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
734
729
  );
735
730
  return paymentItems;
736
731
  } catch (error) {
737
- console.error("[Checkout] \u83B7\u53D6\u5F53\u524D\u8BA2\u5355\u652F\u4ED8\u9879\u5931\u8D25:", error);
732
+ console.error("[Checkout] 获取当前订单支付项失败:", error);
738
733
  return [];
739
734
  }
740
735
  }
@@ -761,7 +756,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
761
756
  async replaceLocalOrderIdAsync(newOrderId) {
762
757
  try {
763
758
  if (!this.store.currentOrder) {
764
- console.warn("[Checkout] \u6CA1\u6709\u5F53\u524D\u8BA2\u5355\uFF0C\u65E0\u6CD5\u66FF\u6362\u8BA2\u5355ID");
759
+ console.warn("[Checkout] 没有当前订单,无法替换订单ID");
765
760
  return null;
766
761
  }
767
762
  const updatedOrder = await this.payment.replaceOrderIdByUuidAsync(
@@ -774,7 +769,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
774
769
  order: updatedOrder,
775
770
  timestamp: Date.now()
776
771
  });
777
- console.log("[Checkout] \u672C\u5730\u8BA2\u5355ID\u66FF\u6362\u6210\u529F:", {
772
+ console.log("[Checkout] 本地订单ID替换成功:", {
778
773
  uuid: updatedOrder.uuid,
779
774
  newOrderId: updatedOrder.id
780
775
  });
@@ -783,7 +778,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
783
778
  }
784
779
  return updatedOrder;
785
780
  } catch (error) {
786
- console.error("[Checkout] \u66FF\u6362\u8BA2\u5355ID\u5931\u8D25:", error);
781
+ console.error("[Checkout] 替换订单ID失败:", error);
787
782
  await this.handleError(error, import_types.CheckoutErrorType.UnknownError);
788
783
  return null;
789
784
  }
@@ -799,14 +794,14 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
799
794
  try {
800
795
  const numAmount = parseFloat(amount);
801
796
  if (isNaN(numAmount) || numAmount < 0) {
802
- throw new Error(`\u65E0\u6548\u7684\u652F\u4ED8\u91D1\u989D: ${amount}`);
797
+ throw new Error(`无效的支付金额: ${amount}`);
803
798
  }
804
799
  const oldAmount = this.store.stateAmount;
805
800
  const formattedAmount = numAmount.toFixed(2);
806
801
  if (oldAmount === formattedAmount) {
807
802
  return;
808
803
  }
809
- this.logInfo("[Checkout] \u8BBE\u7F6E\u81EA\u5B9A\u4E49\u652F\u4ED8\u91D1\u989D:", {
804
+ this.logInfo("[Checkout] 设置自定义支付金额:", {
810
805
  oldAmount,
811
806
  newAmount: formattedAmount
812
807
  });
@@ -817,8 +812,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
817
812
  timestamp: Date.now()
818
813
  });
819
814
  } catch (error) {
820
- const errorMessage = error instanceof Error ? error.message : "\u8BBE\u7F6E\u652F\u4ED8\u91D1\u989D\u5931\u8D25";
821
- console.error("[Checkout] \u8BBE\u7F6E\u81EA\u5B9A\u4E49\u652F\u4ED8\u91D1\u989D\u5931\u8D25:", errorMessage);
815
+ const errorMessage = error instanceof Error ? error.message : "设置支付金额失败";
816
+ console.error("[Checkout] 设置自定义支付金额失败:", errorMessage);
822
817
  await this.handleError(
823
818
  new Error(errorMessage),
824
819
  import_types.CheckoutErrorType.ValidationFailed
@@ -853,10 +848,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
853
848
  */
854
849
  getCartSummary() {
855
850
  if (!this.store.cartSummary || this.store.cartSummary.length === 0) {
856
- console.warn("[Checkout] \u6CA1\u6709\u53EF\u7528\u7684\u8D2D\u7269\u8F66\u5C0F\u8BA1\u6570\u636E");
851
+ console.warn("[Checkout] 没有可用的购物车小计数据");
857
852
  return null;
858
853
  }
859
- this.logInfo("\u83B7\u53D6\u8D2D\u7269\u8F66\u5C0F\u8BA1\u6570\u636E:", {
854
+ this.logInfo("获取购物车小计数据:", {
860
855
  itemCount: this.store.cartSummary.length,
861
856
  items: this.store.cartSummary.map((item) => ({
862
857
  key: item.key,
@@ -877,20 +872,20 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
877
872
  async getPaymentMethodsAsync() {
878
873
  if (this.store.paymentMethods && this.store.paymentMethods.length > 0) {
879
874
  this.logInfo(
880
- `\u4F7F\u7528\u7F13\u5B58\u7684\u652F\u4ED8\u65B9\u5F0F\u6570\u636E\uFF0C\u5171 ${this.store.paymentMethods.length} \u79CD`
875
+ `使用缓存的支付方式数据,共 ${this.store.paymentMethods.length} 种`
881
876
  );
882
877
  return this.store.paymentMethods;
883
878
  }
884
- this.logInfo("store \u4E2D\u65E0\u7F13\u5B58\uFF0C\u4ECE Payment \u6A21\u5757\u83B7\u53D6\u652F\u4ED8\u65B9\u5F0F...");
879
+ this.logInfo("store 中无缓存,从 Payment 模块获取支付方式...");
885
880
  try {
886
881
  const methods = await this.payment.getPayMethodListAsync();
887
882
  this.store.paymentMethods = methods;
888
883
  this.logInfo(
889
- `\u4ECE Payment \u6A21\u5757\u83B7\u53D6\u5230 ${methods.length} \u79CD\u652F\u4ED8\u65B9\u5F0F\uFF0C\u5DF2\u66F4\u65B0\u7F13\u5B58`
884
+ `从 Payment 模块获取到 ${methods.length} 种支付方式,已更新缓存`
890
885
  );
891
886
  return methods;
892
887
  } catch (error) {
893
- this.logError("\u83B7\u53D6\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25:", error);
888
+ this.logError("获取支付方式失败:", error);
894
889
  return [];
895
890
  }
896
891
  }
@@ -909,7 +904,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
909
904
  if (!this.store.currentOrder) {
910
905
  throw (0, import_utils.createCheckoutError)(
911
906
  import_types.CheckoutErrorType.ValidationFailed,
912
- "\u672A\u627E\u5230\u5F53\u524D\u8BA2\u5355\uFF0C\u65E0\u6CD5\u6DFB\u52A0\u652F\u4ED8\u9879"
907
+ "未找到当前订单,无法添加支付项"
913
908
  );
914
909
  }
915
910
  const orderPaymentType = this.store.currentOrder.is_deposit === 1 ? "deposit" : "normal";
@@ -928,35 +923,35 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
928
923
  this.store.currentOrder.uuid,
929
924
  paymentItemWithType
930
925
  );
931
- this.logInfo("\u652F\u4ED8\u9879\u6DFB\u52A0\u6210\u529F");
926
+ this.logInfo("支付项添加成功");
932
927
  this.clearCalculationCache();
933
928
  await this.updateStateAmountToRemaining();
934
929
  const remainingAmount = await this.calculateRemainingAmountAsync();
935
930
  if (Number(remainingAmount) > 0) {
936
- this.logInfo("\u8BA2\u5355\u91D1\u989D\u8FD8\u6709\u5F85\u4ED8\u7684\uFF0C\u540C\u6B65 EFTPOS \u652F\u4ED8");
931
+ this.logInfo("订单金额还有待付的,同步 EFTPOS 支付");
937
932
  const isEftposPayment = ((_a = paymentItem.type) == null ? void 0 : _a.toLowerCase()) === "eftpos" || ((_b = paymentItem.code) == null ? void 0 : _b.toUpperCase().includes("EFTPOS"));
938
933
  const isCashPayment2 = paymentItem.code === "CASHMANUAL";
939
934
  const isCustomePayment = paymentItem.type === "custom";
940
- this.logInfo("EFTPOS \u652F\u4ED8\u68C0\u67E5:", {
935
+ this.logInfo("EFTPOS 支付检查:", {
941
936
  paymentCode: paymentItem.code,
942
937
  paymentType: paymentItem.type,
943
938
  isEftposPayment,
944
939
  currentOrderSynced: this.store.isOrderSynced
945
940
  });
946
941
  if (isEftposPayment || isCashPayment2 || isCustomePayment) {
947
- this.logInfo("\u68C0\u6D4B\u5230 EFTPOS \u652F\u4ED8\uFF0C\u7ACB\u5373\u540C\u6B65\u8BA2\u5355\u5230\u540E\u7AEF...");
942
+ this.logInfo("检测到 EFTPOS 支付,立即同步订单到后端...");
948
943
  try {
949
944
  const syncResult = await this.syncOrderToBackendWithReturn(true);
950
- this.logInfo("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5B8C\u6210 (\u5DF2\u6807\u8BB0\u4E3A\u624B\u52A8\u540C\u6B65):", {
945
+ this.logInfo("EFTPOS 支付后订单同步完成 (已标记为手动同步):", {
951
946
  orderId: syncResult.orderId,
952
947
  isOrderSynced: this.store.isOrderSynced,
953
948
  backendResponse: syncResult.response
954
949
  });
955
950
  } catch (error) {
956
- this.logError("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25:", error);
951
+ this.logError("EFTPOS 支付后订单同步失败:", error);
957
952
  await this.handleError(
958
953
  new Error(
959
- `EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`
954
+ `EFTPOS 支付后订单同步失败: ${error instanceof Error ? error.message : String(error)}`
960
955
  ),
961
956
  import_types.CheckoutErrorType.OrderCreationFailed
962
957
  );
@@ -971,7 +966,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
971
966
  timestamp: Date.now()
972
967
  });
973
968
  } catch (error) {
974
- this.logError("\u6DFB\u52A0\u652F\u4ED8\u9879\u5931\u8D25:", error);
969
+ this.logError("添加支付项失败:", error);
975
970
  await this.handleError(error, import_types.CheckoutErrorType.PaymentFailed);
976
971
  throw error;
977
972
  }
@@ -990,10 +985,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
990
985
  if (!this.store.currentOrder) {
991
986
  throw (0, import_utils.createCheckoutError)(
992
987
  import_types.CheckoutErrorType.ValidationFailed,
993
- "\u5F53\u524D\u6CA1\u6709\u6D3B\u8DC3\u8BA2\u5355\uFF0C\u65E0\u6CD5\u5220\u9664\u652F\u4ED8\u9879"
988
+ "当前没有活跃订单,无法删除支付项"
994
989
  );
995
990
  }
996
- this.logWarning("\u5F00\u59CB\u5220\u9664\u652F\u4ED8\u9879:", {
991
+ this.logWarning("开始删除支付项:", {
997
992
  orderUuid: this.store.currentOrder.uuid,
998
993
  paymentUuid
999
994
  });
@@ -1006,10 +1001,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1006
1001
  if (!paymentItem) {
1007
1002
  throw (0, import_utils.createCheckoutError)(
1008
1003
  import_types.CheckoutErrorType.ValidationFailed,
1009
- `\u652F\u4ED8\u9879\u4E0D\u5B58\u5728: ${paymentUuid}`
1004
+ `支付项不存在: ${paymentUuid}`
1010
1005
  );
1011
1006
  }
1012
- this.logInfo("\u627E\u5230\u8981\u5220\u9664\u7684\u652F\u4ED8\u9879:", {
1007
+ this.logInfo("找到要删除的支付项:", {
1013
1008
  uuid: paymentItem.uuid,
1014
1009
  code: paymentItem.code,
1015
1010
  amount: paymentItem.amount,
@@ -1019,7 +1014,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1019
1014
  this.store.currentOrder.uuid,
1020
1015
  paymentUuid
1021
1016
  );
1022
- this.logInfo("Payment\u652F\u4ED8\u9879\u5220\u9664\u5B8C\u6210", paymentItem);
1017
+ this.logInfo("Payment支付项删除完成", paymentItem);
1023
1018
  this.clearCalculationCache();
1024
1019
  const currentOrderId = this.store.currentOrder.order_id;
1025
1020
  const isCurrentOrderReal = currentOrderId && !(0, import_utils.isVirtualOrderId)(currentOrderId);
@@ -1029,7 +1024,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1029
1024
  if (updatedOrder) {
1030
1025
  if (isCurrentOrderReal && (0, import_utils.isVirtualOrderId)(updatedOrder.order_id)) {
1031
1026
  this.logWarning(
1032
- "[Checkout] deletePaymentItemAsync: \u68C0\u6D4B\u5230\u8BA2\u5355ID\u56DE\u9000\uFF0C\u4FDD\u62A4\u771F\u5B9E\u8BA2\u5355ID:",
1027
+ "[Checkout] deletePaymentItemAsync: 检测到订单ID回退,保护真实订单ID:",
1033
1028
  {
1034
1029
  currentRealId: currentOrderId,
1035
1030
  retrievedVirtualId: updatedOrder.order_id
@@ -1048,7 +1043,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1048
1043
  timestamp: Date.now()
1049
1044
  });
1050
1045
  } catch (error) {
1051
- this.logError("\u5220\u9664\u652F\u4ED8\u9879\u5931\u8D25:", error);
1046
+ this.logError("删除支付项失败:", error);
1052
1047
  await this.handleError(error, import_types.CheckoutErrorType.PaymentFailed);
1053
1048
  throw error;
1054
1049
  }
@@ -1068,7 +1063,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1068
1063
  if (!this.store.currentOrder) {
1069
1064
  throw (0, import_utils.createCheckoutError)(
1070
1065
  import_types.CheckoutErrorType.ValidationFailed,
1071
- "\u5F53\u524D\u6CA1\u6709\u6D3B\u8DC3\u8BA2\u5355\uFF0C\u65E0\u6CD5\u66F4\u65B0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879"
1066
+ "当前没有活跃订单,无法更新代金券支付项"
1072
1067
  );
1073
1068
  }
1074
1069
  const paymentItems = await this.payment.getPaymentItemsAsync(
@@ -1079,7 +1074,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1079
1074
  const remainingValue = new import_decimal.default(remainingAmount);
1080
1075
  const isOrderSynced = this.store.isOrderSynced;
1081
1076
  if (remainingValue.lte(0) && isOrderSynced && voucherPaymentItems.length === 0 && allPaymentItemsSynced) {
1082
- this.logInfo("\u8BA2\u5355\u5DF2\u540C\u6B65\u4E14\u652F\u4ED8\u5B8C\u6210\uFF0C\u8DF3\u8FC7\u6E05\u7A7A\u4EE3\u91D1\u5238\u64CD\u4F5C\u907F\u514D\u91CD\u590D\u540C\u6B65:", {
1077
+ this.logInfo("订单已同步且支付完成,跳过清空代金券操作避免重复同步:", {
1083
1078
  orderUuid: this.store.currentOrder.uuid,
1084
1079
  orderId: this.store.currentOrder.order_id,
1085
1080
  remainingAmount,
@@ -1089,7 +1084,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1089
1084
  });
1090
1085
  return;
1091
1086
  }
1092
- this.logInfo("\u5F00\u59CB\u6279\u91CF\u66F4\u65B0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879:", {
1087
+ this.logInfo("开始批量更新代金券支付项:", {
1093
1088
  voucherPaymentItems
1094
1089
  });
1095
1090
  const orderPaymentType = this.store.currentOrder.is_deposit === 1 ? "deposit" : "normal";
@@ -1097,7 +1092,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1097
1092
  if (!item.voucher_id) {
1098
1093
  throw (0, import_utils.createCheckoutError)(
1099
1094
  import_types.CheckoutErrorType.ValidationFailed,
1100
- `\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u7F3A\u5C11 voucher_id: ${JSON.stringify(item)}`
1095
+ `代金券支付项缺少 voucher_id: ${JSON.stringify(item)}`
1101
1096
  );
1102
1097
  }
1103
1098
  const metadata = {
@@ -1124,7 +1119,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1124
1119
  if (updatedOrder) {
1125
1120
  if (isCurrentOrderReal && (0, import_utils.isVirtualOrderId)(updatedOrder.order_id)) {
1126
1121
  this.logWarning(
1127
- "updateVoucherPaymentItemsAsync: \u68C0\u6D4B\u5230\u8BA2\u5355ID\u56DE\u9000\uFF0C\u4FDD\u62A4\u771F\u5B9E\u8BA2\u5355ID:",
1122
+ "updateVoucherPaymentItemsAsync: 检测到订单ID回退,保护真实订单ID:",
1128
1123
  {
1129
1124
  currentRealId: currentOrderId,
1130
1125
  retrievedVirtualId: updatedOrder.order_id
@@ -1141,9 +1136,9 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1141
1136
  amount: voucherPaymentItems.reduce((sum, item) => sum + parseFloat(String(item.amount)), 0).toFixed(2),
1142
1137
  timestamp: Date.now()
1143
1138
  });
1144
- this.logInfo("\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u6279\u91CF\u66F4\u65B0\u6210\u529F");
1139
+ this.logInfo("代金券支付项批量更新成功");
1145
1140
  } catch (error) {
1146
- this.logError("[Checkout] \u6279\u91CF\u66F4\u65B0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u5931\u8D25:", error);
1141
+ this.logError("[Checkout] 批量更新代金券支付项失败:", error);
1147
1142
  await this.handleError(error, import_types.CheckoutErrorType.PaymentFailed);
1148
1143
  throw error;
1149
1144
  }
@@ -1161,19 +1156,19 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1161
1156
  if (isDeposit !== 0 && isDeposit !== 1) {
1162
1157
  throw (0, import_utils.createCheckoutError)(
1163
1158
  import_types.CheckoutErrorType.ValidationFailed,
1164
- "isDeposit \u53C2\u6570\u53EA\u80FD\u662F 0\uFF08\u5168\u6B3E\u8BA2\u5355\uFF09\u6216 1\uFF08\u5B9A\u91D1\u8BA2\u5355\uFF09"
1159
+ "isDeposit 参数只能是 0(全款订单)或 1(定金订单)"
1165
1160
  );
1166
1161
  }
1167
1162
  if (!this.store.currentOrder) {
1168
1163
  throw (0, import_utils.createCheckoutError)(
1169
1164
  import_types.CheckoutErrorType.ValidationFailed,
1170
- "\u672A\u627E\u5230\u5F53\u524D\u8BA2\u5355\uFF0C\u65E0\u6CD5\u4FEE\u6539\u5B9A\u91D1\u72B6\u6001"
1165
+ "未找到当前订单,无法修改定金状态"
1171
1166
  );
1172
1167
  }
1173
1168
  const newDepositValue = isDeposit;
1174
1169
  const oldDepositValue = this.store.currentOrder.is_deposit;
1175
1170
  if (oldDepositValue === newDepositValue) {
1176
- console.log("[Checkout] \u5B9A\u91D1\u72B6\u6001\u65E0\u53D8\u5316\uFF0C\u8DF3\u8FC7\u66F4\u65B0");
1171
+ console.log("[Checkout] 定金状态无变化,跳过更新");
1177
1172
  return;
1178
1173
  }
1179
1174
  let deposit_amount = this.store.currentOrder.deposit_amount || "0.00";
@@ -1201,12 +1196,12 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1201
1196
  order: this.store.currentOrder,
1202
1197
  timestamp: Date.now()
1203
1198
  });
1204
- this.logInfo("\u8BA2\u5355\u5B9A\u91D1\u72B6\u6001\u66F4\u65B0\u6210\u529F:", {
1199
+ this.logInfo("订单定金状态更新成功:", {
1205
1200
  isDeposit: newDepositValue,
1206
1201
  depositAmount: this.store.currentOrder.deposit_amount
1207
1202
  });
1208
1203
  } catch (error) {
1209
- this.logError("\u66F4\u65B0\u8BA2\u5355\u5B9A\u91D1\u72B6\u6001\u5931\u8D25:", error);
1204
+ this.logError("更新订单定金状态失败:", error);
1210
1205
  await this.handleError(
1211
1206
  error,
1212
1207
  import_types.CheckoutErrorType.ValidationFailed
@@ -1236,25 +1231,25 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1236
1231
  if (depositValue.isNaN() || depositValue.lt(0)) {
1237
1232
  throw (0, import_utils.createCheckoutError)(
1238
1233
  import_types.CheckoutErrorType.ValidationFailed,
1239
- `\u65E0\u6548\u7684\u5B9A\u91D1\u91D1\u989D\u683C\u5F0F: ${depositAmount}`
1234
+ `无效的定金金额格式: ${depositAmount}`
1240
1235
  );
1241
1236
  }
1242
1237
  if (!this.store.currentOrder) {
1243
1238
  throw (0, import_utils.createCheckoutError)(
1244
1239
  import_types.CheckoutErrorType.ValidationFailed,
1245
- "\u672A\u627E\u5230\u5F53\u524D\u8BA2\u5355\uFF0C\u65E0\u6CD5\u8BBE\u7F6E\u5B9A\u91D1\u91D1\u989D"
1240
+ "未找到当前订单,无法设置定金金额"
1246
1241
  );
1247
1242
  }
1248
1243
  const formattedDepositAmount = depositValue.toFixed(2);
1249
1244
  const oldDepositAmount = this.store.currentOrder.deposit_amount || "0.00";
1250
1245
  if (formattedDepositAmount === oldDepositAmount) {
1251
- this.logInfo("\u5B9A\u91D1\u91D1\u989D\u65E0\u53D8\u5316\uFF0C\u8DF3\u8FC7\u66F4\u65B0:", {
1246
+ this.logInfo("定金金额无变化,跳过更新:", {
1252
1247
  currentAmount: oldDepositAmount,
1253
1248
  newAmount: formattedDepositAmount
1254
1249
  });
1255
1250
  return;
1256
1251
  }
1257
- this.logInfo("\u5F00\u59CB\u8BBE\u7F6E\u8BA2\u5355\u5B9A\u91D1\u91D1\u989D:", {
1252
+ this.logInfo("开始设置订单定金金额:", {
1258
1253
  orderUuid: this.store.currentOrder.uuid,
1259
1254
  orderId: this.store.currentOrder.order_id,
1260
1255
  oldDepositAmount,
@@ -1266,10 +1261,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1266
1261
  };
1267
1262
  if (depositValue.gt(0) && this.store.currentOrder.is_deposit !== 1) {
1268
1263
  updateParams.is_deposit = 1;
1269
- this.logInfo("\u5B9A\u91D1\u91D1\u989D\u5927\u4E8E0\uFF0C\u81EA\u52A8\u8BBE\u7F6E\u4E3A\u5B9A\u91D1\u8BA2\u5355");
1264
+ this.logInfo("定金金额大于0,自动设置为定金订单");
1270
1265
  } else if (depositValue.eq(0) && this.store.currentOrder.is_deposit === 1) {
1271
1266
  updateParams.is_deposit = 0;
1272
- this.logInfo("\u5B9A\u91D1\u91D1\u989D\u4E3A0\uFF0C\u81EA\u52A8\u8BBE\u7F6E\u4E3A\u5168\u6B3E\u8BA2\u5355");
1267
+ this.logInfo("定金金额为0,自动设置为全款订单");
1273
1268
  }
1274
1269
  await this.payment.updateOrderAsync(
1275
1270
  this.store.currentOrder.uuid,
@@ -1293,7 +1288,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1293
1288
  order: this.store.currentOrder,
1294
1289
  timestamp: Date.now()
1295
1290
  });
1296
- this.logInfo("\u8BA2\u5355\u5B9A\u91D1\u91D1\u989D\u8BBE\u7F6E\u6210\u529F:", {
1291
+ this.logInfo("订单定金金额设置成功:", {
1297
1292
  orderUuid: this.store.currentOrder.uuid,
1298
1293
  orderId: this.store.currentOrder.order_id,
1299
1294
  oldDepositAmount,
@@ -1302,7 +1297,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1302
1297
  totalAmount: this.store.currentOrder.total_amount
1303
1298
  });
1304
1299
  } catch (error) {
1305
- this.logError("\u8BBE\u7F6E\u8BA2\u5355\u5B9A\u91D1\u91D1\u989D\u5931\u8D25:", error);
1300
+ this.logError("设置订单定金金额失败:", error);
1306
1301
  await this.handleError(
1307
1302
  error,
1308
1303
  import_types.CheckoutErrorType.ValidationFailed
@@ -1330,15 +1325,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1330
1325
  if (!this.store.currentOrder) {
1331
1326
  return {
1332
1327
  success: false,
1333
- message: "\u5F53\u524D\u6CA1\u6709\u6D3B\u8DC3\u8BA2\u5355\uFF0C\u65E0\u6CD5\u540C\u6B65"
1328
+ message: "当前没有活跃订单,无法同步"
1334
1329
  };
1335
1330
  }
1336
1331
  const orderUuid = this.store.currentOrder.uuid;
1337
1332
  const oldOrderId = this.store.currentOrder.order_id;
1338
1333
  if (this.store.isOrderSynced) {
1339
- this.logInfo("\u8BA2\u5355\u5DF2\u540C\u6B65\u8FC7\uFF0C\u5C06\u6267\u884C\u66F4\u65B0\u64CD\u4F5C");
1334
+ this.logInfo("订单已同步过,将执行更新操作");
1340
1335
  }
1341
- this.logInfo("\u5F00\u59CB\u624B\u52A8\u540C\u6B65\u8BA2\u5355\u5230\u540E\u7AEF:", {
1336
+ this.logInfo("开始手动同步订单到后端:", {
1342
1337
  orderUuid,
1343
1338
  orderId: oldOrderId,
1344
1339
  totalAmount: this.store.currentOrder.total_amount,
@@ -1347,7 +1342,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1347
1342
  console.time("manualSyncOrderAsync");
1348
1343
  const syncResult = await this.syncOrderToBackendWithReturn(true);
1349
1344
  console.timeEnd("manualSyncOrderAsync");
1350
- this.logInfo("\u624B\u52A8\u540C\u6B65\u8BA2\u5355\u5B8C\u6210:", {
1345
+ this.logInfo("手动同步订单完成:", {
1351
1346
  orderUuid,
1352
1347
  syncResult,
1353
1348
  oldOrderId,
@@ -1357,11 +1352,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1357
1352
  const finalOrderId = this.store.currentOrder.order_id;
1358
1353
  const finalIsVirtual = (0, import_utils.isVirtualOrderId)(finalOrderId);
1359
1354
  if (finalIsVirtual) {
1360
- this.logError("\u4E25\u91CD\u8B66\u544A\uFF1A\u624B\u52A8\u540C\u6B65\u5B8C\u6210\u540E\u8BA2\u5355ID\u4ECD\u4E3A\u865A\u62DFID\uFF01");
1355
+ this.logError("严重警告:手动同步完成后订单ID仍为虚拟ID!");
1361
1356
  }
1362
1357
  if (syncResult.orderId !== finalOrderId) {
1363
1358
  this.logError(
1364
- "[Checkout] \u4E25\u91CD\u8B66\u544A\uFF1A\u8FD4\u56DE\u7684\u8BA2\u5355ID\u4E0E\u5B58\u50A8\u7684\u8BA2\u5355ID\u4E0D\u4E00\u81F4\uFF01"
1359
+ "[Checkout] 严重警告:返回的订单ID与存储的订单ID不一致!"
1365
1360
  );
1366
1361
  }
1367
1362
  let newRes = {
@@ -1371,11 +1366,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1371
1366
  await this.updateStateAmountToRemaining(false);
1372
1367
  return newRes;
1373
1368
  } catch (error) {
1374
- this.logError("\u624B\u52A8\u540C\u6B65\u8BA2\u5355\u5931\u8D25:", error);
1375
- const errorMessage = error instanceof Error ? error.message : "\u540C\u6B65\u5931\u8D25";
1369
+ this.logError("手动同步订单失败:", error);
1370
+ const errorMessage = error instanceof Error ? error.message : "同步失败";
1376
1371
  return {
1377
1372
  success: false,
1378
- message: `\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ${errorMessage}`,
1373
+ message: `订单同步失败: ${errorMessage}`,
1379
1374
  orderUuid: (_e = this.store.currentOrder) == null ? void 0 : _e.uuid
1380
1375
  };
1381
1376
  }
@@ -1387,7 +1382,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1387
1382
  */
1388
1383
  getOrderNote() {
1389
1384
  if (!this.store.localOrderData) {
1390
- console.log("[Checkout] \u6CA1\u6709\u672C\u5730\u8BA2\u5355\u6570\u636E\uFF0C\u65E0\u6CD5\u83B7\u53D6\u5907\u6CE8");
1385
+ console.log("[Checkout] 没有本地订单数据,无法获取备注");
1391
1386
  return "";
1392
1387
  }
1393
1388
  return this.store.localOrderData.shop_note || "";
@@ -1410,11 +1405,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1410
1405
  */
1411
1406
  isCurrentOrderSynced() {
1412
1407
  if (!this.store.currentOrder) {
1413
- console.log("[Checkout] \u6CA1\u6709\u5F53\u524D\u8BA2\u5355\uFF0C\u540C\u6B65\u72B6\u6001\u4E3Afalse");
1408
+ console.log("[Checkout] 没有当前订单,同步状态为false");
1414
1409
  return false;
1415
1410
  }
1416
1411
  const syncStatus = this.store.isOrderSynced;
1417
- console.log("[Checkout] \u5F53\u524D\u8BA2\u5355\u540C\u6B65\u72B6\u6001:", {
1412
+ console.log("[Checkout] 当前订单同步状态:", {
1418
1413
  orderUuid: this.store.currentOrder.uuid,
1419
1414
  orderId: this.store.currentOrder.order_id,
1420
1415
  isOrderSynced: syncStatus
@@ -1432,7 +1427,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1432
1427
  async cancelCurrentOrderAsync(cancelReason) {
1433
1428
  var _a, _b;
1434
1429
  try {
1435
- this.logInfo("\u5F00\u59CB\u53D6\u6D88\u5F53\u524D\u672C\u5730\u8BA2\u5355:", {
1430
+ this.logInfo("开始取消当前本地订单:", {
1436
1431
  hasCurrentOrder: !!this.store.currentOrder,
1437
1432
  orderUuid: (_a = this.store.currentOrder) == null ? void 0 : _a.uuid,
1438
1433
  orderId: (_b = this.store.currentOrder) == null ? void 0 : _b.order_id,
@@ -1440,34 +1435,34 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1440
1435
  cancelReason
1441
1436
  });
1442
1437
  if (!this.store.currentOrder) {
1443
- this.logInfo("\u6CA1\u6709\u5F53\u524D\u8BA2\u5355\uFF0C\u65E0\u9700\u53D6\u6D88");
1438
+ this.logInfo("没有当前订单,无需取消");
1444
1439
  return {
1445
1440
  success: false,
1446
- message: "\u6CA1\u6709\u5F53\u524D\u8BA2\u5355\u53EF\u53D6\u6D88"
1441
+ message: "没有当前订单可取消"
1447
1442
  };
1448
1443
  }
1449
1444
  const currentOrderUuid = this.store.currentOrder.uuid;
1450
1445
  const currentOrderId = this.store.currentOrder.order_id;
1451
1446
  const isOrderSynced = this.store.isOrderSynced;
1452
1447
  if (isOrderSynced) {
1453
- this.logInfo("\u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u540E\u7AEF\uFF0C\u4E0D\u80FD\u53D6\u6D88:", {
1448
+ this.logInfo("订单已同步到后端,不能取消:", {
1454
1449
  orderId: currentOrderId,
1455
1450
  orderUuid: currentOrderUuid
1456
1451
  });
1457
1452
  return {
1458
1453
  success: false,
1459
- message: "\u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u540E\u7AEF\uFF0C\u65E0\u6CD5\u53D6\u6D88",
1454
+ message: "订单已同步到后端,无法取消",
1460
1455
  orderId: currentOrderId
1461
1456
  };
1462
1457
  }
1463
1458
  try {
1464
- this.logInfo("\u5220\u9664\u672C\u5730\u8BA2\u5355\u6570\u636E");
1459
+ this.logInfo("删除本地订单数据");
1465
1460
  await this.payment.deletePaymentOrderAsync(currentOrderUuid);
1466
- this.logInfo("\u672C\u5730\u8BA2\u5355\u6570\u636E\u5220\u9664\u6210\u529F");
1461
+ this.logInfo("本地订单数据删除成功");
1467
1462
  } catch (error) {
1468
- this.logWarning("\u5220\u9664\u672C\u5730\u8BA2\u5355\u6570\u636E\u5931\u8D25\uFF0C\u4F46\u7EE7\u7EED\u6267\u884C:", error);
1463
+ this.logWarning("删除本地订单数据失败,但继续执行:", error);
1469
1464
  }
1470
- this.logInfo("\u6E05\u7406\u8BA2\u5355\u76F8\u5173\u72B6\u6001");
1465
+ this.logInfo("清理订单相关状态");
1471
1466
  this.store.currentOrder = void 0;
1472
1467
  this.store.localOrderData = void 0;
1473
1468
  this.store.stateAmount = "0.00";
@@ -1475,7 +1470,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1475
1470
  this.store.isOrderSynced = false;
1476
1471
  this.store.currentCustomer = void 0;
1477
1472
  this.payment.wallet.clearAllCache();
1478
- this.logInfo("\u8BA2\u5355\u72B6\u6001\u6E05\u7406\u5B8C\u6210\uFF0CcurrentOrder\u5DF2\u91CA\u653E");
1473
+ this.logInfo("订单状态清理完成,currentOrder已释放");
1479
1474
  await this.core.effects.emit(`${this.name}:onOrderCancelled`, {
1480
1475
  orderUuid: currentOrderUuid,
1481
1476
  orderId: currentOrderId,
@@ -1484,22 +1479,22 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1484
1479
  // 只有未同步订单可以被取消
1485
1480
  timestamp: Date.now()
1486
1481
  });
1487
- this.logInfo("\u672C\u5730\u8BA2\u5355\u53D6\u6D88\u5B8C\u6210:", {
1482
+ this.logInfo("本地订单取消完成:", {
1488
1483
  orderUuid: currentOrderUuid,
1489
1484
  orderId: currentOrderId,
1490
1485
  cancelReason
1491
1486
  });
1492
1487
  return {
1493
1488
  success: true,
1494
- message: "\u672C\u5730\u8BA2\u5355\u5DF2\u6210\u529F\u53D6\u6D88",
1489
+ message: "本地订单已成功取消",
1495
1490
  orderId: currentOrderId
1496
1491
  };
1497
1492
  } catch (error) {
1498
- this.logError("\u53D6\u6D88\u672C\u5730\u8BA2\u5355\u5931\u8D25:", error);
1499
- const errorMessage = error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF";
1493
+ this.logError("取消本地订单失败:", error);
1494
+ const errorMessage = error instanceof Error ? error.message : "未知错误";
1500
1495
  return {
1501
1496
  success: false,
1502
- message: `\u53D6\u6D88\u8BA2\u5355\u5931\u8D25: ${errorMessage}`
1497
+ message: `取消订单失败: ${errorMessage}`
1503
1498
  };
1504
1499
  }
1505
1500
  }
@@ -1515,12 +1510,12 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1515
1510
  if (!this.store.currentOrder) {
1516
1511
  return {
1517
1512
  success: false,
1518
- message: "\u5F53\u524D\u6CA1\u6709\u6D3B\u8DC3\u8BA2\u5355\uFF0C\u65E0\u6CD5\u4FDD\u5B58"
1513
+ message: "当前没有活跃订单,无法保存"
1519
1514
  };
1520
1515
  }
1521
1516
  const orderUuid = this.store.currentOrder.uuid;
1522
1517
  const currentOrderId = this.store.currentOrder.order_id;
1523
- this.logInfo("\u5F00\u59CB\u4FDD\u5B58\u8BA2\u5355\u5E76\u7A0D\u540E\u652F\u4ED8:", {
1518
+ this.logInfo("开始保存订单并稍后支付:", {
1524
1519
  orderUuid,
1525
1520
  orderId: currentOrderId,
1526
1521
  totalAmount: this.store.currentOrder.total_amount
@@ -1532,7 +1527,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1532
1527
  true,
1533
1528
  allPaymentItems
1534
1529
  );
1535
- this.logInfo("\u4FDD\u5B58\u8BA2\u5355\u5B8C\u6210:", {
1530
+ this.logInfo("保存订单完成:", {
1536
1531
  orderUuid,
1537
1532
  oldOrderId: currentOrderId,
1538
1533
  syncResult,
@@ -1542,17 +1537,17 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1542
1537
  });
1543
1538
  return {
1544
1539
  success: true,
1545
- message: "\u8BA2\u5355\u4FDD\u5B58\u6210\u529F\uFF0C\u53EF\u7A0D\u540E\u7EE7\u7EED\u652F\u4ED8",
1540
+ message: "订单保存成功,可稍后继续支付",
1546
1541
  orderId: syncResult.orderId,
1547
1542
  orderUuid,
1548
1543
  response: syncResult.response
1549
1544
  };
1550
1545
  } catch (error) {
1551
- this.logError("\u4FDD\u5B58\u8BA2\u5355\u5931\u8D25:", error);
1552
- const errorMessage = error instanceof Error ? error.message : "\u4FDD\u5B58\u5931\u8D25";
1546
+ this.logError("保存订单失败:", error);
1547
+ const errorMessage = error instanceof Error ? error.message : "保存失败";
1553
1548
  return {
1554
1549
  success: false,
1555
- message: `\u8BA2\u5355\u4FDD\u5B58\u5931\u8D25: ${errorMessage}`,
1550
+ message: `订单保存失败: ${errorMessage}`,
1556
1551
  orderUuid: (_a = this.store.currentOrder) == null ? void 0 : _a.uuid
1557
1552
  };
1558
1553
  }
@@ -1568,10 +1563,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1568
1563
  if (!this.store.localOrderData) {
1569
1564
  throw (0, import_utils.createCheckoutError)(
1570
1565
  import_types.CheckoutErrorType.ValidationFailed,
1571
- "\u6CA1\u6709\u672C\u5730\u8BA2\u5355\u6570\u636E\uFF0C\u65E0\u6CD5\u66F4\u65B0\u5907\u6CE8"
1566
+ "没有本地订单数据,无法更新备注"
1572
1567
  );
1573
1568
  }
1574
- console.log("[Checkout] \u66F4\u65B0\u8BA2\u5355\u5907\u6CE8:", {
1569
+ console.log("[Checkout] 更新订单备注:", {
1575
1570
  orderUuid: (_a = this.store.currentOrder) == null ? void 0 : _a.uuid,
1576
1571
  oldNote: this.store.localOrderData.shop_note,
1577
1572
  newNote: note
@@ -1584,11 +1579,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1584
1579
  this.store.currentOrder.uuid
1585
1580
  );
1586
1581
  if (orderInPayment && orderInPayment.note !== void 0) {
1587
- console.log("[Checkout] \u540C\u6B65\u5907\u6CE8\u5230Payment\u6A21\u5757\u7684\u8BA2\u5355\u6570\u636E\u4E2D");
1582
+ console.log("[Checkout] 同步备注到Payment模块的订单数据中");
1588
1583
  }
1589
1584
  } catch (syncError) {
1590
1585
  console.warn(
1591
- "[Checkout] \u540C\u6B65\u5907\u6CE8\u5230Payment\u6A21\u5757\u5931\u8D25\uFF0C\u4F46\u672C\u5730\u66F4\u65B0\u6210\u529F:",
1586
+ "[Checkout] 同步备注到Payment模块失败,但本地更新成功:",
1592
1587
  syncError
1593
1588
  );
1594
1589
  }
@@ -1599,12 +1594,12 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1599
1594
  newNote: note,
1600
1595
  timestamp: Date.now()
1601
1596
  });
1602
- console.log("[Checkout] \u8BA2\u5355\u5907\u6CE8\u66F4\u65B0\u6210\u529F:", {
1597
+ console.log("[Checkout] 订单备注更新成功:", {
1603
1598
  oldNote,
1604
1599
  newNote: note
1605
1600
  });
1606
1601
  } catch (error) {
1607
- console.error("[Checkout] \u66F4\u65B0\u8BA2\u5355\u5907\u6CE8\u5931\u8D25:", error);
1602
+ console.error("[Checkout] 更新订单备注失败:", error);
1608
1603
  await this.handleError(
1609
1604
  error,
1610
1605
  import_types.CheckoutErrorType.ValidationFailed
@@ -1623,7 +1618,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1623
1618
  context: {},
1624
1619
  timestamp: Date.now()
1625
1620
  });
1626
- console.error("[Checkout] \u9519\u8BEF:", checkoutError);
1621
+ console.error("[Checkout] 错误:", checkoutError);
1627
1622
  }
1628
1623
  /**
1629
1624
  * 处理支付成功
@@ -1646,7 +1641,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1646
1641
  var _a;
1647
1642
  const error = (0, import_utils.createCheckoutError)(
1648
1643
  import_types.CheckoutErrorType.PaymentFailed,
1649
- data.error || "\u652F\u4ED8\u540C\u6B65\u5931\u8D25"
1644
+ data.error || "支付同步失败"
1650
1645
  );
1651
1646
  await this.handleError(
1652
1647
  error instanceof Error ? error : new Error(String(error)),
@@ -1720,7 +1715,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1720
1715
  });
1721
1716
  return processedPaymentItem;
1722
1717
  } catch (error) {
1723
- this.logError("\u5904\u7406\u73B0\u91D1\u652F\u4ED8\u9879\u65F6\u51FA\u9519:", error);
1718
+ this.logError("处理现金支付项时出错:", error);
1724
1719
  return paymentItem;
1725
1720
  }
1726
1721
  }
@@ -1729,12 +1724,12 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1729
1724
  */
1730
1725
  async preloadPaymentMethods() {
1731
1726
  try {
1732
- console.log("[Checkout] \u9884\u52A0\u8F7D\u652F\u4ED8\u65B9\u5F0F...");
1727
+ console.log("[Checkout] 预加载支付方式...");
1733
1728
  const methods = await this.payment.getPayMethodListAsync();
1734
1729
  this.store.paymentMethods = methods;
1735
- console.log(`[Checkout] \u9884\u52A0\u8F7D\u5B8C\u6210\uFF0C\u5171 ${methods.length} \u79CD\u652F\u4ED8\u65B9\u5F0F`);
1730
+ console.log(`[Checkout] 预加载完成,共 ${methods.length} 种支付方式`);
1736
1731
  } catch (error) {
1737
- console.error("[Checkout] \u9884\u52A0\u8F7D\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25:", error);
1732
+ console.error("[Checkout] 预加载支付方式失败:", error);
1738
1733
  this.store.paymentMethods = [];
1739
1734
  }
1740
1735
  }
@@ -1751,15 +1746,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1751
1746
  const retentionDays = cleanupConfig.retentionDays || 7;
1752
1747
  const maxOrdersToDelete = cleanupConfig.maxOrdersToDelete || 100;
1753
1748
  if (!isCleanupEnabled) {
1754
- console.log("[Checkout] \u8BA2\u5355\u6570\u636E\u6E05\u7406\u529F\u80FD\u5DF2\u7981\u7528");
1749
+ console.log("[Checkout] 订单数据清理功能已禁用");
1755
1750
  return;
1756
1751
  }
1757
1752
  console.log(
1758
- `[Checkout] \u5F00\u59CB\u6E05\u7406\u8FC7\u671F\u8BA2\u5355\u6570\u636E\uFF08\u4FDD\u7559 ${retentionDays} \u5929\u5185\u7684\u6570\u636E\uFF09...`
1753
+ `[Checkout] 开始清理过期订单数据(保留 ${retentionDays} 天内的数据)...`
1759
1754
  );
1760
1755
  const allOrders = await this.payment.getOrderListAsync();
1761
1756
  if (!allOrders || allOrders.length === 0) {
1762
- console.log("[Checkout] \u6CA1\u6709\u627E\u5230\u9700\u8981\u6E05\u7406\u7684\u8BA2\u5355\u6570\u636E");
1757
+ console.log("[Checkout] 没有找到需要清理的订单数据");
1763
1758
  return;
1764
1759
  }
1765
1760
  const thresholdDate = /* @__PURE__ */ new Date();
@@ -1794,7 +1789,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1794
1789
  });
1795
1790
  }
1796
1791
  } catch (error) {
1797
- console.warn(`[Checkout] \u5904\u7406\u8BA2\u5355 ${order.uuid} \u65F6\u51FA\u9519:`, error);
1792
+ console.warn(`[Checkout] 处理订单 ${order.uuid} 时出错:`, error);
1798
1793
  continue;
1799
1794
  }
1800
1795
  }
@@ -1807,10 +1802,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1807
1802
  await this.payment.deletePaymentOrderAsync(orderInfo.uuid);
1808
1803
  deletedCount++;
1809
1804
  console.log(
1810
- `[Checkout] \u5DF2\u5220\u9664\u8FC7\u671F\u8BA2\u5355: ${orderInfo.orderId} (${orderInfo.daysSinceCreated} \u5929\u524D\u521B\u5EFA)`
1805
+ `[Checkout] 已删除过期订单: ${orderInfo.orderId} (${orderInfo.daysSinceCreated} 天前创建)`
1811
1806
  );
1812
1807
  } catch (error) {
1813
- console.error(`[Checkout] \u5220\u9664\u8BA2\u5355 ${orderInfo.uuid} \u5931\u8D25:`, error);
1808
+ console.error(`[Checkout] 删除订单 ${orderInfo.uuid} 失败:`, error);
1814
1809
  }
1815
1810
  }
1816
1811
  const summary = {
@@ -1826,16 +1821,16 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1826
1821
  this.logInfo("Expired orders cleanup completed", summary);
1827
1822
  if (ordersToDelete.length > maxOrdersToDelete) {
1828
1823
  console.log(
1829
- `[Checkout] \u8FC7\u671F\u8BA2\u5355\u6E05\u7406\u5B8C\u6210: \u603B\u8BA1 ${allOrders.length} \u4E2A\u8BA2\u5355\uFF0C\u53D1\u73B0 ${ordersToDelete.length} \u4E2A\u8FC7\u671F\u5DF2\u540C\u6B65\u8BA2\u5355\uFF0C\u5220\u9664\u4E86 ${deletedCount} \u4E2A\uFF08\u9650\u5236\u4E3A ${maxOrdersToDelete} \u4E2A\uFF09`
1824
+ `[Checkout] 过期订单清理完成: 总计 ${allOrders.length} 个订单,发现 ${ordersToDelete.length} 个过期已同步订单,删除了 ${deletedCount} 个(限制为 ${maxOrdersToDelete} 个)`
1830
1825
  );
1831
1826
  } else {
1832
1827
  console.log(
1833
- `[Checkout] \u8FC7\u671F\u8BA2\u5355\u6E05\u7406\u5B8C\u6210: \u603B\u8BA1 ${allOrders.length} \u4E2A\u8BA2\u5355\uFF0C\u5220\u9664\u4E86 ${deletedCount} \u4E2A\u8FC7\u671F\u5DF2\u540C\u6B65\u8BA2\u5355`
1828
+ `[Checkout] 过期订单清理完成: 总计 ${allOrders.length} 个订单,删除了 ${deletedCount} 个过期已同步订单`
1834
1829
  );
1835
1830
  }
1836
1831
  } catch (error) {
1837
1832
  const errorMessage = error instanceof Error ? error.message : String(error);
1838
- console.error("[Checkout] \u6E05\u7406\u8FC7\u671F\u8BA2\u5355\u6570\u636E\u5931\u8D25:", error);
1833
+ console.error("[Checkout] 清理过期订单数据失败:", error);
1839
1834
  this.logError("Expired orders cleanup failed", { error: errorMessage });
1840
1835
  }
1841
1836
  }
@@ -1894,7 +1889,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1894
1889
  */
1895
1890
  async calculatePaidAmountAsync() {
1896
1891
  if (!this.store.currentOrder) {
1897
- this.logWarning("[Checkout] calculatePaidAmountAsync: \u6CA1\u6709\u5F53\u524D\u8BA2\u5355");
1892
+ this.logWarning("[Checkout] calculatePaidAmountAsync: 没有当前订单");
1898
1893
  return "0.00";
1899
1894
  }
1900
1895
  try {
@@ -1910,10 +1905,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1910
1905
  );
1911
1906
  const result = this.calculatePaidAmountFromItems(payments);
1912
1907
  this.calculationCache.paidAmount = result;
1913
- this.logInfo("calculatePaidAmountAsync: \u8BA1\u7B97\u7ED3\u679C =", result);
1908
+ this.logInfo("calculatePaidAmountAsync: 计算结果 =", result);
1914
1909
  return result;
1915
1910
  } catch (error) {
1916
- this.logError("calculatePaidAmountAsync \u5931\u8D25:", error);
1911
+ this.logError("calculatePaidAmountAsync 失败:", error);
1917
1912
  return "0.00";
1918
1913
  }
1919
1914
  }
@@ -1946,7 +1941,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1946
1941
  */
1947
1942
  async calculateRemainingAmountAsync() {
1948
1943
  if (!this.store.currentOrder) {
1949
- this.logWarning("calculateRemainingAmountAsync: \u6CA1\u6709\u5F53\u524D\u8BA2\u5355");
1944
+ this.logWarning("calculateRemainingAmountAsync: 没有当前订单");
1950
1945
  return "0.00";
1951
1946
  }
1952
1947
  const { currentOrder } = await this.fetchOrderDataBatch();
@@ -1955,7 +1950,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1955
1950
  }
1956
1951
  const paidAmountStr = await this.calculatePaidAmountAsync();
1957
1952
  const result = this.calculateRemainingAmountFromData(currentOrder, paidAmountStr);
1958
- this.logInfo("calculateRemainingAmountAsync: \u8BA1\u7B97=", result);
1953
+ this.logInfo("calculateRemainingAmountAsync: 计算=", result);
1959
1954
  return result;
1960
1955
  }
1961
1956
  /**
@@ -1966,7 +1961,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1966
1961
  */
1967
1962
  async calculateRemainingTotalAmountAsync() {
1968
1963
  if (!this.store.currentOrder) {
1969
- this.logWarning("calculateRemainingTotalAmountAsync: \u6CA1\u6709\u5F53\u524D\u8BA2\u5355");
1964
+ this.logWarning("calculateRemainingTotalAmountAsync: 没有当前订单");
1970
1965
  return "0.00";
1971
1966
  }
1972
1967
  const { currentOrder } = await this.fetchOrderDataBatch();
@@ -1975,7 +1970,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1975
1970
  }
1976
1971
  const paidAmountStr = await this.calculatePaidAmountAsync();
1977
1972
  const result = this.calculateRemainingTotalAmountFromData(currentOrder, paidAmountStr);
1978
- this.logInfo("calculateRemainingTotalAmountAsync: \u8BA1\u7B97=", result);
1973
+ this.logInfo("calculateRemainingTotalAmountAsync: 计算=", result);
1979
1974
  return result;
1980
1975
  }
1981
1976
  /**
@@ -1994,18 +1989,18 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1994
1989
  timestamp: Date.now(),
1995
1990
  totalAmount: remainingTotalAmount
1996
1991
  });
1997
- this.logInfo("balanceDueAmount \u5DF2\u81EA\u52A8\u66F4\u65B0:", {
1992
+ this.logInfo("balanceDueAmount 已自动更新:", {
1998
1993
  oldAmount: currentBalanceDueAmount,
1999
1994
  newAmount: remainingAmount
2000
1995
  });
2001
1996
  } else {
2002
- this.logInfo("balanceDueAmount \u65E0\u9700\u66F4\u65B0\uFF0C\u5F53\u524D\u503C\u5DF2\u662F\u6700\u65B0:", {
1997
+ this.logInfo("balanceDueAmount 无需更新,当前值已是最新:", {
2003
1998
  balanceDueAmount: currentBalanceDueAmount,
2004
1999
  remainingAmount
2005
2000
  });
2006
2001
  }
2007
2002
  } catch (error) {
2008
- this.logError("\u66F4\u65B0 balanceDueAmount \u5931\u8D25:", error);
2003
+ this.logError("更新 balanceDueAmount 失败:", error);
2009
2004
  }
2010
2005
  }
2011
2006
  /**
@@ -2022,7 +2017,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2022
2017
  const { paymentItems, currentOrder } = await this.fetchOrderDataBatch();
2023
2018
  console.timeEnd("updateStateAmountToRemaining");
2024
2019
  if (!currentOrder) {
2025
- this.logWarning("updateStateAmountToRemaining: \u672A\u627E\u5230\u5F53\u524D\u8BA2\u5355");
2020
+ this.logWarning("updateStateAmountToRemaining: 未找到当前订单");
2026
2021
  return;
2027
2022
  }
2028
2023
  const paidAmount = this.calculatePaidAmountFromItems(paymentItems);
@@ -2071,7 +2066,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2071
2066
  totalAmount: remainingTotalAmount
2072
2067
  });
2073
2068
  }, 0);
2074
- this.logInfo("stateAmount \u5DF2\u81EA\u52A8\u66F4\u65B0\u4E3A\u5269\u4F59\u91D1\u989D:", {
2069
+ this.logInfo("stateAmount 已自动更新为剩余金额:", {
2075
2070
  oldAmount: currentStateAmount,
2076
2071
  newAmount: remainingAmount
2077
2072
  });
@@ -2089,14 +2084,14 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2089
2084
  totalAmount: remainingTotalAmount
2090
2085
  });
2091
2086
  }, 0);
2092
- this.logInfo("balanceDueAmount \u5DF2\u81EA\u52A8\u66F4\u65B0:", {
2087
+ this.logInfo("balanceDueAmount 已自动更新:", {
2093
2088
  oldAmount: currentBalanceDueAmount,
2094
2089
  newAmount: remainingAmount
2095
2090
  });
2096
2091
  }
2097
2092
  console.timeEnd("updateStateAmountToRemaining: updateStateAmountToRemaining");
2098
2093
  if (!hasStateChanged) {
2099
- this.logInfo("\u72B6\u6001\u65E0\u9700\u66F4\u65B0\uFF0C\u5F53\u524D\u503C\u5DF2\u662F\u6700\u65B0:", {
2094
+ this.logInfo("状态无需更新,当前值已是最新:", {
2100
2095
  stateAmount: currentStateAmount,
2101
2096
  remainingAmount
2102
2097
  });
@@ -2104,10 +2099,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2104
2099
  if (checkOrder) {
2105
2100
  await this.checkOrderPaymentCompletionOptimized(paymentItems, remainingAmount);
2106
2101
  } else {
2107
- this.logInfo("\u5916\u90E8\u4F20\u5165\u65E0\u9700 checkOrder\uFF0C\u4E0D\u6267\u884C\u8BA2\u5355\u652F\u4ED8\u5B8C\u6210\u68C0\u6D4B\u548C\u540C\u6B65");
2102
+ this.logInfo("外部传入无需 checkOrder,不执行订单支付完成检测和同步");
2108
2103
  }
2109
2104
  } catch (error) {
2110
- this.logError("\u66F4\u65B0 stateAmount \u4E3A\u5269\u4F59\u91D1\u989D\u5931\u8D25:", error);
2105
+ this.logError("更新 stateAmount 为剩余金额失败:", error);
2111
2106
  }
2112
2107
  }
2113
2108
  /**
@@ -2125,7 +2120,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2125
2120
  if (remainingValue.lte(0)) {
2126
2121
  const totalAmount = this.store.currentOrder.total_amount;
2127
2122
  const paidAmount = this.calculationCache.paidAmount || "0.00";
2128
- this.logInfo("\u68C0\u6D4B\u5230\u8BA2\u5355\u652F\u4ED8\u5B8C\u6210:", {
2123
+ this.logInfo("检测到订单支付完成:", {
2129
2124
  orderUuid: this.store.currentOrder.uuid,
2130
2125
  orderId: this.store.currentOrder.order_id,
2131
2126
  totalAmount,
@@ -2138,13 +2133,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2138
2133
  (item) => item.status !== "voided" && item.voucher_id
2139
2134
  );
2140
2135
  const shouldAutoSync = hasPaymentItems && !allPaymentsHaveVoucherId;
2141
- this.logInfo("\u81EA\u52A8\u540C\u6B65\u8BA2\u5355\u6761\u4EF6\u68C0\u67E5:", {
2136
+ this.logInfo("自动同步订单条件检查:", {
2142
2137
  paymentCount: paymentItems.length,
2143
2138
  hasPaymentItems,
2144
2139
  allHaveVoucherId: allPaymentsHaveVoucherId,
2145
2140
  isOrderSynced: this.store.isOrderSynced,
2146
2141
  shouldAutoSync,
2147
- reason: shouldAutoSync ? "\u652F\u4ED8\u5B8C\u6210\uFF0C\u9700\u8981\u540C\u6B65\u6700\u7EC8\u652F\u4ED8\u72B6\u6001" : "\u8DF3\u8FC7\u540C\u6B65",
2142
+ reason: shouldAutoSync ? "支付完成,需要同步最终支付状态" : "跳过同步",
2148
2143
  paymentItems: paymentItems.map((p) => ({
2149
2144
  uuid: p.uuid,
2150
2145
  code: p.code,
@@ -2156,13 +2151,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2156
2151
  }))
2157
2152
  });
2158
2153
  if (shouldAutoSync) {
2159
- this.logInfo("\u6EE1\u8DB3\u81EA\u52A8\u540C\u6B65\u6761\u4EF6\uFF0C\u5F00\u59CB\u540C\u6B65\u8BA2\u5355\u5230\u540E\u7AEF...");
2154
+ this.logInfo("满足自动同步条件,开始同步订单到后端...");
2160
2155
  await this.syncOrderToBackendWithReturn(false);
2161
2156
  } else {
2162
2157
  if (!hasPaymentItems) {
2163
- this.logInfo("\u6CA1\u6709\u652F\u4ED8\u9879\uFF0C\u8DF3\u8FC7\u8BA2\u5355\u540C\u6B65");
2158
+ this.logInfo("没有支付项,跳过订单同步");
2164
2159
  } else if (allPaymentsHaveVoucherId) {
2165
- this.logInfo("\u6240\u6709\u652F\u4ED8\u9879\u5747\u4E3A\u4EE3\u91D1\u5238\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8BA2\u5355\u540C\u6B65");
2160
+ this.logInfo("所有支付项均为代金券类型,跳过订单同步");
2166
2161
  }
2167
2162
  }
2168
2163
  await this.core.effects.emit(`${this.name}:onOrderPaymentCompleted`, {
@@ -2175,7 +2170,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2175
2170
  });
2176
2171
  }
2177
2172
  } catch (error) {
2178
- this.logError("\u68C0\u67E5\u8BA2\u5355\u652F\u4ED8\u5B8C\u6210\u72B6\u6001\u5931\u8D25:", error);
2173
+ this.logError("检查订单支付完成状态失败:", error);
2179
2174
  }
2180
2175
  }
2181
2176
  /**
@@ -2196,7 +2191,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2196
2191
  if (remainingValue.lte(0)) {
2197
2192
  const totalAmount = this.store.currentOrder.total_amount;
2198
2193
  const paidAmount = await this.calculatePaidAmountAsync();
2199
- this.logInfo("\u68C0\u6D4B\u5230\u8BA2\u5355\u652F\u4ED8\u5B8C\u6210:", {
2194
+ this.logInfo("检测到订单支付完成:", {
2200
2195
  orderUuid: this.store.currentOrder.uuid,
2201
2196
  orderId: this.store.currentOrder.order_id,
2202
2197
  totalAmount,
@@ -2214,13 +2209,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2214
2209
  (item) => item.status !== "voided" && item.voucher_id
2215
2210
  );
2216
2211
  const shouldAutoSync = hasPaymentItems && !allPaymentsHaveVoucherId;
2217
- this.logInfo("\u81EA\u52A8\u540C\u6B65\u8BA2\u5355\u6761\u4EF6\u68C0\u67E5:", {
2212
+ this.logInfo("自动同步订单条件检查:", {
2218
2213
  paymentCount: currentPayments.length,
2219
2214
  hasPaymentItems,
2220
2215
  allHaveVoucherId: allPaymentsHaveVoucherId,
2221
2216
  isOrderSynced: this.store.isOrderSynced,
2222
2217
  shouldAutoSync,
2223
- reason: shouldAutoSync ? "\u652F\u4ED8\u5B8C\u6210\uFF0C\u9700\u8981\u540C\u6B65\u6700\u7EC8\u652F\u4ED8\u72B6\u6001" : "\u8DF3\u8FC7\u540C\u6B65",
2218
+ reason: shouldAutoSync ? "支付完成,需要同步最终支付状态" : "跳过同步",
2224
2219
  paymentItems: currentPayments.map((p) => ({
2225
2220
  uuid: p.uuid,
2226
2221
  code: p.code,
@@ -2232,13 +2227,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2232
2227
  }))
2233
2228
  });
2234
2229
  if (shouldAutoSync) {
2235
- this.logInfo("\u6EE1\u8DB3\u81EA\u52A8\u540C\u6B65\u6761\u4EF6\uFF0C\u5F00\u59CB\u540C\u6B65\u8BA2\u5355\u5230\u540E\u7AEF...");
2230
+ this.logInfo("满足自动同步条件,开始同步订单到后端...");
2236
2231
  await this.syncOrderToBackendWithReturn(false);
2237
2232
  } else {
2238
2233
  if (!hasPaymentItems) {
2239
- this.logInfo("\u6CA1\u6709\u652F\u4ED8\u9879\uFF0C\u8DF3\u8FC7\u8BA2\u5355\u540C\u6B65");
2234
+ this.logInfo("没有支付项,跳过订单同步");
2240
2235
  } else if (allPaymentsHaveVoucherId) {
2241
- this.logInfo("\u6240\u6709\u652F\u4ED8\u9879\u5747\u4E3A\u4EE3\u91D1\u5238\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8BA2\u5355\u540C\u6B65");
2236
+ this.logInfo("所有支付项均为代金券类型,跳过订单同步");
2242
2237
  }
2243
2238
  }
2244
2239
  await this.core.effects.emit(`${this.name}:onOrderPaymentCompleted`, {
@@ -2251,7 +2246,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2251
2246
  });
2252
2247
  }
2253
2248
  } catch (error) {
2254
- this.logError("\u68C0\u67E5\u8BA2\u5355\u652F\u4ED8\u5B8C\u6210\u72B6\u6001\u5931\u8D25:", error);
2249
+ this.logError("检查订单支付完成状态失败:", error);
2255
2250
  }
2256
2251
  }
2257
2252
  /**
@@ -2264,12 +2259,12 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2264
2259
  async syncOrderToBackendWithReturn(isManual = false, customPaymentItems) {
2265
2260
  var _a, _b, _c, _d, _e, _f, _g, _h;
2266
2261
  if (!this.store.localOrderData || !this.store.currentOrder) {
2267
- throw new Error("\u7F3A\u5C11\u5FC5\u8981\u7684\u8BA2\u5355\u6570\u636E\uFF0C\u65E0\u6CD5\u540C\u6B65\u5230\u540E\u7AEF");
2262
+ throw new Error("缺少必要的订单数据,无法同步到后端");
2268
2263
  }
2269
2264
  this.logInfo("syncOrderToBackendWithReturn called", { isManual });
2270
2265
  const currentOrderId = this.store.currentOrder.order_id;
2271
2266
  const isUpdateOperation = this.store.isOrderSynced || !(0, import_utils.isVirtualOrderId)(currentOrderId);
2272
- this.logInfo(`\u5F00\u59CB\u540C\u6B65\u8BA2\u5355\u5230\u540E\u7AEF...`, {
2267
+ this.logInfo(`开始同步订单到后端...`, {
2273
2268
  currentOrderId,
2274
2269
  isVirtualId: (0, import_utils.isVirtualOrderId)(currentOrderId || ""),
2275
2270
  orderUuid: this.store.currentOrder.uuid,
@@ -2293,15 +2288,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2293
2288
  const manualDepositValue = new import_decimal.default(manualDepositAmount);
2294
2289
  if (manualDepositValue.gt(0)) {
2295
2290
  finalDepositAmount = manualDepositAmount;
2296
- this.logInfo("\u4F7F\u7528\u624B\u52A8\u8BBE\u7F6E\u7684\u5B9A\u91D1\u91D1\u989D", {
2291
+ this.logInfo("使用手动设置的定金金额", {
2297
2292
  manualDepositAmount,
2298
- reason: "\u7528\u6237\u901A\u8FC7setDepositAmountAsync\u624B\u52A8\u8BBE\u7F6E\u4E86\u5B9A\u91D1\u91D1\u989D"
2293
+ reason: "用户通过setDepositAmountAsync手动设置了定金金额"
2299
2294
  });
2300
2295
  } else {
2301
2296
  finalDepositAmount = "0.00";
2302
- this.logInfo("\u5B9A\u91D1\u91D1\u989D\u4E3A0", {
2297
+ this.logInfo("定金金额为0", {
2303
2298
  manualDepositAmount,
2304
- reason: "\u624B\u52A8\u8BBE\u7F6E\u548C\u8BA1\u7B97\u503C\u5747\u4E3A0"
2299
+ reason: "手动设置和计算值均为0"
2305
2300
  });
2306
2301
  }
2307
2302
  if (this.store.currentOrder.is_deposit === 0 && processedPaymentItems.every((item) => item.order_payment_type !== "deposit")) {
@@ -2322,7 +2317,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2322
2317
  return sum.plus(amt).sub(rounding);
2323
2318
  }, new import_decimal.default(0)).toFixed(2);
2324
2319
  }
2325
- this.logInfo("\u5B9A\u91D1\u91D1\u989D\u786E\u5B9A\u7ED3\u679C", {
2320
+ this.logInfo("定金金额确定结果", {
2326
2321
  depositPaymentItemsCount: processedPaymentItems.length,
2327
2322
  depositPaymentItems: processedPaymentItems.map((item) => ({
2328
2323
  uuid: item.uuid,
@@ -2383,7 +2378,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2383
2378
  if (isUpdateOperation) {
2384
2379
  if ((0, import_utils.isVirtualOrderId)(currentOrderId)) {
2385
2380
  this.logWarning(
2386
- "\u5C1D\u8BD5\u6570\u636E\u4FEE\u590D\uFF1A\u6682\u65F6\u4E0D\u5305\u542Border_id\uFF0C\u6CE8\u610F\uFF1A\u8FD9\u6B21\u8C03\u7528\u5C06\u4F5C\u4E3A\u521B\u5EFA\u64CD\u4F5C\u5904\u7406\uFF0C\u4F46\u540E\u7EED\u4F1A\u4FEE\u590D\u6570\u636E\u4E00\u81F4\u6027"
2381
+ "尝试数据修复:暂时不包含order_id,注意:这次调用将作为创建操作处理,但后续会修复数据一致性"
2387
2382
  );
2388
2383
  } else {
2389
2384
  orderParams.order_id = currentOrderId;
@@ -2408,11 +2403,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2408
2403
  });
2409
2404
  checkoutResponse = await this.order.createOrderByCheckout(orderParams);
2410
2405
  submitSuccess = true;
2411
- this.logInfo("\u4E0B\u5355\u63A5\u53E3\u8C03\u7528\u6210\u529F", checkoutResponse);
2406
+ this.logInfo("下单接口调用成功", checkoutResponse);
2412
2407
  } catch (error) {
2413
2408
  submitSuccess = false;
2414
2409
  submitError = error instanceof Error ? error.message : String(error);
2415
- this.logError("\u4E0B\u5355\u63A5\u53E3\u8C03\u7528\u5931\u8D25:", submitError);
2410
+ this.logError("下单接口调用失败:", submitError);
2416
2411
  await this.core.effects.emit(`${this.name}:onOrderSyncFailed`, {
2417
2412
  orderUuid: this.store.currentOrder.uuid,
2418
2413
  operation: isUpdateOperation ? "update" : "create",
@@ -2438,7 +2433,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2438
2433
  const responseStatus = checkoutResponse == null ? void 0 : checkoutResponse.status;
2439
2434
  const isSuccessResponse = responseStatus === true || responseStatus === 200 || responseStatus === "success" || responseStatus === 1 && (checkoutResponse == null ? void 0 : checkoutResponse.code) === 200;
2440
2435
  if (!isSuccessResponse) {
2441
- const errorMessage = (checkoutResponse == null ? void 0 : checkoutResponse.message) || "\u8BA2\u5355\u540C\u6B65\u5931\u8D25\uFF0C\u540E\u7AEF\u8FD4\u56DE\u975E\u6210\u529F\u72B6\u6001";
2436
+ const errorMessage = (checkoutResponse == null ? void 0 : checkoutResponse.message) || "订单同步失败,后端返回非成功状态";
2442
2437
  await this.core.effects.emit(`${this.name}:onOrderSyncFailed`, {
2443
2438
  orderUuid: this.store.currentOrder.uuid,
2444
2439
  operation: isUpdateOperation ? "update" : "create",
@@ -2463,10 +2458,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2463
2458
  extractedOrderId = String(extractedOrderId);
2464
2459
  }
2465
2460
  if (!extractedOrderId) {
2466
- this.logError("\u540E\u7AEF\u8FD4\u56DE\u7684\u8BA2\u5355\u4FE1\u606F\u4E2D\u672A\u5305\u542B\u8BA2\u5355ID");
2461
+ this.logError("后端返回的订单信息中未包含订单ID");
2467
2462
  }
2468
2463
  realOrderId = extractedOrderId;
2469
- this.logInfo("\u51C6\u5907\u66FF\u6362\u8BA2\u5355ID:", {
2464
+ this.logInfo("准备替换订单ID:", {
2470
2465
  orderUuid: this.store.currentOrder.uuid,
2471
2466
  oldOrderId: this.store.currentOrder.order_id,
2472
2467
  newOrderId: realOrderId
@@ -2476,38 +2471,38 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2476
2471
  this.store.currentOrder.uuid,
2477
2472
  realOrderId
2478
2473
  );
2479
- this.logInfo("Payment\u6A21\u5757\u66FF\u6362\u8BA2\u5355ID\u7ED3\u679C:", {
2474
+ this.logInfo("Payment模块替换订单ID结果:", {
2480
2475
  wasSuccessful: !!updatedOrder,
2481
2476
  returnedOrderId: updatedOrder == null ? void 0 : updatedOrder.order_id,
2482
2477
  expectedOrderId: realOrderId
2483
2478
  });
2484
2479
  if (updatedOrder) {
2485
- this.logInfo("Payment\u6A21\u5757\u8FD4\u56DE\u7684\u66F4\u65B0\u540E\u8BA2\u5355:", {
2480
+ this.logInfo("Payment模块返回的更新后订单:", {
2486
2481
  uuid: updatedOrder.uuid,
2487
2482
  orderId: updatedOrder.order_id,
2488
2483
  totalAmount: updatedOrder.total_amount
2489
2484
  });
2490
2485
  this.store.currentOrder = updatedOrder;
2491
2486
  this.logInfo(
2492
- "[Checkout] \u8BA2\u5355ID\u66FF\u6362\u6210\u529F\uFF0C\u5F53\u524D\u8BA2\u5355ID:",
2487
+ "[Checkout] 订单ID替换成功,当前订单ID:",
2493
2488
  this.store.currentOrder.order_id
2494
2489
  );
2495
2490
  } else {
2496
2491
  this.logError(
2497
- "[Checkout] Payment\u6A21\u5757\u8FD4\u56DE\u7A7A\u8BA2\u5355\uFF0C\u8BA2\u5355ID\u66FF\u6362\u5931\u8D25\uFF0C\u5F00\u59CB\u624B\u52A8\u66FF\u6362"
2492
+ "[Checkout] Payment模块返回空订单,订单ID替换失败,开始手动替换"
2498
2493
  );
2499
2494
  const beforeManualUpdate = this.store.currentOrder.order_id;
2500
2495
  this.store.currentOrder.order_id = realOrderId;
2501
- this.logInfo("\u624B\u52A8\u8BBE\u7F6E\u8BA2\u5355ID:", {
2496
+ this.logInfo("手动设置订单ID:", {
2502
2497
  beforeReplacement: beforeManualUpdate,
2503
2498
  afterReplacement: this.store.currentOrder.order_id,
2504
- \u76EE\u6807ID: realOrderId
2499
+ 目标ID: realOrderId
2505
2500
  });
2506
2501
  }
2507
2502
  } catch (error) {
2508
- this.logError("\u8C03\u7528Payment\u6A21\u5757\u66FF\u6362\u8BA2\u5355ID\u65F6\u53D1\u751F\u9519\u8BEF:", error);
2503
+ this.logError("调用Payment模块替换订单ID时发生错误:", error);
2509
2504
  this.store.currentOrder.order_id = realOrderId;
2510
- this.logInfo("\u9519\u8BEF\u6062\u590D\uFF1A\u624B\u52A8\u8BBE\u7F6E\u8BA2\u5355ID:", realOrderId);
2505
+ this.logInfo("错误恢复:手动设置订单ID:", realOrderId);
2511
2506
  }
2512
2507
  }
2513
2508
  try {
@@ -2520,7 +2515,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2520
2515
  );
2521
2516
  }
2522
2517
  } catch (e) {
2523
- this.logWarning("\u6807\u8BB0\u652F\u4ED8\u9879\u5DF2\u540C\u6B65\u5931\u8D25\uFF08\u4E0D\u963B\u585E\u4E3B\u6D41\u7A0B\uFF09", { error: e });
2518
+ this.logWarning("标记支付项已同步失败(不阻塞主流程)", { error: e });
2524
2519
  }
2525
2520
  this.store.isOrderSynced = true;
2526
2521
  this.clearCalculationCache();
@@ -2565,7 +2560,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2565
2560
  if (!orderId) {
2566
2561
  return {
2567
2562
  success: false,
2568
- message: "\u8BA2\u5355ID\u4E0D\u80FD\u4E3A\u7A7A",
2563
+ message: "订单ID不能为空",
2569
2564
  orderId
2570
2565
  };
2571
2566
  }
@@ -2579,7 +2574,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2579
2574
  const response = await this.request.put(`/order/order/${orderId}/note`, {
2580
2575
  note
2581
2576
  });
2582
- this.logInfo("\u8BA2\u5355\u5907\u6CE8\u7F16\u8F91\u54CD\u5E94:", {
2577
+ this.logInfo("订单备注编辑响应:", {
2583
2578
  orderId,
2584
2579
  status: response.status,
2585
2580
  message: response.message,
@@ -2600,12 +2595,12 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2600
2595
  }
2601
2596
  return {
2602
2597
  success: true,
2603
- message: response.message || "\u8BA2\u5355\u5907\u6CE8\u4FEE\u6539\u6210\u529F",
2598
+ message: response.message || "订单备注修改成功",
2604
2599
  orderId
2605
2600
  };
2606
2601
  } else {
2607
- const errorMessage = response.message || "\u8BA2\u5355\u5907\u6CE8\u4FEE\u6539\u5931\u8D25";
2608
- this.logError(`\u8BA2\u5355 ${orderId} \u5907\u6CE8\u4FEE\u6539\u5931\u8D25:`, errorMessage);
2602
+ const errorMessage = response.message || "订单备注修改失败";
2603
+ this.logError(`订单 ${orderId} 备注修改失败:`, errorMessage);
2609
2604
  return {
2610
2605
  success: false,
2611
2606
  message: errorMessage,
@@ -2613,11 +2608,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2613
2608
  };
2614
2609
  }
2615
2610
  } catch (error) {
2616
- this.logError("\u7F16\u8F91\u8BA2\u5355\u5907\u6CE8\u5931\u8D25:", error);
2617
- const errorMessage = error instanceof Error ? error.message : "\u7F51\u7EDC\u9519\u8BEF\u6216\u670D\u52A1\u5668\u5F02\u5E38";
2611
+ this.logError("编辑订单备注失败:", error);
2612
+ const errorMessage = error instanceof Error ? error.message : "网络错误或服务器异常";
2618
2613
  return {
2619
2614
  success: false,
2620
- message: `\u7F16\u8F91\u8BA2\u5355\u5907\u6CE8\u5931\u8D25: ${errorMessage}`,
2615
+ message: `编辑订单备注失败: ${errorMessage}`,
2621
2616
  orderId
2622
2617
  };
2623
2618
  }
@@ -2643,13 +2638,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2643
2638
  if (!params.order_ids || params.order_ids.length === 0) {
2644
2639
  return {
2645
2640
  success: false,
2646
- message: "\u8BA2\u5355ID\u5217\u8868\u4E0D\u80FD\u4E3A\u7A7A"
2641
+ message: "订单ID列表不能为空"
2647
2642
  };
2648
2643
  }
2649
2644
  if (!params.emails || params.emails.length === 0) {
2650
2645
  return {
2651
2646
  success: false,
2652
- message: "\u90AE\u7BB1\u5730\u5740\u5217\u8868\u4E0D\u80FD\u4E3A\u7A7A"
2647
+ message: "邮箱地址列表不能为空"
2653
2648
  };
2654
2649
  }
2655
2650
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
@@ -2659,7 +2654,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2659
2654
  if (invalidEmails.length > 0) {
2660
2655
  return {
2661
2656
  success: false,
2662
- message: `\u90AE\u7BB1\u683C\u5F0F\u65E0\u6548: ${invalidEmails.join(", ")}`
2657
+ message: `邮箱格式无效: ${invalidEmails.join(", ")}`
2663
2658
  };
2664
2659
  }
2665
2660
  const requestBody = {
@@ -2675,7 +2670,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2675
2670
  "/order/batch-email",
2676
2671
  requestBody
2677
2672
  );
2678
- this.logInfo("\u652F\u4ED8\u94FE\u63A5\u90AE\u4EF6\u53D1\u9001\u54CD\u5E94:", {
2673
+ this.logInfo("支付链接邮件发送响应:", {
2679
2674
  status: response.status,
2680
2675
  message: response.message,
2681
2676
  data: response.data,
@@ -2684,22 +2679,22 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2684
2679
  if (response.status === true || response.status === 200) {
2685
2680
  return {
2686
2681
  success: true,
2687
- message: response.message || "\u652F\u4ED8\u94FE\u63A5\u90AE\u4EF6\u53D1\u9001\u6210\u529F"
2682
+ message: response.message || "支付链接邮件发送成功"
2688
2683
  };
2689
2684
  } else {
2690
- const errorMessage = response.message || "\u652F\u4ED8\u94FE\u63A5\u90AE\u4EF6\u53D1\u9001\u5931\u8D25";
2691
- console.error("[Checkout] \u652F\u4ED8\u94FE\u63A5\u90AE\u4EF6\u53D1\u9001\u5931\u8D25:", errorMessage);
2685
+ const errorMessage = response.message || "支付链接邮件发送失败";
2686
+ console.error("[Checkout] 支付链接邮件发送失败:", errorMessage);
2692
2687
  return {
2693
2688
  success: false,
2694
2689
  message: errorMessage
2695
2690
  };
2696
2691
  }
2697
2692
  } catch (error) {
2698
- this.logError("\u53D1\u9001\u5BA2\u6237\u652F\u4ED8\u94FE\u63A5\u90AE\u4EF6\u5931\u8D25:", error);
2699
- const errorMessage = error instanceof Error ? error.message : "\u7F51\u7EDC\u9519\u8BEF\u6216\u670D\u52A1\u5668\u5F02\u5E38";
2693
+ this.logError("发送客户支付链接邮件失败:", error);
2694
+ const errorMessage = error instanceof Error ? error.message : "网络错误或服务器异常";
2700
2695
  return {
2701
2696
  success: false,
2702
- message: `\u53D1\u9001\u652F\u4ED8\u94FE\u63A5\u90AE\u4EF6\u5931\u8D25: ${errorMessage}`
2697
+ message: `发送支付链接邮件失败: ${errorMessage}`
2703
2698
  };
2704
2699
  }
2705
2700
  }
@@ -2733,7 +2728,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2733
2728
  await ((_b = (_a = this.order) == null ? void 0 : _a.destroy) == null ? void 0 : _b.call(_a));
2734
2729
  await ((_d = (_c = this.payment) == null ? void 0 : _c.destroy) == null ? void 0 : _d.call(_c));
2735
2730
  this.core.unregisterModule(this);
2736
- console.log("[Checkout] \u5DF2\u9500\u6BC1");
2731
+ console.log("[Checkout] 已销毁");
2737
2732
  }
2738
2733
  /**
2739
2734
  * 重置 store 状态
@@ -2748,7 +2743,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2748
2743
  uuid: this.store.currentOrder.uuid,
2749
2744
  orderId: this.store.currentOrder.order_id
2750
2745
  } : null;
2751
- console.log("[Checkout] \u91CD\u7F6E store \u72B6\u6001\uFF0C\u51C6\u5907\u521B\u5EFA\u65B0\u8BA2\u5355", prevOrderInfo);
2746
+ console.log("[Checkout] 重置 store 状态,准备创建新订单", prevOrderInfo);
2752
2747
  this.store.currentOrder = void 0;
2753
2748
  this.store.localOrderData = void 0;
2754
2749
  this.store.cartSummary = void 0;
@@ -2760,7 +2755,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2760
2755
  this.store.cartItems = [];
2761
2756
  this.payment.wallet.clearAllCache();
2762
2757
  this.clearCalculationCache();
2763
- console.log("[Checkout] Store \u72B6\u6001\u91CD\u7F6E\u5B8C\u6210");
2758
+ console.log("[Checkout] Store 状态重置完成");
2764
2759
  if (prevOrderInfo) {
2765
2760
  setTimeout(() => {
2766
2761
  this.core.effects.emit(`${this.name}:onOrderCleared`, {
@@ -2770,7 +2765,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2770
2765
  }, 0);
2771
2766
  }
2772
2767
  } catch (error) {
2773
- console.error("[Checkout] \u91CD\u7F6E store \u72B6\u6001\u5931\u8D25:", error);
2768
+ console.error("[Checkout] 重置 store 状态失败:", error);
2774
2769
  }
2775
2770
  }
2776
2771
  };