@pisell/private-materials 6.4.71 → 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 (113) 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 +6 -6
  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/forms/sendModal/useSendModal.d.ts +1 -1
  17. package/es/components/booking/hooks/useQuotation.js +69 -21
  18. package/es/components/booking/info/model.d.ts +1 -10
  19. package/es/components/booking/info/service/Lists.js +1 -1
  20. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  21. package/es/components/booking/info/service/serve.d.ts +14 -0
  22. package/es/components/booking/info/service/serve.js +22 -1
  23. package/es/components/booking/info/service2/Group/utils.js +2 -0
  24. package/es/components/booking/info/service2/utils.d.ts +1 -33
  25. package/es/components/booking/info/service2/utils.js +75 -29
  26. package/es/components/booking/info/utils.js +5 -0
  27. package/es/components/booking/info2/service/addService/index.js +146 -89
  28. package/es/components/booking/info2/service/addService/utils.d.ts +9 -1
  29. package/es/components/booking/info2/service/addService/utils.js +78 -9
  30. package/es/components/booking/info2/service/editService/index.js +235 -55
  31. package/es/components/booking/info2/utilsByBooking.js +14 -5
  32. package/es/components/booking/model.d.ts +1 -9
  33. package/es/components/booking/notes/model.d.ts +1 -10
  34. package/es/components/booking/payments/model.d.ts +1 -10
  35. package/es/components/booking/utils.d.ts +9 -1
  36. package/es/components/booking/utils.js +23 -0
  37. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  38. package/es/components/eftposPay/hooks.d.ts +1 -1
  39. package/es/components/eftposPay/store/index.d.ts +2 -2
  40. package/es/components/pay/toC/model.d.ts +1 -9
  41. package/es/components/schedules/model.d.ts +1 -9
  42. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
  43. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +119 -0
  44. package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
  45. package/es/components/ticketBooking/components/addServiceVariant/addService.js +283 -138
  46. package/es/components/ticketBooking/components/ticketBooking/index.js +14 -11
  47. package/es/components/ticketBooking/utils/index.d.ts +6 -1
  48. package/es/components/ticketBooking/utils/index.js +21 -3
  49. package/es/components/wallet/Detail/model.d.ts +1 -13
  50. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  51. package/es/components/wallet/PointCard/model.d.ts +1 -13
  52. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  53. package/es/components/wallet/Voucher/model.d.ts +1 -13
  54. package/es/components/wallet/model.d.ts +1 -9
  55. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
  56. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.js +355 -0
  57. package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
  58. package/es/pro/multiDayTimeSelect/index.d.ts +3 -0
  59. package/es/pro/multiDayTimeSelect/index.js +1 -0
  60. package/es/pro/multiDayTimeSelect/types.d.ts +28 -0
  61. package/es/pro/multiDayTimeSelect/types.js +1 -0
  62. package/lib/components/booking/addons/model.d.ts +1 -10
  63. package/lib/components/booking/components/footer/amount.js +23 -6
  64. package/lib/components/booking/components/footer/utils.d.ts +7 -0
  65. package/lib/components/booking/components/footer/utils.js +23 -11
  66. package/lib/components/booking/forms/model.d.ts +1 -10
  67. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  68. package/lib/components/booking/hooks/useQuotation.js +45 -13
  69. package/lib/components/booking/info/model.d.ts +1 -10
  70. package/lib/components/booking/info/service/Lists.js +1 -1
  71. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  72. package/lib/components/booking/info/service/serve.d.ts +14 -0
  73. package/lib/components/booking/info/service/serve.js +5 -0
  74. package/lib/components/booking/info/service2/Group/utils.js +2 -0
  75. package/lib/components/booking/info/service2/utils.d.ts +1 -33
  76. package/lib/components/booking/info/service2/utils.js +24 -10
  77. package/lib/components/booking/info/utils.js +4 -0
  78. package/lib/components/booking/info2/service/addService/index.js +22 -3
  79. package/lib/components/booking/info2/service/addService/utils.d.ts +9 -1
  80. package/lib/components/booking/info2/service/addService/utils.js +47 -9
  81. package/lib/components/booking/info2/service/editService/index.js +191 -31
  82. package/lib/components/booking/info2/utilsByBooking.js +19 -8
  83. package/lib/components/booking/model.d.ts +1 -9
  84. package/lib/components/booking/notes/model.d.ts +1 -10
  85. package/lib/components/booking/payments/model.d.ts +1 -10
  86. package/lib/components/booking/utils.d.ts +9 -1
  87. package/lib/components/booking/utils.js +15 -0
  88. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  89. package/lib/components/eftposPay/hooks.d.ts +1 -1
  90. package/lib/components/eftposPay/store/index.d.ts +2 -2
  91. package/lib/components/pay/toC/model.d.ts +1 -9
  92. package/lib/components/schedules/model.d.ts +1 -9
  93. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
  94. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +118 -0
  95. package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
  96. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +185 -119
  97. package/lib/components/ticketBooking/components/ticketBooking/index.js +0 -16
  98. package/lib/components/ticketBooking/utils/index.d.ts +6 -1
  99. package/lib/components/ticketBooking/utils/index.js +11 -1
  100. package/lib/components/wallet/Detail/model.d.ts +1 -13
  101. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  102. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  103. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  104. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  105. package/lib/components/wallet/model.d.ts +1 -9
  106. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
  107. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.js +304 -0
  108. package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
  109. package/lib/pro/multiDayTimeSelect/index.d.ts +3 -0
  110. package/lib/pro/multiDayTimeSelect/index.js +35 -0
  111. package/lib/pro/multiDayTimeSelect/types.d.ts +28 -0
  112. package/lib/pro/multiDayTimeSelect/types.js +17 -0
  113. package/package.json +13 -13
@@ -35,7 +35,8 @@ __export(utils_exports, {
35
35
  formatProductBundle: () => formatProductBundle,
36
36
  formatProductOption: () => formatProductOption,
37
37
  formatProductPrice: () => formatProductPrice,
38
- formatValues: () => formatValues
38
+ formatValues: () => formatValues,
39
+ getHasMultiDayProduct: () => getHasMultiDayProduct
39
40
  });
40
41
  module.exports = __toCommonJS(utils_exports);
41
42
  var import_dayjs = __toESM(require("dayjs"));
@@ -351,6 +352,14 @@ var getHolderByIndex = (holder, index) => {
351
352
  form_record: [(_a = holder == null ? void 0 : holder.form_record) == null ? void 0 : _a[index]].filter(Boolean)
352
353
  };
353
354
  };
355
+ var getHasMultiDayProduct = (data) => {
356
+ const list = data.service.value;
357
+ const isHas = list.some((item) => {
358
+ var _a;
359
+ return (_a = item._extend) == null ? void 0 : _a.groupId;
360
+ });
361
+ return isHas;
362
+ };
354
363
  var formatBookings = (data, values) => {
355
364
  const isDay = (0, import_utils4.isDaysBooking)(data);
356
365
  const isEvent = (0, import_utils4.isEventBooking)(data);
@@ -371,7 +380,7 @@ var formatBookings = (data, values) => {
371
380
  const eventOtherParams = data.eventOtherParams;
372
381
  let bookings = [];
373
382
  list.forEach((item) => {
374
- var _a, _b, _c, _d, _e;
383
+ var _a, _b, _c, _d, _e, _f;
375
384
  if (item.isCustomItem) {
376
385
  bookings.push({
377
386
  ...item._extend,
@@ -380,6 +389,7 @@ var formatBookings = (data, values) => {
380
389
  });
381
390
  return;
382
391
  }
392
+ const isMultiDay = (_a = item._extend) == null ? void 0 : _a.groupId;
383
393
  let start_date = item._extend.startDate.format("YYYY-MM-DD");
384
394
  let end_date = item._extend.endDate.format("YYYY-MM-DD");
385
395
  let end_time = item._extend.endDate.format("HH:mm");
@@ -389,8 +399,8 @@ var formatBookings = (data, values) => {
389
399
  }
390
400
  dayParams.holder = formatHolders(data, item, values);
391
401
  if (isDay) {
392
- const startDate = ((_a = item._extend) == null ? void 0 : _a.startDate) || ((_b = item._extend) == null ? void 0 : _b.start_date);
393
- const endDate = ((_c = item._extend) == null ? void 0 : _c.endDate) || ((_d = item._extend) == null ? void 0 : _d.end_date);
402
+ const startDate = ((_b = item._extend) == null ? void 0 : _b.startDate) || ((_c = item._extend) == null ? void 0 : _c.start_date);
403
+ const endDate = ((_d = item._extend) == null ? void 0 : _d.endDate) || ((_e = item._extend) == null ? void 0 : _e.end_date);
394
404
  const { startDateTime, endDateTime } = (0, import_utils4.formatDayTime)({
395
405
  startDate,
396
406
  endDate
@@ -406,7 +416,7 @@ var formatBookings = (data, values) => {
406
416
  "minutes"
407
417
  );
408
418
  }
409
- if (!((_e = item._extend) == null ? void 0 : _e.unique_identification_number)) {
419
+ if (!((_f = item._extend) == null ? void 0 : _f.unique_identification_number)) {
410
420
  const unique_identification_number = (0, import_utils5.getUniqueId)();
411
421
  item._extend.unique_identification_number = unique_identification_number;
412
422
  }
@@ -426,14 +436,14 @@ var formatBookings = (data, values) => {
426
436
  start_time,
427
437
  end_date,
428
438
  start_date,
429
- duration: isDay ? 0 : import_utils.flexibleObj.getValue(item._extend.duration),
439
+ duration: isDay || isMultiDay ? 0 : import_utils.flexibleObj.getValue(item._extend.duration),
430
440
  number: item._extend.capacity ? (0, import_utilsByBooking.getSumCapacity)({ cacheItem: item }) : item._extend.number || 1,
431
441
  resources: formatResource(item),
432
442
  note: item._extend.note,
433
443
  ...eventOtherParams || {},
434
444
  ...dayParams
435
445
  };
436
- if (isDay) {
446
+ if (isDay || isMultiDay) {
437
447
  bookings.push(booking);
438
448
  return;
439
449
  }
@@ -521,6 +531,7 @@ var formatValues = (state) => {
521
531
  metadata: {}
522
532
  };
523
533
  const isDay = (0, import_utils4.isDaysBooking)(state);
534
+ const isHasMultiDay = getHasMultiDayProduct(state);
524
535
  const isEvent = (0, import_utils4.isEventBooking)(state);
525
536
  if (!state.bookingId || isDay) {
526
537
  values.shop_note = formatNote(state);
@@ -538,10 +549,10 @@ var formatValues = (state) => {
538
549
  ...customer
539
550
  };
540
551
  values.holder = formatHolder(state, values);
541
- if (isDay || isEvent) {
552
+ if (isEvent) {
542
553
  values.relation_products = formatRelationProducts(
543
554
  state,
544
- isDay ? "day" : "event"
555
+ "event"
545
556
  );
546
557
  } else {
547
558
  values.relation_products = formatNormalProducts(state);
@@ -555,7 +566,7 @@ var formatValues = (state) => {
555
566
  startTime = `${startTime || "00:00"}:00`;
556
567
  values.schedule_date = `${values.bookings[0].select_date} ${startTime}`;
557
568
  }
558
- if (isDay) {
569
+ if (isDay || isHasMultiDay) {
559
570
  values.metadata.is_multiday_appointment = 1;
560
571
  }
561
572
  if (!((_g = values == null ? void 0 : values.bookings) == null ? void 0 : _g.length)) {
@@ -607,5 +618,6 @@ var checkHolderIsError = (state) => {
607
618
  formatProductBundle,
608
619
  formatProductOption,
609
620
  formatProductPrice,
610
- formatValues
621
+ formatValues,
622
+ getHasMultiDayProduct
611
623
  });
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -4,6 +4,6 @@ declare const useSendModal: (bookingId?: number) => {
4
4
  setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
5
5
  handleOpen: () => void;
6
6
  handleValuesChange: (val: any) => void;
7
- handleOk: (values: SendModalValues) => Promise<boolean | undefined>;
7
+ handleOk: (values: SendModalValues) => Promise<any>;
8
8
  };
9
9
  export default useSendModal;
@@ -40,6 +40,7 @@ var import_utils2 = require("@pisell/utils");
40
40
  var import_materials = require("@pisell/materials");
41
41
  var import_serve = require("../info/service/serve");
42
42
  var import_decimal = __toESM(require("decimal.js"));
43
+ var import_dayjs = __toESM(require("dayjs"));
43
44
  var formatBundleItemMap = (product) => {
44
45
  return product.bundle_group.reduce((pre, cur) => {
45
46
  const curObj = {};
@@ -70,15 +71,19 @@ var setNewCartValue = (cartValue, newProducts) => {
70
71
  let isBundleChange = false;
71
72
  let isNotFoundBundle = false;
72
73
  const notFoundProducts = [];
74
+ const multiDayPricesCache = /* @__PURE__ */ new Map();
73
75
  const value = cartValue.map((item) => {
74
- var _a, _b, _c, _d;
75
- const newProduct = newProducts.find((newItem2) => newItem2.id === item.product_id);
76
+ var _a, _b, _c, _d, _e, _f;
77
+ const itemScheduleDate = ((_a = item._extend) == null ? void 0 : _a.startDate) ? (0, import_dayjs.default)(item._extend.startDate).format("YYYY-MM-DD") : "";
78
+ const newProduct = newProducts.find(
79
+ (newItem2) => newItem2.id === item.product_id && newItem2.schedule_date === itemScheduleDate
80
+ );
76
81
  if (!newProduct) {
77
82
  return item;
78
83
  }
79
84
  let isChangePrice = newProduct.price != item.price;
80
85
  const bundleItemMap = formatBundleItemMap(newProduct);
81
- const newBundle = (((_b = (_a = item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) || []).map((bundle) => {
86
+ const newBundle = (((_c = (_b = item._extend) == null ? void 0 : _b.other) == null ? void 0 : _c.bundle) || []).map((bundle) => {
82
87
  if (!bundleItemMap[bundle.id]) {
83
88
  isNotFoundBundle = true;
84
89
  if (!notFoundProducts.some((p) => p._id === bundle._id)) {
@@ -102,6 +107,24 @@ var setNewCartValue = (cartValue, newProducts) => {
102
107
  // product_price: bundleItemMap[item.id].product_price,
103
108
  };
104
109
  });
110
+ if ((_d = item._extend) == null ? void 0 : _d.groupId) {
111
+ if (!multiDayPricesCache.has(item._extend.groupId)) {
112
+ const productPrices = newProducts.filter((p) => p.id === item.product_id);
113
+ const multiDayPrices = {};
114
+ productPrices.forEach((priceItem) => {
115
+ multiDayPrices[priceItem.schedule_date] = {
116
+ total: Number(priceItem.price),
117
+ origin_total: Number(priceItem.price),
118
+ num: 1,
119
+ quotation_id: priceItem.quotation_id || 0,
120
+ start_date: priceItem.schedule_date,
121
+ end_date: (0, import_dayjs.default)(priceItem.schedule_date).add(1, "day").format("YYYY-MM-DD")
122
+ };
123
+ });
124
+ multiDayPricesCache.set(item._extend.groupId, multiDayPrices);
125
+ }
126
+ item._extend.multiDayPrices = multiDayPricesCache.get(item._extend.groupId);
127
+ }
105
128
  if (!isChangePrice) {
106
129
  return item;
107
130
  } else {
@@ -119,7 +142,7 @@ var setNewCartValue = (cartValue, newProducts) => {
119
142
  bundle_edit: isBundleChange ? 1 : item._extend.bundle_edit,
120
143
  other: {
121
144
  ...item._extend.other,
122
- option: (_d = (_c = item._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.option,
145
+ option: (_f = (_e = item._extend) == null ? void 0 : _e.other) == null ? void 0 : _f.option,
123
146
  bundle: newBundle
124
147
  }
125
148
  }
@@ -145,22 +168,31 @@ var useQuotation = (state, dispatch) => {
145
168
  cartValueRef.current = state.service.value;
146
169
  const getCartQuotation = async (params) => {
147
170
  if (!cartValueRef.current.length) return;
148
- const ids = cartValueRef.current.filter((item) => !item.isCustomItem).map((item) => item.product_id);
149
- if (!ids.length) return;
150
- const data = await (0, import_serve.getProductPrice)({
151
- ids,
152
- schedule_date: params == null ? void 0 : params.schedule_date,
153
- customer_id: params == null ? void 0 : params.customer_id
171
+ if (!(params == null ? void 0 : params.customer_id)) {
172
+ return;
173
+ }
174
+ const queryData = cartValueRef.current.filter((item) => !item.isCustomItem).map((item) => {
175
+ var _a2;
176
+ return {
177
+ product_id: item.product_id,
178
+ schedule_date: ((_a2 = item._extend) == null ? void 0 : _a2.startDate) ? (0, import_dayjs.default)(item._extend.startDate).format("YYYY-MM-DD") : params == null ? void 0 : params.schedule_date
179
+ // 如果没有商品日期,使用传入的默认日期
180
+ };
181
+ });
182
+ if (!queryData.length) return;
183
+ const data = await (0, import_serve.getNormalAndMultiDayProductPrice)({
184
+ customer_id: params == null ? void 0 : params.customer_id,
185
+ data: queryData
154
186
  });
155
- return data;
187
+ return data.data;
156
188
  };
157
189
  const currentDate = (0, import_react.useMemo)(() => {
158
190
  return state.date.value.format("YYYY-MM-DD");
159
191
  }, [state.date.value]);
160
192
  const updateCartQuotation = async (params) => {
161
193
  const data = await getCartQuotation(params);
162
- if (!(data == null ? void 0 : data.data)) return;
163
- const { isChange, value: newCartValue, isNotFoundBundle, notFoundProducts } = setNewCartValue(cartValueRef.current, data.data);
194
+ if (!data || !data.length) return;
195
+ const { isChange, value: newCartValue, isNotFoundBundle, notFoundProducts } = setNewCartValue(cartValueRef.current, data);
164
196
  if (isNotFoundBundle) {
165
197
  setProducts(notFoundProducts);
166
198
  setOpen(true);
@@ -1,14 +1,5 @@
1
- /// <reference types="react" />
2
- import { FormState } from '../model';
3
1
  export declare const walkInData: {
4
2
  id: number;
5
3
  nickname: string;
6
4
  };
7
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
8
- state: FormState;
9
- } & {
10
- dispatch: (params: {
11
- type: string;
12
- payload: any;
13
- }) => void;
14
- }>;
5
+ export declare const Provider: any, Context: any;
@@ -109,7 +109,7 @@ var Lists = ({ onEdit, onChange, onAction, isParallelResource }) => {
109
109
  const p = (0, import_utils.formatProducts)(
110
110
  ((_a2 = state == null ? void 0 : state.service) == null ? void 0 : _a2.value) || [],
111
111
  state,
112
- false,
112
+ true,
113
113
  true,
114
114
  isParallelResource
115
115
  );
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: string;
9
+ locale: any;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -18,3 +18,17 @@ export declare const getProductPrice: (params: {
18
18
  customer_id: number;
19
19
  schedule_date: string;
20
20
  }) => Promise<any>;
21
+ declare type MultiDayProductPriceParams = {
22
+ customer_id: number;
23
+ data: {
24
+ product_id: number;
25
+ schedule_date: string;
26
+ }[];
27
+ };
28
+ /**
29
+ * 获取普通商品和跨日预约的价格
30
+ * @param params
31
+ * @returns
32
+ */
33
+ export declare const getNormalAndMultiDayProductPrice: (params: MultiDayProductPriceParams) => Promise<any>;
34
+ export {};
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/components/booking/info/service/serve.ts
20
20
  var serve_exports = {};
21
21
  __export(serve_exports, {
22
+ getNormalAndMultiDayProductPrice: () => getNormalAndMultiDayProductPrice,
22
23
  getProductDetail: () => getProductDetail,
23
24
  getProductPrice: () => getProductPrice,
24
25
  postMultiDay: () => postMultiDay
@@ -30,8 +31,12 @@ var postMultiDay = async (id, params) => import_utils.request.getRequest().post(
30
31
  useCache: true
31
32
  });
32
33
  var getProductPrice = async (params) => import_utils.request.getRequest().post(`/shop/product/query/price`, params);
34
+ var getNormalAndMultiDayProductPrice = async (params) => {
35
+ return import_utils.request.getRequest().post(`/shop/product/query/shelf/price`, params);
36
+ };
33
37
  // Annotate the CommonJS export names for ESM import in node:
34
38
  0 && (module.exports = {
39
+ getNormalAndMultiDayProductPrice,
35
40
  getProductDetail,
36
41
  getProductPrice,
37
42
  postMultiDay
@@ -31,6 +31,7 @@ module.exports = __toCommonJS(utils_exports);
31
31
  var import_utils = require("@pisell/utils");
32
32
  var import_utils2 = require("../../../utils");
33
33
  var import_distributeDiscount = require("../../service/serviceManager/distributeDiscount");
34
+ var import_utils3 = require("../../../../ticketBooking/utils");
34
35
  var getGroupTotalPrice = (items) => {
35
36
  return items.reduce((prev, next) => {
36
37
  prev.duration += next._extend.duration;
@@ -98,6 +99,7 @@ var createBookingItemsByGroup = (item, isBatchEdit) => {
98
99
  cacheItem._extend.total = totalPrice;
99
100
  cacheItem._extend.origin_total = totalPrice;
100
101
  cacheItem._extend.items = void 0;
102
+ cacheItem._serviceKey = (0, import_utils3.genServiceKey)(cacheItem);
101
103
  bookings.push(cacheItem);
102
104
  }
103
105
  if (isBatchEdit) {
@@ -67,39 +67,7 @@ export declare const genRowKey: (key: string) => string;
67
67
  * @Author: WangHan
68
68
  * @Date: 2024-11-29 17:36
69
69
  */
70
- export declare const formatProducts: (lists: any[], state: any, isRenderGroup?: boolean, isGeneral?: boolean, isParallelResource?: boolean) => {
71
- _origin: any;
72
- id: any;
73
- _id: any;
74
- name: any;
75
- title: any;
76
- price: any;
77
- total: number;
78
- origin_total: number;
79
- num: any;
80
- image: any;
81
- isShowNote: boolean;
82
- note: any;
83
- like_status: any;
84
- bundle: any;
85
- options: any;
86
- errorMessage: string;
87
- product_option_string: any;
88
- discount_reason: any;
89
- resource_id: any;
90
- relation_form_name: any;
91
- holder_title: any;
92
- start_date: any;
93
- end_date: any;
94
- holder_id: any;
95
- isNormalProduct: boolean;
96
- isCustomItem: any;
97
- vouchersApplicable: any;
98
- locale: any;
99
- symbol: any;
100
- relation_products: any;
101
- items: any[];
102
- }[];
70
+ export declare const formatProducts: (lists: any[], state: any, isRenderGroup?: boolean, isGeneral?: boolean, isParallelResource?: boolean) => any[];
103
71
  /**
104
72
  * @title: 禁用日期
105
73
  * @description:
@@ -518,10 +518,11 @@ var getGeneralParams = (item, state, isParallelResource) => {
518
518
  ];
519
519
  }
520
520
  const isNormalProduct = isNormalProductByDurationSchedule(item);
521
+ const isMultiDay = (0, import_utils6.isMultiDayProduct)(item);
521
522
  return {
522
523
  format: ["HH:mm", "HH:mm"],
523
524
  show_time: true,
524
- duration_type: "minutes",
525
+ duration_type: isMultiDay ? "days" : "minutes",
525
526
  // 当前可选择holder列表
526
527
  holders: formatHolders(holders),
527
528
  isShowChangeHolder: !isNormalProduct,
@@ -546,8 +547,6 @@ var calcAddTimeTotalPrice = (total, addTimeProducts) => {
546
547
  };
547
548
  var formatProducts = (lists, state, isRenderGroup = true, isGeneral, isParallelResource) => {
548
549
  if (!(lists == null ? void 0 : lists.length)) return [];
549
- const normalList = [];
550
- const groupList = [];
551
550
  const formItem = (item) => {
552
551
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
553
552
  const _isDayBookingProduct = isDayBookingProduct(item, state);
@@ -600,17 +599,23 @@ var formatProducts = (lists, state, isRenderGroup = true, isGeneral, isParallelR
600
599
  _origin: item
601
600
  };
602
601
  };
603
- console.log(normalList, "normalList");
604
602
  if (isRenderGroup) {
605
- lists.forEach((item) => {
606
- var _a;
603
+ const normalItemsWithIndex = [];
604
+ const groupItemsWithIndex = [];
605
+ const groupFirstIndexMap = {};
606
+ lists.forEach((item, index) => {
607
+ var _a, _b;
607
608
  if (!((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId)) {
608
- normalList.push(formItem(item));
609
+ normalItemsWithIndex.push({ item, index });
609
610
  } else {
610
- groupList.push(item);
611
+ const groupId = (_b = item == null ? void 0 : item._extend) == null ? void 0 : _b.groupId;
612
+ groupItemsWithIndex.push({ item, index });
613
+ if (groupFirstIndexMap[groupId] === void 0) {
614
+ groupFirstIndexMap[groupId] = index;
615
+ }
611
616
  }
612
617
  });
613
- let groups = groupList.reduce((prev, item) => {
618
+ const groups = groupItemsWithIndex.reduce((prev, { item }) => {
614
619
  var _a;
615
620
  const groupId = (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId;
616
621
  if (!prev[groupId]) {
@@ -619,7 +624,16 @@ var formatProducts = (lists, state, isRenderGroup = true, isGeneral, isParallelR
619
624
  prev[groupId].push(item);
620
625
  return prev;
621
626
  }, {});
622
- return Object.values(groups).map((d) => formItem((0, import_utils3.concatBookings)(d))).concat(normalList);
627
+ const mergedGroupItems = Object.entries(groups).map(([groupId, items]) => ({
628
+ item: formItem((0, import_utils3.concatBookings)(items)),
629
+ index: groupFirstIndexMap[groupId]
630
+ }));
631
+ const formattedNormalItems = normalItemsWithIndex.map(({ item, index }) => ({
632
+ item: formItem(item),
633
+ index
634
+ }));
635
+ const allItems = [...mergedGroupItems, ...formattedNormalItems].sort((a, b) => a.index - b.index);
636
+ return allItems.map(({ item }) => item);
623
637
  } else {
624
638
  return lists == null ? void 0 : lists.map((item) => formItem(item));
625
639
  }
@@ -45,6 +45,7 @@ module.exports = __toCommonJS(utils_exports);
45
45
  var import_dayjs = __toESM(require("dayjs"));
46
46
  var import_utils = require("../utils");
47
47
  var import_utils2 = require("../info2/service/addTimeModal/utils");
48
+ var import_utils3 = require("../info2/service/addService/utils");
48
49
  var getIsBundleOrCombination = (productDetail) => {
49
50
  var _a;
50
51
  if ((_a = productDetail == null ? void 0 : productDetail.bundle_group) == null ? void 0 : _a.length) {
@@ -195,6 +196,9 @@ var isOpenAddTime = (state) => {
195
196
  return true;
196
197
  };
197
198
  var isShowAddTime = (state, currentService) => {
199
+ if ((0, import_utils3.isMultiDayProduct)(currentService)) {
200
+ return false;
201
+ }
198
202
  if (!isOpenAddTime(state)) {
199
203
  return false;
200
204
  }
@@ -49,6 +49,7 @@ var import_utils4 = require("@pisell/utils");
49
49
  var import_ahooks = require("ahooks");
50
50
  var import_utils5 = require("../../../info/service2/utils");
51
51
  var import_utils6 = require("../../../../ticketBooking/utils");
52
+ var import_utils7 = require("../../../info/service2/Group/utils");
52
53
  var shopList = [
53
54
  2886,
54
55
  4422,
@@ -223,7 +224,7 @@ var Info = (props) => {
223
224
  isOS: isSession,
224
225
  customer_id: (_c2 = (_b2 = state.client) == null ? void 0 : _b2.value) == null ? void 0 : _c2.id
225
226
  },
226
- callback: (e, extension_type, detail) => {
227
+ callback: async (e, extension_type, detail) => {
227
228
  var _a3, _b3;
228
229
  if (lock) {
229
230
  return;
@@ -249,7 +250,10 @@ var Info = (props) => {
249
250
  },
250
251
  new: 1
251
252
  };
252
- console.log(cacheItem, "cacheItem", e);
253
+ const isMultiDay = (0, import_utils2.isMultiDayProduct)(cacheItem);
254
+ if (isMultiDay) {
255
+ cacheItem._extend.end_date = state.date.value.add(1, "day");
256
+ }
253
257
  let _total = (0, import_utils3.getProductTotalPrice)(cacheItem);
254
258
  cacheItem._extend.total = _total;
255
259
  cacheItem._extend.origin_total = _total;
@@ -262,7 +266,19 @@ var Info = (props) => {
262
266
  cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
263
267
  }
264
268
  cacheItem = (0, import_utils2.getProductExtend)({ cacheItem, state });
265
- if (state.renderType === "eventBooking") {
269
+ const getMultiDayCacheItem = async (isConcatBookings) => {
270
+ cacheItem = await (0, import_utils2.getMultiDay)({
271
+ start_date: cacheItem._extend.start_date,
272
+ end_date: cacheItem._extend.end_date,
273
+ state,
274
+ cacheItem
275
+ });
276
+ cacheItem = (0, import_utils7.createBookingItemsByGroup)(cacheItem);
277
+ if (isConcatBookings) {
278
+ cacheItem = (0, import_utils7.concatBookings)(cacheItem);
279
+ }
280
+ };
281
+ if (state.renderType === "eventBooking" || isMultiDay) {
266
282
  cacheItem.autoClose = false;
267
283
  }
268
284
  if (cacheItem.autoClose) {
@@ -289,6 +305,9 @@ var Info = (props) => {
289
305
  });
290
306
  } else {
291
307
  (_b3 = window.openBookingEditModal) == null ? void 0 : _b3.call(window);
308
+ if (isMultiDay) {
309
+ await getMultiDayCacheItem(true);
310
+ }
292
311
  dispatch({
293
312
  type: "setService",
294
313
  payload: {
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: string;
10
+ locale: any;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -79,6 +79,14 @@ export declare const setDefaultCapacitys: ({ capacitys, cacheItem }: any) => any
79
79
  * @Date: 2024-09-19 20:23
80
80
  */
81
81
  export declare const getResourceByIds: (resourcesOriginMap: any, cacheItem: any, extraParams?: any) => any[];
82
+ /**
83
+ * @title: 是否是跨日商品
84
+ * @description:
85
+ * @param {any} cacheItem
86
+ * @return {*}
87
+ */
88
+ export declare const isMultiDayProduct: (product: any) => boolean;
89
+ export declare const getMultiDay: ({ start_date, end_date, state, cacheItem, }: any) => Promise<any>;
82
90
  /**
83
91
  * @title: 预生成服务的 extend
84
92
  * @description: