@pisell/private-materials 3.4.8 → 3.4.10

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 (78) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +4 -4
  6. package/build/lowcode/view.js +4 -4
  7. package/es/components/booking/components/customSelect/index.js +1 -0
  8. package/es/components/booking/forms/single/RenderValueById.js +2 -2
  9. package/es/components/booking/hooks/useClearCart.js +11 -8
  10. package/es/components/booking/hooks/useQuotation.js +1 -1
  11. package/es/components/booking/info/client/index.js +3 -2
  12. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  13. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  14. package/es/components/booking/info/hooks/useInfoHolder.js +16 -9
  15. package/es/components/booking/info/service/Lists.d.ts +1 -0
  16. package/es/components/booking/info/service/Lists.js +36 -26
  17. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  18. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  19. package/es/components/booking/info/service2/Lists.d.ts +1 -0
  20. package/es/components/booking/info/service2/utils.js +20 -21
  21. package/es/components/booking/info/utils.js +1 -1
  22. package/es/components/booking/info2/index.js +1 -0
  23. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  24. package/es/components/booking/info2/service/addService/utils.js +8 -4
  25. package/es/components/booking/info2/service/addTimeModal/index.js +3 -0
  26. package/es/components/booking/info2/service/editService/Resources/index.js +5 -0
  27. package/es/components/booking/info2/service/editService/index.js +266 -170
  28. package/es/components/booking/info2/service/index.js +19 -15
  29. package/es/components/booking/info2/utilsByBooking.js +3 -2
  30. package/es/components/booking/materiels/duration/index.js +9 -2
  31. package/es/components/booking/materiels/holder/index.d.ts +1 -0
  32. package/es/components/booking/materiels/startTime/index.d.ts +1 -0
  33. package/es/components/booking/materiels/startTime/index.js +2 -2
  34. package/es/components/booking/utils.js +3 -3
  35. package/es/components/schedules/components/CurrentDay/index.d.ts +1 -0
  36. package/es/components/schedules/products/index.d.ts +1 -0
  37. package/es/components/shoppingCart/components/Cart/Product.js +48 -41
  38. package/es/components/shoppingCart/components/Cart/index.js +21 -18
  39. package/es/components/ticketBooking/components/addServiceVariant/addService.js +249 -158
  40. package/es/components/ticketBooking/components/timeBar/index.js +78 -71
  41. package/es/components/ticketBooking/utils/index.d.ts +2 -0
  42. package/es/components/ticketBooking/utils/index.js +18 -1
  43. package/lib/components/booking/components/customSelect/index.js +1 -0
  44. package/lib/components/booking/forms/single/RenderValueById.js +6 -6
  45. package/lib/components/booking/hooks/useClearCart.js +16 -13
  46. package/lib/components/booking/hooks/useQuotation.js +1 -1
  47. package/lib/components/booking/info/client/index.js +5 -4
  48. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  49. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  50. package/lib/components/booking/info/hooks/useInfoHolder.js +10 -9
  51. package/lib/components/booking/info/service/Lists.d.ts +1 -0
  52. package/lib/components/booking/info/service/Lists.js +35 -23
  53. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  54. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  55. package/lib/components/booking/info/service2/Lists.d.ts +1 -0
  56. package/lib/components/booking/info/service2/utils.js +17 -17
  57. package/lib/components/booking/info/utils.js +2 -1
  58. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  59. package/lib/components/booking/info2/service/addService/utils.js +7 -5
  60. package/lib/components/booking/info2/service/addTimeModal/index.js +3 -0
  61. package/lib/components/booking/info2/service/editService/Resources/index.js +2 -0
  62. package/lib/components/booking/info2/service/editService/index.js +139 -74
  63. package/lib/components/booking/info2/service/index.js +13 -9
  64. package/lib/components/booking/info2/utilsByBooking.js +4 -4
  65. package/lib/components/booking/materiels/duration/index.js +7 -2
  66. package/lib/components/booking/materiels/holder/index.d.ts +1 -0
  67. package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
  68. package/lib/components/booking/materiels/startTime/index.js +1 -1
  69. package/lib/components/booking/utils.js +3 -3
  70. package/lib/components/schedules/components/CurrentDay/index.d.ts +1 -0
  71. package/lib/components/schedules/products/index.d.ts +1 -0
  72. package/lib/components/shoppingCart/components/Cart/Product.js +31 -21
  73. package/lib/components/shoppingCart/components/Cart/index.js +18 -15
  74. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +196 -127
  75. package/lib/components/ticketBooking/components/timeBar/index.js +95 -88
  76. package/lib/components/ticketBooking/utils/index.d.ts +2 -0
  77. package/lib/components/ticketBooking/utils/index.js +22 -0
  78. package/package.json +4 -4
@@ -66,20 +66,23 @@ var Cart = () => {
66
66
  };
67
67
  });
68
68
  }, [carts, platform]);
69
- return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-lowcode__shopping-cart") }, isProductList ? /* @__PURE__ */ import_react.default.createElement(import_Product.default, { id: void 0, lists: state == null ? void 0 : state.products }) : /* @__PURE__ */ import_react.default.createElement(
70
- import_materials.Collapse,
71
- {
72
- items: cartsMap,
73
- showHeader: true,
74
- panelBackground: "#ffffff",
75
- collapsible: platform !== "shop" ? "disabled" : "-",
76
- accordion: platform === "shop",
77
- onChange: (key) => {
78
- updateState({ activeKey: key });
79
- onActiveKey(key);
80
- },
81
- ...collapseParams
82
- }
83
- ));
69
+ return (0, import_react.useMemo)(() => {
70
+ console.log("render cart 22222");
71
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-lowcode__shopping-cart") }, isProductList ? /* @__PURE__ */ import_react.default.createElement(import_Product.default, { id: void 0, lists: state == null ? void 0 : state.products }) : /* @__PURE__ */ import_react.default.createElement(
72
+ import_materials.Collapse,
73
+ {
74
+ items: cartsMap,
75
+ showHeader: true,
76
+ panelBackground: "#ffffff",
77
+ collapsible: platform !== "shop" ? "disabled" : "-",
78
+ accordion: platform === "shop",
79
+ onChange: (key) => {
80
+ updateState({ activeKey: key });
81
+ onActiveKey(key);
82
+ },
83
+ ...collapseParams
84
+ }
85
+ ));
86
+ }, [isProductList, cartsMap, platform, collapseParams, state == null ? void 0 : state.products]);
84
87
  };
85
88
  var Cart_default = Cart;
@@ -48,7 +48,7 @@ var import_utils6 = require("../../utils");
48
48
  var import_notAvailable = __toESM(require("../notAvailable"));
49
49
  var import_dayjs = __toESM(require("dayjs"));
50
50
  var AddSerivce = (props) => {
51
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
51
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
52
52
  const { onEdit, state, dispatch, renderMode = "current" } = props;
53
53
  const [loading, setLoading] = (0, import_react.useState)(true);
54
54
  const context = (0, import_useEngineContext.default)();
@@ -70,6 +70,17 @@ var AddSerivce = (props) => {
70
70
  const [currentProduct, setCurrentProduct] = (0, import_react.useState)(null);
71
71
  const stateRef = (0, import_react.useRef)(state);
72
72
  stateRef.current = state;
73
+ (0, import_react.useEffect)(() => {
74
+ return () => {
75
+ Object.values(debounceTimersRef.current).forEach((timer) => {
76
+ if (timer) clearTimeout(timer);
77
+ });
78
+ debounceTimersRef.current = {};
79
+ };
80
+ }, []);
81
+ const pendingCacheValuesRef = (0, import_react.useRef)({});
82
+ const clickCountRef = (0, import_react.useRef)({});
83
+ const debounceTimersRef = (0, import_react.useRef)({});
73
84
  const menuList = (0, import_react.useMemo)(() => {
74
85
  var _a2, _b2, _c2;
75
86
  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) || [];
@@ -202,16 +213,199 @@ var AddSerivce = (props) => {
202
213
  }
203
214
  });
204
215
  };
216
+ const executeCacheValues = (0, import_ahooks.useMemoizedFn)((productId, originalCacheValues, item, originalCallback) => {
217
+ const clickCount = clickCountRef.current[productId] || 1;
218
+ const finalCacheValues = {
219
+ ...originalCacheValues,
220
+ quantity: clickCount
221
+ };
222
+ delete pendingCacheValuesRef.current[productId];
223
+ delete clickCountRef.current[productId];
224
+ delete debounceTimersRef.current[productId];
225
+ originalCallback(finalCacheValues, "", item, true);
226
+ });
227
+ const debouncedExecuteCacheValues = (0, import_ahooks.useMemoizedFn)((productId, cacheValues, item, callback) => {
228
+ if (debounceTimersRef.current[productId]) {
229
+ clearTimeout(debounceTimersRef.current[productId]);
230
+ }
231
+ debounceTimersRef.current[productId] = setTimeout(() => {
232
+ executeCacheValues(productId, cacheValues, item, callback);
233
+ }, 0);
234
+ });
205
235
  const handleSelectProduct = (0, import_ahooks.useMemoizedFn)(
206
236
  (item, type = "select") => {
237
+ var _a2, _b2, _c2;
207
238
  const isSession = (0, import_utils2.isSessionProduct)(item);
208
239
  const isEject = (0, import_utils2.getIsEject)(item, type);
209
240
  const isOnlySession = (0, import_utils2.getIsOnlySession)(item);
210
241
  let lock = false;
242
+ let cacheValues = null;
211
243
  if (isEject) {
212
244
  setCurrentProduct(item);
213
245
  } else {
214
246
  setCurrentProduct(null);
247
+ if ((item == null ? void 0 : item.extension_type) === "normal") {
248
+ cacheValues = {
249
+ bundle: [],
250
+ key: item.id,
251
+ option: [],
252
+ product_id: item.id,
253
+ product_variant_id: 0,
254
+ quantity: 1,
255
+ rowKey: item.id,
256
+ session: null,
257
+ unique: "08974625397",
258
+ _originalItem: item
259
+ // 保存原始商品信息
260
+ };
261
+ }
262
+ }
263
+ const callback = async (e, extension_type, detail, notShowToast) => {
264
+ var _a3, _b3, _c3, _d2, _e2, _f2, _g2;
265
+ setCurrentProduct(null);
266
+ if (lock) {
267
+ return;
268
+ }
269
+ lock = true;
270
+ setTimeout(() => {
271
+ lock = false;
272
+ }, 2e3);
273
+ if (!isBooking4) {
274
+ const data = await createBookingData({
275
+ product: { ...detail || item, _params: e }
276
+ });
277
+ createBooking({ booking: data });
278
+ return;
279
+ }
280
+ const _detail = detail || item;
281
+ const other = JSON.parse(JSON.stringify(e));
282
+ other.session = e.session;
283
+ let cacheItem = {
284
+ ..._detail,
285
+ product_id: item.id,
286
+ _id: (0, import_utils.getUniqueId)(),
287
+ _key: e.key,
288
+ _extend: {
289
+ start_date: state.date.value,
290
+ quantity: (e == null ? void 0 : e.quantity) || 1,
291
+ price: _detail.price,
292
+ product_name: item.title,
293
+ other
294
+ },
295
+ new: 1
296
+ };
297
+ let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
298
+ cacheItem._extend.total = _total;
299
+ cacheItem._extend.origin_total = _total;
300
+ const _isEdit = !!state.service.cacheItem;
301
+ if (_isEdit) {
302
+ cacheItem._id = (_a3 = state.service.cacheItem) == null ? void 0 : _a3._id;
303
+ cacheItem.new = 0;
304
+ }
305
+ if (renderMode === "current") {
306
+ cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
307
+ }
308
+ cacheItem = (0, import_utils3.getProductExtend)({
309
+ cacheItem,
310
+ state,
311
+ isDisabledTime: true
312
+ });
313
+ if (state.renderType === "eventBooking") {
314
+ cacheItem.autoClose = false;
315
+ }
316
+ if (cacheItem.autoClose) {
317
+ cacheItem.autoClose = false;
318
+ cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
319
+ let { list: _list, quantity } = (0, import_utils6.addService)(
320
+ [...state.service.value],
321
+ cacheItem,
322
+ state
323
+ );
324
+ if (!notShowToast) {
325
+ (_b3 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _b3.call(
326
+ Toast,
327
+ /* @__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")(
328
+ quantity || 1
329
+ )))
330
+ );
331
+ }
332
+ (0, import_utils6.addServiceScroll)(e.rowKey, cacheItem);
333
+ try {
334
+ if (((_g2 = (_f2 = (_e2 = (_d2 = (_c3 = context.appHelper.utils.store) == null ? void 0 : _c3.getState) == null ? void 0 : _d2.call(_c3)) == null ? void 0 : _e2.global) == null ? void 0 : _f2.globalConfig) == null ? void 0 : _g2.id) === 2155) {
335
+ const val = _list == null ? void 0 : _list.map((s) => {
336
+ return {
337
+ product_id: s == null ? void 0 : s.product_id,
338
+ detailId: s == null ? void 0 : s.id,
339
+ detailProductId: s == null ? void 0 : s.product_id,
340
+ product_name: s == null ? void 0 : s.title,
341
+ price: s == null ? void 0 : s.price,
342
+ _id: s == null ? void 0 : s._id,
343
+ _key: s == null ? void 0 : s._key,
344
+ _serviceKey: s == null ? void 0 : s._serviceKey
345
+ };
346
+ });
347
+ const sendData = {
348
+ product_id: item == null ? void 0 : item.id,
349
+ detailId: _detail == null ? void 0 : _detail.id,
350
+ detailProductId: _detail == null ? void 0 : _detail.product_id,
351
+ product_name: item == null ? void 0 : item.title,
352
+ price: _detail == null ? void 0 : _detail.price,
353
+ serviceVal: val
354
+ };
355
+ (0, import_utils.sendWarningLog)({
356
+ title: "addService",
357
+ content: [
358
+ { key: "添加数据", value: JSON.stringify(sendData) },
359
+ {
360
+ key: "日期",
361
+ value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
362
+ }
363
+ ]
364
+ });
365
+ }
366
+ } catch (error) {
367
+ }
368
+ dispatch({
369
+ type: "setService",
370
+ payload: {
371
+ addModal: false,
372
+ value: _list,
373
+ edit: true,
374
+ changeService: false
375
+ }
376
+ });
377
+ } else {
378
+ dispatch({
379
+ type: "setService",
380
+ payload: {
381
+ editModal: true,
382
+ cacheItem,
383
+ addModal: !cacheItem.autoClose,
384
+ changeService: false
385
+ }
386
+ });
387
+ onEdit == null ? void 0 : onEdit(cacheItem);
388
+ }
389
+ };
390
+ if (cacheValues) {
391
+ const productId = item.id.toString();
392
+ if (pendingCacheValuesRef.current[productId]) {
393
+ clickCountRef.current[productId] = (clickCountRef.current[productId] || 1) + 1;
394
+ } else {
395
+ pendingCacheValuesRef.current[productId] = cacheValues;
396
+ clickCountRef.current[productId] = 1;
397
+ }
398
+ const cacheItem = (0, import_utils6.createSimpleCacheItem)(item, cacheValues, state);
399
+ const detail = (_a2 = state.service.value) == null ? void 0 : _a2.find((val) => (0, import_utils6.isSameProduct)(val, cacheItem));
400
+ const originalQuantity = ((_b2 = detail == null ? void 0 : detail._extend) == null ? void 0 : _b2.quantity) || 0;
401
+ (_c2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _c2.call(
402
+ Toast,
403
+ /* @__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")(
404
+ (clickCountRef.current[productId] || 1) + originalQuantity
405
+ )))
406
+ );
407
+ debouncedExecuteCacheValues(productId, cacheValues, item, callback);
408
+ return;
215
409
  }
216
410
  state.action({
217
411
  type: "pisell1.handleOpenProductModal",
@@ -233,131 +427,7 @@ var AddSerivce = (props) => {
233
427
  onCancel: () => {
234
428
  setCurrentProduct(null);
235
429
  },
236
- callback: async (e, extension_type, detail) => {
237
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
238
- setCurrentProduct(null);
239
- if (lock) {
240
- return;
241
- }
242
- lock = true;
243
- setTimeout(() => {
244
- lock = false;
245
- }, 2e3);
246
- if (!isBooking4) {
247
- const data = await createBookingData({
248
- product: { ...detail || item, _params: e }
249
- });
250
- createBooking({ booking: data });
251
- return;
252
- }
253
- const _detail = detail || item;
254
- const other = JSON.parse(JSON.stringify(e));
255
- other.session = e.session;
256
- let cacheItem = {
257
- ..._detail,
258
- product_id: item.id,
259
- _id: (0, import_utils.getUniqueId)(),
260
- _key: e.key,
261
- _extend: {
262
- start_date: state.date.value,
263
- quantity: (e == null ? void 0 : e.quantity) || 1,
264
- price: _detail.price,
265
- product_name: item.title,
266
- other
267
- },
268
- new: 1
269
- };
270
- let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
271
- cacheItem._extend.total = _total;
272
- cacheItem._extend.origin_total = _total;
273
- const _isEdit = !!state.service.cacheItem;
274
- if (_isEdit) {
275
- cacheItem._id = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._id;
276
- cacheItem.new = 0;
277
- }
278
- if (renderMode === "current") {
279
- cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
280
- }
281
- cacheItem = (0, import_utils3.getProductExtend)({
282
- cacheItem,
283
- state,
284
- isDisabledTime: true
285
- });
286
- if (state.renderType === "eventBooking") {
287
- cacheItem.autoClose = false;
288
- }
289
- if (cacheItem.autoClose) {
290
- cacheItem.autoClose = false;
291
- cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
292
- let { list: _list, quantity } = (0, import_utils6.addService)(
293
- [...state.service.value],
294
- cacheItem,
295
- state
296
- );
297
- (_b2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _b2.call(
298
- Toast,
299
- /* @__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")(
300
- quantity || 1
301
- )))
302
- );
303
- (0, import_utils6.addServiceScroll)(e.rowKey, cacheItem);
304
- try {
305
- 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) {
306
- const val = _list == null ? void 0 : _list.map((s) => {
307
- return {
308
- product_id: s == null ? void 0 : s.product_id,
309
- detailId: s == null ? void 0 : s.id,
310
- detailProductId: s == null ? void 0 : s.product_id,
311
- product_name: s == null ? void 0 : s.title,
312
- price: s == null ? void 0 : s.price,
313
- _id: s == null ? void 0 : s._id,
314
- _key: s == null ? void 0 : s._key,
315
- _serviceKey: s == null ? void 0 : s._serviceKey
316
- };
317
- });
318
- const sendData = {
319
- product_id: item == null ? void 0 : item.id,
320
- detailId: _detail == null ? void 0 : _detail.id,
321
- detailProductId: _detail == null ? void 0 : _detail.product_id,
322
- product_name: item == null ? void 0 : item.title,
323
- price: _detail == null ? void 0 : _detail.price,
324
- serviceVal: val
325
- };
326
- (0, import_utils.sendWarningLog)({
327
- title: "addService",
328
- content: [
329
- { key: "添加数据", value: JSON.stringify(sendData) },
330
- {
331
- key: "日期",
332
- value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
333
- }
334
- ]
335
- });
336
- }
337
- } catch (error) {
338
- }
339
- dispatch({
340
- type: "setService",
341
- payload: {
342
- addModal: false,
343
- value: _list,
344
- edit: true,
345
- changeService: false
346
- }
347
- });
348
- } else {
349
- dispatch({
350
- type: "setService",
351
- payload: {
352
- editModal: true,
353
- cacheItem,
354
- addModal: !cacheItem.autoClose,
355
- changeService: false
356
- }
357
- });
358
- onEdit == null ? void 0 : onEdit(cacheItem);
359
- }
360
- }
430
+ callback
361
431
  });
362
432
  }
363
433
  );
@@ -415,7 +485,6 @@ var AddSerivce = (props) => {
415
485
  }
416
486
  return null;
417
487
  }, [
418
- (_n = (_m = state.service) == null ? void 0 : _m.cacheItem) == null ? void 0 : _n.autoClose,
419
488
  state.service.addModal,
420
489
  import_utils.locales,
421
490
  renderList,
@@ -35,115 +35,122 @@ module.exports = __toCommonJS(timeBar_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_icons = require("@ant-design/icons");
37
37
  var import_materials = require("@pisell/materials");
38
+ var import_ahooks = require("ahooks");
38
39
  var import_antd = require("antd");
39
40
  var import_classnames = __toESM(require("classnames"));
40
41
  var import_utils = require("@pisell/utils");
41
42
  var import_index = require("./index.less");
42
43
  var TimeBar = (props) => {
43
- var _a, _b, _c, _d;
44
+ var _a, _b;
44
45
  const { globalState: state, setGlobalState, locale } = props;
45
- const _onClickNext = () => {
46
- var _a2, _b2, _c2, _d2;
46
+ const _onClickNext = (0, import_ahooks.useMemoizedFn)(() => {
47
+ var _a2, _b2, _c, _d;
47
48
  const currentTime = (_b2 = (_a2 = state.modalState) == null ? void 0 : _a2.date) == null ? void 0 : _b2.value;
48
49
  const newTime = currentTime["add"](1, "day");
49
- (_c2 = props.onDateChange) == null ? void 0 : _c2.call(props, newTime, newTime.format("YYYY-MM-DD HH:mm:ss"));
50
- (_d2 = props.setIntervalTime) == null ? void 0 : _d2.call(props, false);
51
- };
52
- const _onClickPre = () => {
53
- var _a2, _b2, _c2, _d2;
50
+ (_c = props.onDateChange) == null ? void 0 : _c.call(props, newTime, newTime.format("YYYY-MM-DD HH:mm:ss"));
51
+ (_d = props.setIntervalTime) == null ? void 0 : _d.call(props, false);
52
+ });
53
+ const _onClickPre = (0, import_ahooks.useMemoizedFn)(() => {
54
+ var _a2, _b2, _c, _d;
54
55
  const currentTime = (_b2 = (_a2 = state.modalState) == null ? void 0 : _a2.date) == null ? void 0 : _b2.value;
55
56
  const newTime = currentTime["subtract"](1, "day");
56
- (_c2 = props.onDateChange) == null ? void 0 : _c2.call(props, newTime, newTime.format("YYYY-MM-DD HH:mm:ss"));
57
- (_d2 = props.setIntervalTime) == null ? void 0 : _d2.call(props, false);
58
- };
59
- const _onClickToday = () => {
60
- var _a2;
61
- (_a2 = props.setIntervalTime) == null ? void 0 : _a2.call(props, true);
62
- };
63
- const _onClickNow = () => {
57
+ (_c = props.onDateChange) == null ? void 0 : _c.call(props, newTime, newTime.format("YYYY-MM-DD HH:mm:ss"));
58
+ (_d = props.setIntervalTime) == null ? void 0 : _d.call(props, false);
59
+ });
60
+ const _onClickToday = (0, import_ahooks.useMemoizedFn)(() => {
61
+ var _a2, _b2, _c, _d;
62
+ const currentTime = (_b2 = (_a2 = state.modalState) == null ? void 0 : _a2.date) == null ? void 0 : _b2.value;
63
+ const newTime = currentTime["subtract"](1, "day");
64
+ (_c = props.onDateChange) == null ? void 0 : _c.call(props, newTime, newTime.format("YYYY-MM-DD HH:mm:ss"));
65
+ (_d = props.setIntervalTime) == null ? void 0 : _d.call(props, false);
66
+ });
67
+ const _onClickNow = (0, import_ahooks.useMemoizedFn)(() => {
64
68
  var _a2;
65
69
  (_a2 = props.setIntervalTime) == null ? void 0 : _a2.call(props, true);
66
- };
67
- const _onDateTimeChange = (timeString) => {
68
- var _a2, _b2, _c2, _d2;
70
+ });
71
+ const _onDateTimeChange = (0, import_ahooks.useMemoizedFn)((timeString) => {
72
+ var _a2, _b2, _c, _d;
69
73
  const currentTime = (_b2 = (_a2 = state.modalState) == null ? void 0 : _a2.date) == null ? void 0 : _b2.value;
70
74
  const [hours, minutes] = timeString.split(":").map(Number);
71
75
  const newTime = currentTime.hour(hours).minute(minutes).second(0);
72
- (_c2 = props.onDateTimeChange) == null ? void 0 : _c2.call(props, newTime, newTime.format("YYYY-MM-DD HH:mm:ss"));
76
+ (_c = props.onDateTimeChange) == null ? void 0 : _c.call(props, newTime, newTime.format("YYYY-MM-DD HH:mm:ss"));
73
77
  setGlobalState({
74
78
  isTimeChange: true
75
79
  });
76
- (_d2 = props.setIntervalTime) == null ? void 0 : _d2.call(props, false);
77
- };
78
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-ticket-booking-time-bar" }, /* @__PURE__ */ import_react.default.createElement(
79
- import_antd.Button,
80
- {
81
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons.LeftOutlined, null),
82
- onClick: _onClickPre,
83
- size: "large"
84
- }
85
- ), /* @__PURE__ */ import_react.default.createElement(
86
- import_antd.Button,
87
- {
88
- onClick: _onClickToday,
89
- size: "large",
90
- style: state.intervalSetTime ? { background: "#000", color: "#fff" } : void 0
91
- },
92
- import_utils.locales.getText("pisell2.ticket-booking.today")
93
- ), /* @__PURE__ */ import_react.default.createElement(
94
- "div",
95
- {
96
- className: (0, import_classnames.default)({
97
- "booking-page-date-picker-select": state.isDateChange
98
- }),
99
- style: { width: 200, flexShrink: 0 }
100
- },
101
- /* @__PURE__ */ import_react.default.createElement(
102
- import_materials.DatePicker,
80
+ (_d = props.setIntervalTime) == null ? void 0 : _d.call(props, false);
81
+ });
82
+ return (0, import_react.useMemo)(() => {
83
+ var _a2, _b2, _c, _d;
84
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-ticket-booking-time-bar" }, /* @__PURE__ */ import_react.default.createElement(
85
+ import_antd.Button,
103
86
  {
104
- inputReadOnly: true,
105
- value: (_b = (_a = state == null ? void 0 : state.modalState) == null ? void 0 : _a.date) == null ? void 0 : _b.value,
106
- format: locale === "en" ? "dddd, DD MMM YYYY" : "YYYY年MM月DD日",
107
- onChange: props == null ? void 0 : props.onDateChange,
108
- size: "large",
109
- style: { width: "100%" }
87
+ icon: /* @__PURE__ */ import_react.default.createElement(import_icons.LeftOutlined, null),
88
+ onClick: _onClickPre,
89
+ size: "large"
110
90
  }
111
- )
112
- ), /* @__PURE__ */ import_react.default.createElement(
113
- import_antd.Button,
114
- {
115
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons.RightOutlined, null),
116
- onClick: _onClickNext,
117
- size: "large"
118
- }
119
- ), /* @__PURE__ */ import_react.default.createElement(
120
- "div",
121
- {
122
- className: (0, import_classnames.default)({
123
- "booking-page-date-picker-select": state.isTimeChange
124
- })
125
- },
126
- /* @__PURE__ */ import_react.default.createElement(
127
- import_materials.SelectTime,
91
+ ), /* @__PURE__ */ import_react.default.createElement(
92
+ import_antd.Button,
128
93
  {
129
- value: (_d = (_c = state == null ? void 0 : state.modalState) == null ? void 0 : _c.date) == null ? void 0 : _d.value.format("HH:mm"),
130
- onChange: _onDateTimeChange,
131
- popoverProps: {
132
- style: { zoom: 0.8 }
133
- },
134
- timePickerProps: {},
135
- timeProps: {},
136
- slice: 5
94
+ onClick: _onClickToday,
95
+ size: "large",
96
+ style: state.intervalSetTime ? { background: "#000", color: "#fff" } : void 0
97
+ },
98
+ import_utils.locales.getText("pisell2.ticket-booking.today")
99
+ ), /* @__PURE__ */ import_react.default.createElement(
100
+ "div",
101
+ {
102
+ className: (0, import_classnames.default)({
103
+ "booking-page-date-picker-select": state.isDateChange
104
+ }),
105
+ style: { width: 200, flexShrink: 0 }
106
+ },
107
+ /* @__PURE__ */ import_react.default.createElement(
108
+ import_materials.DatePicker,
109
+ {
110
+ inputReadOnly: true,
111
+ value: (_b2 = (_a2 = state == null ? void 0 : state.modalState) == null ? void 0 : _a2.date) == null ? void 0 : _b2.value,
112
+ format: locale === "en" ? "dddd, DD MMM YYYY" : "YYYY年MM月DD日",
113
+ onChange: props == null ? void 0 : props.onDateChange,
114
+ size: "large",
115
+ style: { width: "100%" }
116
+ }
117
+ )
118
+ ), /* @__PURE__ */ import_react.default.createElement(
119
+ import_antd.Button,
120
+ {
121
+ icon: /* @__PURE__ */ import_react.default.createElement(import_icons.RightOutlined, null),
122
+ onClick: _onClickNext,
123
+ size: "large"
137
124
  }
138
- )
139
- ), /* @__PURE__ */ import_react.default.createElement(
140
- import_antd.Button,
141
- {
142
- onClick: _onClickNow,
143
- size: "large",
144
- style: state.intervalSetTime ? { background: "#000", color: "#fff" } : void 0
145
- },
146
- import_utils.locales.getText("pisell2.ticket-booking.now")
147
- ));
125
+ ), /* @__PURE__ */ import_react.default.createElement(
126
+ "div",
127
+ {
128
+ className: (0, import_classnames.default)({
129
+ "booking-page-date-picker-select": state.isTimeChange
130
+ })
131
+ },
132
+ /* @__PURE__ */ import_react.default.createElement(
133
+ import_materials.SelectTime,
134
+ {
135
+ value: (_d = (_c = state == null ? void 0 : state.modalState) == null ? void 0 : _c.date) == null ? void 0 : _d.value.format("HH:mm"),
136
+ onChange: _onDateTimeChange,
137
+ popoverProps: {
138
+ style: { zoom: 0.8 }
139
+ },
140
+ timePickerProps: {},
141
+ timeProps: {},
142
+ slice: 5
143
+ }
144
+ )
145
+ ), /* @__PURE__ */ import_react.default.createElement(
146
+ import_antd.Button,
147
+ {
148
+ onClick: _onClickNow,
149
+ size: "large",
150
+ style: state.intervalSetTime ? { background: "#000", color: "#fff" } : void 0
151
+ },
152
+ import_utils.locales.getText("pisell2.ticket-booking.now")
153
+ ));
154
+ }, [(_b = (_a = state.modalState) == null ? void 0 : _a.date) == null ? void 0 : _b.value, state.intervalSetTime, state.isTimeChange, state.isDateChange, locale]);
148
155
  };
149
156
  var timeBar_default = TimeBar;
@@ -12,6 +12,7 @@ export declare const restoreProductOtherData: (data: any) => {
12
12
  product_variant_id: number;
13
13
  quantity: number;
14
14
  } | undefined;
15
+ export declare const isSameProduct: (a: any, b: any) => boolean;
15
16
  export declare const addService: (list: any[], addItem: any, state: any) => {
16
17
  list: any[];
17
18
  quantity: any;
@@ -21,3 +22,4 @@ export declare const getCartProductOverlay: (state: any) => any;
21
22
  export declare const getIsOverlayProduct: (item: any, state: any) => any;
22
23
  export declare const getIsShowNumber: (item: any, state: any) => any;
23
24
  export declare const genServiceKey: (item: any) => string;
25
+ export declare const createSimpleCacheItem: (item: any, e: any, state: any) => any;