@pisell/private-materials 6.4.18 → 6.4.20

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.
@@ -30,7 +30,7 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
30
30
  * @return {*}
31
31
  * @Author: xiangfeng.xue
32
32
  */
33
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
33
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
34
34
  /**
35
35
  * 计算所有价格明细
36
36
  * @param items - 购物车商品数组
@@ -1,5 +1,5 @@
1
1
  .pisell-lowcode__booking-tab-pane-wrap {
2
- height: 100vh;
2
+ height: 100%;
3
3
  // padding: 0 32px;
4
4
  width: 100%;
5
5
  position: relative;
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
165
165
  export declare const getDuration: (duration: number | {
166
166
  type: string;
167
167
  value: number;
168
- }) => number | {
168
+ }) => number | "flexible" | {
169
169
  type: string;
170
170
  value: number;
171
- } | "flexible";
171
+ };
172
172
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
173
173
  export declare const getIsEdit: (state: any) => boolean;
174
174
  export {};
@@ -1048,25 +1048,35 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1048
1048
  };
1049
1049
  var handleSendCustomerPaymentLink = /*#__PURE__*/function () {
1050
1050
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(data) {
1051
- var isCurrentOrderSynced, res;
1051
+ var order, stateAmount, isCurrentOrderSynced, res;
1052
1052
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1053
1053
  while (1) switch (_context12.prev = _context12.next) {
1054
1054
  case 0:
1055
1055
  // 先检测订单是否同步过,如果没有,需要先手动下单
1056
+ // 如果是定金模式,则需要设置当前待付金额至 os 的 deposit_amount
1057
+ order = checkoutModule.getCurrentOrderInfo();
1058
+ if (!order.isDeposit) {
1059
+ _context12.next = 5;
1060
+ break;
1061
+ }
1062
+ stateAmount = checkoutModule.getStateAmount();
1063
+ _context12.next = 5;
1064
+ return checkoutModule.setDepositAmountAsync(stateAmount);
1065
+ case 5:
1056
1066
  isCurrentOrderSynced = checkoutModule.isCurrentOrderSynced();
1057
1067
  if (isCurrentOrderSynced) {
1058
- _context12.next = 4;
1068
+ _context12.next = 9;
1059
1069
  break;
1060
1070
  }
1061
- _context12.next = 4;
1071
+ _context12.next = 9;
1062
1072
  return checkoutModule.manualSyncOrderAsync();
1063
- case 4:
1064
- _context12.next = 6;
1073
+ case 9:
1074
+ _context12.next = 11;
1065
1075
  return checkoutModule.sendCustomerPayLinkAsync({
1066
1076
  emails: data.emails,
1067
1077
  order_ids: [checkoutModule.getCurrentOrderId()]
1068
1078
  });
1069
- case 6:
1079
+ case 11:
1070
1080
  res = _context12.sent;
1071
1081
  // 支付链接发送成功 转 toC,这边可以关掉了
1072
1082
  if (res.success) {
@@ -1075,7 +1085,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1075
1085
  } else {
1076
1086
  Toast === null || Toast === void 0 || Toast.error(res.message || locales.getText('pisell2.checkout.send-payment-link.error'));
1077
1087
  }
1078
- case 8:
1088
+ case 13:
1079
1089
  case "end":
1080
1090
  return _context12.stop();
1081
1091
  }
@@ -1603,7 +1613,7 @@ var PaymentModal = function PaymentModal(_ref17) {
1603
1613
  // 获取 checkout 模块并处理订单数据
1604
1614
  checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1605
1615
  if (!(checkout && data && !isLocalOrderCreated.current)) {
1606
- _context17.next = 20;
1616
+ _context17.next = 19;
1607
1617
  break;
1608
1618
  }
1609
1619
  isLocalOrderCreated.current = true;
@@ -1651,130 +1661,27 @@ var PaymentModal = function PaymentModal(_ref17) {
1651
1661
  unsubscribeRef.current();
1652
1662
  unsubscribeRef.current = undefined;
1653
1663
  }
1654
- // 监听订单同步完成,同步完成后显示订单完成 toast,关闭当前弹窗
1655
- unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', function (data) {
1656
- var _data$response, _responseData$payment2;
1657
- // 获取支付状态和相关信息
1658
- var responseData = (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.data;
1659
- // 获取支付状态
1660
- var paymentStatus = responseData === null || responseData === void 0 ? void 0 : responseData.payment_status;
1661
- if (data.isManual) return;
1662
- handlePaymentComplete(data);
1663
- // 如果正在显示现金支付 toast,跳过自动关闭逻辑
1664
- if (showingCashToastRef.current) {
1665
- return;
1666
- }
1667
-
1668
- // 获取订单总金额
1669
- var orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
1670
- var gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
1671
- var currentChangeGivenAmount = Number((responseData === null || responseData === void 0 || (_responseData$payment2 = responseData.payment_info) === null || _responseData$payment2 === void 0 ? void 0 : _responseData$payment2.current_change_given_amount) || 0);
1672
- // const changeDue = Number(responseData?.amount_gap || 0);
1673
- // 获取失败原因
1674
- var failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason;
1675
-
1676
- // 根据支付状态弹出对应的支付结果toast
1677
- if (paymentStatus) {
1678
- // 打印订单完整信息
1679
- console.log('print_order_onOrderSynced>>>>', responseData);
1680
- logger === null || logger === void 0 || logger.addLog({
1681
- type: 'info',
1682
- title: 'print_order_onOrderSynced',
1683
- metadata: {
1684
- responseData: responseData
1685
- }
1686
- });
1687
- try {
1688
- var _responseData$payment3;
1689
- var params = {
1690
- type: '99',
1691
- // 打印订单全部信息
1692
- data: {
1693
- order_id: responseData.order_id,
1694
- machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
1695
- small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment3 = responseData.payment_info) === null || _responseData$payment3 === void 0 ? void 0 : _responseData$payment3.small_ticket_data
1696
- }
1697
- };
1698
- console.log('print_order_onOrderSynced_params>>>>', params);
1699
- logger === null || logger === void 0 || logger.addLog({
1700
- type: 'info',
1701
- title: 'print_order_onOrderSynced_params',
1702
- metadata: {
1703
- params: params
1704
- }
1705
- });
1706
- webPrint(params, function (res) {
1707
- console.log('print_order_onOrderSynced_res>>>>', res);
1708
- logger === null || logger === void 0 || logger.addLog({
1709
- type: 'info',
1710
- title: 'print_order_onOrderSynced_res',
1711
- metadata: {
1712
- res: res
1713
- }
1714
- });
1715
- });
1716
- } catch (error) {
1717
- console.error('print_order_onOrderSynced_error>>>>', error);
1718
- logger === null || logger === void 0 || logger.addLog({
1719
- type: 'info',
1720
- title: 'print_order_onOrderSynced_error',
1721
- metadata: {
1722
- error: error
1723
- }
1724
- });
1725
- }
1726
-
1727
- // 确定支付状态
1728
- var statusClassName = calculateStatusClassName(paymentStatus);
1729
- var autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
1730
-
1731
- // 根据支付状态展示不同的 toast
1732
- displayPaymentResultToast({
1733
- paymentStatus: paymentStatus,
1734
- orderTotalAmount: orderTotalAmount,
1735
- gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
1736
- failureReason: failureReason,
1737
- autoCloseConfig: autoCloseConfig,
1738
- actionButtons: generateActionButtons(paymentStatus)
1739
- }, paymentResultToastConfig);
1740
-
1741
- // 将支付结果信息传递给回调处理
1742
- var paymentResult = _objectSpread(_objectSpread({}, data), {}, {
1743
- toastInfo: {
1744
- status: paymentStatus,
1745
- amount: orderTotalAmount,
1746
- gapAmount: currentChangeGivenAmount,
1747
- failureReason: failureReason
1748
- }
1749
- });
1750
- handlePaymentComplete(paymentResult);
1751
- } else {
1752
- handlePaymentComplete(data);
1753
- }
1754
- // 可以在这里执行同步完成后的业务逻辑
1755
- // 比如:通知其他系统、更新UI状态等
1756
- });
1757
- _context17.next = 31;
1664
+ _context17.next = 30;
1758
1665
  break;
1759
- case 20:
1666
+ case 19:
1760
1667
  if (!isLocalOrderCreated.current) {
1761
- _context17.next = 31;
1668
+ _context17.next = 30;
1762
1669
  break;
1763
1670
  }
1764
1671
  // // 如果本地订单已创建,这时候还更新了 data,则需要销毁当前的订单数据,然后更新新的订单数据了
1765
1672
  console.log('🔄 PaymentModal: data changed, updating checkout data...');
1766
1673
  isLocalOrderCreated.current = false;
1767
- _context17.next = 25;
1674
+ _context17.next = 24;
1768
1675
  return checkout.cancelCurrentOrderAsync();
1769
- case 25:
1770
- _context17.next = 27;
1676
+ case 24:
1677
+ _context17.next = 26;
1771
1678
  return checkout.createLocalOrderAsync({
1772
1679
  orderData: data === null || data === void 0 ? void 0 : data.order_info,
1773
1680
  cartSummary: data === null || data === void 0 || (_data$subtotal_info = data.subtotal_info) === null || _data$subtotal_info === void 0 ? void 0 : _data$subtotal_info.subTotalList,
1774
1681
  autoPayment: true,
1775
1682
  totalInfo: data === null || data === void 0 ? void 0 : data.subtotal_info
1776
1683
  });
1777
- case 27:
1684
+ case 26:
1778
1685
  // 获取订单总金额
1779
1686
  _orderInfo3 = checkout.getCurrentOrderInfo();
1780
1687
  if (_orderInfo3 && _orderInfo3.totalAmount) {
@@ -1782,11 +1689,11 @@ var PaymentModal = function PaymentModal(_ref17) {
1782
1689
  }
1783
1690
  setOrderInfo(_orderInfo3);
1784
1691
  isLocalOrderCreated.current = true;
1785
- case 31:
1786
- _context17.next = 37;
1692
+ case 30:
1693
+ _context17.next = 36;
1787
1694
  break;
1788
- case 33:
1789
- _context17.prev = 33;
1695
+ case 32:
1696
+ _context17.prev = 32;
1790
1697
  _context17.t0 = _context17["catch"](0);
1791
1698
  console.error('Failed to initialize checkout data:', _context17.t0);
1792
1699
  logger === null || logger === void 0 || logger.addLog({
@@ -1796,11 +1703,11 @@ var PaymentModal = function PaymentModal(_ref17) {
1796
1703
  error: _context17.t0
1797
1704
  }
1798
1705
  });
1799
- case 37:
1706
+ case 36:
1800
1707
  case "end":
1801
1708
  return _context17.stop();
1802
1709
  }
1803
- }, _callee17, null, [[0, 33]]);
1710
+ }, _callee17, null, [[0, 32]]);
1804
1711
  }));
1805
1712
  return function initCheckoutData() {
1806
1713
  return _ref22.apply(this, arguments);
@@ -1811,6 +1718,110 @@ var PaymentModal = function PaymentModal(_ref17) {
1811
1718
  }
1812
1719
  }, [data]);
1813
1720
  useEffect(function () {
1721
+ var checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
1722
+ // 监听订单同步完成,同步完成后显示订单完成 toast,关闭当前弹窗
1723
+ unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', function (data) {
1724
+ var _data$response, _responseData$payment2;
1725
+ // 获取支付状态和相关信息
1726
+ var responseData = (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.data;
1727
+ // 获取支付状态
1728
+ var paymentStatus = responseData === null || responseData === void 0 ? void 0 : responseData.payment_status;
1729
+ if (data.isManual) return;
1730
+ handlePaymentComplete(data);
1731
+ // 如果正在显示现金支付 toast,跳过自动关闭逻辑
1732
+ if (showingCashToastRef.current) {
1733
+ return;
1734
+ }
1735
+
1736
+ // 获取订单总金额
1737
+ var orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
1738
+ var gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
1739
+ var currentChangeGivenAmount = Number((responseData === null || responseData === void 0 || (_responseData$payment2 = responseData.payment_info) === null || _responseData$payment2 === void 0 ? void 0 : _responseData$payment2.current_change_given_amount) || 0);
1740
+ // const changeDue = Number(responseData?.amount_gap || 0);
1741
+ // 获取失败原因
1742
+ var failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason;
1743
+
1744
+ // 根据支付状态弹出对应的支付结果toast
1745
+ if (paymentStatus) {
1746
+ // 打印订单完整信息
1747
+ console.log('print_order_onOrderSynced>>>>', responseData);
1748
+ logger === null || logger === void 0 || logger.addLog({
1749
+ type: 'info',
1750
+ title: 'print_order_onOrderSynced',
1751
+ metadata: {
1752
+ responseData: responseData
1753
+ }
1754
+ });
1755
+ try {
1756
+ var _responseData$payment3;
1757
+ var params = {
1758
+ type: '99',
1759
+ // 打印订单全部信息
1760
+ data: {
1761
+ order_id: responseData.order_id,
1762
+ machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
1763
+ small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment3 = responseData.payment_info) === null || _responseData$payment3 === void 0 ? void 0 : _responseData$payment3.small_ticket_data
1764
+ }
1765
+ };
1766
+ console.log('print_order_onOrderSynced_params>>>>', params);
1767
+ logger === null || logger === void 0 || logger.addLog({
1768
+ type: 'info',
1769
+ title: 'print_order_onOrderSynced_params',
1770
+ metadata: {
1771
+ params: params
1772
+ }
1773
+ });
1774
+ webPrint(params, function (res) {
1775
+ console.log('print_order_onOrderSynced_res>>>>', res);
1776
+ logger === null || logger === void 0 || logger.addLog({
1777
+ type: 'info',
1778
+ title: 'print_order_onOrderSynced_res',
1779
+ metadata: {
1780
+ res: res
1781
+ }
1782
+ });
1783
+ });
1784
+ } catch (error) {
1785
+ console.error('print_order_onOrderSynced_error>>>>', error);
1786
+ logger === null || logger === void 0 || logger.addLog({
1787
+ type: 'info',
1788
+ title: 'print_order_onOrderSynced_error',
1789
+ metadata: {
1790
+ error: error
1791
+ }
1792
+ });
1793
+ }
1794
+
1795
+ // 确定支付状态
1796
+ var statusClassName = calculateStatusClassName(paymentStatus);
1797
+ var autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
1798
+
1799
+ // 根据支付状态展示不同的 toast
1800
+ displayPaymentResultToast({
1801
+ paymentStatus: paymentStatus,
1802
+ orderTotalAmount: orderTotalAmount,
1803
+ gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
1804
+ failureReason: failureReason,
1805
+ autoCloseConfig: autoCloseConfig,
1806
+ actionButtons: generateActionButtons(paymentStatus)
1807
+ }, paymentResultToastConfig);
1808
+
1809
+ // 将支付结果信息传递给回调处理
1810
+ var paymentResult = _objectSpread(_objectSpread({}, data), {}, {
1811
+ toastInfo: {
1812
+ status: paymentStatus,
1813
+ amount: orderTotalAmount,
1814
+ gapAmount: currentChangeGivenAmount,
1815
+ failureReason: failureReason
1816
+ }
1817
+ });
1818
+ handlePaymentComplete(paymentResult);
1819
+ } else {
1820
+ handlePaymentComplete(data);
1821
+ }
1822
+ // 可以在这里执行同步完成后的业务逻辑
1823
+ // 比如:通知其他系统、更新UI状态等
1824
+ });
1814
1825
  return function () {
1815
1826
  if (typeof unsubscribeRef.current === 'function') {
1816
1827
  var _unsubscribeRef$curre;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  interface DiscountWalletProps {
4
3
  isCardMode: boolean;
@@ -15,11 +15,11 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "windcave" | "payo" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "loading" | "warn" | "success" | "fail" | "question";
177
+ status: "loading" | "success" | "warn" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -295,9 +295,9 @@ export declare const backUpFree: (payload: Partial<State>) => {
295
295
  name?: string | undefined;
296
296
  symbol?: string | undefined;
297
297
  amount?: string | number | undefined;
298
- mode?: "refund" | "fullPay" | "pay" | "query" | undefined;
298
+ mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
300
+ eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | undefined;
301
301
  action?: "amount" | "pay" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -308,7 +308,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */
@@ -41,7 +41,7 @@ declare type ScanData = {
41
41
  };
42
42
  };
43
43
  export declare const formatScanCustomer: (data: ScanData) => {
44
- searchType: "product" | "customer" | "wallet" | "walletPass" | "local_product";
44
+ searchType: "customer" | "product" | "wallet" | "walletPass" | "local_product";
45
45
  data: any;
46
46
  scanCode: string;
47
47
  } | null;
@@ -30,7 +30,7 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
30
30
  * @return {*}
31
31
  * @Author: xiangfeng.xue
32
32
  */
33
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
33
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
34
34
  /**
35
35
  * 计算所有价格明细
36
36
  * @param items - 购物车商品数组
@@ -1,5 +1,5 @@
1
1
  .pisell-lowcode__booking-tab-pane-wrap {
2
- height: 100vh;
2
+ height: 100%;
3
3
  // padding: 0 32px;
4
4
  width: 100%;
5
5
  position: relative;
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
165
165
  export declare const getDuration: (duration: number | {
166
166
  type: string;
167
167
  value: number;
168
- }) => number | {
168
+ }) => number | "flexible" | {
169
169
  type: string;
170
170
  value: number;
171
- } | "flexible";
171
+ };
172
172
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
173
173
  export declare const getIsEdit: (state: any) => boolean;
174
174
  export {};