@pisell/private-materials 6.4.50 → 6.4.51

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 (147) 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/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +3 -3
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +3 -3
  11. package/es/components/appointmentBooking/components/Services/index.js +36 -18
  12. package/es/components/appointmentBooking/hooks.js +6 -0
  13. package/es/components/booking/addons/model.d.ts +1 -10
  14. package/es/components/booking/components/footer/index.js +12 -1
  15. package/es/components/booking/editBookingModal/index.js +8 -2
  16. package/es/components/booking/forms/model.d.ts +1 -10
  17. package/es/components/booking/info/model.d.ts +1 -10
  18. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  19. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  20. package/es/components/booking/locales.d.ts +6 -0
  21. package/es/components/booking/locales.js +12 -0
  22. package/es/components/booking/model.d.ts +1 -9
  23. package/es/components/booking/notes/model.d.ts +1 -10
  24. package/es/components/booking/payments/model.d.ts +1 -10
  25. package/es/components/checkout/PaymentModal.js +70 -62
  26. package/es/components/checkout/components/AmountSummary/index.js +4 -4
  27. package/es/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
  28. package/es/components/checkout/components/CashPaymentModule/index.js +14 -10
  29. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  30. package/es/components/eftposPay/hooks.d.ts +1 -1
  31. package/es/components/eftposPay/linkly/hooks/normal.js +3 -3
  32. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +25 -4
  33. package/es/components/eftposPay/serve.js +1 -1
  34. package/es/components/eftposPay/store/index.d.ts +2 -2
  35. package/es/components/index.d.ts +3 -1
  36. package/es/components/index.js +3 -1
  37. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -3
  38. package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
  39. package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +112 -24
  40. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
  41. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.js +78 -0
  42. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
  43. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +9 -0
  44. package/es/components/pay/toC/model.d.ts +1 -9
  45. package/es/components/pay/toC/utils.js +1 -1
  46. package/es/components/pinModal/hooks.d.ts +7 -0
  47. package/es/components/pinModal/hooks.js +65 -0
  48. package/es/components/pinModal/index.d.ts +4 -0
  49. package/es/components/pinModal/index.js +98 -0
  50. package/es/components/pinModal/index.less +44 -0
  51. package/es/components/pinModal/locales.d.ts +27 -0
  52. package/es/components/pinModal/locales.js +26 -0
  53. package/es/components/pinModal/serve.d.ts +6 -0
  54. package/es/components/pinModal/serve.js +11 -0
  55. package/es/components/pinModal/types.d.ts +0 -0
  56. package/es/components/pinModal/types.js +0 -0
  57. package/es/components/pinVerifyModal/hooks.d.ts +7 -0
  58. package/es/components/pinVerifyModal/hooks.js +80 -0
  59. package/es/components/pinVerifyModal/index.d.ts +5 -0
  60. package/es/components/pinVerifyModal/index.js +218 -0
  61. package/es/components/pinVerifyModal/index.less +92 -0
  62. package/es/components/pinVerifyModal/locales.d.ts +24 -0
  63. package/es/components/pinVerifyModal/locales.js +23 -0
  64. package/es/components/pinVerifyModal/types.d.ts +33 -0
  65. package/es/components/pinVerifyModal/types.js +1 -0
  66. package/es/components/schedules/model.d.ts +1 -9
  67. package/es/components/ticketBooking/components/ticketBooking/index.js +56 -10
  68. package/es/components/ticketBooking/components/timeBar/index.js +2 -1
  69. package/es/components/wallet/Detail/model.d.ts +1 -13
  70. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  71. package/es/components/wallet/PointCard/model.d.ts +1 -13
  72. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  73. package/es/components/wallet/Voucher/model.d.ts +1 -13
  74. package/es/components/wallet/model.d.ts +1 -9
  75. package/es/components/walletList/index.js +20 -2
  76. package/es/index.d.ts +2 -0
  77. package/es/index.js +3 -1
  78. package/lib/components/appointmentBooking/components/Services/index.js +13 -3
  79. package/lib/components/appointmentBooking/hooks.js +6 -0
  80. package/lib/components/booking/addons/model.d.ts +1 -10
  81. package/lib/components/booking/components/footer/index.js +15 -2
  82. package/lib/components/booking/editBookingModal/index.js +6 -1
  83. package/lib/components/booking/forms/model.d.ts +1 -10
  84. package/lib/components/booking/info/model.d.ts +1 -10
  85. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  86. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  87. package/lib/components/booking/locales.d.ts +6 -0
  88. package/lib/components/booking/locales.js +6 -0
  89. package/lib/components/booking/model.d.ts +1 -9
  90. package/lib/components/booking/notes/model.d.ts +1 -10
  91. package/lib/components/booking/payments/model.d.ts +1 -10
  92. package/lib/components/checkout/PaymentModal.js +5 -4
  93. package/lib/components/checkout/components/AmountSummary/index.js +4 -4
  94. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
  95. package/lib/components/checkout/components/CashPaymentModule/index.js +6 -3
  96. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  97. package/lib/components/eftposPay/hooks.d.ts +1 -1
  98. package/lib/components/eftposPay/linkly/hooks/normal.js +3 -3
  99. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +16 -4
  100. package/lib/components/eftposPay/serve.js +1 -1
  101. package/lib/components/eftposPay/store/index.d.ts +2 -2
  102. package/lib/components/index.d.ts +3 -1
  103. package/lib/components/index.js +6 -0
  104. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -0
  105. package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
  106. package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +84 -36
  107. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
  108. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.js +18 -0
  109. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
  110. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +7 -2
  111. package/lib/components/pay/toC/model.d.ts +1 -9
  112. package/lib/components/pay/toC/utils.js +1 -1
  113. package/lib/components/pinModal/hooks.d.ts +7 -0
  114. package/lib/components/pinModal/hooks.js +85 -0
  115. package/lib/components/pinModal/index.d.ts +4 -0
  116. package/lib/components/pinModal/index.js +88 -0
  117. package/lib/components/pinModal/index.less +44 -0
  118. package/lib/components/pinModal/locales.d.ts +27 -0
  119. package/lib/components/pinModal/locales.js +50 -0
  120. package/lib/components/pinModal/serve.d.ts +6 -0
  121. package/lib/components/pinModal/serve.js +37 -0
  122. package/lib/components/pinModal/types.d.ts +0 -0
  123. package/lib/components/pinModal/types.js +0 -0
  124. package/lib/components/pinVerifyModal/hooks.d.ts +7 -0
  125. package/lib/components/pinVerifyModal/hooks.js +93 -0
  126. package/lib/components/pinVerifyModal/index.d.ts +5 -0
  127. package/lib/components/pinVerifyModal/index.js +230 -0
  128. package/lib/components/pinVerifyModal/index.less +92 -0
  129. package/lib/components/pinVerifyModal/locales.d.ts +24 -0
  130. package/lib/components/pinVerifyModal/locales.js +47 -0
  131. package/lib/components/pinVerifyModal/types.d.ts +33 -0
  132. package/lib/components/pinVerifyModal/types.js +17 -0
  133. package/lib/components/schedules/model.d.ts +1 -9
  134. package/lib/components/ticketBooking/components/ticketBooking/index.js +52 -5
  135. package/lib/components/ticketBooking/components/timeBar/index.js +2 -1
  136. package/lib/components/wallet/Detail/model.d.ts +1 -13
  137. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  138. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  139. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  140. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  141. package/lib/components/wallet/model.d.ts +1 -9
  142. package/lib/components/walletList/index.js +19 -2
  143. package/lib/index.d.ts +2 -0
  144. package/lib/index.js +6 -0
  145. package/lowcode/pin-modal/meta.ts +37 -0
  146. package/lowcode/pin-verify-modal/meta.ts +80 -0
  147. package/package.json +12 -12
@@ -29,6 +29,8 @@ export function CashPaymentModule(_ref) {
29
29
  roundingFunction = _ref.roundingFunction,
30
30
  _ref$balanceDueAmount = _ref.balanceDueAmount,
31
31
  balanceDueAmount = _ref$balanceDueAmount === void 0 ? '0' : _ref$balanceDueAmount,
32
+ _ref$balanceDueTotalA = _ref.balanceDueTotalAmount,
33
+ balanceDueTotalAmount = _ref$balanceDueTotalA === void 0 ? '0' : _ref$balanceDueTotalA,
32
34
  _ref$syncingLock = _ref.syncingLock,
33
35
  syncingLock = _ref$syncingLock === void 0 ? false : _ref$syncingLock;
34
36
  var _useState = useState(customAmount || ''),
@@ -56,7 +58,7 @@ export function CashPaymentModule(_ref) {
56
58
  };
57
59
  useEffect(function () {
58
60
  handleKeyboardConfirm(customAmount || '');
59
- }, [customAmount, balanceDueAmount]);
61
+ }, [customAmount, balanceDueAmount, orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.isDeposit]);
60
62
 
61
63
  // 检查是否应该禁用按钮:原本disabled为true 或者 订单金额为0
62
64
  var isAmountButtonsDisabled = disabled || Number(customAmount || 0) === 0;
@@ -119,33 +121,35 @@ export function CashPaymentModule(_ref) {
119
121
  break;
120
122
  }
121
123
  setAmount('');
122
- _context.next = 32;
124
+ _context.next = 33;
123
125
  break;
124
126
  case 13:
125
127
  // 移除可能的货币符号和多余空格
126
128
  cleanValue = finalValue.replace(/[$\s]/g, '');
127
129
  numValue = parseFloat(cleanValue); // 检查当前金额是否等于剩余支付金额
128
- balanceDue = parseFloat(balanceDueAmount);
130
+ debugger;
131
+ // 需要确认当前是否是定金模式,如果是定金模式则 balanceDue 应该为完整订单剩余待付金额
132
+ balanceDue = parseFloat(orderInfo !== null && orderInfo !== void 0 && orderInfo.isDeposit ? balanceDueTotalAmount || '0' : balanceDueAmount);
129
133
  shouldApplyRounding = Math.abs(numValue - balanceDue) < 0.01; // 使用小数精度比较
130
134
  finalAmount = numValue;
131
135
  roundingDiff = 0;
132
136
  if (!(shouldApplyRounding && roundingFunction)) {
133
- _context.next = 29;
137
+ _context.next = 30;
134
138
  break;
135
139
  }
136
- _context.next = 22;
140
+ _context.next = 23;
137
141
  return roundingFunction(numValue);
138
- case 22:
142
+ case 23:
139
143
  _result = _context.sent;
140
144
  _ref3 = _result || {}, _ref3$roundedAmount = _ref3.roundedAmount, roundedAmount = _ref3$roundedAmount === void 0 ? numValue : _ref3$roundedAmount, _ref3$roundingDiffere = _ref3.roundingDifference, roundingDifference = _ref3$roundingDiffere === void 0 ? 0 : _ref3$roundingDiffere;
141
145
  finalAmount = roundedAmount;
142
146
  roundingDiff = roundingDifference;
143
147
  console.log('应用抹零:', numValue, '->', roundedAmount, '差额:', roundingDifference);
144
- _context.next = 30;
148
+ _context.next = 31;
145
149
  break;
146
- case 29:
147
- console.log('不应用抹零,用户输入金额:', numValue, '剩余支付金额:', balanceDue);
148
150
  case 30:
151
+ console.log('不应用抹零,用户输入金额:', numValue, '剩余支付金额:', balanceDue);
152
+ case 31:
149
153
  setRoundingAmount(roundingDiff);
150
154
  if (isNaN(numValue)) {
151
155
  setAmount('');
@@ -153,7 +157,7 @@ export function CashPaymentModule(_ref) {
153
157
  setAmount(finalAmount.toString());
154
158
  console.log('设置金额为:', finalAmount);
155
159
  }
156
- case 32:
160
+ case 33:
157
161
  case "end":
158
162
  return _context.stop();
159
163
  }
@@ -17,7 +17,7 @@ export declare const useWalletPass: (props: {
17
17
  cardData: any;
18
18
  handleSelectWallet: (value: number[]) => void;
19
19
  selectedWalletIds: any[];
20
- expiredWalletIds: any;
20
+ expiredWalletIds: any[];
21
21
  expiredWalletData: any;
22
22
  disabledWalletData: any[];
23
23
  clearAllSelectedWallet: () => void;
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
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<"tyro" | "windcave" | "stripe" | "payo" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -74,7 +74,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
74
74
  var status = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.status;
75
75
 
76
76
  // 继续查询交易状态
77
- if (status === 0) {
77
+ if (status == 0) {
78
78
  var _res$data2;
79
79
  // 交易流水号
80
80
  numRef.current = res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.session_id;
@@ -89,7 +89,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
89
89
  setTimeout(function () {
90
90
  var _resultQueryRef$curre;
91
91
  (_resultQueryRef$curre = resultQueryRef.current) === null || _resultQueryRef$curre === void 0 || _resultQueryRef$curre.call(resultQueryRef);
92
- });
92
+ }, 300);
93
93
  return;
94
94
  }
95
95
 
@@ -99,7 +99,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
99
99
  }));
100
100
 
101
101
  // 交易成功
102
- if (status === 1) {
102
+ if (status == 1) {
103
103
  var _handleLinklySuccessR;
104
104
  (_handleLinklySuccessR = handleLinklySuccessRef.current) === null || _handleLinklySuccessR === void 0 || _handleLinklySuccessR.call(handleLinklySuccessRef, res);
105
105
  return;
@@ -86,15 +86,22 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
86
86
  isQueryFinishedRef.current = true;
87
87
  var data = (result === null || result === void 0 ? void 0 : result.data) || {};
88
88
  // 交易成功,终止查询
89
- if (data.status === 1) {
89
+ if (data.status == 1) {
90
90
  console.log('交易成功,终止查询');
91
+ sendWarningLog({
92
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u6210\u529F"),
93
+ content: [{
94
+ key: 'response',
95
+ value: JSON.stringify(result)
96
+ }]
97
+ });
91
98
  reset();
92
99
  handleLinklySuccess(result);
93
100
  return;
94
101
  }
95
102
 
96
103
  // 交易状态为0,且不需要签名,则继续查询
97
- if (data.status !== undefined && (data === null || data === void 0 ? void 0 : data.status) === 0) {
104
+ if ((data === null || data === void 0 ? void 0 : data.status) == 0 && (data === null || data === void 0 ? void 0 : data.signature_flag) != 1) {
98
105
  console.log('交易状态为0需要继续查询');
99
106
  isQueryFinishedRef.current = false;
100
107
  _resultQuery();
@@ -105,6 +112,13 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
105
112
  if (data.status < 0) {
106
113
  var _failRef$current;
107
114
  console.log('交易失败,终止查询');
115
+ sendWarningLog({
116
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u5931\u8D25"),
117
+ content: [{
118
+ key: 'response',
119
+ value: JSON.stringify(result)
120
+ }]
121
+ });
108
122
  reset();
109
123
  // 交易失败,code码转换为支付失败code码
110
124
  result.code = PayStatus.Unknown;
@@ -113,8 +127,15 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
113
127
  }
114
128
 
115
129
  // 需要签名
116
- if (data.signature_flag === 1) {
130
+ if (data.signature_flag == 1) {
117
131
  console.log('交易需要签名,终止查询');
132
+ sendWarningLog({
133
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u9700\u8981\u7B7E\u540D"),
134
+ content: [{
135
+ key: 'response',
136
+ value: JSON.stringify(result)
137
+ }]
138
+ });
118
139
  reset();
119
140
  gotoSignature();
120
141
  return;
@@ -240,7 +261,7 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
240
261
  });
241
262
  }
242
263
  sendWarningLog({
243
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u7ED3\u679C\u67E5\u8BE2--").concat(type),
264
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u7ED3\u679C\u8F6E\u8BE2"),
244
265
  content: content
245
266
  });
246
267
  };
@@ -232,7 +232,7 @@ export var linklyPayQuery = /*#__PURE__*/function () {
232
232
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
233
233
  while (1) switch (_context15.prev = _context15.next) {
234
234
  case 0:
235
- return _context15.abrupt("return", request.getRequest().get('/shop/shop/linkly/pay/query', params, config));
235
+ return _context15.abrupt("return", request.getRequest().get('/shop/linkly/pay/query', params, config));
236
236
  case 1:
237
237
  case "end":
238
238
  return _context15.stop();
@@ -297,8 +297,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  amount?: string | number | undefined;
298
298
  mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
301
- action?: "pay" | "amount" | "deviceList" | undefined;
300
+ eftpos?: "tyro" | "windcave" | "stripe" | "payo" | "linkly" | undefined;
301
+ action?: "amount" | "pay" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
304
304
  title?: string | undefined;
@@ -17,4 +17,6 @@ import PisellSelectCustomerModal from './pisellSelectCustomerModal';
17
17
  import SubTotal from './subTotal';
18
18
  import EditBookingModal from './booking/editBookingModal';
19
19
  import StepController from './stepController';
20
- export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController };
20
+ import PinModal from './pinModal';
21
+ import PinVerifyModal from './pinVerifyModal';
22
+ export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController, PinModal, PinVerifyModal, };
@@ -17,4 +17,6 @@ import PisellSelectCustomerModal from "./pisellSelectCustomerModal";
17
17
  import SubTotal from "./subTotal";
18
18
  import EditBookingModal from "./booking/editBookingModal";
19
19
  import StepController from "./stepController";
20
- export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController };
20
+ import PinModal from "./pinModal";
21
+ import PinVerifyModal from "./pinVerifyModal";
22
+ export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController, PinModal, PinVerifyModal };
@@ -262,7 +262,9 @@ export var createThreeDSMethodIframe = /*#__PURE__*/function () {
262
262
  }
263
263
  return _context3.abrupt("return", defaultReturnParams);
264
264
  case 5:
265
- displayBox = document.getElementById('threeds-container'); // 创建iframe
265
+ displayBox = document.getElementById('threeds-container'); // 清空dom中的内容
266
+ displayBox.innerHTML = '';
267
+ // 创建iframe
266
268
  iframe = document.createElement('iframe'); // iframe.src = "about:blank";
267
269
  iframe.classList.add('hidden_TDS_From');
268
270
  iframe.name = 'threeDSMethodIframe';
@@ -315,7 +317,7 @@ export var createThreeDSMethodIframe = /*#__PURE__*/function () {
315
317
  }
316
318
  }, false);
317
319
  }));
318
- case 27:
320
+ case 28:
319
321
  case "end":
320
322
  return _context3.stop();
321
323
  }
@@ -436,7 +438,8 @@ export var checkTDSAuth = /*#__PURE__*/function () {
436
438
  */
437
439
  export var createChallengeIframe = function createChallengeIframe(challengeData, callback) {
438
440
  var displayBox = document.getElementById('threeds-container');
439
-
441
+ // 清空dom中的内容
442
+ displayBox.innerHTML = '';
440
443
  // 创建iframe
441
444
  var iframe = document.createElement('iframe');
442
445
  iframe.classList.add('tdsv2challengeIframe');
@@ -11,6 +11,8 @@ export interface WalletPassListProps {
11
11
  name: string;
12
12
  };
13
13
  onChangeDebounce?: boolean;
14
+ loading?: boolean;
15
+ onLoadingChange?: (loading: boolean) => void;
14
16
  }
15
17
  export declare type WalletPassListRef = {
16
18
  init: (params: MachineCodeListParams, formatList?: (val: WalletPassDataType[]) => WalletPassDataType[]) => void;
@@ -22,18 +22,22 @@ import { PisellModal, PisellText, PisellToast } from '@pisell/materials';
22
22
  import { locales, uniqueByKey } from '@pisell/utils';
23
23
  import { useMemoizedFn } from 'ahooks';
24
24
  import { InfoCircleOutlined } from '@ant-design/icons';
25
+ import PinVerifyModal from "../../../../pinVerifyModal";
25
26
  import MultiModeSearch from "./MultiModeSearch";
26
27
  import List from "./List";
27
- import { searchMachineCodeList } from "./serve";
28
- import { formatMachineCodeServer2CardList } from "./utils";
28
+ import { searchMachineCodeList, searchWalletCode } from "./serve";
29
+ import { formatMachineCodeServer2CardList, getIsWalletCode } from "./utils";
29
30
  import { calcWalletPassListAmount, formatWalletPassList2PreparePayments } from "../../utils";
30
31
  import "./index.less";
32
+ import useEngineContext from "../../../../../hooks/useEngineContext";
31
33
  var Amount = PisellText.Amount;
32
34
  var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
33
- var _searchSelectData$ids;
35
+ var _context$appHelper, _context$appHelper$ge, _searchSelectData$ids;
34
36
  var onWalletPassChange = props.onWalletPassChange,
35
37
  walletPass = props.walletPass,
36
38
  walletSetting = props.walletSetting;
39
+ var context = useEngineContext();
40
+ var isWalletCode = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.businessUtils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getAppByModal) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper, 'wallet');
37
41
 
38
42
  /** 当前 walletPass信息 弹窗操作时都在内部进行,点击 redeem时同步到外层 */
39
43
  var _useState = useState(walletPass),
@@ -87,7 +91,8 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
87
91
  var listRef = useRef(null);
88
92
 
89
93
  /** 当前搜索框搜索值 */
90
- var searchValRef = useRef('');
94
+ var searchValRef = useRef(null);
95
+ var pinVerifyModalRef = useRef(null);
91
96
  var _ref = currentWalletPass || {},
92
97
  walletPassSelectCards = _ref.cards,
93
98
  amount = _ref.amount;
@@ -207,30 +212,33 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
207
212
  * @param val
208
213
  */
209
214
  var searchList = /*#__PURE__*/function () {
210
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(val, isSelectChange) {
211
- var _order$_order2;
212
- var result;
215
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3, isSelectChange) {
216
+ var code, customer_pin_key, _order$_order2, result;
213
217
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
214
218
  while (1) switch (_context2.prev = _context2.next) {
215
219
  case 0:
220
+ code = _ref3.code, customer_pin_key = _ref3.customer_pin_key;
216
221
  if (order !== null && order !== void 0 && order.order_id) {
217
- _context2.next = 2;
222
+ _context2.next = 3;
218
223
  break;
219
224
  }
220
225
  return _context2.abrupt("return");
221
- case 2:
222
- _context2.next = 4;
226
+ case 3:
227
+ setLoading(true);
228
+ _context2.prev = 4;
229
+ _context2.next = 7;
223
230
  return searchMachineCodeList({
224
231
  order_id: order.order_id,
225
- code: val,
232
+ code: code,
226
233
  prepare_payments: prepare_payments,
227
- filter_prepare_wallet_pass: 1,
228
- sale_channel: ((_order$_order2 = order._order) === null || _order$_order2 === void 0 ? void 0 : _order$_order2.sale_channel) || 'online-store'
234
+ // filter_prepare_wallet_pass: 1,
235
+ sale_channel: ((_order$_order2 = order._order) === null || _order$_order2 === void 0 ? void 0 : _order$_order2.sale_channel) || 'online-store',
236
+ customer_pin_key: customer_pin_key
229
237
  });
230
- case 4:
238
+ case 7:
231
239
  result = _context2.sent;
232
240
  if (result) {
233
- _context2.next = 8;
241
+ _context2.next = 11;
234
242
  break;
235
243
  }
236
244
  if (!isSelectChange) {
@@ -239,7 +247,13 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
239
247
  });
240
248
  }
241
249
  return _context2.abrupt("return");
242
- case 8:
250
+ case 11:
251
+ if (!(isSelectChange && !searchValRef.current)) {
252
+ _context2.next = 13;
253
+ break;
254
+ }
255
+ return _context2.abrupt("return");
256
+ case 13:
243
257
  setSearchData(formatMachineCodeServer2CardList([].concat(_toConsumableArray(searchSelectData.details), _toConsumableArray(result)), searchSelectData.ids));
244
258
  if (result.length) {
245
259
  // 如果搜索结果只有一个并且可用,则直接选中
@@ -250,22 +264,88 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
250
264
  });
251
265
  }
252
266
  setSearchOpen(true);
253
- searchValRef.current = val;
267
+ searchValRef.current = {
268
+ code: code,
269
+ customer_pin_key: customer_pin_key
270
+ };
254
271
  }
255
- case 10:
272
+ case 15:
273
+ _context2.prev = 15;
274
+ setLoading(false);
275
+ return _context2.finish(15);
276
+ case 18:
256
277
  case "end":
257
278
  return _context2.stop();
258
279
  }
259
- }, _callee2);
280
+ }, _callee2, null, [[4,, 15, 18]]);
260
281
  }));
261
282
  return function searchList(_x2, _x3) {
262
- return _ref3.apply(this, arguments);
283
+ return _ref4.apply(this, arguments);
284
+ };
285
+ }();
286
+ var searchWalletCodeFn = /*#__PURE__*/function () {
287
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val) {
288
+ var _pinVerifyModalRef$cu, result;
289
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
290
+ while (1) switch (_context3.prev = _context3.next) {
291
+ case 0:
292
+ setLoading(true);
293
+ _context3.prev = 1;
294
+ _context3.next = 4;
295
+ return searchWalletCode({
296
+ code: val,
297
+ with_customer: 1
298
+ });
299
+ case 4:
300
+ result = _context3.sent;
301
+ console.log(result, 'result');
302
+ // 如果搜索不到wallet code则走原始搜索逻辑
303
+ if (result) {
304
+ _context3.next = 9;
305
+ break;
306
+ }
307
+ searchList({
308
+ code: val
309
+ });
310
+ return _context3.abrupt("return");
311
+ case 9:
312
+ (_pinVerifyModalRef$cu = pinVerifyModalRef.current) === null || _pinVerifyModalRef$cu === void 0 || _pinVerifyModalRef$cu.open({
313
+ wallet_code: result.code,
314
+ wallet_detail_id: result.id,
315
+ failed_count: result.failed_count,
316
+ check_max_count: result.check_max_count,
317
+ customer: result.customer
318
+ });
319
+ // const pin = await getPin({ wallet_detail_id: result.id });
320
+ // const pinResult = await verifyPinCode({ wallet_detail_id: result.id, pin: pin.pin });
321
+ // searchList({ customer_pin_key: pinResult.customer_pin_key });
322
+ // console.log(pinResult, 'pinResult');
323
+ case 10:
324
+ _context3.prev = 10;
325
+ setLoading(false);
326
+ return _context3.finish(10);
327
+ case 13:
328
+ case "end":
329
+ return _context3.stop();
330
+ }
331
+ }, _callee3, null, [[1,, 10, 13]]);
332
+ }));
333
+ return function searchWalletCodeFn(_x4) {
334
+ return _ref5.apply(this, arguments);
263
335
  };
264
336
  }();
265
337
  var handleSearch = useMemoizedFn(function (val) {
266
338
  if (!val || searchOpen) return;
267
339
  isAutoSelect.current = true;
268
- searchList(val);
340
+
341
+ // 如果是wallet code 并且安装wallet应用 则搜索wallet code
342
+ if (getIsWalletCode(val) && isWalletCode) {
343
+ searchWalletCodeFn(val);
344
+ } else {
345
+ searchList({
346
+ code: val
347
+ });
348
+ }
269
349
  });
270
350
  useImperativeHandle(ref, function () {
271
351
  return {
@@ -274,7 +354,7 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
274
354
  });
275
355
  var handleSearchModalClose = function handleSearchModalClose() {
276
356
  setSearchOpen(false);
277
- searchValRef.current = '';
357
+ searchValRef.current = null;
278
358
  setSearchSelectData({
279
359
  ids: [],
280
360
  details: []
@@ -398,7 +478,15 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
398
478
  walletSetting: walletSetting,
399
479
  data: searchData,
400
480
  value: searchSelectData.ids,
401
- onChange: handleAddChange
402
- }))));
481
+ onChange: handleAddChange,
482
+ loading: loading
483
+ }))), /*#__PURE__*/React.createElement(PinVerifyModal, {
484
+ ref: pinVerifyModalRef,
485
+ onSuccess: function onSuccess(params) {
486
+ searchList({
487
+ customer_pin_key: params === null || params === void 0 ? void 0 : params.customer_pin_key
488
+ });
489
+ }
490
+ }));
403
491
  });
404
492
  export default /*#__PURE__*/memo(WalletPass);
@@ -84,14 +84,15 @@ export declare const getRecommendMachineCodeList: (order_id: number) => Promise<
84
84
  */
85
85
  export declare const searchMachineCodeList: (params: {
86
86
  order_id: number | string;
87
- code: string;
87
+ code?: string;
88
88
  sale_channel: string;
89
89
  prepare_payments: {
90
90
  voucher_id: number;
91
91
  amount: number;
92
92
  tag: string;
93
93
  }[];
94
- filter_prepare_wallet_pass: 1 | 0;
94
+ filter_prepare_wallet_pass?: 1 | 0;
95
+ customer_pin_key?: string;
95
96
  }) => Promise<WalletPassDataType[]>;
96
97
  /**
97
98
  * walletpass支付
@@ -110,4 +111,39 @@ export declare const walletPassPay: (params: {
110
111
  };
111
112
  }[];
112
113
  }) => Promise<WalletPassDataType[]>;
114
+ /**
115
+ * 搜索wallet code
116
+ */
117
+ export declare const searchWalletCode: (params: {
118
+ code: string;
119
+ with_customer: 1 | 0;
120
+ }) => Promise<{
121
+ code: string;
122
+ id: number;
123
+ status: 'enable' | 'disable' | 'expired';
124
+ expired_at: string;
125
+ customer: Record<string, any>;
126
+ check_max_count: number;
127
+ failed_count: number;
128
+ }>;
129
+ /**
130
+ * 验证pin码
131
+ */
132
+ export declare const verifyPinCode: (params: {
133
+ wallet_detail_id: number;
134
+ pin: string;
135
+ }) => Promise<{
136
+ status: number;
137
+ customer_id: number;
138
+ msg: string;
139
+ customer_pin_key: string;
140
+ }>;
141
+ /**
142
+ * 获取pin码
143
+ */
144
+ export declare const getPin: (params: {
145
+ wallet_detail_id: number;
146
+ }) => Promise<{
147
+ pin: string;
148
+ }>;
113
149
  export {};
@@ -111,4 +111,82 @@ export var walletPassPay = /*#__PURE__*/function () {
111
111
  return function walletPassPay(_x4) {
112
112
  return _ref4.apply(this, arguments);
113
113
  };
114
+ }();
115
+
116
+ /**
117
+ * 搜索wallet code
118
+ */
119
+ export var searchWalletCode = /*#__PURE__*/function () {
120
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
121
+ var _yield$request$getReq5, data;
122
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
123
+ while (1) switch (_context5.prev = _context5.next) {
124
+ case 0:
125
+ _context5.next = 2;
126
+ return request.getRequest().post("/h5/wallet/detail/search", params);
127
+ case 2:
128
+ _yield$request$getReq5 = _context5.sent;
129
+ data = _yield$request$getReq5.data;
130
+ return _context5.abrupt("return", data);
131
+ case 5:
132
+ case "end":
133
+ return _context5.stop();
134
+ }
135
+ }, _callee5);
136
+ }));
137
+ return function searchWalletCode(_x5) {
138
+ return _ref5.apply(this, arguments);
139
+ };
140
+ }();
141
+
142
+ /**
143
+ * 验证pin码
144
+ */
145
+ export var verifyPinCode = /*#__PURE__*/function () {
146
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
147
+ var _yield$request$getReq6, data;
148
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
149
+ while (1) switch (_context6.prev = _context6.next) {
150
+ case 0:
151
+ _context6.next = 2;
152
+ return request.getRequest().post("/h5/wallet/detail/pin/validate", params);
153
+ case 2:
154
+ _yield$request$getReq6 = _context6.sent;
155
+ data = _yield$request$getReq6.data;
156
+ return _context6.abrupt("return", data);
157
+ case 5:
158
+ case "end":
159
+ return _context6.stop();
160
+ }
161
+ }, _callee6);
162
+ }));
163
+ return function verifyPinCode(_x6) {
164
+ return _ref6.apply(this, arguments);
165
+ };
166
+ }();
167
+
168
+ /**
169
+ * 获取pin码
170
+ */
171
+ export var getPin = /*#__PURE__*/function () {
172
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
173
+ var _yield$request$getReq7, data;
174
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
175
+ while (1) switch (_context7.prev = _context7.next) {
176
+ case 0:
177
+ _context7.next = 2;
178
+ return request.getRequest().get("/h5/wallet/detail/pin", params);
179
+ case 2:
180
+ _yield$request$getReq7 = _context7.sent;
181
+ data = _yield$request$getReq7.data;
182
+ return _context7.abrupt("return", data);
183
+ case 5:
184
+ case "end":
185
+ return _context7.stop();
186
+ }
187
+ }, _callee7);
188
+ }));
189
+ return function getPin(_x7) {
190
+ return _ref7.apply(this, arguments);
191
+ };
114
192
  }();
@@ -1,3 +1,9 @@
1
1
  import { WalletPassDataType } from './serve';
2
2
  export declare const formatMachineCodeServer2CardList: (data: WalletPassDataType[], selectId?: number[]) => any;
3
3
  export declare const getDataByIds: (arr: any[], ids: number[]) => any[];
4
+ /**
5
+ * 判断是否是wallet code
6
+ * @param val
7
+ * @returns
8
+ */
9
+ export declare const getIsWalletCode: (val: string) => boolean;
@@ -38,4 +38,13 @@ export var getDataByIds = function getDataByIds(arr, ids) {
38
38
  return arr.filter(function (item) {
39
39
  return ids.includes(item.id);
40
40
  });
41
+ };
42
+
43
+ /**
44
+ * 判断是否是wallet code
45
+ * @param val
46
+ * @returns
47
+ */
48
+ export var getIsWalletCode = function getIsWalletCode(val) {
49
+ return val.startsWith('WL');
41
50
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface FormState {
3
2
  platform: 'pc' | 'h5' | '' | undefined;
4
3
  order: any;
@@ -29,11 +28,4 @@ export interface PayGroup {
29
28
  pay_number?: string;
30
29
  _order: any;
31
30
  }
32
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
33
- state: FormState;
34
- } & {
35
- dispatch: (params: {
36
- type: string;
37
- payload: any;
38
- }) => void;
39
- }>;
31
+ export declare const Provider: any, Context: any;