@pisell/private-materials 6.2.25 → 6.2.26

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 (212) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +1 -1
  6. package/build/lowcode/view.js +1 -1
  7. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +1 -1
  8. package/es/components/booking/components/customSelect/index.js +1 -0
  9. package/es/components/booking/hooks/useClearCart.js +11 -8
  10. package/es/components/booking/info/client/index.js +3 -2
  11. package/es/components/booking/info/hooks/useInfoHolder.js +13 -14
  12. package/es/components/booking/info/service/Lists.js +37 -27
  13. package/es/components/booking/info/service/editService/constants.d.ts +1 -0
  14. package/es/components/booking/info/service/editService/constants.js +3 -0
  15. package/es/components/booking/info/service/editService/index.js +15 -10
  16. package/es/components/booking/info/service2/utils.d.ts +1 -1
  17. package/es/components/booking/info/service2/utils.js +20 -21
  18. package/es/components/booking/info2/index.js +1 -0
  19. package/es/components/booking/info2/service/addService/utils.js +6 -3
  20. package/es/components/booking/info2/service/addTimeModal/index.js +3 -0
  21. package/es/components/booking/info2/service/editService/Resources/index.js +5 -0
  22. package/es/components/booking/info2/service/editService/index.js +265 -170
  23. package/es/components/booking/info2/service/index.js +22 -19
  24. package/es/components/booking/materiels/duration/index.js +9 -2
  25. package/es/components/booking/materiels/holder/index.d.ts +0 -1
  26. package/es/components/shoppingCart/components/Cart/Product.js +51 -47
  27. package/es/components/shoppingCart/components/Cart/index.js +21 -18
  28. package/es/components/ticketBooking/components/addServiceVariant/addService.js +171 -151
  29. package/es/components/ticketBooking/components/timeBar/index.js +77 -73
  30. package/es/components/ticketBooking/utils/index.d.ts +1 -1
  31. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +1 -1
  32. package/lib/components/booking/components/customSelect/index.js +1 -0
  33. package/lib/components/booking/hooks/useClearCart.js +16 -13
  34. package/lib/components/booking/info/client/index.js +5 -4
  35. package/lib/components/booking/info/hooks/useInfoHolder.js +12 -13
  36. package/lib/components/booking/info/service/Lists.js +36 -24
  37. package/lib/components/booking/info/service/editService/constants.d.ts +1 -0
  38. package/lib/components/booking/info/service/editService/constants.js +31 -0
  39. package/lib/components/booking/info/service/editService/index.js +7 -1
  40. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  41. package/lib/components/booking/info/service2/utils.js +17 -17
  42. package/lib/components/booking/info2/service/addService/utils.js +4 -2
  43. package/lib/components/booking/info2/service/addTimeModal/index.js +3 -0
  44. package/lib/components/booking/info2/service/editService/Resources/index.js +2 -0
  45. package/lib/components/booking/info2/service/editService/index.js +138 -74
  46. package/lib/components/booking/info2/service/index.js +14 -10
  47. package/lib/components/booking/materiels/duration/index.js +7 -2
  48. package/lib/components/booking/materiels/holder/index.d.ts +0 -1
  49. package/lib/components/shoppingCart/components/Cart/Product.js +32 -28
  50. package/lib/components/shoppingCart/components/Cart/index.js +18 -15
  51. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +140 -122
  52. package/lib/components/ticketBooking/components/timeBar/index.js +98 -94
  53. package/lib/components/ticketBooking/utils/index.d.ts +1 -1
  54. package/package.json +3 -3
  55. package/es/components/Sales/Cart/index.d.ts +0 -53
  56. package/es/components/booking/addons/index.d.ts +0 -17
  57. package/es/components/booking/components/actionButtons/index.d.ts +0 -29
  58. package/es/components/booking/components/clearCartModal/index.d.ts +0 -10
  59. package/es/components/booking/components/customiseItemModal/index.d.ts +0 -28
  60. package/es/components/booking/components/tabPane/index.d.ts +0 -4
  61. package/es/components/booking/components/voucher/index.d.ts +0 -3
  62. package/es/components/booking/dashboard/index.d.ts +0 -20
  63. package/es/components/booking/info/service/serviceItem/index.d.ts +0 -3
  64. package/es/components/booking/info2/cartClientCard/index.d.ts +0 -6
  65. package/es/components/booking/info2/cartClientCard/locales.d.ts +0 -21
  66. package/es/components/booking/info2/cartClientCard/types.d.ts +0 -13
  67. package/es/components/booking/info2/cartClientCard/utils.d.ts +0 -3
  68. package/es/components/booking/info2/service/editNormalService/index.d.ts +0 -3
  69. package/es/components/booking/info2/service/serviceItem/index.d.ts +0 -3
  70. package/es/components/booking/locales.d.ts +0 -903
  71. package/es/components/booking/notes/addNote/index.d.ts +0 -3
  72. package/es/components/shoppingCart/type.d.ts +0 -49
  73. package/es/components/ticketBooking/components/addServiceVariant/utils.d.ts +0 -8
  74. package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +0 -7
  75. package/es/components/ticketBooking/components/bookingDataPanel/bookingList/index.d.ts +0 -12
  76. package/es/components/ticketBooking/components/bookingDataPanel/bookingList/utils.d.ts +0 -6
  77. package/es/components/ticketBooking/components/bookingDataPanel/constants.d.ts +0 -22
  78. package/es/components/ticketBooking/components/bookingDataPanel/index.d.ts +0 -9
  79. package/es/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.d.ts +0 -14
  80. package/es/components/ticketBooking/components/bookingDataPanel/serve.d.ts +0 -0
  81. package/es/components/ticketBooking/components/floatButtons/index.d.ts +0 -11
  82. package/es/components/ticketBooking/hooks/pisellos/bookingTicket.d.ts +0 -1
  83. package/es/components/ticketBooking/hooks/pisellos/index.d.ts +0 -3
  84. package/es/components/ticketBooking/hooks/pisellos/useCustomer.d.ts +0 -25
  85. package/es/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -12
  86. package/es/components/ticketBooking/hooks/pisellos/useScanGlobalHandle.d.ts +0 -2
  87. package/es/components/ticketBooking/locales.d.ts +0 -177
  88. package/es/components/ticketBooking/serve.d.ts +0 -287
  89. package/es/hooks/useToast.d.ts +0 -2
  90. package/es/hooks/useTranslationOriginal.d.ts +0 -1
  91. package/es/index.d.ts +0 -51
  92. package/es/plus/clientCard/index.d.ts +0 -7
  93. package/es/plus/clientCard/line/index.d.ts +0 -9
  94. package/es/plus/clientCard/locales.d.ts +0 -18
  95. package/es/plus/clientCard/types.d.ts +0 -126
  96. package/es/plus/clientCard/utils.d.ts +0 -8
  97. package/es/plus/clientName/index.d.ts +0 -5
  98. package/es/plus/clientName/type.d.ts +0 -13
  99. package/es/plus/clientName/utils.d.ts +0 -2
  100. package/es/plus/clinetSearch/Add/BirthdayField/index.d.ts +0 -2
  101. package/es/plus/clinetSearch/Add/GenderField/index.d.ts +0 -2
  102. package/es/plus/clinetSearch/Add/PhoneField/index.d.ts +0 -2
  103. package/es/plus/clinetSearch/Add/PhoneField/serve.d.ts +0 -2
  104. package/es/plus/clinetSearch/Add/index.d.ts +0 -18
  105. package/es/plus/clinetSearch/InfiniteScroll/InfiniteScroll.d.ts +0 -5
  106. package/es/plus/clinetSearch/InfiniteScroll/index.d.ts +0 -2
  107. package/es/plus/clinetSearch/InfiniteScroll/types.d.ts +0 -46
  108. package/es/plus/clinetSearch/index.d.ts +0 -18
  109. package/es/plus/clinetSearch/locales.d.ts +0 -102
  110. package/es/plus/clinetSearch/serve.d.ts +0 -1
  111. package/es/plus/clinetSearch/types.d.ts +0 -49
  112. package/es/plus/noteModal/AddTempModal.d.ts +0 -7
  113. package/es/plus/noteModal/index.d.ts +0 -4
  114. package/es/plus/noteModal/locales.d.ts +0 -33
  115. package/es/plus/noteModal/types.d.ts +0 -17
  116. package/es/pro/comprehensiveSearch/hooks/useNativeScanner.d.ts +0 -5
  117. package/es/pro/comprehensiveSearch/hooks/useTerminalPeripherals.d.ts +0 -9
  118. package/es/pro/comprehensiveSearch/index.d.ts +0 -9
  119. package/es/pro/comprehensiveSearch/locales.d.ts +0 -18
  120. package/es/pro/comprehensiveSearch/types.d.ts +0 -31
  121. package/es/pro/numberKeyboard/index.d.ts +0 -28
  122. package/es/pro/numberKeyboard/locales.d.ts +0 -12
  123. package/es/pro/pisellNumberSelector/example.d.ts +0 -3
  124. package/es/pro/pisellNumberSelector/index.d.ts +0 -26
  125. package/es/pro/pisellPhoneKeyboard/index.d.ts +0 -12
  126. package/es/pro/pisellPhoneKeyboard/locales.d.ts +0 -12
  127. package/es/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.d.ts +0 -5
  128. package/es/pro/pisellPriceKeyboardModal/index.d.ts +0 -2
  129. package/es/pro/pisellPriceKeyboardModal/types.d.ts +0 -25
  130. package/es/pro/pisellPriceRadio/index.d.ts +0 -26
  131. package/es/pro/skuDetailModal/index.d.ts +0 -5
  132. package/es/pro/skuDetailModal/locales.d.ts +0 -48
  133. package/es/pro/skuDetailModal/types.d.ts +0 -347
  134. package/lib/components/Sales/Cart/index.d.ts +0 -53
  135. package/lib/components/booking/addons/index.d.ts +0 -17
  136. package/lib/components/booking/components/actionButtons/index.d.ts +0 -29
  137. package/lib/components/booking/components/clearCartModal/index.d.ts +0 -10
  138. package/lib/components/booking/components/customiseItemModal/index.d.ts +0 -28
  139. package/lib/components/booking/components/tabPane/index.d.ts +0 -4
  140. package/lib/components/booking/components/voucher/index.d.ts +0 -3
  141. package/lib/components/booking/dashboard/index.d.ts +0 -20
  142. package/lib/components/booking/info/service/serviceItem/index.d.ts +0 -3
  143. package/lib/components/booking/info2/cartClientCard/index.d.ts +0 -6
  144. package/lib/components/booking/info2/cartClientCard/locales.d.ts +0 -21
  145. package/lib/components/booking/info2/cartClientCard/types.d.ts +0 -13
  146. package/lib/components/booking/info2/cartClientCard/utils.d.ts +0 -3
  147. package/lib/components/booking/info2/service/editNormalService/index.d.ts +0 -3
  148. package/lib/components/booking/info2/service/serviceItem/index.d.ts +0 -3
  149. package/lib/components/booking/locales.d.ts +0 -903
  150. package/lib/components/booking/notes/addNote/index.d.ts +0 -3
  151. package/lib/components/shoppingCart/type.d.ts +0 -49
  152. package/lib/components/ticketBooking/components/addServiceVariant/utils.d.ts +0 -8
  153. package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +0 -7
  154. package/lib/components/ticketBooking/components/bookingDataPanel/bookingList/index.d.ts +0 -12
  155. package/lib/components/ticketBooking/components/bookingDataPanel/bookingList/utils.d.ts +0 -6
  156. package/lib/components/ticketBooking/components/bookingDataPanel/constants.d.ts +0 -22
  157. package/lib/components/ticketBooking/components/bookingDataPanel/index.d.ts +0 -9
  158. package/lib/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.d.ts +0 -14
  159. package/lib/components/ticketBooking/components/bookingDataPanel/serve.d.ts +0 -0
  160. package/lib/components/ticketBooking/components/floatButtons/index.d.ts +0 -11
  161. package/lib/components/ticketBooking/hooks/pisellos/bookingTicket.d.ts +0 -1
  162. package/lib/components/ticketBooking/hooks/pisellos/index.d.ts +0 -3
  163. package/lib/components/ticketBooking/hooks/pisellos/useCustomer.d.ts +0 -25
  164. package/lib/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -12
  165. package/lib/components/ticketBooking/hooks/pisellos/useScanGlobalHandle.d.ts +0 -2
  166. package/lib/components/ticketBooking/locales.d.ts +0 -177
  167. package/lib/components/ticketBooking/serve.d.ts +0 -287
  168. package/lib/hooks/useToast.d.ts +0 -2
  169. package/lib/hooks/useTranslationOriginal.d.ts +0 -1
  170. package/lib/index.d.ts +0 -51
  171. package/lib/plus/clientCard/index.d.ts +0 -7
  172. package/lib/plus/clientCard/line/index.d.ts +0 -9
  173. package/lib/plus/clientCard/locales.d.ts +0 -18
  174. package/lib/plus/clientCard/types.d.ts +0 -126
  175. package/lib/plus/clientCard/utils.d.ts +0 -8
  176. package/lib/plus/clientName/index.d.ts +0 -5
  177. package/lib/plus/clientName/type.d.ts +0 -13
  178. package/lib/plus/clientName/utils.d.ts +0 -2
  179. package/lib/plus/clinetSearch/Add/BirthdayField/index.d.ts +0 -2
  180. package/lib/plus/clinetSearch/Add/GenderField/index.d.ts +0 -2
  181. package/lib/plus/clinetSearch/Add/PhoneField/index.d.ts +0 -2
  182. package/lib/plus/clinetSearch/Add/PhoneField/serve.d.ts +0 -2
  183. package/lib/plus/clinetSearch/Add/index.d.ts +0 -18
  184. package/lib/plus/clinetSearch/InfiniteScroll/InfiniteScroll.d.ts +0 -5
  185. package/lib/plus/clinetSearch/InfiniteScroll/index.d.ts +0 -2
  186. package/lib/plus/clinetSearch/InfiniteScroll/types.d.ts +0 -46
  187. package/lib/plus/clinetSearch/index.d.ts +0 -18
  188. package/lib/plus/clinetSearch/locales.d.ts +0 -102
  189. package/lib/plus/clinetSearch/serve.d.ts +0 -1
  190. package/lib/plus/clinetSearch/types.d.ts +0 -49
  191. package/lib/plus/noteModal/AddTempModal.d.ts +0 -7
  192. package/lib/plus/noteModal/index.d.ts +0 -4
  193. package/lib/plus/noteModal/locales.d.ts +0 -33
  194. package/lib/plus/noteModal/types.d.ts +0 -17
  195. package/lib/pro/comprehensiveSearch/hooks/useNativeScanner.d.ts +0 -5
  196. package/lib/pro/comprehensiveSearch/hooks/useTerminalPeripherals.d.ts +0 -9
  197. package/lib/pro/comprehensiveSearch/index.d.ts +0 -9
  198. package/lib/pro/comprehensiveSearch/locales.d.ts +0 -18
  199. package/lib/pro/comprehensiveSearch/types.d.ts +0 -31
  200. package/lib/pro/numberKeyboard/index.d.ts +0 -28
  201. package/lib/pro/numberKeyboard/locales.d.ts +0 -12
  202. package/lib/pro/pisellNumberSelector/example.d.ts +0 -3
  203. package/lib/pro/pisellNumberSelector/index.d.ts +0 -26
  204. package/lib/pro/pisellPhoneKeyboard/index.d.ts +0 -12
  205. package/lib/pro/pisellPhoneKeyboard/locales.d.ts +0 -12
  206. package/lib/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.d.ts +0 -5
  207. package/lib/pro/pisellPriceKeyboardModal/index.d.ts +0 -2
  208. package/lib/pro/pisellPriceKeyboardModal/types.d.ts +0 -25
  209. package/lib/pro/pisellPriceRadio/index.d.ts +0 -26
  210. package/lib/pro/skuDetailModal/index.d.ts +0 -5
  211. package/lib/pro/skuDetailModal/locales.d.ts +0 -48
  212. package/lib/pro/skuDetailModal/types.d.ts +0 -347
@@ -20,6 +20,9 @@ var Duration = function Duration(props) {
20
20
  startDate = props.startDate,
21
21
  timeObj = props.timeObj,
22
22
  resetProps = _objectWithoutProperties(props, _excluded);
23
+ var startDateStr = useMemo(function () {
24
+ return dayjs(startDate).format('YYYY-MM-DD HH:mm:ss');
25
+ }, [startDate]);
23
26
 
24
27
  /**
25
28
  * @title: 时间切片
@@ -57,7 +60,7 @@ var Duration = function Duration(props) {
57
60
  });
58
61
  }
59
62
  return durationSlicesBasedOnTime;
60
- }, [timeObj, slice, locale, duration, startDate, usableTime]);
63
+ }, [timeObj.durationSlicesBasedOnTime, slice, locale, duration, startDateStr, usableTime === null || usableTime === void 0 ? void 0 : usableTime.end_at]);
61
64
  useEffect(function () {
62
65
  timeObjChange === null || timeObjChange === void 0 || timeObjChange(times);
63
66
  }, [times]);
@@ -72,6 +75,10 @@ var Duration = function Duration(props) {
72
75
  }, d[label]);
73
76
  });
74
77
  }, []);
75
- return /*#__PURE__*/React.createElement(Select, _extends({}, selectProps, resetProps), renderOptions(times));
78
+ var options = useMemo(function () {
79
+ console.log('render form options');
80
+ return renderOptions(times);
81
+ }, [times]);
82
+ return /*#__PURE__*/React.createElement(Select, _extends({}, selectProps, resetProps), options);
76
83
  };
77
84
  export default Duration;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SelectProps } from 'antd';
3
2
  interface HolderProps extends SelectProps {
4
3
  selectProps?: SelectProps;
@@ -6,6 +6,7 @@ import useClearCart from "../../hooks/useClearCart";
6
6
  import { useContext } from "../../hooks/useContext";
7
7
  import useAddService from "../../hooks/useAddService";
8
8
  import { isNormalProductByDurationSchedule } from "../../../booking/info/service2/utils";
9
+ import { useMemoizedFn } from "ahooks";
9
10
  var Product = function Product(props) {
10
11
  var id = props.id,
11
12
  lists = props.lists,
@@ -38,10 +39,10 @@ var Product = function Product(props) {
38
39
  * @Author: WangHan
39
40
  * @Date: 2024-11-28 22:02
40
41
  */
41
- var handleChange = function handleChange(item, type, other) {
42
+ var handleChange = useMemoizedFn(function (item, type, other) {
42
43
  if (disabledEdit && !(other !== null && other !== void 0 && other.disabled)) return;
43
44
  onChange(item, type, other);
44
- };
45
+ });
45
46
  var productParams = useMemo(function () {
46
47
  return {
47
48
  isShowNote: isShowNote,
@@ -62,51 +63,54 @@ var Product = function Product(props) {
62
63
  isShowDelete: conf === null || conf === void 0 ? void 0 : conf.show_remove_button
63
64
  };
64
65
  };
65
- return /*#__PURE__*/React.createElement("div", {
66
- className: "pisell-lowcode__shopping-cart-content"
67
- }, clearCart, lists === null || lists === void 0 ? void 0 : lists.map(function (item) {
68
- var Comp = ProductCard;
69
- var isRetail;
70
- if (state.scenario === 'booking2') {
71
- isRetail = isNormalProductByDurationSchedule(item === null || item === void 0 ? void 0 : item._origin);
72
- Comp = isRetail ? ProductCard.V2 : ProductCard;
73
- }
74
- return /*#__PURE__*/React.createElement(Comp, _extends({
75
- type: isRetail ? 'a2' : undefined,
76
- key: item._id,
77
- dataSource: item,
78
- onAction: function onAction(e) {
79
- return _onAction === null || _onAction === void 0 ? void 0 : _onAction(e);
80
- },
81
- onDelete: function onDelete(e) {
82
- return handleChange(e, 'delete', item);
83
- },
84
- onNote: function onNote(e) {
85
- return handleChange(e, 'note', {
86
- note: e.note
87
- });
88
- },
89
- onLike: function onLike(e) {
90
- return handleChange(e, 'like', {
91
- like_status: e.like_status
92
- });
93
- },
94
- onEditProduct: function onEditProduct(e) {
95
- return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'edit_product');
96
- },
97
- onCard: function onCard(e) {
98
- return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'view');
99
- },
100
- onChangeResource: function onChangeResource(e) {
101
- return handleChange(item, 'change_resource', e);
102
- },
103
- onChangeHolder: function onChangeHolder(e) {
104
- return handleChange(item, 'change_holder', e);
105
- },
106
- onAddHolder: function onAddHolder(e) {
107
- return handleChange(item, 'add_holder', e);
66
+ return useMemo(function () {
67
+ console.log('render cart');
68
+ return /*#__PURE__*/React.createElement("div", {
69
+ className: "pisell-lowcode__shopping-cart-content"
70
+ }, clearCart, lists === null || lists === void 0 ? void 0 : lists.map(function (item) {
71
+ var Comp = ProductCard;
72
+ var isRetail;
73
+ if (state.scenario === 'booking2') {
74
+ isRetail = isNormalProductByDurationSchedule(item === null || item === void 0 ? void 0 : item._origin);
75
+ Comp = isRetail ? ProductCard.V2 : ProductCard;
108
76
  }
109
- }, productParams, getProductCardStyleProps(isRetail ? 'retail' : 'appointment')));
110
- }), !hideAddBtn && platform !== 'h5' && isAdd ? useAddService(id, 'more') : null);
77
+ return /*#__PURE__*/React.createElement(Comp, _extends({
78
+ type: isRetail ? 'a2' : undefined,
79
+ key: item._id,
80
+ dataSource: item,
81
+ onAction: function onAction(e) {
82
+ return _onAction === null || _onAction === void 0 ? void 0 : _onAction(e);
83
+ },
84
+ onDelete: function onDelete(e) {
85
+ return handleChange(e, 'delete', item);
86
+ },
87
+ onNote: function onNote(e) {
88
+ return handleChange(e, 'note', {
89
+ note: e.note
90
+ });
91
+ },
92
+ onLike: function onLike(e) {
93
+ return handleChange(e, 'like', {
94
+ like_status: e.like_status
95
+ });
96
+ },
97
+ onEditProduct: function onEditProduct(e) {
98
+ return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'edit_product');
99
+ },
100
+ onCard: function onCard(e) {
101
+ return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'view');
102
+ },
103
+ onChangeResource: function onChangeResource(e) {
104
+ return handleChange(item, 'change_resource', e);
105
+ },
106
+ onChangeHolder: function onChangeHolder(e) {
107
+ return handleChange(item, 'change_holder', e);
108
+ },
109
+ onAddHolder: function onAddHolder(e) {
110
+ return handleChange(item, 'add_holder', e);
111
+ }
112
+ }, productParams, getProductCardStyleProps(isRetail ? 'retail' : 'appointment')));
113
+ }), !hideAddBtn && platform !== 'h5' && isAdd ? useAddService(id, 'more') : null);
114
+ }, [clearCart, lists, productParams, hideAddBtn, isAdd, platform]);
111
115
  };
112
116
  export default Product;
@@ -51,23 +51,26 @@ var Cart = function Cart() {
51
51
  });
52
52
  });
53
53
  }, [carts, platform]);
54
- return /*#__PURE__*/React.createElement("div", {
55
- className: classNames('pisell-lowcode__shopping-cart')
56
- }, isProductList ? /*#__PURE__*/React.createElement(Product, {
57
- id: undefined,
58
- lists: state === null || state === void 0 ? void 0 : state.products
59
- }) : /*#__PURE__*/React.createElement(Collapse, _extends({
60
- items: cartsMap,
61
- showHeader: true,
62
- panelBackground: "#ffffff",
63
- collapsible: platform !== 'shop' ? 'disabled' : '-',
64
- accordion: platform === 'shop',
65
- onChange: function onChange(key) {
66
- updateState({
67
- activeKey: key
68
- });
69
- onActiveKey(key);
70
- }
71
- }, collapseParams)));
54
+ return useMemo(function () {
55
+ console.log('render cart 22222');
56
+ return /*#__PURE__*/React.createElement("div", {
57
+ className: classNames('pisell-lowcode__shopping-cart')
58
+ }, isProductList ? /*#__PURE__*/React.createElement(Product, {
59
+ id: undefined,
60
+ lists: state === null || state === void 0 ? void 0 : state.products
61
+ }) : /*#__PURE__*/React.createElement(Collapse, _extends({
62
+ items: cartsMap,
63
+ showHeader: true,
64
+ panelBackground: "#ffffff",
65
+ collapsible: platform !== 'shop' ? 'disabled' : '-',
66
+ accordion: platform === 'shop',
67
+ onChange: function onChange(key) {
68
+ updateState({
69
+ activeKey: key
70
+ });
71
+ onActiveKey(key);
72
+ }
73
+ }, collapseParams)));
74
+ }, [isProductList, cartsMap, platform, collapseParams, state === null || state === void 0 ? void 0 : state.products]);
72
75
  };
73
76
  export default Cart;
@@ -34,7 +34,7 @@ import dayjs from 'dayjs';
34
34
  import { useProducts } from "../../hooks/pisellos";
35
35
  import { createCacheItem, genValues, isBundle, isOption, setHandleSetService } from "./utils";
36
36
  var AddSerivce = function AddSerivce(props) {
37
- var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$client2, _state$service2;
37
+ var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$client2;
38
38
  var onEdit = props.onEdit,
39
39
  state = props.state,
40
40
  dispatch = props.dispatch,
@@ -221,10 +221,178 @@ var AddSerivce = function AddSerivce(props) {
221
221
  var isEject = getIsEject(item, type);
222
222
  var isOnlySession = getIsOnlySession(item);
223
223
  var lock = false;
224
+ // 对于不需要打开弹窗的商品, 直接模拟数据, 不走弹窗
225
+ var cacheValues = null;
224
226
  if (isEject) {
225
227
  setCurrentProduct(item);
226
228
  } else {
227
229
  setCurrentProduct(null);
230
+ if (!isSession) {
231
+ cacheValues = {
232
+ bundle: [],
233
+ key: item.id,
234
+ option: [],
235
+ product_id: item.id,
236
+ product_variant_id: 0,
237
+ quantity: 1,
238
+ rowKey: item.id,
239
+ session: null,
240
+ unique: '08974625397'
241
+ };
242
+ }
243
+ }
244
+ var callback = /*#__PURE__*/function () {
245
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, extension_type, detail) {
246
+ var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData;
247
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
248
+ while (1) switch (_context.prev = _context.next) {
249
+ case 0:
250
+ setCurrentProduct(null);
251
+ // 防止选择商品弹窗多次触发callback
252
+ if (!lock) {
253
+ _context.next = 3;
254
+ break;
255
+ }
256
+ return _context.abrupt("return");
257
+ case 3:
258
+ lock = true;
259
+
260
+ // 2秒后解除
261
+ setTimeout(function () {
262
+ lock = false;
263
+ }, 2000);
264
+ if (isBooking4) {
265
+ _context.next = 11;
266
+ break;
267
+ }
268
+ _context.next = 8;
269
+ return createBookingData({
270
+ product: _objectSpread(_objectSpread({}, detail || item), {}, {
271
+ _params: e
272
+ })
273
+ });
274
+ case 8:
275
+ data = _context.sent;
276
+ // 创建预约
277
+ createBooking({
278
+ booking: data
279
+ });
280
+ return _context.abrupt("return");
281
+ case 11:
282
+ // info2 addService 逻辑
283
+ _detail = detail || item;
284
+ other = JSON.parse(JSON.stringify(e));
285
+ other.session = e.session;
286
+ cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
287
+ product_id: item.id,
288
+ _id: getUniqueId(),
289
+ _key: e.key,
290
+ _extend: {
291
+ start_date: state.date.value,
292
+ quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
293
+ price: _detail.price,
294
+ product_name: item.title,
295
+ other: other
296
+ },
297
+ new: 1
298
+ });
299
+ _total = getProductTotalPrice(cacheItem); // 用于折扣 可修改
300
+ cacheItem._extend.total = _total;
301
+ // 用于储存原价
302
+ cacheItem._extend.origin_total = _total;
303
+ _isEdit = !!state.service.cacheItem;
304
+ if (_isEdit) {
305
+ cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
306
+ cacheItem.new = 0;
307
+ }
308
+ // 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
309
+ if (renderMode === 'current') {
310
+ // cacheItem._extend.resource = 0;
311
+ cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
312
+ }
313
+ cacheItem = getProductExtend({
314
+ cacheItem: cacheItem,
315
+ state: state,
316
+ isDisabledTime: true
317
+ });
318
+ if (state.renderType === 'eventBooking') {
319
+ cacheItem.autoClose = false;
320
+ }
321
+ if (cacheItem.autoClose) {
322
+ cacheItem.autoClose = false;
323
+ cacheItem._serviceKey = genServiceKey(cacheItem);
324
+ _addService2 = addService(_toConsumableArray(state.service.value), cacheItem, state), _list = _addService2.list, quantity = _addService2.quantity;
325
+ handleAddToast(cacheItem.title, quantity || 1);
326
+ addServiceScroll(e.rowKey, cacheItem);
327
+ try {
328
+ if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
329
+ val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
330
+ return {
331
+ product_id: s === null || s === void 0 ? void 0 : s.product_id,
332
+ detailId: s === null || s === void 0 ? void 0 : s.id,
333
+ detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
334
+ product_name: s === null || s === void 0 ? void 0 : s.title,
335
+ price: s === null || s === void 0 ? void 0 : s.price,
336
+ _id: s === null || s === void 0 ? void 0 : s._id,
337
+ _key: s === null || s === void 0 ? void 0 : s._key,
338
+ _serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
339
+ };
340
+ });
341
+ sendData = {
342
+ product_id: item === null || item === void 0 ? void 0 : item.id,
343
+ detailId: _detail === null || _detail === void 0 ? void 0 : _detail.id,
344
+ detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
345
+ product_name: item === null || item === void 0 ? void 0 : item.title,
346
+ price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
347
+ serviceVal: val
348
+ };
349
+ sendWarningLog({
350
+ title: 'addService',
351
+ content: [{
352
+ key: '添加数据',
353
+ value: JSON.stringify(sendData)
354
+ }, {
355
+ key: '日期',
356
+ value: dayjs().format('YYYY-MM-DD HH:mm:ss')
357
+ }]
358
+ });
359
+ }
360
+ } catch (error) {}
361
+ dispatch({
362
+ type: 'setService',
363
+ payload: {
364
+ addModal: false,
365
+ value: _list,
366
+ edit: true,
367
+ changeService: false
368
+ }
369
+ });
370
+ } else {
371
+ dispatch({
372
+ type: 'setService',
373
+ payload: {
374
+ editModal: true,
375
+ cacheItem: cacheItem,
376
+ addModal: !cacheItem.autoClose,
377
+ changeService: false
378
+ }
379
+ });
380
+ onEdit === null || onEdit === void 0 || onEdit(cacheItem);
381
+ }
382
+ case 24:
383
+ case "end":
384
+ return _context.stop();
385
+ }
386
+ }, _callee);
387
+ }));
388
+ return function callback(_x, _x2, _x3) {
389
+ return _ref.apply(this, arguments);
390
+ };
391
+ }();
392
+ // 如果不需要打开弹窗, 直接添加数据
393
+ if (cacheValues) {
394
+ callback(cacheValues, '', item);
395
+ return;
228
396
  }
229
397
  state.action({
230
398
  type: 'pisell1.handleOpenProductModal',
@@ -246,155 +414,7 @@ var AddSerivce = function AddSerivce(props) {
246
414
  onCancel: function onCancel() {
247
415
  setCurrentProduct(null);
248
416
  },
249
- callback: function () {
250
- var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, extension_type, detail) {
251
- var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData;
252
- return _regeneratorRuntime().wrap(function _callee$(_context) {
253
- while (1) switch (_context.prev = _context.next) {
254
- case 0:
255
- setCurrentProduct(null);
256
- // 防止选择商品弹窗多次触发callback
257
- if (!lock) {
258
- _context.next = 3;
259
- break;
260
- }
261
- return _context.abrupt("return");
262
- case 3:
263
- lock = true;
264
-
265
- // 2秒后解除
266
- setTimeout(function () {
267
- lock = false;
268
- }, 2000);
269
- if (isBooking4) {
270
- _context.next = 11;
271
- break;
272
- }
273
- _context.next = 8;
274
- return createBookingData({
275
- product: _objectSpread(_objectSpread({}, detail || item), {}, {
276
- _params: e
277
- })
278
- });
279
- case 8:
280
- data = _context.sent;
281
- // 创建预约
282
- createBooking({
283
- booking: data
284
- });
285
- return _context.abrupt("return");
286
- case 11:
287
- // info2 addService 逻辑
288
- _detail = detail || item;
289
- other = JSON.parse(JSON.stringify(e));
290
- other.session = e.session;
291
- cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
292
- product_id: item.id,
293
- _id: getUniqueId(),
294
- _key: e.key,
295
- _extend: {
296
- start_date: state.date.value,
297
- quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
298
- price: _detail.price,
299
- product_name: item.title,
300
- other: other
301
- },
302
- new: 1
303
- });
304
- _total = getProductTotalPrice(cacheItem); // 用于折扣 可修改
305
- cacheItem._extend.total = _total;
306
- // 用于储存原价
307
- cacheItem._extend.origin_total = _total;
308
- _isEdit = !!state.service.cacheItem;
309
- if (_isEdit) {
310
- cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
311
- cacheItem.new = 0;
312
- }
313
- // 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
314
- if (renderMode === 'current') {
315
- // cacheItem._extend.resource = 0;
316
- cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
317
- }
318
- cacheItem = getProductExtend({
319
- cacheItem: cacheItem,
320
- state: state,
321
- isDisabledTime: true
322
- });
323
- if (state.renderType === 'eventBooking') {
324
- cacheItem.autoClose = false;
325
- }
326
- if (cacheItem.autoClose) {
327
- cacheItem.autoClose = false;
328
- cacheItem._serviceKey = genServiceKey(cacheItem);
329
- _addService2 = addService(_toConsumableArray(state.service.value), cacheItem, state), _list = _addService2.list, quantity = _addService2.quantity;
330
- handleAddToast(cacheItem.title, quantity || 1);
331
- addServiceScroll(e.rowKey, cacheItem);
332
- try {
333
- if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
334
- val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
335
- return {
336
- product_id: s === null || s === void 0 ? void 0 : s.product_id,
337
- detailId: s === null || s === void 0 ? void 0 : s.id,
338
- detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
339
- product_name: s === null || s === void 0 ? void 0 : s.title,
340
- price: s === null || s === void 0 ? void 0 : s.price,
341
- _id: s === null || s === void 0 ? void 0 : s._id,
342
- _key: s === null || s === void 0 ? void 0 : s._key,
343
- _serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
344
- };
345
- });
346
- sendData = {
347
- product_id: item === null || item === void 0 ? void 0 : item.id,
348
- detailId: _detail === null || _detail === void 0 ? void 0 : _detail.id,
349
- detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
350
- product_name: item === null || item === void 0 ? void 0 : item.title,
351
- price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
352
- serviceVal: val
353
- };
354
- sendWarningLog({
355
- title: 'addService',
356
- content: [{
357
- key: '添加数据',
358
- value: JSON.stringify(sendData)
359
- }, {
360
- key: '日期',
361
- value: dayjs().format('YYYY-MM-DD HH:mm:ss')
362
- }]
363
- });
364
- }
365
- } catch (error) {}
366
- dispatch({
367
- type: 'setService',
368
- payload: {
369
- addModal: false,
370
- value: _list,
371
- edit: true,
372
- changeService: false
373
- }
374
- });
375
- } else {
376
- dispatch({
377
- type: 'setService',
378
- payload: {
379
- editModal: true,
380
- cacheItem: cacheItem,
381
- addModal: !cacheItem.autoClose,
382
- changeService: false
383
- }
384
- });
385
- onEdit === null || onEdit === void 0 || onEdit(cacheItem);
386
- }
387
- case 24:
388
- case "end":
389
- return _context.stop();
390
- }
391
- }, _callee);
392
- }));
393
- function callback(_x, _x2, _x3) {
394
- return _callback.apply(this, arguments);
395
- }
396
- return callback;
397
- }()
417
+ callback: callback
398
418
  });
399
419
  });
400
420
  var renderList = useMemo(function () {
@@ -451,6 +471,6 @@ var AddSerivce = function AddSerivce(props) {
451
471
  }));
452
472
  }
453
473
  return null;
454
- }, [(_state$service2 = state.service) === null || _state$service2 === void 0 || (_state$service2 = _state$service2.cacheItem) === null || _state$service2 === void 0 ? void 0 : _state$service2.autoClose, state.service.addModal, locales, renderList, state.amountSymbol, state.renderType, state === null || state === void 0 ? void 0 : state.activeCartId, holderId(state), loading, currentProduct, isBooking4]);
474
+ }, [state.service.addModal, locales, renderList, state.amountSymbol, state.renderType, state === null || state === void 0 ? void 0 : state.activeCartId, holderId(state), loading, currentProduct, isBooking4]);
455
475
  };
456
476
  export default AddSerivce;