@pisell/private-materials 3.0.201 → 3.0.202

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 (129) 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 +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +12 -27
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -33
  11. package/es/components/booking/addons/model.d.ts +1 -1
  12. package/es/components/booking/components/footer/amount.js +5 -4
  13. package/es/components/booking/components/footer/utils.js +49 -29
  14. package/es/components/booking/forms/model.d.ts +1 -1
  15. package/es/components/booking/info/Provider.d.ts +0 -0
  16. package/es/components/booking/info/Provider.js +54 -0
  17. package/es/components/booking/info/clientVariant/vertical/index.js +93 -7
  18. package/es/components/booking/info/main.js +10 -9
  19. package/es/components/booking/info/pet/ChangePetModal/index.js +38 -23
  20. package/es/components/booking/info/service/addService/index.js +70 -99
  21. package/es/components/booking/info/service/addService/utils.d.ts +1 -0
  22. package/es/components/booking/info/service/addService/utils.js +55 -3
  23. package/es/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
  24. package/es/components/booking/info/service/editService/BookingList/index.js +39 -0
  25. package/es/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
  26. package/es/components/booking/info/service/editService/EditTabs/index.js +35 -0
  27. package/es/components/booking/info/service/editService/index.js +234 -142
  28. package/es/components/booking/info/service/serve.d.ts +10 -0
  29. package/es/components/booking/info/service/serve.js +28 -0
  30. package/es/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
  31. package/es/components/booking/info/service/serviceManager/distributeDiscount.js +55 -0
  32. package/es/components/booking/info/service/serviceManager/index.d.ts +20 -0
  33. package/es/components/booking/info/service/serviceManager/index.js +277 -0
  34. package/es/components/booking/info/service/serviceManager/utils.d.ts +0 -0
  35. package/es/components/booking/info/service/serviceManager/utils.js +0 -0
  36. package/es/components/booking/info/service2/Group/utils.d.ts +14 -0
  37. package/es/components/booking/info/service2/Group/utils.js +146 -0
  38. package/es/components/booking/info/service2/Lists.js +27 -33
  39. package/es/components/booking/info/service2/index.d.ts +4 -1
  40. package/es/components/booking/info/service2/index.js +5 -6
  41. package/es/components/booking/info/service2/status.js +1 -1
  42. package/es/components/booking/info/service2/utils.d.ts +95 -3
  43. package/es/components/booking/info/service2/utils.js +676 -52
  44. package/es/components/booking/info/utils.d.ts +11 -0
  45. package/es/components/booking/info/utils.js +24 -0
  46. package/es/components/booking/locales.d.ts +6 -0
  47. package/es/components/booking/locales.js +9 -3
  48. package/es/components/booking/model.d.ts +1 -0
  49. package/es/components/booking/notes/index.d.ts +1 -1
  50. package/es/components/booking/notes/model.d.ts +1 -1
  51. package/es/components/booking/payments/index.d.ts +1 -1
  52. package/es/components/booking/payments/model.d.ts +1 -1
  53. package/es/components/booking/utils.js +5 -4
  54. package/es/components/eftpos/hooks.d.ts +4 -4
  55. package/es/components/eftposPay/amount.d.ts +1 -1
  56. package/es/components/eftposPay/component/step/index.d.ts +6 -6
  57. package/es/components/eftposPay/component/step/step.d.ts +4 -4
  58. package/es/components/eftposPay/hooks.d.ts +1 -1
  59. package/es/components/eftposPay/store/index.d.ts +1 -1
  60. package/es/components/eftposPay/tyro/hooks.d.ts +2 -2
  61. package/es/components/eftposPay/windcave/helper.d.ts +1 -1
  62. package/es/components/schedules/index.d.ts +1 -1
  63. package/es/components/schedules/model.d.ts +1 -1
  64. package/es/components/shoppingCart/components/Cart/Product.js +11 -39
  65. package/es/components/shoppingCart/components/Render/index.js +8 -7
  66. package/es/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
  67. package/es/components/shoppingCart/hooks/useClearCart.js +10 -5
  68. package/es/components/shoppingCart/type.d.ts +1 -1
  69. package/es/components/shoppingCart/utils.js +2 -5
  70. package/lib/components/booking/addons/model.d.ts +1 -1
  71. package/lib/components/booking/components/footer/amount.js +4 -3
  72. package/lib/components/booking/components/footer/utils.js +28 -28
  73. package/lib/components/booking/forms/model.d.ts +1 -1
  74. package/lib/components/booking/info/Provider.d.ts +0 -0
  75. package/lib/components/booking/info/Provider.js +0 -0
  76. package/lib/components/booking/info/clientVariant/vertical/index.js +51 -1
  77. package/lib/components/booking/info/main.js +6 -5
  78. package/lib/components/booking/info/pet/ChangePetModal/index.js +33 -23
  79. package/lib/components/booking/info/service/addService/index.js +50 -92
  80. package/lib/components/booking/info/service/addService/utils.d.ts +1 -0
  81. package/lib/components/booking/info/service/addService/utils.js +27 -0
  82. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
  83. package/lib/components/booking/info/service/editService/BookingList/index.js +55 -0
  84. package/lib/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
  85. package/lib/components/booking/info/service/editService/EditTabs/index.js +75 -0
  86. package/lib/components/booking/info/service/editService/index.js +309 -234
  87. package/lib/components/booking/info/service/serve.d.ts +10 -0
  88. package/lib/components/booking/info/service/serve.js +7 -2
  89. package/lib/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
  90. package/lib/components/booking/info/service/serviceManager/distributeDiscount.js +70 -0
  91. package/lib/components/booking/info/service/serviceManager/index.d.ts +20 -0
  92. package/lib/components/booking/info/service/serviceManager/index.js +207 -0
  93. package/lib/components/booking/info/service/serviceManager/utils.d.ts +0 -0
  94. package/lib/components/booking/info/service/serviceManager/utils.js +0 -0
  95. package/lib/components/booking/info/service2/Group/utils.d.ts +14 -0
  96. package/lib/components/booking/info/service2/Group/utils.js +142 -0
  97. package/lib/components/booking/info/service2/Lists.js +14 -12
  98. package/lib/components/booking/info/service2/index.d.ts +4 -1
  99. package/lib/components/booking/info/service2/index.js +5 -5
  100. package/lib/components/booking/info/service2/status.js +1 -1
  101. package/lib/components/booking/info/service2/utils.d.ts +95 -3
  102. package/lib/components/booking/info/service2/utils.js +401 -48
  103. package/lib/components/booking/info/utils.d.ts +11 -0
  104. package/lib/components/booking/info/utils.js +35 -0
  105. package/lib/components/booking/locales.d.ts +6 -0
  106. package/lib/components/booking/locales.js +9 -3
  107. package/lib/components/booking/model.d.ts +1 -0
  108. package/lib/components/booking/notes/index.d.ts +1 -1
  109. package/lib/components/booking/notes/model.d.ts +1 -1
  110. package/lib/components/booking/payments/index.d.ts +1 -1
  111. package/lib/components/booking/payments/model.d.ts +1 -1
  112. package/lib/components/booking/utils.js +3 -4
  113. package/lib/components/eftpos/hooks.d.ts +4 -4
  114. package/lib/components/eftposPay/amount.d.ts +1 -1
  115. package/lib/components/eftposPay/component/step/index.d.ts +6 -6
  116. package/lib/components/eftposPay/component/step/step.d.ts +4 -4
  117. package/lib/components/eftposPay/hooks.d.ts +1 -1
  118. package/lib/components/eftposPay/store/index.d.ts +1 -1
  119. package/lib/components/eftposPay/tyro/hooks.d.ts +2 -2
  120. package/lib/components/eftposPay/windcave/helper.d.ts +1 -1
  121. package/lib/components/schedules/index.d.ts +1 -1
  122. package/lib/components/schedules/model.d.ts +1 -1
  123. package/lib/components/shoppingCart/components/Cart/Product.js +6 -22
  124. package/lib/components/shoppingCart/components/Render/index.js +6 -10
  125. package/lib/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
  126. package/lib/components/shoppingCart/hooks/useClearCart.js +4 -9
  127. package/lib/components/shoppingCart/type.d.ts +1 -1
  128. package/lib/components/shoppingCart/utils.js +2 -8
  129. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -9,7 +9,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
9
9
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
10
  import { getDiscountTime, flexibleObj } from "../../utils";
11
11
  import { formatAmount } from '@pisell/utils';
12
- import { isDayBooking, isAppointment } from "../../info/service2/utils";
12
+ import { isDayBooking, isDayBookingProduct } from "../../info/service2/utils";
13
13
  var getRelationDetailsTotal = function getRelationDetailsTotal(relation_details) {
14
14
  var total = 0;
15
15
  var _iterator = _createForOfIteratorHelper(relation_details),
@@ -48,10 +48,11 @@ var getProductAmount = function getProductAmount(state, isEdit) {
48
48
  var _item = _step2.value;
49
49
  // 跨日预约
50
50
  if (isDay) {
51
- price += Number(_item._extend.total) * Number(_item._extend.quantity);
51
+ var quantity = _item._extend.quantity || 1;
52
+ price += Number(_item._extend.total) * Number(quantity);
52
53
 
53
54
  // 普通商品不能加到时长上
54
- var _duration = isAppointment(_item, state) ? _item._extend.duration : 0;
55
+ var _duration = isDayBookingProduct(_item, state) ? _item._extend.duration : 0;
55
56
  duration += _duration;
56
57
  } else {
57
58
  price += Number(_item._extend.total);
@@ -91,7 +92,7 @@ var getProductAmount = function getProductAmount(state, isEdit) {
91
92
  var current = 0;
92
93
  if (isDay) {
93
94
  // 普通商品不能加到时长上
94
- var _duration2 = isAppointment(cur, state) ? cur._extend.duration : 0;
95
+ var _duration2 = isDayBookingProduct(cur, state) ? cur._extend.duration : 0;
95
96
  current = _duration2 || 0;
96
97
  } else {
97
98
  var _cur$_extend;
@@ -47,6 +47,7 @@ export var formatProductOption = function formatProductOption(option) {
47
47
  "num": d.num,
48
48
  "option_group_item_id": d.product_option_item_id,
49
49
  "option_group_id": d.option_group_id
50
+ // "add_price": Number(d?.add_price),
50
51
  };
51
52
  });
52
53
  };
@@ -72,6 +73,8 @@ export var formatProductBundle = function formatProductBundle(bundle) {
72
73
  "num": d.num,
73
74
  "extension_id": d.extension_id,
74
75
  "extension_type": d.extension_type,
76
+ // "price": Number(d?.price),
77
+ // "price_type": d?.price_type,
75
78
  "option": formatProductOption(d.option)
76
79
  };
77
80
  });
@@ -159,7 +162,6 @@ var formatProductPrice = function formatProductPrice(item) {
159
162
  var _item$_extend2, _item$_extend3;
160
163
  var other = (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.other;
161
164
  var price = Number((_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.price);
162
-
163
165
  // 单规格, 单价 + 单规格价格
164
166
  if (other !== null && other !== void 0 && other.option) {
165
167
  var _other$option;
@@ -169,6 +171,25 @@ var formatProductPrice = function formatProductPrice(item) {
169
171
  }
170
172
  return price;
171
173
  };
174
+ var formatMetaData = function formatMetaData(item) {
175
+ var _item$_extend4, _item$_extend5, _item$_extend7;
176
+ var metadata = {};
177
+ if ((_item$_extend4 = item._extend) !== null && _item$_extend4 !== void 0 && _item$_extend4.capacity) {
178
+ metadata.capacity = item._extend.capacity;
179
+ }
180
+ if (item._extend.groupId) {
181
+ metadata.groupId = item._extend.groupId;
182
+ }
183
+ if ((_item$_extend5 = item._extend) !== null && _item$_extend5 !== void 0 && _item$_extend5.holder_id) {
184
+ var _item$_extend6;
185
+ metadata.holder_id = (_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.holder_id;
186
+ }
187
+ if ((_item$_extend7 = item._extend) !== null && _item$_extend7 !== void 0 && _item$_extend7.multiDayPrices) {
188
+ var _item$_extend8;
189
+ metadata.multiDayPrices = (_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.multiDayPrices;
190
+ }
191
+ return metadata;
192
+ };
172
193
 
173
194
  /**
174
195
  * @title: 格式化商品数据
@@ -179,7 +200,7 @@ var formatProductPrice = function formatProductPrice(item) {
179
200
  * @Date: 2024-12-07 14:21
180
201
  */
181
202
  var formatProducts = function formatProducts(item) {
182
- var _item$_extend4, _item$_extend4$other, _item$_extend5, _item$_extend5$other, _item$_extend6, _item$_extend6$other;
203
+ var _item$_extend9, _item$_extend9$other, _item$_extend10, _item$_extend10$other, _item$_extend11, _item$_extend11$other;
183
204
  var total = Number(item._extend.total);
184
205
  var origin_total = Number(item._extend.origin_total);
185
206
  var discount_amount = origin_total - total;
@@ -198,10 +219,11 @@ var formatProducts = function formatProducts(item) {
198
219
  "discount_per": item._extend.discount_per,
199
220
  "discount_type": item._extend.discount_type || discount_type,
200
221
  "order_detail_id": item._extend.order_detail_id || 0,
201
- "product_bundle": formatProductBundle((_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 ? void 0 : (_item$_extend4$other = _item$_extend4.other) === null || _item$_extend4$other === void 0 ? void 0 : _item$_extend4$other.bundle),
222
+ "product_bundle": formatProductBundle((_item$_extend9 = item._extend) === null || _item$_extend9 === void 0 ? void 0 : (_item$_extend9$other = _item$_extend9.other) === null || _item$_extend9$other === void 0 ? void 0 : _item$_extend9$other.bundle),
202
223
  "bundle_edit": item._extend.bundle_edit,
203
- "product_option_item": formatProductOption((_item$_extend5 = item._extend) === null || _item$_extend5 === void 0 ? void 0 : (_item$_extend5$other = _item$_extend5.other) === null || _item$_extend5$other === void 0 ? void 0 : _item$_extend5$other.option),
204
- "product_variant_id": ((_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : (_item$_extend6$other = _item$_extend6.other) === null || _item$_extend6$other === void 0 ? void 0 : _item$_extend6$other.product_variant_id) || 0
224
+ "product_option_item": formatProductOption((_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : (_item$_extend10$other = _item$_extend10.other) === null || _item$_extend10$other === void 0 ? void 0 : _item$_extend10$other.option),
225
+ "product_variant_id": ((_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : (_item$_extend11$other = _item$_extend11.other) === null || _item$_extend11$other === void 0 ? void 0 : _item$_extend11$other.product_variant_id) || 0,
226
+ metadata: formatMetaData(item)
205
227
  };
206
228
  };
207
229
 
@@ -219,11 +241,11 @@ var formatDayRelationProducts = function formatDayRelationProducts(data, booking
219
241
 
220
242
  // 过滤出卡片中的普通商品
221
243
  var relation_products = list === null || list === void 0 ? void 0 : list.filter(function (item) {
222
- var _item$_extend7;
223
- var holderId = (_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.holder_id;
244
+ var _item$_extend12;
245
+ var holderId = (_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.holder_id;
224
246
  var bookingHolderId = booking_item._extend.holder_id;
225
- var isAppointment = appointmentTypes.includes(item.extension_type);
226
- return holderId && holderId === bookingHolderId && !isAppointment;
247
+ var isDayBookingProduct = appointmentTypes.includes(item.extension_type);
248
+ return holderId && holderId === bookingHolderId && !isDayBookingProduct;
227
249
  });
228
250
  relation_products = relation_products.map(function (item) {
229
251
  return formatProducts(item);
@@ -246,15 +268,15 @@ var formatAppointmentProductLists = function formatAppointmentProductLists(data)
246
268
 
247
269
  // 找出预约商品
248
270
  list = list.filter(function (item) {
249
- var _item$_extend8;
250
- return ((_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.holder_id) && appointmentTypes.includes(item.extension_type);
271
+ var _item$_extend13;
272
+ return ((_item$_extend13 = item._extend) === null || _item$_extend13 === void 0 ? void 0 : _item$_extend13.holder_id) && appointmentTypes.includes(item.extension_type);
251
273
  });
252
274
 
253
275
  // 对预约商品列表根据holder_id进行分组
254
276
  var groupMap = new Map();
255
277
  list.forEach(function (item) {
256
- var _item$_extend9;
257
- var key = (_item$_extend9 = item._extend) === null || _item$_extend9 === void 0 ? void 0 : _item$_extend9.holder_id; // 分组键
278
+ var _item$_extend14;
279
+ var key = (_item$_extend14 = item._extend) === null || _item$_extend14 === void 0 ? void 0 : _item$_extend14.holder_id; // 分组键
258
280
  if (!groupMap.has(key)) {
259
281
  groupMap.set(key, []);
260
282
  }
@@ -262,16 +284,16 @@ var formatAppointmentProductLists = function formatAppointmentProductLists(data)
262
284
  });
263
285
 
264
286
  // 处理每个分组
265
- groupMap.forEach(function (group) {
266
- // 只给第一个数据增加 relation_products
267
- group[0].relation_products = formatDayRelationProducts(data, group[0]);
268
- });
287
+ // groupMap.forEach(group => {
288
+ // // 只给第一个数据增加 relation_products
289
+ // group[0].relation_products = formatDayRelationProducts(data, group[0])
290
+ // });
269
291
 
270
292
  // 将分组的结果还原为数组
271
293
  var result = (_Array$from = Array.from(groupMap.values())) === null || _Array$from === void 0 ? void 0 : _Array$from.reduce(function (acc, group) {
272
294
  return acc.concat(group);
273
295
  }, []);
274
- return result || [];
296
+ return list || [];
275
297
  } catch (error) {}
276
298
  };
277
299
 
@@ -297,7 +319,6 @@ var formatBookings = function formatBookings(data, values) {
297
319
  };
298
320
  var eventOtherParams = data.eventOtherParams;
299
321
  var bookings = [];
300
- console.log(list, 'wh_result11');
301
322
  bookings = list.map(function (item) {
302
323
  var start_date = item._extend.startDate.format('YYYY-MM-DD');
303
324
  var end_date = item._extend.endDate.format('YYYY-MM-DD');
@@ -311,9 +332,9 @@ var formatBookings = function formatBookings(data, values) {
311
332
 
312
333
  // 跨日预约下的普通商品
313
334
  if (isDay) {
314
- var _item$_extend10, _item$_extend11, _item$_extend12, _item$_extend13;
315
- var startDate = ((_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.startDate) || ((_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.start_date);
316
- var endDate = ((_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.endDate) || ((_item$_extend13 = item._extend) === null || _item$_extend13 === void 0 ? void 0 : _item$_extend13.end_date);
335
+ var _item$_extend15, _item$_extend16, _item$_extend17, _item$_extend18;
336
+ var startDate = ((_item$_extend15 = item._extend) === null || _item$_extend15 === void 0 ? void 0 : _item$_extend15.startDate) || ((_item$_extend16 = item._extend) === null || _item$_extend16 === void 0 ? void 0 : _item$_extend16.start_date);
337
+ var endDate = ((_item$_extend17 = item._extend) === null || _item$_extend17 === void 0 ? void 0 : _item$_extend17.endDate) || ((_item$_extend18 = item._extend) === null || _item$_extend18 === void 0 ? void 0 : _item$_extend18.end_date);
317
338
  var _formatDayTime = formatDayTime({
318
339
  startDate: startDate,
319
340
  endDate: endDate
@@ -355,9 +376,7 @@ var formatBookings = function formatBookings(data, values) {
355
376
  cacheItem: item
356
377
  }) : item._extend.number || 1,
357
378
  "resources": formatResource(item),
358
- "metadata": item._extend.capacity ? {
359
- capacity: item._extend.capacity
360
- } : undefined
379
+ "metadata": formatMetaData(item)
361
380
  }, eventOtherParams || {}), dayParams);
362
381
  });
363
382
  return bookings;
@@ -376,14 +395,13 @@ var formatRelationProducts = function formatRelationProducts(data) {
376
395
  var list = ((_data$service = data.service) === null || _data$service === void 0 ? void 0 : _data$service.value) || [];
377
396
  // open items 下的商品
378
397
  list = list.filter(function (item) {
379
- var _item$_extend14;
380
- return !((_item$_extend14 = item._extend) !== null && _item$_extend14 !== void 0 && _item$_extend14.holder_id);
398
+ return !appointmentTypes.includes(item.extension_type);
381
399
  });
382
400
  var relationProducts = [];
383
401
  relationProducts = list.map(function (item) {
384
402
  return formatProducts(item);
385
403
  });
386
- return relationProducts;
404
+ return relationProducts || [];
387
405
  };
388
406
 
389
407
  /**
@@ -454,7 +472,6 @@ export var formatValues = function formatValues(state) {
454
472
  // 主体
455
473
  values.holder = formatHolder(state, values);
456
474
  if (isDay) {
457
- // 父预约商品
458
475
  values.relation_products = formatRelationProducts(state);
459
476
  }
460
477
 
@@ -473,6 +490,9 @@ export var formatValues = function formatValues(state) {
473
490
  // 跨日预约增加多余参数区分
474
491
  if (isDay) {
475
492
  values.metadata.is_multiday_appointment = 1;
493
+ // is_bundle_price_calculated 用于区分商品的price是总价,还是商品的单价
494
+ values.is_bundle_price_calculated = 1;
476
495
  }
496
+ debugger;
477
497
  return values;
478
498
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
File without changes
@@ -0,0 +1,54 @@
1
+ // 暂不使用
2
+
3
+ // import React, { createContext, useContext, useRef, useState } from 'react';
4
+ // import { FormState } from '../model';
5
+ // import useEngineContext from '../../../hooks/useEngineContext';
6
+
7
+ // import { request } from '../utils';
8
+ // type BookingInfoContextType = FormState;
9
+
10
+ // const BookingInfoContext = createContext<BookingInfoContextType | undefined>(
11
+ // undefined
12
+ // );
13
+ // const defaultModules = {
14
+ // client: 1,
15
+ // date: 1,
16
+ // service: 1,
17
+ // holder: 1,
18
+ // note: 1,
19
+ // service2: 0,
20
+ // };
21
+ // export const BookingInfoProvider: React.FC<any> = (props) => {
22
+ // const { style, globalState, modules = defaultModules, children } = props;
23
+ // const context = useEngineContext();
24
+ // request.setRequest(context.appHelper.utils.request);
25
+
26
+ // return (
27
+ // <BookingInfoContext.Provider
28
+ // value={{
29
+ // setGlobalState: props.setGlobalState,
30
+ // ...globalState,
31
+ // isTerminal: context?.appHelper?.utils?.isTerminal?.(),
32
+ // isFranchisee:
33
+ // context?.appHelper?.utils?.businessUtils?.getAppByModal?.(
34
+ // 'franchisee'
35
+ // ),
36
+ // timezone:
37
+ // context?.appHelper?.utils?.store?.getState()?.global?.globalConfig
38
+ // ?.timezone,
39
+ // modules,
40
+ // style,
41
+ // }}
42
+ // >
43
+ // {children}
44
+ // </BookingInfoContext.Provider>
45
+ // );
46
+ // };
47
+
48
+ // export const useBookingInfo = (): BookingInfoContextType => {
49
+ // const context = useContext(BookingInfoContext);
50
+ // if (!context) {
51
+ // throw new Error();
52
+ // }
53
+ // return context;
54
+ // };
@@ -32,10 +32,11 @@ import useEngineContext from "../../../../../hooks/useEngineContext";
32
32
  import { formatAddFormValues } from "../../../forms/format";
33
33
  import { moveItemToFront } from "../../utils";
34
34
  import { request } from "../../../utils";
35
- import { isDayBooking, isOpenDeletePet } from "../../service2/utils";
35
+ import { isDayBooking, isOpenDeletePet, getPets, getAppointmentService, updateServicePrice } from "../../service2/utils";
36
36
  import ChangePetModal from "../../pet/ChangePetModal";
37
+ import { walkInData } from "../../model";
37
38
  var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
38
- var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig8, _state$bookingConfig9, _state$bookingConfig10, _state$bookingConfig11, _state$pet3, _state$pet4, _state$pet6, _state$pet6$formData, _state$pet6$formData$, _state$pet8, _state$client$value4, _state$bookingConfig17, _state$bookingConfig18, _state$bookingConfig19, _state$pet9, _state$pet9$formData, _state$bookingConfig20, _state$bookingConfig21, _state$service2, _state$client$value5, _state$client$value6, _state$client$value7, _state$client$value8, _state$client$value9, _context$appHelper2, _context$appHelper2$u, _context$appHelper2$u2, _state$bookingConfig22, _state$client6;
39
+ var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig8, _state$bookingConfig9, _state$bookingConfig10, _state$bookingConfig11, _state$pet3, _state$pet4, _state$pet6, _state$pet6$formData, _state$pet6$formData$, _state$pet8, _state$client$value4, _state$bookingConfig17, _state$bookingConfig18, _state$bookingConfig19, _state$pet9, _state$pet9$formData, _state$bookingConfig20, _state$bookingConfig21, _state$service2, _state$client$value6, _state$client$value7, _state$client$value8, _state$client$value9, _state$client$value10, _context$appHelper2, _context$appHelper2$u, _context$appHelper2$u2, _state$bookingConfig22, _state$client6;
39
40
  var globalState = props.globalState,
40
41
  setGlobalState = props.setGlobalState;
41
42
  var modalRef = useRef();
@@ -332,6 +333,91 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
332
333
  setSearch: (_modalRef$current2 = modalRef.current) === null || _modalRef$current2 === void 0 ? void 0 : _modalRef$current2.setSearch
333
334
  };
334
335
  });
336
+
337
+ /**
338
+ * @title: 是否打开更改商品弹窗
339
+ * @description:
340
+ * @param {*} useMemo
341
+ * @return {*}
342
+ * @Author: WangHan
343
+ * @Date: 2024-12-30 22:40
344
+ */
345
+ var isOpenDeleteProduct = useMemo(function () {
346
+ if (!isDayBooking(state)) return false;
347
+ var pets = getPets(state);
348
+ var appointmentServices = getAppointmentService(state);
349
+ if (pets !== null && pets !== void 0 && pets.length && appointmentServices !== null && appointmentServices !== void 0 && appointmentServices.length) {
350
+ return true;
351
+ }
352
+ return false;
353
+ }, [state]);
354
+
355
+ /**
356
+ * @title: 更改了客户
357
+ * @description:
358
+ * @param {any} e
359
+ * @return {*}
360
+ * @Author: WangHan
361
+ * @Date: 2024-12-31 14:48
362
+ */
363
+ var _handleSelectClient = /*#__PURE__*/function () {
364
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
365
+ var _state$service3, _state$service3$value, _state$client$value5, _value, _state, _changePetRef$current2, _state$service4, services;
366
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
367
+ while (1) switch (_context2.prev = _context2.next) {
368
+ case 0:
369
+ handleSelectClient(e);
370
+ if (!isDayBooking(state)) {
371
+ _context2.next = 13;
372
+ break;
373
+ }
374
+ _value = (e === null || e === void 0 ? void 0 : e[e.length - 1]) || walkInData;
375
+ if (!_value.loading) {
376
+ _context2.next = 5;
377
+ break;
378
+ }
379
+ return _context2.abrupt("return");
380
+ case 5:
381
+ if (!(isDayBooking(state) && (state === null || state === void 0 ? void 0 : (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : (_state$service3$value = _state$service3.value) === null || _state$service3$value === void 0 ? void 0 : _state$service3$value.length) > 0 && ((_state$client$value5 = state.client.value) === null || _state$client$value5 === void 0 ? void 0 : _state$client$value5.id) !== (_value === null || _value === void 0 ? void 0 : _value.id))) {
382
+ _context2.next = 13;
383
+ break;
384
+ }
385
+ _state = _objectSpread(_objectSpread({}, state), {}, {
386
+ client: _objectSpread(_objectSpread({}, state.client), {}, {
387
+ value: _objectSpread(_objectSpread({}, _value), {}, {
388
+ name: getNickname(_value)
389
+ })
390
+ })
391
+ }); // 表单数据并且有预约商品数据,则更新客户后将预约商品数据清空
392
+ if (isOpenDeleteProduct) {
393
+ (_changePetRef$current2 = changePetRef.current) === null || _changePetRef$current2 === void 0 ? void 0 : _changePetRef$current2.open({
394
+ setGlobalState: setGlobalState,
395
+ service: ((_state$service4 = state.service) === null || _state$service4 === void 0 ? void 0 : _state$service4.value) || [],
396
+ state: state,
397
+ source: 'changeClient'
398
+ });
399
+ }
400
+ _context2.next = 10;
401
+ return updateServicePrice(_state);
402
+ case 10:
403
+ services = _context2.sent;
404
+ console.log(services, state, _value, isOpenDeleteProduct, 'wh98797686');
405
+ setGlobalState({
406
+ service: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
407
+ value: services,
408
+ edit: true
409
+ })
410
+ });
411
+ case 13:
412
+ case "end":
413
+ return _context2.stop();
414
+ }
415
+ }, _callee2);
416
+ }));
417
+ return function _handleSelectClient(_x2) {
418
+ return _ref3.apply(this, arguments);
419
+ };
420
+ }();
335
421
  return /*#__PURE__*/React.createElement("div", {
336
422
  className: classNames('pisell-lowcode__booking-vertical-client-wrap', _defineProperty({}, 'create-booking-page-vertical-client-wrap', state.isBookingCreatePage))
337
423
  }, /*#__PURE__*/React.createElement("div", {
@@ -345,7 +431,7 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
345
431
  round: true
346
432
  }, /*#__PURE__*/React.createElement(Avatar, {
347
433
  className: "pisell-lowcode__booking-client-avatar",
348
- src: image.ali((_state$client$value5 = state.client.value) === null || _state$client$value5 === void 0 ? void 0 : _state$client$value5.cover, 100),
434
+ src: image.ali((_state$client$value6 = state.client.value) === null || _state$client$value6 === void 0 ? void 0 : _state$client$value6.cover, 100),
349
435
  size: 64,
350
436
  icon: /*#__PURE__*/React.createElement(User01, {
351
437
  className: "pisell-lowcode__booking-client-list-item-avatar-icon"
@@ -358,11 +444,11 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
358
444
  className: "pisell-lowcode__booking-client-desc-item"
359
445
  }, locales.getText('pisell2.text.leave-empty-for-walk-in'))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
360
446
  className: "pisell-lowcode__booking-client-title"
361
- }, getNickname(state.client.value)), (_state$client$value6 = state.client.value) !== null && _state$client$value6 !== void 0 && _state$client$value6.email ? /*#__PURE__*/React.createElement("div", {
447
+ }, getNickname(state.client.value)), (_state$client$value7 = state.client.value) !== null && _state$client$value7 !== void 0 && _state$client$value7.email ? /*#__PURE__*/React.createElement("div", {
362
448
  className: "pisell-lowcode__booking-client-desc-item"
363
- }, (_state$client$value7 = state.client.value) === null || _state$client$value7 === void 0 ? void 0 : _state$client$value7.email) : null, (_state$client$value8 = state.client.value) !== null && _state$client$value8 !== void 0 && _state$client$value8.phone ? /*#__PURE__*/React.createElement("div", {
449
+ }, (_state$client$value8 = state.client.value) === null || _state$client$value8 === void 0 ? void 0 : _state$client$value8.email) : null, (_state$client$value9 = state.client.value) !== null && _state$client$value9 !== void 0 && _state$client$value9.phone ? /*#__PURE__*/React.createElement("div", {
364
450
  className: "pisell-lowcode__booking-client-desc-item"
365
- }, (_state$client$value9 = state.client.value) === null || _state$client$value9 === void 0 ? void 0 : _state$client$value9.phone) : null), !isWalkIn && /*#__PURE__*/React.createElement("div", {
451
+ }, (_state$client$value10 = state.client.value) === null || _state$client$value10 === void 0 ? void 0 : _state$client$value10.phone) : null), !isWalkIn && /*#__PURE__*/React.createElement("div", {
366
452
  className: "pisell-lowcode__booking-client-action-wrap"
367
453
  }, !state.disabledEdit && /*#__PURE__*/React.createElement(Dropdown.Button, {
368
454
  menu: {
@@ -400,7 +486,7 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
400
486
  autoFocus: !(context !== null && context !== void 0 && (_context$appHelper2 = context.appHelper) !== null && _context$appHelper2 !== void 0 && (_context$appHelper2$u = _context$appHelper2.utils) !== null && _context$appHelper2$u !== void 0 && (_context$appHelper2$u2 = _context$appHelper2$u.isTerminal) !== null && _context$appHelper2$u2 !== void 0 && _context$appHelper2$u2.call(_context$appHelper2$u)),
401
487
  ref: modalRef,
402
488
  onClose: handleClose,
403
- handleSelectClient: handleSelectClient,
489
+ handleSelectClient: _handleSelectClient,
404
490
  handleCreateItem: handleCreateItem,
405
491
  childrenValue: state.pet.value,
406
492
  handleSelectPet: handleSelectPet,
@@ -36,8 +36,7 @@ var defaultModules = {
36
36
  };
37
37
  locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
38
38
  var Info = Provider(function (props) {
39
- var _modal$state2, _modal$state2$booking, _modal$state2$booking2, _modal$state2$booking3, _modal$state5, _modal$state5$notes, _context$appHelper4, _context$appHelper4$u, _classNames, _modal$state6, _React$createElement;
40
- // return <Payments {...props} />;
39
+ var _modal$state2, _modal$state2$booking, _modal$state2$booking2, _modal$state2$booking3, _modal$state5, _modal$state5$notes, _context$appHelper4, _context$appHelper4$u, _classNames, _modal$state6;
41
40
  var style = props.style,
42
41
  globalState = props.globalState,
43
42
  _props$modules = props.modules,
@@ -80,7 +79,8 @@ var Info = Provider(function (props) {
80
79
  }, globalState), {}, {
81
80
  isTerminal: context === null || context === void 0 ? void 0 : (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : (_context$appHelper2$u = _context$appHelper2.utils) === null || _context$appHelper2$u === void 0 ? void 0 : (_context$appHelper2$u2 = _context$appHelper2$u.isTerminal) === null || _context$appHelper2$u2 === void 0 ? void 0 : _context$appHelper2$u2.call(_context$appHelper2$u),
82
81
  isFranchisee: isFranchisee,
83
- timezone: context === null || context === void 0 ? void 0 : (_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 ? void 0 : (_context$appHelper3$u = _context$appHelper3.utils) === null || _context$appHelper3$u === void 0 ? void 0 : (_context$appHelper3$u2 = _context$appHelper3$u.store) === null || _context$appHelper3$u2 === void 0 ? void 0 : (_context$appHelper3$u3 = _context$appHelper3$u2.getState()) === null || _context$appHelper3$u3 === void 0 ? void 0 : (_context$appHelper3$u4 = _context$appHelper3$u3.global) === null || _context$appHelper3$u4 === void 0 ? void 0 : (_context$appHelper3$u5 = _context$appHelper3$u4.globalConfig) === null || _context$appHelper3$u5 === void 0 ? void 0 : _context$appHelper3$u5.timezone
82
+ timezone: context === null || context === void 0 ? void 0 : (_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 ? void 0 : (_context$appHelper3$u = _context$appHelper3.utils) === null || _context$appHelper3$u === void 0 ? void 0 : (_context$appHelper3$u2 = _context$appHelper3$u.store) === null || _context$appHelper3$u2 === void 0 ? void 0 : (_context$appHelper3$u3 = _context$appHelper3$u2.getState()) === null || _context$appHelper3$u3 === void 0 ? void 0 : (_context$appHelper3$u4 = _context$appHelper3$u3.global) === null || _context$appHelper3$u4 === void 0 ? void 0 : (_context$appHelper3$u5 = _context$appHelper3$u4.globalConfig) === null || _context$appHelper3$u5 === void 0 ? void 0 : _context$appHelper3$u5.timezone,
83
+ isDayBooking: (globalState === null || globalState === void 0 ? void 0 : globalState.renderType) === 'dayBooking'
84
84
  })
85
85
  });
86
86
  }, [JSON.stringify(globalState)]);
@@ -126,17 +126,18 @@ var Info = Provider(function (props) {
126
126
  onChange: addNote
127
127
  });
128
128
  }, [modules.note, globalState === null || globalState === void 0 ? void 0 : globalState.bookingId, globalState.render, (_modal$state5 = modal.state) === null || _modal$state5 === void 0 ? void 0 : (_modal$state5$notes = _modal$state5.notes) === null || _modal$state5$notes === void 0 ? void 0 : _modal$state5$notes.orderNote]);
129
- return /*#__PURE__*/React.createElement(React.Fragment, null, !!modal.state.setGlobalState ? /*#__PURE__*/React.createElement(TabPane, (_React$createElement = {
130
- style: style,
129
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !!modal.state.setGlobalState ? /*#__PURE__*/React.createElement(TabPane, {
130
+ style: _objectSpread(_objectSpread({}, style), {}, {
131
+ height: context !== null && context !== void 0 && (_context$appHelper4 = context.appHelper) !== null && _context$appHelper4 !== void 0 && (_context$appHelper4$u = _context$appHelper4.utils) !== null && _context$appHelper4$u !== void 0 && _context$appHelper4$u.isMobile ? '100%' : '100vh'
132
+ }),
131
133
  header: header,
132
134
  footer: /*#__PURE__*/React.createElement(Footer, {
133
135
  state: modal.state,
134
136
  dispatch: modal.dispatch,
135
137
  source: "info"
136
- })
137
- }, _defineProperty(_React$createElement, "style", {
138
- height: context !== null && context !== void 0 && (_context$appHelper4 = context.appHelper) !== null && _context$appHelper4 !== void 0 && (_context$appHelper4$u = _context$appHelper4.utils) !== null && _context$appHelper4$u !== void 0 && _context$appHelper4$u.isMobile ? '100%' : '100vh'
139
- }), _defineProperty(_React$createElement, "bodyClassName", classNames('booking-info-warp', (_classNames = {}, _defineProperty(_classNames, 'create-booking-page-info-wrap', isBookingCreatePage), _defineProperty(_classNames, 'create-booking-page-info-wrap-create', isBookingCreatePageCreateMode && !isTerminalDayBooking(modal.state)), _classNames))), _React$createElement), /*#__PURE__*/React.createElement("div", {
138
+ }),
139
+ bodyClassName: classNames('booking-info-warp', (_classNames = {}, _defineProperty(_classNames, 'create-booking-page-info-wrap', isBookingCreatePage), _defineProperty(_classNames, 'create-booking-page-info-wrap-create', isBookingCreatePageCreateMode && !isTerminalDayBooking(modal.state)), _classNames))
140
+ }, /*#__PURE__*/React.createElement("div", {
140
141
  className: "booking-info"
141
142
  }, createHeader, modules.client ? /*#__PURE__*/React.createElement(Client, null) : null, modules.holder && !((_modal$state6 = modal.state) !== null && _modal$state6 !== void 0 && _modal$state6.disabledEdit) ? /*#__PURE__*/React.createElement(React.Fragment, null, params.type === 'form' ? /*#__PURE__*/React.createElement(Pet, null) : null) : null, modules.date ? /*#__PURE__*/React.createElement(DateCom, null) : null, /*#__PURE__*/React.createElement(Skeleton, {
142
143
  loading: globalState.loading,
@@ -50,32 +50,47 @@ var ChangePetModal = function ChangePetModal(props, ref) {
50
50
  service = params.service,
51
51
  dispatch = params.dispatch,
52
52
  setGlobalState = params.setGlobalState,
53
- state = params.state;
53
+ state = params.state,
54
+ source = params.source;
54
55
  var _service = _toConsumableArray(service || []);
55
- if (type === 'ok') {
56
- var _service2;
57
- // 将商品放在open items中
58
- _service = (_service2 = _service) === null || _service2 === void 0 ? void 0 : _service2.map(function (item) {
59
- if (ids !== null && ids !== void 0 && ids.includes(item._extend.holder_id)) {
60
- return _objectSpread(_objectSpread({}, item), {}, {
61
- _extend: _objectSpread(_objectSpread({}, item._extend || {}), {}, {
62
- holder_id: 0
63
- })
64
- });
65
- }
66
- return item;
67
- });
68
56
 
69
- // 预约商品不能放在open items中, 所以过滤掉 holder_id为0 并且是预约商品的数据
70
- _service = _service.filter(function (item) {
71
- var _item$_extend;
72
- return !((item === null || item === void 0 ? void 0 : (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.holder_id) === 0 && appointmentTypes.includes(item.extension_type));
73
- });
57
+ // 如果是更改客户信息,则删除所有的预约商品数据
58
+ if (source === 'changeClient') {
59
+ if (type === 'ok') {
60
+ var _service2;
61
+ _service = (_service2 = _service) === null || _service2 === void 0 ? void 0 : _service2.filter(function (item) {
62
+ return !appointmentTypes.includes(item.extension_type);
63
+ });
64
+ } else {
65
+ _service = [];
66
+ }
74
67
  } else {
75
- // 将商品数据清空
76
- _service = _service.filter(function (item) {
77
- return !ids.includes(item._extend.holder_id);
78
- });
68
+ // 更改表单信息
69
+ if (type === 'ok') {
70
+ var _service3;
71
+ // 将商品放在open items中
72
+ _service = (_service3 = _service) === null || _service3 === void 0 ? void 0 : _service3.map(function (item) {
73
+ if (ids !== null && ids !== void 0 && ids.includes(item._extend.holder_id)) {
74
+ return _objectSpread(_objectSpread({}, item), {}, {
75
+ _extend: _objectSpread(_objectSpread({}, item._extend || {}), {}, {
76
+ holder_id: 0
77
+ })
78
+ });
79
+ }
80
+ return item;
81
+ });
82
+
83
+ // 预约商品不能放在open items中, 所以过滤掉 holder_id为0 并且是预约商品的数据
84
+ _service = _service.filter(function (item) {
85
+ var _item$_extend;
86
+ return !((item === null || item === void 0 ? void 0 : (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.holder_id) === 0 && appointmentTypes.includes(item.extension_type));
87
+ });
88
+ } else {
89
+ // 将商品数据清空
90
+ _service = _service.filter(function (item) {
91
+ return !ids.includes(item._extend.holder_id);
92
+ });
93
+ }
79
94
  }
80
95
 
81
96
  // 更新服务商品列表