@pisell/pisellos 0.0.243 → 0.0.244

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.
@@ -85,6 +85,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
85
85
  cartItems: [],
86
86
  paymentMethods: [],
87
87
  stateAmount: '0.00',
88
+ balanceDueAmount: '0.00',
88
89
  cartSummary: undefined,
89
90
  isOrderSynced: false,
90
91
  currentCustomer: undefined
@@ -934,30 +935,31 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
934
935
  this.payment.wallet.clearAllCache();
935
936
  this.store.cartItems = [];
936
937
  this.store.stateAmount = '0.00';
938
+ this.store.balanceDueAmount = '0.00';
937
939
  this.store.isOrderSynced = false;
938
940
  this.store.currentCustomer = undefined;
939
- _context14.next = 14;
941
+ _context14.next = 15;
940
942
  return this.setStatus(CheckoutStatus.Cancelled);
941
- case 14:
942
- _context14.next = 16;
943
+ case 15:
944
+ _context14.next = 17;
943
945
  return this.core.effects.emit(CheckoutHooks.OnCheckoutCancelled, {
944
946
  timestamp: Date.now()
945
947
  });
946
- case 16:
948
+ case 17:
947
949
  console.log('[Checkout] 结账流程已取消');
948
- _context14.next = 24;
950
+ _context14.next = 25;
949
951
  break;
950
- case 19:
951
- _context14.prev = 19;
952
+ case 20:
953
+ _context14.prev = 20;
952
954
  _context14.t0 = _context14["catch"](0);
953
955
  console.error('[Checkout] 取消结账失败:', _context14.t0);
954
- _context14.next = 24;
956
+ _context14.next = 25;
955
957
  return this.handleError(_context14.t0, CheckoutErrorType.UnknownError);
956
- case 24:
958
+ case 25:
957
959
  case "end":
958
960
  return _context14.stop();
959
961
  }
960
- }, _callee14, this, [[0, 19]]);
962
+ }, _callee14, this, [[0, 20]]);
961
963
  }));
962
964
  function cancelCheckoutAsync() {
963
965
  return _cancelCheckoutAsync.apply(this, arguments);
@@ -1507,6 +1509,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1507
1509
  return this.store.stateAmount;
1508
1510
  }
1509
1511
 
1512
+ /**
1513
+ * 获取系统计算的待付金额(只读)
1514
+ *
1515
+ * 此方法返回系统内部计算的实际待付金额,不允许外部修改
1516
+ *
1517
+ * @returns 当前系统计算的待付金额
1518
+ */
1519
+ }, {
1520
+ key: "getBalanceDueAmount",
1521
+ value: function getBalanceDueAmount() {
1522
+ return this.store.balanceDueAmount;
1523
+ }
1524
+
1510
1525
  /**
1511
1526
  * 刷新 stateAmount 为当前剩余未支付金额
1512
1527
  *
@@ -2458,6 +2473,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2458
2473
  this.store.currentOrder = undefined; // 释放 currentOrder
2459
2474
  this.store.localOrderData = undefined;
2460
2475
  this.store.stateAmount = '0.00';
2476
+ this.store.balanceDueAmount = '0.00';
2461
2477
  this.store.isOrderSynced = false;
2462
2478
  this.store.currentCustomer = undefined;
2463
2479
 
@@ -2466,7 +2482,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2466
2482
  console.log('[Checkout] 订单状态清理完成,currentOrder已释放');
2467
2483
 
2468
2484
  // 触发订单取消事件
2469
- _context32.next = 32;
2485
+ _context32.next = 33;
2470
2486
  return this.core.effects.emit(CheckoutHooks.OnOrderCancelled, {
2471
2487
  orderUuid: currentOrderUuid,
2472
2488
  orderId: currentOrderId,
@@ -2475,7 +2491,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2475
2491
  // 只有未同步订单可以被取消
2476
2492
  timestamp: Date.now()
2477
2493
  });
2478
- case 32:
2494
+ case 33:
2479
2495
  console.log('[Checkout] 本地订单取消完成:', {
2480
2496
  orderUuid: currentOrderUuid,
2481
2497
  orderId: currentOrderId,
@@ -2486,8 +2502,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2486
2502
  message: '本地订单已成功取消',
2487
2503
  orderId: currentOrderId
2488
2504
  });
2489
- case 36:
2490
- _context32.prev = 36;
2505
+ case 37:
2506
+ _context32.prev = 37;
2491
2507
  _context32.t1 = _context32["catch"](0);
2492
2508
  console.error('[Checkout] 取消本地订单失败:', _context32.t1);
2493
2509
  errorMessage = _context32.t1 instanceof Error ? _context32.t1.message : '未知错误';
@@ -2495,11 +2511,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2495
2511
  success: false,
2496
2512
  message: "\u53D6\u6D88\u8BA2\u5355\u5931\u8D25: ".concat(errorMessage)
2497
2513
  });
2498
- case 41:
2514
+ case 42:
2499
2515
  case "end":
2500
2516
  return _context32.stop();
2501
2517
  }
2502
- }, _callee32, this, [[0, 36], [12, 19]]);
2518
+ }, _callee32, this, [[0, 37], [12, 19]]);
2503
2519
  }));
2504
2520
  function cancelCurrentOrderAsync(_x21) {
2505
2521
  return _cancelCurrentOrderAsync.apply(this, arguments);
@@ -3332,14 +3348,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3332
3348
  return calculateRemainingAmountAsync;
3333
3349
  }()
3334
3350
  /**
3335
- * 更新 stateAmount 为当前剩余未支付金额
3351
+ * 更新 balanceDueAmount 为当前剩余未支付金额(系统内部计算)
3336
3352
  */
3337
3353
  )
3338
3354
  }, {
3339
- key: "updateStateAmountToRemaining",
3355
+ key: "updateBalanceDueAmount",
3340
3356
  value: (function () {
3341
- var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
3342
- var _this$store$currentOr17, remainingAmount, currentStateAmount;
3357
+ var _updateBalanceDueAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
3358
+ var _this$store$currentOr17, remainingAmount, currentBalanceDueAmount;
3343
3359
  return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3344
3360
  while (1) switch (_context46.prev = _context46.next) {
3345
3361
  case 0:
@@ -3348,23 +3364,92 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3348
3364
  return this.calculateRemainingAmountAsync();
3349
3365
  case 3:
3350
3366
  remainingAmount = _context46.sent;
3367
+ currentBalanceDueAmount = this.store.balanceDueAmount;
3368
+ console.log('[Checkout] updateBalanceDueAmount: 状态检查:', {
3369
+ calculatedRemainingAmount: remainingAmount,
3370
+ currentBalanceDueAmount: currentBalanceDueAmount,
3371
+ needsUpdate: remainingAmount !== currentBalanceDueAmount,
3372
+ orderUuid: (_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.uuid
3373
+ });
3374
+
3375
+ // 只有当剩余金额与当前 balanceDueAmount 不同时才更新
3376
+ if (!(remainingAmount !== currentBalanceDueAmount)) {
3377
+ _context46.next = 13;
3378
+ break;
3379
+ }
3380
+ this.store.balanceDueAmount = remainingAmount;
3381
+
3382
+ // 发出 balanceDueAmount 变更事件
3383
+ _context46.next = 10;
3384
+ return this.core.effects.emit(CheckoutHooks.OnBalanceDueAmountChanged, {
3385
+ oldAmount: currentBalanceDueAmount,
3386
+ newAmount: remainingAmount,
3387
+ timestamp: Date.now()
3388
+ });
3389
+ case 10:
3390
+ console.log('[Checkout] balanceDueAmount 已自动更新:', {
3391
+ oldAmount: currentBalanceDueAmount,
3392
+ newAmount: remainingAmount
3393
+ });
3394
+ _context46.next = 14;
3395
+ break;
3396
+ case 13:
3397
+ console.log('[Checkout] balanceDueAmount 无需更新,当前值已是最新:', {
3398
+ balanceDueAmount: currentBalanceDueAmount,
3399
+ remainingAmount: remainingAmount
3400
+ });
3401
+ case 14:
3402
+ _context46.next = 19;
3403
+ break;
3404
+ case 16:
3405
+ _context46.prev = 16;
3406
+ _context46.t0 = _context46["catch"](0);
3407
+ console.error('[Checkout] 更新 balanceDueAmount 失败:', _context46.t0);
3408
+ case 19:
3409
+ case "end":
3410
+ return _context46.stop();
3411
+ }
3412
+ }, _callee46, this, [[0, 16]]);
3413
+ }));
3414
+ function updateBalanceDueAmount() {
3415
+ return _updateBalanceDueAmount.apply(this, arguments);
3416
+ }
3417
+ return updateBalanceDueAmount;
3418
+ }()
3419
+ /**
3420
+ * 更新 stateAmount 为当前剩余未支付金额
3421
+ */
3422
+ )
3423
+ }, {
3424
+ key: "updateStateAmountToRemaining",
3425
+ value: (function () {
3426
+ var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
3427
+ var _this$store$currentOr18, remainingAmount, currentStateAmount;
3428
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
3429
+ while (1) switch (_context47.prev = _context47.next) {
3430
+ case 0:
3431
+ _context47.prev = 0;
3432
+ _context47.next = 3;
3433
+ return this.calculateRemainingAmountAsync();
3434
+ case 3:
3435
+ remainingAmount = _context47.sent;
3351
3436
  currentStateAmount = this.store.stateAmount;
3352
3437
  console.log('[Checkout] updateStateAmountToRemaining: 状态检查:', {
3353
3438
  calculatedRemainingAmount: remainingAmount,
3354
3439
  currentStateAmount: currentStateAmount,
3355
3440
  needsUpdate: remainingAmount !== currentStateAmount,
3356
- orderUuid: (_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.uuid
3441
+ orderUuid: (_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.uuid
3357
3442
  });
3358
3443
 
3359
3444
  // 只有当剩余金额与当前 stateAmount 不同时才更新
3360
3445
  if (!(remainingAmount !== currentStateAmount)) {
3361
- _context46.next = 13;
3446
+ _context47.next = 13;
3362
3447
  break;
3363
3448
  }
3364
3449
  this.store.stateAmount = remainingAmount;
3365
3450
 
3366
3451
  // 发出 stateAmount 变更事件
3367
- _context46.next = 10;
3452
+ _context47.next = 10;
3368
3453
  return this.core.effects.emit(CheckoutHooks.OnStateAmountChanged, {
3369
3454
  oldAmount: currentStateAmount,
3370
3455
  newAmount: remainingAmount,
@@ -3375,7 +3460,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3375
3460
  oldAmount: currentStateAmount,
3376
3461
  newAmount: remainingAmount
3377
3462
  });
3378
- _context46.next = 14;
3463
+ _context47.next = 14;
3379
3464
  break;
3380
3465
  case 13:
3381
3466
  console.log('[Checkout] stateAmount 无需更新,当前值已是最新:', {
@@ -3383,20 +3468,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3383
3468
  remainingAmount: remainingAmount
3384
3469
  });
3385
3470
  case 14:
3386
- _context46.next = 16;
3387
- return this.checkOrderPaymentCompletion();
3471
+ _context47.next = 16;
3472
+ return this.updateBalanceDueAmount();
3388
3473
  case 16:
3389
- _context46.next = 21;
3390
- break;
3474
+ _context47.next = 18;
3475
+ return this.checkOrderPaymentCompletion();
3391
3476
  case 18:
3392
- _context46.prev = 18;
3393
- _context46.t0 = _context46["catch"](0);
3394
- console.error('[Checkout] 更新 stateAmount 为剩余金额失败:', _context46.t0);
3395
- case 21:
3477
+ _context47.next = 23;
3478
+ break;
3479
+ case 20:
3480
+ _context47.prev = 20;
3481
+ _context47.t0 = _context47["catch"](0);
3482
+ console.error('[Checkout] 更新 stateAmount 为剩余金额失败:', _context47.t0);
3483
+ case 23:
3396
3484
  case "end":
3397
- return _context46.stop();
3485
+ return _context47.stop();
3398
3486
  }
3399
- }, _callee46, this, [[0, 18]]);
3487
+ }, _callee47, this, [[0, 20]]);
3400
3488
  }));
3401
3489
  function updateStateAmountToRemaining() {
3402
3490
  return _updateStateAmountToRemaining.apply(this, arguments);
@@ -3412,32 +3500,32 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3412
3500
  }, {
3413
3501
  key: "checkOrderPaymentCompletion",
3414
3502
  value: (function () {
3415
- var _checkOrderPaymentCompletion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
3503
+ var _checkOrderPaymentCompletion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
3416
3504
  var remainingAmount, remainingValue, totalAmount, paidAmount, currentPayments, hasPaymentItems, allPaymentsHaveVoucherId, shouldAutoSync;
3417
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
3418
- while (1) switch (_context47.prev = _context47.next) {
3505
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
3506
+ while (1) switch (_context48.prev = _context48.next) {
3419
3507
  case 0:
3420
- _context47.prev = 0;
3508
+ _context48.prev = 0;
3421
3509
  if (this.store.currentOrder) {
3422
- _context47.next = 3;
3510
+ _context48.next = 3;
3423
3511
  break;
3424
3512
  }
3425
- return _context47.abrupt("return");
3513
+ return _context48.abrupt("return");
3426
3514
  case 3:
3427
- _context47.next = 5;
3515
+ _context48.next = 5;
3428
3516
  return this.calculateRemainingAmountAsync();
3429
3517
  case 5:
3430
- remainingAmount = _context47.sent;
3518
+ remainingAmount = _context48.sent;
3431
3519
  remainingValue = parseFloat(remainingAmount); // 当剩余金额小于等于0时,认为订单已完成支付
3432
3520
  if (!(remainingValue <= 0)) {
3433
- _context47.next = 29;
3521
+ _context48.next = 29;
3434
3522
  break;
3435
3523
  }
3436
3524
  totalAmount = this.store.currentOrder.total_amount;
3437
- _context47.next = 11;
3525
+ _context48.next = 11;
3438
3526
  return this.calculatePaidAmountAsync();
3439
3527
  case 11:
3440
- paidAmount = _context47.sent;
3528
+ paidAmount = _context48.sent;
3441
3529
  console.log('[Checkout] 检测到订单支付完成:', {
3442
3530
  orderUuid: this.store.currentOrder.uuid,
3443
3531
  orderId: this.store.currentOrder.order_id,
@@ -3448,11 +3536,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3448
3536
  });
3449
3537
 
3450
3538
  // 从 Payment 模块获取最新支付项,检查自动同步条件
3451
- _context47.next = 15;
3539
+ _context48.next = 15;
3452
3540
  return this.payment.getPaymentItemsAsync(this.store.currentOrder.uuid, false // 不包括已撤销的支付项
3453
3541
  );
3454
3542
  case 15:
3455
- currentPayments = _context47.sent;
3543
+ currentPayments = _context48.sent;
3456
3544
  // 检查自动同步条件:
3457
3545
  // 1. 待付金额为 0 ✓ (已在上面检查)
3458
3546
  // 2. 需要有支付项
@@ -3484,14 +3572,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3484
3572
  })
3485
3573
  });
3486
3574
  if (!shouldAutoSync) {
3487
- _context47.next = 26;
3575
+ _context48.next = 26;
3488
3576
  break;
3489
3577
  }
3490
3578
  console.log('[Checkout] 满足自动同步条件,开始同步订单到后端...');
3491
- _context47.next = 24;
3579
+ _context48.next = 24;
3492
3580
  return this.syncOrderToBackend();
3493
3581
  case 24:
3494
- _context47.next = 27;
3582
+ _context48.next = 27;
3495
3583
  break;
3496
3584
  case 26:
3497
3585
  if (!hasPaymentItems) {
@@ -3500,7 +3588,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3500
3588
  console.log('[Checkout] 所有支付项均为代金券类型,跳过订单同步');
3501
3589
  }
3502
3590
  case 27:
3503
- _context47.next = 29;
3591
+ _context48.next = 29;
3504
3592
  return this.core.effects.emit(CheckoutHooks.OnOrderPaymentCompleted, {
3505
3593
  orderUuid: this.store.currentOrder.uuid,
3506
3594
  orderId: this.store.currentOrder.order_id,
@@ -3510,17 +3598,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3510
3598
  timestamp: Date.now()
3511
3599
  });
3512
3600
  case 29:
3513
- _context47.next = 34;
3601
+ _context48.next = 34;
3514
3602
  break;
3515
3603
  case 31:
3516
- _context47.prev = 31;
3517
- _context47.t0 = _context47["catch"](0);
3518
- console.error('[Checkout] 检查订单支付完成状态失败:', _context47.t0);
3604
+ _context48.prev = 31;
3605
+ _context48.t0 = _context48["catch"](0);
3606
+ console.error('[Checkout] 检查订单支付完成状态失败:', _context48.t0);
3519
3607
  case 34:
3520
3608
  case "end":
3521
- return _context47.stop();
3609
+ return _context48.stop();
3522
3610
  }
3523
- }, _callee47, this, [[0, 31]]);
3611
+ }, _callee48, this, [[0, 31]]);
3524
3612
  }));
3525
3613
  function checkOrderPaymentCompletion() {
3526
3614
  return _checkOrderPaymentCompletion.apply(this, arguments);
@@ -3592,8 +3680,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3592
3680
  }, {
3593
3681
  key: "syncOrderToBackendWithReturn",
3594
3682
  value: (function () {
3595
- var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
3596
- var _this$store$currentCu2, _this$store$currentOr18, _this$store$currentOr19, _checkoutResponse3, _checkoutResponse4, _checkoutResponse5, _checkoutResponse6;
3683
+ var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
3684
+ var _this$store$currentCu2, _this$store$currentOr19, _this$store$currentOr20, _checkoutResponse3, _checkoutResponse4, _checkoutResponse5, _checkoutResponse6, _checkoutResponse7, _checkoutResponse8;
3597
3685
  var isManual,
3598
3686
  customPaymentItems,
3599
3687
  syncType,
@@ -3610,22 +3698,28 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3610
3698
  submitError,
3611
3699
  _checkoutResponse,
3612
3700
  _checkoutResponse2,
3701
+ responseStatus,
3702
+ isSuccessResponse,
3703
+ _checkoutResponse9,
3704
+ _checkoutResponse10,
3705
+ _checkoutResponse11,
3706
+ errorMessage,
3613
3707
  realOrderId,
3614
- _checkoutResponse7,
3708
+ _checkoutResponse12,
3615
3709
  extractedOrderId,
3616
- _checkoutResponse8,
3710
+ _checkoutResponse13,
3617
3711
  updatedOrder,
3618
3712
  beforeManualUpdate,
3619
3713
  finalOrderId,
3620
3714
  finalIsVirtual,
3621
- _args48 = arguments;
3622
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
3623
- while (1) switch (_context48.prev = _context48.next) {
3715
+ _args49 = arguments;
3716
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
3717
+ while (1) switch (_context49.prev = _context49.next) {
3624
3718
  case 0:
3625
- isManual = _args48.length > 0 && _args48[0] !== undefined ? _args48[0] : false;
3626
- customPaymentItems = _args48.length > 1 ? _args48[1] : undefined;
3719
+ isManual = _args49.length > 0 && _args49[0] !== undefined ? _args49[0] : false;
3720
+ customPaymentItems = _args49.length > 1 ? _args49[1] : undefined;
3627
3721
  if (!(!this.store.localOrderData || !this.store.currentOrder)) {
3628
- _context48.next = 4;
3722
+ _context49.next = 4;
3629
3723
  break;
3630
3724
  }
3631
3725
  throw new Error('缺少必要的订单数据,无法同步到后端');
@@ -3666,17 +3760,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3666
3760
  });
3667
3761
 
3668
3762
  // 获取当前订单的支付项
3669
- _context48.t0 = customPaymentItems;
3670
- if (_context48.t0) {
3671
- _context48.next = 18;
3763
+ _context49.t0 = customPaymentItems;
3764
+ if (_context49.t0) {
3765
+ _context49.next = 18;
3672
3766
  break;
3673
3767
  }
3674
- _context48.next = 17;
3768
+ _context49.next = 17;
3675
3769
  return this.payment.getPaymentItemsAsync(this.store.currentOrder.uuid);
3676
3770
  case 17:
3677
- _context48.t0 = _context48.sent;
3771
+ _context49.t0 = _context49.sent;
3678
3772
  case 18:
3679
- paymentItems = _context48.t0;
3773
+ paymentItems = _context49.t0;
3680
3774
  console.log('[Checkout] 获取到支付项:', {
3681
3775
  count: paymentItems.length,
3682
3776
  isCustomFiltered: !!customPaymentItems,
@@ -3717,8 +3811,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3717
3811
  currency_code: this.otherParams.currency_code,
3718
3812
  currency_symbol: this.otherParams.currency_symbol,
3719
3813
  currency_format: this.otherParams.currency_format,
3720
- is_deposit: ((_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.is_deposit) || 0,
3721
- deposit_amount: ((_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.deposit_amount) || '0.00',
3814
+ is_deposit: ((_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.is_deposit) || 0,
3815
+ deposit_amount: ((_this$store$currentOr20 = this.store.currentOrder) === null || _this$store$currentOr20 === void 0 ? void 0 : _this$store$currentOr20.deposit_amount) || '0.00',
3722
3816
  // surcharge_fee: this.otherParams.surcharge_fee,
3723
3817
  // surcharges: ,
3724
3818
  note: this.store.localOrderData.shop_note
@@ -3749,7 +3843,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3749
3843
 
3750
3844
  // 发送下单接口请求开始事件
3751
3845
  startTime = Date.now();
3752
- _context48.next = 25;
3846
+ _context49.next = 25;
3753
3847
  return this.core.effects.emit(CheckoutHooks.OnOrderSubmitStart, {
3754
3848
  orderUuid: this.store.currentOrder.uuid,
3755
3849
  operation: isUpdateOperation ? 'update' : 'create',
@@ -3759,25 +3853,38 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3759
3853
  });
3760
3854
  case 25:
3761
3855
  submitSuccess = false;
3762
- _context48.prev = 26;
3763
- _context48.next = 29;
3856
+ _context49.prev = 26;
3857
+ _context49.next = 29;
3764
3858
  return this.order.createOrderByCheckout(orderParams);
3765
3859
  case 29:
3766
- checkoutResponse = _context48.sent;
3860
+ checkoutResponse = _context49.sent;
3767
3861
  submitSuccess = true;
3768
3862
  console.log('[Checkout] 下单接口调用成功');
3769
- _context48.next = 40;
3863
+ _context49.next = 41;
3770
3864
  break;
3771
3865
  case 34:
3772
- _context48.prev = 34;
3773
- _context48.t1 = _context48["catch"](26);
3866
+ _context49.prev = 34;
3867
+ _context49.t1 = _context49["catch"](26);
3774
3868
  submitSuccess = false;
3775
- submitError = _context48.t1 instanceof Error ? _context48.t1.message : String(_context48.t1);
3776
- console.error('[Checkout] 下单接口调用失败:', submitError);
3777
- throw _context48.t1;
3869
+ submitError = _context49.t1 instanceof Error ? _context49.t1.message : String(_context49.t1);
3870
+ // console.error('[Checkout] 下单接口调用失败:', submitError);
3871
+
3872
+ // 发送订单同步失败事件(网络错误或请求失败)
3873
+ _context49.next = 40;
3874
+ return this.core.effects.emit(CheckoutHooks.OnOrderSyncFailed, {
3875
+ orderUuid: this.store.currentOrder.uuid,
3876
+ operation: isUpdateOperation ? 'update' : 'create',
3877
+ isManual: isManual,
3878
+ error: submitError,
3879
+ errorType: 'network_error',
3880
+ duration: Date.now() - startTime,
3881
+ timestamp: Date.now()
3882
+ });
3778
3883
  case 40:
3779
- _context48.prev = 40;
3780
- _context48.next = 43;
3884
+ throw _context49.t1;
3885
+ case 41:
3886
+ _context49.prev = 41;
3887
+ _context49.next = 44;
3781
3888
  return this.core.effects.emit(CheckoutHooks.OnOrderSubmitEnd, {
3782
3889
  success: submitSuccess,
3783
3890
  orderUuid: this.store.currentOrder.uuid,
@@ -3788,29 +3895,62 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3788
3895
  duration: Date.now() - startTime,
3789
3896
  timestamp: Date.now()
3790
3897
  });
3791
- case 43:
3792
- return _context48.finish(40);
3793
3898
  case 44:
3899
+ return _context49.finish(41);
3900
+ case 45:
3794
3901
  console.log('[Checkout] 后端返回的响应数据:', {
3795
3902
  status: (_checkoutResponse3 = checkoutResponse) === null || _checkoutResponse3 === void 0 ? void 0 : _checkoutResponse3.status,
3796
3903
  code: (_checkoutResponse4 = checkoutResponse) === null || _checkoutResponse4 === void 0 ? void 0 : _checkoutResponse4.code,
3797
3904
  message: (_checkoutResponse5 = checkoutResponse) === null || _checkoutResponse5 === void 0 ? void 0 : _checkoutResponse5.message,
3798
3905
  data: (_checkoutResponse6 = checkoutResponse) === null || _checkoutResponse6 === void 0 ? void 0 : _checkoutResponse6.data
3799
3906
  });
3907
+
3908
+ // 检查响应状态是否为成功状态
3909
+ responseStatus = (_checkoutResponse7 = checkoutResponse) === null || _checkoutResponse7 === void 0 ? void 0 : _checkoutResponse7.status;
3910
+ isSuccessResponse = responseStatus === true || responseStatus === 200 || responseStatus === 'success' || responseStatus === 1 && ((_checkoutResponse8 = checkoutResponse) === null || _checkoutResponse8 === void 0 ? void 0 : _checkoutResponse8.code) === 200;
3911
+ if (isSuccessResponse) {
3912
+ _context49.next = 54;
3913
+ break;
3914
+ }
3915
+ errorMessage = ((_checkoutResponse9 = checkoutResponse) === null || _checkoutResponse9 === void 0 ? void 0 : _checkoutResponse9.message) || '订单同步失败,后端返回非成功状态';
3916
+ console.error('[Checkout] 订单同步失败,响应状态检查未通过:', {
3917
+ expectedSuccess: true,
3918
+ actualStatus: responseStatus,
3919
+ code: (_checkoutResponse10 = checkoutResponse) === null || _checkoutResponse10 === void 0 ? void 0 : _checkoutResponse10.code,
3920
+ message: (_checkoutResponse11 = checkoutResponse) === null || _checkoutResponse11 === void 0 ? void 0 : _checkoutResponse11.message,
3921
+ errorMessage: errorMessage
3922
+ });
3923
+
3924
+ // 发送订单同步失败事件
3925
+ _context49.next = 53;
3926
+ return this.core.effects.emit(CheckoutHooks.OnOrderSyncFailed, {
3927
+ orderUuid: this.store.currentOrder.uuid,
3928
+ operation: isUpdateOperation ? 'update' : 'create',
3929
+ isManual: isManual,
3930
+ error: errorMessage,
3931
+ errorType: 'api_error',
3932
+ response: checkoutResponse,
3933
+ duration: Date.now() - startTime,
3934
+ timestamp: Date.now()
3935
+ });
3936
+ case 53:
3937
+ throw new Error(errorMessage);
3938
+ case 54:
3939
+ console.log('[Checkout] 响应状态检查通过,开始处理订单数据');
3800
3940
  if (!isUpdateOperation) {
3801
- _context48.next = 50;
3941
+ _context49.next = 60;
3802
3942
  break;
3803
3943
  }
3804
3944
  // 更新操作:使用现有的订单ID
3805
3945
  realOrderId = currentOrderId;
3806
3946
  console.log("[Checkout] \u8BA2\u5355\u66F4\u65B0\u6210\u529F\uFF0C\u8BA2\u5355ID: ".concat(realOrderId));
3807
- _context48.next = 71;
3947
+ _context49.next = 81;
3808
3948
  break;
3809
- case 50:
3949
+ case 60:
3810
3950
  // 创建操作:从响应中提取新的订单ID
3811
- extractedOrderId = (_checkoutResponse7 = checkoutResponse) === null || _checkoutResponse7 === void 0 || (_checkoutResponse7 = _checkoutResponse7.data) === null || _checkoutResponse7 === void 0 ? void 0 : _checkoutResponse7.order_id; // 如果data.order_id不存在,尝试直接从根级获取
3951
+ extractedOrderId = (_checkoutResponse12 = checkoutResponse) === null || _checkoutResponse12 === void 0 || (_checkoutResponse12 = _checkoutResponse12.data) === null || _checkoutResponse12 === void 0 ? void 0 : _checkoutResponse12.order_id; // 如果data.order_id不存在,尝试直接从根级获取
3812
3952
  if (!extractedOrderId) {
3813
- extractedOrderId = (_checkoutResponse8 = checkoutResponse) === null || _checkoutResponse8 === void 0 ? void 0 : _checkoutResponse8.order_id;
3953
+ extractedOrderId = (_checkoutResponse13 = checkoutResponse) === null || _checkoutResponse13 === void 0 ? void 0 : _checkoutResponse13.order_id;
3814
3954
  }
3815
3955
 
3816
3956
  // 确保转换为字符串类型
@@ -3818,11 +3958,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3818
3958
  extractedOrderId = String(extractedOrderId);
3819
3959
  }
3820
3960
  if (extractedOrderId) {
3821
- _context48.next = 55;
3961
+ _context49.next = 65;
3822
3962
  break;
3823
3963
  }
3824
3964
  throw new Error('后端返回的订单信息中未包含订单ID');
3825
- case 55:
3965
+ case 65:
3826
3966
  realOrderId = extractedOrderId;
3827
3967
  console.log('[Checkout] 订单创建成功,真实订单ID:', realOrderId);
3828
3968
 
@@ -3832,11 +3972,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3832
3972
  oldOrderId: this.store.currentOrder.order_id,
3833
3973
  newOrderId: realOrderId
3834
3974
  });
3835
- _context48.prev = 58;
3836
- _context48.next = 61;
3975
+ _context49.prev = 68;
3976
+ _context49.next = 71;
3837
3977
  return this.payment.replaceOrderIdByUuidAsync(this.store.currentOrder.uuid, realOrderId);
3838
- case 61:
3839
- updatedOrder = _context48.sent;
3978
+ case 71:
3979
+ updatedOrder = _context49.sent;
3840
3980
  console.log('[Checkout] Payment模块替换订单ID结果:', {
3841
3981
  wasSuccessful: !!updatedOrder,
3842
3982
  returnedOrderId: updatedOrder === null || updatedOrder === void 0 ? void 0 : updatedOrder.order_id,
@@ -3862,22 +4002,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3862
4002
  目标ID: realOrderId
3863
4003
  });
3864
4004
  }
3865
- _context48.next = 71;
4005
+ _context49.next = 81;
3866
4006
  break;
3867
- case 66:
3868
- _context48.prev = 66;
3869
- _context48.t2 = _context48["catch"](58);
3870
- console.error('[Checkout] 调用Payment模块替换订单ID时发生错误:', _context48.t2);
4007
+ case 76:
4008
+ _context49.prev = 76;
4009
+ _context49.t2 = _context49["catch"](68);
4010
+ console.error('[Checkout] 调用Payment模块替换订单ID时发生错误:', _context49.t2);
3871
4011
 
3872
4012
  // 发生错误时也进行手动替换
3873
4013
  this.store.currentOrder.order_id = realOrderId;
3874
4014
  console.log('[Checkout] 错误恢复:手动设置订单ID:', realOrderId);
3875
- case 71:
4015
+ case 81:
3876
4016
  // 标记订单已同步
3877
4017
  this.store.isOrderSynced = true;
3878
4018
 
3879
4019
  // 触发订单同步完成事件
3880
- _context48.next = 74;
4020
+ _context49.next = 84;
3881
4021
  return this.core.effects.emit(CheckoutHooks.OnOrderSynced, {
3882
4022
  orderUuid: this.store.currentOrder.uuid,
3883
4023
  realOrderId: realOrderId,
@@ -3886,7 +4026,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3886
4026
  isManual: isManual,
3887
4027
  response: checkoutResponse
3888
4028
  });
3889
- case 74:
4029
+ case 84:
3890
4030
  // 验证最终状态
3891
4031
  finalOrderId = this.store.currentOrder.order_id;
3892
4032
  finalIsVirtual = this.isVirtualOrderId(finalOrderId || '');
@@ -3903,12 +4043,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3903
4043
  }
3904
4044
 
3905
4045
  // 返回真实订单ID
3906
- return _context48.abrupt("return", realOrderId);
3907
- case 79:
4046
+ return _context49.abrupt("return", realOrderId);
4047
+ case 89:
3908
4048
  case "end":
3909
- return _context48.stop();
4049
+ return _context49.stop();
3910
4050
  }
3911
- }, _callee48, this, [[26, 34, 40, 44], [58, 66]]);
4051
+ }, _callee49, this, [[26, 34, 41, 45], [68, 76]]);
3912
4052
  }));
3913
4053
  function syncOrderToBackendWithReturn() {
3914
4054
  return _syncOrderToBackendWithReturn.apply(this, arguments);
@@ -3918,27 +4058,27 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3918
4058
  }, {
3919
4059
  key: "syncOrderToBackend",
3920
4060
  value: function () {
3921
- var _syncOrderToBackend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
3922
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
3923
- while (1) switch (_context49.prev = _context49.next) {
4061
+ var _syncOrderToBackend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
4062
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4063
+ while (1) switch (_context50.prev = _context50.next) {
3924
4064
  case 0:
3925
- _context49.prev = 0;
3926
- _context49.next = 3;
4065
+ _context50.prev = 0;
4066
+ _context50.next = 3;
3927
4067
  return this.syncOrderToBackendWithReturn(false);
3928
4068
  case 3:
3929
- _context49.next = 10;
4069
+ _context50.next = 10;
3930
4070
  break;
3931
4071
  case 5:
3932
- _context49.prev = 5;
3933
- _context49.t0 = _context49["catch"](0);
3934
- console.error('[Checkout] 同步订单到后端失败:', _context49.t0);
3935
- _context49.next = 10;
3936
- return this.handleError(new Error("\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context49.t0 instanceof Error ? _context49.t0.message : String(_context49.t0))), CheckoutErrorType.OrderCreationFailed);
4072
+ _context50.prev = 5;
4073
+ _context50.t0 = _context50["catch"](0);
4074
+ console.error('[Checkout] 同步订单到后端失败:', _context50.t0);
4075
+ _context50.next = 10;
4076
+ return this.handleError(new Error("\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context50.t0 instanceof Error ? _context50.t0.message : String(_context50.t0))), CheckoutErrorType.OrderCreationFailed);
3937
4077
  case 10:
3938
4078
  case "end":
3939
- return _context49.stop();
4079
+ return _context50.stop();
3940
4080
  }
3941
- }, _callee49, this, [[0, 5]]);
4081
+ }, _callee50, this, [[0, 5]]);
3942
4082
  }));
3943
4083
  function syncOrderToBackend() {
3944
4084
  return _syncOrderToBackend.apply(this, arguments);
@@ -3978,15 +4118,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3978
4118
  }, {
3979
4119
  key: "setOtherParams",
3980
4120
  value: function () {
3981
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
4121
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
3982
4122
  var _ref5,
3983
4123
  _ref5$cover,
3984
4124
  cover,
3985
- _args50 = arguments;
3986
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
3987
- while (1) switch (_context50.prev = _context50.next) {
4125
+ _args51 = arguments;
4126
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4127
+ while (1) switch (_context51.prev = _context51.next) {
3988
4128
  case 0:
3989
- _ref5 = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
4129
+ _ref5 = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
3990
4130
  if (cover) {
3991
4131
  this.otherParams = params;
3992
4132
  } else {
@@ -3994,9 +4134,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3994
4134
  }
3995
4135
  case 2:
3996
4136
  case "end":
3997
- return _context50.stop();
4137
+ return _context51.stop();
3998
4138
  }
3999
- }, _callee50, this);
4139
+ }, _callee51, this);
4000
4140
  }));
4001
4141
  function setOtherParams(_x32) {
4002
4142
  return _setOtherParams.apply(this, arguments);
@@ -4015,12 +4155,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4015
4155
  }, {
4016
4156
  key: "editOrderNoteByOrderIdAsync",
4017
4157
  value: (function () {
4018
- var _editOrderNoteByOrderIdAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(orderId, note) {
4158
+ var _editOrderNoteByOrderIdAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(orderId, note) {
4019
4159
  var response, previousNote, errorMessage, _errorMessage;
4020
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4021
- while (1) switch (_context51.prev = _context51.next) {
4160
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
4161
+ while (1) switch (_context52.prev = _context52.next) {
4022
4162
  case 0:
4023
- _context51.prev = 0;
4163
+ _context52.prev = 0;
4024
4164
  console.log('[Checkout] 开始编辑订单备注:', {
4025
4165
  orderId: orderId,
4026
4166
  note: note,
@@ -4029,21 +4169,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4029
4169
 
4030
4170
  // 参数验证
4031
4171
  if (orderId) {
4032
- _context51.next = 4;
4172
+ _context52.next = 4;
4033
4173
  break;
4034
4174
  }
4035
- return _context51.abrupt("return", {
4175
+ return _context52.abrupt("return", {
4036
4176
  success: false,
4037
4177
  message: '订单ID不能为空',
4038
4178
  orderId: orderId
4039
4179
  });
4040
4180
  case 4:
4041
- _context51.next = 6;
4181
+ _context52.next = 6;
4042
4182
  return this.request.put("/order/order/".concat(orderId, "/note"), {
4043
4183
  note: note
4044
4184
  });
4045
4185
  case 6:
4046
- response = _context51.sent;
4186
+ response = _context52.sent;
4047
4187
  console.log('[Checkout] 订单备注编辑响应:', {
4048
4188
  orderId: orderId,
4049
4189
  status: response.status,
@@ -4053,14 +4193,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4053
4193
 
4054
4194
  // 检查响应状态
4055
4195
  if (!(response.status === true || response.status === 200)) {
4056
- _context51.next = 19;
4196
+ _context52.next = 19;
4057
4197
  break;
4058
4198
  }
4059
4199
  console.log("[Checkout] \u8BA2\u5355 ".concat(orderId, " \u5907\u6CE8\u4FEE\u6539\u6210\u529F"));
4060
4200
 
4061
4201
  // 如果当前订单就是被修改的订单,同时更新本地状态
4062
4202
  if (!(this.store.currentOrder && (String(this.store.currentOrder.order_id) === String(orderId) || String(this.store.currentOrder.id) === String(orderId)))) {
4063
- _context51.next = 16;
4203
+ _context52.next = 16;
4064
4204
  break;
4065
4205
  }
4066
4206
  console.log('[Checkout] 更新本地订单备注状态');
@@ -4072,7 +4212,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4072
4212
  }
4073
4213
 
4074
4214
  // 触发订单备注变更事件
4075
- _context51.next = 16;
4215
+ _context52.next = 16;
4076
4216
  return this.core.effects.emit(CheckoutHooks.OnOrderNoteChanged, {
4077
4217
  orderUuid: this.store.currentOrder.uuid,
4078
4218
  oldNote: previousNote,
@@ -4080,7 +4220,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4080
4220
  timestamp: Date.now()
4081
4221
  });
4082
4222
  case 16:
4083
- return _context51.abrupt("return", {
4223
+ return _context52.abrupt("return", {
4084
4224
  success: true,
4085
4225
  message: response.message || '订单备注修改成功',
4086
4226
  orderId: orderId
@@ -4089,29 +4229,29 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4089
4229
  // API返回失败状态
4090
4230
  errorMessage = response.message || '订单备注修改失败';
4091
4231
  console.error("[Checkout] \u8BA2\u5355 ".concat(orderId, " \u5907\u6CE8\u4FEE\u6539\u5931\u8D25:"), errorMessage);
4092
- return _context51.abrupt("return", {
4232
+ return _context52.abrupt("return", {
4093
4233
  success: false,
4094
4234
  message: errorMessage,
4095
4235
  orderId: orderId
4096
4236
  });
4097
4237
  case 22:
4098
- _context51.next = 29;
4238
+ _context52.next = 29;
4099
4239
  break;
4100
4240
  case 24:
4101
- _context51.prev = 24;
4102
- _context51.t0 = _context51["catch"](0);
4103
- console.error('[Checkout] 编辑订单备注失败:', _context51.t0);
4104
- _errorMessage = _context51.t0 instanceof Error ? _context51.t0.message : '网络错误或服务器异常';
4105
- return _context51.abrupt("return", {
4241
+ _context52.prev = 24;
4242
+ _context52.t0 = _context52["catch"](0);
4243
+ console.error('[Checkout] 编辑订单备注失败:', _context52.t0);
4244
+ _errorMessage = _context52.t0 instanceof Error ? _context52.t0.message : '网络错误或服务器异常';
4245
+ return _context52.abrupt("return", {
4106
4246
  success: false,
4107
4247
  message: "\u7F16\u8F91\u8BA2\u5355\u5907\u6CE8\u5931\u8D25: ".concat(_errorMessage),
4108
4248
  orderId: orderId
4109
4249
  });
4110
4250
  case 29:
4111
4251
  case "end":
4112
- return _context51.stop();
4252
+ return _context52.stop();
4113
4253
  }
4114
- }, _callee51, this, [[0, 24]]);
4254
+ }, _callee52, this, [[0, 24]]);
4115
4255
  }));
4116
4256
  function editOrderNoteByOrderIdAsync(_x33, _x34) {
4117
4257
  return _editOrderNoteByOrderIdAsync.apply(this, arguments);
@@ -4130,12 +4270,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4130
4270
  }, {
4131
4271
  key: "sendCustomerPayLinkAsync",
4132
4272
  value: (function () {
4133
- var _sendCustomerPayLinkAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
4273
+ var _sendCustomerPayLinkAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
4134
4274
  var emailRegex, invalidEmails, requestBody, response, errorMessage, _errorMessage2;
4135
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
4136
- while (1) switch (_context52.prev = _context52.next) {
4275
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
4276
+ while (1) switch (_context53.prev = _context53.next) {
4137
4277
  case 0:
4138
- _context52.prev = 0;
4278
+ _context53.prev = 0;
4139
4279
  console.log('[Checkout] 开始发送客户支付链接邮件:', {
4140
4280
  orderIds: params.order_ids,
4141
4281
  emails: params.emails,
@@ -4144,19 +4284,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4144
4284
 
4145
4285
  // 参数验证
4146
4286
  if (!(!params.order_ids || params.order_ids.length === 0)) {
4147
- _context52.next = 4;
4287
+ _context53.next = 4;
4148
4288
  break;
4149
4289
  }
4150
- return _context52.abrupt("return", {
4290
+ return _context53.abrupt("return", {
4151
4291
  success: false,
4152
4292
  message: '订单ID列表不能为空'
4153
4293
  });
4154
4294
  case 4:
4155
4295
  if (!(!params.emails || params.emails.length === 0)) {
4156
- _context52.next = 6;
4296
+ _context53.next = 6;
4157
4297
  break;
4158
4298
  }
4159
- return _context52.abrupt("return", {
4299
+ return _context53.abrupt("return", {
4160
4300
  success: false,
4161
4301
  message: '邮箱地址列表不能为空'
4162
4302
  });
@@ -4167,10 +4307,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4167
4307
  return !emailRegex.test(email);
4168
4308
  });
4169
4309
  if (!(invalidEmails.length > 0)) {
4170
- _context52.next = 10;
4310
+ _context53.next = 10;
4171
4311
  break;
4172
4312
  }
4173
- return _context52.abrupt("return", {
4313
+ return _context53.abrupt("return", {
4174
4314
  success: false,
4175
4315
  message: "\u90AE\u7BB1\u683C\u5F0F\u65E0\u6548: ".concat(invalidEmails.join(', '))
4176
4316
  });
@@ -4184,10 +4324,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4184
4324
  console.log('[Checkout] 发送支付链接邮件请求参数:', requestBody);
4185
4325
 
4186
4326
  // 调用后端API发送邮件
4187
- _context52.next = 14;
4327
+ _context53.next = 14;
4188
4328
  return this.request.post('/order/batch-email', requestBody);
4189
4329
  case 14:
4190
- response = _context52.sent;
4330
+ response = _context53.sent;
4191
4331
  console.log('[Checkout] 支付链接邮件发送响应:', {
4192
4332
  status: response.status,
4193
4333
  message: response.message,
@@ -4197,11 +4337,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4197
4337
 
4198
4338
  // 检查响应状态
4199
4339
  if (!(response.status === true || response.status === 200)) {
4200
- _context52.next = 21;
4340
+ _context53.next = 21;
4201
4341
  break;
4202
4342
  }
4203
4343
  console.log('[Checkout] 支付链接邮件发送成功');
4204
- return _context52.abrupt("return", {
4344
+ return _context53.abrupt("return", {
4205
4345
  success: true,
4206
4346
  message: response.message || '支付链接邮件发送成功'
4207
4347
  });
@@ -4209,27 +4349,27 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4209
4349
  // API返回失败状态
4210
4350
  errorMessage = response.message || '支付链接邮件发送失败';
4211
4351
  console.error('[Checkout] 支付链接邮件发送失败:', errorMessage);
4212
- return _context52.abrupt("return", {
4352
+ return _context53.abrupt("return", {
4213
4353
  success: false,
4214
4354
  message: errorMessage
4215
4355
  });
4216
4356
  case 24:
4217
- _context52.next = 31;
4357
+ _context53.next = 31;
4218
4358
  break;
4219
4359
  case 26:
4220
- _context52.prev = 26;
4221
- _context52.t0 = _context52["catch"](0);
4222
- console.error('[Checkout] 发送客户支付链接邮件失败:', _context52.t0);
4223
- _errorMessage2 = _context52.t0 instanceof Error ? _context52.t0.message : '网络错误或服务器异常';
4224
- return _context52.abrupt("return", {
4360
+ _context53.prev = 26;
4361
+ _context53.t0 = _context53["catch"](0);
4362
+ console.error('[Checkout] 发送客户支付链接邮件失败:', _context53.t0);
4363
+ _errorMessage2 = _context53.t0 instanceof Error ? _context53.t0.message : '网络错误或服务器异常';
4364
+ return _context53.abrupt("return", {
4225
4365
  success: false,
4226
4366
  message: "\u53D1\u9001\u652F\u4ED8\u94FE\u63A5\u90AE\u4EF6\u5931\u8D25: ".concat(_errorMessage2)
4227
4367
  });
4228
4368
  case 31:
4229
4369
  case "end":
4230
- return _context52.stop();
4370
+ return _context53.stop();
4231
4371
  }
4232
- }, _callee52, this, [[0, 26]]);
4372
+ }, _callee53, this, [[0, 26]]);
4233
4373
  }));
4234
4374
  function sendCustomerPayLinkAsync(_x35) {
4235
4375
  return _sendCustomerPayLinkAsync.apply(this, arguments);
@@ -4246,23 +4386,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4246
4386
  }, {
4247
4387
  key: "roundAmountAsync",
4248
4388
  value: (function () {
4249
- var _roundAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(amount) {
4389
+ var _roundAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(amount) {
4250
4390
  var _this$otherParams$ord, _this$otherParams$ord2;
4251
4391
  var result;
4252
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
4253
- while (1) switch (_context53.prev = _context53.next) {
4392
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
4393
+ while (1) switch (_context54.prev = _context54.next) {
4254
4394
  case 0:
4255
- _context53.next = 2;
4395
+ _context54.next = 2;
4256
4396
  return this.payment.roundAmountAsync(amount, (_this$otherParams$ord = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord === void 0 ? void 0 : _this$otherParams$ord.interval, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.type);
4257
4397
  case 2:
4258
- result = _context53.sent;
4398
+ result = _context54.sent;
4259
4399
  console.log("[Checkout] \u91D1\u989D\u820D\u5165\u5B8C\u6210 - \u539F\u59CB: ".concat(result.originalAmount, ", \u820D\u5165\u540E: ").concat(result.roundedAmount, ", \u5DEE\u989D: ").concat(result.roundingDifference));
4260
- return _context53.abrupt("return", result);
4400
+ return _context54.abrupt("return", result);
4261
4401
  case 5:
4262
4402
  case "end":
4263
- return _context53.stop();
4403
+ return _context54.stop();
4264
4404
  }
4265
- }, _callee53, this);
4405
+ }, _callee54, this);
4266
4406
  }));
4267
4407
  function roundAmountAsync(_x36) {
4268
4408
  return _roundAmountAsync.apply(this, arguments);
@@ -4272,10 +4412,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4272
4412
  }, {
4273
4413
  key: "destroy",
4274
4414
  value: function () {
4275
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
4415
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
4276
4416
  var _this$order, _this$order$destroy, _this$payment, _this$payment$destroy;
4277
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
4278
- while (1) switch (_context54.prev = _context54.next) {
4417
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
4418
+ while (1) switch (_context55.prev = _context55.next) {
4279
4419
  case 0:
4280
4420
  // 清理钱包模块的所有缓存数据
4281
4421
  this.payment.wallet.clearAllCache();
@@ -4284,10 +4424,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4284
4424
  this.core.effects.offByModuleDestroy(this.name);
4285
4425
 
4286
4426
  // 销毁子模块
4287
- _context54.next = 4;
4427
+ _context55.next = 4;
4288
4428
  return (_this$order = this.order) === null || _this$order === void 0 || (_this$order$destroy = _this$order.destroy) === null || _this$order$destroy === void 0 ? void 0 : _this$order$destroy.call(_this$order);
4289
4429
  case 4:
4290
- _context54.next = 6;
4430
+ _context55.next = 6;
4291
4431
  return (_this$payment = this.payment) === null || _this$payment === void 0 || (_this$payment$destroy = _this$payment.destroy) === null || _this$payment$destroy === void 0 ? void 0 : _this$payment$destroy.call(_this$payment);
4292
4432
  case 6:
4293
4433
  // 取消注册模块
@@ -4295,9 +4435,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4295
4435
  console.log('[Checkout] 已销毁');
4296
4436
  case 8:
4297
4437
  case "end":
4298
- return _context54.stop();
4438
+ return _context55.stop();
4299
4439
  }
4300
- }, _callee54, this);
4440
+ }, _callee55, this);
4301
4441
  }));
4302
4442
  function destroy() {
4303
4443
  return _destroy.apply(this, arguments);
@@ -4312,12 +4452,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4312
4452
  }, {
4313
4453
  key: "resetStoreStateAsync",
4314
4454
  value: (function () {
4315
- var _resetStoreStateAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
4455
+ var _resetStoreStateAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
4316
4456
  var prevOrderInfo;
4317
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
4318
- while (1) switch (_context55.prev = _context55.next) {
4457
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
4458
+ while (1) switch (_context56.prev = _context56.next) {
4319
4459
  case 0:
4320
- _context55.prev = 0;
4460
+ _context56.prev = 0;
4321
4461
  prevOrderInfo = this.store.currentOrder ? {
4322
4462
  uuid: this.store.currentOrder.uuid,
4323
4463
  orderId: this.store.currentOrder.order_id
@@ -4329,6 +4469,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4329
4469
  this.store.localOrderData = undefined;
4330
4470
  this.store.cartSummary = undefined;
4331
4471
  this.store.stateAmount = '0.00';
4472
+ this.store.balanceDueAmount = '0.00';
4332
4473
  this.store.isOrderSynced = false;
4333
4474
  this.store.currentCustomer = undefined;
4334
4475
  this.store.lastError = undefined;
@@ -4342,36 +4483,36 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4342
4483
  // 注意:故意保留 this.store.paymentMethods,因为支付方式数据不易变更,保留在内存中提高性能
4343
4484
 
4344
4485
  // 重置状态和步骤为初始状态
4345
- _context55.next = 14;
4486
+ _context56.next = 15;
4346
4487
  return this.setStatus(CheckoutStatus.Ready);
4347
- case 14:
4348
- _context55.next = 16;
4488
+ case 15:
4489
+ _context56.next = 17;
4349
4490
  return this.setStep(CheckoutStep.OrderConfirmation);
4350
- case 16:
4491
+ case 17:
4351
4492
  console.log('[Checkout] Store 状态重置完成');
4352
4493
 
4353
4494
  // 触发订单清理事件(如果之前有订单)
4354
4495
  if (!prevOrderInfo) {
4355
- _context55.next = 20;
4496
+ _context56.next = 21;
4356
4497
  break;
4357
4498
  }
4358
- _context55.next = 20;
4499
+ _context56.next = 21;
4359
4500
  return this.core.effects.emit(CheckoutHooks.OnOrderCleared, {
4360
4501
  previousOrder: prevOrderInfo,
4361
4502
  timestamp: Date.now()
4362
4503
  });
4363
- case 20:
4364
- _context55.next = 25;
4504
+ case 21:
4505
+ _context56.next = 26;
4365
4506
  break;
4366
- case 22:
4367
- _context55.prev = 22;
4368
- _context55.t0 = _context55["catch"](0);
4369
- console.error('[Checkout] 重置 store 状态失败:', _context55.t0);
4370
- case 25:
4507
+ case 23:
4508
+ _context56.prev = 23;
4509
+ _context56.t0 = _context56["catch"](0);
4510
+ console.error('[Checkout] 重置 store 状态失败:', _context56.t0);
4511
+ case 26:
4371
4512
  case "end":
4372
- return _context55.stop();
4513
+ return _context56.stop();
4373
4514
  }
4374
- }, _callee55, this, [[0, 22]]);
4515
+ }, _callee56, this, [[0, 23]]);
4375
4516
  }));
4376
4517
  function resetStoreStateAsync() {
4377
4518
  return _resetStoreStateAsync.apply(this, arguments);
@@ -4389,37 +4530,37 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
4389
4530
  }, {
4390
4531
  key: "clearCompletedOrderAsync",
4391
4532
  value: (function () {
4392
- var _clearCompletedOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
4533
+ var _clearCompletedOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57() {
4393
4534
  var prevOrderInfo;
4394
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
4395
- while (1) switch (_context56.prev = _context56.next) {
4535
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
4536
+ while (1) switch (_context57.prev = _context57.next) {
4396
4537
  case 0:
4397
- _context56.prev = 0;
4538
+ _context57.prev = 0;
4398
4539
  prevOrderInfo = this.store.currentOrder ? {
4399
4540
  uuid: this.store.currentOrder.uuid,
4400
4541
  orderId: this.store.currentOrder.order_id
4401
4542
  } : null;
4402
- _context56.next = 4;
4543
+ _context57.next = 4;
4403
4544
  return this.resetStoreStateAsync();
4404
4545
  case 4:
4405
- return _context56.abrupt("return", {
4546
+ return _context57.abrupt("return", {
4406
4547
  success: true,
4407
4548
  message: prevOrderInfo ? '订单状态已成功清理' : '没有需要清理的订单状态',
4408
4549
  clearedOrder: prevOrderInfo
4409
4550
  });
4410
4551
  case 7:
4411
- _context56.prev = 7;
4412
- _context56.t0 = _context56["catch"](0);
4413
- console.error('[Checkout] 手动清理订单状态失败:', _context56.t0);
4414
- return _context56.abrupt("return", {
4552
+ _context57.prev = 7;
4553
+ _context57.t0 = _context57["catch"](0);
4554
+ console.error('[Checkout] 手动清理订单状态失败:', _context57.t0);
4555
+ return _context57.abrupt("return", {
4415
4556
  success: false,
4416
- message: _context56.t0 instanceof Error ? _context56.t0.message : '清理失败'
4557
+ message: _context57.t0 instanceof Error ? _context57.t0.message : '清理失败'
4417
4558
  });
4418
4559
  case 11:
4419
4560
  case "end":
4420
- return _context56.stop();
4561
+ return _context57.stop();
4421
4562
  }
4422
- }, _callee56, this, [[0, 7]]);
4563
+ }, _callee57, this, [[0, 7]]);
4423
4564
  }));
4424
4565
  function clearCompletedOrderAsync() {
4425
4566
  return _clearCompletedOrderAsync.apply(this, arguments);