@pisell/private-materials 3.4.8 → 3.4.9

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 (48) 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 +3 -3
  6. package/build/lowcode/view.js +3 -3
  7. package/es/components/booking/components/customSelect/index.js +1 -0
  8. package/es/components/booking/hooks/useClearCart.js +11 -8
  9. package/es/components/booking/hooks/useQuotation.js +1 -1
  10. package/es/components/booking/info/client/index.js +3 -2
  11. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  12. package/es/components/booking/info/hooks/useInfoHolder.js +16 -9
  13. package/es/components/booking/info/service/Lists.js +36 -26
  14. package/es/components/booking/info/service2/utils.js +20 -21
  15. package/es/components/booking/info2/index.js +1 -0
  16. package/es/components/booking/info2/service/addService/utils.js +6 -3
  17. package/es/components/booking/info2/service/addTimeModal/index.js +3 -0
  18. package/es/components/booking/info2/service/editService/Resources/index.js +5 -0
  19. package/es/components/booking/info2/service/editService/index.js +266 -170
  20. package/es/components/booking/info2/service/index.js +19 -15
  21. package/es/components/booking/materiels/duration/index.js +9 -2
  22. package/es/components/shoppingCart/components/Cart/Product.js +48 -41
  23. package/es/components/shoppingCart/components/Cart/index.js +21 -18
  24. package/es/components/ticketBooking/components/addServiceVariant/addService.js +249 -158
  25. package/es/components/ticketBooking/components/timeBar/index.js +78 -71
  26. package/es/components/ticketBooking/utils/index.d.ts +2 -0
  27. package/es/components/ticketBooking/utils/index.js +18 -1
  28. package/lib/components/booking/components/customSelect/index.js +1 -0
  29. package/lib/components/booking/hooks/useClearCart.js +16 -13
  30. package/lib/components/booking/hooks/useQuotation.js +1 -1
  31. package/lib/components/booking/info/client/index.js +5 -4
  32. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  33. package/lib/components/booking/info/hooks/useInfoHolder.js +10 -9
  34. package/lib/components/booking/info/service/Lists.js +35 -23
  35. package/lib/components/booking/info/service2/utils.js +17 -17
  36. package/lib/components/booking/info2/service/addService/utils.js +4 -2
  37. package/lib/components/booking/info2/service/addTimeModal/index.js +3 -0
  38. package/lib/components/booking/info2/service/editService/Resources/index.js +2 -0
  39. package/lib/components/booking/info2/service/editService/index.js +139 -74
  40. package/lib/components/booking/info2/service/index.js +13 -9
  41. package/lib/components/booking/materiels/duration/index.js +7 -2
  42. package/lib/components/shoppingCart/components/Cart/Product.js +31 -21
  43. package/lib/components/shoppingCart/components/Cart/index.js +18 -15
  44. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +196 -127
  45. package/lib/components/ticketBooking/components/timeBar/index.js +95 -88
  46. package/lib/components/ticketBooking/utils/index.d.ts +2 -0
  47. package/lib/components/ticketBooking/utils/index.js +22 -0
  48. package/package.json +4 -4
@@ -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 (!isSession && (0, import_utils4.isNormalProductByDurationSchedule)(item)) {
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;
@@ -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
  genServiceKey: () => genServiceKey,
@@ -40,11 +41,13 @@ __export(utils_exports, {
40
41
  getIsOverlayProduct: () => getIsOverlayProduct,
41
42
  getIsShowNumber: () => getIsShowNumber,
42
43
  getNextTimeSlice: () => getNextTimeSlice,
44
+ isSameProduct: () => isSameProduct,
43
45
  restoreProductOtherData: () => restoreProductOtherData
44
46
  });
45
47
  module.exports = __toCommonJS(utils_exports);
46
48
  var import_dayjs = __toESM(require("dayjs"));
47
49
  var import_utils = require("../../booking/info/service2/utils");
50
+ var import_utils2 = require("@pisell/utils");
48
51
  var formatDateToStr = (date) => {
49
52
  const format = (val) => {
50
53
  return (0, import_dayjs.default)(val).format("YYYY-MM-DD HH:mm:ss");
@@ -223,10 +226,28 @@ var genServiceKey = (item) => {
223
226
  });
224
227
  return `${product_id}-${durationKey}-${resourceKey}-${start_time}-${total}`;
225
228
  };
229
+ var createSimpleCacheItem = (item, e, state) => {
230
+ let cacheItem = {
231
+ ...item,
232
+ product_id: item.id,
233
+ _id: (0, import_utils2.getUniqueId)(),
234
+ _key: e.key,
235
+ _extend: {
236
+ start_date: state.date.value,
237
+ quantity: (e == null ? void 0 : e.quantity) || 1,
238
+ price: item.price,
239
+ product_name: item.title,
240
+ other: e
241
+ },
242
+ new: 1
243
+ };
244
+ return cacheItem;
245
+ };
226
246
  // Annotate the CommonJS export names for ESM import in node:
227
247
  0 && (module.exports = {
228
248
  addService,
229
249
  addServiceScroll,
250
+ createSimpleCacheItem,
230
251
  formatBookingList,
231
252
  formatDateToStr,
232
253
  genServiceKey,
@@ -236,5 +257,6 @@ var genServiceKey = (item) => {
236
257
  getIsOverlayProduct,
237
258
  getIsShowNumber,
238
259
  getNextTimeSlice,
260
+ isSameProduct,
239
261
  restoreProductOtherData
240
262
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.4.8",
3
+ "version": "3.4.9",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,9 +60,9 @@
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/utils": "3.0.0",
63
- "@pisell/materials": "3.3.49",
64
- "@pisell/icon": "0.0.11",
65
- "@pisell/date-picker": "3.0.2"
63
+ "@pisell/materials": "3.3.50",
64
+ "@pisell/date-picker": "3.0.2",
65
+ "@pisell/icon": "0.0.11"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",