@pisell/private-materials 6.1.17 → 6.1.19

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 (76) 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 +21 -13
  7. package/build/lowcode/render/default/view.js +1 -1
  8. package/build/lowcode/view.js +8 -8
  9. package/es/components/Sales/Summary/utils.d.ts +1 -1
  10. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +1 -1
  11. package/es/components/booking/components/actionButtons/index.js +17 -7
  12. package/es/components/booking/components/footer/index.js +7 -3
  13. package/es/components/booking/deposit/ClientItem/index.js +1 -1
  14. package/es/components/booking/deposit/DepositItem/index.js +1 -1
  15. package/es/components/booking/hooks/useQuotation.js +1 -1
  16. package/es/components/booking/info/hooks/useInfoHolder.js +2 -2
  17. package/es/components/booking/info/service/Lists.js +1 -1
  18. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  19. package/es/components/booking/info/service/editService/constants.d.ts +1 -0
  20. package/es/components/booking/info/service/editService/constants.js +3 -0
  21. package/es/components/booking/info/service/editService/index.js +15 -10
  22. package/es/components/booking/info/service2/utils.d.ts +1 -1
  23. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  24. package/es/components/booking/info2/service/editService/index.js +6 -5
  25. package/es/components/booking/info2/service/index.js +0 -1
  26. package/es/components/booking/locales.js +2 -2
  27. package/es/components/eftposPay/amount.d.ts +1 -1
  28. package/es/components/eftposPay/device.d.ts +1 -1
  29. package/es/components/eftposPay/hooks.d.ts +2 -2
  30. package/es/components/eftposPay/store/index.d.ts +6 -6
  31. package/es/components/schedules/utils.d.ts +1 -1
  32. package/es/components/shoppingCart/components/Cart/Product.js +4 -6
  33. package/es/components/ticketBooking/components/addServiceVariant/addService.js +86 -26
  34. package/es/components/ticketBooking/components/ticketBooking/index.js +5 -0
  35. package/es/components/ticketBooking/hooks/pisellos/useCustomer.js +5 -2
  36. package/es/components/ticketBooking/hooks/pisellos/useScanManager.d.ts +6 -0
  37. package/es/components/ticketBooking/hooks/pisellos/useScanManager.js +20 -0
  38. package/es/components/ticketBooking/utils/index.d.ts +2 -0
  39. package/es/components/ticketBooking/utils/index.js +18 -1
  40. package/es/pro/pisellNumberSelector/index.js +43 -24
  41. package/es/pro/pisellPhoneKeyboard/index.js +1 -1
  42. package/es/utils/index.d.ts +1 -1
  43. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  44. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +1 -1
  45. package/lib/components/booking/components/actionButtons/index.js +15 -6
  46. package/lib/components/booking/components/footer/index.js +3 -0
  47. package/lib/components/booking/deposit/ClientItem/index.js +1 -1
  48. package/lib/components/booking/deposit/DepositItem/index.js +1 -1
  49. package/lib/components/booking/hooks/useQuotation.js +1 -1
  50. package/lib/components/booking/info/hooks/useInfoHolder.js +2 -2
  51. package/lib/components/booking/info/service/Lists.js +1 -1
  52. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  53. package/lib/components/booking/info/service/editService/constants.d.ts +1 -0
  54. package/lib/components/booking/info/service/editService/constants.js +31 -0
  55. package/lib/components/booking/info/service/editService/index.js +7 -1
  56. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  57. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  58. package/lib/components/booking/info2/service/editService/index.js +6 -5
  59. package/lib/components/booking/locales.js +2 -2
  60. package/lib/components/eftposPay/amount.d.ts +1 -1
  61. package/lib/components/eftposPay/device.d.ts +1 -1
  62. package/lib/components/eftposPay/hooks.d.ts +2 -2
  63. package/lib/components/eftposPay/store/index.d.ts +6 -6
  64. package/lib/components/schedules/utils.d.ts +1 -1
  65. package/lib/components/shoppingCart/components/Cart/Product.js +3 -8
  66. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +58 -18
  67. package/lib/components/ticketBooking/components/ticketBooking/index.js +4 -0
  68. package/lib/components/ticketBooking/hooks/pisellos/useCustomer.js +5 -2
  69. package/lib/components/ticketBooking/hooks/pisellos/useScanManager.d.ts +6 -0
  70. package/lib/components/ticketBooking/hooks/pisellos/useScanManager.js +44 -0
  71. package/lib/components/ticketBooking/utils/index.d.ts +2 -0
  72. package/lib/components/ticketBooking/utils/index.js +22 -0
  73. package/lib/pro/pisellNumberSelector/index.js +30 -20
  74. package/lib/pro/pisellPhoneKeyboard/index.js +1 -1
  75. package/lib/utils/index.d.ts +1 -1
  76. package/package.json +12 -12
@@ -28,7 +28,7 @@ import { isBooking4Shop } from "../../../booking/info/utils";
28
28
  import { useService } from "../../../booking/info/service/serviceManager";
29
29
  import ProductSelect from "../../../productSelect";
30
30
  import "./index.less";
31
- import { addService, addServiceScroll, genServiceKey, getIsShowNumber } from "../../utils";
31
+ import { addService, addServiceScroll, createSimpleCacheItem, genServiceKey, getIsShowNumber, isSameProduct } from "../../utils";
32
32
  import NotAvailable from "../notAvailable";
33
33
  import dayjs from 'dayjs';
34
34
  import { useProducts } from "../../hooks/pisellos";
@@ -64,6 +64,21 @@ var AddSerivce = function AddSerivce(props) {
64
64
  getProducts = _useProducts.getProducts,
65
65
  products = _useProducts.products,
66
66
  loading = _useProducts.loading;
67
+
68
+ // 组件卸载时清理所有定时器
69
+ useEffect(function () {
70
+ return function () {
71
+ Object.values(debounceTimersRef.current).forEach(function (timer) {
72
+ if (timer) clearTimeout(timer);
73
+ });
74
+ debounceTimersRef.current = {};
75
+ };
76
+ }, []);
77
+
78
+ // 防抖相关的 refs
79
+ var pendingCacheValuesRef = useRef({});
80
+ var clickCountRef = useRef({});
81
+ var debounceTimersRef = useRef({});
67
82
  var menuList = useMemo(function () {
68
83
  var _state$bookingConfig;
69
84
  return (state === null || state === void 0 || (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.config) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.menu_list_tab) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.menu_list) || [];
@@ -194,6 +209,35 @@ var AddSerivce = function AddSerivce(props) {
194
209
  className: "add-toast-quantity"
195
210
  }, locales.getText('pisell2.ticket-booking.in-cart')(quantity || 1))));
196
211
  };
212
+ var executeCacheValues = useMemoizedFn(function (productId, originalCacheValues, item, originalCallback) {
213
+ var clickCount = clickCountRef.current[productId] || 1;
214
+
215
+ // 更新 quantity 为累积的点击次数
216
+ var finalCacheValues = _objectSpread(_objectSpread({}, originalCacheValues), {}, {
217
+ quantity: clickCount
218
+ });
219
+
220
+ // 清理当前商品的缓存数据
221
+ delete pendingCacheValuesRef.current[productId];
222
+ delete clickCountRef.current[productId];
223
+ delete debounceTimersRef.current[productId];
224
+
225
+ // 执行原始的回调函数
226
+ originalCallback(finalCacheValues, '', item, true);
227
+ });
228
+
229
+ // 为每个商品单独创建防抖函数
230
+ var debouncedExecuteCacheValues = useMemoizedFn(function (productId, cacheValues, item, callback) {
231
+ // 清除该商品的旧定时器
232
+ if (debounceTimersRef.current[productId]) {
233
+ clearTimeout(debounceTimersRef.current[productId]);
234
+ }
235
+
236
+ // 创建新的防抖定时器
237
+ debounceTimersRef.current[productId] = setTimeout(function () {
238
+ executeCacheValues(productId, cacheValues, item, callback);
239
+ }, 0);
240
+ });
197
241
  var handleSelectProduct = useMemoizedFn(function (item) {
198
242
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
199
243
  console.log('handleSelectProduct');
@@ -220,8 +264,7 @@ var AddSerivce = function AddSerivce(props) {
220
264
  setCurrentProduct(item);
221
265
  } else {
222
266
  setCurrentProduct(null);
223
- console.log('进入else isSession');
224
- if (!isSession) {
267
+ if (!isSession && isNormalProductByDurationSchedule(item)) {
225
268
  cacheValues = {
226
269
  bundle: [],
227
270
  key: item.id,
@@ -231,26 +274,25 @@ var AddSerivce = function AddSerivce(props) {
231
274
  quantity: 1,
232
275
  rowKey: item.id,
233
276
  session: null,
234
- unique: '08974625397'
277
+ unique: '08974625397',
278
+ _originalItem: item // 保存原始商品信息
235
279
  };
236
280
  }
237
281
  }
238
282
  var callback = /*#__PURE__*/function () {
239
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, extension_type, detail) {
240
- var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _Toast$success2, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData;
283
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, extension_type, detail, notShowToast) {
284
+ var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData;
241
285
  return _regeneratorRuntime().wrap(function _callee$(_context) {
242
286
  while (1) switch (_context.prev = _context.next) {
243
287
  case 0:
244
- console.timeEnd('打开弹窗');
245
- console.log('点击了加入购物车 ---弹窗', e);
246
288
  setCurrentProduct(null);
247
289
  // 防止选择商品弹窗多次触发callback
248
290
  if (!lock) {
249
- _context.next = 5;
291
+ _context.next = 3;
250
292
  break;
251
293
  }
252
294
  return _context.abrupt("return");
253
- case 5:
295
+ case 3:
254
296
  lock = true;
255
297
 
256
298
  // 2秒后解除
@@ -258,23 +300,23 @@ var AddSerivce = function AddSerivce(props) {
258
300
  lock = false;
259
301
  }, 2000);
260
302
  if (isBooking4) {
261
- _context.next = 13;
303
+ _context.next = 11;
262
304
  break;
263
305
  }
264
- _context.next = 10;
306
+ _context.next = 8;
265
307
  return createBookingData({
266
308
  product: _objectSpread(_objectSpread({}, detail || item), {}, {
267
309
  _params: e
268
310
  })
269
311
  });
270
- case 10:
312
+ case 8:
271
313
  data = _context.sent;
272
314
  // 创建预约
273
315
  createBooking({
274
316
  booking: data
275
317
  });
276
318
  return _context.abrupt("return");
277
- case 13:
319
+ case 11:
278
320
  // info2 addService 逻辑
279
321
  _detail = detail || item;
280
322
  other = JSON.parse(JSON.stringify(e));
@@ -318,13 +360,9 @@ var AddSerivce = function AddSerivce(props) {
318
360
  cacheItem.autoClose = false;
319
361
  cacheItem._serviceKey = genServiceKey(cacheItem);
320
362
  _addService2 = addService(_toConsumableArray(state.service.value), cacheItem, state), _list = _addService2.list, quantity = _addService2.quantity;
321
- Toast === null || Toast === void 0 || (_Toast$success2 = Toast.success) === null || _Toast$success2 === void 0 || _Toast$success2.call(Toast, /*#__PURE__*/React.createElement("div", {
322
- className: "add-toast-wrap"
323
- }, /*#__PURE__*/React.createElement("div", {
324
- className: "add-toast-title"
325
- }, cacheItem.title), /*#__PURE__*/React.createElement("div", {
326
- className: "add-toast-quantity"
327
- }, locales.getText('pisell2.ticket-booking.in-cart')(quantity || 1))));
363
+ if (!notShowToast) {
364
+ handleAddToast(cacheItem.title, quantity || 1);
365
+ }
328
366
  addServiceScroll(e.rowKey, cacheItem);
329
367
  try {
330
368
  if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
@@ -382,23 +420,45 @@ var AddSerivce = function AddSerivce(props) {
382
420
  });
383
421
  onEdit === null || onEdit === void 0 || onEdit(cacheItem);
384
422
  }
385
- case 26:
423
+ case 24:
386
424
  case "end":
387
425
  return _context.stop();
388
426
  }
389
427
  }, _callee);
390
428
  }));
391
- return function callback(_x, _x2, _x3) {
429
+ return function callback(_x, _x2, _x3, _x4) {
392
430
  return _ref.apply(this, arguments);
393
431
  };
394
432
  }();
433
+
395
434
  // 如果不需要打开弹窗, 直接添加数据
396
435
  if (cacheValues) {
397
- console.log('进入cacheValues');
398
- callback(cacheValues, '', item);
436
+ var _state$service$value, _detail$_extend, _Toast$success2;
437
+ var productId = item.id.toString();
438
+
439
+ // 如果已经有pending的同商品,增加点击次数
440
+ if (pendingCacheValuesRef.current[productId]) {
441
+ clickCountRef.current[productId] = (clickCountRef.current[productId] || 1) + 1;
442
+ } else {
443
+ // 第一次点击,初始化数据
444
+ pendingCacheValuesRef.current[productId] = cacheValues;
445
+ clickCountRef.current[productId] = 1;
446
+ }
447
+ var cacheItem = createSimpleCacheItem(item, cacheValues, state);
448
+ var detail = (_state$service$value = state.service.value) === null || _state$service$value === void 0 ? void 0 : _state$service$value.find(function (val) {
449
+ return isSameProduct(val, cacheItem);
450
+ });
451
+ var originalQuantity = (detail === null || detail === void 0 || (_detail$_extend = detail._extend) === null || _detail$_extend === void 0 ? void 0 : _detail$_extend.quantity) || 0;
452
+ Toast === null || Toast === void 0 || (_Toast$success2 = Toast.success) === null || _Toast$success2 === void 0 || _Toast$success2.call(Toast, /*#__PURE__*/React.createElement("div", {
453
+ className: "add-toast-wrap"
454
+ }, /*#__PURE__*/React.createElement("div", {
455
+ className: "add-toast-title"
456
+ }, item.title), /*#__PURE__*/React.createElement("div", {
457
+ className: "add-toast-quantity"
458
+ }, locales.getText('pisell2.ticket-booking.in-cart')((clickCountRef.current[productId] || 1) + originalQuantity))));
459
+ debouncedExecuteCacheValues(productId, cacheValues, item, callback);
399
460
  return;
400
461
  }
401
- console.time('打开弹窗');
402
462
  state.action({
403
463
  type: 'pisell1.handleOpenProductModal',
404
464
  data: {
@@ -47,6 +47,7 @@ import "./index.less";
47
47
  import { getBookingType } from "../bookingDataPanel/bookingList/utils";
48
48
  import { useCustomer } from "../../hooks/pisellos";
49
49
  import { useMemoizedFn } from "ahooks";
50
+ import useScanManager from "../../hooks/pisellos/useScanManager";
50
51
  export var _formatBookingDetail = function _formatBookingDetail(data, modalState) {
51
52
  var _bookings$list, _bookings$list2;
52
53
  var customer_id = data.customer_id,
@@ -251,6 +252,8 @@ var TicketBooking = function TicketBooking() {
251
252
  openScan = _useScanGlobal.openScan,
252
253
  closeScan = _useScanGlobal.closeScan;
253
254
  var handleScan = useScanGlobalHandle();
255
+ var _useScanManager = useScanManager(),
256
+ enableAllScanListeners = _useScanManager.enableAllScanListeners;
254
257
  var changeCustomerToGlobalState = useMemoizedFn(function () {});
255
258
  var _useCustomer = useCustomer({
256
259
  changeCustomerToGlobalState: changeCustomerToGlobalState
@@ -303,11 +306,13 @@ var TicketBooking = function TicketBooking() {
303
306
  // 支付成功后清空状态
304
307
  _initFn(function () {});
305
308
  selectCustomer(null);
309
+ enableAllScanListeners();
306
310
  });
307
311
 
308
312
  // 作废预约
309
313
  interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || _interaction$utils2.mountFunction('booking', 'voidBooking', function (orderId) {
310
314
  voidAppointment(orderId);
315
+ enableAllScanListeners();
311
316
  });
312
317
  return function () {
313
318
  off === null || off === void 0 || off();
@@ -208,12 +208,15 @@ export var useCustomer = function useCustomer(props) {
208
208
 
209
209
  // 选择客户
210
210
  var selectCustomer = useMemoizedFn(function (customer) {
211
- bookingTicket.setActiveCustomer(customer);
211
+ var _bookingTicket$setAct, _props$changeCustomer2;
212
+ bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$setAct = bookingTicket.setActiveCustomer) === null || _bookingTicket$setAct === void 0 || _bookingTicket$setAct.call(bookingTicket, customer);
213
+ (_props$changeCustomer2 = props.changeCustomerToGlobalState) === null || _props$changeCustomer2 === void 0 || _props$changeCustomer2.call(props, customer);
212
214
  });
213
215
 
214
216
  // 新增客户到第一个
215
217
  var addCustomerToFirst = useMemoizedFn(function (customer) {
216
- bookingTicket.addCustomerToFirst(customer);
218
+ var _bookingTicket$addCus;
219
+ bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$addCus = bookingTicket.addCustomerToFirst) === null || _bookingTicket$addCus === void 0 || _bookingTicket$addCus.call(bookingTicket, customer);
217
220
  });
218
221
  return {
219
222
  // 客户列表
@@ -0,0 +1,6 @@
1
+ declare const useScanManager: () => {
2
+ disableAllScanListeners: () => void;
3
+ enableAllScanListeners: () => void;
4
+ clearAllScanListenersTaskQueue: () => void;
5
+ };
6
+ export default useScanManager;
@@ -0,0 +1,20 @@
1
+ import { useBookingTicket } from "./bookingTicket";
2
+ import { useMemoizedFn } from "ahooks";
3
+ var useScanManager = function useScanManager() {
4
+ var bookingTicket = useBookingTicket();
5
+ var disableAllScanListeners = useMemoizedFn(function () {
6
+ bookingTicket.disableAllScanListeners();
7
+ });
8
+ var enableAllScanListeners = useMemoizedFn(function () {
9
+ bookingTicket.enableAllScanListeners();
10
+ });
11
+ var clearAllScanListenersTaskQueue = useMemoizedFn(function () {
12
+ bookingTicket.clearAllScanListenersTaskQueue();
13
+ });
14
+ return {
15
+ disableAllScanListeners: disableAllScanListeners,
16
+ enableAllScanListeners: enableAllScanListeners,
17
+ clearAllScanListenersTaskQueue: clearAllScanListenersTaskQueue
18
+ };
19
+ };
20
+ export default useScanManager;
@@ -14,6 +14,7 @@ export declare const restoreProductOtherData: (data: any) => {
14
14
  product_variant_id: any;
15
15
  quantity: number;
16
16
  } | undefined;
17
+ export declare const isSameProduct: (a: any, b: any) => boolean;
17
18
  export declare const addService: (list: any[], addItem: any, state: any) => {
18
19
  list: any[];
19
20
  quantity: any;
@@ -57,4 +58,5 @@ export declare const formatScanGlobal: (data: ScanData) => {
57
58
  data: any;
58
59
  scanCode: string;
59
60
  } | null | undefined;
61
+ export declare const createSimpleCacheItem: (item: any, e: any, state: any) => any;
60
62
  export {};
@@ -16,6 +16,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
16
16
  import dayjs from 'dayjs';
17
17
  import { isNormalProductByDurationSchedule } from "../../booking/info/service2/utils";
18
18
  import { isArr } from '@pisell/utils';
19
+ import { getUniqueId } from "@pisell/utils";
19
20
 
20
21
  /** dayjs对象格式化为字符串时间 */
21
22
  export var formatDateToStr = function formatDateToStr(date) {
@@ -125,7 +126,7 @@ export var restoreProductOtherData = function restoreProductOtherData(data) {
125
126
  };
126
127
 
127
128
  // 是相同的商品
128
- var isSameProduct = function isSameProduct(a, b) {
129
+ export var isSameProduct = function isSameProduct(a, b) {
129
130
  var _a$_extend2, _b$_extend2;
130
131
  if (isNormalProductByDurationSchedule(a) && isNormalProductByDurationSchedule(b)) {
131
132
  var _a$_extend, _b$_extend;
@@ -315,4 +316,20 @@ export var formatScanGlobal = function formatScanGlobal(data) {
315
316
  scanCode: scanCode
316
317
  };
317
318
  }
319
+ };
320
+ export var createSimpleCacheItem = function createSimpleCacheItem(item, e, state) {
321
+ var cacheItem = _objectSpread(_objectSpread({}, item), {}, {
322
+ product_id: item.id,
323
+ _id: getUniqueId(),
324
+ _key: e.key,
325
+ _extend: {
326
+ start_date: state.date.value,
327
+ quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
328
+ price: item.price,
329
+ product_name: item.title,
330
+ other: e
331
+ },
332
+ new: 1
333
+ });
334
+ return cacheItem;
318
335
  };
@@ -10,9 +10,9 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import React, { useMemo, useState } from 'react';
12
12
  import { Popover } from 'antd';
13
- import Delete from '@pisell/icon/src/Delete';
14
- import Plus from '@pisell/icon/src/Plus';
15
- import Minus from '@pisell/icon/src/Minus';
13
+ import Delete from '@pisell/icon/es/Delete';
14
+ import Plus from '@pisell/icon/es/Plus';
15
+ import Minus from '@pisell/icon/es/Minus';
16
16
  // import { VirtualKeyboard } from '@pisell/materials';
17
17
  import NumberKeyBoard from "../numberKeyboard";
18
18
  import classNames from 'classnames';
@@ -45,6 +45,11 @@ var PisellNumberSelector = function PisellNumberSelector(_ref) {
45
45
  _useState4 = _slicedToArray(_useState3, 2),
46
46
  inputValue = _useState4[0],
47
47
  setInputValue = _useState4[1];
48
+ var _useState5 = useState(value.toString()),
49
+ _useState6 = _slicedToArray(_useState5, 2),
50
+ tempValue = _useState6[0],
51
+ setTempValue = _useState6[1]; // 添加临时值状态
52
+
48
53
  var KeyboardItems = useMemo(function () {
49
54
  return [{
50
55
  value: 1,
@@ -128,22 +133,24 @@ var PisellNumberSelector = function PisellNumberSelector(_ref) {
128
133
  };
129
134
  var handleChange = function handleChange(e) {
130
135
  if (!e) {
131
- onChange === null || onChange === void 0 || onChange(min);
136
+ setTempValue(min.toString());
132
137
  return;
133
138
  }
134
139
  if (e === 'delete') {
135
- // setInputValue(inputValue.slice(0, -1));
136
- onChange === null || onChange === void 0 || onChange(Number(inputValue.slice(0, -1)));
140
+ // 删除最后一位数字
141
+ var newTempValue = tempValue.slice(0, -1);
142
+ setTempValue(newTempValue || '0');
137
143
  return;
138
144
  } else if (e === 'verify') {
139
- var newValue = parseInt(inputValue) || 0;
145
+ // 确认时提交暂存的值
146
+ var newValue = parseInt(tempValue) || 0;
140
147
  var clampedValue = Math.max(min, Math.min(max, newValue));
141
148
  onChange === null || onChange === void 0 || onChange(clampedValue);
142
149
  setOpen(false); // 手动关闭弹窗
143
150
  return;
144
151
  } else {
145
- // 虚拟键盘现在会处理最大值限制,这里直接设置输入值
146
- onChange === null || onChange === void 0 || onChange(Number(e));
152
+ // 更新暂存值,不直接触发onChange
153
+ setTempValue(e);
147
154
  }
148
155
  };
149
156
 
@@ -151,22 +158,43 @@ var PisellNumberSelector = function PisellNumberSelector(_ref) {
151
158
  var adjustPriceContent = useMemo(function () {
152
159
  if (!enablePriceAdjust) return null;
153
160
  return /*#__PURE__*/React.createElement(NumberKeyBoard, {
154
- selectType: "dark",
155
- value: value.toString(),
161
+ value: tempValue // 使用临时值
162
+ ,
156
163
  max: max,
157
164
  onChange: handleChange,
158
165
  onOk: function onOk() {
166
+ var newValue = parseInt(tempValue) || 0;
167
+ var clampedValue = Math.max(min, Math.min(max, newValue));
168
+ onChange === null || onChange === void 0 || onChange(clampedValue);
159
169
  setOpen(false);
160
170
  }
161
171
  });
162
- }, [enablePriceAdjust, inputValue, KeyboardItems, max]);
172
+ }, [enablePriceAdjust, tempValue, max, handleChange]);
163
173
 
164
174
  // 点击数字的处理
165
175
  var handleNumberClick = function handleNumberClick() {
166
176
  if (disabled) return;
167
177
  if (enablePriceAdjust) {
168
178
  // Popover 会自动处理打开,我们只需要设置初始值
169
- setInputValue(value.toString());
179
+ setTempValue(value.toString()); // 设置临时值为当前值
180
+ }
181
+ };
182
+
183
+ // 处理弹窗开关时的值同步
184
+ var handleOpenChange = function handleOpenChange(visible) {
185
+ setOpen(visible);
186
+ if (visible) {
187
+ // 打开时设置临时值为当前值
188
+ setTempValue(value.toString());
189
+ } else {
190
+ // 关闭时检查是否需要提交值
191
+ var tempNumber = parseInt(tempValue) || 0;
192
+ var clampedValue = Math.max(min, Math.min(max, tempNumber));
193
+ if (clampedValue !== value) {
194
+ onChange === null || onChange === void 0 || onChange(clampedValue);
195
+ }
196
+ // 重置临时值为当前值,确保下次打开时显示正确的值
197
+ setTempValue(value.toString());
170
198
  }
171
199
  };
172
200
 
@@ -193,22 +221,13 @@ var PisellNumberSelector = function PisellNumberSelector(_ref) {
193
221
  overlayInnerStyle: {
194
222
  padding: 0
195
223
  },
196
- onOpenChange: function onOpenChange(visible) {
197
- setOpen(visible);
198
- if (visible) {
199
- // 打开时设置初始输入值
200
- setInputValue(value.toString());
201
- } else {
202
- // 关闭时重置输入值
203
- setInputValue(value.toString());
204
- }
205
- },
206
224
  destroyTooltipOnHide: true,
207
225
  arrow: false,
208
226
  align: {
209
227
  offset: [0, 0]
210
228
  },
211
- overlayClassName: "pisell-number-selector-popover"
229
+ overlayClassName: "pisell-number-selector-popover",
230
+ onOpenChange: handleOpenChange
212
231
  }, numberDisplayElement) : numberDisplayElement;
213
232
  return /*#__PURE__*/React.createElement("div", {
214
233
  className: classNames('pisell-number-selector-new', className, _defineProperty(_defineProperty({}, "pisell-number-selector-".concat(size), size), 'pisell-number-selector-disabled', disabled))
@@ -15,7 +15,7 @@ import React, { useState, useMemo, useEffect } from 'react';
15
15
  import { VirtualKeyboard } from '@pisell/materials';
16
16
  import { Popover, Input } from 'antd';
17
17
  import "./index.less";
18
- import Delete from '@pisell/icon/src/Delete';
18
+ import Delete from '@pisell/icon/es/Delete';
19
19
  import { locales } from '@pisell/utils';
20
20
  import localeTexts from "./locales";
21
21
  import { getLocale } from "../../utils/locales";
@@ -18,6 +18,6 @@ declare let modal: Omit<ModalStaticFunctions, 'warn'>;
18
18
  export declare const setModal: (m: Omit<ModalStaticFunctions, 'warn'>) => void;
19
19
  export declare const saveConfirm: () => Promise<{
20
20
  destroy: () => void;
21
- update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
21
+ update: (configUpdate: import("antd/es/modal/interface").ModalFuncProps | ((prevConfig: import("antd/es/modal/interface").ModalFuncProps) => import("antd/es/modal/interface").ModalFuncProps)) => void;
22
22
  }>;
23
23
  export { modal };
@@ -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[]) => Decimal | "0.00";
33
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
34
34
  /**
35
35
  * 计算所有价格明细
36
36
  * @param items - 购物车商品数组
@@ -83,7 +83,7 @@ var DepositModal = (props) => {
83
83
  closable: true,
84
84
  bodyStyle: { padding: "24px", minHeight: "300px" },
85
85
  destroyOnClose: true,
86
- title: (item == null ? void 0 : item.title) || (policy == null ? void 0 : policy.title) || "协议",
86
+ title: (item == null ? void 0 : item.title) || (policy == null ? void 0 : policy.title) || void 0,
87
87
  onCancel,
88
88
  mobileModalHeight: "auto",
89
89
  className: "policy-modal-wrap",
@@ -48,6 +48,7 @@ var import_index = require("./index.less");
48
48
  var import_useCustomer = require("../../../ticketBooking/hooks/pisellos/useCustomer");
49
49
  var import_ahooks = require("ahooks");
50
50
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
51
+ var import_useScanManager = __toESM(require("../../../ticketBooking/hooks/pisellos/useScanManager"));
51
52
  var createToastContent = (text) => /* @__PURE__ */ import_react.default.createElement("div", { className: "action-buttons-toast-content" }, text);
52
53
  var ActionButtons = ({
53
54
  state,
@@ -55,7 +56,7 @@ var ActionButtons = ({
55
56
  disabled = false,
56
57
  source
57
58
  }) => {
58
- var _a, _b, _c, _d, _e, _f, _g, _h;
59
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
59
60
  const [showClearModal, setShowClearModal] = (0, import_react.useState)(false);
60
61
  const [showPriceAdjustModal, setShowPriceAdjustModal] = (0, import_react.useState)(false);
61
62
  const [showCustomiseModal, setShowCustomiseModal] = (0, import_react.useState)(false);
@@ -75,6 +76,7 @@ var ActionButtons = ({
75
76
  const { selectCustomer } = (0, import_useCustomer.useCustomer)({
76
77
  changeCustomerToGlobalState
77
78
  });
79
+ const { clearAllScanListenersTaskQueue } = (0, import_useScanManager.default)();
78
80
  (0, import_react.useEffect)(() => {
79
81
  if (!pisellOS) return;
80
82
  const handleCustomerSelected = () => {
@@ -114,21 +116,26 @@ var ActionButtons = ({
114
116
  }, [state, hasCartItems]);
115
117
  const [discountList, setDiscountList] = (0, import_react.useState)([]);
116
118
  const usedVouchersCount = (0, import_react.useMemo)(() => {
119
+ var _a2, _b2;
117
120
  try {
121
+ if (!((_b2 = (_a2 = state.service) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length)) {
122
+ return 0;
123
+ }
118
124
  return discountList.filter((discount) => discount.isSelected).length;
119
125
  } catch (error) {
120
126
  console.error("计算已使用券数量失败:", error);
121
127
  return 0;
122
128
  }
123
- }, [discountList]);
129
+ }, [discountList, (_e = state.service) == null ? void 0 : _e.value]);
124
130
  const shouldShowWarning = (0, import_react.useMemo)(() => {
131
+ var _a2, _b2;
125
132
  try {
126
- return discountList.length > 0 && !discountList.some((discount) => discount.isSelected) && discountList.some((discount) => discount.isManualSelect);
133
+ return ((_b2 = (_a2 = state.service) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length) > 0 && discountList.length > 0 && !discountList.some((discount) => discount.isSelected) && discountList.some((discount) => discount.isManualSelect);
127
134
  } catch (error) {
128
135
  console.error("判断警告状态失败:", error);
129
136
  return false;
130
137
  }
131
- }, [discountList]);
138
+ }, [discountList, (_f = state.service) == null ? void 0 : _f.value]);
132
139
  (0, import_react.useEffect)(() => {
133
140
  var _a2;
134
141
  const { pisellos } = ((_a2 = context.appHelper) == null ? void 0 : _a2.utils) || {};
@@ -140,11 +147,12 @@ var ActionButtons = ({
140
147
  return () => {
141
148
  pisellos.effects.off("shopDiscount:onDiscountListChange", onDiscountListChange);
142
149
  };
143
- }, [(_e = context.appHelper) == null ? void 0 : _e.utils]);
150
+ }, [(_g = context.appHelper) == null ? void 0 : _g.utils]);
144
151
  const handleClear = () => {
145
152
  setShowClearModal(true);
146
153
  };
147
154
  const handleClearItemsOnly = () => {
155
+ clearAllScanListenersTaskQueue();
148
156
  if (!hasCartItems) {
149
157
  Toast == null ? void 0 : Toast.info(createToastContent(import_utils.locales.getText("pisell2.clear-cart-modal.empty-cart-tip")));
150
158
  return;
@@ -171,6 +179,7 @@ var ActionButtons = ({
171
179
  Toast == null ? void 0 : Toast.success(createToastContent(import_utils.locales.getText("pisell2.action-buttons.clear-success")));
172
180
  };
173
181
  const handleClearAllAndReset = () => {
182
+ clearAllScanListenersTaskQueue();
174
183
  dispatch({
175
184
  type: "setService",
176
185
  payload: {
@@ -360,7 +369,7 @@ var ActionButtons = ({
360
369
  visible: showCustomiseModal,
361
370
  onClose: () => setShowCustomiseModal(false),
362
371
  onSave: handleCustomiseItemSave,
363
- currencySymbol: ((_h = (_g = (_f = context.appHelper) == null ? void 0 : _f.utils) == null ? void 0 : _g.getSymbolic) == null ? void 0 : _h.call(_g)) || "$",
372
+ currencySymbol: ((_j = (_i = (_h = context.appHelper) == null ? void 0 : _h.utils) == null ? void 0 : _i.getSymbolic) == null ? void 0 : _j.call(_i)) || "$",
364
373
  disabled: isDisabledEdit
365
374
  }
366
375
  ), /* @__PURE__ */ import_react.default.createElement(
@@ -53,6 +53,7 @@ var import__ = require("../../../../index");
53
53
  var import_useIsBooking4Shop = require("../../hooks/useIsBooking4Shop");
54
54
  var import_utils4 = require("@pisell/utils");
55
55
  var import_dayjs = __toESM(require("dayjs"));
56
+ var import_useScanManager = __toESM(require("../../../ticketBooking/hooks/pisellos/useScanManager"));
56
57
  var Footer = (props) => {
57
58
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
58
59
  const { state, buttons, dispatch, source } = props;
@@ -65,6 +66,7 @@ var Footer = (props) => {
65
66
  const appointmentProductRef = (0, import_react.useRef)(null);
66
67
  const context = (0, import_useEngineContext.default)();
67
68
  const { isTerminal, isWebPos, interaction, store, storage, businessUtils } = (_a = context.appHelper) == null ? void 0 : _a.utils;
69
+ const { disableAllScanListeners } = (0, import_useScanManager.default)();
68
70
  (0, import_react.useEffect)(() => {
69
71
  store == null ? void 0 : store.dispatch({
70
72
  type: "global/_getMetadataMap",
@@ -218,6 +220,7 @@ var Footer = (props) => {
218
220
  return;
219
221
  }
220
222
  if (isTerminal == null ? void 0 : isTerminal()) {
223
+ disableAllScanListeners();
221
224
  return (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
222
225
  module: "booking",
223
226
  key: "booking_checkout",
@@ -36,7 +36,7 @@ var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var import_utils = require("@pisell/utils");
38
38
  var import_classnames = __toESM(require("classnames"));
39
- var import_User01 = __toESM(require("@pisell/icon/src/User01"));
39
+ var import_User01 = __toESM(require("@pisell/icon/es/User01"));
40
40
  var import_utils2 = require("../../utils");
41
41
  var import_index = require("./index.less");
42
42
  var ClientItem = (props) => {
@@ -37,7 +37,7 @@ var import_antd = require("antd");
37
37
  var import_icons = require("@ant-design/icons");
38
38
  var import_utils = require("@pisell/utils");
39
39
  var import_ClientItem = __toESM(require("../ClientItem"));
40
- var import_Edit05 = __toESM(require("@pisell/icon/src/Edit05"));
40
+ var import_Edit05 = __toESM(require("@pisell/icon/es/Edit05"));
41
41
  var import_index = require("./index.less");
42
42
  var statusTagColor = {
43
43
  unpaid: "#B2DDFF",
@@ -35,7 +35,7 @@ __export(useQuotation_exports, {
35
35
  module.exports = __toCommonJS(useQuotation_exports);
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_utils = require("../utils");
38
- var import_useEngineContext = __toESM(require("../../../../es/hooks/useEngineContext"));
38
+ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
39
39
  var import_utils2 = require("@pisell/utils");
40
40
  var import_materials = require("@pisell/materials");
41
41
  var import_serve = require("../info/service/serve");