@pisell/private-materials 6.4.5 → 6.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +4 -4
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +4 -4
  9. package/es/components/booking/components/footer/amount.d.ts +6 -2
  10. package/es/components/booking/components/footer/amount.js +77 -55
  11. package/es/components/booking/components/footer/index.js +11 -11
  12. package/es/components/checkout/PaymentModal.d.ts +1 -0
  13. package/es/components/checkout/PaymentModal.js +22 -19
  14. package/es/components/checkout/components/WalletPassModule/components/DiscountWallet/DiscountTextMode.js +6 -1
  15. package/es/components/checkout/components/WalletPassModule/components/WalletPassTextMode/index.js +6 -1
  16. package/es/components/ticketBooking/components/ticketBooking/index.js +46 -4
  17. package/es/components/ticketBooking/locales.d.ts +12 -0
  18. package/es/components/ticketBooking/locales.js +15 -3
  19. package/lib/components/booking/components/footer/amount.d.ts +6 -2
  20. package/lib/components/booking/components/footer/amount.js +63 -38
  21. package/lib/components/booking/components/footer/index.js +2 -2
  22. package/lib/components/checkout/PaymentModal.d.ts +1 -0
  23. package/lib/components/checkout/PaymentModal.js +14 -16
  24. package/lib/components/checkout/components/WalletPassModule/components/DiscountWallet/DiscountTextMode.js +3 -1
  25. package/lib/components/checkout/components/WalletPassModule/components/WalletPassTextMode/index.js +3 -1
  26. package/lib/components/ticketBooking/components/ticketBooking/index.js +31 -2
  27. package/lib/components/ticketBooking/locales.d.ts +12 -0
  28. package/lib/components/ticketBooking/locales.js +15 -3
  29. package/package.json +1 -1
@@ -3,10 +3,14 @@ export declare const getIsPriceIncludeTax: (state: any) => any;
3
3
  /**
4
4
  * 总金额
5
5
  * @param state
6
- * @param options
6
+ * @param options isEdit: 预约信息是否发生变动
7
7
  * @returns
8
8
  */
9
- export declare const getSumTotal: (state: any, { isEdit, ScheduleModule, ...rest }: any) => {
9
+ export declare const getSumTotal: (state: any, options: {
10
+ [key: string]: any;
11
+ isEdit: boolean;
12
+ ScheduleModule: any;
13
+ }) => {
10
14
  productAmount: number;
11
15
  duration: string;
12
16
  tax: number;
@@ -1,7 +1,4 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["isEdit", "ScheduleModule"];
3
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -192,7 +189,6 @@ var processItemsTax = function processItemsTax(items, state, options) {
192
189
  // 计算原始税费(折扣前)- 单个商品
193
190
  var originalTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
194
191
  total: unitPrice.toNumber(),
195
- price: item._extend.total,
196
192
  quantity: 1
197
193
  }), state, {
198
194
  tax_rate: tax_rate,
@@ -222,9 +218,40 @@ var processItemsTax = function processItemsTax(items, state, options) {
222
218
  item._extend.original_tax_fee = originalTaxPerItem.toNumber();
223
219
  item._extend.tax_fee = discountedTaxPerItem.toNumber();
224
220
 
221
+ // 注意:加时商品独立计算,不考虑主商品数量
222
+ var addTimeTotalTax = new Decimal(0);
223
+ if (Array.isArray(item._extend.relation_details)) {
224
+ var _iterator5 = _createForOfIteratorHelper(item._extend.relation_details),
225
+ _step5;
226
+ try {
227
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
228
+ var atItem = _step5.value;
229
+ // 计算单件加时商品折扣后价格
230
+ var _originTotal = new Decimal(atItem.selling_price || atItem.price || 0);
231
+ var _discountedTotal = _originTotal;
232
+ if (productExpectAmount > 0) {
233
+ _discountedTotal = _originTotal.minus(_originTotal.dividedBy(productExpectAmount).times(shopDiscount));
234
+ }
235
+ var addTimeTaxPerItem = getProductItemTax(_objectSpread(_objectSpread({}, atItem), {}, {
236
+ total: _discountedTotal,
237
+ // 可能包含原有数据,或前端临时数据
238
+ quantity: atItem.product_quantity || atItem.num || 1
239
+ }), state, {
240
+ tax_rate: tax_rate,
241
+ is_price_include_tax: is_price_include_tax
242
+ });
243
+ addTimeTotalTax = addTimeTotalTax.plus(addTimeTaxPerItem);
244
+ }
245
+ } catch (err) {
246
+ _iterator5.e(err);
247
+ } finally {
248
+ _iterator5.f();
249
+ }
250
+ }
251
+
225
252
  // 累加到总税费(乘以数量)
226
- originTax = originTax.plus(originalTaxPerItem.times(quantity));
227
- tax = tax.plus(discountedTaxPerItem.times(quantity));
253
+ originTax = originTax.plus(originalTaxPerItem.times(quantity)).plus(addTimeTotalTax);
254
+ tax = tax.plus(discountedTaxPerItem.times(quantity)).plus(addTimeTotalTax);
228
255
  }
229
256
  } catch (err) {
230
257
  _iterator4.e(err);
@@ -406,13 +433,14 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
406
433
  * @param options 包含 ScheduleModule 和其他附加费计算所需参数
407
434
  */
408
435
  var getSurcharge = function getSurcharge(state, options) {
409
- var ScheduleModule = options.ScheduleModule,
436
+ var isEdit = options.isEdit,
437
+ ScheduleModule = options.ScheduleModule,
410
438
  surcharge_list = options.surcharge_list,
411
439
  scheduleById = options.scheduleById;
412
440
  var bookingDetail = state.bookingDetail,
413
441
  bookingId = state.bookingId;
414
- // 编辑状态直接从详情取出
415
- if (bookingId) {
442
+ // 编辑状态, 且未修改商品时直接从详情取出
443
+ if (!isEdit && bookingId) {
416
444
  if (Array.isArray(bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.surcharge)) {
417
445
  var _state$bookingDetail3;
418
446
  return (((_state$bookingDetail3 = state.bookingDetail) === null || _state$bookingDetail3 === void 0 ? void 0 : _state$bookingDetail3.surcharge) || []).map(function (d, index) {
@@ -459,52 +487,52 @@ var getSurcharge = function getSurcharge(state, options) {
459
487
 
460
488
  // 检查service中符合条件的商品
461
489
  if (Array.isArray(service === null || service === void 0 ? void 0 : service.value)) {
462
- var _iterator5 = _createForOfIteratorHelper(service.value),
463
- _step5;
490
+ var _iterator6 = _createForOfIteratorHelper(service.value),
491
+ _step6;
464
492
  try {
465
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
466
- var item = _step5.value;
493
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
494
+ var item = _step6.value;
467
495
  if (isProductMatchSurchargeCondition(item, {
468
496
  surchargeConfig: surchargeConfig,
469
497
  scheduleById: scheduleById || {},
470
498
  ScheduleModule: ScheduleModule
471
499
  })) {
472
500
  matchedItems.push({
473
- total: Number(item._extend.price),
474
- // 附加费不参与折扣,需要使用商品原价计算
501
+ total: Number(item._extend.total),
502
+ addTimeTotal: getRelationDetailsTotal(item._extend.relation_details || []),
475
503
  quantity: item._extend.quantity || 1
476
504
  });
477
505
  }
478
506
  }
479
507
  } catch (err) {
480
- _iterator5.e(err);
508
+ _iterator6.e(err);
481
509
  } finally {
482
- _iterator5.f();
510
+ _iterator6.f();
483
511
  }
484
512
  }
485
513
 
486
514
  // 检查addons中符合条件的商品
487
515
  if (Array.isArray(addons === null || addons === void 0 ? void 0 : addons.value)) {
488
- var _iterator6 = _createForOfIteratorHelper(addons.value),
489
- _step6;
516
+ var _iterator7 = _createForOfIteratorHelper(addons.value),
517
+ _step7;
490
518
  try {
491
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
492
- var _item2 = _step6.value;
519
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
520
+ var _item2 = _step7.value;
493
521
  if (isProductMatchSurchargeCondition(_item2, {
494
522
  surchargeConfig: surchargeConfig,
495
523
  scheduleById: scheduleById || {},
496
524
  ScheduleModule: ScheduleModule
497
525
  })) {
498
526
  matchedItems.push({
499
- total: Number(_item2._extend.price),
527
+ total: Number(_item2._extend.total),
500
528
  quantity: _item2._extend.quantity || 1
501
529
  });
502
530
  }
503
531
  }
504
532
  } catch (err) {
505
- _iterator6.e(err);
533
+ _iterator7.e(err);
506
534
  } finally {
507
- _iterator6.f();
535
+ _iterator7.f();
508
536
  }
509
537
  }
510
538
  var finalAmount = 0;
@@ -515,21 +543,22 @@ var getSurcharge = function getSurcharge(state, options) {
515
543
  // 计算百分比附加费 - 对每个商品单独计算
516
544
  if (percentage && new Decimal(percentage).gt(0)) {
517
545
  var percentageRate = new Decimal(percentage);
518
- var _iterator7 = _createForOfIteratorHelper(matchedItems),
519
- _step7;
546
+ var _iterator8 = _createForOfIteratorHelper(matchedItems),
547
+ _step8;
520
548
  try {
521
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
522
- var _item3 = _step7.value;
549
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
550
+ var _item3 = _step8.value;
523
551
  // 对每个商品:max(0, 价格) * 数量 * 费率
524
552
  var itemPrice = new Decimal(Math.max(0, _item3.total || 0));
525
553
  var itemQuantity = new Decimal(_item3.quantity || 1);
526
- var itemSurcharge = itemPrice.times(itemQuantity).times(percentageRate);
554
+ var addTimeTotal = new Decimal(_item3.addTimeTotal || 0);
555
+ var itemSurcharge = itemPrice.times(itemQuantity).plus(addTimeTotal).times(percentageRate);
527
556
  configTotal = configTotal.plus(itemSurcharge);
528
557
  }
529
558
  } catch (err) {
530
- _iterator7.e(err);
559
+ _iterator8.e(err);
531
560
  } finally {
532
- _iterator7.f();
561
+ _iterator8.f();
533
562
  }
534
563
  }
535
564
 
@@ -564,12 +593,16 @@ var getSurcharge = function getSurcharge(state, options) {
564
593
  * @param state
565
594
  * @returns
566
595
  */
567
- var getSurchargeAmount = function getSurchargeAmount(state, surcharge) {
596
+ var getSurchargeAmount = function getSurchargeAmount(state, surcharge, options) {
568
597
  var bookingDetail = state.bookingDetail,
569
598
  bookingId = state.bookingId;
570
- // 编辑状态直接使用后端的数据
571
- if (bookingDetail && bookingId) {
572
- return Number(bookingDetail.surcharge_fee);
599
+ var isEdit = options.isEdit;
600
+ // 订单未变更过
601
+ if (!isEdit) {
602
+ // 有后端数据则直接使用后端的数据
603
+ if (bookingDetail && bookingId) {
604
+ return Number(bookingDetail.surcharge_fee);
605
+ }
573
606
  }
574
607
  if (!Array.isArray(surcharge)) return 0;
575
608
  // 新增状态使用 getSurcharge 的返回值进行求和
@@ -617,7 +650,6 @@ var getExpectAmount = function getExpectAmount(_ref2) {
617
650
  state = _ref2.state,
618
651
  options = _ref2.options;
619
652
  var _tax = tax;
620
-
621
653
  // 如果价格含税, 则将税费改为0
622
654
  if (getIsPriceIncludeTax(state) || options !== null && options !== void 0 && options.is_price_include_tax) {
623
655
  _tax = 0;
@@ -647,15 +679,12 @@ var getSumTotalAmount = function getSumTotalAmount(_ref3) {
647
679
  /**
648
680
  * 总金额
649
681
  * @param state
650
- * @param options
682
+ * @param options isEdit: 预约信息是否发生变动
651
683
  * @returns
652
684
  */
653
- export var getSumTotal = function getSumTotal(state, _ref4) {
654
- var isEdit = _ref4.isEdit,
655
- ScheduleModule = _ref4.ScheduleModule,
656
- rest = _objectWithoutProperties(_ref4, _excluded);
685
+ export var getSumTotal = function getSumTotal(state, options) {
657
686
  // 商品总金额, 包含 商品折扣 报价单 子商品
658
- var _getProductExpectAmou = getProductExpectAmount(state, isEdit),
687
+ var _getProductExpectAmou = getProductExpectAmount(state, options.isEdit),
659
688
  productExpectAmount = _getProductExpectAmou.productExpectAmount,
660
689
  duration = _getProductExpectAmou.duration;
661
690
 
@@ -669,11 +698,9 @@ export var getSumTotal = function getSumTotal(state, _ref4) {
669
698
  var paySurchargeFee = getPaySurchargeFee(state);
670
699
 
671
700
  // 订单附加费列表
672
- var surcharge = getSurcharge(state, _objectSpread({
673
- ScheduleModule: ScheduleModule
674
- }, rest));
701
+ var surcharge = getSurcharge(state, options);
675
702
  // 订单附加费金额
676
- var surchargeAmount = getSurchargeAmount(state, surcharge);
703
+ var surchargeAmount = getSurchargeAmount(state, surcharge, options);
677
704
 
678
705
  // 算出整单折扣的百分比 shopDiscount / productExpectAmount
679
706
  var computed = {
@@ -682,12 +709,11 @@ export var getSumTotal = function getSumTotal(state, _ref4) {
682
709
  };
683
710
  // 税费
684
711
  var _getTax = getTax(state, _objectSpread({
685
- isEdit: isEdit,
686
712
  computed: computed
687
- }, rest)),
713
+ }, options)),
688
714
  tax = _getTax.tax,
689
715
  originTax = _getTax.originTax;
690
- var taxInfo = getTaxInfo(state, rest);
716
+ var taxInfo = getTaxInfo(state, options);
691
717
 
692
718
  // 已付金额 (包含手续费)
693
719
  var paidAmount = getPaidAmount(state);
@@ -705,9 +731,7 @@ export var getSumTotal = function getSumTotal(state, _ref4) {
705
731
  surchargeAmount: surchargeAmount,
706
732
  shopDiscount: shopDiscount,
707
733
  state: state,
708
- options: _objectSpread({
709
- isEdit: isEdit
710
- }, rest)
734
+ options: options
711
735
  });
712
736
 
713
737
  // 订单原价(不包含整单折扣的价格)
@@ -717,9 +741,7 @@ export var getSumTotal = function getSumTotal(state, _ref4) {
717
741
  surchargeAmount: surchargeAmount,
718
742
  shopDiscount: 0,
719
743
  state: state,
720
- options: _objectSpread({
721
- isEdit: isEdit
722
- }, rest)
744
+ options: options
723
745
  });
724
746
 
725
747
  // 总支付金额 总计
@@ -606,7 +606,7 @@ var Footer = function Footer(props) {
606
606
  case 0:
607
607
  isNewOrder = !state.bookingId; // 如果有编辑内容, 则先保存
608
608
  if (!isEdit) {
609
- _context4.next = 26;
609
+ _context4.next = 25;
610
610
  break;
611
611
  }
612
612
  if (!isDayBooking(state)) {
@@ -621,7 +621,7 @@ var Footer = function Footer(props) {
621
621
  return _context4.abrupt("return");
622
622
  case 6:
623
623
  if (!state.isBookingTicket2) {
624
- _context4.next = 20;
624
+ _context4.next = 19;
625
625
  break;
626
626
  }
627
627
  _context4.next = 9;
@@ -648,7 +648,6 @@ var Footer = function Footer(props) {
648
648
  showDetail: showDetail
649
649
  }
650
650
  };
651
- console.log('💳 Footer: Setting payment modal data:', modalData);
652
651
  setPaymentModalData(modalData);
653
652
  setIsPaymentModalOpen(true); // 打开 modal
654
653
  setCheckoutLoading(false);
@@ -682,24 +681,24 @@ var Footer = function Footer(props) {
682
681
  }
683
682
  };
684
683
  });
685
- _context4.next = 25;
684
+ _context4.next = 24;
686
685
  break;
687
- case 20:
688
- _context4.next = 22;
686
+ case 19:
687
+ _context4.next = 21;
689
688
  return handleSave({
690
689
  type: 'checkout',
691
690
  messageShow: !(isTerminal !== null && isTerminal !== void 0 && isTerminal())
692
691
  });
693
- case 22:
692
+ case 21:
694
693
  _res = _context4.sent;
695
694
  // goCheckout2(res);
696
695
  console.log(_res);
697
696
  goCheckout((_res === null || _res === void 0 ? void 0 : _res.order_id) || state.bookingId, isNewOrder);
698
- case 25:
697
+ case 24:
699
698
  return _context4.abrupt("return");
700
- case 26:
699
+ case 25:
701
700
  return _context4.abrupt("return", goCheckout(state.bookingId, isNewOrder));
702
- case 27:
701
+ case 26:
703
702
  case "end":
704
703
  return _context4.stop();
705
704
  }
@@ -1792,7 +1791,8 @@ var Footer = function Footer(props) {
1792
1791
  onConfirm: handleNoteConfirm,
1793
1792
  onDelete: handleNoteDelete,
1794
1793
  onCancel: handleNoteCancel
1795
- }), isPaymentModalOpen && /*#__PURE__*/React.createElement(PaymentModal, {
1794
+ }), /*#__PURE__*/React.createElement(PaymentModal, {
1795
+ open: isPaymentModalOpen,
1796
1796
  data: paymentModalData,
1797
1797
  callback: paymentCallback || undefined,
1798
1798
  state: state,
@@ -11,6 +11,7 @@ interface PaymentModalData {
11
11
  total: any;
12
12
  }
13
13
  interface PaymentModalProps {
14
+ open?: boolean;
14
15
  data?: PaymentModalData;
15
16
  callback?: (result: any) => void;
16
17
  onClose?: (reset?: boolean) => void;
@@ -33,7 +33,7 @@ import PaymentOptionsModule from "./components/PaymentOptionsModule";
33
33
  import CashPaymentModule from "./components/CashPaymentModule";
34
34
  import AdditionalModule from "./components/AdditionalModule";
35
35
  import { getSumTotal } from "../booking/components/footer/amount";
36
- import { usePaymentResultToast, PaymentResultToastProvider, closePaymentResultToast } from "./components/PaymentResultToast";
36
+ import { PaymentResultToastProvider, closePaymentResultToast } from "./components/PaymentResultToast";
37
37
  import { formatCurrency, calculateStatusClassName, calculateAutoCloseConfig, displayPaymentResultToast, createShowSuccessToast } from "./utils/PaymentResultToastUtils";
38
38
  import { Printer, FileCheck02, RefreshCw05, CreditCard02, MessageTextSquare02, ArrowLeft, DotsVertical } from '@pisell/icon';
39
39
  import { checkoutStyles } from "./styles";
@@ -66,6 +66,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
66
66
  var _parentModuleConfig$s, _state$client2, _state$client3;
67
67
  var cartData = _ref.cartData,
68
68
  orderInfo = _ref.orderInfo,
69
+ isModalOpen = _ref.isModalOpen,
69
70
  onPaymentComplete = _ref.onPaymentComplete,
70
71
  onPaymentCancel = _ref.onPaymentCancel,
71
72
  onStatusChange = _ref.onStatusChange,
@@ -92,7 +93,8 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
92
93
  pisellosAllModule = utils.pisellosAllModule,
93
94
  interaction = utils.interaction;
94
95
  var Toast = useToast();
95
- var paymentResultToast = usePaymentResultToast();
96
+ // const paymentResultToast = usePaymentResultToast();
97
+
96
98
  var checkoutRef = useRef(null);
97
99
  var savePayLaterHandlerRef = useRef(null);
98
100
  // 剩余待付金额-可自定义修改,也可认作支付方式付出去需要付多少钱
@@ -352,8 +354,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
352
354
 
353
355
  // 初始化自定义金额
354
356
  useEffect(function () {
355
- console.time('initCustomAmount');
356
- if (checkoutModule && orderInfo) {
357
+ if (checkoutModule && orderInfo && isModalOpen) {
357
358
  try {
358
359
  var currentAmount = checkoutModule.getStateAmount();
359
360
  if (currentAmount) {
@@ -375,8 +376,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
375
376
  // 没有os 数据的时候先用外面传入的购物车数据展示
376
377
  // setCustomAmount(cartData?.total?.expectAmount || 0);
377
378
  }
378
- console.timeEnd('initCustomAmount');
379
- if (checkoutModule) {
379
+ if (checkoutModule && isModalOpen) {
380
380
  checkoutModule.getPaymentMethodsAsync().then(function (paymentMethods) {
381
381
  setPaymentMethods(paymentMethods);
382
382
  // TODO: 现金枚举类型需要从os导入
@@ -394,7 +394,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
394
394
 
395
395
  // 初始化推荐金额
396
396
  useEffect(function () {
397
- if (customAmount && checkoutModule && currency && orderInfo) {
397
+ if (customAmount && checkoutModule && currency && orderInfo && isModalOpen) {
398
398
  try {
399
399
  setRecommendAmounts(checkoutModule.payment.cash.getRecommendedAmount(customAmount, currency));
400
400
  } catch (error) {
@@ -405,7 +405,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
405
405
 
406
406
  // 监听金额变化事件
407
407
  useEffect(function () {
408
- if (checkoutModule && checkoutModule.core) {
408
+ if (checkoutModule && checkoutModule.core && isModalOpen) {
409
409
  try {
410
410
  var core = checkoutModule.core;
411
411
  if (core.effects && typeof core.effects.on === 'function') {
@@ -1136,7 +1136,8 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1136
1136
 
1137
1137
  var PaymentModal = function PaymentModal(_ref16) {
1138
1138
  var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper;
1139
- var data = _ref16.data,
1139
+ var open = _ref16.open,
1140
+ data = _ref16.data,
1140
1141
  callback = _ref16.callback,
1141
1142
  onClose = _ref16.onClose,
1142
1143
  dispatch = _ref16.dispatch,
@@ -1444,7 +1445,7 @@ var PaymentModal = function PaymentModal(_ref16) {
1444
1445
  status: 'cancelled'
1445
1446
  });
1446
1447
  var checkout = pisellos.getModule('checkout');
1447
- checkout.cancelCheckoutAsync();
1448
+ checkout.cancelCurrentOrderAsync();
1448
1449
  onClose === null || onClose === void 0 || onClose(reset || false);
1449
1450
  };
1450
1451
 
@@ -1554,7 +1555,7 @@ var PaymentModal = function PaymentModal(_ref16) {
1554
1555
  var paymentStatus = responseData === null || responseData === void 0 ? void 0 : responseData.payment_status;
1555
1556
  // 获取订单总金额
1556
1557
  var orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
1557
- var gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
1558
+ // const gapAmount = Number(responseData?.amount_gap || 0);
1558
1559
  var currentChangeGivenAmount = Number((responseData === null || responseData === void 0 || (_responseData$payment = responseData.payment_info) === null || _responseData$payment === void 0 ? void 0 : _responseData$payment.current_change_given_amount) || 0);
1559
1560
  // const changeDue = Number(responseData?.amount_gap || 0);
1560
1561
  // 获取失败原因
@@ -1564,7 +1565,7 @@ var PaymentModal = function PaymentModal(_ref16) {
1564
1565
  if (paymentStatus) {
1565
1566
  // 确定支付状态
1566
1567
  var statusClassName = calculateStatusClassName(paymentStatus);
1567
- var autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!gapAmount);
1568
+ var autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
1568
1569
 
1569
1570
  // 根据支付状态展示不同的 toast
1570
1571
  displayPaymentResultToast({
@@ -1581,7 +1582,7 @@ var PaymentModal = function PaymentModal(_ref16) {
1581
1582
  toastInfo: {
1582
1583
  status: paymentStatus,
1583
1584
  amount: orderTotalAmount,
1584
- gapAmount: gapAmount,
1585
+ gapAmount: currentChangeGivenAmount,
1585
1586
  failureReason: failureReason
1586
1587
  }
1587
1588
  });
@@ -1659,10 +1660,10 @@ var PaymentModal = function PaymentModal(_ref16) {
1659
1660
  return _ref21.apply(this, arguments);
1660
1661
  };
1661
1662
  }();
1662
- if (data) {
1663
+ if (data && open) {
1663
1664
  initCheckoutData();
1664
1665
  }
1665
- }, [data]);
1666
+ }, [data, open]);
1666
1667
 
1667
1668
  // 创建PaymentResultToast配置对象
1668
1669
  var paymentResultToastConfig = {
@@ -2001,17 +2002,18 @@ var PaymentModal = function PaymentModal(_ref16) {
2001
2002
 
2002
2003
  // 使用新的工具方法创建showSuccessToast函数
2003
2004
  var showSuccessToast = createShowSuccessToast(paymentResultToastConfig, generateActionButtons);
2004
- console.log('✅ PaymentModal: Rendering PisellContainer with open=true');
2005
- return /*#__PURE__*/React.createElement(PaymentResultToastProvider, null, /*#__PURE__*/React.createElement(PisellContainer, {
2005
+ return /*#__PURE__*/React.createElement(PaymentResultToastProvider, null, /*#__PURE__*/React.createElement(PisellContainer
2006
+ // open={open}
2007
+ , {
2006
2008
  renderType: "modal",
2007
2009
  props: {
2008
- open: true,
2010
+ open: open,
2009
2011
  onCancel: function onCancel() {
2010
2012
  handlePaymentCancel(false);
2011
2013
  },
2012
2014
  title: /*#__PURE__*/React.createElement(CustomHeader, null),
2013
2015
  width: 880,
2014
- destroyOnClose: true,
2016
+ destroyOnClose: false,
2015
2017
  maskClosable: false,
2016
2018
  footer: null,
2017
2019
  closeIcon: null,
@@ -2032,6 +2034,7 @@ var PaymentModal = function PaymentModal(_ref16) {
2032
2034
  }
2033
2035
  }, /*#__PURE__*/React.createElement(PaymentContent, {
2034
2036
  ref: paymentContentRef,
2037
+ isModalOpen: open,
2035
2038
  cartData: cloneDeep(data),
2036
2039
  orderInfo: orderInfo,
2037
2040
  onPaymentComplete: handlePaymentComplete,
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import { PisellText } from '@pisell/materials';
3
+ var Amount = PisellText.Amount;
2
4
  var DiscountTextMode = function DiscountTextMode(_ref) {
3
5
  var cardData = _ref.cardData,
4
6
  selectedWalletIds = _ref.selectedWalletIds;
@@ -14,7 +16,10 @@ var DiscountTextMode = function DiscountTextMode(_ref) {
14
16
  className: "discount-text-name"
15
17
  }, card.name), /*#__PURE__*/React.createElement("span", {
16
18
  className: "discount-text-amount"
17
- }, "-", card.savedAmount ? "$".concat(card.savedAmount) : '$0'));
19
+ }, "-", /*#__PURE__*/React.createElement(Amount, {
20
+ value: card.savedAmount,
21
+ showCurrencySymbol: true
22
+ })));
18
23
  }) : /*#__PURE__*/React.createElement("div", {
19
24
  className: "discount-text-empty"
20
25
  }));
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
+ import { PisellText } from '@pisell/materials';
2
3
  import "./index.less";
4
+ var Amount = PisellText.Amount;
3
5
  var WalletPassTextMode = function WalletPassTextMode(_ref) {
4
6
  var cardData = _ref.cardData,
5
7
  selectedWalletIds = _ref.selectedWalletIds;
@@ -15,7 +17,10 @@ var WalletPassTextMode = function WalletPassTextMode(_ref) {
15
17
  className: "wallet-pass-text-name"
16
18
  }, card.name), /*#__PURE__*/React.createElement("span", {
17
19
  className: "wallet-pass-text-amount"
18
- }, "-", card.redeem ? "".concat(card.redeem) : '$0'));
20
+ }, "-", /*#__PURE__*/React.createElement(Amount, {
21
+ value: card.redeem,
22
+ showCurrencySymbol: true
23
+ })));
19
24
  }) : /*#__PURE__*/React.createElement("div", {
20
25
  className: "wallet-pass-text-empty"
21
26
  }));
@@ -25,8 +25,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
25
25
  import React, { useEffect, useMemo, useRef, useState } from 'react';
26
26
  import { locales } from '@pisell/utils';
27
27
  import { message } from 'antd';
28
- import { Iconfont } from '@pisell/materials';
29
- import { getOrderInfoByCode, getBookingDetail, getEventBookingDetail, getBookingConfig, getServices, voidAppointment } from "../../serve";
28
+ import { Iconfont, PisellModal } from '@pisell/materials';
29
+ import { getOrderInfoByCode, getBookingDetail, getEventBookingDetail, getBookingConfig, getServices } from "../../serve";
30
30
  import * as apis from "../../serve";
31
31
  import dayjs from 'dayjs';
32
32
  import useEngineContext from "../../../../hooks/useEngineContext";
@@ -247,6 +247,10 @@ var TicketBooking = function TicketBooking() {
247
247
  _useState2 = _slicedToArray(_useState, 2),
248
248
  activeBookingId = _useState2[0],
249
249
  setActiveBookingId = _useState2[1];
250
+ var _useState3 = useState(false),
251
+ _useState4 = _slicedToArray(_useState3, 2),
252
+ showTerminalUpgradeModal = _useState4[0],
253
+ setShowTerminalUpgradeModal = _useState4[1];
250
254
  var pisellFloatingPanelRef = useRef(null);
251
255
  var closeRef = useRef(null);
252
256
  var bookingTicket = useBookingTicket();
@@ -261,6 +265,26 @@ var TicketBooking = function TicketBooking() {
261
265
  changeCustomerToGlobalState: changeCustomerToGlobalState
262
266
  }),
263
267
  selectCustomer = _useCustomer.selectCustomer;
268
+
269
+ // 检测Terminal版本并显示升级提示
270
+ var checkTerminalVersion = useMemoizedFn(function () {
271
+ if (isTerminal()) {
272
+ var userAgent = navigator.userAgent;
273
+ if (userAgent.includes('terminal')) {
274
+ // 匹配 terminal/x.x.x(xxx) 格式,支持多位数
275
+ var terminalVersionMatch = userAgent.match(/terminal\/[\d.]+\((\d+)\)/i);
276
+ if (terminalVersionMatch && terminalVersionMatch[1]) {
277
+ var buildNumberStr = terminalVersionMatch[1];
278
+ var buildNumber = parseInt(buildNumberStr, 10);
279
+
280
+ // 确保解析成功且是有效数字
281
+ if (!isNaN(buildNumber) && buildNumber > 0 && buildNumber < 766) {
282
+ setShowTerminalUpgradeModal(true);
283
+ }
284
+ }
285
+ }
286
+ }
287
+ });
264
288
  useMemo(function () {
265
289
  openScan(function (data) {
266
290
  handleScan(data);
@@ -336,6 +360,9 @@ var TicketBooking = function TicketBooking() {
336
360
  });
337
361
  _setShopOpeningHours();
338
362
  _setIntervalTime(true);
363
+
364
+ // 检测Terminal版本
365
+ checkTerminalVersion();
339
366
  interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || _interaction$utils.mountFunction('bookingTicket', 'clearAllCart', function (type, orderId) {
340
367
  console.log('bookingTicket.clearAllCart');
341
368
  // 支付成功后清空状态
@@ -349,8 +376,9 @@ var TicketBooking = function TicketBooking() {
349
376
 
350
377
  // 作废预约
351
378
  interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || _interaction$utils2.mountFunction('booking', 'voidBooking', function (orderId) {
352
- voidAppointment(orderId);
353
- enableAllScanListeners();
379
+ // checkout2.0 结账时不生成订单 所以不需要作废订单
380
+ // voidAppointment(orderId);
381
+ // enableAllScanListeners();
354
382
  });
355
383
  return function () {
356
384
  off === null || off === void 0 || off();
@@ -387,6 +415,7 @@ var TicketBooking = function TicketBooking() {
387
415
  intervalSetTime: isInterval
388
416
  });
389
417
  };
418
+ useEffect(function () {}, []);
390
419
  var getDataFromHost = function getDataFromHost() {
391
420
  try {
392
421
  var is_price_include_tax = getData('is_price_include_tax');
@@ -1210,6 +1239,19 @@ var TicketBooking = function TicketBooking() {
1210
1239
  ref: pisellFloatingPanelRef,
1211
1240
  currentDate: currentDate,
1212
1241
  onBookingClick: handleBookingClick
1242
+ }), /*#__PURE__*/React.createElement(PisellModal.Information, {
1243
+ open: showTerminalUpgradeModal,
1244
+ title: locales.getText('pisell2.ticket-booking.terminal-upgrade-title'),
1245
+ describe: locales.getText('pisell2.ticket-booking.terminal-upgrade-description'),
1246
+ okText: locales.getText('pisell2.ticket-booking.terminal-upgrade-ok'),
1247
+ cancelText: locales.getText('pisell2.ticket-booking.terminal-upgrade-cancel'),
1248
+ closable: true,
1249
+ onOk: function onOk() {
1250
+ return setShowTerminalUpgradeModal(false);
1251
+ },
1252
+ onCancel: function onCancel() {
1253
+ return setShowTerminalUpgradeModal(false);
1254
+ }
1213
1255
  }));
1214
1256
  };
1215
1257
  export default TicketBooking;