@pisell/private-materials 6.6.62 → 6.6.63

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 (203) 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 +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/components/footer/amount.js +4 -3
  12. package/es/components/booking/components/footer/utils.js +10 -3
  13. package/es/components/booking/components/voucher/index.js +1 -1
  14. package/es/components/booking/info2/service/editService/index.js +76 -8
  15. package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
  16. package/es/components/booking/info2/service/editService/utils.js +16 -0
  17. package/es/components/booking/payments/index.js +1 -1
  18. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  19. package/es/components/eftpos/PairModal/hooks.d.ts +27 -0
  20. package/es/components/eftpos/PairModal/hooks.js +67 -0
  21. package/es/components/eftpos/PairModal/index.d.ts +11 -0
  22. package/es/components/eftpos/PairModal/index.js +246 -0
  23. package/es/components/eftpos/PairModal/index.less +70 -0
  24. package/es/components/eftpos/SettlementModal/Action.d.ts +7 -0
  25. package/es/components/eftpos/SettlementModal/Action.js +141 -0
  26. package/es/components/eftpos/SettlementModal/index.d.ts +7 -0
  27. package/es/components/eftpos/SettlementModal/index.js +135 -0
  28. package/es/components/eftpos/SettlementModal/index.less +33 -0
  29. package/es/components/eftpos/SettlementModal/serve.d.ts +8 -0
  30. package/es/components/eftpos/SettlementModal/serve.js +171 -0
  31. package/es/components/eftpos/SettlementModal/types.d.ts +138 -0
  32. package/es/components/eftpos/SettlementModal/types.js +35 -0
  33. package/es/components/eftpos/SettlementModal/utils.d.ts +18 -0
  34. package/es/components/eftpos/SettlementModal/utils.js +351 -0
  35. package/es/components/eftpos/assets/mx51SCI.svg +15 -0
  36. package/es/components/eftpos/const.d.ts +3 -1
  37. package/es/components/eftpos/const.js +2 -0
  38. package/es/components/eftpos/device.d.ts +3 -1
  39. package/es/components/eftpos/device.js +14 -3
  40. package/es/components/eftpos/hooks.d.ts +13 -0
  41. package/es/components/eftpos/hooks.js +35 -0
  42. package/es/components/eftpos/index.js +198 -24
  43. package/es/components/eftpos/index.less +32 -1
  44. package/es/components/eftpos/locales.d.ts +80 -0
  45. package/es/components/eftpos/locales.js +205 -25
  46. package/es/components/eftpos/table.js +47 -3
  47. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  48. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  49. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +145 -0
  50. package/es/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  51. package/es/components/eftposPay/aggregatePayment/index.js +2 -1
  52. package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  53. package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
  54. package/es/components/eftposPay/aggregatePayment/service.js +1 -0
  55. package/es/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  56. package/es/components/eftposPay/aggregatePayment/types.js +4 -8
  57. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  58. package/es/components/eftposPay/aggregatePayment/utils/payment.js +231 -168
  59. package/es/components/eftposPay/amount.js +15 -1
  60. package/es/components/eftposPay/app.js +2 -3
  61. package/es/components/eftposPay/component/fail/failCustom.js +13 -4
  62. package/es/components/eftposPay/component/fail/index.js +12 -5
  63. package/es/components/eftposPay/component/fail/network.js +3 -0
  64. package/es/components/eftposPay/component/fail/unknow.js +8 -0
  65. package/es/components/eftposPay/component/manual/index.js +17 -3
  66. package/es/components/eftposPay/component/signature/index.js +3 -0
  67. package/es/components/eftposPay/const.d.ts +8 -3
  68. package/es/components/eftposPay/const.js +2 -0
  69. package/es/components/eftposPay/device.js +225 -38
  70. package/es/components/eftposPay/helper.d.ts +3 -0
  71. package/es/components/eftposPay/helper.js +2 -1
  72. package/es/components/eftposPay/hooks.d.ts +1 -1
  73. package/es/components/eftposPay/index.js +50 -13
  74. package/es/components/eftposPay/linkly/const.js +1 -1
  75. package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
  76. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
  77. package/es/components/eftposPay/linkly/index.js +11 -23
  78. package/es/components/eftposPay/locales.d.ts +15 -0
  79. package/es/components/eftposPay/locales.js +30 -15
  80. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  81. package/es/components/eftposPay/manufacturer.js +4 -0
  82. package/es/components/eftposPay/mx51/Action.d.ts +6 -0
  83. package/es/components/eftposPay/mx51/Action.js +144 -0
  84. package/es/components/eftposPay/mx51/const.d.ts +5 -0
  85. package/es/components/eftposPay/mx51/const.js +69 -0
  86. package/es/components/eftposPay/mx51/index.d.ts +6 -0
  87. package/es/components/eftposPay/mx51/index.js +498 -0
  88. package/es/components/eftposPay/mx51/types.d.ts +142 -0
  89. package/es/components/eftposPay/mx51/types.js +35 -0
  90. package/es/components/eftposPay/mx51/utils.d.ts +10 -0
  91. package/es/components/eftposPay/mx51/utils.js +121 -0
  92. package/es/components/eftposPay/pay.js +21 -9
  93. package/es/components/eftposPay/payo/config.js +39 -5
  94. package/es/components/eftposPay/payo/const.js +1 -1
  95. package/es/components/eftposPay/payo/hooks.js +3 -12
  96. package/es/components/eftposPay/payo/payment.js +69 -136
  97. package/es/components/eftposPay/store/index.d.ts +4 -8
  98. package/es/components/eftposPay/tip.js +5 -0
  99. package/es/components/eftposPay/tyro/const.js +1 -1
  100. package/es/components/eftposPay/tyro/index.js +44 -11
  101. package/es/components/eftposPay/utils/payLog.d.ts +81 -0
  102. package/es/components/eftposPay/utils/payLog.js +458 -0
  103. package/es/components/eftposPay/windcave/const.js +1 -1
  104. package/es/components/eftposPay/windcave/receiptAction.js +5 -0
  105. package/es/components/eftposPay/windcave/windcave.js +37 -38
  106. package/lib/components/booking/components/footer/amount.js +3 -3
  107. package/lib/components/booking/components/footer/utils.js +12 -5
  108. package/lib/components/booking/components/voucher/index.js +1 -1
  109. package/lib/components/booking/info2/service/editService/index.js +56 -5
  110. package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
  111. package/lib/components/booking/info2/service/editService/utils.js +16 -0
  112. package/lib/components/booking/payments/index.js +1 -1
  113. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  114. package/lib/components/eftpos/PairModal/hooks.d.ts +27 -0
  115. package/lib/components/eftpos/PairModal/hooks.js +70 -0
  116. package/lib/components/eftpos/PairModal/index.d.ts +11 -0
  117. package/lib/components/eftpos/PairModal/index.js +197 -0
  118. package/lib/components/eftpos/PairModal/index.less +70 -0
  119. package/lib/components/eftpos/SettlementModal/Action.d.ts +7 -0
  120. package/lib/components/eftpos/SettlementModal/Action.js +153 -0
  121. package/lib/components/eftpos/SettlementModal/index.d.ts +7 -0
  122. package/lib/components/eftpos/SettlementModal/index.js +170 -0
  123. package/lib/components/eftpos/SettlementModal/index.less +33 -0
  124. package/lib/components/eftpos/SettlementModal/serve.d.ts +8 -0
  125. package/lib/components/eftpos/SettlementModal/serve.js +45 -0
  126. package/lib/components/eftpos/SettlementModal/types.d.ts +138 -0
  127. package/lib/components/eftpos/SettlementModal/types.js +43 -0
  128. package/lib/components/eftpos/SettlementModal/utils.d.ts +18 -0
  129. package/lib/components/eftpos/SettlementModal/utils.js +248 -0
  130. package/lib/components/eftpos/assets/mx51SCI.svg +15 -0
  131. package/lib/components/eftpos/const.d.ts +3 -1
  132. package/lib/components/eftpos/const.js +2 -0
  133. package/lib/components/eftpos/device.d.ts +3 -1
  134. package/lib/components/eftpos/device.js +13 -3
  135. package/lib/components/eftpos/hooks.d.ts +13 -0
  136. package/lib/components/eftpos/hooks.js +30 -0
  137. package/lib/components/eftpos/index.js +121 -8
  138. package/lib/components/eftpos/index.less +32 -1
  139. package/lib/components/eftpos/locales.d.ts +80 -0
  140. package/lib/components/eftpos/locales.js +231 -21
  141. package/lib/components/eftpos/table.js +30 -2
  142. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  143. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  144. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +171 -0
  145. package/lib/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  146. package/lib/components/eftposPay/aggregatePayment/index.js +5 -2
  147. package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  148. package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
  149. package/lib/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  150. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  151. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +173 -123
  152. package/lib/components/eftposPay/amount.js +13 -1
  153. package/lib/components/eftposPay/app.js +4 -5
  154. package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
  155. package/lib/components/eftposPay/component/fail/index.js +10 -2
  156. package/lib/components/eftposPay/component/fail/network.js +3 -0
  157. package/lib/components/eftposPay/component/fail/unknow.js +8 -0
  158. package/lib/components/eftposPay/component/manual/index.js +16 -2
  159. package/lib/components/eftposPay/component/signature/index.js +3 -0
  160. package/lib/components/eftposPay/const.d.ts +8 -3
  161. package/lib/components/eftposPay/const.js +2 -0
  162. package/lib/components/eftposPay/device.js +114 -25
  163. package/lib/components/eftposPay/helper.d.ts +3 -0
  164. package/lib/components/eftposPay/helper.js +2 -1
  165. package/lib/components/eftposPay/hooks.d.ts +1 -1
  166. package/lib/components/eftposPay/index.js +38 -13
  167. package/lib/components/eftposPay/linkly/const.js +1 -1
  168. package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
  169. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
  170. package/lib/components/eftposPay/linkly/index.js +8 -10
  171. package/lib/components/eftposPay/locales.d.ts +15 -0
  172. package/lib/components/eftposPay/locales.js +30 -15
  173. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  174. package/lib/components/eftposPay/manufacturer.js +6 -0
  175. package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
  176. package/lib/components/eftposPay/mx51/Action.js +154 -0
  177. package/lib/components/eftposPay/mx51/const.d.ts +5 -0
  178. package/lib/components/eftposPay/mx51/const.js +85 -0
  179. package/lib/components/eftposPay/mx51/index.d.ts +6 -0
  180. package/lib/components/eftposPay/mx51/index.js +433 -0
  181. package/lib/components/eftposPay/mx51/types.d.ts +142 -0
  182. package/lib/components/eftposPay/mx51/types.js +43 -0
  183. package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
  184. package/lib/components/eftposPay/mx51/utils.js +115 -0
  185. package/lib/components/eftposPay/pay.js +13 -3
  186. package/lib/components/eftposPay/payo/config.js +16 -8
  187. package/lib/components/eftposPay/payo/const.js +1 -1
  188. package/lib/components/eftposPay/payo/hooks.js +12 -10
  189. package/lib/components/eftposPay/payo/payment.js +31 -65
  190. package/lib/components/eftposPay/store/index.d.ts +4 -8
  191. package/lib/components/eftposPay/tip.js +5 -0
  192. package/lib/components/eftposPay/tyro/const.js +1 -1
  193. package/lib/components/eftposPay/tyro/index.js +21 -17
  194. package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
  195. package/lib/components/eftposPay/utils/payLog.js +321 -0
  196. package/lib/components/eftposPay/windcave/const.js +1 -1
  197. package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
  198. package/lib/components/eftposPay/windcave/windcave.js +27 -29
  199. package/package.json +2 -2
  200. package/es/components/eftposPay/utils/log/index.d.ts +0 -110
  201. package/es/components/eftposPay/utils/log/index.js +0 -371
  202. package/lib/components/eftposPay/utils/log/index.d.ts +0 -110
  203. package/lib/components/eftposPay/utils/log/index.js +0 -294
@@ -17,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  /* eslint-disable consistent-return */
18
18
  /* eslint-disable react/no-array-index-key */
19
19
  /* eslint-disable array-callback-return */
20
- import { locales, sendWarningLog } from '@pisell/utils';
20
+ import { locales } from '@pisell/utils';
21
21
  import React, { useEffect, useMemo, useRef, useState } from 'react';
22
22
  import Step from "../component/step/step";
23
23
  import { ModeEnum, StatusEnum } from "../const";
@@ -26,6 +26,7 @@ import { useStoreRef } from "../hooks";
26
26
  import { updateCustom, updateState, useContextData, useDispatch } from "../store";
27
27
  import { StemTypeEnum, StepStatusEnum, getStepMapping } from "./const";
28
28
  import { useFail, useValidate } from "./helper";
29
+ import payLog from "../utils/payLog";
29
30
  import Action, { ReceiptAction } from "./receiptAction";
30
31
  var Minute = 1000 * 60;
31
32
 
@@ -59,7 +60,7 @@ export default (function (_ref) {
59
60
  var stepRef = useRef(custom === null || custom === void 0 ? void 0 : custom.step);
60
61
  var listRef = useRef(custom === null || custom === void 0 ? void 0 : custom.list);
61
62
  var initRef = useRef(false);
62
- var clearRef = useRef();
63
+ var clearRef = useRef(null);
63
64
 
64
65
  /** 是否是签名页面 */
65
66
  var isReceiptPage = useMemo(function () {
@@ -146,9 +147,11 @@ export default (function (_ref) {
146
147
  // 是否在签名步骤
147
148
  if (stepRef.current === StepStatusEnum.Receipt) {
148
149
  if (StatusEnum.Loading === statusRef.current) {
150
+ payLog.log('Windcave:签名页面处于运行中(已发送签名,或取消签名接口),进行计时查询');
149
151
  // 签名页面处于运行中(已发送签名,或取消签名接口),则进行计时查询
150
152
  run();
151
153
  } else {
154
+ payLog.log('Windcave:签名页面处于未加载中,进行无限查询');
152
155
  // 签名页面处于未加载中,则进行无限查询
153
156
  run(-1);
154
157
  }
@@ -162,9 +165,6 @@ export default (function (_ref) {
162
165
  run();
163
166
  return;
164
167
  }
165
-
166
- // 不存在支付流水号 则去创建支付
167
- console.log('modeRef.current = ', modeRef.current);
168
168
  numRef.current = getUuid();
169
169
  dispatch(updateState({
170
170
  number: numRef.current
@@ -174,16 +174,16 @@ export default (function (_ref) {
174
174
  if (isPay) {
175
175
  var _deviceRef$current2;
176
176
  _params = _objectSpread(_objectSpread({}, custom !== null && custom !== void 0 && custom.platform ? {
177
- "operator_id": custom.operator_id,
178
- "operator_type": custom.operator_type,
179
- "platform": custom.platform,
180
- "custom_payment_id": custom.custom_payment_id,
181
- "service_charge": {
182
- "amount": payRef.current.surMoney,
183
- "percentage": payRef.current.surPercentRate
184
- },
185
- "original_amount": payRef.current.amount
177
+ operator_id: custom.operator_id,
178
+ operator_type: custom.operator_type,
179
+ platform: custom.platform,
180
+ custom_payment_id: custom.custom_payment_id
186
181
  } : {}), {}, {
182
+ service_charge: {
183
+ amount: payRef.current.surMoney,
184
+ percentage: payRef.current.surPercentRate
185
+ },
186
+ original_amount: payRef.current.amount,
187
187
  order_id: orderIdRef.current,
188
188
  amount: payRef.current.total,
189
189
  card_reader_type: eftposRef.current,
@@ -206,6 +206,18 @@ export default (function (_ref) {
206
206
  })))))
207
207
  };
208
208
  }
209
+ payLog.setContext({
210
+ transactionNumber: numRef.current
211
+ });
212
+ if (isPay) {
213
+ payLog.log('Windcave:发起支付', {
214
+ number: numRef.current
215
+ });
216
+ } else {
217
+ payLog.log('Windcave:发起退款', {
218
+ number: numRef.current
219
+ });
220
+ }
209
221
  var resultPromise = isPay ? api.pay(_params, {
210
222
  signal: controllerRef.current.signal
211
223
  }) : api.refund(_params, {
@@ -218,39 +230,24 @@ export default (function (_ref) {
218
230
  return;
219
231
  }
220
232
  if (res && "".concat(res.code) === '200' && res.data && res.data.txn_status_id) {
221
- var _validateRef$current;
233
+ var _res$data, _validateRef$current;
234
+ payLog.log('Windcave:接口成功,进入轮询', {
235
+ txn_status_id: res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.txn_status_id
236
+ });
222
237
  (_validateRef$current = validateRef.current) === null || _validateRef$current === void 0 || _validateRef$current.call(validateRef, res, true);
223
238
  return;
224
239
  }
225
- sendWarningLog({
226
- title: 'windcave支付失败',
227
- content: [{
228
- key: 'res',
229
- value: JSON.stringify(res)
230
- }, {
231
- key: 'params',
232
- value: JSON.stringify(_params)
233
- }]
240
+ payLog.log('Windcave:支付接口返回失败', {
241
+ code: res === null || res === void 0 ? void 0 : res.code
234
242
  });
235
243
  (_failRef$current = failRef.current) === null || _failRef$current === void 0 || _failRef$current.call(failRef, res, stepRef.current >= StepStatusEnum.Account);
236
244
  }).catch(function (res) {
237
245
  var _failRef$current2;
238
246
  var isNoNet = unloadRef.current || !netRef.current;
239
- sendWarningLog({
240
- title: 'windcave支付失败',
241
- content: [{
242
- key: 'error',
243
- value: JSON.stringify(res)
244
- }, {
245
- key: 'params',
246
- value: JSON.stringify(_params)
247
- }, {
248
- key: 'isNoNet',
249
- value: isNoNet ? '1' : '0'
250
- }]
247
+ payLog.log('Windcave:支付接口异常', {
248
+ error: res === null || res === void 0 ? void 0 : res.message,
249
+ isNoNet: isNoNet
251
250
  });
252
-
253
- // 无网 或 已卸载 则不进行处理
254
251
  if (isNoNet) {
255
252
  return;
256
253
  }
@@ -265,6 +262,7 @@ export default (function (_ref) {
265
262
  * @Date: 2024-08-20 12:51
266
263
  */
267
264
  var onCancel = function onCancel() {
265
+ payLog.log('Windcave:点击取消支付');
268
266
  setDisabled(true);
269
267
  api.update({
270
268
  type: 'CANCEL',
@@ -290,6 +288,7 @@ export default (function (_ref) {
290
288
  */
291
289
  var onChangeReceipt = function onChangeReceipt(status) {
292
290
  if (status) {
291
+ payLog.log('Windcave:签名状态');
293
292
  // 签名,取消签名接口执行成功, 进行计时查询
294
293
  run();
295
294
  }
@@ -323,7 +323,7 @@ var processItemsTax = (items, state, options) => {
323
323
  }
324
324
  }
325
325
  }
326
- return { originTax: expectedOriginTax, tax: expectedTax };
326
+ return { originTax: expectedOriginTax, tax: expectedTax, taxDecimal: preciseTax };
327
327
  };
328
328
  var clearTaxFee = (state) => {
329
329
  var _a, _b;
@@ -376,7 +376,7 @@ var getTax = (state, options) => {
376
376
  computed
377
377
  });
378
378
  totalOriginTax = totalOriginTax.plus(serviceResult.originTax);
379
- totalTax = totalTax.plus(serviceResult.tax);
379
+ totalTax = totalTax.plus(serviceResult.taxDecimal);
380
380
  }
381
381
  if ((_c = state == null ? void 0 : state.addons) == null ? void 0 : _c.value) {
382
382
  const addonsResult = processItemsTax(state.addons.value, state, {
@@ -385,7 +385,7 @@ var getTax = (state, options) => {
385
385
  computed
386
386
  });
387
387
  totalOriginTax = totalOriginTax.plus(addonsResult.originTax);
388
- totalTax = totalTax.plus(addonsResult.tax);
388
+ totalTax = totalTax.plus(addonsResult.taxDecimal);
389
389
  }
390
390
  }
391
391
  return {
@@ -111,13 +111,14 @@ var formatProductBundle = (bundle) => {
111
111
  } catch (error) {
112
112
  }
113
113
  return bundle.map((d) => {
114
+ var _a;
114
115
  const option = formatProductOption(d.option);
115
116
  const option_price = option.reduce((temp, item) => {
116
117
  return temp + Number(item.num) * item.custom_add_price;
117
118
  }, 0);
118
119
  const product_discount_difference = ((d == null ? void 0 : d.discount_list) || []).reduce((pre, cur) => {
119
- var _a;
120
- return pre + (((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0);
120
+ var _a2;
121
+ return pre + (((_a2 = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a2.product_discount_difference) || 0);
121
122
  }, 0);
122
123
  return {
123
124
  "is_charge_tax": d.is_charge_tax,
@@ -138,7 +139,7 @@ var formatProductBundle = (bundle) => {
138
139
  "bundle_selling_price": Math.abs(d == null ? void 0 : d.price),
139
140
  // "bundle_sum_price": d?.original_price || d?.original_total,
140
141
  "metadata": {
141
- custom_product_bundle_map_id: d._id,
142
+ custom_product_bundle_map_id: ((_a = d == null ? void 0 : d.metadata) == null ? void 0 : _a.custom_product_bundle_map_id) || d._id,
142
143
  // 子商品单数量附加费
143
144
  "surcharge_fee": d.surcharge_fee,
144
145
  // 可选,附加费均摊舍入金额
@@ -373,7 +374,7 @@ var getMainProductSellingPrice = (item) => {
373
374
  }
374
375
  return new import_decimal.default((_f = item._extend) == null ? void 0 : _f.main_product_selling_price).add(optionPrice).toNumber();
375
376
  };
376
- var formatProducts = (item, quantity) => {
377
+ var formatProducts = (item, quantity, options) => {
377
378
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
378
379
  const total = Number(item._extend.total);
379
380
  const origin_total = Number(item._extend.origin_total);
@@ -387,6 +388,9 @@ var formatProducts = (item, quantity) => {
387
388
  ...d.metadata,
388
389
  unique_identification_number: `${item._extend.unique_identification_number}_${d.discount.resource_id}`
389
390
  };
391
+ if ((options == null ? void 0 : options.isServiceEdit) && (options == null ? void 0 : options.isMultiDay)) {
392
+ delete d.id;
393
+ }
390
394
  });
391
395
  const notManualDiscount = discount_list.filter(
392
396
  (item2) => item2.type !== "product"
@@ -527,7 +531,10 @@ var formatBookings = (data, values) => {
527
531
  item._extend.unique_identification_number = unique_identification_number;
528
532
  }
529
533
  const booking = {
530
- product: formatProducts(item),
534
+ product: formatProducts(item, void 0, {
535
+ isServiceEdit: data.service.edit,
536
+ isMultiDay
537
+ }),
531
538
  relation_products: formatRelationDetails(item._extend.relation_details),
532
539
  id: item.booking_id || 0,
533
540
  relation_id: item._extend.relation_id || 0,
@@ -111,7 +111,7 @@ var VoucherCard = (props) => {
111
111
  const val = (_a2 = state.service.value || []) == null ? void 0 : _a2.map((value) => {
112
112
  var _a3, _b2, _c2;
113
113
  return {
114
- booking_id: value.booking_id,
114
+ // booking_id: value.booking_id,
115
115
  id: value.id,
116
116
  price: value.price,
117
117
  total: (_a3 = value == null ? void 0 : value._extend) == null ? void 0 : _a3.total,
@@ -64,6 +64,7 @@ var import_utils9 = require("../../../info/service2/Group/utils");
64
64
  var import_useShopDiscountModule = require("../../../../ticketBooking/hooks/pisellos/useShopDiscountModule");
65
65
  var import_DiscountChangeModal = __toESM(require("./DiscountChangeModal"));
66
66
  var import_decimal = __toESM(require("decimal.js"));
67
+ var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
67
68
  var submitLock = false;
68
69
  var Info = (_, ref) => {
69
70
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K;
@@ -79,6 +80,7 @@ var Info = (_, ref) => {
79
80
  const useEndDate = import_antd.Form.useWatch("end_date", form);
80
81
  const shopDiscount = (0, import_useShopDiscountModule.useShopDiscountModule)();
81
82
  const [discountChangeModalOpen, setDiscountChangeModalOpen] = (0, import_react.useState)(false);
83
+ const context = (0, import_useEngineContext.default)();
82
84
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
83
85
  const resourcesRef = (0, import_react.useRef)(null);
84
86
  const isChangeTotal = (0, import_react.useRef)(false);
@@ -500,17 +502,23 @@ var Info = (_, ref) => {
500
502
  return ((_d2 = (_c2 = (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._extend) == null ? void 0 : _c2.other) == null ? void 0 : _d2.bundle) || [];
501
503
  }, [(_o = (_n = (_m = (_l = state.service) == null ? void 0 : _l.cacheItem) == null ? void 0 : _m._extend) == null ? void 0 : _n.other) == null ? void 0 : _o.bundle]);
502
504
  const handleEdit = (0, import_ahooks.useMemoizedFn)((e) => {
503
- var _a2, _b2, _c2, _d2, _e2;
505
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
504
506
  const item = state.service.cacheItem;
505
507
  let values = form.getFieldsValue();
506
508
  const isSession = (0, import_utils6.isSessionProduct)(item);
507
509
  const sessionValue = {};
510
+ let oldSession = {};
508
511
  if (isSession) {
509
512
  sessionValue.startEndTime = {
510
513
  startDate: (_a2 = item == null ? void 0 : item._extend) == null ? void 0 : _a2.start_date,
511
514
  endDate: (_b2 = item == null ? void 0 : item._extend) == null ? void 0 : _b2.end_date,
512
515
  duration: (_c2 = item == null ? void 0 : item._extend) == null ? void 0 : _c2.duration
513
516
  };
517
+ oldSession = {
518
+ start_date: (0, import_dayjs.default)((_d2 = item == null ? void 0 : item._extend) == null ? void 0 : _d2.start_date).format("YYYY-MM-DD"),
519
+ end_date: (0, import_dayjs.default)((_e2 = item == null ? void 0 : item._extend) == null ? void 0 : _e2.end_date).format("YYYY-MM-DD"),
520
+ duration: (_f2 = item == null ? void 0 : item._extend) == null ? void 0 : _f2.duration
521
+ };
514
522
  }
515
523
  state.action({
516
524
  type: "pisell1.handleOpenProductModal",
@@ -525,15 +533,16 @@ var Info = (_, ref) => {
525
533
  number: (0, import_utils3.getIsShowNumber)(item, state)
526
534
  },
527
535
  isOS: isSession,
528
- customer_id: (_e2 = (_d2 = state.client) == null ? void 0 : _d2.value) == null ? void 0 : _e2.id,
536
+ customer_id: (_h2 = (_g2 = state.client) == null ? void 0 : _g2.value) == null ? void 0 : _h2.id,
529
537
  value: {
530
538
  ...item._extend.other,
539
+ bundle: (0, import_utils8.mergeBundles)(item._extend.other),
531
540
  ...sessionValue,
532
541
  quantity: values.quantity || item._extend.quantity
533
542
  }
534
543
  },
535
544
  callback: (e2, extension_type, detail) => {
536
- var _a3, _b3, _c3, _d3, _e3;
545
+ var _a3, _b3, _c3, _d3, _e3, _f3, _g3, _h3, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
537
546
  isEditedRef.current = true;
538
547
  const _detail = detail || item;
539
548
  let other = JSON.parse(JSON.stringify(e2));
@@ -570,6 +579,29 @@ var Info = (_, ref) => {
570
579
  } catch (err) {
571
580
  }
572
581
  const sessionDetail = (0, import_utils5.editSessionProduct)(cacheItem, e2.session);
582
+ try {
583
+ (0, import_utils.sendWarningLog)({
584
+ title: "修改商品数据",
585
+ content: [
586
+ { key: "productId", value: item.id },
587
+ { key: "isSession", value: isSession },
588
+ { key: "oldSession", value: JSON.stringify(oldSession) },
589
+ { key: "sessionValue", value: JSON.stringify({
590
+ startTime: (_d3 = e2.session) == null ? void 0 : _d3.start_time,
591
+ endTime: (_e3 = e2.session) == null ? void 0 : _e3.end_time,
592
+ startDate: (0, import_dayjs.default)((_f3 = e2.session) == null ? void 0 : _f3.start_at).format("YYYY-MM-DD"),
593
+ endDate: (0, import_dayjs.default)((_g3 = e2.session) == null ? void 0 : _g3.end_at).format("YYYY-MM-DD"),
594
+ duration: (_h3 = e2.session) == null ? void 0 : _h3.duration
595
+ }) },
596
+ { key: "日期", value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm") },
597
+ {
598
+ key: "店铺id",
599
+ value: (_o2 = (_n2 = (_m2 = (_l2 = (_k2 = (_j2 = (_i2 = context.appHelper) == null ? void 0 : _i2.utils) == null ? void 0 : _j2.store) == null ? void 0 : _k2.getState) == null ? void 0 : _l2.call(_k2)) == null ? void 0 : _m2.global) == null ? void 0 : _n2.globalConfig) == null ? void 0 : _o2.id
600
+ }
601
+ ]
602
+ });
603
+ } catch (err) {
604
+ }
573
605
  if (sessionDetail) {
574
606
  setTimeout(() => {
575
607
  form.setFieldsValue({
@@ -583,7 +615,7 @@ var Info = (_, ref) => {
583
615
  origin_total = (0, import_utils6.getProductOriginTotalPrice)(cacheItem);
584
616
  }
585
617
  cacheItem._extend.origin_total = origin_total;
586
- (((_d3 = cacheItem._extend) == null ? void 0 : _d3.items) || []).forEach((item2) => item2._extend.origin_total = origin_total);
618
+ (((_p2 = cacheItem._extend) == null ? void 0 : _p2.items) || []).forEach((item2) => item2._extend.origin_total = origin_total);
587
619
  dispatch({
588
620
  type: "setService",
589
621
  payload: {
@@ -592,7 +624,7 @@ var Info = (_, ref) => {
592
624
  });
593
625
  form.setFieldsValue({
594
626
  total: _total,
595
- capacity: (_e3 = cacheItem._extend) == null ? void 0 : _e3.capacity,
627
+ capacity: (_q2 = cacheItem._extend) == null ? void 0 : _q2.capacity,
596
628
  quantity: (e2 == null ? void 0 : e2.quantity) || (values == null ? void 0 : values.quantity) || 1
597
629
  });
598
630
  }
@@ -1023,6 +1055,14 @@ var Info = (_, ref) => {
1023
1055
  var _a2, _b2, _c2;
1024
1056
  delete cacheItem.discount_list;
1025
1057
  (_c2 = (_b2 = (_a2 = cacheItem._extend.other) == null ? void 0 : _a2.bundle) == null ? void 0 : _b2.forEach) == null ? void 0 : _c2.call(_b2, (bundle) => {
1058
+ var _a3;
1059
+ const restoredPrice = getBundleOriginalSellingPrice(bundle);
1060
+ if (restoredPrice !== void 0) {
1061
+ bundle.price = restoredPrice;
1062
+ bundle.original_price = restoredPrice;
1063
+ bundle.original_total = restoredPrice;
1064
+ }
1065
+ (_a3 = bundle == null ? void 0 : bundle.metadata) == null ? true : delete _a3.custom_product_bundle_map_id;
1026
1066
  bundle == null ? true : delete bundle.discount_list;
1027
1067
  bundle == null ? true : delete bundle.booking_id;
1028
1068
  bundle == null ? true : delete bundle.bundle_selling_price;
@@ -1030,6 +1070,17 @@ var Info = (_, ref) => {
1030
1070
  });
1031
1071
  return cacheItem;
1032
1072
  };
1073
+ const getBundleOriginalSellingPrice = (bundle) => {
1074
+ const priceSource = (bundle == null ? void 0 : bundle.bundle_sum_price) ?? (bundle == null ? void 0 : bundle.original_total) ?? (bundle == null ? void 0 : bundle.original_price) ?? (bundle == null ? void 0 : bundle.product_price) ?? (bundle == null ? void 0 : bundle.price);
1075
+ const price2 = Number(priceSource);
1076
+ if (!Number.isFinite(price2)) {
1077
+ return void 0;
1078
+ }
1079
+ if ((bundle == null ? void 0 : bundle.bundle_sum_type) === "markdown") {
1080
+ return -Math.abs(price2);
1081
+ }
1082
+ return price2;
1083
+ };
1033
1084
  const handleKeepOriginal = () => {
1034
1085
  setDiscountChangeModalOpen(false);
1035
1086
  };
@@ -32,6 +32,7 @@ export declare const setProductPrice: (cacheItem: any, { newTotal, origin_total
32
32
  * @returns 折扣列表
33
33
  */
34
34
  export declare const getProductAllDiscountList: (cacheItem: any) => any;
35
+ export declare const mergeBundles: (other: any) => any[];
35
36
  /**
36
37
  * 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
37
38
  * @param other - callback 返回的新数据
@@ -32,6 +32,7 @@ __export(utils_exports, {
32
32
  getAutoAllocationStorage: () => getAutoAllocationStorage,
33
33
  getProductAllDiscountList: () => getProductAllDiscountList,
34
34
  mergeBundleWithOriginalPrice: () => mergeBundleWithOriginalPrice,
35
+ mergeBundles: () => mergeBundles,
35
36
  setAutoAllocationStorage: () => setAutoAllocationStorage,
36
37
  setProductPrice: () => setProductPrice
37
38
  });
@@ -96,6 +97,20 @@ var getProductAllDiscountList = (cacheItem) => {
96
97
  discountList.push(...bundleDiscountList);
97
98
  return discountList;
98
99
  };
100
+ var mergeBundles = (other) => {
101
+ const bundle = (other == null ? void 0 : other.bundle) || [];
102
+ const newBundle = [];
103
+ bundle.forEach((item) => {
104
+ const newItem = newBundle.find((newItem2) => newItem2.id === item.id);
105
+ if (newItem) {
106
+ newItem.num += item.num || 1;
107
+ newItem.quantity += item.quantity || 1;
108
+ } else {
109
+ newBundle.push({ ...item });
110
+ }
111
+ });
112
+ return newBundle;
113
+ };
99
114
  var mergeBundleWithOriginalPrice = (other, originalOther) => {
100
115
  var _a, _b;
101
116
  if (!((_a = other == null ? void 0 : other.bundle) == null ? void 0 : _a.length) || !((_b = originalOther == null ? void 0 : originalOther.bundle) == null ? void 0 : _b.length)) return other;
@@ -115,6 +130,7 @@ var mergeBundleWithOriginalPrice = (other, originalOther) => {
115
130
  getAutoAllocationStorage,
116
131
  getProductAllDiscountList,
117
132
  mergeBundleWithOriginalPrice,
133
+ mergeBundles,
118
134
  setAutoAllocationStorage,
119
135
  setProductPrice
120
136
  });
@@ -134,7 +134,7 @@ var Payments = (0, import_model.Provider)((props) => {
134
134
  item.service_fee,
135
135
  2,
136
136
  (state == null ? void 0 : state.amountSymbol) || "$"
137
- ), ")") : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "payment-list-item-date" }, (0, import_dayjs.default)(item.payment_time).format(
137
+ ), ")") : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "payment-list-item-date" }, (0, import_dayjs.default)(item.payment_time || item.created_at).format(
138
138
  "HH:mm YYYY/MM/DD"
139
139
  ), /* @__PURE__ */ import_react.default.createElement("span", { className: "payment-list-item-platform-type" }, item.platform && import_utils.locales.getText("pisell2.text.platform.type")(
140
140
  item.platform
@@ -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;
@@ -0,0 +1,27 @@
1
+ interface ModalProps {
2
+ visible?: boolean;
3
+ data?: Record<string, any>;
4
+ onCancel?: () => void;
5
+ onCheck?: () => void;
6
+ onConfirm?: () => void;
7
+ close?: () => void;
8
+ }
9
+ export declare const usePairModal: () => {
10
+ visible: boolean;
11
+ open: (props: ModalProps) => void;
12
+ close: () => void;
13
+ modalProps: ModalProps;
14
+ };
15
+ /**
16
+ * @title 解除配对
17
+ */
18
+ export declare const useUnPairRequest: () => {
19
+ run: (params: any) => any;
20
+ };
21
+ /**
22
+ * @title 检查配对状态
23
+ */
24
+ export declare const useCheckPairRequest: () => {
25
+ run: (params: any) => any;
26
+ };
27
+ export {};
@@ -0,0 +1,70 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/eftpos/PairModal/hooks.ts
20
+ var hooks_exports = {};
21
+ __export(hooks_exports, {
22
+ useCheckPairRequest: () => useCheckPairRequest,
23
+ usePairModal: () => usePairModal,
24
+ useUnPairRequest: () => useUnPairRequest
25
+ });
26
+ module.exports = __toCommonJS(hooks_exports);
27
+ var import_react = require("react");
28
+ var import_hooks = require("../hooks");
29
+ var usePairModal = () => {
30
+ const [visible, setVisible] = (0, import_react.useState)(false);
31
+ const [modalProps, setModalProps] = (0, import_react.useState)({});
32
+ const open = (props) => {
33
+ setModalProps({ ...props || {}, visible: true, close });
34
+ setVisible(true);
35
+ };
36
+ const close = () => {
37
+ setVisible(false);
38
+ setModalProps({});
39
+ };
40
+ return {
41
+ visible,
42
+ open,
43
+ close,
44
+ modalProps
45
+ };
46
+ };
47
+ var useUnPairRequest = () => {
48
+ const request = (0, import_hooks.useRequest)();
49
+ const run = (params) => {
50
+ return request.post("/shop/pay/card-reader/unpair", params, {});
51
+ };
52
+ return {
53
+ run
54
+ };
55
+ };
56
+ var useCheckPairRequest = () => {
57
+ const request = (0, import_hooks.useRequest)();
58
+ const run = (params) => {
59
+ return request.post("/shop/pay/card-reader/pairing-info", params, {});
60
+ };
61
+ return {
62
+ run
63
+ };
64
+ };
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ useCheckPairRequest,
68
+ usePairModal,
69
+ useUnPairRequest
70
+ });
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface PairModalProps {
4
+ visible?: boolean;
5
+ data?: Record<string, any>;
6
+ onCancel?: () => void;
7
+ onCheck?: () => void;
8
+ onConfirm?: () => void;
9
+ }
10
+ declare const PairModal: React.FC<PairModalProps>;
11
+ export default PairModal;