@pisell/private-materials 3.0.152-gray → 3.0.152

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 (186) 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 -12
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/components/booking/addons/model.d.ts +1 -2
  12. package/es/components/booking/components/footer/index.js +51 -36
  13. package/es/components/booking/components/footer/utils.js +35 -4
  14. package/es/components/booking/forms/forms.d.ts +0 -1
  15. package/es/components/booking/forms/forms.js +2 -4
  16. package/es/components/booking/forms/model.d.ts +1 -2
  17. package/es/components/booking/forms/single/index.d.ts +1 -1
  18. package/es/components/booking/forms/single/index.js +3 -4
  19. package/es/components/booking/index.js +1 -1
  20. package/es/components/booking/info/index.d.ts +4 -12
  21. package/es/components/booking/info/index.js +12 -123
  22. package/es/components/booking/info/index.less +0 -9
  23. package/es/components/booking/info/main.d.ts +12 -0
  24. package/es/components/booking/info/main.js +124 -0
  25. package/es/components/booking/info/model.js +0 -1
  26. package/es/components/booking/info/pet/index.js +1 -1
  27. package/es/components/booking/info/service/addService/index.d.ts +2 -8
  28. package/es/components/booking/info/service/addService/index.js +36 -82
  29. package/es/components/booking/info/service/addService/index.less +1 -27
  30. package/es/components/booking/info/service/addTimeModal/index.js +4 -4
  31. package/es/components/booking/info/service/editService/index.js +13 -11
  32. package/es/components/booking/info/utils.d.ts +1 -0
  33. package/es/components/booking/info/utils.js +7 -0
  34. package/es/components/booking/info2/index.d.ts +12 -0
  35. package/es/components/booking/{dashboard → info2}/index.js +196 -222
  36. package/es/components/booking/info2/serve.d.ts +6 -0
  37. package/es/components/booking/info2/serve.js +79 -0
  38. package/es/components/booking/info2/service/actions/index.d.ts +6 -0
  39. package/es/components/booking/info2/service/actions/index.js +86 -0
  40. package/es/components/booking/info2/service/addService/index.d.ts +6 -0
  41. package/es/components/booking/info2/service/addService/index.js +404 -0
  42. package/es/components/booking/info2/service/addService/mock.d.ts +214 -0
  43. package/es/components/booking/info2/service/addService/mock.js +332 -0
  44. package/es/components/booking/info2/service/addService/utils.d.ts +71 -0
  45. package/es/components/booking/info2/service/addService/utils.js +510 -0
  46. package/es/components/booking/info2/service/addTimeModal/index.d.ts +4 -0
  47. package/es/components/booking/info2/service/addTimeModal/index.js +681 -0
  48. package/es/components/booking/info2/service/addTimeModal/serve.d.ts +9 -0
  49. package/es/components/booking/{dashboard → info2/service/addTimeModal}/serve.js +51 -5
  50. package/es/components/booking/info2/service/addTimeModal/utils.d.ts +31 -0
  51. package/es/components/booking/info2/service/addTimeModal/utils.js +176 -0
  52. package/es/components/booking/info2/service/editService/Capacity/index.d.ts +4 -0
  53. package/es/components/booking/info2/service/editService/Capacity/index.js +121 -0
  54. package/es/components/booking/info2/service/editService/Capacity/index.less +1 -0
  55. package/es/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.d.ts +7 -0
  56. package/es/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.js +28 -0
  57. package/es/components/booking/info2/service/editService/Resources/index.d.ts +4 -0
  58. package/es/components/booking/info2/service/editService/Resources/index.js +233 -0
  59. package/es/components/booking/info2/service/editService/Resources/index.less +21 -0
  60. package/es/components/booking/info2/service/editService/index.d.ts +7 -0
  61. package/es/components/booking/info2/service/editService/index.js +617 -0
  62. package/es/components/booking/info2/service/editService/index.less +99 -0
  63. package/es/components/booking/info2/service/editService/utils.d.ts +11 -0
  64. package/es/components/booking/{info/addServiceVariant/index.js → info2/service/editService/utils.js} +30 -26
  65. package/es/components/booking/info2/service/index.d.ts +4 -0
  66. package/es/components/booking/info2/service/index.js +55 -0
  67. package/es/components/booking/info2/service/serviceItem/index.d.ts +4 -0
  68. package/es/components/booking/info2/service/serviceItem/index.js +176 -0
  69. package/es/components/booking/info2/service/serviceItem/index.less +125 -0
  70. package/es/components/booking/info2/service/serviceList/index.d.ts +6 -0
  71. package/es/components/booking/info2/service/serviceList/index.js +106 -0
  72. package/es/components/booking/info2/service/serviceList/index.less +0 -0
  73. package/es/components/booking/info2/utilsByBooking.d.ts +34 -0
  74. package/es/components/booking/info2/utilsByBooking.js +349 -0
  75. package/es/components/booking/locales.d.ts +3 -48
  76. package/es/components/booking/locales.js +9 -48
  77. package/es/components/booking/materiels/resources/index.d.ts +2 -2
  78. package/es/components/booking/materiels/resources/index.js +11 -11
  79. package/es/components/booking/mock.d.ts +1 -0
  80. package/es/components/booking/mock.js +66 -0
  81. package/es/components/booking/model.d.ts +0 -2
  82. package/es/components/booking/notes/index.d.ts +1 -1
  83. package/es/components/booking/notes/model.d.ts +1 -2
  84. package/es/components/booking/payments/model.d.ts +1 -2
  85. package/es/components/booking/utils.d.ts +1 -1
  86. package/es/components/booking/utils.js +51 -54
  87. package/es/components/index.d.ts +1 -1
  88. package/es/components/index.js +1 -1
  89. package/es/components/schedules/index.d.ts +1 -1
  90. package/es/components/schedules/model.d.ts +1 -2
  91. package/es/index.d.ts +1 -3
  92. package/es/index.js +2 -4
  93. package/lib/components/booking/addons/model.d.ts +1 -2
  94. package/lib/components/booking/components/footer/index.js +31 -8
  95. package/lib/components/booking/components/footer/utils.js +29 -4
  96. package/lib/components/booking/forms/forms.d.ts +0 -1
  97. package/lib/components/booking/forms/forms.js +2 -5
  98. package/lib/components/booking/forms/model.d.ts +1 -2
  99. package/lib/components/booking/forms/single/index.d.ts +1 -1
  100. package/lib/components/booking/forms/single/index.js +2 -4
  101. package/lib/components/booking/index.js +2 -2
  102. package/lib/components/booking/info/client/index.js +8 -1
  103. package/lib/components/booking/info/index.d.ts +4 -12
  104. package/lib/components/booking/info/index.js +14 -118
  105. package/lib/components/booking/info/index.less +0 -9
  106. package/lib/components/booking/info/main.d.ts +12 -0
  107. package/lib/components/booking/info/main.js +152 -0
  108. package/lib/components/booking/info/pet/index.js +1 -2
  109. package/lib/components/booking/info/service/addService/index.d.ts +2 -8
  110. package/lib/components/booking/info/service/addService/index.js +29 -66
  111. package/lib/components/booking/info/service/addService/index.less +1 -27
  112. package/lib/components/booking/info/service/addTimeModal/index.js +1 -0
  113. package/lib/components/booking/info/service/editService/index.js +6 -9
  114. package/lib/components/booking/info/utils.d.ts +1 -0
  115. package/lib/components/booking/info/utils.js +9 -0
  116. package/lib/components/booking/info2/index.d.ts +12 -0
  117. package/lib/components/booking/info2/index.js +202 -0
  118. package/lib/components/booking/info2/serve.d.ts +6 -0
  119. package/lib/components/booking/{dashboard → info2}/serve.js +25 -5
  120. package/lib/components/booking/info2/service/actions/index.d.ts +6 -0
  121. package/lib/components/booking/info2/service/actions/index.js +102 -0
  122. package/lib/components/booking/info2/service/addService/index.d.ts +6 -0
  123. package/lib/components/booking/info2/service/addService/index.js +356 -0
  124. package/lib/components/booking/info2/service/addService/mock.d.ts +214 -0
  125. package/lib/components/booking/info2/service/addService/mock.js +398 -0
  126. package/lib/components/booking/info2/service/addService/utils.d.ts +71 -0
  127. package/lib/components/booking/info2/service/addService/utils.js +377 -0
  128. package/lib/components/booking/info2/service/addTimeModal/index.d.ts +4 -0
  129. package/lib/components/booking/info2/service/addTimeModal/index.js +558 -0
  130. package/lib/components/booking/info2/service/addTimeModal/serve.d.ts +9 -0
  131. package/lib/components/booking/info2/service/addTimeModal/serve.js +45 -0
  132. package/lib/components/booking/info2/service/addTimeModal/utils.d.ts +31 -0
  133. package/lib/components/booking/info2/service/addTimeModal/utils.js +157 -0
  134. package/lib/components/booking/info2/service/editService/Capacity/index.d.ts +4 -0
  135. package/lib/components/booking/info2/service/editService/Capacity/index.js +97 -0
  136. package/lib/components/booking/info2/service/editService/Capacity/index.less +1 -0
  137. package/lib/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.d.ts +7 -0
  138. package/lib/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.js +54 -0
  139. package/lib/components/booking/info2/service/editService/Resources/index.d.ts +4 -0
  140. package/lib/components/booking/info2/service/editService/Resources/index.js +212 -0
  141. package/lib/components/booking/info2/service/editService/Resources/index.less +21 -0
  142. package/lib/components/booking/info2/service/editService/index.d.ts +7 -0
  143. package/lib/components/booking/info2/service/editService/index.js +483 -0
  144. package/lib/components/booking/info2/service/editService/index.less +99 -0
  145. package/lib/components/booking/info2/service/editService/utils.d.ts +11 -0
  146. package/lib/components/booking/info2/service/editService/utils.js +0 -0
  147. package/lib/components/booking/info2/service/index.d.ts +4 -0
  148. package/lib/components/booking/info2/service/index.js +75 -0
  149. package/lib/components/booking/info2/service/serviceItem/index.d.ts +4 -0
  150. package/lib/components/booking/info2/service/serviceItem/index.js +184 -0
  151. package/lib/components/booking/info2/service/serviceItem/index.less +125 -0
  152. package/lib/components/booking/info2/service/serviceList/index.d.ts +6 -0
  153. package/lib/components/booking/info2/service/serviceList/index.js +130 -0
  154. package/lib/components/booking/info2/service/serviceList/index.less +0 -0
  155. package/lib/components/booking/info2/utilsByBooking.d.ts +34 -0
  156. package/lib/components/booking/info2/utilsByBooking.js +257 -0
  157. package/lib/components/booking/locales.d.ts +3 -48
  158. package/lib/components/booking/locales.js +3 -48
  159. package/lib/components/booking/materiels/resources/index.d.ts +2 -2
  160. package/lib/components/booking/mock.d.ts +1 -0
  161. package/lib/components/booking/mock.js +67 -2
  162. package/lib/components/booking/model.d.ts +0 -2
  163. package/lib/components/booking/notes/index.d.ts +1 -1
  164. package/lib/components/booking/notes/model.d.ts +1 -2
  165. package/lib/components/booking/payments/model.d.ts +1 -2
  166. package/lib/components/booking/utils.d.ts +1 -1
  167. package/lib/components/booking/utils.js +22 -57
  168. package/lib/components/eftposPay/tyro/index.js +3 -1
  169. package/lib/components/index.d.ts +1 -1
  170. package/lib/components/index.js +1 -1
  171. package/lib/components/schedules/index.d.ts +1 -1
  172. package/lib/components/schedules/model.d.ts +1 -2
  173. package/lib/index.d.ts +1 -3
  174. package/lib/index.js +1 -7
  175. package/package.json +2 -2
  176. package/es/components/booking/dashboard/index.d.ts +0 -10
  177. package/es/components/booking/dashboard/serve.d.ts +0 -1
  178. package/es/components/booking/info/addServiceVariant/index.d.ts +0 -7
  179. package/lib/components/booking/dashboard/index.d.ts +0 -10
  180. package/lib/components/booking/dashboard/index.js +0 -225
  181. package/lib/components/booking/dashboard/serve.d.ts +0 -1
  182. package/lib/components/booking/info/addServiceVariant/index.d.ts +0 -7
  183. package/lib/components/booking/info/addServiceVariant/index.js +0 -58
  184. package/lowcode/booking-dashboard/meta.ts +0 -130
  185. package/lowcode/booking-vertical-add-service/meta.ts +0 -124
  186. package/lowcode/vertical-add-service/meta.ts +0 -71
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -31,7 +31,8 @@ import "./index.less";
31
31
  import useEngineContext from "../../../../hooks/useEngineContext";
32
32
  import { DownOutlined } from '@ant-design/icons';
33
33
  import { eventBookingCheck } from "./serve";
34
-
34
+ import { createBookings, editBookings } from "../../info2/serve";
35
+ import { isBooking4Shop } from "../../info/utils";
35
36
  /**
36
37
  * @title: 底部
37
38
  * @description:
@@ -238,7 +239,7 @@ var Footer = function Footer(props) {
238
239
  key: 'booking_checkout',
239
240
  data: {
240
241
  order_id: order_id,
241
- callbackType: "pisell2"
242
+ callbackType: 'pisell2'
242
243
  }
243
244
  }));
244
245
  case 2:
@@ -339,6 +340,19 @@ var Footer = function Footer(props) {
339
340
  return _ref3.apply(this, arguments);
340
341
  };
341
342
  }();
343
+ var getApis = function getApis() {
344
+ var _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6;
345
+ if (isBooking4Shop((_context$appHelper$ut2 = context.appHelper.utils.store) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.getState) === null || _context$appHelper$ut3 === void 0 ? void 0 : (_context$appHelper$ut4 = _context$appHelper$ut3.call(_context$appHelper$ut2)) === null || _context$appHelper$ut4 === void 0 ? void 0 : (_context$appHelper$ut5 = _context$appHelper$ut4.global) === null || _context$appHelper$ut5 === void 0 ? void 0 : (_context$appHelper$ut6 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut6 === void 0 ? void 0 : _context$appHelper$ut6.id, state.renderType)) {
346
+ return {
347
+ editBooking: editBookings,
348
+ createBooking: createBookings
349
+ };
350
+ }
351
+ return {
352
+ editBooking: state.apis.editBooking,
353
+ createBooking: state.apis.createBooking
354
+ };
355
+ };
342
356
 
343
357
  /**
344
358
  * @title: 保存info
@@ -350,7 +364,7 @@ var Footer = function Footer(props) {
350
364
  */
351
365
  var handleSave = /*#__PURE__*/function () {
352
366
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref4) {
353
- var type, _ref4$messageShow, messageShow, _setLoading, editApi, createApi, saveOtherValue, _state$onSave, callbackData, values, api, _yield$eventBookingCh, data, confirmed;
367
+ var type, _ref4$messageShow, messageShow, _setLoading, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, callbackData, values, api, _yield$eventBookingCh, data, confirmed;
354
368
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
355
369
  while (1) switch (_context4.prev = _context4.next) {
356
370
  case 0:
@@ -358,43 +372,44 @@ var Footer = function Footer(props) {
358
372
  // 区分loading, 是点击的checkout 还是save
359
373
  _setLoading = type === 'checkout' ? setCheckoutLoading : setLoading;
360
374
  _setLoading(true);
361
- editApi = state.renderType === 'eventBooking' ? state.apis.editEventBooking : state.apis.editBooking;
362
- createApi = state.renderType === 'eventBooking' ? state.apis.createEventBooking : state.apis.createBooking;
375
+ _getApis = getApis(), createBooking = _getApis.createBooking, editBooking = _getApis.editBooking;
376
+ editApi = state.renderType === 'eventBooking' ? state.apis.editEventBooking : editBooking;
377
+ createApi = state.renderType === 'eventBooking' ? state.apis.createEventBooking : createBooking;
363
378
  saveOtherValue = {};
364
379
  if (!(type === 'save')) {
365
- _context4.next = 13;
380
+ _context4.next = 14;
366
381
  break;
367
382
  }
368
- _context4.next = 9;
383
+ _context4.next = 10;
369
384
  return state === null || state === void 0 ? void 0 : (_state$onSave = state.onSave) === null || _state$onSave === void 0 ? void 0 : _state$onSave.call(state, state.client);
370
- case 9:
385
+ case 10:
371
386
  _context4.t0 = _context4.sent;
372
387
  if (_context4.t0) {
373
- _context4.next = 12;
388
+ _context4.next = 13;
374
389
  break;
375
390
  }
376
391
  _context4.t0 = {};
377
- case 12:
378
- saveOtherValue = _context4.t0;
379
392
  case 13:
380
- _context4.prev = 13;
393
+ saveOtherValue = _context4.t0;
394
+ case 14:
395
+ _context4.prev = 14;
381
396
  callbackData = null; // 格式化提交的参数
382
397
  values = formatValues(_objectSpread(_objectSpread({}, state), saveOtherValue)); // 区分是新增还是编辑
383
398
  api = state.bookingId ? editApi : createApi; // 活动预约新建时校验重复
384
399
  if (!(!state.bookingId && state.renderType === 'eventBooking')) {
385
- _context4.next = 29;
400
+ _context4.next = 30;
386
401
  break;
387
402
  }
388
- _context4.next = 20;
403
+ _context4.next = 21;
389
404
  return eventBookingCheck(values);
390
- case 20:
405
+ case 21:
391
406
  _yield$eventBookingCh = _context4.sent;
392
407
  data = _yield$eventBookingCh.data;
393
408
  if (!data.list.length) {
394
- _context4.next = 29;
409
+ _context4.next = 30;
395
410
  break;
396
411
  }
397
- _context4.next = 25;
412
+ _context4.next = 26;
398
413
  return modal.confirm({
399
414
  icon: null,
400
415
  title: locales.getText('page.event.booking.text.duplicate-enrollment'),
@@ -406,53 +421,53 @@ var Footer = function Footer(props) {
406
421
  width: 480,
407
422
  okText: locales.getText('page.event.booking.text.duplicate-enrollment-confirm')
408
423
  });
409
- case 25:
424
+ case 26:
410
425
  confirmed = _context4.sent;
411
426
  if (confirmed) {
412
- _context4.next = 29;
427
+ _context4.next = 30;
413
428
  break;
414
429
  }
415
430
  _setLoading(false);
416
431
  return _context4.abrupt("return");
417
- case 29:
432
+ case 30:
418
433
  if (!addonsEdit) {
419
- _context4.next = 32;
434
+ _context4.next = 33;
420
435
  break;
421
436
  }
422
- _context4.next = 32;
437
+ _context4.next = 33;
423
438
  return handleSaveAddons();
424
- case 32:
439
+ case 33:
425
440
  if (!infoEdit) {
426
- _context4.next = 37;
441
+ _context4.next = 38;
427
442
  break;
428
443
  }
429
- _context4.next = 35;
430
- return api(values);
431
- case 35:
444
+ _context4.next = 36;
445
+ return api(values, state.bookingId);
446
+ case 36:
432
447
  callbackData = _context4.sent;
433
448
  if (messageShow) {
434
449
  message.success(locales.getText(state.bookingId ? 'pisell2.text.appointment-updated' : 'pisell2.text.created-successfully'));
435
450
  }
436
- case 37:
451
+ case 38:
437
452
  // 回调关闭弹窗
438
453
  state === null || state === void 0 ? void 0 : state.callback(callbackData);
439
454
  _setLoading(false);
440
455
 
441
456
  // return数据 checkout时需要
442
457
  return _context4.abrupt("return", callbackData || values);
443
- case 42:
444
- _context4.prev = 42;
445
- _context4.t1 = _context4["catch"](13);
458
+ case 43:
459
+ _context4.prev = 43;
460
+ _context4.t1 = _context4["catch"](14);
446
461
  console.log(_context4.t1);
447
462
  if ((_context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.code) === 70101) {
448
463
  message.error(_context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.message);
449
464
  }
450
465
  _setLoading(false);
451
- case 47:
466
+ case 48:
452
467
  case "end":
453
468
  return _context4.stop();
454
469
  }
455
- }, _callee4, null, [[13, 42]]);
470
+ }, _callee4, null, [[14, 43]]);
456
471
  }));
457
472
  return function handleSave(_x3) {
458
473
  return _ref5.apply(this, arguments);
@@ -891,7 +906,7 @@ var Footer = function Footer(props) {
891
906
  }
892
907
  if (transaction_habit_selection.button_rows == 1) {
893
908
  if (state.appointment_status !== 'cancelled') {
894
- if (!state.disabledEdit && !state.isBookingCreatePage) {
909
+ if (!state.disabledEdit) {
895
910
  arr.push(actionMap.sale);
896
911
  }
897
912
  }
@@ -1032,7 +1047,7 @@ var Footer = function Footer(props) {
1032
1047
  if (!state.bookingDetail) {
1033
1048
  return true;
1034
1049
  }
1035
- if (!((_state$addons3 = state.addons) !== null && _state$addons3 !== void 0 && _state$addons3.load) && state.renderType !== 'eventBooking' && !state.isBookingCreatePage) {
1050
+ if (!((_state$addons3 = state.addons) !== null && _state$addons3 !== void 0 && _state$addons3.load) && state.renderType !== 'eventBooking') {
1036
1051
  return true;
1037
1052
  }
1038
1053
  }
@@ -1182,7 +1197,7 @@ var Footer = function Footer(props) {
1182
1197
  style: {
1183
1198
  marginTop: 12
1184
1199
  }
1185
- }, state.appointment_status !== 'cancelled' && !state.isBookingCreatePage ? /*#__PURE__*/React.createElement(Button, {
1200
+ }, state.appointment_status !== 'cancelled' ? /*#__PURE__*/React.createElement(Button, {
1186
1201
  onClick: function onClick() {
1187
1202
  return handleSale();
1188
1203
  },
@@ -6,6 +6,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
6
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
7
  import { flexibleObj, isNowTime, getNowTime } from "../../utils";
8
8
  import { isWalkIn } from "../../utils";
9
+ import { getSumCapacity } from "../../info2/utilsByBooking";
9
10
  var formatNote = function formatNote(data) {
10
11
  var _data$notes;
11
12
  return ((_data$notes = data.notes) === null || _data$notes === void 0 ? void 0 : _data$notes.orderNote) || "";
@@ -91,6 +92,30 @@ var formatRelationDetails = function formatRelationDetails(list) {
91
92
  };
92
93
  });
93
94
  };
95
+ var formatResource = function formatResource(service) {
96
+ if (!service._extend.resource) {
97
+ return undefined;
98
+ }
99
+ try {
100
+ return Object.values(service._extend.resource).reduce(function (pre, cur) {
101
+ pre = pre.concat(cur.map(function (d) {
102
+ return {
103
+ form_id: d.form_id,
104
+ relation_type: d.relation_type || 'form',
105
+ relation_id: d.relation_id || 0,
106
+ capacity: getSumCapacity({
107
+ cacheItem: service
108
+ }),
109
+ like_status: d.like_status,
110
+ metadata: d.metadata
111
+ };
112
+ }));
113
+ return pre;
114
+ }, []);
115
+ } catch (err) {
116
+ return undefined;
117
+ }
118
+ };
94
119
 
95
120
  /**
96
121
  * @title: 预约商品信息
@@ -135,11 +160,11 @@ var formatBookings = function formatBookings(data) {
135
160
  },
136
161
  "relation_products": formatRelationDetails(item._extend.relation_details),
137
162
  'id': item.booking_id || 0,
138
- "relation_id": item._extend.relation_id,
163
+ "relation_id": item._extend.relation_id || 0,
139
164
  "like_status": item._extend.like_status || 'common',
140
- "relation_type": item._extend.relation_type,
165
+ "relation_type": item._extend.relation_type || '',
141
166
  "is_all": false,
142
- "schedule_id": item._extend.schedule_id,
167
+ "schedule_id": item._extend.schedule_id || 0,
143
168
  "end_time": end_time,
144
169
  "sub_type": getSubType(item),
145
170
  "select_date": start_date,
@@ -147,7 +172,13 @@ var formatBookings = function formatBookings(data) {
147
172
  "end_date": end_date,
148
173
  "start_date": start_date,
149
174
  "duration": flexibleObj.getValue(item._extend.duration),
150
- "number": item._extend.number || 1
175
+ "number": item._extend.capacity ? getSumCapacity({
176
+ cacheItem: item
177
+ }) : 1,
178
+ "resources": formatResource(item),
179
+ "metadata": item._extend.capacity ? {
180
+ capacity: item._extend.capacity
181
+ } : undefined
151
182
  }, eventOtherParams || {});
152
183
  });
153
184
  return bookings;
@@ -12,7 +12,6 @@ export interface InfoProps {
12
12
  client: any;
13
13
  loading?: boolean;
14
14
  addButtonProps?: any;
15
- drawerProps?: any;
16
15
  }
17
16
  /**
18
17
  * @title: 表单模块
@@ -43,8 +43,7 @@ var Forms = Provider(function (props) {
43
43
  addCallback = props.addCallback,
44
44
  client = props.client,
45
45
  loading = props.loading,
46
- addButtonProps = props.addButtonProps,
47
- drawerProps = props.drawerProps;
46
+ addButtonProps = props.addButtonProps;
48
47
 
49
48
  // 新增数据
50
49
  var onAction = useMemoizedFn( /*#__PURE__*/function () {
@@ -172,7 +171,6 @@ var Forms = Provider(function (props) {
172
171
  onChange: function onChange(val) {
173
172
  onValueChange(d, val);
174
173
  },
175
- drawerProps: drawerProps,
176
174
  onAdd: function onAdd() {
177
175
  onAction(d, true);
178
176
  },
@@ -196,6 +194,6 @@ var Forms = Provider(function (props) {
196
194
  optionRender: optionRender
197
195
  })));
198
196
  }));
199
- }, [forms, hideTitle, modalOpen, value, loading, client === null || client === void 0 ? void 0 : client.id, addButtonProps, customSelectProps, optionRender, drawerProps]);
197
+ }, [forms, hideTitle, modalOpen, value, loading, client === null || client === void 0 ? void 0 : client.id, addButtonProps, customSelectProps, optionRender]);
200
198
  });
201
199
  export default Forms;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -7,5 +7,5 @@ import "./index.less";
7
7
  * @Author: zhiwei.Wang
8
8
  * @Date: 2024-01-30 17:06
9
9
  */
10
- declare const Single: ({ value, onChange, form, mode, optionRender, loading, customSelectProps, onAdd, addButtonProps, modalOpen, watch, drawerProps, }: any) => React.JSX.Element;
10
+ declare const Single: ({ value, onChange, form, mode, optionRender, loading, customSelectProps, onAdd, addButtonProps, modalOpen, watch, }: any) => React.JSX.Element;
11
11
  export default Single;
@@ -41,8 +41,7 @@ var Single = function Single(_ref) {
41
41
  onAdd = _ref.onAdd,
42
42
  addButtonProps = _ref.addButtonProps,
43
43
  modalOpen = _ref.modalOpen,
44
- watch = _ref.watch,
45
- drawerProps = _ref.drawerProps;
44
+ watch = _ref.watch;
46
45
  // const primaryField = useMemo(() => {
47
46
  // return field.field[0]?.key || "";
48
47
  // }, [field]);
@@ -235,10 +234,10 @@ var Single = function Single(_ref) {
235
234
  },
236
235
  name: ((_form$form3 = form.form) === null || _form$form3 === void 0 ? void 0 : _form$form3.title) || "-",
237
236
  addButtonProps: _addButtonProps,
238
- drawerProps: _objectSpread({
237
+ drawerProps: {
239
238
  title: "".concat(locales.getText("pisell2.text.select"), " ").concat(((_form$form4 = form.form) === null || _form$form4 === void 0 ? void 0 : _form$form4.title) || "-"),
240
239
  destroyOnClose: true
241
- }, drawerProps || {}),
240
+ },
242
241
  optionRender: _optionRender,
243
242
  rowKey: "form_record_id"
244
243
  }, customSelectProps || {})));
@@ -6,7 +6,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
6
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
7
  import React, { useEffect, useContext } from 'react';
8
8
  import { Provider, Context } from "./model";
9
- import Info from "./info";
9
+ import Info from "./info/main";
10
10
  import Notes from "./notes";
11
11
  import Addons from "./addons";
12
12
  import Forms from "./forms";
@@ -1,12 +1,4 @@
1
- import "./index.less";
2
- export interface InfoProps {
3
- style: any;
4
- globalState: any;
5
- callback: any;
6
- setGlobalState: any;
7
- modules: any;
8
- slot: any;
9
- setState: any;
10
- }
11
- declare const Info: any;
12
- export default Info;
1
+ import React from 'react';
2
+ import { InfoProps } from './main';
3
+ declare const APP: (props: InfoProps) => React.JSX.Element;
4
+ export default APP;
@@ -1,125 +1,14 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
- import React, { useContext, useEffect, useMemo } from "react";
8
- import { Provider, Context } from "./model";
9
- import Client from "./client";
10
- import Service from "./service";
11
- import Pet from "./pet";
12
- import DateCom from "./date";
13
- import Footer from "../components/footer";
14
- import TabPane from "../components/tabPane";
15
- import AddNote from "../notes/addNote";
16
- import Header from "./header";
17
- import localeTexts from "../locales";
18
- import { locales } from "@pisell/utils";
19
- import { findNextDuration, flexibleObj, formatResource, getErrorList, sliceDayIntoFiveMinutes, request } from "../utils";
20
- import { updateServiceDate } from "./date";
1
+ import React from 'react';
2
+ import Info2 from "../info2";
3
+ import Info1 from "./main";
21
4
  import useEngineContext from "../../../hooks/useEngineContext";
22
- import Notes from "./notes";
23
- import "./index.less";
24
- import classNames from "classnames";
25
- var defaultModules = {
26
- client: 1,
27
- date: 1,
28
- service: 1,
29
- holder: 1,
30
- note: 1
31
- };
32
- locales.init(localeTexts, localStorage.getItem("umi_locale") || "en");
33
- var Info = Provider(function (props) {
34
- var _modal$state2, _modal$state2$booking, _modal$state2$booking2, _modal$state2$booking3, _modal$state4, _modal$state4$notes, _context$appHelper4, _context$appHelper4$u, _modal$state5, _React$createElement;
35
- // return <Payments {...props} />;
36
- var style = props.style,
37
- globalState = props.globalState,
38
- _props$modules = props.modules,
39
- modules = _props$modules === void 0 ? defaultModules : _props$modules,
40
- slot = props.slot;
41
- var modal = useContext(Context);
5
+ import { isBooking4Shop } from "./utils";
6
+ var APP = function APP(props) {
7
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _props$globalState;
42
8
  var context = useEngineContext();
43
- request.setRequest(context.appHelper.utils.request);
44
- var params = useMemo(function () {
45
- var _modal$state, _modal$state$bookingC, _modal$state$bookingC2, _modal$state$bookingC3;
46
- return ((_modal$state = modal.state) === null || _modal$state === void 0 ? void 0 : (_modal$state$bookingC = _modal$state.bookingConfig) === null || _modal$state$bookingC === void 0 ? void 0 : (_modal$state$bookingC2 = _modal$state$bookingC.config) === null || _modal$state$bookingC2 === void 0 ? void 0 : (_modal$state$bookingC3 = _modal$state$bookingC2.basic) === null || _modal$state$bookingC3 === void 0 ? void 0 : _modal$state$bookingC3.appointment_subject) || {};
47
- }, [(_modal$state2 = modal.state) === null || _modal$state2 === void 0 ? void 0 : (_modal$state2$booking = _modal$state2.bookingConfig) === null || _modal$state2$booking === void 0 ? void 0 : (_modal$state2$booking2 = _modal$state2$booking.config) === null || _modal$state2$booking2 === void 0 ? void 0 : (_modal$state2$booking3 = _modal$state2$booking2.basic) === null || _modal$state2$booking3 === void 0 ? void 0 : _modal$state2$booking3.appointment_subject]);
48
- useEffect(function () {
49
- document.body.id = "body";
50
- // 注入函数到页面的state内
51
- if (props.setState) {
52
- props.setState({
53
- bookingFunctions: {
54
- formatResource: formatResource,
55
- getErrorList: getErrorList,
56
- sliceDayIntoFiveMinutes: sliceDayIntoFiveMinutes,
57
- findNextDuration: findNextDuration,
58
- flexibleObj: flexibleObj,
59
- updateServiceDate: updateServiceDate
60
- }
61
- });
62
- }
63
- }, []);
64
- useEffect(function () {
65
- var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper2, _context$appHelper2$u, _context$appHelper2$u2, _context$appHelper3, _context$appHelper3$u, _context$appHelper3$u2, _context$appHelper3$u3, _context$appHelper3$u4, _context$appHelper3$u5;
66
- var isFranchisee = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.businessUtils) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.getAppByModal) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2, "franchisee");
67
- modal.dispatch({
68
- type: "setState",
69
- payload: _objectSpread(_objectSpread({
70
- setGlobalState: props.setGlobalState
71
- }, globalState), {}, {
72
- 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),
73
- isFranchisee: isFranchisee,
74
- 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
75
- })
76
- });
77
- }, [JSON.stringify(globalState)]);
78
- var addNote = function addNote(e) {
79
- modal.dispatch({
80
- type: "setNotes",
81
- payload: {
82
- orderNote: e,
83
- edit: true
84
- }
85
- });
86
- };
87
- var header = useMemo(function () {
88
- if ((globalState === null || globalState === void 0 ? void 0 : globalState.renderType) === "eventBooking") {
89
- return locales.getText("pisell2.text.enroll.detail");
90
- }
91
- return globalState !== null && globalState !== void 0 && globalState.bookingId ? /*#__PURE__*/React.createElement(Header, {
92
- state: modal.state,
93
- dispatch: modal.dispatch
94
- }) : /*#__PURE__*/React.createElement("div", {
95
- className: "",
96
- style: {
97
- height: 0
98
- }
99
- });
100
- }, [globalState === null || globalState === void 0 ? void 0 : globalState.bookingId, modal.state, modal.dispatch, globalState === null || globalState === void 0 ? void 0 : globalState.renderType]);
101
- var notes = useMemo(function () {
102
- var _modal$state3, _modal$state3$notes;
103
- if (!modules.note) {
104
- return null;
105
- }
106
- return globalState !== null && globalState !== void 0 && globalState.bookingId ? globalState.renderType === "eventBooking" ? /*#__PURE__*/React.createElement(Notes, null) : null : /*#__PURE__*/React.createElement(AddNote, {
107
- value: (_modal$state3 = modal.state) === null || _modal$state3 === void 0 ? void 0 : (_modal$state3$notes = _modal$state3.notes) === null || _modal$state3$notes === void 0 ? void 0 : _modal$state3$notes.orderNote,
108
- onChange: addNote
109
- });
110
- }, [modules.note, globalState === null || globalState === void 0 ? void 0 : globalState.bookingId, globalState.render, (_modal$state4 = modal.state) === null || _modal$state4 === void 0 ? void 0 : (_modal$state4$notes = _modal$state4.notes) === null || _modal$state4$notes === void 0 ? void 0 : _modal$state4$notes.orderNote]);
111
- return /*#__PURE__*/React.createElement(React.Fragment, null, !!modal.state.setGlobalState ? /*#__PURE__*/React.createElement(TabPane, (_React$createElement = {
112
- style: style,
113
- header: header,
114
- footer: /*#__PURE__*/React.createElement(Footer, {
115
- state: modal.state,
116
- dispatch: modal.dispatch,
117
- source: "info"
118
- })
119
- }, _defineProperty(_React$createElement, "style", {
120
- 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"
121
- }), _defineProperty(_React$createElement, "bodyClassName", classNames('booking-info-warp', _defineProperty({}, 'create-booking-page-info-wrap', modal.state.isBookingCreatePage))), _React$createElement), /*#__PURE__*/React.createElement("div", {
122
- className: "booking-info"
123
- }, modules.client ? /*#__PURE__*/React.createElement(Client, null) : null, modules.holder && !((_modal$state5 = modal.state) !== null && _modal$state5 !== void 0 && _modal$state5.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, modules.service ? /*#__PURE__*/React.createElement(React.Fragment, null, modal.state.date.value ? /*#__PURE__*/React.createElement(Service, null) : null) : null, notes, slot ? slot : null)) : null);
124
- });
125
- export default Info;
9
+ if (isBooking4Shop((_context$appHelper$ut = context.appHelper.utils.store) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.getState) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut3 === void 0 ? void 0 : (_context$appHelper$ut4 = _context$appHelper$ut3.global) === null || _context$appHelper$ut4 === void 0 ? void 0 : (_context$appHelper$ut5 = _context$appHelper$ut4.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id, props === null || props === void 0 ? void 0 : (_props$globalState = props.globalState) === null || _props$globalState === void 0 ? void 0 : _props$globalState.renderType)) {
10
+ return /*#__PURE__*/React.createElement(Info2, props);
11
+ }
12
+ return /*#__PURE__*/React.createElement(Info1, props);
13
+ };
14
+ export default APP;
@@ -15,13 +15,4 @@
15
15
  // height: 42px;
16
16
  // background: #069456;
17
17
  // }
18
- }
19
- #create-booking-page-info-wrap {
20
- .pisell-lowcode__booking-tab-pane-footer {
21
- padding: 12px 16px !important;
22
- }
23
- }
24
- .create-booking-page-info-wrap {
25
- position: initial !important;
26
- padding: 0 16px !important;
27
18
  }
@@ -0,0 +1,12 @@
1
+ import './index.less';
2
+ export interface InfoProps {
3
+ style: any;
4
+ globalState: any;
5
+ callback: any;
6
+ setGlobalState: any;
7
+ modules: any;
8
+ slot: any;
9
+ setState: any;
10
+ }
11
+ declare const Info: any;
12
+ export default Info;