@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
@@ -59,7 +59,7 @@ var useInfoHolder = (state, dispatch) => {
59
59
  const showAddTimeModal = (0, import_react.useMemo)(() => {
60
60
  return (0, import_utils.isOpenAddTime)(state);
61
61
  }, [state, appointment_card.quick_time]);
62
- const handleEdit = (cacheItem, type) => {
62
+ const handleEdit = (0, import_ahooks.useMemoizedFn)((cacheItem, type) => {
63
63
  var _a2, _b2, _c2;
64
64
  const isNoSpecAndPackage = (0, import_utilsByBooking.getIsNoSpecAndPackage)(cacheItem);
65
65
  if (isNoSpecAndPackage) {
@@ -67,7 +67,7 @@ var useInfoHolder = (state, dispatch) => {
67
67
  } else {
68
68
  (_c2 = (_b2 = detailRef.current) == null ? void 0 : _b2.init) == null ? void 0 : _c2.call(_b2, cacheItem, false, type === "edit_product");
69
69
  }
70
- };
70
+ });
71
71
  const dispatchService = (type, payload) => {
72
72
  dispatch({
73
73
  type,
@@ -114,7 +114,7 @@ var Lists = ({ onEdit, onChange, onAction, isParallelResource }) => {
114
114
  );
115
115
  console.timeEnd("products");
116
116
  return p;
117
- }, [(_a = state == null ? void 0 : state.service) == null ? void 0 : _a.value]);
117
+ }, [(_a = state == null ? void 0 : state.service) == null ? void 0 : _a.value, state]);
118
118
  return (0, import_react.useMemo)(() => {
119
119
  console.log("render List");
120
120
  return /* @__PURE__ */ import_react.default.createElement(import_Provider.CartContext.Provider, { value: { state } }, /* @__PURE__ */ import_react.default.createElement(
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: any;
9
+ locale: string;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -0,0 +1 @@
1
+ export declare const getIsPartyRoomResourceShop: (id: number) => boolean;
@@ -0,0 +1,31 @@
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/booking/info/service/editService/constants.ts
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ getIsPartyRoomResourceShop: () => getIsPartyRoomResourceShop
23
+ });
24
+ module.exports = __toCommonJS(constants_exports);
25
+ var getIsPartyRoomResourceShop = (id) => {
26
+ return [2155, 9].includes(id);
27
+ };
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ getIsPartyRoomResourceShop
31
+ });
@@ -57,10 +57,13 @@ var import_like = __toESM(require("../like"));
57
57
  var import_utils7 = require("../../utils");
58
58
  var import_serviceManager = require("../serviceManager");
59
59
  var import_EditTabs = __toESM(require("./EditTabs"));
60
+ var import_constants = require("./constants");
61
+ var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
60
62
  var submitLock = false;
61
63
  var Info = (_, ref) => {
62
64
  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;
63
65
  const [form] = import_antd.Form.useForm();
66
+ const context = (0, import_useEngineContext.default)();
64
67
  const useTotal = import_antd.Form.useWatch("total", form);
65
68
  const useLikeStatus = import_antd.Form.useWatch("like_status", form);
66
69
  const useResource = import_antd.Form.useWatch("resource", form);
@@ -355,6 +358,7 @@ var Info = (_, ref) => {
355
358
  });
356
359
  }, [(_q = (_p = (_o = state.service) == null ? void 0 : _o.cacheItem) == null ? void 0 : _p._extend) == null ? void 0 : _q.multi_day]);
357
360
  const getResourcesData = async () => {
361
+ var _a2, _b2, _c2, _d2, _e2;
358
362
  setResourceLoading(true);
359
363
  try {
360
364
  let params = {};
@@ -374,10 +378,12 @@ var Info = (_, ref) => {
374
378
  } else {
375
379
  params.with_date_times = state.date.value.format("YYYY-MM-DD");
376
380
  }
381
+ const isPartyRoomResourceShop = (0, import_constants.getIsPartyRoomResourceShop)((_e2 = (_d2 = (_c2 = (_b2 = (_a2 = context.appHelper.utils.store) == null ? void 0 : _a2.getState) == null ? void 0 : _b2.call(_a2)) == null ? void 0 : _c2.global) == null ? void 0 : _d2.globalConfig) == null ? void 0 : _e2.id);
382
+ const codes = isPartyRoomResourceShop ? ["resources", "therapist", "table", "party_room"] : ["resources", "therapist", "table"];
377
383
  let data = await state.apis.getResources({
378
384
  skip: 1,
379
385
  num: 1e3,
380
- codes: ["resources", "therapist", "table"],
386
+ codes,
381
387
  _config: { abort: true },
382
388
  ...params
383
389
  });
@@ -248,4 +248,4 @@ export declare const updateAppointmentServicePrice: (state: any, { start_date, e
248
248
  * @Author: WangHan
249
249
  * @Date: 2024-12-24 11:32
250
250
  */
251
- export declare const updateServicePrice: (state: any) => Promise<any> | never[];
251
+ export declare const updateServicePrice: (state: any) => never[] | Promise<any>;
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: any;
10
+ locale: string;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -54,7 +54,7 @@ var import_utilsByBooking = require("../../utilsByBooking");
54
54
  var import_utils7 = require("../addService/utils");
55
55
  var submitLock = false;
56
56
  var Info = (_, ref) => {
57
- 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;
57
+ 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;
58
58
  const [form] = import_antd.Form.useForm();
59
59
  const useTotal = import_antd.Form.useWatch("total", form);
60
60
  const useResource = import_antd.Form.useWatch("resource", form);
@@ -145,7 +145,7 @@ var Info = (_, ref) => {
145
145
  } catch (err) {
146
146
  }
147
147
  }, [useDuration, flexibleOption]);
148
- const handleDeleteProduct = () => {
148
+ const handleDeleteProduct = (0, import_ahooks.useMemoizedFn)(() => {
149
149
  var _a2;
150
150
  if (state.channelDisabledEdit) {
151
151
  return;
@@ -163,7 +163,7 @@ var Info = (_, ref) => {
163
163
  cacheItem: null
164
164
  }
165
165
  });
166
- };
166
+ });
167
167
  const getDiscount = () => {
168
168
  var _a2;
169
169
  let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
@@ -466,7 +466,6 @@ var Info = (_, ref) => {
466
466
  return false;
467
467
  }, [state.renderType, isNormalProduct]);
468
468
  const SelectTime = (_p = window.BaseMaterials) == null ? void 0 : _p.SelectTime;
469
- console.log(isShowTimeAndResource, "isShowTimeAndResource");
470
469
  const productName = (0, import_react.useMemo)(() => {
471
470
  var _a2, _b2, _c2;
472
471
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "product_name" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name" }, ((_c2 = (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._extend) == null ? void 0 : _c2.product_name) || "-"), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleEdit }, import_utils.locales.getText("pisell2.text.edit")), !state.isBookingCreatePage && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleChange }, import_utils.locales.getText("pisell2.text.change"))), /* @__PURE__ */ import_react.default.createElement(
@@ -638,6 +637,8 @@ var Info = (_, ref) => {
638
637
  import_utils.locales.getText("pisell2.text.apply")
639
638
  ));
640
639
  }, [(_G = state.service.resourcesOrigin) == null ? void 0 : _G.length, isNormalProduct]);
640
+ console.log("render edit");
641
+ console.log(state.service.editModal && !((_H = state.service.cacheItem) == null ? void 0 : _H.autoClose), performance.now() - window.pp1, "打开商品1");
641
642
  const [val, setVal] = (0, import_react.useState)(false);
642
643
  (0, import_react.useEffect)(() => {
643
644
  if (isShowTimeAndResource) {
@@ -656,7 +657,7 @@ var Info = (_, ref) => {
656
657
  zIndex: state.service.changeService ? 999 : 1e3,
657
658
  forceRender: true,
658
659
  mask: state.drawerMask,
659
- open: !isNoSpecAndPackage && state.service.editModal && !((_H = state.service.cacheItem) == null ? void 0 : _H.autoClose),
660
+ open: !isNoSpecAndPackage && state.service.editModal && !((_I = state.service.cacheItem) == null ? void 0 : _I.autoClose),
660
661
  title: import_utils.locales.getText("pisell2.text.edit-service"),
661
662
  onClose: () => {
662
663
  closeBookingEditModal();
@@ -77,7 +77,7 @@ var locales_default = {
77
77
  "pisell2.text.holder": "Holder",
78
78
  "pisell2.text.warnings": "Warnings",
79
79
  "pisell2.text.order-notes": "Order notes",
80
- "pisell2.text.add-order-notes": "Add Order note",
80
+ "pisell2.text.add-order-notes": "Add Order Note",
81
81
  "pisell2.text.add-internal-notes": "Add Internal note",
82
82
  "pisell2.text.add-notes": "Add Notes",
83
83
  "pisell2.text.notes": "Notes",
@@ -300,7 +300,7 @@ var locales_default = {
300
300
  // Action Buttons
301
301
  "pisell2.action-buttons.clear": "Clear",
302
302
  "pisell2.action-buttons.manuel-order": "Manual\nOrder $",
303
- "pisell2.action-buttons.customise-item": "Cust. \nItem",
303
+ "pisell2.action-buttons.customise-item": "Cust.\nItem",
304
304
  "pisell2.action-buttons.no-items-to-adjust": "No items in cart to adjust price.",
305
305
  "pisell2.action-buttons.adjust-order-price": "Adjust Order Price",
306
306
  "pisell2.action-buttons.price-adjusted-success": "Order price adjusted successfully.",
@@ -8,7 +8,7 @@ import { PosProps } from './const';
8
8
  */
9
9
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
10
10
  className?: string | undefined;
11
- onChange?: ((status: "success" | "page" | "fail" | "print" | "mark_tx_processed", params?: string | {
11
+ onChange?: ((status: "page" | "success" | "fail" | "print" | "mark_tx_processed", params?: string | {
12
12
  [keys: string]: unknown;
13
13
  } | undefined, other?: any) => void) | undefined;
14
14
  onClose: () => void;
@@ -10,7 +10,7 @@ import './device.less';
10
10
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
11
11
  api: PayProps['api'];
12
12
  className?: string | undefined;
13
- onChange?: ((status: "success" | "page" | "fail" | "print" | "mark_tx_processed", params?: string | {
13
+ onChange?: ((status: "page" | "success" | "fail" | "print" | "mark_tx_processed", params?: string | {
14
14
  [keys: string]: unknown;
15
15
  } | undefined, other?: any) => void) | undefined;
16
16
  onClose: () => void;
@@ -15,11 +15,11 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"success" | "warn" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "success" | "warn" | "loading" | "fail" | "question";
177
+ status: "loading" | "success" | "warn" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -295,20 +295,20 @@ export declare const backUpFree: (payload: Partial<State>) => {
295
295
  name?: string | undefined;
296
296
  symbol?: string | undefined;
297
297
  amount?: string | number | undefined;
298
- mode?: "pay" | "fullPay" | "refund" | "query" | undefined;
298
+ mode?: "fullPay" | "pay" | "refund" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "linkly" | undefined;
301
- action?: "amount" | "deviceList" | "pay" | undefined;
300
+ eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
301
+ action?: "amount" | "pay" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
304
304
  title?: string | undefined;
305
305
  subTitle?: string | undefined;
306
- type?: "step" | "unset" | undefined;
306
+ type?: "unset" | "step" | undefined;
307
307
  render?: boolean | undefined;
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "success" | "warn" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */
@@ -17,6 +17,6 @@ declare let modal: Omit<ModalStaticFunctions, "warn">;
17
17
  export declare const setModal: (m: Omit<ModalStaticFunctions, "warn">) => void;
18
18
  export declare const saveConfirm: () => Promise<{
19
19
  destroy: () => void;
20
- update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
20
+ update: (configUpdate: import("antd/es/modal/interface").ModalFuncProps | ((prevConfig: import("antd/es/modal/interface").ModalFuncProps) => import("antd/es/modal/interface").ModalFuncProps)) => void;
21
21
  }>;
22
22
  export { modal };
@@ -87,19 +87,13 @@ var Product = (props) => {
87
87
  isShowChangeHolder,
88
88
  isShowEditProduct
89
89
  ]);
90
- (0, import_ahooks.useTrackedEffect)(
91
- (changes) => {
92
- console.log("Index of changed dependencies: ", changes);
93
- },
94
- [clearCart, lists, productParams, hideAddBtn, isAdd, platform]
95
- );
96
- const getProductCardStyleProps = (type) => {
90
+ const getProductCardStyleProps = (0, import_ahooks.useMemoizedFn)((type) => {
97
91
  const conf = productCardStyleConfig[`${type}_product_card_style`];
98
92
  return {
99
93
  isShowImage: conf == null ? void 0 : conf.show_product_image,
100
94
  isShowDelete: conf == null ? void 0 : conf.show_remove_button
101
95
  };
102
- };
96
+ });
103
97
  return (0, import_react.useMemo)(() => {
104
98
  console.log("render cart");
105
99
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__shopping-cart-content" }, clearCart, lists == null ? void 0 : lists.map((item) => {
@@ -135,6 +129,7 @@ var Product = (props) => {
135
129
  color: "#667085"
136
130
  }
137
131
  ],
132
+ escapeDom: ".pisell-number-selector-popover",
138
133
  key: item._id,
139
134
  dataSource: item,
140
135
  onAction: (e) => onAction == null ? void 0 : onAction(e),
@@ -71,6 +71,17 @@ var AddSerivce = (props) => {
71
71
  const stateRef = (0, import_react.useRef)(state);
72
72
  stateRef.current = state;
73
73
  const { getProducts, products, loading } = (0, import_pisellos.useProducts)();
74
+ (0, import_react.useEffect)(() => {
75
+ return () => {
76
+ Object.values(debounceTimersRef.current).forEach((timer) => {
77
+ if (timer) clearTimeout(timer);
78
+ });
79
+ debounceTimersRef.current = {};
80
+ };
81
+ }, []);
82
+ const pendingCacheValuesRef = (0, import_react.useRef)({});
83
+ const clickCountRef = (0, import_react.useRef)({});
84
+ const debounceTimersRef = (0, import_react.useRef)({});
74
85
  const menuList = (0, import_react.useMemo)(() => {
75
86
  var _a2, _b2, _c2;
76
87
  return ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.menu_list_tab) == null ? void 0 : _c2.menu_list) || [];
@@ -116,9 +127,28 @@ var AddSerivce = (props) => {
116
127
  /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(quantity || 1)))
117
128
  );
118
129
  };
130
+ const executeCacheValues = (0, import_ahooks.useMemoizedFn)((productId, originalCacheValues, item, originalCallback) => {
131
+ const clickCount = clickCountRef.current[productId] || 1;
132
+ const finalCacheValues = {
133
+ ...originalCacheValues,
134
+ quantity: clickCount
135
+ };
136
+ delete pendingCacheValuesRef.current[productId];
137
+ delete clickCountRef.current[productId];
138
+ delete debounceTimersRef.current[productId];
139
+ originalCallback(finalCacheValues, "", item, true);
140
+ });
141
+ const debouncedExecuteCacheValues = (0, import_ahooks.useMemoizedFn)((productId, cacheValues, item, callback) => {
142
+ if (debounceTimersRef.current[productId]) {
143
+ clearTimeout(debounceTimersRef.current[productId]);
144
+ }
145
+ debounceTimersRef.current[productId] = setTimeout(() => {
146
+ executeCacheValues(productId, cacheValues, item, callback);
147
+ }, 0);
148
+ });
119
149
  const handleSelectProduct = (0, import_ahooks.useMemoizedFn)(
120
150
  (item, type = "select") => {
121
- var _a2;
151
+ var _a2, _b2, _c2, _d2;
122
152
  console.log("handleSelectProduct");
123
153
  if (!(0, import_utils4.isNormalProductByDurationSchedule)(item)) {
124
154
  if (!Array.isArray((_a2 = state.service) == null ? void 0 : _a2.resourcesOrigin) || !state.service.resourcesOrigin.length) {
@@ -141,8 +171,7 @@ var AddSerivce = (props) => {
141
171
  setCurrentProduct(item);
142
172
  } else {
143
173
  setCurrentProduct(null);
144
- console.log("进入else isSession");
145
- if (!isSession) {
174
+ if (!isSession && (0, import_utils4.isNormalProductByDurationSchedule)(item)) {
146
175
  cacheValues = {
147
176
  bundle: [],
148
177
  key: item.id,
@@ -152,14 +181,14 @@ var AddSerivce = (props) => {
152
181
  quantity: 1,
153
182
  rowKey: item.id,
154
183
  session: null,
155
- unique: "08974625397"
184
+ unique: "08974625397",
185
+ _originalItem: item
186
+ // 保存原始商品信息
156
187
  };
157
188
  }
158
189
  }
159
- const callback = async (e, extension_type, detail) => {
160
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2;
161
- console.timeEnd("打开弹窗");
162
- console.log("点击了加入购物车 ---弹窗", e);
190
+ const callback = async (e, extension_type, detail, notShowToast) => {
191
+ var _a3, _b3, _c3, _d3, _e2, _f2;
163
192
  setCurrentProduct(null);
164
193
  if (lock) {
165
194
  return;
@@ -219,15 +248,12 @@ var AddSerivce = (props) => {
219
248
  cacheItem,
220
249
  state
221
250
  );
222
- (_b2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _b2.call(
223
- Toast,
224
- /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, cacheItem.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(
225
- quantity || 1
226
- )))
227
- );
251
+ if (!notShowToast) {
252
+ handleAddToast(cacheItem.title, quantity || 1);
253
+ }
228
254
  (0, import_utils6.addServiceScroll)(e.rowKey, cacheItem);
229
255
  try {
230
- if (((_g2 = (_f2 = (_e2 = (_d2 = (_c2 = context.appHelper.utils.store) == null ? void 0 : _c2.getState) == null ? void 0 : _d2.call(_c2)) == null ? void 0 : _e2.global) == null ? void 0 : _f2.globalConfig) == null ? void 0 : _g2.id) === 2155) {
256
+ if (((_f2 = (_e2 = (_d3 = (_c3 = (_b3 = context.appHelper.utils.store) == null ? void 0 : _b3.getState) == null ? void 0 : _c3.call(_b3)) == null ? void 0 : _d3.global) == null ? void 0 : _e2.globalConfig) == null ? void 0 : _f2.id) === 2155) {
231
257
  const val = _list == null ? void 0 : _list.map((s) => {
232
258
  return {
233
259
  product_id: s == null ? void 0 : s.product_id,
@@ -285,11 +311,25 @@ var AddSerivce = (props) => {
285
311
  }
286
312
  };
287
313
  if (cacheValues) {
288
- console.log("进入cacheValues");
289
- callback(cacheValues, "", item);
314
+ const productId = item.id.toString();
315
+ if (pendingCacheValuesRef.current[productId]) {
316
+ clickCountRef.current[productId] = (clickCountRef.current[productId] || 1) + 1;
317
+ } else {
318
+ pendingCacheValuesRef.current[productId] = cacheValues;
319
+ clickCountRef.current[productId] = 1;
320
+ }
321
+ const cacheItem = (0, import_utils6.createSimpleCacheItem)(item, cacheValues, state);
322
+ const detail = (_b2 = state.service.value) == null ? void 0 : _b2.find((val) => (0, import_utils6.isSameProduct)(val, cacheItem));
323
+ const originalQuantity = ((_c2 = detail == null ? void 0 : detail._extend) == null ? void 0 : _c2.quantity) || 0;
324
+ (_d2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _d2.call(
325
+ Toast,
326
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(
327
+ (clickCountRef.current[productId] || 1) + originalQuantity
328
+ )))
329
+ );
330
+ debouncedExecuteCacheValues(productId, cacheValues, item, callback);
290
331
  return;
291
332
  }
292
- console.time("打开弹窗");
293
333
  state.action({
294
334
  type: "pisell1.handleOpenProductModal",
295
335
  data: {
@@ -58,6 +58,7 @@ var import_index = require("./index.less");
58
58
  var import_utils4 = require("../bookingDataPanel/bookingList/utils");
59
59
  var import_pisellos = require("../../hooks/pisellos");
60
60
  var import_ahooks = require("ahooks");
61
+ var import_useScanManager = __toESM(require("../../hooks/pisellos/useScanManager"));
61
62
  var _formatBookingDetail = (data, modalState) => {
62
63
  var _a, _b, _c, _d;
63
64
  let {
@@ -264,6 +265,7 @@ var TicketBooking = () => {
264
265
  const bookingTicket = (0, import_bookingTicket.useBookingTicket)();
265
266
  const { openScan, closeScan } = (0, import_useScanGlobal.default)();
266
267
  const handleScan = (0, import_useScanGlobalHandle.default)();
268
+ const { enableAllScanListeners } = (0, import_useScanManager.default)();
267
269
  const changeCustomerToGlobalState = (0, import_ahooks.useMemoizedFn)(() => {
268
270
  });
269
271
  const { selectCustomer } = (0, import_pisellos.useCustomer)({
@@ -315,6 +317,7 @@ var TicketBooking = () => {
315
317
  _initFn(() => {
316
318
  });
317
319
  selectCustomer(null);
320
+ enableAllScanListeners();
318
321
  }
319
322
  );
320
323
  (_e2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _e2.mountFunction(
@@ -322,6 +325,7 @@ var TicketBooking = () => {
322
325
  "voidBooking",
323
326
  (orderId) => {
324
327
  (0, import_serve.voidAppointment)(orderId);
328
+ enableAllScanListeners();
325
329
  }
326
330
  );
327
331
  return () => {
@@ -106,10 +106,13 @@ var useCustomer = (props) => {
106
106
  setLoading(false);
107
107
  });
108
108
  const selectCustomer = (0, import_ahooks.useMemoizedFn)((customer) => {
109
- bookingTicket.setActiveCustomer(customer);
109
+ var _a, _b;
110
+ (_a = bookingTicket == null ? void 0 : bookingTicket.setActiveCustomer) == null ? void 0 : _a.call(bookingTicket, customer);
111
+ (_b = props.changeCustomerToGlobalState) == null ? void 0 : _b.call(props, customer);
110
112
  });
111
113
  const addCustomerToFirst = (0, import_ahooks.useMemoizedFn)((customer) => {
112
- bookingTicket.addCustomerToFirst(customer);
114
+ var _a;
115
+ (_a = bookingTicket == null ? void 0 : bookingTicket.addCustomerToFirst) == null ? void 0 : _a.call(bookingTicket, customer);
113
116
  });
114
117
  return {
115
118
  // 客户列表
@@ -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,44 @@
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/ticketBooking/hooks/pisellos/useScanManager.ts
20
+ var useScanManager_exports = {};
21
+ __export(useScanManager_exports, {
22
+ default: () => useScanManager_default
23
+ });
24
+ module.exports = __toCommonJS(useScanManager_exports);
25
+ var import_bookingTicket = require("./bookingTicket");
26
+ var import_ahooks = require("ahooks");
27
+ var useScanManager = () => {
28
+ const bookingTicket = (0, import_bookingTicket.useBookingTicket)();
29
+ const disableAllScanListeners = (0, import_ahooks.useMemoizedFn)(() => {
30
+ bookingTicket.disableAllScanListeners();
31
+ });
32
+ const enableAllScanListeners = (0, import_ahooks.useMemoizedFn)(() => {
33
+ bookingTicket.enableAllScanListeners();
34
+ });
35
+ const clearAllScanListenersTaskQueue = (0, import_ahooks.useMemoizedFn)(() => {
36
+ bookingTicket.clearAllScanListenersTaskQueue();
37
+ });
38
+ return {
39
+ disableAllScanListeners,
40
+ enableAllScanListeners,
41
+ clearAllScanListenersTaskQueue
42
+ };
43
+ };
44
+ var useScanManager_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 {};
@@ -31,6 +31,7 @@ var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  addService: () => addService,
33
33
  addServiceScroll: () => addServiceScroll,
34
+ createSimpleCacheItem: () => createSimpleCacheItem,
34
35
  formatBookingList: () => formatBookingList,
35
36
  formatDateToStr: () => formatDateToStr,
36
37
  formatHolder: () => formatHolder,
@@ -45,12 +46,14 @@ __export(utils_exports, {
45
46
  getIsParallelResourcesBooking: () => getIsParallelResourcesBooking,
46
47
  getIsShowNumber: () => getIsShowNumber,
47
48
  getNextTimeSlice: () => getNextTimeSlice,
49
+ isSameProduct: () => isSameProduct,
48
50
  restoreProductOtherData: () => restoreProductOtherData
49
51
  });
50
52
  module.exports = __toCommonJS(utils_exports);
51
53
  var import_dayjs = __toESM(require("dayjs"));
52
54
  var import_utils = require("../../booking/info/service2/utils");
53
55
  var import_utils2 = require("@pisell/utils");
56
+ var import_utils3 = require("@pisell/utils");
54
57
  var formatDateToStr = (date) => {
55
58
  const format = (val) => {
56
59
  return (0, import_dayjs.default)(val).format("YYYY-MM-DD HH:mm:ss");
@@ -279,10 +282,28 @@ var formatScanGlobal = (data) => {
279
282
  return { searchType, data: resultData, scanCode };
280
283
  }
281
284
  };
285
+ var createSimpleCacheItem = (item, e, state) => {
286
+ let cacheItem = {
287
+ ...item,
288
+ product_id: item.id,
289
+ _id: (0, import_utils3.getUniqueId)(),
290
+ _key: e.key,
291
+ _extend: {
292
+ start_date: state.date.value,
293
+ quantity: (e == null ? void 0 : e.quantity) || 1,
294
+ price: item.price,
295
+ product_name: item.title,
296
+ other: e
297
+ },
298
+ new: 1
299
+ };
300
+ return cacheItem;
301
+ };
282
302
  // Annotate the CommonJS export names for ESM import in node:
283
303
  0 && (module.exports = {
284
304
  addService,
285
305
  addServiceScroll,
306
+ createSimpleCacheItem,
286
307
  formatBookingList,
287
308
  formatDateToStr,
288
309
  formatHolder,
@@ -297,5 +318,6 @@ var formatScanGlobal = (data) => {
297
318
  getIsParallelResourcesBooking,
298
319
  getIsShowNumber,
299
320
  getNextTimeSlice,
321
+ isSameProduct,
300
322
  restoreProductOtherData
301
323
  });