@pisell/pisellos 0.0.232 → 0.0.233

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.
@@ -276,17 +276,59 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
276
276
  if (!this.store.currentOrder) {
277
277
  return [];
278
278
  }
279
+ var getDiscountListAmount = function getDiscountListAmount(list) {
280
+ return list.reduce(function (pre, item) {
281
+ return pre + (item.amount || 0);
282
+ }, 0);
283
+ };
279
284
  var productList = (_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.original_order_data.bookings.map(function (item) {
280
285
  return {
281
286
  product_id: item.product.product_id,
282
287
  product_variant_id: item.product.product_variant_id,
283
288
  quantity: item.product.num,
284
- selling_price: item.product.price - (item.product.discount_amount || 0)
289
+ selling_price: item.product.price - (item.product.discount_amount || 0) - getDiscountListAmount(item.product.discount_list)
285
290
  };
286
291
  });
287
292
  return productList;
288
293
  }
289
-
294
+ }, {
295
+ key: "initWalletData",
296
+ value: function () {
297
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
298
+ var _this$store$currentOr2, _this$store$currentCu;
299
+ var amountInfo, walletBusinessData;
300
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
301
+ while (1) switch (_context6.prev = _context6.next) {
302
+ case 0:
303
+ amountInfo = (_this$store$currentOr2 = this.store.currentOrder) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.order_info) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.amount_breakdown;
304
+ if (amountInfo) {
305
+ _context6.next = 3;
306
+ break;
307
+ }
308
+ return _context6.abrupt("return");
309
+ case 3:
310
+ // 准备钱包初始化的业务数据
311
+ walletBusinessData = _objectSpread({
312
+ customer_id: (_this$store$currentCu = this.store.currentCustomer) !== null && _this$store$currentCu !== void 0 && _this$store$currentCu.customer_id ? Number(this.store.currentCustomer.customer_id) : undefined,
313
+ amountInfo: {
314
+ totalAmount: amountInfo.totalAmount,
315
+ subTotal: amountInfo.subTotal
316
+ },
317
+ products: this.getProductListByOrder()
318
+ }, params);
319
+ _context6.next = 6;
320
+ return this.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
321
+ case 6:
322
+ case "end":
323
+ return _context6.stop();
324
+ }
325
+ }, _callee6, this);
326
+ }));
327
+ function initWalletData(_x8) {
328
+ return _initWalletData.apply(this, arguments);
329
+ }
330
+ return initWalletData;
331
+ }()
290
332
  /**
291
333
  * 创建本地订单 (前端模拟下单流程)
292
334
  *
@@ -297,21 +339,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
297
339
  }, {
298
340
  key: "createLocalOrderAsync",
299
341
  value: (function () {
300
- var _createLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
301
- var _params$totalInfo, _params$totalInfo2, _this$store$currentCu, validation, localOrderId, amountInfo, customerInfo, paymentOrder, walletBusinessData, walletData;
302
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
303
- while (1) switch (_context6.prev = _context6.next) {
342
+ var _createLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
343
+ var _params$totalInfo, _params$totalInfo2, validation, localOrderId, amountInfo, customerInfo, paymentOrder;
344
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
345
+ while (1) switch (_context7.prev = _context7.next) {
304
346
  case 0:
305
- _context6.prev = 0;
306
- _context6.next = 3;
347
+ _context7.prev = 0;
348
+ _context7.next = 3;
307
349
  return this.setStatus(CheckoutStatus.CreatingOrder);
308
350
  case 3:
309
- _context6.next = 5;
351
+ _context7.next = 5;
310
352
  return this.validateLocalOrderData(params.orderData);
311
353
  case 5:
312
- validation = _context6.sent;
354
+ validation = _context7.sent;
313
355
  if (validation.valid) {
314
- _context6.next = 8;
356
+ _context7.next = 8;
315
357
  break;
316
358
  }
317
359
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, "\u8BA2\u5355\u6570\u636E\u9A8C\u8BC1\u5931\u8D25: ".concat(validation.errors.join(', ')));
@@ -345,7 +387,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
345
387
  }
346
388
 
347
389
  // 创建支付订单对象
348
- _context6.next = 20;
390
+ _context7.next = 20;
349
391
  return this.payment.createPaymentOrderAsync({
350
392
  order_id: localOrderId,
351
393
  total_amount: amountInfo.totalAmount,
@@ -363,46 +405,33 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
363
405
  }
364
406
  });
365
407
  case 20:
366
- paymentOrder = _context6.sent;
408
+ paymentOrder = _context7.sent;
367
409
  this.store.currentOrder = paymentOrder;
368
-
369
- // 准备钱包初始化的业务数据
370
- walletBusinessData = {
371
- customer_id: (_this$store$currentCu = this.store.currentCustomer) !== null && _this$store$currentCu !== void 0 && _this$store$currentCu.customer_id ? Number(this.store.currentCustomer.customer_id) : undefined,
372
- amountInfo: {
373
- totalAmount: amountInfo.totalAmount,
374
- subTotal: amountInfo.subTotal
375
- },
376
- products: this.getProductListByOrder()
377
- }; // 调用WalletPass模块的业务数据初始化函数
378
- _context6.next = 25;
379
- return this.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
380
- case 25:
381
- walletData = _context6.sent;
382
- console.log(walletData.walletRecommendList, 'walletRecommendList');
383
- console.log(walletData.userIdentificationCodes, 'userIdentificationCodes');
384
- _context6.next = 30;
410
+ _context7.next = 24;
411
+ return this.initWalletData();
412
+ case 24:
413
+ _context7.next = 26;
385
414
  return this.setStatus(CheckoutStatus.OrderCreated);
386
- case 30:
387
- _context6.next = 32;
415
+ case 26:
416
+ _context7.next = 28;
388
417
  return this.setStep(CheckoutStep.PaymentMethod);
389
- case 32:
418
+ case 28:
390
419
  if (!params.autoPayment) {
391
- _context6.next = 35;
420
+ _context7.next = 31;
392
421
  break;
393
422
  }
394
- _context6.next = 35;
423
+ _context7.next = 31;
395
424
  return this.setStep(CheckoutStep.PaymentProcessing);
396
- case 35:
397
- _context6.next = 37;
425
+ case 31:
426
+ _context7.next = 33;
398
427
  return this.core.effects.emit(CheckoutHooks.OnOrderCreated, {
399
428
  order: paymentOrder,
400
429
  timestamp: Date.now()
401
430
  });
402
- case 37:
403
- _context6.next = 39;
431
+ case 33:
432
+ _context7.next = 35;
404
433
  return this.updateStateAmountToRemaining();
405
- case 39:
434
+ case 35:
406
435
  console.log('[Checkout] 本地订单创建成功:', {
407
436
  localOrderId: localOrderId,
408
437
  uuid: paymentOrder.uuid,
@@ -411,27 +440,27 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
411
440
  taxAmount: amountInfo.taxAmount,
412
441
  stateAmount: this.store.stateAmount
413
442
  });
414
- return _context6.abrupt("return", paymentOrder);
443
+ return _context7.abrupt("return", paymentOrder);
444
+ case 39:
445
+ _context7.prev = 39;
446
+ _context7.t0 = _context7["catch"](0);
447
+ _context7.next = 43;
448
+ return this.handleError(_context7.t0, CheckoutErrorType.OrderCreationFailed);
415
449
  case 43:
416
- _context6.prev = 43;
417
- _context6.t0 = _context6["catch"](0);
418
- _context6.next = 47;
419
- return this.handleError(_context6.t0, CheckoutErrorType.OrderCreationFailed);
420
- case 47:
421
- _context6.next = 49;
450
+ _context7.next = 45;
422
451
  return this.core.effects.emit(CheckoutHooks.OnOrderCreationFailed, {
423
452
  error: this.store.lastError,
424
453
  timestamp: Date.now()
425
454
  });
426
- case 49:
427
- throw _context6.t0;
428
- case 50:
455
+ case 45:
456
+ throw _context7.t0;
457
+ case 46:
429
458
  case "end":
430
- return _context6.stop();
459
+ return _context7.stop();
431
460
  }
432
- }, _callee6, this, [[0, 43]]);
461
+ }, _callee7, this, [[0, 39]]);
433
462
  }));
434
- function createLocalOrderAsync(_x8) {
463
+ function createLocalOrderAsync(_x9) {
435
464
  return _createLocalOrderAsync.apply(this, arguments);
436
465
  }
437
466
  return createLocalOrderAsync;
@@ -445,7 +474,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
445
474
  }, {
446
475
  key: "placeOrderAsync",
447
476
  value: (function () {
448
- var _placeOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
477
+ var _placeOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
449
478
  var params,
450
479
  _data,
451
480
  orderData,
@@ -453,26 +482,26 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
453
482
  realOrderId,
454
483
  updatedOrder,
455
484
  errorMessage,
456
- _args7 = arguments;
457
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
458
- while (1) switch (_context7.prev = _context7.next) {
485
+ _args8 = arguments;
486
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
487
+ while (1) switch (_context8.prev = _context8.next) {
459
488
  case 0:
460
- params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
461
- _context7.prev = 1;
489
+ params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
490
+ _context8.prev = 1;
462
491
  if (this.store.localOrderData) {
463
- _context7.next = 4;
492
+ _context8.next = 4;
464
493
  break;
465
494
  }
466
495
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有找到本地订单数据,请先调用 createLocalOrderAsync 创建虚拟订单');
467
496
  case 4:
468
497
  if (this.store.currentOrder) {
469
- _context7.next = 6;
498
+ _context8.next = 6;
470
499
  break;
471
500
  }
472
501
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有找到当前订单,请先创建虚拟订单');
473
502
  case 6:
474
503
  console.log('[Checkout] 开始手动下单流程...');
475
- _context7.next = 9;
504
+ _context8.next = 9;
476
505
  return this.setStatus(CheckoutStatus.CreatingOrder);
477
506
  case 9:
478
507
  // 准备订单数据,使用 Order 模块期望的格式
@@ -481,18 +510,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
481
510
  type: this.store.localOrderData.type,
482
511
  platform: this.store.localOrderData.platform
483
512
  }; // 调用 Order 模块提交订单
484
- _context7.next = 12;
513
+ _context8.next = 12;
485
514
  return this.order.submitOrder({
486
515
  url: params.url,
487
516
  // 可选的自定义 URL
488
517
  query: orderData
489
518
  });
490
519
  case 12:
491
- orderResponse = _context7.sent;
520
+ orderResponse = _context8.sent;
492
521
  // 提取真实订单ID(假设返回格式包含 order_id)
493
522
  realOrderId = (orderResponse === null || orderResponse === void 0 || (_data = orderResponse.data) === null || _data === void 0 ? void 0 : _data.order_id) || (orderResponse === null || orderResponse === void 0 ? void 0 : orderResponse.order_id);
494
523
  if (realOrderId) {
495
- _context7.next = 16;
524
+ _context8.next = 16;
496
525
  break;
497
526
  }
498
527
  throw createCheckoutError(CheckoutErrorType.OrderCreationFailed, '订单创建成功但未返回订单ID');
@@ -501,15 +530,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
501
530
 
502
531
  // 如果设置了自动替换订单ID,则替换虚拟订单ID
503
532
  if (!(params.autoReplaceOrderId !== false)) {
504
- _context7.next = 23;
533
+ _context8.next = 23;
505
534
  break;
506
535
  }
507
536
  // 默认为 true
508
537
  console.log('[Checkout] 自动替换虚拟订单ID为真实订单ID...');
509
- _context7.next = 21;
538
+ _context8.next = 21;
510
539
  return this.replaceLocalOrderIdAsync(realOrderId);
511
540
  case 21:
512
- updatedOrder = _context7.sent;
541
+ updatedOrder = _context8.sent;
513
542
  if (updatedOrder) {
514
543
  console.log('[Checkout] 订单ID替换成功:', {
515
544
  oldId: this.store.currentOrder.order_id,
@@ -517,10 +546,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
517
546
  });
518
547
  }
519
548
  case 23:
520
- _context7.next = 25;
549
+ _context8.next = 25;
521
550
  return this.setStatus(CheckoutStatus.OrderCreated);
522
551
  case 25:
523
- _context7.next = 27;
552
+ _context8.next = 27;
524
553
  return this.core.effects.emit(CheckoutHooks.OnOrderCreated, {
525
554
  order: this.store.currentOrder,
526
555
  timestamp: Date.now()
@@ -529,33 +558,33 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
529
558
  // 标记订单已同步
530
559
  this.store.isOrderSynced = true;
531
560
  console.log('[Checkout] 手动下单流程完成');
532
- return _context7.abrupt("return", {
561
+ return _context8.abrupt("return", {
533
562
  success: true,
534
563
  orderId: realOrderId
535
564
  });
536
565
  case 32:
537
- _context7.prev = 32;
538
- _context7.t0 = _context7["catch"](1);
566
+ _context8.prev = 32;
567
+ _context8.t0 = _context8["catch"](1);
539
568
  // 处理 CheckoutError 对象
540
569
  errorMessage = '下单失败';
541
- if (_context7.t0 && _typeof(_context7.t0) === 'object' && 'message' in _context7.t0) {
542
- errorMessage = _context7.t0.message;
543
- } else if (_context7.t0 instanceof Error) {
544
- errorMessage = _context7.t0.message;
570
+ if (_context8.t0 && _typeof(_context8.t0) === 'object' && 'message' in _context8.t0) {
571
+ errorMessage = _context8.t0.message;
572
+ } else if (_context8.t0 instanceof Error) {
573
+ errorMessage = _context8.t0.message;
545
574
  }
546
575
  console.error('[Checkout] 手动下单失败:', errorMessage);
547
- _context7.next = 39;
548
- return this.handleError(_context7.t0, CheckoutErrorType.OrderCreationFailed);
576
+ _context8.next = 39;
577
+ return this.handleError(_context8.t0, CheckoutErrorType.OrderCreationFailed);
549
578
  case 39:
550
- return _context7.abrupt("return", {
579
+ return _context8.abrupt("return", {
551
580
  success: false,
552
581
  error: errorMessage
553
582
  });
554
583
  case 40:
555
584
  case "end":
556
- return _context7.stop();
585
+ return _context8.stop();
557
586
  }
558
- }, _callee7, this, [[1, 32]]);
587
+ }, _callee8, this, [[1, 32]]);
559
588
  }));
560
589
  function placeOrderAsync() {
561
590
  return _placeOrderAsync.apply(this, arguments);
@@ -569,13 +598,13 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
569
598
  }, {
570
599
  key: "createOrderAsync",
571
600
  value: (function () {
572
- var _createOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
601
+ var _createOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
573
602
  var _data2, checkResult, orderResponse, paymentOrder;
574
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
575
- while (1) switch (_context8.prev = _context8.next) {
603
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
604
+ while (1) switch (_context9.prev = _context9.next) {
576
605
  case 0:
577
- _context8.prev = 0;
578
- _context8.next = 3;
606
+ _context9.prev = 0;
607
+ _context9.next = 3;
579
608
  return this.setStatus(CheckoutStatus.CreatingOrder);
580
609
  case 3:
581
610
  // 验证购物车数据
@@ -584,12 +613,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
584
613
  type: 'account' // 默认使用 account 类型
585
614
  });
586
615
  if (checkResult) {
587
- _context8.next = 6;
616
+ _context9.next = 6;
588
617
  break;
589
618
  }
590
619
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '购物车数据验证失败,请检查商品信息');
591
620
  case 6:
592
- _context8.next = 8;
621
+ _context9.next = 8;
593
622
  return this.order.submitOrder({
594
623
  query: {
595
624
  cartItems: params.cartItems,
@@ -598,23 +627,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
598
627
  }
599
628
  });
600
629
  case 8:
601
- orderResponse = _context8.sent;
602
- _context8.next = 11;
630
+ orderResponse = _context9.sent;
631
+ _context9.next = 11;
603
632
  return this.payment.createPaymentOrderAsync({
604
633
  order_id: (orderResponse === null || orderResponse === void 0 || (_data2 = orderResponse.data) === null || _data2 === void 0 ? void 0 : _data2.order_id) || "order_".concat(Date.now()),
605
634
  total_amount: this.calculateTotalAmount(params.cartItems),
606
635
  order_info: orderResponse === null || orderResponse === void 0 ? void 0 : orderResponse.data
607
636
  });
608
637
  case 11:
609
- paymentOrder = _context8.sent;
638
+ paymentOrder = _context9.sent;
610
639
  this.store.currentOrder = paymentOrder;
611
- _context8.next = 15;
640
+ _context9.next = 15;
612
641
  return this.setStatus(CheckoutStatus.OrderCreated);
613
642
  case 15:
614
- _context8.next = 17;
643
+ _context9.next = 17;
615
644
  return this.setStep(CheckoutStep.PaymentMethod);
616
645
  case 17:
617
- _context8.next = 19;
646
+ _context9.next = 19;
618
647
  return this.core.effects.emit(CheckoutHooks.OnOrderCreated, {
619
648
  order: paymentOrder,
620
649
  timestamp: Date.now()
@@ -624,31 +653,31 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
624
653
  this.store.isOrderSynced = true;
625
654
 
626
655
  // 自动设置 stateAmount 为剩余未支付金额
627
- _context8.next = 22;
656
+ _context9.next = 22;
628
657
  return this.updateStateAmountToRemaining();
629
658
  case 22:
630
659
  console.log('[Checkout] 订单创建成功:', paymentOrder.id);
631
- return _context8.abrupt("return", paymentOrder);
660
+ return _context9.abrupt("return", paymentOrder);
632
661
  case 26:
633
- _context8.prev = 26;
634
- _context8.t0 = _context8["catch"](0);
635
- _context8.next = 30;
636
- return this.handleError(_context8.t0, CheckoutErrorType.OrderCreationFailed);
662
+ _context9.prev = 26;
663
+ _context9.t0 = _context9["catch"](0);
664
+ _context9.next = 30;
665
+ return this.handleError(_context9.t0, CheckoutErrorType.OrderCreationFailed);
637
666
  case 30:
638
- _context8.next = 32;
667
+ _context9.next = 32;
639
668
  return this.core.effects.emit(CheckoutHooks.OnOrderCreationFailed, {
640
669
  error: this.store.lastError,
641
670
  timestamp: Date.now()
642
671
  });
643
672
  case 32:
644
- throw _context8.t0;
673
+ throw _context9.t0;
645
674
  case 33:
646
675
  case "end":
647
- return _context8.stop();
676
+ return _context9.stop();
648
677
  }
649
- }, _callee8, this, [[0, 26]]);
678
+ }, _callee9, this, [[0, 26]]);
650
679
  }));
651
- function createOrderAsync(_x9) {
680
+ function createOrderAsync(_x10) {
652
681
  return _createOrderAsync.apply(this, arguments);
653
682
  }
654
683
  return createOrderAsync;
@@ -660,22 +689,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
660
689
  }, {
661
690
  key: "processPaymentAsync",
662
691
  value: (function () {
663
- var _processPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
692
+ var _processPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
664
693
  var paymentMethod, paymentItem, result;
665
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
666
- while (1) switch (_context9.prev = _context9.next) {
694
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
695
+ while (1) switch (_context10.prev = _context10.next) {
667
696
  case 0:
668
- _context9.prev = 0;
697
+ _context10.prev = 0;
669
698
  if (this.store.currentOrder) {
670
- _context9.next = 3;
699
+ _context10.next = 3;
671
700
  break;
672
701
  }
673
702
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '未找到当前订单,请先创建订单');
674
703
  case 3:
675
- _context9.next = 5;
704
+ _context10.next = 5;
676
705
  return this.setStatus(CheckoutStatus.ProcessingPayment);
677
706
  case 5:
678
- _context9.next = 7;
707
+ _context10.next = 7;
679
708
  return this.setStep(CheckoutStep.PaymentProcessing);
680
709
  case 7:
681
710
  // 查找支付方式
@@ -683,7 +712,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
683
712
  return method.code === params.paymentMethodCode;
684
713
  });
685
714
  if (paymentMethod) {
686
- _context9.next = 10;
715
+ _context10.next = 10;
687
716
  break;
688
717
  }
689
718
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, "\u672A\u627E\u5230\u652F\u4ED8\u65B9\u5F0F: ".concat(params.paymentMethodCode));
@@ -696,14 +725,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
696
725
  amount: String(params.amount),
697
726
  id: paymentMethod.id
698
727
  }; // 添加支付项到订单
699
- _context9.next = 13;
728
+ _context10.next = 13;
700
729
  return this.payment.addPaymentItemAsync(this.store.currentOrder.uuid, paymentItem);
701
730
  case 13:
702
- _context9.next = 15;
731
+ _context10.next = 15;
703
732
  return this.payment.submitPayAsync(this.store.currentOrder.uuid);
704
733
  case 15:
705
- result = _context9.sent;
706
- _context9.next = 18;
734
+ result = _context10.sent;
735
+ _context10.next = 18;
707
736
  return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
708
737
  orderUuid: this.store.currentOrder.uuid,
709
738
  paymentMethodCode: params.paymentMethodCode,
@@ -712,42 +741,42 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
712
741
  });
713
742
  case 18:
714
743
  if (!(result.status === 'success')) {
715
- _context9.next = 27;
744
+ _context10.next = 27;
716
745
  break;
717
746
  }
718
- _context9.next = 21;
747
+ _context10.next = 21;
719
748
  return this.setStatus(CheckoutStatus.PaymentCompleted);
720
749
  case 21:
721
- _context9.next = 23;
750
+ _context10.next = 23;
722
751
  return this.updateStateAmountToRemaining();
723
752
  case 23:
724
- _context9.next = 25;
753
+ _context10.next = 25;
725
754
  return this.handlePaymentSuccess({
726
755
  orderUuid: this.store.currentOrder.uuid,
727
756
  timestamp: Date.now()
728
757
  });
729
758
  case 25:
730
- _context9.next = 28;
759
+ _context10.next = 28;
731
760
  break;
732
761
  case 27:
733
762
  throw createCheckoutError(CheckoutErrorType.PaymentFailed, '支付处理失败,请重试');
734
763
  case 28:
735
- _context9.next = 35;
764
+ _context10.next = 35;
736
765
  break;
737
766
  case 30:
738
- _context9.prev = 30;
739
- _context9.t0 = _context9["catch"](0);
740
- _context9.next = 34;
741
- return this.handleError(_context9.t0, CheckoutErrorType.PaymentFailed);
767
+ _context10.prev = 30;
768
+ _context10.t0 = _context10["catch"](0);
769
+ _context10.next = 34;
770
+ return this.handleError(_context10.t0, CheckoutErrorType.PaymentFailed);
742
771
  case 34:
743
- throw _context9.t0;
772
+ throw _context10.t0;
744
773
  case 35:
745
774
  case "end":
746
- return _context9.stop();
775
+ return _context10.stop();
747
776
  }
748
- }, _callee9, this, [[0, 30]]);
777
+ }, _callee10, this, [[0, 30]]);
749
778
  }));
750
- function processPaymentAsync(_x10) {
779
+ function processPaymentAsync(_x11) {
751
780
  return _processPaymentAsync.apply(this, arguments);
752
781
  }
753
782
  return processPaymentAsync;
@@ -759,61 +788,61 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
759
788
  }, {
760
789
  key: "completeCheckoutAsync",
761
790
  value: (function () {
762
- var _completeCheckoutAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
791
+ var _completeCheckoutAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
763
792
  var order;
764
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
765
- while (1) switch (_context10.prev = _context10.next) {
793
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
794
+ while (1) switch (_context11.prev = _context11.next) {
766
795
  case 0:
767
- _context10.prev = 0;
796
+ _context11.prev = 0;
768
797
  if (this.store.currentOrder) {
769
- _context10.next = 3;
798
+ _context11.next = 3;
770
799
  break;
771
800
  }
772
801
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '未找到当前订单');
773
802
  case 3:
774
- _context10.next = 5;
803
+ _context11.next = 5;
775
804
  return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
776
805
  case 5:
777
- order = _context10.sent;
806
+ order = _context11.sent;
778
807
  if (!(!order || order.payment_status !== PaymentStatus.Finished)) {
779
- _context10.next = 8;
808
+ _context11.next = 8;
780
809
  break;
781
810
  }
782
811
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '订单支付未完成,无法完成结账');
783
812
  case 8:
784
813
  // 清理钱包模块的所有缓存数据
785
814
  this.payment.wallet.clearAllCache();
786
- _context10.next = 11;
815
+ _context11.next = 11;
787
816
  return this.setStatus(CheckoutStatus.Completed);
788
817
  case 11:
789
- _context10.next = 13;
818
+ _context11.next = 13;
790
819
  return this.setStep(CheckoutStep.Complete);
791
820
  case 13:
792
- _context10.next = 15;
821
+ _context11.next = 15;
793
822
  return this.core.effects.emit(CheckoutHooks.OnCheckoutCompleted, {
794
823
  orderId: order.id,
795
824
  timestamp: Date.now()
796
825
  });
797
826
  case 15:
798
827
  console.log('[Checkout] 结账流程完成:', order.id);
799
- return _context10.abrupt("return", {
828
+ return _context11.abrupt("return", {
800
829
  success: true,
801
830
  orderId: String(order.id)
802
831
  });
803
832
  case 19:
804
- _context10.prev = 19;
805
- _context10.t0 = _context10["catch"](0);
806
- _context10.next = 23;
807
- return this.handleError(_context10.t0, CheckoutErrorType.UnknownError);
833
+ _context11.prev = 19;
834
+ _context11.t0 = _context11["catch"](0);
835
+ _context11.next = 23;
836
+ return this.handleError(_context11.t0, CheckoutErrorType.UnknownError);
808
837
  case 23:
809
- return _context10.abrupt("return", {
838
+ return _context11.abrupt("return", {
810
839
  success: false
811
840
  });
812
841
  case 24:
813
842
  case "end":
814
- return _context10.stop();
843
+ return _context11.stop();
815
844
  }
816
- }, _callee10, this, [[0, 19]]);
845
+ }, _callee11, this, [[0, 19]]);
817
846
  }));
818
847
  function completeCheckoutAsync() {
819
848
  return _completeCheckoutAsync.apply(this, arguments);
@@ -827,16 +856,16 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
827
856
  }, {
828
857
  key: "cancelCheckoutAsync",
829
858
  value: (function () {
830
- var _cancelCheckoutAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
831
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
832
- while (1) switch (_context11.prev = _context11.next) {
859
+ var _cancelCheckoutAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
860
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
861
+ while (1) switch (_context12.prev = _context12.next) {
833
862
  case 0:
834
- _context11.prev = 0;
863
+ _context12.prev = 0;
835
864
  if (!this.store.currentOrder) {
836
- _context11.next = 5;
865
+ _context12.next = 5;
837
866
  break;
838
867
  }
839
- _context11.next = 4;
868
+ _context12.next = 4;
840
869
  return this.payment.deletePaymentOrderAsync(this.store.currentOrder.uuid);
841
870
  case 4:
842
871
  this.store.currentOrder = undefined;
@@ -849,28 +878,28 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
849
878
  this.store.stateAmount = '0.00';
850
879
  this.store.isOrderSynced = false;
851
880
  this.store.currentCustomer = undefined;
852
- _context11.next = 14;
881
+ _context12.next = 14;
853
882
  return this.setStatus(CheckoutStatus.Cancelled);
854
883
  case 14:
855
- _context11.next = 16;
884
+ _context12.next = 16;
856
885
  return this.core.effects.emit(CheckoutHooks.OnCheckoutCancelled, {
857
886
  timestamp: Date.now()
858
887
  });
859
888
  case 16:
860
889
  console.log('[Checkout] 结账流程已取消');
861
- _context11.next = 24;
890
+ _context12.next = 24;
862
891
  break;
863
892
  case 19:
864
- _context11.prev = 19;
865
- _context11.t0 = _context11["catch"](0);
866
- console.error('[Checkout] 取消结账失败:', _context11.t0);
867
- _context11.next = 24;
868
- return this.handleError(_context11.t0, CheckoutErrorType.UnknownError);
893
+ _context12.prev = 19;
894
+ _context12.t0 = _context12["catch"](0);
895
+ console.error('[Checkout] 取消结账失败:', _context12.t0);
896
+ _context12.next = 24;
897
+ return this.handleError(_context12.t0, CheckoutErrorType.UnknownError);
869
898
  case 24:
870
899
  case "end":
871
- return _context11.stop();
900
+ return _context12.stop();
872
901
  }
873
- }, _callee11, this, [[0, 19]]);
902
+ }, _callee12, this, [[0, 19]]);
874
903
  }));
875
904
  function cancelCheckoutAsync() {
876
905
  return _cancelCheckoutAsync.apply(this, arguments);
@@ -899,28 +928,28 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
899
928
  }, {
900
929
  key: "getCheckoutSummaryAsync",
901
930
  value: (function () {
902
- var _getCheckoutSummaryAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
903
- var _this$store$currentOr2, _this$store$currentOr3;
931
+ var _getCheckoutSummaryAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
932
+ var _this$store$currentOr3, _this$store$currentOr4;
904
933
  var totalAmount, paidAmount, remainingAmount;
905
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
906
- while (1) switch (_context12.prev = _context12.next) {
934
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
935
+ while (1) switch (_context13.prev = _context13.next) {
907
936
  case 0:
908
- totalAmount = ((_this$store$currentOr2 = this.store.currentOrder) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.total_amount) || '0.00';
937
+ totalAmount = ((_this$store$currentOr3 = this.store.currentOrder) === null || _this$store$currentOr3 === void 0 ? void 0 : _this$store$currentOr3.total_amount) || '0.00';
909
938
  paidAmount = this.calculatePaidAmount();
910
939
  remainingAmount = this.calculateRemainingAmount();
911
- return _context12.abrupt("return", {
940
+ return _context13.abrupt("return", {
912
941
  order: this.store.currentOrder,
913
942
  totalAmount: totalAmount,
914
943
  paidAmount: paidAmount,
915
944
  remainingAmount: remainingAmount,
916
- paymentStatus: ((_this$store$currentOr3 = this.store.currentOrder) === null || _this$store$currentOr3 === void 0 ? void 0 : _this$store$currentOr3.payment_status) || PaymentStatus.Processing,
945
+ paymentStatus: ((_this$store$currentOr4 = this.store.currentOrder) === null || _this$store$currentOr4 === void 0 ? void 0 : _this$store$currentOr4.payment_status) || PaymentStatus.Processing,
917
946
  availablePaymentMethods: this.store.paymentMethods
918
947
  });
919
948
  case 4:
920
949
  case "end":
921
- return _context12.stop();
950
+ return _context13.stop();
922
951
  }
923
- }, _callee12, this);
952
+ }, _callee13, this);
924
953
  }));
925
954
  function getCheckoutSummaryAsync() {
926
955
  return _getCheckoutSummaryAsync.apply(this, arguments);
@@ -934,24 +963,24 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
934
963
  }, {
935
964
  key: "getAvailablePaymentMethodsAsync",
936
965
  value: (function () {
937
- var _getAvailablePaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
938
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
939
- while (1) switch (_context13.prev = _context13.next) {
966
+ var _getAvailablePaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
967
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
968
+ while (1) switch (_context14.prev = _context14.next) {
940
969
  case 0:
941
970
  if (!(this.store.paymentMethods.length === 0)) {
942
- _context13.next = 4;
971
+ _context14.next = 4;
943
972
  break;
944
973
  }
945
974
  console.log('[Checkout] 支付方式缓存为空,重新加载...');
946
- _context13.next = 4;
975
+ _context14.next = 4;
947
976
  return this.preloadPaymentMethods();
948
977
  case 4:
949
- return _context13.abrupt("return", this.store.paymentMethods);
978
+ return _context14.abrupt("return", this.store.paymentMethods);
950
979
  case 5:
951
980
  case "end":
952
- return _context13.stop();
981
+ return _context14.stop();
953
982
  }
954
- }, _callee13, this);
983
+ }, _callee14, this);
955
984
  }));
956
985
  function getAvailablePaymentMethodsAsync() {
957
986
  return _getAvailablePaymentMethodsAsync.apply(this, arguments);
@@ -967,20 +996,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
967
996
  }, {
968
997
  key: "refreshPaymentMethodsAsync",
969
998
  value: (function () {
970
- var _refreshPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
971
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
972
- while (1) switch (_context14.prev = _context14.next) {
999
+ var _refreshPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1000
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1001
+ while (1) switch (_context15.prev = _context15.next) {
973
1002
  case 0:
974
1003
  console.log('[Checkout] 强制刷新支付方式缓存...');
975
- _context14.next = 3;
1004
+ _context15.next = 3;
976
1005
  return this.preloadPaymentMethods();
977
1006
  case 3:
978
- return _context14.abrupt("return", this.store.paymentMethods);
1007
+ return _context15.abrupt("return", this.store.paymentMethods);
979
1008
  case 4:
980
1009
  case "end":
981
- return _context14.stop();
1010
+ return _context15.stop();
982
1011
  }
983
- }, _callee14, this);
1012
+ }, _callee15, this);
984
1013
  }));
985
1014
  function refreshPaymentMethodsAsync() {
986
1015
  return _refreshPaymentMethodsAsync.apply(this, arguments);
@@ -994,8 +1023,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
994
1023
  }, {
995
1024
  key: "getOrderOriginalData",
996
1025
  value: function getOrderOriginalData() {
997
- var _this$store$currentOr4;
998
- return (_this$store$currentOr4 = this.store.currentOrder) === null || _this$store$currentOr4 === void 0 ? void 0 : _this$store$currentOr4.order_info;
1026
+ var _this$store$currentOr5;
1027
+ return (_this$store$currentOr5 = this.store.currentOrder) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.order_info;
999
1028
  }
1000
1029
 
1001
1030
  /**
@@ -1061,19 +1090,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1061
1090
  }, {
1062
1091
  key: "getCurrentOrderPaymentItemsAsync",
1063
1092
  value: (function () {
1064
- var _getCurrentOrderPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1093
+ var _getCurrentOrderPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1065
1094
  var _currentOrder2, paymentItems;
1066
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1067
- while (1) switch (_context15.prev = _context15.next) {
1095
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1096
+ while (1) switch (_context16.prev = _context16.next) {
1068
1097
  case 0:
1069
- _context15.prev = 0;
1098
+ _context16.prev = 0;
1070
1099
  _currentOrder2 = this.store.currentOrder;
1071
1100
  if (_currentOrder2) {
1072
- _context15.next = 5;
1101
+ _context16.next = 5;
1073
1102
  break;
1074
1103
  }
1075
1104
  console.log('[Checkout] 当前没有活跃订单,无法获取支付项');
1076
- return _context15.abrupt("return", []);
1105
+ return _context16.abrupt("return", []);
1077
1106
  case 5:
1078
1107
  console.log('[Checkout] 获取当前订单支付项:', {
1079
1108
  orderUuid: _currentOrder2.uuid,
@@ -1081,10 +1110,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1081
1110
  });
1082
1111
 
1083
1112
  // 调用Payment模块获取支付项
1084
- _context15.next = 8;
1113
+ _context16.next = 8;
1085
1114
  return this.payment.getPaymentItemsAsync(_currentOrder2.uuid);
1086
1115
  case 8:
1087
- paymentItems = _context15.sent;
1116
+ paymentItems = _context16.sent;
1088
1117
  console.log('[Checkout] 成功获取支付项:', {
1089
1118
  orderUuid: _currentOrder2.uuid,
1090
1119
  paymentItemCount: paymentItems.length,
@@ -1109,17 +1138,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1109
1138
  };
1110
1139
  })
1111
1140
  });
1112
- return _context15.abrupt("return", paymentItems);
1141
+ return _context16.abrupt("return", paymentItems);
1113
1142
  case 13:
1114
- _context15.prev = 13;
1115
- _context15.t0 = _context15["catch"](0);
1116
- console.error('[Checkout] 获取当前订单支付项失败:', _context15.t0);
1117
- return _context15.abrupt("return", []);
1143
+ _context16.prev = 13;
1144
+ _context16.t0 = _context16["catch"](0);
1145
+ console.error('[Checkout] 获取当前订单支付项失败:', _context16.t0);
1146
+ return _context16.abrupt("return", []);
1118
1147
  case 17:
1119
1148
  case "end":
1120
- return _context15.stop();
1149
+ return _context16.stop();
1121
1150
  }
1122
- }, _callee15, this, [[0, 13]]);
1151
+ }, _callee16, this, [[0, 13]]);
1123
1152
  }));
1124
1153
  function getCurrentOrderPaymentItemsAsync() {
1125
1154
  return _getCurrentOrderPaymentItemsAsync.apply(this, arguments);
@@ -1133,10 +1162,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1133
1162
  }, {
1134
1163
  key: "validateCheckoutAsync",
1135
1164
  value: (function () {
1136
- var _validateCheckoutAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1165
+ var _validateCheckoutAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1137
1166
  var errors;
1138
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1139
- while (1) switch (_context16.prev = _context16.next) {
1167
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1168
+ while (1) switch (_context17.prev = _context17.next) {
1140
1169
  case 0:
1141
1170
  errors = []; // 验证购物车
1142
1171
  if (!this.store.cartItems || this.store.cartItems.length === 0) {
@@ -1152,15 +1181,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1152
1181
  if (this.store.status === CheckoutStatus.Error) {
1153
1182
  errors.push('结账流程存在错误');
1154
1183
  }
1155
- return _context16.abrupt("return", {
1184
+ return _context17.abrupt("return", {
1156
1185
  valid: errors.length === 0,
1157
1186
  errors: errors
1158
1187
  });
1159
1188
  case 5:
1160
1189
  case "end":
1161
- return _context16.stop();
1190
+ return _context17.stop();
1162
1191
  }
1163
- }, _callee16, this);
1192
+ }, _callee17, this);
1164
1193
  }));
1165
1194
  function validateCheckoutAsync() {
1166
1195
  return _validateCheckoutAsync.apply(this, arguments);
@@ -1174,44 +1203,44 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1174
1203
  }, {
1175
1204
  key: "retryFailedOperationAsync",
1176
1205
  value: (function () {
1177
- var _retryFailedOperationAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1178
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1179
- while (1) switch (_context17.prev = _context17.next) {
1206
+ var _retryFailedOperationAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1207
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1208
+ while (1) switch (_context18.prev = _context18.next) {
1180
1209
  case 0:
1181
- _context17.prev = 0;
1210
+ _context18.prev = 0;
1182
1211
  if (!(this.store.status === CheckoutStatus.Error && this.store.lastError)) {
1183
- _context17.next = 10;
1212
+ _context18.next = 10;
1184
1213
  break;
1185
1214
  }
1186
- _context17.t0 = this.store.lastError.type;
1187
- _context17.next = _context17.t0 === CheckoutErrorType.OrderCreationFailed ? 5 : 9;
1215
+ _context18.t0 = this.store.lastError.type;
1216
+ _context18.next = _context18.t0 === CheckoutErrorType.OrderCreationFailed ? 5 : 9;
1188
1217
  break;
1189
1218
  case 5:
1190
1219
  if (!(this.store.cartItems.length > 0)) {
1191
- _context17.next = 8;
1220
+ _context18.next = 8;
1192
1221
  break;
1193
1222
  }
1194
- _context17.next = 8;
1223
+ _context18.next = 8;
1195
1224
  return this.createOrderAsync({
1196
1225
  cartItems: this.store.cartItems
1197
1226
  });
1198
1227
  case 8:
1199
- return _context17.abrupt("break", 10);
1228
+ return _context18.abrupt("break", 10);
1200
1229
  case 9:
1201
1230
  console.warn('[Checkout] 无法重试此类型的错误:', this.store.lastError.type);
1202
1231
  case 10:
1203
- _context17.next = 16;
1232
+ _context18.next = 16;
1204
1233
  break;
1205
1234
  case 12:
1206
- _context17.prev = 12;
1207
- _context17.t1 = _context17["catch"](0);
1208
- _context17.next = 16;
1209
- return this.handleError(_context17.t1, CheckoutErrorType.UnknownError);
1235
+ _context18.prev = 12;
1236
+ _context18.t1 = _context18["catch"](0);
1237
+ _context18.next = 16;
1238
+ return this.handleError(_context18.t1, CheckoutErrorType.UnknownError);
1210
1239
  case 16:
1211
1240
  case "end":
1212
- return _context17.stop();
1241
+ return _context18.stop();
1213
1242
  }
1214
- }, _callee17, this, [[0, 12]]);
1243
+ }, _callee18, this, [[0, 12]]);
1215
1244
  }));
1216
1245
  function retryFailedOperationAsync() {
1217
1246
  return _retryFailedOperationAsync.apply(this, arguments);
@@ -1263,32 +1292,32 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1263
1292
  }, {
1264
1293
  key: "replaceLocalOrderIdAsync",
1265
1294
  value: (function () {
1266
- var _replaceLocalOrderIdAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(newOrderId) {
1295
+ var _replaceLocalOrderIdAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(newOrderId) {
1267
1296
  var updatedOrder;
1268
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1269
- while (1) switch (_context18.prev = _context18.next) {
1297
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1298
+ while (1) switch (_context19.prev = _context19.next) {
1270
1299
  case 0:
1271
- _context18.prev = 0;
1300
+ _context19.prev = 0;
1272
1301
  if (this.store.currentOrder) {
1273
- _context18.next = 4;
1302
+ _context19.next = 4;
1274
1303
  break;
1275
1304
  }
1276
1305
  console.warn('[Checkout] 没有当前订单,无法替换订单ID');
1277
- return _context18.abrupt("return", null);
1306
+ return _context19.abrupt("return", null);
1278
1307
  case 4:
1279
- _context18.next = 6;
1308
+ _context19.next = 6;
1280
1309
  return this.payment.replaceOrderIdByUuidAsync(this.store.currentOrder.uuid, newOrderId);
1281
1310
  case 6:
1282
- updatedOrder = _context18.sent;
1311
+ updatedOrder = _context19.sent;
1283
1312
  if (!updatedOrder) {
1284
- _context18.next = 15;
1313
+ _context19.next = 15;
1285
1314
  break;
1286
1315
  }
1287
1316
  // 更新当前订单引用
1288
1317
  this.store.currentOrder = updatedOrder;
1289
1318
 
1290
1319
  // 触发订单更新事件
1291
- _context18.next = 11;
1320
+ _context19.next = 11;
1292
1321
  return this.core.effects.emit(CheckoutHooks.OnOrderCreated, {
1293
1322
  order: updatedOrder,
1294
1323
  timestamp: Date.now()
@@ -1303,25 +1332,25 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1303
1332
  this.store.isOrderSynced = true;
1304
1333
 
1305
1334
  // 订单ID替换后更新 stateAmount
1306
- _context18.next = 15;
1335
+ _context19.next = 15;
1307
1336
  return this.updateStateAmountToRemaining();
1308
1337
  case 15:
1309
- return _context18.abrupt("return", updatedOrder);
1338
+ return _context19.abrupt("return", updatedOrder);
1310
1339
  case 18:
1311
- _context18.prev = 18;
1312
- _context18.t0 = _context18["catch"](0);
1313
- console.error('[Checkout] 替换订单ID失败:', _context18.t0);
1314
- _context18.next = 23;
1315
- return this.handleError(_context18.t0, CheckoutErrorType.UnknownError);
1340
+ _context19.prev = 18;
1341
+ _context19.t0 = _context19["catch"](0);
1342
+ console.error('[Checkout] 替换订单ID失败:', _context19.t0);
1343
+ _context19.next = 23;
1344
+ return this.handleError(_context19.t0, CheckoutErrorType.UnknownError);
1316
1345
  case 23:
1317
- return _context18.abrupt("return", null);
1346
+ return _context19.abrupt("return", null);
1318
1347
  case 24:
1319
1348
  case "end":
1320
- return _context18.stop();
1349
+ return _context19.stop();
1321
1350
  }
1322
- }, _callee18, this, [[0, 18]]);
1351
+ }, _callee19, this, [[0, 18]]);
1323
1352
  }));
1324
- function replaceLocalOrderIdAsync(_x11) {
1353
+ function replaceLocalOrderIdAsync(_x12) {
1325
1354
  return _replaceLocalOrderIdAsync.apply(this, arguments);
1326
1355
  }
1327
1356
  return replaceLocalOrderIdAsync;
@@ -1337,16 +1366,16 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1337
1366
  }, {
1338
1367
  key: "setStateAmountAsync",
1339
1368
  value: (function () {
1340
- var _setStateAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(amount) {
1369
+ var _setStateAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(amount) {
1341
1370
  var numAmount, oldAmount, formattedAmount, errorMessage;
1342
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1343
- while (1) switch (_context19.prev = _context19.next) {
1371
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1372
+ while (1) switch (_context20.prev = _context20.next) {
1344
1373
  case 0:
1345
- _context19.prev = 0;
1374
+ _context20.prev = 0;
1346
1375
  // 验证金额格式
1347
1376
  numAmount = parseFloat(amount);
1348
1377
  if (!(isNaN(numAmount) || numAmount < 0)) {
1349
- _context19.next = 4;
1378
+ _context20.next = 4;
1350
1379
  break;
1351
1380
  }
1352
1381
  throw new Error("\u65E0\u6548\u7684\u652F\u4ED8\u91D1\u989D: ".concat(amount));
@@ -1354,16 +1383,16 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1354
1383
  oldAmount = this.store.stateAmount;
1355
1384
  formattedAmount = numAmount.toFixed(2); // 如果金额没有变化,直接返回
1356
1385
  if (!(oldAmount === formattedAmount)) {
1357
- _context19.next = 8;
1386
+ _context20.next = 8;
1358
1387
  break;
1359
1388
  }
1360
- return _context19.abrupt("return");
1389
+ return _context20.abrupt("return");
1361
1390
  case 8:
1362
1391
  // 更新状态
1363
1392
  this.store.stateAmount = formattedAmount;
1364
1393
 
1365
1394
  // 触发金额变更事件
1366
- _context19.next = 11;
1395
+ _context20.next = 11;
1367
1396
  return this.core.effects.emit(CheckoutHooks.OnStateAmountChanged, {
1368
1397
  oldAmount: oldAmount,
1369
1398
  newAmount: formattedAmount,
@@ -1374,24 +1403,24 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1374
1403
  oldAmount: oldAmount,
1375
1404
  newAmount: formattedAmount
1376
1405
  });
1377
- _context19.next = 21;
1406
+ _context20.next = 21;
1378
1407
  break;
1379
1408
  case 14:
1380
- _context19.prev = 14;
1381
- _context19.t0 = _context19["catch"](0);
1382
- errorMessage = _context19.t0 instanceof Error ? _context19.t0.message : '设置支付金额失败';
1409
+ _context20.prev = 14;
1410
+ _context20.t0 = _context20["catch"](0);
1411
+ errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : '设置支付金额失败';
1383
1412
  console.error('[Checkout] 设置自定义支付金额失败:', errorMessage);
1384
- _context19.next = 20;
1413
+ _context20.next = 20;
1385
1414
  return this.handleError(new Error(errorMessage), CheckoutErrorType.ValidationFailed);
1386
1415
  case 20:
1387
- throw _context19.t0;
1416
+ throw _context20.t0;
1388
1417
  case 21:
1389
1418
  case "end":
1390
- return _context19.stop();
1419
+ return _context20.stop();
1391
1420
  }
1392
- }, _callee19, this, [[0, 14]]);
1421
+ }, _callee20, this, [[0, 14]]);
1393
1422
  }));
1394
- function setStateAmountAsync(_x12) {
1423
+ function setStateAmountAsync(_x13) {
1395
1424
  return _setStateAmountAsync.apply(this, arguments);
1396
1425
  }
1397
1426
  return setStateAmountAsync;
@@ -1416,17 +1445,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1416
1445
  }, {
1417
1446
  key: "refreshStateAmountAsync",
1418
1447
  value: (function () {
1419
- var _refreshStateAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1420
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1421
- while (1) switch (_context20.prev = _context20.next) {
1448
+ var _refreshStateAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1449
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1450
+ while (1) switch (_context21.prev = _context21.next) {
1422
1451
  case 0:
1423
- _context20.next = 2;
1452
+ _context21.next = 2;
1424
1453
  return this.updateStateAmountToRemaining();
1425
1454
  case 2:
1426
1455
  case "end":
1427
- return _context20.stop();
1456
+ return _context21.stop();
1428
1457
  }
1429
- }, _callee20, this);
1458
+ }, _callee21, this);
1430
1459
  }));
1431
1460
  function refreshStateAmountAsync() {
1432
1461
  return _refreshStateAmountAsync.apply(this, arguments);
@@ -1490,19 +1519,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1490
1519
  }, {
1491
1520
  key: "getPaymentMethodsAsync",
1492
1521
  value: (function () {
1493
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1494
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1495
- while (1) switch (_context21.prev = _context21.next) {
1522
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1523
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1524
+ while (1) switch (_context22.prev = _context22.next) {
1496
1525
  case 0:
1497
- _context21.next = 2;
1526
+ _context22.next = 2;
1498
1527
  return this.payment.getPayMethodListAsync();
1499
1528
  case 2:
1500
- return _context21.abrupt("return", _context21.sent);
1529
+ return _context22.abrupt("return", _context22.sent);
1501
1530
  case 3:
1502
1531
  case "end":
1503
- return _context21.stop();
1532
+ return _context22.stop();
1504
1533
  }
1505
- }, _callee21, this);
1534
+ }, _callee22, this);
1506
1535
  }));
1507
1536
  function getPaymentMethodsAsync() {
1508
1537
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -1521,14 +1550,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1521
1550
  }, {
1522
1551
  key: "addPaymentItemAsync",
1523
1552
  value: (function () {
1524
- var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(paymentItem) {
1553
+ var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(paymentItem) {
1525
1554
  var currentOrderId, isCurrentOrderReal, updatedOrder, needsOrderSync;
1526
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1527
- while (1) switch (_context22.prev = _context22.next) {
1555
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1556
+ while (1) switch (_context23.prev = _context23.next) {
1528
1557
  case 0:
1529
- _context22.prev = 0;
1558
+ _context23.prev = 0;
1530
1559
  if (this.store.currentOrder) {
1531
- _context22.next = 3;
1560
+ _context23.next = 3;
1532
1561
  break;
1533
1562
  }
1534
1563
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '未找到当前订单,无法添加支付项');
@@ -1545,7 +1574,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1545
1574
  });
1546
1575
 
1547
1576
  // 添加支付项到订单
1548
- _context22.next = 6;
1577
+ _context23.next = 6;
1549
1578
  return this.payment.addPaymentItemAsync(this.store.currentOrder.uuid, paymentItem);
1550
1579
  case 6:
1551
1580
  console.log('[Checkout] 支付项添加成功');
@@ -1557,10 +1586,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1557
1586
  当前订单ID: currentOrderId,
1558
1587
  是否为真实ID: isCurrentOrderReal
1559
1588
  });
1560
- _context22.next = 12;
1589
+ _context23.next = 12;
1561
1590
  return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
1562
1591
  case 12:
1563
- updatedOrder = _context22.sent;
1592
+ updatedOrder = _context23.sent;
1564
1593
  if (updatedOrder) {
1565
1594
  // 如果当前订单ID是真实ID,但获取到的订单ID是虚拟ID,需要保护真实ID
1566
1595
  if (isCurrentOrderReal && this.isVirtualOrderId(updatedOrder.order_id)) {
@@ -1589,7 +1618,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1589
1618
  isOrderSynced: this.store.isOrderSynced
1590
1619
  });
1591
1620
  if (!needsOrderSync) {
1592
- _context22.next = 21;
1621
+ _context23.next = 21;
1593
1622
  break;
1594
1623
  }
1595
1624
  console.log('[Checkout] 检测到非现金/自定义支付,开始同步订单到后端...', {
@@ -1598,7 +1627,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1598
1627
  订单同步状态: this.store.isOrderSynced,
1599
1628
  订单UUID: this.store.currentOrder.uuid
1600
1629
  });
1601
- _context22.next = 20;
1630
+ _context23.next = 20;
1602
1631
  return this.syncOrderToBackend();
1603
1632
  case 20:
1604
1633
  console.log('[Checkout] addPaymentItemAsync 中的同步完成:', {
@@ -1607,10 +1636,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1607
1636
  订单同步状态: this.store.isOrderSynced
1608
1637
  });
1609
1638
  case 21:
1610
- _context22.next = 23;
1639
+ _context23.next = 23;
1611
1640
  return this.updateStateAmountToRemaining();
1612
1641
  case 23:
1613
- _context22.next = 25;
1642
+ _context23.next = 25;
1614
1643
  return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
1615
1644
  orderUuid: this.store.currentOrder.uuid,
1616
1645
  paymentMethodCode: paymentItem.code,
@@ -1618,23 +1647,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1618
1647
  timestamp: Date.now()
1619
1648
  });
1620
1649
  case 25:
1621
- _context22.next = 33;
1650
+ _context23.next = 33;
1622
1651
  break;
1623
1652
  case 27:
1624
- _context22.prev = 27;
1625
- _context22.t0 = _context22["catch"](0);
1626
- console.error('[Checkout] 添加支付项失败:', _context22.t0);
1627
- _context22.next = 32;
1628
- return this.handleError(_context22.t0, CheckoutErrorType.PaymentFailed);
1653
+ _context23.prev = 27;
1654
+ _context23.t0 = _context23["catch"](0);
1655
+ console.error('[Checkout] 添加支付项失败:', _context23.t0);
1656
+ _context23.next = 32;
1657
+ return this.handleError(_context23.t0, CheckoutErrorType.PaymentFailed);
1629
1658
  case 32:
1630
- throw _context22.t0;
1659
+ throw _context23.t0;
1631
1660
  case 33:
1632
1661
  case "end":
1633
- return _context22.stop();
1662
+ return _context23.stop();
1634
1663
  }
1635
- }, _callee22, this, [[0, 27]]);
1664
+ }, _callee23, this, [[0, 27]]);
1636
1665
  }));
1637
- function addPaymentItemAsync(_x13) {
1666
+ function addPaymentItemAsync(_x14) {
1638
1667
  return _addPaymentItemAsync.apply(this, arguments);
1639
1668
  }
1640
1669
  return addPaymentItemAsync;
@@ -1652,14 +1681,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1652
1681
  }, {
1653
1682
  key: "deletePaymentItemAsync",
1654
1683
  value: (function () {
1655
- var _deletePaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(paymentUuid) {
1684
+ var _deletePaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(paymentUuid) {
1656
1685
  var paymentItem, currentOrderId, isCurrentOrderReal, updatedOrder;
1657
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1658
- while (1) switch (_context23.prev = _context23.next) {
1686
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1687
+ while (1) switch (_context24.prev = _context24.next) {
1659
1688
  case 0:
1660
- _context23.prev = 0;
1689
+ _context24.prev = 0;
1661
1690
  if (this.store.currentOrder) {
1662
- _context23.next = 3;
1691
+ _context24.next = 3;
1663
1692
  break;
1664
1693
  }
1665
1694
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '当前没有活跃订单,无法删除支付项');
@@ -1674,7 +1703,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1674
1703
  return p.uuid === paymentUuid;
1675
1704
  });
1676
1705
  if (paymentItem) {
1677
- _context23.next = 7;
1706
+ _context24.next = 7;
1678
1707
  break;
1679
1708
  }
1680
1709
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, "\u652F\u4ED8\u9879\u4E0D\u5B58\u5728: ".concat(paymentUuid));
@@ -1687,7 +1716,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1687
1716
  });
1688
1717
 
1689
1718
  // 调用 Payment 模块删除支付项
1690
- _context23.next = 10;
1719
+ _context24.next = 10;
1691
1720
  return this.payment.deletePaymentAsync(this.store.currentOrder.uuid, paymentUuid);
1692
1721
  case 10:
1693
1722
  console.log('[Checkout] Payment模块删除完成');
@@ -1695,10 +1724,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1695
1724
  // 重新从Payment模块获取最新的订单数据,确保支付项同步
1696
1725
  currentOrderId = this.store.currentOrder.order_id; // 保存当前的订单ID
1697
1726
  isCurrentOrderReal = currentOrderId && !this.isVirtualOrderId(currentOrderId);
1698
- _context23.next = 15;
1727
+ _context24.next = 15;
1699
1728
  return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
1700
1729
  case 15:
1701
- updatedOrder = _context23.sent;
1730
+ updatedOrder = _context24.sent;
1702
1731
  if (updatedOrder) {
1703
1732
  // 如果当前订单ID是真实ID,但获取到的订单ID是虚拟ID,需要保护真实ID
1704
1733
  if (isCurrentOrderReal && this.isVirtualOrderId(updatedOrder.order_id)) {
@@ -1713,10 +1742,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1713
1742
  }
1714
1743
 
1715
1744
  // 更新 stateAmount 为剩余未支付金额
1716
- _context23.next = 19;
1745
+ _context24.next = 19;
1717
1746
  return this.updateStateAmountToRemaining();
1718
1747
  case 19:
1719
- _context23.next = 21;
1748
+ _context24.next = 21;
1720
1749
  return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
1721
1750
  orderUuid: this.store.currentOrder.uuid,
1722
1751
  paymentMethodCode: paymentItem.code,
@@ -1726,23 +1755,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1726
1755
  });
1727
1756
  case 21:
1728
1757
  console.log('[Checkout] 支付项删除成功');
1729
- _context23.next = 30;
1758
+ _context24.next = 30;
1730
1759
  break;
1731
1760
  case 24:
1732
- _context23.prev = 24;
1733
- _context23.t0 = _context23["catch"](0);
1734
- console.error('[Checkout] 删除支付项失败:', _context23.t0);
1735
- _context23.next = 29;
1736
- return this.handleError(_context23.t0, CheckoutErrorType.PaymentFailed);
1761
+ _context24.prev = 24;
1762
+ _context24.t0 = _context24["catch"](0);
1763
+ console.error('[Checkout] 删除支付项失败:', _context24.t0);
1764
+ _context24.next = 29;
1765
+ return this.handleError(_context24.t0, CheckoutErrorType.PaymentFailed);
1737
1766
  case 29:
1738
- throw _context23.t0;
1767
+ throw _context24.t0;
1739
1768
  case 30:
1740
1769
  case "end":
1741
- return _context23.stop();
1770
+ return _context24.stop();
1742
1771
  }
1743
- }, _callee23, this, [[0, 24]]);
1772
+ }, _callee24, this, [[0, 24]]);
1744
1773
  }));
1745
- function deletePaymentItemAsync(_x14) {
1774
+ function deletePaymentItemAsync(_x15) {
1746
1775
  return _deletePaymentItemAsync.apply(this, arguments);
1747
1776
  }
1748
1777
  return deletePaymentItemAsync;
@@ -1761,14 +1790,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1761
1790
  }, {
1762
1791
  key: "updateVoucherPaymentItemsAsync",
1763
1792
  value: (function () {
1764
- var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(voucherPaymentItems) {
1793
+ var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(voucherPaymentItems) {
1765
1794
  var _iterator, _step, item, currentOrderId, isCurrentOrderReal, updatedOrder, voucherItems;
1766
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1767
- while (1) switch (_context24.prev = _context24.next) {
1795
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1796
+ while (1) switch (_context25.prev = _context25.next) {
1768
1797
  case 0:
1769
- _context24.prev = 0;
1798
+ _context25.prev = 0;
1770
1799
  if (this.store.currentOrder) {
1771
- _context24.next = 3;
1800
+ _context25.next = 3;
1772
1801
  break;
1773
1802
  }
1774
1803
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '当前没有活跃订单,无法更新代金券支付项');
@@ -1781,35 +1810,35 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1781
1810
 
1782
1811
  // 验证所有支付项都包含 voucher_id
1783
1812
  _iterator = _createForOfIteratorHelper(voucherPaymentItems);
1784
- _context24.prev = 5;
1813
+ _context25.prev = 5;
1785
1814
  _iterator.s();
1786
1815
  case 7:
1787
1816
  if ((_step = _iterator.n()).done) {
1788
- _context24.next = 13;
1817
+ _context25.next = 13;
1789
1818
  break;
1790
1819
  }
1791
1820
  item = _step.value;
1792
1821
  if (item.voucher_id) {
1793
- _context24.next = 11;
1822
+ _context25.next = 11;
1794
1823
  break;
1795
1824
  }
1796
1825
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, "\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u7F3A\u5C11 voucher_id: ".concat(JSON.stringify(item)));
1797
1826
  case 11:
1798
- _context24.next = 7;
1827
+ _context25.next = 7;
1799
1828
  break;
1800
1829
  case 13:
1801
- _context24.next = 18;
1830
+ _context25.next = 18;
1802
1831
  break;
1803
1832
  case 15:
1804
- _context24.prev = 15;
1805
- _context24.t0 = _context24["catch"](5);
1806
- _iterator.e(_context24.t0);
1833
+ _context25.prev = 15;
1834
+ _context25.t0 = _context25["catch"](5);
1835
+ _iterator.e(_context25.t0);
1807
1836
  case 18:
1808
- _context24.prev = 18;
1837
+ _context25.prev = 18;
1809
1838
  _iterator.f();
1810
- return _context24.finish(18);
1839
+ return _context25.finish(18);
1811
1840
  case 21:
1812
- _context24.next = 23;
1841
+ _context25.next = 23;
1813
1842
  return this.payment.updateVoucherPaymentItemsAsync(this.store.currentOrder.uuid, voucherPaymentItems);
1814
1843
  case 23:
1815
1844
  console.log('[Checkout] Payment模块批量更新完成');
@@ -1817,10 +1846,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1817
1846
  // 重新从Payment模块获取最新的订单数据,确保支付项同步
1818
1847
  currentOrderId = this.store.currentOrder.order_id; // 保存当前的订单ID
1819
1848
  isCurrentOrderReal = currentOrderId && !this.isVirtualOrderId(currentOrderId);
1820
- _context24.next = 28;
1849
+ _context25.next = 28;
1821
1850
  return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
1822
1851
  case 28:
1823
- updatedOrder = _context24.sent;
1852
+ updatedOrder = _context25.sent;
1824
1853
  if (updatedOrder) {
1825
1854
  // 如果当前订单ID是真实ID,但获取到的订单ID是虚拟ID,需要保护真实ID
1826
1855
  if (isCurrentOrderReal && this.isVirtualOrderId(updatedOrder.order_id)) {
@@ -1851,10 +1880,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1851
1880
  }
1852
1881
 
1853
1882
  // 更新 stateAmount 为剩余未支付金额
1854
- _context24.next = 32;
1883
+ _context25.next = 32;
1855
1884
  return this.updateStateAmountToRemaining();
1856
1885
  case 32:
1857
- _context24.next = 34;
1886
+ _context25.next = 34;
1858
1887
  return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
1859
1888
  orderUuid: this.store.currentOrder.uuid,
1860
1889
  paymentMethodCode: 'VOUCHER_BATCH',
@@ -1865,23 +1894,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1865
1894
  });
1866
1895
  case 34:
1867
1896
  console.log('[Checkout] 代金券支付项批量更新成功');
1868
- _context24.next = 43;
1897
+ _context25.next = 43;
1869
1898
  break;
1870
1899
  case 37:
1871
- _context24.prev = 37;
1872
- _context24.t1 = _context24["catch"](0);
1873
- console.error('[Checkout] 批量更新代金券支付项失败:', _context24.t1);
1874
- _context24.next = 42;
1875
- return this.handleError(_context24.t1, CheckoutErrorType.PaymentFailed);
1900
+ _context25.prev = 37;
1901
+ _context25.t1 = _context25["catch"](0);
1902
+ console.error('[Checkout] 批量更新代金券支付项失败:', _context25.t1);
1903
+ _context25.next = 42;
1904
+ return this.handleError(_context25.t1, CheckoutErrorType.PaymentFailed);
1876
1905
  case 42:
1877
- throw _context24.t1;
1906
+ throw _context25.t1;
1878
1907
  case 43:
1879
1908
  case "end":
1880
- return _context24.stop();
1909
+ return _context25.stop();
1881
1910
  }
1882
- }, _callee24, this, [[0, 37], [5, 15, 18, 21]]);
1911
+ }, _callee25, this, [[0, 37], [5, 15, 18, 21]]);
1883
1912
  }));
1884
- function updateVoucherPaymentItemsAsync(_x15) {
1913
+ function updateVoucherPaymentItemsAsync(_x16) {
1885
1914
  return _updateVoucherPaymentItemsAsync.apply(this, arguments);
1886
1915
  }
1887
1916
  return updateVoucherPaymentItemsAsync;
@@ -1898,20 +1927,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1898
1927
  }, {
1899
1928
  key: "updateOrderDepositStatusAsync",
1900
1929
  value: (function () {
1901
- var _updateOrderDepositStatusAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(isDeposit) {
1930
+ var _updateOrderDepositStatusAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(isDeposit) {
1902
1931
  var newDepositValue, oldDepositValue, updateParams;
1903
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1904
- while (1) switch (_context25.prev = _context25.next) {
1932
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1933
+ while (1) switch (_context26.prev = _context26.next) {
1905
1934
  case 0:
1906
- _context25.prev = 0;
1935
+ _context26.prev = 0;
1907
1936
  if (!(isDeposit !== 0 && isDeposit !== 1)) {
1908
- _context25.next = 3;
1937
+ _context26.next = 3;
1909
1938
  break;
1910
1939
  }
1911
1940
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, 'isDeposit 参数只能是 0(全款订单)或 1(定金订单)');
1912
1941
  case 3:
1913
1942
  if (this.store.currentOrder) {
1914
- _context25.next = 5;
1943
+ _context26.next = 5;
1915
1944
  break;
1916
1945
  }
1917
1946
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '未找到当前订单,无法修改定金状态');
@@ -1919,11 +1948,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1919
1948
  newDepositValue = isDeposit;
1920
1949
  oldDepositValue = this.store.currentOrder.is_deposit; // 如果状态没有变化,直接返回
1921
1950
  if (!(oldDepositValue === newDepositValue)) {
1922
- _context25.next = 10;
1951
+ _context26.next = 10;
1923
1952
  break;
1924
1953
  }
1925
1954
  console.log('[Checkout] 定金状态无变化,跳过更新');
1926
- return _context25.abrupt("return");
1955
+ return _context26.abrupt("return");
1927
1956
  case 10:
1928
1957
  console.log('[Checkout] 更新订单定金状态:', {
1929
1958
  orderUuid: this.store.currentOrder.uuid,
@@ -1942,7 +1971,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1942
1971
  }
1943
1972
 
1944
1973
  // 调用 Payment 模块更新订单
1945
- _context25.next = 15;
1974
+ _context26.next = 15;
1946
1975
  return this.payment.updateOrderAsync(this.store.currentOrder.uuid, updateParams);
1947
1976
  case 15:
1948
1977
  // 更新本地缓存的订单对象
@@ -1954,7 +1983,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1954
1983
  }
1955
1984
 
1956
1985
  // 触发订单更新事件
1957
- _context25.next = 19;
1986
+ _context26.next = 19;
1958
1987
  return this.core.effects.emit(CheckoutHooks.OnOrderCreated, {
1959
1988
  order: this.store.currentOrder,
1960
1989
  timestamp: Date.now()
@@ -1964,23 +1993,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1964
1993
  isDeposit: newDepositValue,
1965
1994
  depositAmount: this.store.currentOrder.deposit_amount
1966
1995
  });
1967
- _context25.next = 28;
1996
+ _context26.next = 28;
1968
1997
  break;
1969
1998
  case 22:
1970
- _context25.prev = 22;
1971
- _context25.t0 = _context25["catch"](0);
1972
- console.error('[Checkout] 更新订单定金状态失败:', _context25.t0);
1973
- _context25.next = 27;
1974
- return this.handleError(_context25.t0, CheckoutErrorType.ValidationFailed);
1999
+ _context26.prev = 22;
2000
+ _context26.t0 = _context26["catch"](0);
2001
+ console.error('[Checkout] 更新订单定金状态失败:', _context26.t0);
2002
+ _context26.next = 27;
2003
+ return this.handleError(_context26.t0, CheckoutErrorType.ValidationFailed);
1975
2004
  case 27:
1976
- throw _context25.t0;
2005
+ throw _context26.t0;
1977
2006
  case 28:
1978
2007
  case "end":
1979
- return _context25.stop();
2008
+ return _context26.stop();
1980
2009
  }
1981
- }, _callee25, this, [[0, 22]]);
2010
+ }, _callee26, this, [[0, 22]]);
1982
2011
  }));
1983
- function updateOrderDepositStatusAsync(_x16) {
2012
+ function updateOrderDepositStatusAsync(_x17) {
1984
2013
  return _updateOrderDepositStatusAsync.apply(this, arguments);
1985
2014
  }
1986
2015
  return updateOrderDepositStatusAsync;
@@ -1997,13 +2026,13 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1997
2026
  }, {
1998
2027
  key: "updateOrderCustomerAsync",
1999
2028
  value: (function () {
2000
- var _updateOrderCustomerAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(customer) {
2001
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2002
- while (1) switch (_context26.prev = _context26.next) {
2029
+ var _updateOrderCustomerAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(customer) {
2030
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2031
+ while (1) switch (_context27.prev = _context27.next) {
2003
2032
  case 0:
2004
- _context26.prev = 0;
2033
+ _context27.prev = 0;
2005
2034
  if (this.store.currentOrder) {
2006
- _context26.next = 3;
2035
+ _context27.next = 3;
2007
2036
  break;
2008
2037
  }
2009
2038
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '未找到当前订单,无法更新客户信息');
@@ -2026,23 +2055,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2026
2055
  this.store.localOrderData.customer_name = customer.customer_name;
2027
2056
  }
2028
2057
  console.log('[Checkout] 订单客户信息更新成功:', this.store.currentCustomer);
2029
- _context26.next = 15;
2058
+ _context27.next = 15;
2030
2059
  break;
2031
2060
  case 9:
2032
- _context26.prev = 9;
2033
- _context26.t0 = _context26["catch"](0);
2034
- console.error('[Checkout] 更新订单客户信息失败:', _context26.t0);
2035
- _context26.next = 14;
2036
- return this.handleError(_context26.t0, CheckoutErrorType.ValidationFailed);
2061
+ _context27.prev = 9;
2062
+ _context27.t0 = _context27["catch"](0);
2063
+ console.error('[Checkout] 更新订单客户信息失败:', _context27.t0);
2064
+ _context27.next = 14;
2065
+ return this.handleError(_context27.t0, CheckoutErrorType.ValidationFailed);
2037
2066
  case 14:
2038
- throw _context26.t0;
2067
+ throw _context27.t0;
2039
2068
  case 15:
2040
2069
  case "end":
2041
- return _context26.stop();
2070
+ return _context27.stop();
2042
2071
  }
2043
- }, _callee26, this, [[0, 9]]);
2072
+ }, _callee27, this, [[0, 9]]);
2044
2073
  }));
2045
- function updateOrderCustomerAsync(_x17) {
2074
+ function updateOrderCustomerAsync(_x18) {
2046
2075
  return _updateOrderCustomerAsync.apply(this, arguments);
2047
2076
  }
2048
2077
  return updateOrderCustomerAsync;
@@ -2068,7 +2097,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2068
2097
  key: "needsManualSync",
2069
2098
  value: function needsManualSync() {
2070
2099
  try {
2071
- var _this$store$currentOr5;
2100
+ var _this$store$currentOr6;
2072
2101
  // 检查基础条件
2073
2102
  if (!this.store.currentOrder || this.store.isOrderSynced) {
2074
2103
  return false;
@@ -2089,7 +2118,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2089
2118
  orderUuid: this.store.currentOrder.uuid,
2090
2119
  isOrderSynced: this.store.isOrderSynced,
2091
2120
  remainingAmount: remainingAmount,
2092
- hasPayments: ((_this$store$currentOr5 = this.store.currentOrder.payment) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.length) > 0,
2121
+ hasPayments: ((_this$store$currentOr6 = this.store.currentOrder.payment) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.length) > 0,
2093
2122
  allPaymentsHaveVoucherId: allPaymentsHaveVoucherId,
2094
2123
  needsManualSync: allPaymentsHaveVoucherId
2095
2124
  });
@@ -2108,17 +2137,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2108
2137
  }, {
2109
2138
  key: "manualSyncOrderAsync",
2110
2139
  value: (function () {
2111
- var _manualSyncOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2112
- var orderUuid, oldOrderId, realOrderId, finalOrderId, finalIsVirtual, _this$store$currentOr6, errorMessage;
2113
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2114
- while (1) switch (_context27.prev = _context27.next) {
2140
+ var _manualSyncOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2141
+ var orderUuid, oldOrderId, realOrderId, finalOrderId, finalIsVirtual, _this$store$currentOr7, errorMessage;
2142
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2143
+ while (1) switch (_context28.prev = _context28.next) {
2115
2144
  case 0:
2116
- _context27.prev = 0;
2145
+ _context28.prev = 0;
2117
2146
  if (this.store.currentOrder) {
2118
- _context27.next = 3;
2147
+ _context28.next = 3;
2119
2148
  break;
2120
2149
  }
2121
- return _context27.abrupt("return", {
2150
+ return _context28.abrupt("return", {
2122
2151
  success: false,
2123
2152
  message: '当前没有活跃订单,无法同步'
2124
2153
  });
@@ -2136,10 +2165,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2136
2165
  });
2137
2166
 
2138
2167
  // 强制同步订单到后端,并获取真实订单ID
2139
- _context27.next = 9;
2168
+ _context28.next = 9;
2140
2169
  return this.syncOrderToBackendWithReturn(true);
2141
2170
  case 9:
2142
- realOrderId = _context27.sent;
2171
+ realOrderId = _context28.sent;
2143
2172
  console.log('[Checkout] 手动同步订单完成:', {
2144
2173
  orderUuid: orderUuid,
2145
2174
  oldOrderId: oldOrderId,
@@ -2163,7 +2192,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2163
2192
  if (realOrderId !== finalOrderId) {
2164
2193
  console.error('[Checkout] 严重警告:返回的订单ID与存储的订单ID不一致!');
2165
2194
  }
2166
- return _context27.abrupt("return", {
2195
+ return _context28.abrupt("return", {
2167
2196
  success: true,
2168
2197
  message: '订单同步成功',
2169
2198
  orderId: realOrderId,
@@ -2171,20 +2200,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2171
2200
  orderUuid: orderUuid
2172
2201
  });
2173
2202
  case 19:
2174
- _context27.prev = 19;
2175
- _context27.t0 = _context27["catch"](0);
2176
- console.error('[Checkout] 手动同步订单失败:', _context27.t0);
2177
- errorMessage = _context27.t0 instanceof Error ? _context27.t0.message : '同步失败';
2178
- return _context27.abrupt("return", {
2203
+ _context28.prev = 19;
2204
+ _context28.t0 = _context28["catch"](0);
2205
+ console.error('[Checkout] 手动同步订单失败:', _context28.t0);
2206
+ errorMessage = _context28.t0 instanceof Error ? _context28.t0.message : '同步失败';
2207
+ return _context28.abrupt("return", {
2179
2208
  success: false,
2180
2209
  message: "\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(errorMessage),
2181
- orderUuid: (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.uuid
2210
+ orderUuid: (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.uuid
2182
2211
  });
2183
2212
  case 24:
2184
2213
  case "end":
2185
- return _context27.stop();
2214
+ return _context28.stop();
2186
2215
  }
2187
- }, _callee27, this, [[0, 19]]);
2216
+ }, _callee28, this, [[0, 19]]);
2188
2217
  }));
2189
2218
  function manualSyncOrderAsync() {
2190
2219
  return _manualSyncOrderAsync.apply(this, arguments);
@@ -2230,17 +2259,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2230
2259
  }, {
2231
2260
  key: "saveForLaterPaymentAsync",
2232
2261
  value: (function () {
2233
- var _saveForLaterPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2234
- var orderUuid, currentOrderId, allPaymentItems, filteredPaymentItems, voucherItems, realOrderId, finalOrderId, _this$store$currentOr7, errorMessage;
2235
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2236
- while (1) switch (_context28.prev = _context28.next) {
2262
+ var _saveForLaterPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2263
+ var orderUuid, currentOrderId, allPaymentItems, filteredPaymentItems, voucherItems, realOrderId, finalOrderId, _this$store$currentOr8, errorMessage;
2264
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2265
+ while (1) switch (_context29.prev = _context29.next) {
2237
2266
  case 0:
2238
- _context28.prev = 0;
2267
+ _context29.prev = 0;
2239
2268
  if (this.store.currentOrder) {
2240
- _context28.next = 3;
2269
+ _context29.next = 3;
2241
2270
  break;
2242
2271
  }
2243
- return _context28.abrupt("return", {
2272
+ return _context29.abrupt("return", {
2244
2273
  success: false,
2245
2274
  message: '当前没有活跃订单,无法保存'
2246
2275
  });
@@ -2254,10 +2283,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2254
2283
  });
2255
2284
 
2256
2285
  // 获取当前订单的所有支付项
2257
- _context28.next = 8;
2286
+ _context29.next = 8;
2258
2287
  return this.payment.getPaymentItemsAsync(this.store.currentOrder.uuid);
2259
2288
  case 8:
2260
- allPaymentItems = _context28.sent;
2289
+ allPaymentItems = _context29.sent;
2261
2290
  // 过滤掉带有 voucher_id 的支付项(代金券类支付项)
2262
2291
  filteredPaymentItems = allPaymentItems.filter(function (payment) {
2263
2292
  return !payment.voucher_id || payment.voucher_id.trim() === '';
@@ -2287,10 +2316,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2287
2316
  });
2288
2317
 
2289
2318
  // 调用同步方法,传入过滤后的支付项
2290
- _context28.next = 14;
2319
+ _context29.next = 14;
2291
2320
  return this.syncOrderToBackendWithReturn(false, filteredPaymentItems);
2292
2321
  case 14:
2293
- realOrderId = _context28.sent;
2322
+ realOrderId = _context29.sent;
2294
2323
  console.log('[Checkout] 保存订单完成:', {
2295
2324
  orderUuid: orderUuid,
2296
2325
  oldOrderId: currentOrderId,
@@ -2307,27 +2336,27 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2307
2336
  是否一致: realOrderId === finalOrderId,
2308
2337
  同步状态: this.store.isOrderSynced
2309
2338
  });
2310
- return _context28.abrupt("return", {
2339
+ return _context29.abrupt("return", {
2311
2340
  success: true,
2312
2341
  message: '订单保存成功,可稍后继续支付',
2313
2342
  orderId: realOrderId,
2314
2343
  orderUuid: orderUuid
2315
2344
  });
2316
2345
  case 21:
2317
- _context28.prev = 21;
2318
- _context28.t0 = _context28["catch"](0);
2319
- console.error('[Checkout] 保存订单失败:', _context28.t0);
2320
- errorMessage = _context28.t0 instanceof Error ? _context28.t0.message : '保存失败';
2321
- return _context28.abrupt("return", {
2346
+ _context29.prev = 21;
2347
+ _context29.t0 = _context29["catch"](0);
2348
+ console.error('[Checkout] 保存订单失败:', _context29.t0);
2349
+ errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : '保存失败';
2350
+ return _context29.abrupt("return", {
2322
2351
  success: false,
2323
2352
  message: "\u8BA2\u5355\u4FDD\u5B58\u5931\u8D25: ".concat(errorMessage),
2324
- orderUuid: (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.uuid
2353
+ orderUuid: (_this$store$currentOr8 = this.store.currentOrder) === null || _this$store$currentOr8 === void 0 ? void 0 : _this$store$currentOr8.uuid
2325
2354
  });
2326
2355
  case 26:
2327
2356
  case "end":
2328
- return _context28.stop();
2357
+ return _context29.stop();
2329
2358
  }
2330
- }, _callee28, this, [[0, 21]]);
2359
+ }, _callee29, this, [[0, 21]]);
2331
2360
  }));
2332
2361
  function saveForLaterPaymentAsync() {
2333
2362
  return _saveForLaterPaymentAsync.apply(this, arguments);
@@ -2371,15 +2400,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2371
2400
  }, {
2372
2401
  key: "updateShopDiscountAsync",
2373
2402
  value: (function () {
2374
- var _updateShopDiscountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(discountAmount) {
2375
- var _this$store$currentOr8, _this$store$currentOr9, oldDiscount, shopDiscountItem, updatedAmountInfo;
2376
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2377
- while (1) switch (_context29.prev = _context29.next) {
2403
+ var _updateShopDiscountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(discountAmount) {
2404
+ var _this$store$currentOr9, _this$store$currentOr10, oldDiscount, shopDiscountItem, updatedAmountInfo;
2405
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2406
+ while (1) switch (_context30.prev = _context30.next) {
2378
2407
  case 0:
2379
- _context29.prev = 0;
2408
+ _context30.prev = 0;
2380
2409
  oldDiscount = this.getShopDiscount();
2381
2410
  console.log('[Checkout] 更新商店折扣:', {
2382
- orderUuid: (_this$store$currentOr8 = this.store.currentOrder) === null || _this$store$currentOr8 === void 0 ? void 0 : _this$store$currentOr8.uuid,
2411
+ orderUuid: (_this$store$currentOr9 = this.store.currentOrder) === null || _this$store$currentOr9 === void 0 ? void 0 : _this$store$currentOr9.uuid,
2383
2412
  oldDiscount: oldDiscount,
2384
2413
  newDiscount: discountAmount
2385
2414
  });
@@ -2424,12 +2453,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2424
2453
  }
2425
2454
 
2426
2455
  // 4. 更新 stateAmount 为剩余未支付金额
2427
- _context29.next = 8;
2456
+ _context30.next = 8;
2428
2457
  return this.updateStateAmountToRemaining();
2429
2458
  case 8:
2430
- _context29.next = 10;
2459
+ _context30.next = 10;
2431
2460
  return this.core.effects.emit(CheckoutHooks.OnShopDiscountChanged, {
2432
- orderUuid: (_this$store$currentOr9 = this.store.currentOrder) === null || _this$store$currentOr9 === void 0 ? void 0 : _this$store$currentOr9.uuid,
2461
+ orderUuid: (_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.uuid,
2433
2462
  oldDiscount: oldDiscount,
2434
2463
  newDiscount: discountAmount,
2435
2464
  timestamp: Date.now()
@@ -2439,23 +2468,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2439
2468
  oldDiscount: oldDiscount,
2440
2469
  newDiscount: discountAmount
2441
2470
  });
2442
- _context29.next = 19;
2471
+ _context30.next = 19;
2443
2472
  break;
2444
2473
  case 13:
2445
- _context29.prev = 13;
2446
- _context29.t0 = _context29["catch"](0);
2447
- console.error('[Checkout] 更新商店折扣失败:', _context29.t0);
2448
- _context29.next = 18;
2449
- return this.handleError(_context29.t0, CheckoutErrorType.ValidationFailed);
2474
+ _context30.prev = 13;
2475
+ _context30.t0 = _context30["catch"](0);
2476
+ console.error('[Checkout] 更新商店折扣失败:', _context30.t0);
2477
+ _context30.next = 18;
2478
+ return this.handleError(_context30.t0, CheckoutErrorType.ValidationFailed);
2450
2479
  case 18:
2451
- throw _context29.t0;
2480
+ throw _context30.t0;
2452
2481
  case 19:
2453
2482
  case "end":
2454
- return _context29.stop();
2483
+ return _context30.stop();
2455
2484
  }
2456
- }, _callee29, this, [[0, 13]]);
2485
+ }, _callee30, this, [[0, 13]]);
2457
2486
  }));
2458
- function updateShopDiscountAsync(_x18) {
2487
+ function updateShopDiscountAsync(_x19) {
2459
2488
  return _updateShopDiscountAsync.apply(this, arguments);
2460
2489
  }
2461
2490
  return updateShopDiscountAsync;
@@ -2469,20 +2498,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2469
2498
  }, {
2470
2499
  key: "updateOrderNoteAsync",
2471
2500
  value: (function () {
2472
- var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(note) {
2473
- var _this$store$currentOr10, _this$store$currentOr11, oldNote, orderInPayment;
2474
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2475
- while (1) switch (_context30.prev = _context30.next) {
2501
+ var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(note) {
2502
+ var _this$store$currentOr11, _this$store$currentOr12, oldNote, orderInPayment;
2503
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2504
+ while (1) switch (_context31.prev = _context31.next) {
2476
2505
  case 0:
2477
- _context30.prev = 0;
2506
+ _context31.prev = 0;
2478
2507
  if (this.store.localOrderData) {
2479
- _context30.next = 3;
2508
+ _context31.next = 3;
2480
2509
  break;
2481
2510
  }
2482
2511
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有本地订单数据,无法更新备注');
2483
2512
  case 3:
2484
2513
  console.log('[Checkout] 更新订单备注:', {
2485
- orderUuid: (_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.uuid,
2514
+ orderUuid: (_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.uuid,
2486
2515
  oldNote: this.store.localOrderData.shop_note,
2487
2516
  newNote: note
2488
2517
  });
@@ -2493,29 +2522,29 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2493
2522
 
2494
2523
  // 如果有当前订单,也同步到Payment模块中的订单数据
2495
2524
  if (!this.store.currentOrder) {
2496
- _context30.next = 17;
2525
+ _context31.next = 17;
2497
2526
  break;
2498
2527
  }
2499
- _context30.prev = 7;
2500
- _context30.next = 10;
2528
+ _context31.prev = 7;
2529
+ _context31.next = 10;
2501
2530
  return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
2502
2531
  case 10:
2503
- orderInPayment = _context30.sent;
2532
+ orderInPayment = _context31.sent;
2504
2533
  if (orderInPayment && orderInPayment.note !== undefined) {
2505
2534
  // 使用Payment模块的更新方法(如果有的话)
2506
2535
  // 这里可能需要根据Payment模块的实际API来调整
2507
2536
  console.log('[Checkout] 同步备注到Payment模块的订单数据中');
2508
2537
  }
2509
- _context30.next = 17;
2538
+ _context31.next = 17;
2510
2539
  break;
2511
2540
  case 14:
2512
- _context30.prev = 14;
2513
- _context30.t0 = _context30["catch"](7);
2514
- console.warn('[Checkout] 同步备注到Payment模块失败,但本地更新成功:', _context30.t0);
2541
+ _context31.prev = 14;
2542
+ _context31.t0 = _context31["catch"](7);
2543
+ console.warn('[Checkout] 同步备注到Payment模块失败,但本地更新成功:', _context31.t0);
2515
2544
  case 17:
2516
- _context30.next = 19;
2545
+ _context31.next = 19;
2517
2546
  return this.core.effects.emit(CheckoutHooks.OnOrderNoteChanged, {
2518
- orderUuid: (_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.uuid,
2547
+ orderUuid: (_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.uuid,
2519
2548
  oldNote: oldNote,
2520
2549
  newNote: note,
2521
2550
  timestamp: Date.now()
@@ -2525,23 +2554,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2525
2554
  oldNote: oldNote,
2526
2555
  newNote: note
2527
2556
  });
2528
- _context30.next = 28;
2557
+ _context31.next = 28;
2529
2558
  break;
2530
2559
  case 22:
2531
- _context30.prev = 22;
2532
- _context30.t1 = _context30["catch"](0);
2533
- console.error('[Checkout] 更新订单备注失败:', _context30.t1);
2534
- _context30.next = 27;
2535
- return this.handleError(_context30.t1, CheckoutErrorType.ValidationFailed);
2560
+ _context31.prev = 22;
2561
+ _context31.t1 = _context31["catch"](0);
2562
+ console.error('[Checkout] 更新订单备注失败:', _context31.t1);
2563
+ _context31.next = 27;
2564
+ return this.handleError(_context31.t1, CheckoutErrorType.ValidationFailed);
2536
2565
  case 27:
2537
- throw _context30.t1;
2566
+ throw _context31.t1;
2538
2567
  case 28:
2539
2568
  case "end":
2540
- return _context30.stop();
2569
+ return _context31.stop();
2541
2570
  }
2542
- }, _callee30, this, [[0, 22], [7, 14]]);
2571
+ }, _callee31, this, [[0, 22], [7, 14]]);
2543
2572
  }));
2544
- function updateOrderNoteAsync(_x19) {
2573
+ function updateOrderNoteAsync(_x20) {
2545
2574
  return _updateOrderNoteAsync.apply(this, arguments);
2546
2575
  }
2547
2576
  return updateOrderNoteAsync;
@@ -2553,14 +2582,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2553
2582
  }, {
2554
2583
  key: "setStatus",
2555
2584
  value: (function () {
2556
- var _setStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(status) {
2585
+ var _setStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(status) {
2557
2586
  var oldStatus;
2558
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2559
- while (1) switch (_context31.prev = _context31.next) {
2587
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2588
+ while (1) switch (_context32.prev = _context32.next) {
2560
2589
  case 0:
2561
2590
  oldStatus = this.store.status;
2562
2591
  this.store.status = status;
2563
- _context31.next = 4;
2592
+ _context32.next = 4;
2564
2593
  return this.core.effects.emit(CheckoutHooks.OnStatusChanged, {
2565
2594
  oldStatus: oldStatus,
2566
2595
  newStatus: status,
@@ -2568,11 +2597,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2568
2597
  });
2569
2598
  case 4:
2570
2599
  case "end":
2571
- return _context31.stop();
2600
+ return _context32.stop();
2572
2601
  }
2573
- }, _callee31, this);
2602
+ }, _callee32, this);
2574
2603
  }));
2575
- function setStatus(_x20) {
2604
+ function setStatus(_x21) {
2576
2605
  return _setStatus.apply(this, arguments);
2577
2606
  }
2578
2607
  return setStatus;
@@ -2584,14 +2613,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2584
2613
  }, {
2585
2614
  key: "setStep",
2586
2615
  value: (function () {
2587
- var _setStep = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(step) {
2616
+ var _setStep = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(step) {
2588
2617
  var oldStep;
2589
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2590
- while (1) switch (_context32.prev = _context32.next) {
2618
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2619
+ while (1) switch (_context33.prev = _context33.next) {
2591
2620
  case 0:
2592
2621
  oldStep = this.store.step;
2593
2622
  this.store.step = step;
2594
- _context32.next = 4;
2623
+ _context33.next = 4;
2595
2624
  return this.core.effects.emit(CheckoutHooks.OnStepChanged, {
2596
2625
  oldStep: oldStep,
2597
2626
  newStep: step,
@@ -2599,11 +2628,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2599
2628
  });
2600
2629
  case 4:
2601
2630
  case "end":
2602
- return _context32.stop();
2631
+ return _context33.stop();
2603
2632
  }
2604
- }, _callee32, this);
2633
+ }, _callee33, this);
2605
2634
  }));
2606
- function setStep(_x21) {
2635
+ function setStep(_x22) {
2607
2636
  return _setStep.apply(this, arguments);
2608
2637
  }
2609
2638
  return setStep;
@@ -2615,17 +2644,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2615
2644
  }, {
2616
2645
  key: "handleError",
2617
2646
  value: (function () {
2618
- var _handleError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(error, type) {
2647
+ var _handleError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(error, type) {
2619
2648
  var checkoutError;
2620
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2621
- while (1) switch (_context33.prev = _context33.next) {
2649
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2650
+ while (1) switch (_context34.prev = _context34.next) {
2622
2651
  case 0:
2623
2652
  checkoutError = error instanceof Error && 'type' in error ? error : createCheckoutError(type, error.message, error);
2624
2653
  this.store.lastError = checkoutError;
2625
- _context33.next = 4;
2654
+ _context34.next = 4;
2626
2655
  return this.setStatus(CheckoutStatus.Error);
2627
2656
  case 4:
2628
- _context33.next = 6;
2657
+ _context34.next = 6;
2629
2658
  return this.core.effects.emit(CheckoutHooks.OnError, {
2630
2659
  error: checkoutError,
2631
2660
  context: {
@@ -2638,11 +2667,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2638
2667
  console.error('[Checkout] 错误:', checkoutError);
2639
2668
  case 7:
2640
2669
  case "end":
2641
- return _context33.stop();
2670
+ return _context34.stop();
2642
2671
  }
2643
- }, _callee33, this);
2672
+ }, _callee34, this);
2644
2673
  }));
2645
- function handleError(_x22, _x23) {
2674
+ function handleError(_x23, _x24) {
2646
2675
  return _handleError.apply(this, arguments);
2647
2676
  }
2648
2677
  return handleError;
@@ -2654,34 +2683,34 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2654
2683
  }, {
2655
2684
  key: "handlePaymentSuccess",
2656
2685
  value: (function () {
2657
- var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(data) {
2658
- var _this$store$currentOr12;
2659
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2660
- while (1) switch (_context34.prev = _context34.next) {
2686
+ var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(data) {
2687
+ var _this$store$currentOr13;
2688
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2689
+ while (1) switch (_context35.prev = _context35.next) {
2661
2690
  case 0:
2662
- _context34.next = 2;
2691
+ _context35.next = 2;
2663
2692
  return this.setStatus(CheckoutStatus.PaymentCompleted);
2664
2693
  case 2:
2665
- _context34.next = 4;
2694
+ _context35.next = 4;
2666
2695
  return this.updateStateAmountToRemaining();
2667
2696
  case 4:
2668
- _context34.next = 6;
2697
+ _context35.next = 6;
2669
2698
  return this.core.effects.emit(CheckoutHooks.OnPaymentSuccess, {
2670
2699
  orderUuid: data.orderUuid,
2671
2700
  paymentMethodCode: '',
2672
- amount: ((_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.total_amount) || '0',
2701
+ amount: ((_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.total_amount) || '0',
2673
2702
  timestamp: data.timestamp
2674
2703
  });
2675
2704
  case 6:
2676
- _context34.next = 8;
2705
+ _context35.next = 8;
2677
2706
  return this.completeCheckoutAsync();
2678
2707
  case 8:
2679
2708
  case "end":
2680
- return _context34.stop();
2709
+ return _context35.stop();
2681
2710
  }
2682
- }, _callee34, this);
2711
+ }, _callee35, this);
2683
2712
  }));
2684
- function handlePaymentSuccess(_x24) {
2713
+ function handlePaymentSuccess(_x25) {
2685
2714
  return _handlePaymentSuccess.apply(this, arguments);
2686
2715
  }
2687
2716
  return handlePaymentSuccess;
@@ -2693,30 +2722,30 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2693
2722
  }, {
2694
2723
  key: "handlePaymentError",
2695
2724
  value: (function () {
2696
- var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(data) {
2697
- var _this$store$currentOr13;
2725
+ var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(data) {
2726
+ var _this$store$currentOr14;
2698
2727
  var error;
2699
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2700
- while (1) switch (_context35.prev = _context35.next) {
2728
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2729
+ while (1) switch (_context36.prev = _context36.next) {
2701
2730
  case 0:
2702
2731
  error = createCheckoutError(CheckoutErrorType.PaymentFailed, data.error || '支付同步失败');
2703
- _context35.next = 3;
2732
+ _context36.next = 3;
2704
2733
  return this.handleError(error instanceof Error ? error : new Error(String(error)), CheckoutErrorType.PaymentFailed);
2705
2734
  case 3:
2706
- _context35.next = 5;
2735
+ _context36.next = 5;
2707
2736
  return this.core.effects.emit(CheckoutHooks.OnPaymentFailed, {
2708
2737
  orderUuid: data.orderUuid,
2709
2738
  paymentMethodCode: '',
2710
- amount: ((_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.total_amount) || '0',
2739
+ amount: ((_this$store$currentOr14 = this.store.currentOrder) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.total_amount) || '0',
2711
2740
  timestamp: data.timestamp
2712
2741
  });
2713
2742
  case 5:
2714
2743
  case "end":
2715
- return _context35.stop();
2744
+ return _context36.stop();
2716
2745
  }
2717
- }, _callee35, this);
2746
+ }, _callee36, this);
2718
2747
  }));
2719
- function handlePaymentError(_x25) {
2748
+ function handlePaymentError(_x26) {
2720
2749
  return _handlePaymentError.apply(this, arguments);
2721
2750
  }
2722
2751
  return handlePaymentError;
@@ -2728,18 +2757,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2728
2757
  }, {
2729
2758
  key: "validateCheckoutParams",
2730
2759
  value: (function () {
2731
- var _validateCheckoutParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
2732
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2733
- while (1) switch (_context36.prev = _context36.next) {
2760
+ var _validateCheckoutParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
2761
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2762
+ while (1) switch (_context37.prev = _context37.next) {
2734
2763
  case 0:
2735
- return _context36.abrupt("return", validateCheckoutData(params));
2764
+ return _context37.abrupt("return", validateCheckoutData(params));
2736
2765
  case 1:
2737
2766
  case "end":
2738
- return _context36.stop();
2767
+ return _context37.stop();
2739
2768
  }
2740
- }, _callee36);
2769
+ }, _callee37);
2741
2770
  }));
2742
- function validateCheckoutParams(_x26) {
2771
+ function validateCheckoutParams(_x27) {
2743
2772
  return _validateCheckoutParams.apply(this, arguments);
2744
2773
  }
2745
2774
  return validateCheckoutParams;
@@ -2751,10 +2780,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2751
2780
  }, {
2752
2781
  key: "validateLocalOrderData",
2753
2782
  value: (function () {
2754
- var _validateLocalOrderData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(orderData) {
2783
+ var _validateLocalOrderData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(orderData) {
2755
2784
  var errors;
2756
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2757
- while (1) switch (_context37.prev = _context37.next) {
2785
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2786
+ while (1) switch (_context38.prev = _context38.next) {
2758
2787
  case 0:
2759
2788
  errors = []; // 验证基本字段
2760
2789
  if (!orderData.type) {
@@ -2781,17 +2810,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2781
2810
  }
2782
2811
  });
2783
2812
  }
2784
- return _context37.abrupt("return", {
2813
+ return _context38.abrupt("return", {
2785
2814
  valid: errors.length === 0,
2786
2815
  errors: errors
2787
2816
  });
2788
2817
  case 6:
2789
2818
  case "end":
2790
- return _context37.stop();
2819
+ return _context38.stop();
2791
2820
  }
2792
- }, _callee37);
2821
+ }, _callee38);
2793
2822
  }));
2794
- function validateLocalOrderData(_x27) {
2823
+ function validateLocalOrderData(_x28) {
2795
2824
  return _validateLocalOrderData.apply(this, arguments);
2796
2825
  }
2797
2826
  return validateLocalOrderData;
@@ -2889,31 +2918,31 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2889
2918
  }, {
2890
2919
  key: "preloadPaymentMethods",
2891
2920
  value: (function () {
2892
- var _preloadPaymentMethods = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
2921
+ var _preloadPaymentMethods = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
2893
2922
  var methods;
2894
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2895
- while (1) switch (_context38.prev = _context38.next) {
2923
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
2924
+ while (1) switch (_context39.prev = _context39.next) {
2896
2925
  case 0:
2897
- _context38.prev = 0;
2926
+ _context39.prev = 0;
2898
2927
  console.log('[Checkout] 预加载支付方式...');
2899
- _context38.next = 4;
2928
+ _context39.next = 4;
2900
2929
  return this.payment.getPayMethodListAsync();
2901
2930
  case 4:
2902
- methods = _context38.sent;
2931
+ methods = _context39.sent;
2903
2932
  this.store.paymentMethods = methods;
2904
2933
  console.log("[Checkout] \u9884\u52A0\u8F7D\u5B8C\u6210\uFF0C\u5171 ".concat(methods.length, " \u79CD\u652F\u4ED8\u65B9\u5F0F"));
2905
- _context38.next = 13;
2934
+ _context39.next = 13;
2906
2935
  break;
2907
2936
  case 9:
2908
- _context38.prev = 9;
2909
- _context38.t0 = _context38["catch"](0);
2910
- console.error('[Checkout] 预加载支付方式失败:', _context38.t0);
2937
+ _context39.prev = 9;
2938
+ _context39.t0 = _context39["catch"](0);
2939
+ console.error('[Checkout] 预加载支付方式失败:', _context39.t0);
2911
2940
  this.store.paymentMethods = [];
2912
2941
  case 13:
2913
2942
  case "end":
2914
- return _context38.stop();
2943
+ return _context39.stop();
2915
2944
  }
2916
- }, _callee38, this, [[0, 9]]);
2945
+ }, _callee39, this, [[0, 9]]);
2917
2946
  }));
2918
2947
  function preloadPaymentMethods() {
2919
2948
  return _preloadPaymentMethods.apply(this, arguments);
@@ -3000,30 +3029,30 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3000
3029
  }, {
3001
3030
  key: "updateStateAmountToRemaining",
3002
3031
  value: (function () {
3003
- var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3004
- var _this$store$currentOr14, remainingAmount, currentStateAmount;
3005
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3006
- while (1) switch (_context39.prev = _context39.next) {
3032
+ var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3033
+ var _this$store$currentOr15, remainingAmount, currentStateAmount;
3034
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3035
+ while (1) switch (_context40.prev = _context40.next) {
3007
3036
  case 0:
3008
- _context39.prev = 0;
3037
+ _context40.prev = 0;
3009
3038
  remainingAmount = this.calculateRemainingAmount();
3010
3039
  currentStateAmount = this.store.stateAmount;
3011
3040
  console.log('[Checkout] updateStateAmountToRemaining: 状态检查:', {
3012
3041
  calculatedRemainingAmount: remainingAmount,
3013
3042
  currentStateAmount: currentStateAmount,
3014
3043
  needsUpdate: remainingAmount !== currentStateAmount,
3015
- orderUuid: (_this$store$currentOr14 = this.store.currentOrder) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.uuid
3044
+ orderUuid: (_this$store$currentOr15 = this.store.currentOrder) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.uuid
3016
3045
  });
3017
3046
 
3018
3047
  // 只有当剩余金额与当前 stateAmount 不同时才更新
3019
3048
  if (!(remainingAmount !== currentStateAmount)) {
3020
- _context39.next = 11;
3049
+ _context40.next = 11;
3021
3050
  break;
3022
3051
  }
3023
3052
  this.store.stateAmount = remainingAmount;
3024
3053
 
3025
3054
  // 发出 stateAmount 变更事件
3026
- _context39.next = 8;
3055
+ _context40.next = 8;
3027
3056
  return this.core.effects.emit(CheckoutHooks.OnStateAmountChanged, {
3028
3057
  oldAmount: currentStateAmount,
3029
3058
  newAmount: remainingAmount,
@@ -3034,7 +3063,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3034
3063
  oldAmount: currentStateAmount,
3035
3064
  newAmount: remainingAmount
3036
3065
  });
3037
- _context39.next = 12;
3066
+ _context40.next = 12;
3038
3067
  break;
3039
3068
  case 11:
3040
3069
  console.log('[Checkout] stateAmount 无需更新,当前值已是最新:', {
@@ -3042,20 +3071,20 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3042
3071
  remainingAmount: remainingAmount
3043
3072
  });
3044
3073
  case 12:
3045
- _context39.next = 14;
3074
+ _context40.next = 14;
3046
3075
  return this.checkOrderPaymentCompletion();
3047
3076
  case 14:
3048
- _context39.next = 19;
3077
+ _context40.next = 19;
3049
3078
  break;
3050
3079
  case 16:
3051
- _context39.prev = 16;
3052
- _context39.t0 = _context39["catch"](0);
3053
- console.error('[Checkout] 更新 stateAmount 为剩余金额失败:', _context39.t0);
3080
+ _context40.prev = 16;
3081
+ _context40.t0 = _context40["catch"](0);
3082
+ console.error('[Checkout] 更新 stateAmount 为剩余金额失败:', _context40.t0);
3054
3083
  case 19:
3055
3084
  case "end":
3056
- return _context39.stop();
3085
+ return _context40.stop();
3057
3086
  }
3058
- }, _callee39, this, [[0, 16]]);
3087
+ }, _callee40, this, [[0, 16]]);
3059
3088
  }));
3060
3089
  function updateStateAmountToRemaining() {
3061
3090
  return _updateStateAmountToRemaining.apply(this, arguments);
@@ -3071,22 +3100,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3071
3100
  }, {
3072
3101
  key: "checkOrderPaymentCompletion",
3073
3102
  value: (function () {
3074
- var _checkOrderPaymentCompletion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3075
- var remainingAmount, remainingValue, _this$store$currentOr15, _this$store$currentOr16, totalAmount, paidAmount, allPaymentsHaveVoucherId;
3076
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3077
- while (1) switch (_context40.prev = _context40.next) {
3103
+ var _checkOrderPaymentCompletion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3104
+ var remainingAmount, remainingValue, _this$store$currentOr16, _this$store$currentOr17, totalAmount, paidAmount, allPaymentsHaveVoucherId;
3105
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3106
+ while (1) switch (_context41.prev = _context41.next) {
3078
3107
  case 0:
3079
- _context40.prev = 0;
3108
+ _context41.prev = 0;
3080
3109
  if (this.store.currentOrder) {
3081
- _context40.next = 3;
3110
+ _context41.next = 3;
3082
3111
  break;
3083
3112
  }
3084
- return _context40.abrupt("return");
3113
+ return _context41.abrupt("return");
3085
3114
  case 3:
3086
3115
  remainingAmount = this.calculateRemainingAmount();
3087
3116
  remainingValue = parseFloat(remainingAmount); // 当剩余金额小于等于0时,认为订单已完成支付
3088
3117
  if (!(remainingValue <= 0)) {
3089
- _context40.next = 21;
3118
+ _context41.next = 21;
3090
3119
  break;
3091
3120
  }
3092
3121
  totalAmount = this.store.currentOrder.total_amount;
@@ -3105,9 +3134,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3105
3134
  return item.status !== 'voided' && item.voucher_id;
3106
3135
  });
3107
3136
  console.log('[Checkout] 支付项voucher_id检查:', {
3108
- paymentCount: ((_this$store$currentOr15 = this.store.currentOrder.payment) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.length) || 0,
3137
+ paymentCount: ((_this$store$currentOr16 = this.store.currentOrder.payment) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.length) || 0,
3109
3138
  allHaveVoucherId: allPaymentsHaveVoucherId,
3110
- paymentItems: (_this$store$currentOr16 = this.store.currentOrder.payment) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.map(function (p) {
3139
+ paymentItems: (_this$store$currentOr17 = this.store.currentOrder.payment) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.map(function (p) {
3111
3140
  return {
3112
3141
  uuid: p.uuid,
3113
3142
  code: p.code,
@@ -3120,22 +3149,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3120
3149
 
3121
3150
  // 如果支付完成但订单未同步,需要判断是否同步
3122
3151
  if (this.store.isOrderSynced) {
3123
- _context40.next = 19;
3152
+ _context41.next = 19;
3124
3153
  break;
3125
3154
  }
3126
3155
  if (!allPaymentsHaveVoucherId) {
3127
- _context40.next = 16;
3156
+ _context41.next = 16;
3128
3157
  break;
3129
3158
  }
3130
3159
  console.log('[Checkout] 所有支付项均为代金券类型,跳过订单同步');
3131
- _context40.next = 19;
3160
+ _context41.next = 19;
3132
3161
  break;
3133
3162
  case 16:
3134
3163
  console.log('[Checkout] 支付完成但订单未同步,开始同步订单到后端...');
3135
- _context40.next = 19;
3164
+ _context41.next = 19;
3136
3165
  return this.syncOrderToBackend();
3137
3166
  case 19:
3138
- _context40.next = 21;
3167
+ _context41.next = 21;
3139
3168
  return this.core.effects.emit(CheckoutHooks.OnOrderPaymentCompleted, {
3140
3169
  orderUuid: this.store.currentOrder.uuid,
3141
3170
  orderId: this.store.currentOrder.order_id,
@@ -3145,17 +3174,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3145
3174
  timestamp: Date.now()
3146
3175
  });
3147
3176
  case 21:
3148
- _context40.next = 26;
3177
+ _context41.next = 26;
3149
3178
  break;
3150
3179
  case 23:
3151
- _context40.prev = 23;
3152
- _context40.t0 = _context40["catch"](0);
3153
- console.error('[Checkout] 检查订单支付完成状态失败:', _context40.t0);
3180
+ _context41.prev = 23;
3181
+ _context41.t0 = _context41["catch"](0);
3182
+ console.error('[Checkout] 检查订单支付完成状态失败:', _context41.t0);
3154
3183
  case 26:
3155
3184
  case "end":
3156
- return _context40.stop();
3185
+ return _context41.stop();
3157
3186
  }
3158
- }, _callee40, this, [[0, 23]]);
3187
+ }, _callee41, this, [[0, 23]]);
3159
3188
  }));
3160
3189
  function checkOrderPaymentCompletion() {
3161
3190
  return _checkOrderPaymentCompletion.apply(this, arguments);
@@ -3227,8 +3256,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3227
3256
  }, {
3228
3257
  key: "syncOrderToBackendWithReturn",
3229
3258
  value: (function () {
3230
- var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3231
- var _this$store$currentCu2, _this$store$currentOr17, _this$store$currentOr18;
3259
+ var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3260
+ var _this$store$currentCu2, _this$store$currentOr18, _this$store$currentOr19;
3232
3261
  var isManual,
3233
3262
  customPaymentItems,
3234
3263
  syncType,
@@ -3247,14 +3276,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3247
3276
  beforeManualUpdate,
3248
3277
  finalOrderId,
3249
3278
  finalIsVirtual,
3250
- _args41 = arguments;
3251
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3252
- while (1) switch (_context41.prev = _context41.next) {
3279
+ _args42 = arguments;
3280
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3281
+ while (1) switch (_context42.prev = _context42.next) {
3253
3282
  case 0:
3254
- isManual = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : false;
3255
- customPaymentItems = _args41.length > 1 ? _args41[1] : undefined;
3283
+ isManual = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : false;
3284
+ customPaymentItems = _args42.length > 1 ? _args42[1] : undefined;
3256
3285
  if (!(!this.store.localOrderData || !this.store.currentOrder)) {
3257
- _context41.next = 4;
3286
+ _context42.next = 4;
3258
3287
  break;
3259
3288
  }
3260
3289
  throw new Error('缺少必要的订单数据,无法同步到后端');
@@ -3295,17 +3324,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3295
3324
  });
3296
3325
 
3297
3326
  // 获取当前订单的支付项
3298
- _context41.t0 = customPaymentItems;
3299
- if (_context41.t0) {
3300
- _context41.next = 18;
3327
+ _context42.t0 = customPaymentItems;
3328
+ if (_context42.t0) {
3329
+ _context42.next = 18;
3301
3330
  break;
3302
3331
  }
3303
- _context41.next = 17;
3332
+ _context42.next = 17;
3304
3333
  return this.payment.getPaymentItemsAsync(this.store.currentOrder.uuid);
3305
3334
  case 17:
3306
- _context41.t0 = _context41.sent;
3335
+ _context42.t0 = _context42.sent;
3307
3336
  case 18:
3308
- paymentItems = _context41.t0;
3337
+ paymentItems = _context42.t0;
3309
3338
  console.log('[Checkout] 获取到支付项:', {
3310
3339
  count: paymentItems.length,
3311
3340
  isCustomFiltered: !!customPaymentItems,
@@ -3346,8 +3375,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3346
3375
  currency_code: this.otherParams.currency_code,
3347
3376
  currency_symbol: this.otherParams.currency_symbol,
3348
3377
  currency_format: this.otherParams.currency_format,
3349
- is_deposit: ((_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.is_deposit) || 0,
3350
- deposit_amount: ((_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.deposit_amount) || '0.00',
3378
+ is_deposit: ((_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.is_deposit) || 0,
3379
+ deposit_amount: ((_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.deposit_amount) || '0.00',
3351
3380
  // surcharge_fee: this.otherParams.surcharge_fee,
3352
3381
  // surcharges: ,
3353
3382
  note: this.store.localOrderData.shop_note
@@ -3377,10 +3406,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3377
3406
  }
3378
3407
 
3379
3408
  // 调用 Order 模块的专用 createOrderByCheckout 方法
3380
- _context41.next = 24;
3409
+ _context42.next = 24;
3381
3410
  return this.order.createOrderByCheckout(orderParams);
3382
3411
  case 24:
3383
- checkoutResponse = _context41.sent;
3412
+ checkoutResponse = _context42.sent;
3384
3413
  console.log('[Checkout] 后端返回的响应数据:', {
3385
3414
  status: checkoutResponse === null || checkoutResponse === void 0 ? void 0 : checkoutResponse.status,
3386
3415
  code: checkoutResponse === null || checkoutResponse === void 0 ? void 0 : checkoutResponse.code,
@@ -3388,13 +3417,13 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3388
3417
  data: checkoutResponse === null || checkoutResponse === void 0 ? void 0 : checkoutResponse.data
3389
3418
  });
3390
3419
  if (!isUpdateOperation) {
3391
- _context41.next = 31;
3420
+ _context42.next = 31;
3392
3421
  break;
3393
3422
  }
3394
3423
  // 更新操作:使用现有的订单ID
3395
3424
  realOrderId = currentOrderId;
3396
3425
  console.log("[Checkout] \u8BA2\u5355\u66F4\u65B0\u6210\u529F\uFF0C\u8BA2\u5355ID: ".concat(realOrderId));
3397
- _context41.next = 52;
3426
+ _context42.next = 52;
3398
3427
  break;
3399
3428
  case 31:
3400
3429
  // 创建操作:从响应中提取新的订单ID
@@ -3408,7 +3437,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3408
3437
  extractedOrderId = String(extractedOrderId);
3409
3438
  }
3410
3439
  if (extractedOrderId) {
3411
- _context41.next = 36;
3440
+ _context42.next = 36;
3412
3441
  break;
3413
3442
  }
3414
3443
  throw new Error('后端返回的订单信息中未包含订单ID');
@@ -3422,11 +3451,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3422
3451
  oldOrderId: this.store.currentOrder.order_id,
3423
3452
  newOrderId: realOrderId
3424
3453
  });
3425
- _context41.prev = 39;
3426
- _context41.next = 42;
3454
+ _context42.prev = 39;
3455
+ _context42.next = 42;
3427
3456
  return this.payment.replaceOrderIdByUuidAsync(this.store.currentOrder.uuid, realOrderId);
3428
3457
  case 42:
3429
- updatedOrder = _context41.sent;
3458
+ updatedOrder = _context42.sent;
3430
3459
  console.log('[Checkout] Payment模块替换订单ID结果:', {
3431
3460
  wasSuccessful: !!updatedOrder,
3432
3461
  returnedOrderId: updatedOrder === null || updatedOrder === void 0 ? void 0 : updatedOrder.order_id,
@@ -3452,12 +3481,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3452
3481
  目标ID: realOrderId
3453
3482
  });
3454
3483
  }
3455
- _context41.next = 52;
3484
+ _context42.next = 52;
3456
3485
  break;
3457
3486
  case 47:
3458
- _context41.prev = 47;
3459
- _context41.t1 = _context41["catch"](39);
3460
- console.error('[Checkout] 调用Payment模块替换订单ID时发生错误:', _context41.t1);
3487
+ _context42.prev = 47;
3488
+ _context42.t1 = _context42["catch"](39);
3489
+ console.error('[Checkout] 调用Payment模块替换订单ID时发生错误:', _context42.t1);
3461
3490
 
3462
3491
  // 发生错误时也进行手动替换
3463
3492
  this.store.currentOrder.order_id = realOrderId;
@@ -3467,7 +3496,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3467
3496
  this.store.isOrderSynced = true;
3468
3497
 
3469
3498
  // 触发订单同步完成事件
3470
- _context41.next = 55;
3499
+ _context42.next = 55;
3471
3500
  return this.core.effects.emit(CheckoutHooks.OnOrderSynced, {
3472
3501
  orderUuid: this.store.currentOrder.uuid,
3473
3502
  realOrderId: realOrderId,
@@ -3493,12 +3522,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3493
3522
  }
3494
3523
 
3495
3524
  // 返回真实订单ID
3496
- return _context41.abrupt("return", realOrderId);
3525
+ return _context42.abrupt("return", realOrderId);
3497
3526
  case 60:
3498
3527
  case "end":
3499
- return _context41.stop();
3528
+ return _context42.stop();
3500
3529
  }
3501
- }, _callee41, this, [[39, 47]]);
3530
+ }, _callee42, this, [[39, 47]]);
3502
3531
  }));
3503
3532
  function syncOrderToBackendWithReturn() {
3504
3533
  return _syncOrderToBackendWithReturn.apply(this, arguments);
@@ -3508,27 +3537,27 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3508
3537
  }, {
3509
3538
  key: "syncOrderToBackend",
3510
3539
  value: function () {
3511
- var _syncOrderToBackend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3512
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3513
- while (1) switch (_context42.prev = _context42.next) {
3540
+ var _syncOrderToBackend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
3541
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3542
+ while (1) switch (_context43.prev = _context43.next) {
3514
3543
  case 0:
3515
- _context42.prev = 0;
3516
- _context42.next = 3;
3544
+ _context43.prev = 0;
3545
+ _context43.next = 3;
3517
3546
  return this.syncOrderToBackendWithReturn(false);
3518
3547
  case 3:
3519
- _context42.next = 10;
3548
+ _context43.next = 10;
3520
3549
  break;
3521
3550
  case 5:
3522
- _context42.prev = 5;
3523
- _context42.t0 = _context42["catch"](0);
3524
- console.error('[Checkout] 同步订单到后端失败:', _context42.t0);
3525
- _context42.next = 10;
3526
- return this.handleError(new Error("\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0))), CheckoutErrorType.OrderCreationFailed);
3551
+ _context43.prev = 5;
3552
+ _context43.t0 = _context43["catch"](0);
3553
+ console.error('[Checkout] 同步订单到后端失败:', _context43.t0);
3554
+ _context43.next = 10;
3555
+ return this.handleError(new Error("\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context43.t0 instanceof Error ? _context43.t0.message : String(_context43.t0))), CheckoutErrorType.OrderCreationFailed);
3527
3556
  case 10:
3528
3557
  case "end":
3529
- return _context42.stop();
3558
+ return _context43.stop();
3530
3559
  }
3531
- }, _callee42, this, [[0, 5]]);
3560
+ }, _callee43, this, [[0, 5]]);
3532
3561
  }));
3533
3562
  function syncOrderToBackend() {
3534
3563
  return _syncOrderToBackend.apply(this, arguments);
@@ -3568,15 +3597,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3568
3597
  }, {
3569
3598
  key: "setOtherParams",
3570
3599
  value: function () {
3571
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3600
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3572
3601
  var _ref3,
3573
3602
  _ref3$cover,
3574
3603
  cover,
3575
- _args43 = arguments;
3576
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3577
- while (1) switch (_context43.prev = _context43.next) {
3604
+ _args44 = arguments;
3605
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3606
+ while (1) switch (_context44.prev = _context44.next) {
3578
3607
  case 0:
3579
- _ref3 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref3$cover = _ref3.cover, cover = _ref3$cover === void 0 ? false : _ref3$cover;
3608
+ _ref3 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref3$cover = _ref3.cover, cover = _ref3$cover === void 0 ? false : _ref3$cover;
3580
3609
  if (cover) {
3581
3610
  this.otherParams = params;
3582
3611
  } else {
@@ -3584,11 +3613,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3584
3613
  }
3585
3614
  case 2:
3586
3615
  case "end":
3587
- return _context43.stop();
3616
+ return _context44.stop();
3588
3617
  }
3589
- }, _callee43, this);
3618
+ }, _callee44, this);
3590
3619
  }));
3591
- function setOtherParams(_x28) {
3620
+ function setOtherParams(_x29) {
3592
3621
  return _setOtherParams.apply(this, arguments);
3593
3622
  }
3594
3623
  return setOtherParams;
@@ -3605,12 +3634,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3605
3634
  }, {
3606
3635
  key: "editOrderNoteByOrderIdAsync",
3607
3636
  value: (function () {
3608
- var _editOrderNoteByOrderIdAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(orderId, note) {
3637
+ var _editOrderNoteByOrderIdAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(orderId, note) {
3609
3638
  var response, previousNote, errorMessage, _errorMessage;
3610
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3611
- while (1) switch (_context44.prev = _context44.next) {
3639
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3640
+ while (1) switch (_context45.prev = _context45.next) {
3612
3641
  case 0:
3613
- _context44.prev = 0;
3642
+ _context45.prev = 0;
3614
3643
  console.log('[Checkout] 开始编辑订单备注:', {
3615
3644
  orderId: orderId,
3616
3645
  note: note,
@@ -3619,21 +3648,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3619
3648
 
3620
3649
  // 参数验证
3621
3650
  if (orderId) {
3622
- _context44.next = 4;
3651
+ _context45.next = 4;
3623
3652
  break;
3624
3653
  }
3625
- return _context44.abrupt("return", {
3654
+ return _context45.abrupt("return", {
3626
3655
  success: false,
3627
3656
  message: '订单ID不能为空',
3628
3657
  orderId: orderId
3629
3658
  });
3630
3659
  case 4:
3631
- _context44.next = 6;
3660
+ _context45.next = 6;
3632
3661
  return this.request.put("/shop/order/order/".concat(orderId, "/note"), {
3633
3662
  note: note
3634
3663
  });
3635
3664
  case 6:
3636
- response = _context44.sent;
3665
+ response = _context45.sent;
3637
3666
  console.log('[Checkout] 订单备注编辑响应:', {
3638
3667
  orderId: orderId,
3639
3668
  status: response.status,
@@ -3643,14 +3672,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3643
3672
 
3644
3673
  // 检查响应状态
3645
3674
  if (!(response.status === true || response.status === 200)) {
3646
- _context44.next = 19;
3675
+ _context45.next = 19;
3647
3676
  break;
3648
3677
  }
3649
3678
  console.log("[Checkout] \u8BA2\u5355 ".concat(orderId, " \u5907\u6CE8\u4FEE\u6539\u6210\u529F"));
3650
3679
 
3651
3680
  // 如果当前订单就是被修改的订单,同时更新本地状态
3652
3681
  if (!(this.store.currentOrder && (String(this.store.currentOrder.order_id) === String(orderId) || String(this.store.currentOrder.id) === String(orderId)))) {
3653
- _context44.next = 16;
3682
+ _context45.next = 16;
3654
3683
  break;
3655
3684
  }
3656
3685
  console.log('[Checkout] 更新本地订单备注状态');
@@ -3662,7 +3691,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3662
3691
  }
3663
3692
 
3664
3693
  // 触发订单备注变更事件
3665
- _context44.next = 16;
3694
+ _context45.next = 16;
3666
3695
  return this.core.effects.emit(CheckoutHooks.OnOrderNoteChanged, {
3667
3696
  orderUuid: this.store.currentOrder.uuid,
3668
3697
  oldNote: previousNote,
@@ -3670,7 +3699,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3670
3699
  timestamp: Date.now()
3671
3700
  });
3672
3701
  case 16:
3673
- return _context44.abrupt("return", {
3702
+ return _context45.abrupt("return", {
3674
3703
  success: true,
3675
3704
  message: response.message || '订单备注修改成功',
3676
3705
  orderId: orderId
@@ -3679,31 +3708,31 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3679
3708
  // API返回失败状态
3680
3709
  errorMessage = response.message || '订单备注修改失败';
3681
3710
  console.error("[Checkout] \u8BA2\u5355 ".concat(orderId, " \u5907\u6CE8\u4FEE\u6539\u5931\u8D25:"), errorMessage);
3682
- return _context44.abrupt("return", {
3711
+ return _context45.abrupt("return", {
3683
3712
  success: false,
3684
3713
  message: errorMessage,
3685
3714
  orderId: orderId
3686
3715
  });
3687
3716
  case 22:
3688
- _context44.next = 29;
3717
+ _context45.next = 29;
3689
3718
  break;
3690
3719
  case 24:
3691
- _context44.prev = 24;
3692
- _context44.t0 = _context44["catch"](0);
3693
- console.error('[Checkout] 编辑订单备注失败:', _context44.t0);
3694
- _errorMessage = _context44.t0 instanceof Error ? _context44.t0.message : '网络错误或服务器异常';
3695
- return _context44.abrupt("return", {
3720
+ _context45.prev = 24;
3721
+ _context45.t0 = _context45["catch"](0);
3722
+ console.error('[Checkout] 编辑订单备注失败:', _context45.t0);
3723
+ _errorMessage = _context45.t0 instanceof Error ? _context45.t0.message : '网络错误或服务器异常';
3724
+ return _context45.abrupt("return", {
3696
3725
  success: false,
3697
3726
  message: "\u7F16\u8F91\u8BA2\u5355\u5907\u6CE8\u5931\u8D25: ".concat(_errorMessage),
3698
3727
  orderId: orderId
3699
3728
  });
3700
3729
  case 29:
3701
3730
  case "end":
3702
- return _context44.stop();
3731
+ return _context45.stop();
3703
3732
  }
3704
- }, _callee44, this, [[0, 24]]);
3733
+ }, _callee45, this, [[0, 24]]);
3705
3734
  }));
3706
- function editOrderNoteByOrderIdAsync(_x29, _x30) {
3735
+ function editOrderNoteByOrderIdAsync(_x30, _x31) {
3707
3736
  return _editOrderNoteByOrderIdAsync.apply(this, arguments);
3708
3737
  }
3709
3738
  return editOrderNoteByOrderIdAsync;
@@ -3711,10 +3740,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3711
3740
  }, {
3712
3741
  key: "destroy",
3713
3742
  value: function () {
3714
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
3743
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
3715
3744
  var _this$order, _this$order$destroy, _this$payment, _this$payment$destroy;
3716
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3717
- while (1) switch (_context45.prev = _context45.next) {
3745
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3746
+ while (1) switch (_context46.prev = _context46.next) {
3718
3747
  case 0:
3719
3748
  // 清理钱包模块的所有缓存数据
3720
3749
  this.payment.wallet.clearAllCache();
@@ -3723,10 +3752,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3723
3752
  this.core.effects.offByModuleDestroy(this.name);
3724
3753
 
3725
3754
  // 销毁子模块
3726
- _context45.next = 4;
3755
+ _context46.next = 4;
3727
3756
  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);
3728
3757
  case 4:
3729
- _context45.next = 6;
3758
+ _context46.next = 6;
3730
3759
  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);
3731
3760
  case 6:
3732
3761
  // 取消注册模块
@@ -3734,9 +3763,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3734
3763
  console.log('[Checkout] 已销毁');
3735
3764
  case 8:
3736
3765
  case "end":
3737
- return _context45.stop();
3766
+ return _context46.stop();
3738
3767
  }
3739
- }, _callee45, this);
3768
+ }, _callee46, this);
3740
3769
  }));
3741
3770
  function destroy() {
3742
3771
  return _destroy.apply(this, arguments);