@pisell/private-materials 3.3.34 → 3.3.35

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 (148) 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.css +1 -1
  6. package/build/lowcode/render/default/view.js +3 -3
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +5 -5
  9. package/es/components/Sales/Cart/index.js +26 -13
  10. package/es/components/Sales/Cart/types.d.ts +12 -0
  11. package/es/components/Sales/Cart/utils.d.ts +23 -0
  12. package/es/components/Sales/Cart/utils.js +161 -0
  13. package/es/components/Sales/Checkout/utils.d.ts +9 -1
  14. package/es/components/Sales/Checkout/utils.js +25 -3
  15. package/es/components/Sales/Event/Detail.d.ts +2 -0
  16. package/es/components/Sales/Event/Detail.js +56 -13
  17. package/es/components/Sales/Event/serve.d.ts +10 -0
  18. package/es/components/Sales/Event/serve.js +26 -1
  19. package/es/components/Sales/Summary/utils.js +1 -0
  20. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +18 -17
  21. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
  22. package/es/components/appointmentBooking/components/Cart/Item/index.js +21 -20
  23. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +156 -53
  24. package/es/components/appointmentBooking/components/ConfirmInformation/utils.d.ts +12 -0
  25. package/es/components/appointmentBooking/components/ConfirmInformation/utils.js +17 -0
  26. package/es/components/appointmentBooking/components/Content/index.d.ts +0 -1
  27. package/es/components/appointmentBooking/components/Content/index.js +26 -25
  28. package/es/components/appointmentBooking/components/Content/index.less +23 -1
  29. package/es/components/appointmentBooking/components/Footer/index.js +5 -5
  30. package/es/components/appointmentBooking/components/Header/index.d.ts +0 -1
  31. package/es/components/appointmentBooking/components/Header/index.js +7 -7
  32. package/es/components/appointmentBooking/components/Services/index.js +50 -25
  33. package/es/components/appointmentBooking/hooks.d.ts +2 -1
  34. package/es/components/appointmentBooking/hooks.js +52 -47
  35. package/es/components/appointmentBooking/index.d.ts +0 -1
  36. package/es/components/booking/components/TabProduct/index.d.ts +0 -1
  37. package/es/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
  38. package/es/components/booking/components/footer/index.d.ts +0 -1
  39. package/es/components/booking/deposit/index.d.ts +0 -1
  40. package/es/components/booking/forms/single/index.d.ts +0 -1
  41. package/es/components/booking/info/addServiceVariant/index.d.ts +0 -1
  42. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
  43. package/es/components/booking/info/date/index.d.ts +0 -1
  44. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  45. package/es/components/booking/info/index.d.ts +0 -1
  46. package/es/components/booking/info/service/Lists.d.ts +0 -1
  47. package/es/components/booking/info/service/actions/index.d.ts +0 -1
  48. package/es/components/booking/info/service/addService/index.d.ts +0 -1
  49. package/es/components/booking/info/service/addTimeModal/index.d.ts +0 -1
  50. package/es/components/booking/info/service/serviceList/index.d.ts +0 -1
  51. package/es/components/booking/info/service2/Lists.d.ts +0 -1
  52. package/es/components/booking/info2/service/actions/index.d.ts +0 -1
  53. package/es/components/booking/info2/service/addService/index.d.ts +0 -1
  54. package/es/components/booking/info2/service/addTimeModal/index.d.ts +0 -1
  55. package/es/components/booking/info2/service/serviceList/index.d.ts +0 -1
  56. package/es/components/booking/materiels/duration/index.d.ts +0 -1
  57. package/es/components/booking/materiels/holder/index.d.ts +0 -1
  58. package/es/components/booking/materiels/startTime/index.d.ts +0 -1
  59. package/es/components/booking/utils.d.ts +2 -2
  60. package/es/components/booking/utils.js +19 -11
  61. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +218 -73
  62. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
  63. package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  64. package/es/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
  65. package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
  66. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +3 -1
  67. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js +7 -4
  68. package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
  69. package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
  70. package/es/components/eventBooking/components/bookingDetailModal/index.js +70 -13
  71. package/es/components/eventBooking/index.d.ts +0 -1
  72. package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
  73. package/es/components/productExtension/fields/Forms/index.d.ts +0 -1
  74. package/es/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
  75. package/es/components/productExtension/index.d.ts +0 -1
  76. package/es/components/productSelect/components/TabProduct/index.js +4 -2
  77. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  78. package/es/components/ticketBooking/index.d.ts +0 -1
  79. package/lib/components/Sales/Cart/index.js +30 -18
  80. package/lib/components/Sales/Cart/types.d.ts +12 -0
  81. package/lib/components/Sales/Cart/utils.d.ts +23 -0
  82. package/lib/components/Sales/Cart/utils.js +149 -0
  83. package/lib/components/Sales/Checkout/utils.d.ts +9 -1
  84. package/lib/components/Sales/Checkout/utils.js +18 -4
  85. package/lib/components/Sales/Event/Detail.d.ts +2 -0
  86. package/lib/components/Sales/Event/Detail.js +34 -10
  87. package/lib/components/Sales/Event/serve.d.ts +10 -0
  88. package/lib/components/Sales/Event/serve.js +5 -2
  89. package/lib/components/Sales/Summary/utils.js +1 -0
  90. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +3 -3
  91. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
  92. package/lib/components/appointmentBooking/components/Cart/Item/index.js +1 -1
  93. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +43 -6
  94. package/lib/components/appointmentBooking/components/ConfirmInformation/utils.d.ts +12 -0
  95. package/lib/components/appointmentBooking/components/ConfirmInformation/utils.js +37 -0
  96. package/lib/components/appointmentBooking/components/Content/index.d.ts +0 -1
  97. package/lib/components/appointmentBooking/components/Content/index.js +7 -7
  98. package/lib/components/appointmentBooking/components/Content/index.less +23 -1
  99. package/lib/components/appointmentBooking/components/Header/index.d.ts +0 -1
  100. package/lib/components/appointmentBooking/components/Header/index.js +5 -3
  101. package/lib/components/appointmentBooking/components/Services/index.js +18 -10
  102. package/lib/components/appointmentBooking/hooks.d.ts +2 -1
  103. package/lib/components/appointmentBooking/hooks.js +9 -3
  104. package/lib/components/appointmentBooking/index.d.ts +0 -1
  105. package/lib/components/booking/components/TabProduct/index.d.ts +0 -1
  106. package/lib/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
  107. package/lib/components/booking/components/footer/index.d.ts +0 -1
  108. package/lib/components/booking/deposit/index.d.ts +0 -1
  109. package/lib/components/booking/forms/single/index.d.ts +0 -1
  110. package/lib/components/booking/info/addServiceVariant/index.d.ts +0 -1
  111. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
  112. package/lib/components/booking/info/date/index.d.ts +0 -1
  113. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  114. package/lib/components/booking/info/index.d.ts +0 -1
  115. package/lib/components/booking/info/service/Lists.d.ts +0 -1
  116. package/lib/components/booking/info/service/actions/index.d.ts +0 -1
  117. package/lib/components/booking/info/service/addService/index.d.ts +0 -1
  118. package/lib/components/booking/info/service/addTimeModal/index.d.ts +0 -1
  119. package/lib/components/booking/info/service/serviceList/index.d.ts +0 -1
  120. package/lib/components/booking/info/service2/Lists.d.ts +0 -1
  121. package/lib/components/booking/info2/service/actions/index.d.ts +0 -1
  122. package/lib/components/booking/info2/service/addService/index.d.ts +0 -1
  123. package/lib/components/booking/info2/service/addTimeModal/index.d.ts +0 -1
  124. package/lib/components/booking/info2/service/serviceList/index.d.ts +0 -1
  125. package/lib/components/booking/materiels/duration/index.d.ts +0 -1
  126. package/lib/components/booking/materiels/holder/index.d.ts +0 -1
  127. package/lib/components/booking/materiels/startTime/index.d.ts +0 -1
  128. package/lib/components/booking/utils.d.ts +2 -2
  129. package/lib/components/booking/utils.js +5 -1
  130. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +128 -42
  131. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
  132. package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  133. package/lib/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
  134. package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
  135. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +3 -1
  136. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js +7 -2
  137. package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
  138. package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
  139. package/lib/components/eventBooking/components/bookingDetailModal/index.js +79 -24
  140. package/lib/components/eventBooking/index.d.ts +0 -1
  141. package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
  142. package/lib/components/productExtension/fields/Forms/index.d.ts +0 -1
  143. package/lib/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
  144. package/lib/components/productExtension/index.d.ts +0 -1
  145. package/lib/components/productSelect/components/TabProduct/index.js +6 -2
  146. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  147. package/lib/components/ticketBooking/index.d.ts +0 -1
  148. package/package.json +4 -4
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./index.less";
3
2
  declare const Actions: ({ currentService }: {
4
3
  currentService: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PisellDrawerProps } from '../../../components/drawer';
3
2
  import './index.less';
4
3
  interface AddServiceProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const AddTimeModal: () => JSX.Element;
4
3
  export default AddTimeModal;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const ServiceList: ({ onEdit }: {
4
3
  onEdit: any;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const Lists: ({ onEdit, onChange }: any) => JSX.Element;
3
2
  export default Lists;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import '../../../info/service/actions/index.less';
3
2
  declare const Actions: ({ currentService }: {
4
3
  currentService: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PisellDrawerProps } from '../../../components/drawer';
3
2
  import '../../../info/service/addService/index.less';
4
3
  interface AddServiceProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import '../../../info/service/addTimeModal/index.less';
3
2
  declare const AddTimeModal: () => JSX.Element;
4
3
  export default AddTimeModal;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const ServiceList: ({ onEdit }: {
4
3
  onEdit: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SelectProps } from 'antd';
3
2
  interface DurationProps extends SelectProps {
4
3
  locale?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SelectProps } from 'antd';
3
2
  interface HolderProps extends SelectProps {
4
3
  selectProps?: SelectProps;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SelectProps } from "antd";
3
2
  interface StartTimeProps extends SelectProps {
4
3
  locale?: string;
@@ -163,10 +163,10 @@ export declare const getProductTotalPrice: (item: any) => number;
163
163
  export declare const getDuration: (duration: number | {
164
164
  type: string;
165
165
  value: number;
166
- }) => number | {
166
+ }) => number | "flexible" | {
167
167
  type: string;
168
168
  value: number;
169
- } | "flexible";
169
+ };
170
170
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
171
171
  export declare const getIsEdit: (state: any) => boolean;
172
172
  export {};
@@ -230,6 +230,9 @@ var formatProductListByCategory = (list, filterItem) => {
230
230
  return Object.values(categoryObject).sort((a, b) => b.sort - a.sort);
231
231
  };
232
232
  var getResourceTimeIsUsable = (item, cacheItem) => {
233
+ var _a;
234
+ const isEdit = !!cacheItem.booking_id;
235
+ const isCurrentRelation = item.item_id === ((_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.relation_id);
233
236
  const startDate = (0, import_dayjs.default)(
234
237
  cacheItem._extend.start_date.format("YYYY-MM-DD") + " " + getServeStartTime(cacheItem._extend.start_time)
235
238
  );
@@ -240,7 +243,8 @@ var getResourceTimeIsUsable = (item, cacheItem) => {
240
243
  if (time.max_participants_limit == 0) {
241
244
  isMaxLimitRange = true;
242
245
  } else {
243
- isMaxLimitRange = time.order_event_count < time.max_participants_limit;
246
+ const orderEventCount = isEdit && isCurrentRelation ? time.order_event_count - 1 : time.order_event_count;
247
+ isMaxLimitRange = orderEventCount < time.max_participants_limit;
244
248
  }
245
249
  const timeStartDate = (0, import_dayjs.default)(time.start_date + " " + time.start_time).subtract(
246
250
  1,
@@ -61,59 +61,145 @@ var ContinueButton = () => {
61
61
  const [openEmptyHolder, setOpenEmptyHolder] = (0, import_react.useState)(false);
62
62
  const { setData, removeSessionStorage } = (0, import_Sales.useSales)();
63
63
  const context = (0, import_useEngineContext.default)();
64
- const { store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
64
+ const { store, action, getStore } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
65
65
  const handleCheckout = async () => {
66
- var _a2;
67
- const value = (0, import_utils2.formatValues)(data);
68
- const result = await onCheckout(value);
69
- if (result == null ? void 0 : result.success) {
70
- removeSessionStorage();
71
- } else {
72
- (0, import_materials.PisellToast)({
73
- content: ((_a2 = result == null ? void 0 : result.err) == null ? void 0 : _a2.message) || ""
74
- });
75
- }
66
+ const params = (0, import_utils2.getFormParams)(data);
67
+ action == null ? void 0 : action({
68
+ type: "pisell1.goProductForm",
69
+ data: params,
70
+ callback: async (e) => {
71
+ var _a2;
72
+ const value = (0, import_utils2.formatValues)(data, false, {
73
+ relation_forms: e
74
+ });
75
+ const result = await onCheckout(value);
76
+ if (result == null ? void 0 : result.success) {
77
+ removeSessionStorage();
78
+ } else {
79
+ (0, import_materials.PisellToast)({
80
+ content: ((_a2 = result == null ? void 0 : result.err) == null ? void 0 : _a2.message) || ""
81
+ });
82
+ }
83
+ }
84
+ });
76
85
  };
77
- const getEventDetailBookingOptions = (0, import_ahooks.useRequest)(
78
- import_serve.getEventDetailBookingOptionsApi,
79
- {
80
- manual: true,
81
- onSuccess: (res) => {
86
+ const _getProductPrice = (0, import_ahooks.useRequest)(import_serve.getProductPrice, {
87
+ manual: true,
88
+ onSuccess: (res) => {
89
+ const list = res.data || [];
90
+ const productById = list.reduce((pre, cur) => {
91
+ pre[cur.id] = cur;
92
+ return pre;
93
+ }, {});
94
+ console.log("start update price");
95
+ const newCartItems = cartData.cartItems.map((item) => {
82
96
  var _a2;
83
- const list = ((_a2 = res.data) == null ? void 0 : _a2.list) || [];
84
- const productById = list.reduce((pre, cur) => {
85
- pre[cur.id] = cur;
86
- return pre;
87
- }, {});
88
- const newCartItems = cartData.cartItems.map((item) => {
89
- const { product } = item._originData || {};
90
- let newProduct = productById[product.product_id];
91
- item.price = newProduct.price;
92
- item.total = newProduct.price;
97
+ const { product } = item._originData || {};
98
+ let newProduct = productById[product.product_id];
99
+ let _totalPrice = Number(newProduct.price);
100
+ if (!(item == null ? void 0 : item._productDetail)) {
101
+ item.price = _totalPrice;
102
+ item.total = _totalPrice;
93
103
  return item;
94
- });
95
- setData({
96
- cartData: {
97
- ...cartData,
98
- cartItems: newCartItems
104
+ }
105
+ const { bundle = [], options } = item._productDetail;
106
+ if (product == null ? void 0 : product.product_variant_id) {
107
+ const { variant = [] } = newProduct;
108
+ const _variant = variant.find(
109
+ (v) => v.id === product.product_variant_id
110
+ );
111
+ if (_variant) {
112
+ _totalPrice = Number(_variant.price);
99
113
  }
100
- });
101
- }
114
+ } else if (
115
+ // 2. 套餐商品
116
+ Array.isArray(product == null ? void 0 : product.product_bundle) && product.product_bundle.length > 0
117
+ ) {
118
+ const { bundle_group = [] } = newProduct;
119
+ for (let i = 0; i < product.product_bundle.length; i++) {
120
+ const pbItem = product.product_bundle[i];
121
+ const { bundle_group_id, bundle_id, option } = pbItem;
122
+ const _originBundleItemInfo = bundle.find(
123
+ (bi) => bi.id === bundle_id
124
+ );
125
+ const _targetBundleGroup = bundle_group.find(
126
+ (bg) => bg.id === bundle_group_id
127
+ );
128
+ if ((_a2 = _targetBundleGroup == null ? void 0 : _targetBundleGroup.bundle_item) == null ? void 0 : _a2.length) {
129
+ let _newBundleItemInfo = _targetBundleGroup.bundle_item.find(
130
+ (bi) => bi.id === bundle_id
131
+ );
132
+ if ((_originBundleItemInfo == null ? void 0 : _originBundleItemInfo._bundle_product_id) === (_newBundleItemInfo == null ? void 0 : _newBundleItemInfo.bundle_product_id)) {
133
+ const {
134
+ price_type,
135
+ num = 0,
136
+ option: _originBundleItemOptions
137
+ } = _originBundleItemInfo;
138
+ const _bundleItemPrice = Number(_newBundleItemInfo.price);
139
+ if (price_type === "markup") {
140
+ _totalPrice += _bundleItemPrice * num;
141
+ } else if (price_type === "markdown") {
142
+ _totalPrice -= _bundleItemPrice * num;
143
+ } else {
144
+ _totalPrice += _bundleItemPrice * num;
145
+ }
146
+ if (Array.isArray(option) && (option == null ? void 0 : option.length) > 0) {
147
+ for (let j = 0; j < option.length; j++) {
148
+ const { option_group_item_id } = option[j];
149
+ const _originOptionItem = _originBundleItemOptions.find(
150
+ (op) => op.product_option_item_id === option_group_item_id
151
+ );
152
+ if (_originOptionItem) {
153
+ const { price, num: _optionNum = 0 } = _originOptionItem;
154
+ _totalPrice += Number(price) * _optionNum;
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
161
+ } else if (
162
+ // 3. 单规格商品
163
+ Array.isArray(product == null ? void 0 : product.product_option_item) && product.product_option_item.length > 0
164
+ ) {
165
+ for (let i = 0; i < product.product_option_item.length; i++) {
166
+ const { option_group_item_id } = product.product_option_item[i];
167
+ const _originOptionItem = options.find(
168
+ (op) => op.product_option_item_id === option_group_item_id
169
+ );
170
+ if (_originOptionItem) {
171
+ const { price, num = 0 } = _originOptionItem;
172
+ _totalPrice += Number(price) * num;
173
+ }
174
+ }
175
+ }
176
+ item.price = _totalPrice;
177
+ item.total = _totalPrice;
178
+ return item;
179
+ });
180
+ console.log("new cart data", newCartItems);
181
+ setData({
182
+ cartData: {
183
+ ...cartData,
184
+ cartItems: newCartItems
185
+ }
186
+ });
102
187
  }
103
- );
188
+ });
104
189
  const getCartItemProductsWithQuotation = async () => {
105
190
  var _a2, _b2;
106
191
  const ids = cartData.cartItems.map((item) => {
107
- const { product } = item._originData || {};
108
- return product == null ? void 0 : product.product_id;
192
+ const { product = {} } = item._originData || {};
193
+ const { product_id } = product;
194
+ return product_id;
109
195
  }).filter((id) => !!id);
110
- const customer = (_b2 = (_a2 = store == null ? void 0 : store.getState()) == null ? void 0 : _a2.global) == null ? void 0 : _b2.userInfo;
111
- getEventDetailBookingOptions.run({
196
+ const store2 = getStore();
197
+ const customer = (_b2 = (_a2 = store2 == null ? void 0 : store2.getState()) == null ? void 0 : _a2.global) == null ? void 0 : _b2.userInfo;
198
+ if (!(ids == null ? void 0 : ids.length)) return;
199
+ _getProductPrice.run({
112
200
  ids,
113
- num: 100,
114
- skip: 1,
115
- customer_id: customer == null ? void 0 : customer.id,
116
- open_quotation: 1
201
+ customer_id: customer == null ? void 0 : customer.id
202
+ // open_quotation: 1,
117
203
  });
118
204
  };
119
205
  const handleNextStep = async () => {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Cart: ({ open, onCancel }: any) => JSX.Element;
3
4
  export default Cart;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const Layout: () => JSX.Element;
4
3
  export default Layout;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const Header: () => JSX.Element;
4
3
  export default Header;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const SelectHolderModal: (props: any) => JSX.Element;
3
2
  export default SelectHolderModal;
@@ -1,2 +1,4 @@
1
- declare const BookingOptions: () => JSX.Element;
1
+ declare const BookingOptions: (props: {
2
+ onChangeBookingOption?: ((bookingOption: any) => void) | undefined;
3
+ }) => JSX.Element;
2
4
  export default BookingOptions;
@@ -37,9 +37,14 @@ var import_OpenCard = __toESM(require("../../OpenCard"));
37
37
  var import_materials = require("@pisell/materials");
38
38
  var import_utils = require("@pisell/utils");
39
39
  var import_Sales = require("../../../../Sales");
40
- var BookingOptions = () => {
40
+ var BookingOptions = (props) => {
41
41
  var _a, _b;
42
42
  const { detail, currentBookingOption, selectEventDetailBookingOptions } = (0, import_Sales.useEventDetail)();
43
+ const onChange = (value, item) => {
44
+ var _a2;
45
+ selectEventDetailBookingOptions(value);
46
+ (_a2 = props == null ? void 0 : props.onChangeBookingOption) == null ? void 0 : _a2.call(props, item);
47
+ };
43
48
  return /* @__PURE__ */ import_react.default.createElement(
44
49
  import_OpenCard.default,
45
50
  {
@@ -67,7 +72,7 @@ var BookingOptions = () => {
67
72
  }
68
73
  ));
69
74
  },
70
- onChange: (value) => selectEventDetailBookingOptions(value)
75
+ onChange
71
76
  }
72
77
  )
73
78
  );
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const Resource: (props: any) => JSX.Element;
3
2
  export default Resource;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const Schedule: () => JSX.Element;
3
2
  export default Schedule;
@@ -42,12 +42,21 @@ var import_Resource = __toESM(require("./components/Resource"));
42
42
  var import_BookingOptions = __toESM(require("./components/BookingOptions"));
43
43
  var import_OrderProductModal = __toESM(require("../Provider/OrderProductModal/index"));
44
44
  var import_index = require("./index.less");
45
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
45
46
  var BookingDetailModal = (props) => {
46
47
  var _a;
47
48
  const modalContentRef = (0, import_react.useRef)(null);
49
+ const context = (0, import_useEngineContext.default)();
50
+ const { utils } = context.appHelper || {};
48
51
  const tabsRef = (0, import_react.useRef)();
49
52
  const { open = false } = props;
50
- const { detail, onCloseEventDetail, onSelectEventDetail } = (0, import_Sales.useEventDetail)();
53
+ const {
54
+ detail,
55
+ onCloseEventDetail,
56
+ onSelectEventDetail,
57
+ selectEventDetailProductDetail,
58
+ checkBeforeSelectEventDetail
59
+ } = (0, import_Sales.useEventDetail)();
51
60
  const { addToCart, checkBeforeAddToCart, checkBeforeAddToCartResquest } = (0, import_Sales.useCart)();
52
61
  const [activeTab, setActiveTab] = (0, import_react.useState)("introduction");
53
62
  const [isScrolling, setIsScrolling] = (0, import_react.useState)(false);
@@ -175,34 +184,80 @@ var BookingDetailModal = (props) => {
175
184
  }
176
185
  };
177
186
  const content = () => {
178
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-detail-modal-content", style: { height: (0, import_utils.isMobile)() ? "100%" : "calc(80vh - 146px)" } }, /* @__PURE__ */ import_react.default.createElement("div", { className: "anchor-wrapper" }, /* @__PURE__ */ import_react.default.createElement(
179
- import_materials.PisellAnchor,
187
+ return /* @__PURE__ */ import_react.default.createElement(
188
+ "div",
180
189
  {
181
- ref: tabsRef,
182
- options: anchorOptions,
183
- containerRef: modalContentRef,
184
- tab: activeTab,
185
- onChange: (key) => {
186
- handleTabChange(key);
187
- },
188
- onTabClick: () => {
189
- isUserClickRef.current = true;
190
+ className: "booking-detail-modal-content",
191
+ style: { height: (0, import_utils.isMobile)() ? "100%" : "calc(80vh - 146px)" }
192
+ },
193
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "anchor-wrapper" }, /* @__PURE__ */ import_react.default.createElement(
194
+ import_materials.PisellAnchor,
195
+ {
196
+ ref: tabsRef,
197
+ options: anchorOptions,
198
+ containerRef: modalContentRef,
199
+ tab: activeTab,
200
+ onChange: (key) => {
201
+ handleTabChange(key);
202
+ },
203
+ onTabClick: () => {
204
+ isUserClickRef.current = true;
205
+ }
190
206
  }
207
+ )),
208
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "content-wrapper", ref: modalContentRef }, /* @__PURE__ */ import_react.default.createElement("div", { "data-section": "introduction", className: "content-section" }, (images == null ? void 0 : images.length) > 0 ? /* @__PURE__ */ import_react.default.createElement(
209
+ import_materials.PisellImageCarousels,
210
+ {
211
+ dataSource: images,
212
+ width: "100%",
213
+ height: (0, import_utils.isMobile)() ? 300 : 400,
214
+ showArrows: !(0, import_utils.isMobile)(),
215
+ showDots: (images == null ? void 0 : images.length) > 1,
216
+ autoplay: (images == null ? void 0 : images.length) > 1,
217
+ loop: false
218
+ }
219
+ ) : null, /* @__PURE__ */ import_react.default.createElement(import_eventCard.default, { data: detail == null ? void 0 : detail.introduction })), /* @__PURE__ */ import_react.default.createElement("div", { "data-section": "schedule", className: "content-section" }, /* @__PURE__ */ import_react.default.createElement(import_Schedule.default, null)), /* @__PURE__ */ import_react.default.createElement("div", { "data-section": "resource", className: "content-section" }, /* @__PURE__ */ import_react.default.createElement(import_Resource.default, null)), /* @__PURE__ */ import_react.default.createElement("div", { "data-section": "booking_options", className: "content-section" }, /* @__PURE__ */ import_react.default.createElement(
220
+ import_BookingOptions.default,
221
+ {
222
+ onChangeBookingOption: checkToOpenProductDetailModal
223
+ }
224
+ )))
225
+ );
226
+ };
227
+ const checkToOpenProductDetailModal = (bookingOption) => {
228
+ var _a2;
229
+ console.log(">>>>>>>", bookingOption);
230
+ if (((_a2 = bookingOption == null ? void 0 : bookingOption._originData) == null ? void 0 : _a2.is_eject) !== 1) {
231
+ return;
232
+ }
233
+ utils == null ? void 0 : utils.action({
234
+ type: "pisell1.productDetail",
235
+ data: {
236
+ detail: { ...(bookingOption == null ? void 0 : bookingOption._originData) || {} },
237
+ isOS: false
238
+ },
239
+ callback: (data) => {
240
+ if (data == null ? void 0 : data.isCancel) {
241
+ return;
242
+ }
243
+ console.log("data>>>>>>", data);
244
+ const product = {
245
+ ...data,
246
+ options: (data == null ? void 0 : data.option) || []
247
+ };
248
+ delete product.option;
249
+ selectEventDetailProductDetail(product);
250
+ handleOk();
191
251
  }
192
- )), /* @__PURE__ */ import_react.default.createElement("div", { className: "content-wrapper", ref: modalContentRef }, /* @__PURE__ */ import_react.default.createElement("div", { "data-section": "introduction", className: "content-section" }, (images == null ? void 0 : images.length) > 0 ? /* @__PURE__ */ import_react.default.createElement(
193
- import_materials.PisellImageCarousels,
194
- {
195
- dataSource: images,
196
- width: "100%",
197
- height: (0, import_utils.isMobile)() ? 300 : 400,
198
- showArrows: !(0, import_utils.isMobile)(),
199
- showDots: (images == null ? void 0 : images.length) > 1,
200
- autoplay: (images == null ? void 0 : images.length) > 1,
201
- loop: false
202
- }
203
- ) : null, /* @__PURE__ */ import_react.default.createElement(import_eventCard.default, { data: detail == null ? void 0 : detail.introduction })), /* @__PURE__ */ import_react.default.createElement("div", { "data-section": "schedule", className: "content-section" }, /* @__PURE__ */ import_react.default.createElement(import_Schedule.default, null)), /* @__PURE__ */ import_react.default.createElement("div", { "data-section": "resource", className: "content-section" }, /* @__PURE__ */ import_react.default.createElement(import_Resource.default, null)), /* @__PURE__ */ import_react.default.createElement("div", { "data-section": "booking_options", className: "content-section" }, /* @__PURE__ */ import_react.default.createElement(import_BookingOptions.default, null))));
252
+ });
204
253
  };
205
254
  const handleOk = async () => {
255
+ console.log(">>>>>>>", detail);
256
+ const result = checkBeforeSelectEventDetail();
257
+ if (!result) {
258
+ checkToOpenProductDetailModal(detail == null ? void 0 : detail.selectedProduct);
259
+ return;
260
+ }
206
261
  onSelectEventDetail();
207
262
  const checkRes = await checkBeforeAddToCart();
208
263
  if ((checkRes == null ? void 0 : checkRes.result) === false) {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const EventBooking: () => JSX.Element;
4
3
  export default EventBooking;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const Actor: ({ name }: {
3
2
  name: string;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface InfoProps {
3
2
  relation_id: any;
4
3
  action: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  interface valueType {
4
3
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./index.less";
3
2
  interface ProductExtensionProps {
4
3
  onDataChange: any;
@@ -58,7 +58,9 @@ var TabProduct = (props) => {
58
58
  (0, import_react.useEffect)(() => {
59
59
  if (list == null ? void 0 : list.length) {
60
60
  setCurrentGroupId(list[0].id);
61
- handleObserver();
61
+ requestAnimationFrame(() => {
62
+ handleObserver();
63
+ });
62
64
  }
63
65
  }, [list]);
64
66
  const handleObserver = (0, import_ahooks.useMemoizedFn)(() => {
@@ -142,7 +144,9 @@ var TabProduct = (props) => {
142
144
  tab: currentGroupId,
143
145
  onChange: (e) => {
144
146
  var _a;
145
- let comWrapper = document.querySelector(".pisell-product-select-wrapper");
147
+ let comWrapper = document.querySelector(
148
+ ".pisell-product-select-wrapper"
149
+ );
146
150
  let categoryDom = document.querySelector(
147
151
  ".pisell-product-select-tabs-wrapper"
148
152
  );
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const TicketBooking: () => JSX.Element;
4
3
  export default TicketBooking;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  interface TicketBookingProps {
4
3
  productExtensionType: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.3.34",
3
+ "version": "3.3.35",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,9 +60,9 @@
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/utils": "1.0.42",
63
- "@pisell/materials": "3.3.11",
64
- "@pisell/date-picker": "3.0.2",
65
- "@pisell/icon": "0.0.11"
63
+ "@pisell/materials": "3.3.12",
64
+ "@pisell/icon": "0.0.11",
65
+ "@pisell/date-picker": "3.0.2"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",