@pisell/private-materials 3.0.199 → 3.0.201

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 (200) 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 +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  11. package/es/components/booking/addons/model.d.ts +1 -1
  12. package/es/components/booking/components/customSelect/index.d.ts +1 -0
  13. package/es/components/booking/components/customSelect/index.js +6 -2
  14. package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
  15. package/es/components/booking/components/footer/AppointmentProductModal/index.js +38 -0
  16. package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
  17. package/es/components/booking/components/footer/amount.js +45 -22
  18. package/es/components/booking/components/footer/index.js +84 -40
  19. package/es/components/booking/components/footer/utils.js +243 -32
  20. package/es/components/booking/info/addServiceVariant/index.js +8 -1
  21. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
  22. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +14 -13
  23. package/es/components/booking/info/clientVariant/vertical/index.js +33 -4
  24. package/es/components/booking/info/dateRange/index.d.ts +5 -0
  25. package/es/components/booking/info/dateRange/index.js +98 -0
  26. package/es/components/booking/info/dateRange/index.less +21 -0
  27. package/es/components/booking/info/main.js +20 -8
  28. package/es/components/booking/info/model.js +3 -0
  29. package/es/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
  30. package/es/components/booking/info/pet/ChangePetModal/index.js +119 -0
  31. package/es/components/booking/info/pet/ChangePetModal/index.less +4 -0
  32. package/es/components/booking/info/pet/index.js +54 -5
  33. package/es/components/booking/info/service/addService/index.js +142 -22
  34. package/es/components/booking/info/service/addService/index.less +13 -3
  35. package/es/components/booking/info/service/addService/utils.d.ts +11 -2
  36. package/es/components/booking/info/service/addService/utils.js +49 -24
  37. package/es/components/booking/info/service/editService/index.js +255 -44
  38. package/es/components/booking/info/service/editService/index.less +18 -13
  39. package/es/components/booking/info/service2/Lists.d.ts +3 -0
  40. package/es/components/booking/info/service2/Lists.js +158 -0
  41. package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
  42. package/es/components/booking/info/service2/hooks/useSelectPet.js +54 -0
  43. package/es/components/booking/info/service2/index.d.ts +3 -0
  44. package/es/components/booking/info/service2/index.js +58 -0
  45. package/es/components/booking/info/service2/status.d.ts +31 -0
  46. package/es/components/booking/info/service2/status.js +78 -0
  47. package/es/components/booking/info/service2/utils.d.ts +145 -0
  48. package/es/components/booking/info/service2/utils.js +438 -0
  49. package/es/components/booking/info/utils.d.ts +9 -0
  50. package/es/components/booking/info/utils.js +13 -0
  51. package/es/components/booking/locales.d.ts +60 -0
  52. package/es/components/booking/locales.js +75 -3
  53. package/es/components/booking/materiels/holder/index.d.ts +7 -0
  54. package/es/components/booking/materiels/holder/index.js +51 -0
  55. package/es/components/booking/model.d.ts +4 -1
  56. package/es/components/booking/model.js +4 -2
  57. package/es/components/booking/payments/index.d.ts +1 -1
  58. package/es/components/booking/utils.d.ts +12 -3
  59. package/es/components/booking/utils.js +139 -23
  60. package/es/components/eftpos/form/index.js +6 -12
  61. package/es/components/eftpos/group/index.d.ts +2 -1
  62. package/es/components/eftpos/group/index.js +2 -1
  63. package/es/components/eftpos/index.js +2 -2
  64. package/es/components/eftposPay/helper.d.ts +0 -1
  65. package/es/components/eftposPay/helper.js +0 -14
  66. package/es/components/eftposPay/tyro/index.js +20 -51
  67. package/es/components/shoppingCart/Provider.d.ts +3 -0
  68. package/es/components/shoppingCart/Provider.js +86 -0
  69. package/es/components/shoppingCart/components/Cart/Product.d.ts +4 -0
  70. package/es/components/shoppingCart/components/Cart/Product.js +96 -0
  71. package/es/components/shoppingCart/components/Cart/index.d.ts +4 -0
  72. package/es/components/shoppingCart/components/Cart/index.js +72 -0
  73. package/es/components/shoppingCart/components/Cart/index.less +68 -0
  74. package/es/components/shoppingCart/components/Empty/index.d.ts +4 -0
  75. package/es/components/shoppingCart/components/Empty/index.js +14 -0
  76. package/es/components/shoppingCart/components/Empty/index.less +19 -0
  77. package/es/components/shoppingCart/components/Render/index.d.ts +4 -0
  78. package/es/components/shoppingCart/components/Render/index.js +68 -0
  79. package/es/components/shoppingCart/components/Render/index.less +2 -0
  80. package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
  81. package/es/components/shoppingCart/components/SelectHolderModal/index.js +124 -0
  82. package/es/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
  83. package/es/components/shoppingCart/hooks/useAddService.d.ts +3 -0
  84. package/es/components/shoppingCart/hooks/useAddService.js +23 -0
  85. package/es/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
  86. package/es/components/shoppingCart/hooks/useClearCart.js +54 -0
  87. package/es/components/shoppingCart/hooks/useContext.d.ts +1 -0
  88. package/es/components/shoppingCart/hooks/useContext.js +5 -0
  89. package/es/components/shoppingCart/index.d.ts +4 -0
  90. package/es/components/shoppingCart/index.js +24 -0
  91. package/es/components/shoppingCart/locales.d.ts +33 -0
  92. package/es/components/shoppingCart/locales.js +38 -0
  93. package/es/components/shoppingCart/mock.d.ts +40 -0
  94. package/es/components/shoppingCart/mock.js +40 -0
  95. package/es/components/shoppingCart/status.d.ts +2 -0
  96. package/es/components/shoppingCart/status.js +22 -0
  97. package/es/components/shoppingCart/type.d.ts +39 -0
  98. package/es/components/shoppingCart/type.js +1 -0
  99. package/es/components/shoppingCart/utils.d.ts +63 -0
  100. package/es/components/shoppingCart/utils.js +119 -0
  101. package/es/index.d.ts +1 -0
  102. package/es/index.js +2 -1
  103. package/lib/components/booking/addons/model.d.ts +1 -1
  104. package/lib/components/booking/components/customSelect/index.d.ts +1 -0
  105. package/lib/components/booking/components/customSelect/index.js +6 -2
  106. package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
  107. package/lib/components/booking/components/footer/AppointmentProductModal/index.js +60 -0
  108. package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
  109. package/lib/components/booking/components/footer/amount.js +26 -8
  110. package/lib/components/booking/components/footer/index.js +25 -4
  111. package/lib/components/booking/components/footer/utils.js +157 -31
  112. package/lib/components/booking/info/addServiceVariant/index.js +5 -0
  113. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
  114. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +8 -7
  115. package/lib/components/booking/info/clientVariant/vertical/index.js +36 -10
  116. package/lib/components/booking/info/dateRange/index.d.ts +5 -0
  117. package/lib/components/booking/info/dateRange/index.js +111 -0
  118. package/lib/components/booking/info/dateRange/index.less +21 -0
  119. package/lib/components/booking/info/main.js +11 -4
  120. package/lib/components/booking/info/model.js +3 -0
  121. package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
  122. package/lib/components/booking/info/pet/ChangePetModal/index.js +111 -0
  123. package/lib/components/booking/info/pet/ChangePetModal/index.less +4 -0
  124. package/lib/components/booking/info/pet/index.js +61 -25
  125. package/lib/components/booking/info/service/addService/index.js +107 -34
  126. package/lib/components/booking/info/service/addService/index.less +13 -3
  127. package/lib/components/booking/info/service/addService/utils.d.ts +11 -2
  128. package/lib/components/booking/info/service/addService/utils.js +31 -10
  129. package/lib/components/booking/info/service/editService/index.js +293 -125
  130. package/lib/components/booking/info/service/editService/index.less +18 -13
  131. package/lib/components/booking/info/service2/Lists.d.ts +3 -0
  132. package/lib/components/booking/info/service2/Lists.js +113 -0
  133. package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
  134. package/lib/components/booking/info/service2/hooks/useSelectPet.js +50 -0
  135. package/lib/components/booking/info/service2/index.d.ts +3 -0
  136. package/lib/components/booking/info/service2/index.js +75 -0
  137. package/lib/components/booking/info/service2/status.d.ts +31 -0
  138. package/lib/components/booking/info/service2/status.js +81 -0
  139. package/lib/components/booking/info/service2/utils.d.ts +145 -0
  140. package/lib/components/booking/info/service2/utils.js +322 -0
  141. package/lib/components/booking/info/utils.d.ts +9 -0
  142. package/lib/components/booking/info/utils.js +6 -0
  143. package/lib/components/booking/locales.d.ts +60 -0
  144. package/lib/components/booking/locales.js +63 -3
  145. package/lib/components/booking/materiels/holder/index.d.ts +7 -0
  146. package/lib/components/booking/materiels/holder/index.js +65 -0
  147. package/lib/components/booking/model.d.ts +4 -1
  148. package/lib/components/booking/model.js +4 -2
  149. package/lib/components/booking/payments/index.d.ts +1 -1
  150. package/lib/components/booking/utils.d.ts +12 -3
  151. package/lib/components/booking/utils.js +87 -15
  152. package/lib/components/eftpos/form/index.js +6 -12
  153. package/lib/components/eftpos/group/index.d.ts +2 -1
  154. package/lib/components/eftpos/group/index.js +1 -0
  155. package/lib/components/eftpos/index.js +2 -2
  156. package/lib/components/eftposPay/helper.d.ts +0 -1
  157. package/lib/components/eftposPay/helper.js +0 -21
  158. package/lib/components/eftposPay/tyro/index.js +7 -36
  159. package/lib/components/shoppingCart/Provider.d.ts +3 -0
  160. package/lib/components/shoppingCart/Provider.js +110 -0
  161. package/lib/components/shoppingCart/components/Cart/Product.d.ts +4 -0
  162. package/lib/components/shoppingCart/components/Cart/Product.js +89 -0
  163. package/lib/components/shoppingCart/components/Cart/index.d.ts +4 -0
  164. package/lib/components/shoppingCart/components/Cart/index.js +77 -0
  165. package/lib/components/shoppingCart/components/Cart/index.less +68 -0
  166. package/lib/components/shoppingCart/components/Empty/index.d.ts +4 -0
  167. package/lib/components/shoppingCart/components/Empty/index.js +43 -0
  168. package/lib/components/shoppingCart/components/Empty/index.less +19 -0
  169. package/lib/components/shoppingCart/components/Render/index.d.ts +4 -0
  170. package/lib/components/shoppingCart/components/Render/index.js +79 -0
  171. package/lib/components/shoppingCart/components/Render/index.less +2 -0
  172. package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
  173. package/lib/components/shoppingCart/components/SelectHolderModal/index.js +116 -0
  174. package/lib/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
  175. package/lib/components/shoppingCart/hooks/useAddService.d.ts +3 -0
  176. package/lib/components/shoppingCart/hooks/useAddService.js +55 -0
  177. package/lib/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
  178. package/lib/components/shoppingCart/hooks/useClearCart.js +71 -0
  179. package/lib/components/shoppingCart/hooks/useContext.d.ts +1 -0
  180. package/lib/components/shoppingCart/hooks/useContext.js +31 -0
  181. package/lib/components/shoppingCart/index.d.ts +4 -0
  182. package/lib/components/shoppingCart/index.js +60 -0
  183. package/lib/components/shoppingCart/locales.d.ts +33 -0
  184. package/lib/components/shoppingCart/locales.js +56 -0
  185. package/lib/components/shoppingCart/mock.d.ts +40 -0
  186. package/lib/components/shoppingCart/mock.js +76 -0
  187. package/lib/components/shoppingCart/status.d.ts +2 -0
  188. package/lib/components/shoppingCart/status.js +60 -0
  189. package/lib/components/shoppingCart/type.d.ts +39 -0
  190. package/lib/components/shoppingCart/type.js +17 -0
  191. package/lib/components/shoppingCart/utils.d.ts +63 -0
  192. package/lib/components/shoppingCart/utils.js +92 -0
  193. package/lib/index.d.ts +1 -0
  194. package/lib/index.js +3 -0
  195. package/lowcode/shopping-cart/meta.ts +98 -0
  196. package/package.json +4 -4
  197. package/es/components/eftpos/receipt/index.d.ts +0 -24
  198. package/es/components/eftpos/receipt/index.js +0 -96
  199. package/lib/components/eftpos/receipt/index.d.ts +0 -24
  200. package/lib/components/eftpos/receipt/index.js +0 -88
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -32,6 +32,7 @@ interface CustomSelectProps {
32
32
  autoFocus?: boolean;
33
33
  showDropDown?: boolean;
34
34
  handleOpenModal?: () => void;
35
+ handleDayChange?: (value: any) => void;
35
36
  }
36
37
  declare const _default: React.ForwardRefExoticComponent<CustomSelectProps & React.RefAttributes<unknown>>;
37
38
  export default _default;
@@ -72,7 +72,8 @@ var CustomSelect = function CustomSelect(props, ref) {
72
72
  autoFocus = props.autoFocus,
73
73
  _props$showDropDown = props.showDropDown,
74
74
  showDropDown = _props$showDropDown === void 0 ? true : _props$showDropDown,
75
- propsHandleOpenModal = props.handleOpenModal;
75
+ propsHandleOpenModal = props.handleOpenModal,
76
+ handleDayChange = props.handleDayChange;
76
77
  var searchRef = useRef();
77
78
 
78
79
  // 当前选择的值
@@ -152,7 +153,7 @@ var CustomSelect = function CustomSelect(props, ref) {
152
153
  * @Author: zhiwei.Wang
153
154
  * @Date: 2024-01-30 16:45
154
155
  */
155
- var handleOpenModal = function handleOpenModal() {
156
+ var handleOpenModal = function handleOpenModal(item) {
156
157
  // 禁止则return
157
158
  if (disabled) {
158
159
  return;
@@ -241,6 +242,9 @@ var CustomSelect = function CustomSelect(props, ref) {
241
242
  * @Date: 2024-01-30 16:47
242
243
  */
243
244
  var handleRemoveItem = function handleRemoveItem(item) {
245
+ if (handleDayChange) {
246
+ handleDayChange(item);
247
+ }
244
248
  var _arr = changeArray(_value, item, rowKey);
245
249
  _onValueChange(_arr);
246
250
  set_value(_arr);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
3
+ export default _default;
@@ -0,0 +1,38 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ 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; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useState, forwardRef, useImperativeHandle } from 'react';
8
+ import { locales } from '@pisell/utils';
9
+ import { PisellModal } from '@pisell/materials';
10
+ var AppointmentProductModal = function AppointmentProductModal(props, ref) {
11
+ var _useState = useState(false),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ open = _useState2[0],
14
+ setOpen = _useState2[1];
15
+ useImperativeHandle(ref, function () {
16
+ return {
17
+ open: function open() {
18
+ setOpen(true);
19
+ }
20
+ };
21
+ });
22
+ return /*#__PURE__*/React.createElement(PisellModal.Information, {
23
+ open: open,
24
+ platform: "pc",
25
+ title: locales.getText('pisell2.text.missing.reservation.title'),
26
+ describe: locales.getText('pisell2.text.missing.reservation.content'),
27
+ cancelText: locales.getText('pisell2.text.cancel'),
28
+ okText: locales.getText('pisell2.text.confirm'),
29
+ closable: true,
30
+ onOk: function onOk() {
31
+ return setOpen(false);
32
+ },
33
+ onCancel: function onCancel() {
34
+ return setOpen(false);
35
+ }
36
+ });
37
+ };
38
+ export default /*#__PURE__*/forwardRef(AppointmentProductModal);
@@ -9,6 +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
13
  var getRelationDetailsTotal = function getRelationDetailsTotal(relation_details) {
13
14
  var total = 0;
14
15
  var _iterator = _createForOfIteratorHelper(relation_details),
@@ -35,6 +36,8 @@ var getRelationDetailsTotal = function getRelationDetailsTotal(relation_details)
35
36
  var getProductAmount = function getProductAmount(state, isEdit) {
36
37
  var price = 0;
37
38
  var duration = 0;
39
+ // 是否是跨日预约
40
+ var isDay = isDayBooking(state);
38
41
  if (isEdit) {
39
42
  // 计算总价 服务 和 附加商品
40
43
  if (state !== null && state !== void 0 && state.service || state !== null && state !== void 0 && state.addons) {
@@ -42,44 +45,64 @@ var getProductAmount = function getProductAmount(state, isEdit) {
42
45
  _step2;
43
46
  try {
44
47
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
45
- var item = _step2.value;
46
- // 预约商品
47
- price += Number(item._extend.total);
48
-
49
- // 附加商品
50
- price += getRelationDetailsTotal(item._extend.relation_details || []);
51
- // price +=
52
- duration += flexibleObj.getValue(item._extend.duration);
48
+ var _item = _step2.value;
49
+ // 跨日预约
50
+ if (isDay) {
51
+ price += Number(_item._extend.total) * Number(_item._extend.quantity);
52
+
53
+ // 普通商品不能加到时长上
54
+ var _duration = isAppointment(_item, state) ? _item._extend.duration : 0;
55
+ duration += _duration;
56
+ } else {
57
+ price += Number(_item._extend.total);
58
+
59
+ // 附加商品
60
+ price += getRelationDetailsTotal(_item._extend.relation_details || []);
61
+ duration += flexibleObj.getValue(_item._extend.duration);
62
+ }
53
63
  }
64
+
65
+ // 不是跨日预约才执行
54
66
  } catch (err) {
55
67
  _iterator2.e(err);
56
68
  } finally {
57
69
  _iterator2.f();
58
70
  }
59
- var _iterator3 = _createForOfIteratorHelper(state.addons.value),
60
- _step3;
61
- try {
62
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
63
- var _item = _step3.value;
64
- price += Number(_item._extend.total) * _item._extend.quantity;
71
+ if (!isDay) {
72
+ var _iterator3 = _createForOfIteratorHelper(state.addons.value),
73
+ _step3;
74
+ try {
75
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
76
+ var item = _step3.value;
77
+ price += Number(item._extend.total) * item._extend.quantity;
78
+ }
79
+ } catch (err) {
80
+ _iterator3.e(err);
81
+ } finally {
82
+ _iterator3.f();
65
83
  }
66
- } catch (err) {
67
- _iterator3.e(err);
68
- } finally {
69
- _iterator3.f();
70
84
  }
71
85
  }
72
86
  } else {
73
87
  var _state$bookingDetail, _state$service;
74
88
  price = Number((_state$bookingDetail = state.bookingDetail) === null || _state$bookingDetail === void 0 ? void 0 : _state$bookingDetail.product_expect_amount);
75
- duration = ((state === null || state === void 0 ? void 0 : (_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || []).reduce(function (pre, cur) {
76
- var _cur$_extend;
77
- return pre + flexibleObj.getValue(((_cur$_extend = cur._extend) === null || _cur$_extend === void 0 ? void 0 : _cur$_extend.duration) || 0);
89
+ var services = (state === null || state === void 0 ? void 0 : (_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || [];
90
+ duration = services.reduce(function (pre, cur) {
91
+ var current = 0;
92
+ if (isDay) {
93
+ // 普通商品不能加到时长上
94
+ var _duration2 = isAppointment(cur, state) ? cur._extend.duration : 0;
95
+ current = _duration2 || 0;
96
+ } else {
97
+ var _cur$_extend;
98
+ current = flexibleObj.getValue(((_cur$_extend = cur._extend) === null || _cur$_extend === void 0 ? void 0 : _cur$_extend.duration) || 0);
99
+ }
100
+ return pre + current;
78
101
  }, 0);
79
102
  }
80
103
  return {
81
104
  price: Number(price),
82
- duration: getDiscountTime(duration)
105
+ duration: getDiscountTime(duration, isDay)
83
106
  };
84
107
  };
85
108
  var getProductItemTax = function getProductItemTax(item, bookingDetail) {
@@ -17,7 +17,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
17
17
  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; }
18
18
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- import React, { useEffect, useMemo, useState } from 'react';
20
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
21
21
  import ChevronDown from '@pisell/icon/es/ChevronDown';
22
22
  import classNames from 'classnames';
23
23
  import { Skeleton, message, Dropdown, Space, Modal } from 'antd';
@@ -33,6 +33,9 @@ import { DownOutlined } from '@ant-design/icons';
33
33
  import { eventBookingCheck } from "./serve";
34
34
  import { createBookings, editBookings } from "../../info2/serve";
35
35
  import { isBooking4Shop } from "../../info/utils";
36
+ import { isDayBooking, isHasDayAppointmentProduct } from "../../info/service2/utils";
37
+ import AppointmentProductModal from "./AppointmentProductModal";
38
+
36
39
  /**
37
40
  * @title: 底部
38
41
  * @description:
@@ -66,6 +69,7 @@ var Footer = function Footer(props) {
66
69
  _useState8 = _slicedToArray(_useState7, 2),
67
70
  isShowPaymentLink = _useState8[0],
68
71
  setIsShowPaymentLink = _useState8[1];
72
+ var appointmentProductRef = useRef(null);
69
73
  var context = useEngineContext();
70
74
  var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
71
75
  isTerminal = _context$appHelper$ut.isTerminal,
@@ -286,25 +290,36 @@ var Footer = function Footer(props) {
286
290
  */
287
291
  var handleCheckout = /*#__PURE__*/function () {
288
292
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
289
- var res;
293
+ var isHasDayProducts, res;
290
294
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
291
295
  while (1) switch (_context2.prev = _context2.next) {
292
296
  case 0:
293
297
  if (!isEdit) {
294
- _context2.next = 6;
298
+ _context2.next = 10;
299
+ break;
300
+ }
301
+ if (!isDayBooking(state)) {
302
+ _context2.next = 5;
303
+ break;
304
+ }
305
+ isHasDayProducts = handleDaySubmit();
306
+ if (!isHasDayProducts) {
307
+ _context2.next = 5;
295
308
  break;
296
309
  }
297
- _context2.next = 3;
310
+ return _context2.abrupt("return");
311
+ case 5:
312
+ _context2.next = 7;
298
313
  return handleSave({
299
314
  type: 'checkout'
300
315
  });
301
- case 3:
316
+ case 7:
302
317
  res = _context2.sent;
303
318
  goCheckout((res === null || res === void 0 ? void 0 : res.order_id) || state.bookingId);
304
319
  return _context2.abrupt("return");
305
- case 6:
320
+ case 10:
306
321
  return _context2.abrupt("return", goCheckout(state.bookingId));
307
- case 7:
322
+ case 11:
308
323
  case "end":
309
324
  return _context2.stop();
310
325
  }
@@ -356,7 +371,7 @@ var Footer = function Footer(props) {
356
371
  }();
357
372
  var getApis = function getApis() {
358
373
  var _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6;
359
- 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)) {
374
+ 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) || state.renderType === 'dayBooking') {
360
375
  return {
361
376
  editBooking: editBookings,
362
377
  createBooking: createBookings
@@ -368,6 +383,22 @@ var Footer = function Footer(props) {
368
383
  };
369
384
  };
370
385
 
386
+ /**
387
+ * @title: 跨日预约提交之前的验证
388
+ * @description:
389
+ * @return {*}
390
+ * @Author: WangHan
391
+ * @Date: 2024-12-12 16:18
392
+ */
393
+ var handleDaySubmit = function handleDaySubmit() {
394
+ var _isHasDayProducts = isHasDayAppointmentProduct(state);
395
+ if (_isHasDayProducts) {
396
+ var _appointmentProductRe;
397
+ appointmentProductRef === null || appointmentProductRef === void 0 ? void 0 : (_appointmentProductRe = appointmentProductRef.current) === null || _appointmentProductRe === void 0 ? void 0 : _appointmentProductRe.open();
398
+ }
399
+ return _isHasDayProducts;
400
+ };
401
+
371
402
  /**
372
403
  * @title: 保存info
373
404
  * @description:
@@ -378,11 +409,22 @@ var Footer = function Footer(props) {
378
409
  */
379
410
  var handleSave = /*#__PURE__*/function () {
380
411
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref4) {
381
- var type, _ref4$messageShow, messageShow, _setLoading, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, callbackData, values, api, _yield$eventBookingCh, data, confirmed;
412
+ var type, _ref4$messageShow, messageShow, isHasDayProducts, _setLoading, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, callbackData, values, api, _yield$eventBookingCh, data, confirmed;
382
413
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
383
414
  while (1) switch (_context4.prev = _context4.next) {
384
415
  case 0:
385
416
  type = _ref4.type, _ref4$messageShow = _ref4.messageShow, messageShow = _ref4$messageShow === void 0 ? true : _ref4$messageShow;
417
+ if (!isDayBooking(state)) {
418
+ _context4.next = 5;
419
+ break;
420
+ }
421
+ isHasDayProducts = handleDaySubmit();
422
+ if (!isHasDayProducts) {
423
+ _context4.next = 5;
424
+ break;
425
+ }
426
+ return _context4.abrupt("return");
427
+ case 5:
386
428
  // 区分loading, 是点击的checkout 还是save
387
429
  _setLoading = type === 'checkout' ? setCheckoutLoading : setLoading;
388
430
  _setLoading(true);
@@ -391,39 +433,39 @@ var Footer = function Footer(props) {
391
433
  createApi = state.renderType === 'eventBooking' ? state.apis.createEventBooking : createBooking;
392
434
  saveOtherValue = {};
393
435
  if (!(type === 'save')) {
394
- _context4.next = 14;
436
+ _context4.next = 18;
395
437
  break;
396
438
  }
397
- _context4.next = 10;
439
+ _context4.next = 14;
398
440
  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);
399
- case 10:
441
+ case 14:
400
442
  _context4.t0 = _context4.sent;
401
443
  if (_context4.t0) {
402
- _context4.next = 13;
444
+ _context4.next = 17;
403
445
  break;
404
446
  }
405
447
  _context4.t0 = {};
406
- case 13:
448
+ case 17:
407
449
  saveOtherValue = _context4.t0;
408
- case 14:
409
- _context4.prev = 14;
450
+ case 18:
451
+ _context4.prev = 18;
410
452
  callbackData = null; // 格式化提交的参数
411
453
  values = formatValues(_objectSpread(_objectSpread({}, state), saveOtherValue)); // 区分是新增还是编辑
412
454
  api = state.bookingId ? editApi : createApi; // 活动预约新建时校验重复
413
455
  if (!(!state.bookingId && state.renderType === 'eventBooking')) {
414
- _context4.next = 30;
456
+ _context4.next = 34;
415
457
  break;
416
458
  }
417
- _context4.next = 21;
459
+ _context4.next = 25;
418
460
  return eventBookingCheck(values);
419
- case 21:
461
+ case 25:
420
462
  _yield$eventBookingCh = _context4.sent;
421
463
  data = _yield$eventBookingCh.data;
422
464
  if (!data.list.length) {
423
- _context4.next = 30;
465
+ _context4.next = 34;
424
466
  break;
425
467
  }
426
- _context4.next = 26;
468
+ _context4.next = 30;
427
469
  return modal.confirm({
428
470
  icon: null,
429
471
  title: locales.getText('page.event.booking.text.duplicate-enrollment'),
@@ -435,53 +477,53 @@ var Footer = function Footer(props) {
435
477
  width: 480,
436
478
  okText: locales.getText('page.event.booking.text.duplicate-enrollment-confirm')
437
479
  });
438
- case 26:
480
+ case 30:
439
481
  confirmed = _context4.sent;
440
482
  if (confirmed) {
441
- _context4.next = 30;
483
+ _context4.next = 34;
442
484
  break;
443
485
  }
444
486
  _setLoading(false);
445
487
  return _context4.abrupt("return");
446
- case 30:
488
+ case 34:
447
489
  if (!addonsEdit) {
448
- _context4.next = 33;
490
+ _context4.next = 37;
449
491
  break;
450
492
  }
451
- _context4.next = 33;
493
+ _context4.next = 37;
452
494
  return handleSaveAddons();
453
- case 33:
495
+ case 37:
454
496
  if (!infoEdit) {
455
- _context4.next = 38;
497
+ _context4.next = 42;
456
498
  break;
457
499
  }
458
- _context4.next = 36;
500
+ _context4.next = 40;
459
501
  return api(values, state.bookingId);
460
- case 36:
502
+ case 40:
461
503
  callbackData = _context4.sent;
462
504
  if (messageShow) {
463
505
  message.success(locales.getText(state.bookingId ? 'pisell2.text.appointment-updated' : 'pisell2.text.created-successfully'));
464
506
  }
465
- case 38:
507
+ case 42:
466
508
  // 回调关闭弹窗
467
509
  state === null || state === void 0 ? void 0 : state.callback(callbackData);
468
510
  _setLoading(false);
469
511
 
470
512
  // return数据 checkout时需要
471
513
  return _context4.abrupt("return", callbackData || values);
472
- case 43:
473
- _context4.prev = 43;
474
- _context4.t1 = _context4["catch"](14);
514
+ case 47:
515
+ _context4.prev = 47;
516
+ _context4.t1 = _context4["catch"](18);
475
517
  console.log(_context4.t1);
476
518
  if ((_context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.code) === 70101) {
477
519
  message.error(_context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.message);
478
520
  }
479
521
  _setLoading(false);
480
- case 48:
522
+ case 52:
481
523
  case "end":
482
524
  return _context4.stop();
483
525
  }
484
- }, _callee4, null, [[14, 43]]);
526
+ }, _callee4, null, [[18, 47]]);
485
527
  }));
486
528
  return function handleSave(_x3) {
487
529
  return _ref5.apply(this, arguments);
@@ -799,7 +841,7 @@ var Footer = function Footer(props) {
799
841
 
800
842
  /**
801
843
  * @title: 清空按钮
802
- * @description:
844
+ * @description:
803
845
  * @return: *
804
846
  * @Author: shengjie.zuo
805
847
  * @Date: 2024-10-26 10:52:01
@@ -949,7 +991,7 @@ var Footer = function Footer(props) {
949
991
  }
950
992
  if (transaction_habit_selection.button_rows == 1) {
951
993
  if (state.appointment_status !== 'cancelled') {
952
- if (!state.disabledEdit && !state.isBookingCreatePage) {
994
+ if (!state.disabledEdit && !state.isBookingCreatePage && !isDayBooking(state)) {
953
995
  arr.push(actionMap.sale);
954
996
  }
955
997
  }
@@ -1240,7 +1282,7 @@ var Footer = function Footer(props) {
1240
1282
  style: {
1241
1283
  marginTop: 12
1242
1284
  }
1243
- }, state.appointment_status !== 'cancelled' && !state.isBookingCreatePage ? /*#__PURE__*/React.createElement(Button, {
1285
+ }, state.appointment_status !== 'cancelled' && !state.isBookingCreatePage && !isDayBooking(state) ? /*#__PURE__*/React.createElement(Button, {
1244
1286
  onClick: function onClick() {
1245
1287
  return handleSale();
1246
1288
  },
@@ -1252,6 +1294,8 @@ var Footer = function Footer(props) {
1252
1294
  },
1253
1295
  size: "large",
1254
1296
  className: "pisell-lowcode__booking-footer-buttons-item"
1255
- }, actionMap.orderDetail.label)) : null, contextHolder);
1297
+ }, actionMap.orderDetail.label)) : null, contextHolder, /*#__PURE__*/React.createElement(AppointmentProductModal, {
1298
+ ref: appointmentProductRef
1299
+ }));
1256
1300
  };
1257
1301
  export default Footer;