@pisell/private-materials 6.4.1 → 6.4.3

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.
@@ -46,6 +46,7 @@ import { WALLET_PASS_CODE_ARRAY, WALLET_PASS_CODE_MAP } from "./constants";
46
46
  import { cloneDeep } from 'lodash';
47
47
  import { getShopWalletPassId } from "./utils";
48
48
  import usePaymentLogger from "./hooks/usePaymentLogger";
49
+ import { Button } from 'antd';
49
50
 
50
51
  // Checkout 模块的事件常量
51
52
  var CheckoutHooks = {
@@ -82,7 +83,8 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
82
83
  onShowCashPaymentChange = _ref.onShowCashPaymentChange,
83
84
  showSuccessToast = _ref.showSuccessToast,
84
85
  _ref$dynamicMaxHeight = _ref.dynamicMaxHeight,
85
- dynamicMaxHeight = _ref$dynamicMaxHeight === void 0 ? '600px' : _ref$dynamicMaxHeight;
86
+ dynamicMaxHeight = _ref$dynamicMaxHeight === void 0 ? '600px' : _ref$dynamicMaxHeight,
87
+ onOrderSyncFailed = _ref.onOrderSyncFailed;
86
88
  var context = useEngineContext();
87
89
  var utils = context.appHelper.utils || {};
88
90
  var pisellos = utils.pisellos,
@@ -450,7 +452,15 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
450
452
  var _Toast$hide;
451
453
  Toast === null || Toast === void 0 || (_Toast$hide = Toast.hide) === null || _Toast$hide === void 0 || _Toast$hide.call(Toast);
452
454
  } else {
453
- Toast === null || Toast === void 0 || Toast.fail(locales.getText('pisell2.checkout.order-sync-failed') || 'Order sync failed');
455
+ var _Toast$hide2;
456
+ Toast === null || Toast === void 0 || (_Toast$hide2 = Toast.hide) === null || _Toast$hide2 === void 0 || _Toast$hide2.call(Toast);
457
+ // 调用失败回调,让父组件处理弹窗显示
458
+ if (onOrderSyncFailed) {
459
+ onOrderSyncFailed();
460
+ } else {
461
+ // 兜底显示 Toast
462
+ Toast === null || Toast === void 0 || Toast.fail(locales.getText('pisell2.checkout.order-sync-failed') || 'Order sync failed');
463
+ }
454
464
  }
455
465
  });
456
466
 
@@ -739,9 +749,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
739
749
  logger === null || logger === void 0 || logger.addLog({
740
750
  type: 'info',
741
751
  title: 'handleSelectWalletChange checkoutModule updateVoucherPaymentItemsAsync',
742
- metadata: {
743
- voucherItems: voucherItems
744
- }
752
+ metadata: {}
745
753
  });
746
754
  _context8.next = 6;
747
755
  return checkoutModule.updateVoucherPaymentItemsAsync(voucherItems);
@@ -1153,8 +1161,50 @@ var PaymentModal = function PaymentModal(_ref16) {
1153
1161
  _useState28 = _slicedToArray(_useState27, 2),
1154
1162
  windowHeight = _useState28[0],
1155
1163
  setWindowHeight = _useState28[1];
1164
+ var _useState29 = useState(false),
1165
+ _useState30 = _slicedToArray(_useState29, 2),
1166
+ showRetryModal = _useState30[0],
1167
+ setShowRetryModal = _useState30[1];
1156
1168
  var Toast = useToast();
1157
1169
 
1170
+ // 重试处理函数(逻辑由用户自己实现)
1171
+ var handleRetry = /*#__PURE__*/function () {
1172
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1173
+ var checkoutModule, res;
1174
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1175
+ while (1) switch (_context13.prev = _context13.next) {
1176
+ case 0:
1177
+ // TODO: 用户在这里实现重试逻辑
1178
+ // console.log('重试按钮被点击,请在这里添加重试逻辑');
1179
+ // 示例:重试成功后关闭弹窗
1180
+ // try {
1181
+ // await checkoutModule.manualSyncOrderAsync();
1182
+ // setShowRetryModal(false); // 成功后关闭弹窗
1183
+ // } catch (error) {
1184
+ // // 失败保持弹窗打开,允许继续重试
1185
+ // }
1186
+ checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1187
+ _context13.next = 3;
1188
+ return checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.manualSyncOrderAsync();
1189
+ case 3:
1190
+ res = _context13.sent;
1191
+ console.log(res);
1192
+ if (res.success) {
1193
+ setShowRetryModal(false);
1194
+ showSuccessToast === null || showSuccessToast === void 0 || showSuccessToast(res);
1195
+ // setShowRetryModal(false);
1196
+ }
1197
+ case 6:
1198
+ case "end":
1199
+ return _context13.stop();
1200
+ }
1201
+ }, _callee13);
1202
+ }));
1203
+ return function handleRetry() {
1204
+ return _ref18.apply(this, arguments);
1205
+ };
1206
+ }();
1207
+
1158
1208
  // 初始化和监听窗口高度变化
1159
1209
  useEffect(function () {
1160
1210
  var updateHeight = function updateHeight() {
@@ -1198,28 +1248,28 @@ var PaymentModal = function PaymentModal(_ref16) {
1198
1248
  }, []);
1199
1249
 
1200
1250
  // 订单备注相关状态
1201
- var _useState29 = useState(false),
1202
- _useState30 = _slicedToArray(_useState29, 2),
1203
- noteModalOpen = _useState30[0],
1204
- setNoteModalOpen = _useState30[1];
1205
- var _useState31 = useState(''),
1251
+ var _useState31 = useState(false),
1206
1252
  _useState32 = _slicedToArray(_useState31, 2),
1207
- orderNote = _useState32[0],
1208
- setOrderNote = _useState32[1];
1209
- var _useState33 = useState('payment-content'),
1253
+ noteModalOpen = _useState32[0],
1254
+ setNoteModalOpen = _useState32[1];
1255
+ var _useState33 = useState(''),
1210
1256
  _useState34 = _slicedToArray(_useState33, 2),
1211
- noteModalSource = _useState34[0],
1212
- setNoteModalSource = _useState34[1];
1257
+ orderNote = _useState34[0],
1258
+ setOrderNote = _useState34[1];
1259
+ var _useState35 = useState('payment-content'),
1260
+ _useState36 = _slicedToArray(_useState35, 2),
1261
+ noteModalSource = _useState36[0],
1262
+ setNoteModalSource = _useState36[1];
1213
1263
 
1214
1264
  // 订单备注相关处理函数
1215
1265
  var handleNoteConfirm = /*#__PURE__*/function () {
1216
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(noteValue) {
1266
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(noteValue) {
1217
1267
  var checkoutModule, orderId, _checkoutModule$editO, _checkoutModule, _checkoutModule$updat;
1218
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1219
- while (1) switch (_context13.prev = _context13.next) {
1268
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1269
+ while (1) switch (_context14.prev = _context14.next) {
1220
1270
  case 0:
1221
1271
  if (!(noteModalSource === 'payment-result-toast')) {
1222
- _context13.next = 6;
1272
+ _context14.next = 6;
1223
1273
  break;
1224
1274
  }
1225
1275
  checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
@@ -1230,15 +1280,15 @@ var PaymentModal = function PaymentModal(_ref16) {
1230
1280
  Toast === null || Toast === void 0 || Toast.success(locales.getText('pisell2.checkout.order-note.updated-successfully'));
1231
1281
  }
1232
1282
  setNoteModalOpen(false);
1233
- return _context13.abrupt("return");
1283
+ return _context14.abrupt("return");
1234
1284
  case 6:
1235
- _context13.prev = 6;
1285
+ _context14.prev = 6;
1236
1286
  _checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1237
1287
  if (!_checkoutModule) {
1238
- _context13.next = 13;
1288
+ _context14.next = 13;
1239
1289
  break;
1240
1290
  }
1241
- _context13.next = 11;
1291
+ _context14.next = 11;
1242
1292
  return (_checkoutModule$updat = _checkoutModule.updateOrderNoteAsync) === null || _checkoutModule$updat === void 0 ? void 0 : _checkoutModule$updat.call(_checkoutModule, noteValue);
1243
1293
  case 11:
1244
1294
  setOrderNote(noteValue);
@@ -1264,38 +1314,38 @@ var PaymentModal = function PaymentModal(_ref16) {
1264
1314
  console.log('Note added from payment content');
1265
1315
  // 在支付内容中打开的,执行常规处理逻辑
1266
1316
  }
1267
- _context13.next = 21;
1317
+ _context14.next = 21;
1268
1318
  break;
1269
1319
  case 17:
1270
- _context13.prev = 17;
1271
- _context13.t0 = _context13["catch"](6);
1272
- console.error('Failed to update order note:', _context13.t0);
1320
+ _context14.prev = 17;
1321
+ _context14.t0 = _context14["catch"](6);
1322
+ console.error('Failed to update order note:', _context14.t0);
1273
1323
  Toast === null || Toast === void 0 || Toast.error(locales.getText('pisell2.checkout.order-note.update-failed'));
1274
1324
  case 21:
1275
1325
  setNoteModalOpen(false);
1276
1326
  case 22:
1277
1327
  case "end":
1278
- return _context13.stop();
1328
+ return _context14.stop();
1279
1329
  }
1280
- }, _callee13, null, [[6, 17]]);
1330
+ }, _callee14, null, [[6, 17]]);
1281
1331
  }));
1282
1332
  return function handleNoteConfirm(_x13) {
1283
- return _ref18.apply(this, arguments);
1333
+ return _ref19.apply(this, arguments);
1284
1334
  };
1285
1335
  }();
1286
1336
  var handleNoteDelete = /*#__PURE__*/function () {
1287
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1337
+ var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1288
1338
  var checkoutModule, _checkoutModule$updat2;
1289
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1290
- while (1) switch (_context14.prev = _context14.next) {
1339
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1340
+ while (1) switch (_context15.prev = _context15.next) {
1291
1341
  case 0:
1292
- _context14.prev = 0;
1342
+ _context15.prev = 0;
1293
1343
  checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1294
1344
  if (!checkoutModule) {
1295
- _context14.next = 7;
1345
+ _context15.next = 7;
1296
1346
  break;
1297
1347
  }
1298
- _context14.next = 5;
1348
+ _context15.next = 5;
1299
1349
  return (_checkoutModule$updat2 = checkoutModule.updateOrderNoteAsync) === null || _checkoutModule$updat2 === void 0 ? void 0 : _checkoutModule$updat2.call(checkoutModule, '');
1300
1350
  case 5:
1301
1351
  setOrderNote('');
@@ -1311,23 +1361,23 @@ var PaymentModal = function PaymentModal(_ref16) {
1311
1361
  }
1312
1362
  });
1313
1363
  }
1314
- _context14.next = 14;
1364
+ _context15.next = 14;
1315
1365
  break;
1316
1366
  case 10:
1317
- _context14.prev = 10;
1318
- _context14.t0 = _context14["catch"](0);
1319
- console.error('Failed to delete order note:', _context14.t0);
1367
+ _context15.prev = 10;
1368
+ _context15.t0 = _context15["catch"](0);
1369
+ console.error('Failed to delete order note:', _context15.t0);
1320
1370
  Toast === null || Toast === void 0 || Toast.error(locales.getText('pisell2.checkout.order-note.delete-failed'));
1321
1371
  case 14:
1322
1372
  setNoteModalOpen(false);
1323
1373
  case 15:
1324
1374
  case "end":
1325
- return _context14.stop();
1375
+ return _context15.stop();
1326
1376
  }
1327
- }, _callee14, null, [[0, 10]]);
1377
+ }, _callee15, null, [[0, 10]]);
1328
1378
  }));
1329
1379
  return function handleNoteDelete() {
1330
- return _ref19.apply(this, arguments);
1380
+ return _ref20.apply(this, arguments);
1331
1381
  };
1332
1382
  }();
1333
1383
  var handleNoteCancel = function handleNoteCancel() {
@@ -1429,31 +1479,31 @@ var PaymentModal = function PaymentModal(_ref16) {
1429
1479
  setOrderNote(data.order_info.order_note);
1430
1480
  }
1431
1481
  }, [data]);
1432
- var _useState35 = useState(false),
1433
- _useState36 = _slicedToArray(_useState35, 2),
1434
- isLocalOrderCreated = _useState36[0],
1435
- setIsLocalOrderCreated = _useState36[1];
1482
+ var _useState37 = useState(false),
1483
+ _useState38 = _slicedToArray(_useState37, 2),
1484
+ isLocalOrderCreated = _useState38[0],
1485
+ setIsLocalOrderCreated = _useState38[1];
1436
1486
 
1437
1487
  // 初始化checkout数据
1438
1488
  useEffect(function () {
1439
1489
  var initCheckoutData = /*#__PURE__*/function () {
1440
- var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1490
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1441
1491
  var checkout, _newData$subtotal_inf, shop_wallet_pass_id, newData, _orderInfo, _data$subtotal_info, _orderInfo2;
1442
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1443
- while (1) switch (_context15.prev = _context15.next) {
1492
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1493
+ while (1) switch (_context16.prev = _context16.next) {
1444
1494
  case 0:
1445
- _context15.prev = 0;
1495
+ _context16.prev = 0;
1446
1496
  // 获取 checkout 模块并处理订单数据
1447
1497
  checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1448
1498
  if (!(checkout && data && !isLocalOrderCreated)) {
1449
- _context15.next = 19;
1499
+ _context16.next = 19;
1450
1500
  break;
1451
1501
  }
1452
1502
  setIsLocalOrderCreated(true);
1453
- _context15.next = 6;
1503
+ _context16.next = 6;
1454
1504
  return getShopWalletPassId(interaction);
1455
1505
  case 6:
1456
- shop_wallet_pass_id = _context15.sent;
1506
+ shop_wallet_pass_id = _context16.sent;
1457
1507
  checkout.setOtherParams({
1458
1508
  is_price_include_tax: getData('is_price_include_tax'),
1459
1509
  tax_rate: getData('tax_rate') || '10',
@@ -1469,7 +1519,7 @@ var PaymentModal = function PaymentModal(_ref16) {
1469
1519
  console.time('initCheckoutData');
1470
1520
  newData = cloneDeep(data); // setTotalAmount(newData.total.expectAmount);
1471
1521
  // 先往 checkout 解决方案推送一条 local 数据
1472
- _context15.next = 12;
1522
+ _context16.next = 12;
1473
1523
  return checkout.createLocalOrderAsync({
1474
1524
  orderData: newData.order_info,
1475
1525
  cartSummary: (_newData$subtotal_inf = newData.subtotal_info) === null || _newData$subtotal_inf === void 0 ? void 0 : _newData$subtotal_inf.subTotalList,
@@ -1562,20 +1612,20 @@ var PaymentModal = function PaymentModal(_ref16) {
1562
1612
  // 可以在这里执行同步完成后的业务逻辑
1563
1613
  // 比如:通知其他系统、更新UI状态等
1564
1614
  });
1565
- _context15.next = 30;
1615
+ _context16.next = 30;
1566
1616
  break;
1567
1617
  case 19:
1568
1618
  if (!isLocalOrderCreated) {
1569
- _context15.next = 30;
1619
+ _context16.next = 30;
1570
1620
  break;
1571
1621
  }
1572
1622
  // // 如果本地订单已创建,这时候还更新了 data,则需要销毁当前的订单数据,然后更新新的订单数据了
1573
1623
  console.log('🔄 PaymentModal: data changed, updating checkout data...');
1574
1624
  setIsLocalOrderCreated(false);
1575
- _context15.next = 24;
1625
+ _context16.next = 24;
1576
1626
  return checkout.cancelCurrentOrderAsync();
1577
1627
  case 24:
1578
- _context15.next = 26;
1628
+ _context16.next = 26;
1579
1629
  return checkout.createLocalOrderAsync({
1580
1630
  orderData: data === null || data === void 0 ? void 0 : data.order_info,
1581
1631
  cartSummary: data === null || data === void 0 || (_data$subtotal_info = data.subtotal_info) === null || _data$subtotal_info === void 0 ? void 0 : _data$subtotal_info.subTotalList,
@@ -1591,20 +1641,20 @@ var PaymentModal = function PaymentModal(_ref16) {
1591
1641
  setOrderInfo(_orderInfo2);
1592
1642
  setIsLocalOrderCreated(true);
1593
1643
  case 30:
1594
- _context15.next = 35;
1644
+ _context16.next = 35;
1595
1645
  break;
1596
1646
  case 32:
1597
- _context15.prev = 32;
1598
- _context15.t0 = _context15["catch"](0);
1599
- console.error('Failed to initialize checkout data:', _context15.t0);
1647
+ _context16.prev = 32;
1648
+ _context16.t0 = _context16["catch"](0);
1649
+ console.error('Failed to initialize checkout data:', _context16.t0);
1600
1650
  case 35:
1601
1651
  case "end":
1602
- return _context15.stop();
1652
+ return _context16.stop();
1603
1653
  }
1604
- }, _callee15, null, [[0, 32]]);
1654
+ }, _callee16, null, [[0, 32]]);
1605
1655
  }));
1606
1656
  return function initCheckoutData() {
1607
- return _ref20.apply(this, arguments);
1657
+ return _ref21.apply(this, arguments);
1608
1658
  };
1609
1659
  }();
1610
1660
  if (data) {
@@ -1631,11 +1681,11 @@ var PaymentModal = function PaymentModal(_ref16) {
1631
1681
 
1632
1682
  // 通用回调函数
1633
1683
  var handleDetailsClick = /*#__PURE__*/function () {
1634
- var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1684
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1635
1685
  var _context$appHelper2;
1636
1686
  var _context$appHelper$ut5, isTerminal, isWebPos, checkout, orderId;
1637
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1638
- while (1) switch (_context16.prev = _context16.next) {
1687
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1688
+ while (1) switch (_context17.prev = _context17.next) {
1639
1689
  case 0:
1640
1690
  setTimeout(function () {
1641
1691
  // 关闭支付结果toast
@@ -1645,15 +1695,15 @@ var PaymentModal = function PaymentModal(_ref16) {
1645
1695
  }, 0);
1646
1696
  _context$appHelper$ut5 = (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils, isTerminal = _context$appHelper$ut5.isTerminal, isWebPos = _context$appHelper$ut5.isWebPos;
1647
1697
  if (!(isTerminal !== null && isTerminal !== void 0 && isTerminal())) {
1648
- _context16.next = 8;
1698
+ _context17.next = 8;
1649
1699
  break;
1650
1700
  }
1651
1701
  checkout = pisellos.getModule('checkout');
1652
- _context16.next = 6;
1702
+ _context17.next = 6;
1653
1703
  return checkout.getCurrentOrderId();
1654
1704
  case 6:
1655
- orderId = _context16.sent;
1656
- return _context16.abrupt("return", interaction.utils.postMessageToApp({
1705
+ orderId = _context17.sent;
1706
+ return _context17.abrupt("return", interaction.utils.postMessageToApp({
1657
1707
  module: 'booking',
1658
1708
  key: 'view_order',
1659
1709
  data: {
@@ -1663,46 +1713,46 @@ var PaymentModal = function PaymentModal(_ref16) {
1663
1713
  }));
1664
1714
  case 8:
1665
1715
  case "end":
1666
- return _context16.stop();
1716
+ return _context17.stop();
1667
1717
  }
1668
- }, _callee16);
1718
+ }, _callee17);
1669
1719
  }));
1670
1720
  return function handleDetailsClick() {
1671
- return _ref21.apply(this, arguments);
1721
+ return _ref22.apply(this, arguments);
1672
1722
  };
1673
1723
  }();
1674
1724
  var handlePrintReceiptClick = /*#__PURE__*/function () {
1675
- var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1725
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1676
1726
  var checkoutModule, data, isSynced, orderId, params;
1677
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1678
- while (1) switch (_context17.prev = _context17.next) {
1727
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1728
+ while (1) switch (_context18.prev = _context18.next) {
1679
1729
  case 0:
1680
1730
  checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1681
1731
  if (checkoutModule) {
1682
- _context17.next = 3;
1732
+ _context18.next = 3;
1683
1733
  break;
1684
1734
  }
1685
- return _context17.abrupt("return");
1735
+ return _context18.abrupt("return");
1686
1736
  case 3:
1687
- _context17.next = 5;
1737
+ _context18.next = 5;
1688
1738
  return checkoutModule.isCurrentOrderSynced();
1689
1739
  case 5:
1690
- isSynced = _context17.sent;
1740
+ isSynced = _context18.sent;
1691
1741
  if (isSynced) {
1692
- _context17.next = 12;
1742
+ _context18.next = 12;
1693
1743
  break;
1694
1744
  }
1695
- _context17.next = 9;
1745
+ _context18.next = 9;
1696
1746
  return checkoutModule.manualSyncOrderAsync();
1697
1747
  case 9:
1698
- data = _context17.sent;
1699
- _context17.next = 16;
1748
+ data = _context18.sent;
1749
+ _context18.next = 16;
1700
1750
  break;
1701
1751
  case 12:
1702
- _context17.next = 14;
1752
+ _context18.next = 14;
1703
1753
  return checkoutModule.getCurrentOrderId();
1704
1754
  case 14:
1705
- orderId = _context17.sent;
1755
+ orderId = _context18.sent;
1706
1756
  data = {
1707
1757
  orderId: orderId
1708
1758
  };
@@ -1728,12 +1778,12 @@ var PaymentModal = function PaymentModal(_ref16) {
1728
1778
  }
1729
1779
  case 17:
1730
1780
  case "end":
1731
- return _context17.stop();
1781
+ return _context18.stop();
1732
1782
  }
1733
- }, _callee17);
1783
+ }, _callee18);
1734
1784
  }));
1735
1785
  return function handlePrintReceiptClick() {
1736
- return _ref22.apply(this, arguments);
1786
+ return _ref23.apply(this, arguments);
1737
1787
  };
1738
1788
  }();
1739
1789
  var handleRetryClick = function handleRetryClick() {
@@ -1998,7 +2048,10 @@ var PaymentModal = function PaymentModal(_ref16) {
1998
2048
  moduleConfig: moduleConfig,
1999
2049
  onShowCashPaymentChange: handleShowCashPaymentChange,
2000
2050
  showSuccessToast: showSuccessToast,
2001
- dynamicMaxHeight: dynamicMaxHeight
2051
+ dynamicMaxHeight: dynamicMaxHeight,
2052
+ onOrderSyncFailed: function onOrderSyncFailed() {
2053
+ return setShowRetryModal(true);
2054
+ }
2002
2055
  })), noteModalOpen && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(NoteModal, {
2003
2056
  open: noteModalOpen,
2004
2057
  title: locales.getText('pisell2.text.add-order-notes'),
@@ -2007,7 +2060,36 @@ var PaymentModal = function PaymentModal(_ref16) {
2007
2060
  onDelete: handleNoteDelete,
2008
2061
  onCancel: handleNoteCancel
2009
2062
  // {...({ zIndex: 2000 } as any)}
2010
- })), document.body));
2063
+ })), document.body), /*#__PURE__*/React.createElement(PisellContainer, {
2064
+ renderType: "modal",
2065
+ props: {
2066
+ open: showRetryModal,
2067
+ title: locales.getText('pisell2.checkout.tips'),
2068
+ footer: null,
2069
+ closable: false,
2070
+ maskClosable: false,
2071
+ keyboard: false,
2072
+ onCancel: function onCancel() {} // 禁用关闭
2073
+ }
2074
+ }, /*#__PURE__*/React.createElement("div", {
2075
+ style: {
2076
+ textAlign: 'center',
2077
+ padding: '20px'
2078
+ }
2079
+ }, /*#__PURE__*/React.createElement("div", {
2080
+ style: {
2081
+ marginBottom: '16px',
2082
+ fontSize: '16px'
2083
+ }
2084
+ }, locales.getText('pisell2.checkout.sync-retry-hint') || '请点击重试按钮重新同步订单'), /*#__PURE__*/React.createElement(Button, {
2085
+ type: "primary",
2086
+ size: "large",
2087
+ onClick: handleRetry,
2088
+ style: {
2089
+ width: '100%',
2090
+ marginTop: '80px'
2091
+ }
2092
+ }, locales.getText('retry') || '重试'))));
2011
2093
  };
2012
2094
 
2013
2095
  // 导出类型供外部使用
@@ -1,4 +1,6 @@
1
1
  .additional-module {
2
+ padding-bottom: 16px; // 底部间距
3
+
2
4
  // 标题样式
3
5
  &-title {
4
6
  font-size: 24px;
@@ -417,10 +417,7 @@ export var useWalletPass = function useWalletPass(props) {
417
417
  logger === null || logger === void 0 || logger.addLog({
418
418
  type: 'info',
419
419
  title: 'useWalletPass_onOrderCreated onSelectChange 开始调用',
420
- metadata: {
421
- recommendList: recommendList,
422
- select: _select
423
- }
420
+ metadata: {}
424
421
  });
425
422
  // 设置默认选中钱包
426
423
  onSelectChange === null || onSelectChange === void 0 || onSelectChange(_select);
@@ -571,10 +568,7 @@ export var useWalletPass = function useWalletPass(props) {
571
568
  logger === null || logger === void 0 || logger.addLog({
572
569
  type: 'info',
573
570
  title: 'useWalletPass_handleFetchUserIdentificationCodes onSelectChange 开始调用',
574
- metadata: {
575
- prepare_payments: prepare_payments,
576
- select: select
577
- }
571
+ metadata: {}
578
572
  });
579
573
  onSelectChange === null || onSelectChange === void 0 || onSelectChange(select);
580
574
  fetchUserIdentificationCodes({
@@ -740,13 +734,18 @@ export var useWalletPass = function useWalletPass(props) {
740
734
  }
741
735
  });
742
736
  var handleSelectDiscount = useMemoizedFn(function (value, option) {
743
- var _pisellos$effects2;
737
+ var _detail$discountList, _pisellos$effects2;
744
738
  setLoading(true);
745
739
  var isSelected = value.includes(option.id);
746
740
  var detail = shopDiscount.setDiscountSelected({
747
741
  discountId: option.id,
748
742
  isSelected: isSelected
749
743
  });
744
+ if (!(detail !== null && detail !== void 0 && (_detail$discountList = detail.discountList) !== null && _detail$discountList !== void 0 && (_detail$discountList = _detail$discountList.find(function (item) {
745
+ return item.id === option.id;
746
+ })) !== null && _detail$discountList !== void 0 && _detail$discountList.isSelected)) {
747
+ setLoading(false);
748
+ }
750
749
 
751
750
  // 保持初始顺序设置折扣列表
752
751
  var sortedDiscountList = sortDiscountListWithInitialOrder(detail.discountList);
@@ -91,7 +91,6 @@
91
91
  .additional-module-container {
92
92
  flex-shrink: 0; // 不允许缩小
93
93
  min-height: 60px; // 确保额外模块有足够的显示空间
94
- padding-bottom: 16px; // 底部间距
95
94
  position: absolute;
96
95
  bottom: 0;
97
96
  width: calc(100% - 80px);
@@ -147,6 +147,9 @@ declare const _default: {
147
147
  'wallet-pass-module-customer-name-walk-in': string;
148
148
  'pisell2.amount-summary.amount-cannot-be-zero': string;
149
149
  'pisell2.checkout.order-sync-failed': string;
150
+ 'pisell2.checkout.sync-retry-hint': string;
151
+ 'pisell2.checkout.tips': string;
152
+ retry: string;
150
153
  };
151
154
  'zh-CN': {
152
155
  'order.total': string;
@@ -296,6 +299,9 @@ declare const _default: {
296
299
  'wallet-pass-module-customer-name-walk-in': string;
297
300
  'pisell2.amount-summary.amount-cannot-be-zero': string;
298
301
  'pisell2.checkout.order-sync-failed': string;
302
+ 'pisell2.checkout.sync-retry-hint': string;
303
+ 'pisell2.checkout.tips': string;
304
+ retry: string;
299
305
  };
300
306
  'zh-HK': {
301
307
  'order.total': string;
@@ -445,6 +451,9 @@ declare const _default: {
445
451
  'wallet-pass-module-customer-name-walk-in': string;
446
452
  'pisell2.amount-summary.amount-cannot-be-zero': string;
447
453
  'pisell2.checkout.order-sync-failed': string;
454
+ 'pisell2.checkout.sync-retry-hint': string;
455
+ 'pisell2.checkout.tips': string;
456
+ retry: string;
448
457
  };
449
458
  };
450
459
  export default _default;
@@ -192,7 +192,10 @@ export default {
192
192
  // Amount validation errors
193
193
  'pisell2.amount-summary.amount-cannot-be-zero': 'The amount cannot be 0',
194
194
  // Order sync errors
195
- 'pisell2.checkout.order-sync-failed': 'Order sync failed, please check your network'
195
+ 'pisell2.checkout.order-sync-failed': 'Order sync failed, please check your network',
196
+ 'pisell2.checkout.sync-retry-hint': 'Network error, please click the retry button to resync the order',
197
+ 'pisell2.checkout.tips': 'Tips',
198
+ 'retry': 'Retry'
196
199
  },
197
200
  'zh-CN': {
198
201
  // Order and Payment
@@ -390,7 +393,10 @@ export default {
390
393
  // Amount validation errors
391
394
  'pisell2.amount-summary.amount-cannot-be-zero': '金额不能为0',
392
395
  // Order sync errors
393
- 'pisell2.checkout.order-sync-failed': '订单同步失败,请检查网络'
396
+ 'pisell2.checkout.order-sync-failed': '订单同步失败,请检查网络',
397
+ 'pisell2.checkout.sync-retry-hint': '网络异常,请点击重试按钮重新同步订单',
398
+ 'pisell2.checkout.tips': '提示',
399
+ 'retry': '重试'
394
400
  },
395
401
  'zh-HK': {
396
402
  // Order and Payment
@@ -588,6 +594,9 @@ export default {
588
594
  // Amount validation errors
589
595
  'pisell2.amount-summary.amount-cannot-be-zero': '金額不能為0',
590
596
  // Order sync errors
591
- 'pisell2.checkout.order-sync-failed': '訂單同步失敗,請檢查網絡'
597
+ 'pisell2.checkout.order-sync-failed': '訂單同步失敗,請檢查網絡',
598
+ 'pisell2.checkout.sync-retry-hint': '網絡異常,請點擊重試按鈕重新同步訂單',
599
+ 'pisell2.checkout.tips': '提示',
600
+ 'retry': '重試'
592
601
  }
593
602
  };
@@ -88,7 +88,7 @@ var index = function index(_ref) {
88
88
  return createGridComponents(layout);
89
89
  }, [layout]);
90
90
  var context = useEngineContext();
91
- useEffect(function () {
91
+ useLayoutEffect(function () {
92
92
  var _context$appHelper$ut;
93
93
  locales.init(localeTexts, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get('umi_locale')) || 'en');
94
94
  }, []);