@pisell/private-materials 6.4.70 → 6.4.72

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 (111) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/booking/addons/model.d.ts +1 -10
  12. package/es/components/booking/components/footer/amount.js +25 -8
  13. package/es/components/booking/components/footer/utils.d.ts +7 -0
  14. package/es/components/booking/components/footer/utils.js +46 -22
  15. package/es/components/booking/forms/model.d.ts +1 -10
  16. package/es/components/booking/hooks/useQuotation.js +69 -21
  17. package/es/components/booking/info/model.d.ts +1 -10
  18. package/es/components/booking/info/service/Lists.js +1 -1
  19. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  20. package/es/components/booking/info/service/serve.d.ts +14 -0
  21. package/es/components/booking/info/service/serve.js +22 -1
  22. package/es/components/booking/info/service2/Group/utils.js +2 -0
  23. package/es/components/booking/info/service2/utils.d.ts +1 -33
  24. package/es/components/booking/info/service2/utils.js +75 -29
  25. package/es/components/booking/info/utils.js +5 -0
  26. package/es/components/booking/info2/service/addService/index.js +146 -89
  27. package/es/components/booking/info2/service/addService/utils.d.ts +9 -1
  28. package/es/components/booking/info2/service/addService/utils.js +78 -9
  29. package/es/components/booking/info2/service/editService/index.js +235 -55
  30. package/es/components/booking/info2/utilsByBooking.js +14 -5
  31. package/es/components/booking/model.d.ts +1 -9
  32. package/es/components/booking/notes/model.d.ts +1 -10
  33. package/es/components/booking/payments/model.d.ts +1 -10
  34. package/es/components/booking/utils.d.ts +9 -1
  35. package/es/components/booking/utils.js +23 -0
  36. package/es/components/eftposPay/hooks.d.ts +1 -1
  37. package/es/components/eftposPay/store/index.d.ts +2 -2
  38. package/es/components/pay/toC/model.d.ts +1 -9
  39. package/es/components/schedules/model.d.ts +1 -9
  40. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
  41. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +119 -0
  42. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
  43. package/es/components/ticketBooking/components/addServiceVariant/addService.js +283 -138
  44. package/es/components/ticketBooking/components/ticketBooking/index.js +14 -11
  45. package/es/components/ticketBooking/hooks/pisellos/useProducts.js +106 -32
  46. package/es/components/ticketBooking/utils/index.d.ts +6 -1
  47. package/es/components/ticketBooking/utils/index.js +21 -3
  48. package/es/components/wallet/Detail/model.d.ts +1 -13
  49. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  50. package/es/components/wallet/PointCard/model.d.ts +1 -13
  51. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  52. package/es/components/wallet/Voucher/model.d.ts +1 -13
  53. package/es/components/wallet/model.d.ts +1 -9
  54. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
  55. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.js +355 -0
  56. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
  57. package/es/pro/multiDayTimeSelect/index.d.ts +3 -0
  58. package/es/pro/multiDayTimeSelect/index.js +1 -0
  59. package/es/pro/multiDayTimeSelect/types.d.ts +28 -0
  60. package/es/pro/multiDayTimeSelect/types.js +1 -0
  61. package/lib/components/booking/addons/model.d.ts +1 -10
  62. package/lib/components/booking/components/footer/amount.js +23 -6
  63. package/lib/components/booking/components/footer/utils.d.ts +7 -0
  64. package/lib/components/booking/components/footer/utils.js +23 -11
  65. package/lib/components/booking/forms/model.d.ts +1 -10
  66. package/lib/components/booking/hooks/useQuotation.js +45 -13
  67. package/lib/components/booking/info/model.d.ts +1 -10
  68. package/lib/components/booking/info/service/Lists.js +1 -1
  69. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  70. package/lib/components/booking/info/service/serve.d.ts +14 -0
  71. package/lib/components/booking/info/service/serve.js +5 -0
  72. package/lib/components/booking/info/service2/Group/utils.js +2 -0
  73. package/lib/components/booking/info/service2/utils.d.ts +1 -33
  74. package/lib/components/booking/info/service2/utils.js +24 -10
  75. package/lib/components/booking/info/utils.js +4 -0
  76. package/lib/components/booking/info2/service/addService/index.js +22 -3
  77. package/lib/components/booking/info2/service/addService/utils.d.ts +9 -1
  78. package/lib/components/booking/info2/service/addService/utils.js +47 -9
  79. package/lib/components/booking/info2/service/editService/index.js +191 -31
  80. package/lib/components/booking/info2/utilsByBooking.js +19 -8
  81. package/lib/components/booking/model.d.ts +1 -9
  82. package/lib/components/booking/notes/model.d.ts +1 -10
  83. package/lib/components/booking/payments/model.d.ts +1 -10
  84. package/lib/components/booking/utils.d.ts +9 -1
  85. package/lib/components/booking/utils.js +15 -0
  86. package/lib/components/eftposPay/hooks.d.ts +1 -1
  87. package/lib/components/eftposPay/store/index.d.ts +2 -2
  88. package/lib/components/pay/toC/model.d.ts +1 -9
  89. package/lib/components/schedules/model.d.ts +1 -9
  90. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
  91. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +118 -0
  92. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
  93. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +185 -119
  94. package/lib/components/ticketBooking/components/ticketBooking/index.js +0 -16
  95. package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +54 -9
  96. package/lib/components/ticketBooking/utils/index.d.ts +6 -1
  97. package/lib/components/ticketBooking/utils/index.js +11 -1
  98. package/lib/components/wallet/Detail/model.d.ts +1 -13
  99. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  100. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  101. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  102. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  103. package/lib/components/wallet/model.d.ts +1 -9
  104. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
  105. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.js +304 -0
  106. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
  107. package/lib/pro/multiDayTimeSelect/index.d.ts +3 -0
  108. package/lib/pro/multiDayTimeSelect/index.js +35 -0
  109. package/lib/pro/multiDayTimeSelect/types.d.ts +28 -0
  110. package/lib/pro/multiDayTimeSelect/types.js +17 -0
  111. package/package.json +4 -4
@@ -22,8 +22,8 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
22
22
  import { useMemoizedFn } from 'ahooks';
23
23
  import useEngineContext from "../../../../hooks/useEngineContext";
24
24
  import { isSessionProduct, request, getProductTotalPrice, getIsEject, getIsOnlySession } from "../../../booking/utils";
25
- import { getProductExtend } from "../../../booking/info2/service/addService/utils";
26
- import { holderId, isDaysBooking, isNormalProductByDurationSchedule } from "../../../booking/info/service2/utils";
25
+ import { getMultiDay, getProductExtend, isMultiDayProduct } from "../../../booking/info2/service/addService/utils";
26
+ import { holderId, isNormalProductByDurationSchedule } from "../../../booking/info/service2/utils";
27
27
  import { isBooking4Shop } from "../../../booking/info/utils";
28
28
  import { useService } from "../../../booking/info/service/serviceManager";
29
29
  import ProductDisplayAdapter, { resolveProductDisplayConfig } from "../ProductDisplayAdapter";
@@ -35,6 +35,8 @@ import { useProducts } from "../../hooks/pisellos";
35
35
  import { createCacheItem, genValues, isBundle, isOption, setHandleSetService } from "./utils";
36
36
  import { useToast } from '@pisell/materials';
37
37
  import { useIsActive } from "../../context/IsActiveContext";
38
+ import { concatBookings, createBookingItemsByGroup } from "../../../booking/info/service2/Group/utils";
39
+ import MultiDayTimeSelectModal from "./MultiDayTimeSelectModal";
38
40
  var productListLayout = {
39
41
  grid: true,
40
42
  config: '12:12'
@@ -77,6 +79,18 @@ var AddSerivce = function AddSerivce(props) {
77
79
  _useState4 = _slicedToArray(_useState3, 2),
78
80
  firstLoading = _useState4[0],
79
81
  setFirstLoading = _useState4[1];
82
+ var _useState5 = useState(false),
83
+ _useState6 = _slicedToArray(_useState5, 2),
84
+ multiDayModalOpen = _useState6[0],
85
+ setMultiDayModalOpen = _useState6[1];
86
+ var _useState7 = useState(false),
87
+ _useState8 = _slicedToArray(_useState7, 2),
88
+ multiDayModalLoading = _useState8[0],
89
+ setMultiDayModalLoading = _useState8[1];
90
+ var _useState9 = useState(null),
91
+ _useState10 = _slicedToArray(_useState9, 2),
92
+ pendingMultiDayData = _useState10[0],
93
+ setPendingMultiDayData = _useState10[1];
80
94
  var stateRef = useRef(state);
81
95
  stateRef.current = state;
82
96
  var _useProducts = useProducts(notAvailableRef),
@@ -198,9 +212,227 @@ var AddSerivce = function AddSerivce(props) {
198
212
  executeCacheValues(productId, cacheValues, item, callback);
199
213
  }, 0);
200
214
  });
215
+
216
+ // 处理添加服务的逻辑(提取为独立函数,方便跨日商品确认后调用)
217
+ var processAddService = useMemoizedFn( /*#__PURE__*/function () {
218
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item, _detail, e, notShowToast, startDate, endDate) {
219
+ var other, cacheItem, _total, _isEdit, _stateRef$current$ser, isMultiDay, getMultiDayCacheItem, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData, _window$openBookingEd, _window;
220
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
221
+ while (1) switch (_context2.prev = _context2.next) {
222
+ case 0:
223
+ other = JSON.parse(JSON.stringify(e));
224
+ other.session = e.session;
225
+ cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
226
+ product_id: item.id,
227
+ _id: getUniqueId(),
228
+ _key: e.key,
229
+ _extend: {
230
+ start_date: startDate,
231
+ quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
232
+ price: _detail.price,
233
+ product_name: item.title,
234
+ other: other,
235
+ end_date: endDate
236
+ },
237
+ new: 1
238
+ });
239
+ _total = getProductTotalPrice(cacheItem); // 用于折扣 可修改
240
+ cacheItem._extend.total = _total;
241
+ // 用于储存原价
242
+ cacheItem._extend.origin_total = _total;
243
+ _isEdit = !!stateRef.current.service.cacheItem;
244
+ if (_isEdit) {
245
+ cacheItem._id = (_stateRef$current$ser = stateRef.current.service.cacheItem) === null || _stateRef$current$ser === void 0 ? void 0 : _stateRef$current$ser._id;
246
+ cacheItem.new = 0;
247
+ }
248
+ // 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
249
+ if (renderMode === 'current') {
250
+ // cacheItem._extend.resource = 0;
251
+ cacheItem.currentDefaultTime = stateRef.current.date.value.format('HH:mm');
252
+ }
253
+ cacheItem = getProductExtend({
254
+ cacheItem: cacheItem,
255
+ state: stateRef.current,
256
+ isDisabledTime: true
257
+ });
258
+ isMultiDay = isMultiDayProduct(cacheItem);
259
+ getMultiDayCacheItem = /*#__PURE__*/function () {
260
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(isConcatBookings) {
261
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
262
+ while (1) switch (_context.prev = _context.next) {
263
+ case 0:
264
+ _context.next = 2;
265
+ return getMultiDay({
266
+ start_date: cacheItem._extend.start_date,
267
+ end_date: cacheItem._extend.end_date,
268
+ state: stateRef.current,
269
+ cacheItem: cacheItem
270
+ });
271
+ case 2:
272
+ cacheItem = _context.sent;
273
+ cacheItem = createBookingItemsByGroup(cacheItem);
274
+ if (isConcatBookings) {
275
+ cacheItem = concatBookings(cacheItem);
276
+ }
277
+ case 5:
278
+ case "end":
279
+ return _context.stop();
280
+ }
281
+ }, _callee);
282
+ }));
283
+ return function getMultiDayCacheItem(_x7) {
284
+ return _ref2.apply(this, arguments);
285
+ };
286
+ }();
287
+ if (stateRef.current.renderType === 'eventBooking') {
288
+ cacheItem.autoClose = false;
289
+ }
290
+ if (!cacheItem.autoClose) {
291
+ _context2.next = 26;
292
+ break;
293
+ }
294
+ cacheItem.autoClose = false;
295
+ cacheItem._serviceKey = genServiceKey(cacheItem);
296
+ if (!isMultiDay) {
297
+ _context2.next = 19;
298
+ break;
299
+ }
300
+ _context2.next = 19;
301
+ return getMultiDayCacheItem();
302
+ case 19:
303
+ _addService2 = addService(_toConsumableArray(stateRef.current.service.value), cacheItem, stateRef.current, isMultiDay), _list = _addService2.list, quantity = _addService2.quantity;
304
+ if (!notShowToast) {
305
+ handleAddToast(cacheItem.title, quantity || 1);
306
+ }
307
+ window.dispatchEvent(new CustomEvent('onAddNewService', {
308
+ detail: {
309
+ cacheItem: cacheItem
310
+ }
311
+ }));
312
+ try {
313
+ if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
314
+ val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
315
+ return {
316
+ product_id: s === null || s === void 0 ? void 0 : s.product_id,
317
+ detailId: s === null || s === void 0 ? void 0 : s.id,
318
+ detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
319
+ product_name: s === null || s === void 0 ? void 0 : s.title,
320
+ price: s === null || s === void 0 ? void 0 : s.price,
321
+ _id: s === null || s === void 0 ? void 0 : s._id,
322
+ _key: s === null || s === void 0 ? void 0 : s._key,
323
+ _serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
324
+ };
325
+ });
326
+ sendData = {
327
+ product_id: item === null || item === void 0 ? void 0 : item.id,
328
+ detailId: _detail === null || _detail === void 0 ? void 0 : _detail.id,
329
+ detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
330
+ product_name: item === null || item === void 0 ? void 0 : item.title,
331
+ price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
332
+ serviceVal: val
333
+ };
334
+ sendWarningLog({
335
+ title: 'addService',
336
+ content: [{
337
+ key: '添加数据',
338
+ value: JSON.stringify(sendData)
339
+ }, {
340
+ key: '日期',
341
+ value: dayjs().format('YYYY-MM-DD HH:mm:ss')
342
+ }]
343
+ });
344
+ }
345
+ } catch (error) {}
346
+ dispatch({
347
+ type: 'setService',
348
+ payload: {
349
+ addModal: false,
350
+ value: _list,
351
+ edit: true,
352
+ changeService: false
353
+ }
354
+ });
355
+ _context2.next = 32;
356
+ break;
357
+ case 26:
358
+ (_window$openBookingEd = (_window = window).openBookingEditModal) === null || _window$openBookingEd === void 0 || _window$openBookingEd.call(_window);
359
+ if (!isMultiDay) {
360
+ _context2.next = 30;
361
+ break;
362
+ }
363
+ _context2.next = 30;
364
+ return getMultiDayCacheItem(true);
365
+ case 30:
366
+ dispatch({
367
+ type: 'setService',
368
+ payload: {
369
+ editModal: true,
370
+ cacheItem: cacheItem,
371
+ addModal: !cacheItem.autoClose,
372
+ changeService: false
373
+ }
374
+ });
375
+ onEdit === null || onEdit === void 0 || onEdit(cacheItem);
376
+ case 32:
377
+ case "end":
378
+ return _context2.stop();
379
+ }
380
+ }, _callee2);
381
+ }));
382
+ return function (_x, _x2, _x3, _x4, _x5, _x6) {
383
+ return _ref.apply(this, arguments);
384
+ };
385
+ }());
386
+
387
+ // 处理跨日商品时间选择确认
388
+ var handleMultiDayConfirm = useMemoizedFn( /*#__PURE__*/function () {
389
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(startDate, endDate, duration) {
390
+ var item, detail, e, notShowToast;
391
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
392
+ while (1) switch (_context3.prev = _context3.next) {
393
+ case 0:
394
+ if (pendingMultiDayData) {
395
+ _context3.next = 2;
396
+ break;
397
+ }
398
+ return _context3.abrupt("return");
399
+ case 2:
400
+ setMultiDayModalLoading(true);
401
+ _context3.prev = 3;
402
+ item = pendingMultiDayData.item, detail = pendingMultiDayData.detail, e = pendingMultiDayData.e, notShowToast = pendingMultiDayData.notShowToast; // 使用选择的时间继续处理添加服务逻辑
403
+ _context3.next = 7;
404
+ return processAddService(item, detail, e, notShowToast, startDate, endDate);
405
+ case 7:
406
+ setPendingMultiDayData(null);
407
+ setMultiDayModalOpen(false);
408
+ _context3.next = 14;
409
+ break;
410
+ case 11:
411
+ _context3.prev = 11;
412
+ _context3.t0 = _context3["catch"](3);
413
+ console.error('添加跨日商品失败:', _context3.t0);
414
+ case 14:
415
+ _context3.prev = 14;
416
+ setMultiDayModalLoading(false);
417
+ return _context3.finish(14);
418
+ case 17:
419
+ case "end":
420
+ return _context3.stop();
421
+ }
422
+ }, _callee3, null, [[3, 11, 14, 17]]);
423
+ }));
424
+ return function (_x8, _x9, _x10) {
425
+ return _ref3.apply(this, arguments);
426
+ };
427
+ }());
428
+
429
+ // 处理跨日商品时间选择取消
430
+ var handleMultiDayCancel = useMemoizedFn(function () {
431
+ setMultiDayModalOpen(false);
432
+ setPendingMultiDayData(null);
433
+ });
201
434
  var handleSelectProduct = useMemoizedFn(function (item) {
202
435
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
203
- console.log('handleSelectProduct');
204
436
  if (!isNormalProductByDurationSchedule(item)) {
205
437
  var _state$service;
206
438
  if (!Array.isArray((_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.resourcesOrigin) || !state.service.resourcesOrigin.length) {
@@ -240,19 +472,20 @@ var AddSerivce = function AddSerivce(props) {
240
472
  }
241
473
  }
242
474
  var callback = /*#__PURE__*/function () {
243
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, extension_type, detail, notShowToast) {
244
- var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData, _window$openBookingEd, _window;
245
- return _regeneratorRuntime().wrap(function _callee$(_context) {
246
- while (1) switch (_context.prev = _context.next) {
475
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(e, extension_type, detail, notShowToast) {
476
+ var data, _detail, isMultiDay;
477
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
478
+ while (1) switch (_context4.prev = _context4.next) {
247
479
  case 0:
480
+ debugger;
248
481
  setCurrentProduct(null);
249
482
  // 防止选择商品弹窗多次触发callback
250
483
  if (!lock) {
251
- _context.next = 3;
484
+ _context4.next = 4;
252
485
  break;
253
486
  }
254
- return _context.abrupt("return");
255
- case 3:
487
+ return _context4.abrupt("return");
488
+ case 4:
256
489
  lock = true;
257
490
 
258
491
  // 2秒后解除
@@ -260,144 +493,57 @@ var AddSerivce = function AddSerivce(props) {
260
493
  lock = false;
261
494
  }, 2000);
262
495
  if (isBooking4) {
263
- _context.next = 11;
496
+ _context4.next = 12;
264
497
  break;
265
498
  }
266
- _context.next = 8;
499
+ _context4.next = 9;
267
500
  return createBookingData({
268
501
  product: _objectSpread(_objectSpread({}, detail || item), {}, {
269
502
  _params: e
270
503
  })
271
504
  });
272
- case 8:
273
- data = _context.sent;
505
+ case 9:
506
+ data = _context4.sent;
274
507
  // 创建预约
275
508
  createBooking({
276
509
  booking: data
277
510
  });
278
- return _context.abrupt("return");
279
- case 11:
511
+ return _context4.abrupt("return");
512
+ case 12:
280
513
  // info2 addService 逻辑
281
- _detail = detail || item;
282
- other = JSON.parse(JSON.stringify(e));
283
- other.session = e.session;
284
- cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
285
- product_id: item.id,
286
- _id: getUniqueId(),
287
- _key: e.key,
288
- _extend: {
289
- start_date: state.date.value,
290
- quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
291
- price: _detail.price,
292
- product_name: item.title,
293
- other: other
294
- },
295
- new: 1
296
- });
297
- _total = getProductTotalPrice(cacheItem); // 用于折扣 可修改
298
- cacheItem._extend.total = _total;
299
- // 用于储存原价
300
- cacheItem._extend.origin_total = _total;
301
- _isEdit = !!state.service.cacheItem;
302
- if (_isEdit) {
303
- cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
304
- cacheItem.new = 0;
305
- }
306
- // 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
307
- if (renderMode === 'current') {
308
- // cacheItem._extend.resource = 0;
309
- cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
514
+ _detail = detail || item; // 判断是否是跨日商品,如果是,先打开时间选择弹窗
515
+ isMultiDay = isMultiDayProduct(_detail || item);
516
+ if (!isMultiDay) {
517
+ _context4.next = 18;
518
+ break;
310
519
  }
311
- cacheItem = getProductExtend({
312
- cacheItem: cacheItem,
313
- state: state,
314
- isDisabledTime: true
520
+ // 保存待处理的数据
521
+ setPendingMultiDayData({
522
+ item: item,
523
+ detail: _detail,
524
+ e: e,
525
+ notShowToast: notShowToast
315
526
  });
316
- if (state.renderType === 'eventBooking') {
317
- cacheItem.autoClose = false;
318
- }
319
- if (cacheItem.autoClose) {
320
- cacheItem.autoClose = false;
321
- cacheItem._serviceKey = genServiceKey(cacheItem);
322
- _addService2 = addService(_toConsumableArray(stateRef.current.service.value), cacheItem, state), _list = _addService2.list, quantity = _addService2.quantity;
323
- if (!notShowToast) {
324
- handleAddToast(cacheItem.title, quantity || 1);
325
- }
326
- window.dispatchEvent(new CustomEvent('onAddNewService', {
327
- detail: {
328
- cacheItem: cacheItem
329
- }
330
- }));
331
- try {
332
- if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
333
- val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
334
- return {
335
- product_id: s === null || s === void 0 ? void 0 : s.product_id,
336
- detailId: s === null || s === void 0 ? void 0 : s.id,
337
- detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
338
- product_name: s === null || s === void 0 ? void 0 : s.title,
339
- price: s === null || s === void 0 ? void 0 : s.price,
340
- _id: s === null || s === void 0 ? void 0 : s._id,
341
- _key: s === null || s === void 0 ? void 0 : s._key,
342
- _serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
343
- };
344
- });
345
- sendData = {
346
- product_id: item === null || item === void 0 ? void 0 : item.id,
347
- detailId: _detail === null || _detail === void 0 ? void 0 : _detail.id,
348
- detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
349
- product_name: item === null || item === void 0 ? void 0 : item.title,
350
- price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
351
- serviceVal: val
352
- };
353
- sendWarningLog({
354
- title: 'addService',
355
- content: [{
356
- key: '添加数据',
357
- value: JSON.stringify(sendData)
358
- }, {
359
- key: '日期',
360
- value: dayjs().format('YYYY-MM-DD HH:mm:ss')
361
- }]
362
- });
363
- }
364
- } catch (error) {}
365
- dispatch({
366
- type: 'setService',
367
- payload: {
368
- addModal: false,
369
- value: _list,
370
- edit: true,
371
- changeService: false
372
- }
373
- });
374
- } else {
375
- (_window$openBookingEd = (_window = window).openBookingEditModal) === null || _window$openBookingEd === void 0 || _window$openBookingEd.call(_window);
376
- dispatch({
377
- type: 'setService',
378
- payload: {
379
- editModal: true,
380
- cacheItem: cacheItem,
381
- addModal: !cacheItem.autoClose,
382
- changeService: false
383
- }
384
- });
385
- onEdit === null || onEdit === void 0 || onEdit(cacheItem);
386
- }
387
- case 24:
527
+ // 打开时间选择弹窗
528
+ setMultiDayModalOpen(true);
529
+ return _context4.abrupt("return");
530
+ case 18:
531
+ _context4.next = 20;
532
+ return processAddService(item, _detail, e, notShowToast, state.date.value);
533
+ case 20:
388
534
  case "end":
389
- return _context.stop();
535
+ return _context4.stop();
390
536
  }
391
- }, _callee);
537
+ }, _callee4);
392
538
  }));
393
- return function callback(_x, _x2, _x3, _x4) {
394
- return _ref.apply(this, arguments);
539
+ return function callback(_x11, _x12, _x13, _x14) {
540
+ return _ref4.apply(this, arguments);
395
541
  };
396
542
  }();
397
543
 
398
544
  // 如果不需要打开弹窗, 直接添加数据
399
545
  if (cacheValues) {
400
- var _stateRef$current$ser, _detail$_extend, _Toast$success2;
546
+ var _stateRef$current$ser2, _detail$_extend, _Toast$success2;
401
547
  var productId = item.id.toString();
402
548
 
403
549
  // 如果已经有pending的同商品,增加点击次数
@@ -409,7 +555,7 @@ var AddSerivce = function AddSerivce(props) {
409
555
  clickCountRef.current[productId] = 1;
410
556
  }
411
557
  var cacheItem = createSimpleCacheItem(item, cacheValues, state);
412
- var detail = (_stateRef$current$ser = stateRef.current.service.value) === null || _stateRef$current$ser === void 0 ? void 0 : _stateRef$current$ser.find(function (val) {
558
+ var detail = (_stateRef$current$ser2 = stateRef.current.service.value) === null || _stateRef$current$ser2 === void 0 ? void 0 : _stateRef$current$ser2.find(function (val) {
413
559
  return isSameProduct(val, cacheItem);
414
560
  });
415
561
  var originalQuantity = (detail === null || detail === void 0 || (_detail$_extend = detail._extend) === null || _detail$_extend === void 0 ? void 0 : _detail$_extend.quantity) || 0;
@@ -448,16 +594,6 @@ var AddSerivce = function AddSerivce(props) {
448
594
  });
449
595
  var renderList = useMemo(function () {
450
596
  var _list = products || [];
451
-
452
- // 跨日预约
453
- if (isDaysBooking(state)) {
454
- // 公共购物车下过滤掉预约商品
455
- if (!holderId(state)) {
456
- _list = _list.filter(function (item) {
457
- return isNormalProductByDurationSchedule(item);
458
- });
459
- }
460
- }
461
597
  return _list;
462
598
  }, [products, state === null || state === void 0 ? void 0 : state.activeCartId]);
463
599
  var currentDate = useMemo(function () {
@@ -496,6 +632,7 @@ var AddSerivce = function AddSerivce(props) {
496
632
  }, [productDisplayConfig]);
497
633
  return useMemo(function () {
498
634
  if (renderMode === 'current') {
635
+ var _pendingMultiDayData$;
499
636
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProductDisplayAdapter, {
500
637
  config: finalDisplayConfig,
501
638
  dataSource: renderList,
@@ -504,9 +641,17 @@ var AddSerivce = function AddSerivce(props) {
504
641
  onSelectProduct: handleSelectProduct
505
642
  }), /*#__PURE__*/React.createElement(NotAvailable, {
506
643
  ref: notAvailableRef
644
+ }), /*#__PURE__*/React.createElement(MultiDayTimeSelectModal, {
645
+ open: multiDayModalOpen,
646
+ productName: pendingMultiDayData === null || pendingMultiDayData === void 0 || (_pendingMultiDayData$ = pendingMultiDayData.item) === null || _pendingMultiDayData$ === void 0 ? void 0 : _pendingMultiDayData$.title,
647
+ locale: state === null || state === void 0 ? void 0 : state.locale,
648
+ defaultStartDate: state.date.value,
649
+ loading: multiDayModalLoading,
650
+ onConfirm: handleMultiDayConfirm,
651
+ onCancel: handleMultiDayCancel
507
652
  }));
508
653
  }
509
654
  return null;
510
- }, [firstLoading, state.service.addModal, locales, renderList, state.amountSymbol, state.renderType, state === null || state === void 0 ? void 0 : state.activeCartId, holderId(state), loading, currentProduct, isBooking4, finalDisplayConfig]);
655
+ }, [firstLoading, state.service.addModal, locales, renderList, state.amountSymbol, state.renderType, state === null || state === void 0 ? void 0 : state.activeCartId, holderId(state), loading, currentProduct, isBooking4, finalDisplayConfig, multiDayModalOpen, pendingMultiDayData, multiDayModalLoading]);
511
656
  };
512
657
  export default AddSerivce;
@@ -679,17 +679,20 @@ var TicketBooking = function TicketBooking(props) {
679
679
  })
680
680
  });
681
681
  setTimeout(function () {
682
- var _state$modalState$ser;
683
- if ((_state$modalState$ser = state.modalState.service) !== null && _state$modalState$ser !== void 0 && (_state$modalState$ser = _state$modalState$ser.value) !== null && _state$modalState$ser !== void 0 && _state$modalState$ser.length) {
684
- var _state$bookingFunctio, _state$bookingFunctio2, _state$modalState$ser2;
685
- var _list = (_state$bookingFunctio = state.bookingFunctions) === null || _state$bookingFunctio === void 0 || (_state$bookingFunctio2 = _state$bookingFunctio.updateServiceDate) === null || _state$bookingFunctio2 === void 0 ? void 0 : _state$bookingFunctio2.call(_state$bookingFunctio, (_state$modalState$ser2 = state.modalState.service) === null || _state$modalState$ser2 === void 0 ? void 0 : _state$modalState$ser2.value, date, false);
686
- _setModalState({
687
- service: _objectSpread(_objectSpread({}, state.modalState.service), {}, {
688
- value: _list,
689
- edit: true
690
- })
691
- });
692
- }
682
+ // if (state.modalState.service?.value?.length) {
683
+ // let _list = state.bookingFunctions?.updateServiceDate?.(
684
+ // state.modalState.service?.value,
685
+ // date,
686
+ // false
687
+ // );
688
+ // _setModalState({
689
+ // service: {
690
+ // ...state.modalState.service,
691
+ // value: _list,
692
+ // edit: true,
693
+ // },
694
+ // });
695
+ // }
693
696
  }, 100);
694
697
  };
695
698
  var _setShopOpeningHours = function _setShopOpeningHours() {