@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
@@ -22,6 +22,7 @@ import { checkBeforeAddToCartApi } from "./serve";
22
22
  import { useCustomer } from "../Customer";
23
23
  import { useRequest } from 'ahooks';
24
24
  import { formatValues } from "../Checkout/utils";
25
+ import { handleCartItemOrigin, handleProductInfo } from "./utils";
25
26
  var defaultState = {
26
27
  cartItems: [],
27
28
  currentCartItem: null
@@ -158,6 +159,7 @@ export var CartProvider = function CartProvider(_ref) {
158
159
  * @Date: 2025-01-20 13:00
159
160
  */
160
161
  var createCartItemFromEvent = function createCartItemFromEvent(eventItem) {
162
+ console.log('eventItem>>>>>>', eventItem);
161
163
  var _getCurrentData = getCurrentData(),
162
164
  resourceData = _getCurrentData.resourceData,
163
165
  holderData = _getCurrentData.holderData;
@@ -253,29 +255,37 @@ export var CartProvider = function CartProvider(_ref) {
253
255
  var createCartItemData = function createCartItemData() {
254
256
  var _cartData = getCurrentData().cartData;
255
257
  if (_cartData.currentCartItem) {
256
- var _eventItem$eventDetai, _eventItem$eventDetai2, _startDateInfo$times, _eventItem$eventDetai3, _endDateInfo$times, _eventItem$eventDetai4;
258
+ var _eventDetail$bookingO, _eventItem$eventDetai, _startDateInfo$times, _eventItem$eventDetai2, _endDateInfo$times, _eventItem$eventDetai3;
257
259
  var _ref2 = _cartData.currentCartItem || {},
258
260
  _id = _ref2._id,
259
261
  _ref2$eventItem = _ref2.eventItem,
260
262
  _eventItem = _ref2$eventItem === void 0 ? {} : _ref2$eventItem,
261
263
  _ref2$holderItem = _ref2.holderItem,
262
264
  _holderItem = _ref2$holderItem === void 0 ? {} : _ref2$holderItem;
263
- var bookingOptionData = _eventItem === null || _eventItem === void 0 || (_eventItem$eventDetai = _eventItem.eventDetail) === null || _eventItem$eventDetai === void 0 || (_eventItem$eventDetai = _eventItem$eventDetai.bookingOptionItem) === null || _eventItem$eventDetai === void 0 ? void 0 : _eventItem$eventDetai._originData;
265
+ var eventDetail = _eventItem === null || _eventItem === void 0 ? void 0 : _eventItem.eventDetail;
266
+ var bookingOptionData = eventDetail === null || eventDetail === void 0 || (_eventDetail$bookingO = eventDetail.bookingOptionItem) === null || _eventDetail$bookingO === void 0 ? void 0 : _eventDetail$bookingO._originData;
267
+ console.log('eventDetail>>>>>>', eventDetail);
268
+
264
269
  // 活动开始日期相关信息
265
- var startDateInfo = _eventItem === null || _eventItem === void 0 || (_eventItem$eventDetai2 = _eventItem.eventDetail) === null || _eventItem$eventDetai2 === void 0 || (_eventItem$eventDetai2 = _eventItem$eventDetai2.selectDate) === null || _eventItem$eventDetai2 === void 0 ? void 0 : _eventItem$eventDetai2.startDateInfo;
270
+ var startDateInfo = _eventItem === null || _eventItem === void 0 || (_eventItem$eventDetai = _eventItem.eventDetail) === null || _eventItem$eventDetai === void 0 || (_eventItem$eventDetai = _eventItem$eventDetai.selectDate) === null || _eventItem$eventDetai === void 0 ? void 0 : _eventItem$eventDetai.startDateInfo;
266
271
  var startTime = startDateInfo === null || startDateInfo === void 0 || (_startDateInfo$times = startDateInfo.times) === null || _startDateInfo$times === void 0 || (_startDateInfo$times = _startDateInfo$times[0]) === null || _startDateInfo$times === void 0 ? void 0 : _startDateInfo$times.start_at;
267
- var endDateInfo = _eventItem === null || _eventItem === void 0 || (_eventItem$eventDetai3 = _eventItem.eventDetail) === null || _eventItem$eventDetai3 === void 0 || (_eventItem$eventDetai3 = _eventItem$eventDetai3.selectDate) === null || _eventItem$eventDetai3 === void 0 ? void 0 : _eventItem$eventDetai3.endDateInfo;
272
+ var endDateInfo = _eventItem === null || _eventItem === void 0 || (_eventItem$eventDetai2 = _eventItem.eventDetail) === null || _eventItem$eventDetai2 === void 0 || (_eventItem$eventDetai2 = _eventItem$eventDetai2.selectDate) === null || _eventItem$eventDetai2 === void 0 ? void 0 : _eventItem$eventDetai2.endDateInfo;
268
273
  var endTime = endDateInfo === null || endDateInfo === void 0 || (_endDateInfo$times = endDateInfo.times) === null || _endDateInfo$times === void 0 || (_endDateInfo$times = _endDateInfo$times.slice(-1)) === null || _endDateInfo$times === void 0 || (_endDateInfo$times = _endDateInfo$times[0]) === null || _endDateInfo$times === void 0 ? void 0 : _endDateInfo$times.end_at;
269
- var originTotal = Number((bookingOptionData === null || bookingOptionData === void 0 ? void 0 : bookingOptionData.original_price) || '');
274
+ var num = 1;
275
+ var _handleProductInfo = handleProductInfo(eventDetail, num),
276
+ totalPrice = _handleProductInfo.totalPrice,
277
+ originTotal = _handleProductInfo.originTotal,
278
+ is_charge_tax = _handleProductInfo.is_charge_tax;
270
279
  var newCartItem = {
271
280
  _id: _id,
272
281
  id: _eventItem.id,
273
282
  name: _eventItem.title,
274
- price: bookingOptionData === null || bookingOptionData === void 0 ? void 0 : bookingOptionData.price,
275
- total: bookingOptionData === null || bookingOptionData === void 0 ? void 0 : bookingOptionData.price,
283
+ price: totalPrice,
284
+ // eventBooking中售价和总价保持一致,因为数量为1
285
+ total: totalPrice,
276
286
  // 排除原始价格为0的场景
277
- origin_total: isNaN(originTotal) || originTotal === 0 ? undefined : bookingOptionData === null || bookingOptionData === void 0 ? void 0 : bookingOptionData.original_price,
278
- num: 1,
287
+ origin_total: isNaN(originTotal) || originTotal === 0 ? undefined : originTotal,
288
+ num: num,
279
289
  image: _eventItem.image,
280
290
  isShowNote: true,
281
291
  note: '',
@@ -290,12 +300,12 @@ export var CartProvider = function CartProvider(_ref) {
290
300
  // 是否显示时间
291
301
  show_time: true,
292
302
  end_time: endTime ? dayjs(endTime || '').format('HH:mm') : '',
293
- custom_day_count: (_eventItem === null || _eventItem === void 0 || (_eventItem$eventDetai4 = _eventItem.eventDetail) === null || _eventItem$eventDetai4 === void 0 || (_eventItem$eventDetai4 = _eventItem$eventDetai4.selectDate) === null || _eventItem$eventDetai4 === void 0 || (_eventItem$eventDetai4 = _eventItem$eventDetai4.dates) === null || _eventItem$eventDetai4 === void 0 ? void 0 : _eventItem$eventDetai4.length) || 0,
294
- is_charge_tax: bookingOptionData === null || bookingOptionData === void 0 ? void 0 : bookingOptionData.is_charge_tax,
303
+ custom_day_count: (_eventItem === null || _eventItem === void 0 || (_eventItem$eventDetai3 = _eventItem.eventDetail) === null || _eventItem$eventDetai3 === void 0 || (_eventItem$eventDetai3 = _eventItem$eventDetai3.selectDate) === null || _eventItem$eventDetai3 === void 0 || (_eventItem$eventDetai3 = _eventItem$eventDetai3.dates) === null || _eventItem$eventDetai3 === void 0 ? void 0 : _eventItem$eventDetai3.length) || 0,
304
+ is_charge_tax: is_charge_tax,
295
305
  _originData: _objectSpread(_objectSpread({}, _cartData.currentCartItem._originData), {}, {
296
306
  product: {
297
307
  num: 1,
298
- product_id: bookingOptionData.id,
308
+ product_id: bookingOptionData === null || bookingOptionData === void 0 ? void 0 : bookingOptionData.id,
299
309
  note: '',
300
310
  // eventdetail 获取
301
311
  product_bundle: [],
@@ -311,8 +321,11 @@ export var CartProvider = function CartProvider(_ref) {
311
321
  end_time_text: endTime ? dayjs(endTime || '').format('HH:mm') : null
312
322
  },
313
323
  event_unique_identifier: _id // 传递给接口用于商品可用性检测的比对
314
- })
324
+ }),
325
+ _productDetail: eventDetail.productDetail
315
326
  };
327
+ var originData = handleCartItemOrigin(newCartItem, eventDetail);
328
+ newCartItem._originData = originData;
316
329
  if (_holderItem !== null && _holderItem !== void 0 && _holderItem._originData) {
317
330
  var _getUserInfo, _holderItem$_originDa, _holderItem$_originDa2, _holderItem$_originDa3;
318
331
  newCartItem._originData.holder = {
@@ -17,3 +17,15 @@ export interface IUnavailableResult {
17
17
  * 更新失效的购物车商品
18
18
  */
19
19
  export declare type TUpdateDisabledCartItem = (list: Array<IUnavailableResult>) => void;
20
+ export interface ICalculatePriceParams {
21
+ /** 商品 */
22
+ product: any;
23
+ /** 规格 */
24
+ variant?: any;
25
+ /** 套餐 */
26
+ bundle?: any[];
27
+ /** 规格 */
28
+ options?: any[];
29
+ /** 数量 */
30
+ num?: number;
31
+ }
@@ -0,0 +1,23 @@
1
+ import { ICalculatePriceParams } from './types';
2
+ export declare const handleProductInfo: (eventDetail: any, num: number) => {
3
+ totalPrice: number;
4
+ originTotal: any;
5
+ is_charge_tax: any;
6
+ };
7
+ /**
8
+ * 获取商品总价
9
+ * @description 当前总价计算基于商品数量为1
10
+ * @param item 商品
11
+ * @returns 商品总价
12
+ */
13
+ export declare const getTotalPrice: (params: ICalculatePriceParams) => number;
14
+ /**
15
+ * 获取商品原始总价
16
+ * @description 当前总价计算基于商品数量为1
17
+ * @param item 商品
18
+ * @returns 商品原始总价
19
+ */
20
+ export declare const getOriginTotalPrice: (params: ICalculatePriceParams) => number | undefined;
21
+ export declare const handleCartItemOrigin: (cartItem: any, eventDetail: any) => any;
22
+ export declare const formatBundleToOrigin: (bundle: any) => any;
23
+ export declare const formatOptionsToOrigin: (options: any) => any;
@@ -0,0 +1,161 @@
1
+ export var handleProductInfo = function handleProductInfo(eventDetail, num) {
2
+ var productDetail = eventDetail.productDetail,
3
+ bookingOptionItem = eventDetail.bookingOptionItem;
4
+ var normalProduct = bookingOptionItem === null || bookingOptionItem === void 0 ? void 0 : bookingOptionItem._originData;
5
+ var totalPrice = Number((normalProduct === null || normalProduct === void 0 ? void 0 : normalProduct.price) || '');
6
+ var originTotal = Number((normalProduct === null || normalProduct === void 0 ? void 0 : normalProduct.original_price) || '');
7
+ var is_charge_tax = normalProduct === null || normalProduct === void 0 ? void 0 : normalProduct.is_charge_tax;
8
+ if (productDetail) {
9
+ var origin = productDetail.origin,
10
+ bundle = productDetail.bundle,
11
+ options = productDetail.options,
12
+ product_variant_id = productDetail.product_variant_id;
13
+ var variant = null;
14
+
15
+ // 如果是组合规格,需要单独处理
16
+ if (product_variant_id) {
17
+ var _origin$variant, _variant;
18
+ variant = origin === null || origin === void 0 || (_origin$variant = origin.variant) === null || _origin$variant === void 0 ? void 0 : _origin$variant.find(function (item) {
19
+ return (item === null || item === void 0 ? void 0 : item.id) === product_variant_id;
20
+ });
21
+ is_charge_tax = (_variant = variant) === null || _variant === void 0 ? void 0 : _variant.is_charge_tax;
22
+ }
23
+ var params = {
24
+ product: origin,
25
+ variant: variant,
26
+ bundle: bundle,
27
+ options: options,
28
+ num: num
29
+ };
30
+ totalPrice = getTotalPrice(params);
31
+ originTotal = getOriginTotalPrice(params);
32
+ }
33
+ return {
34
+ totalPrice: totalPrice,
35
+ originTotal: originTotal,
36
+ is_charge_tax: is_charge_tax
37
+ };
38
+ };
39
+
40
+ /**
41
+ * 获取商品总价
42
+ * @description 当前总价计算基于商品数量为1
43
+ * @param item 商品
44
+ * @returns 商品总价
45
+ */
46
+ export var getTotalPrice = function getTotalPrice(params) {
47
+ var product = params.product,
48
+ bundle = params.bundle,
49
+ options = params.options,
50
+ variant = params.variant;
51
+ var num = params.num || 1;
52
+ var price = Number(product.price);
53
+
54
+ // 组合规格
55
+ if (variant) {
56
+ price = Number(variant === null || variant === void 0 ? void 0 : variant.price);
57
+ }
58
+
59
+ // 套餐
60
+ if (bundle !== null && bundle !== void 0 && bundle.length) {
61
+ price = bundle.reduce(function (accumulator, currentValue) {
62
+ return accumulator + Number(currentValue.price) * Number(currentValue.num);
63
+ }, price);
64
+ }
65
+
66
+ // 单规格
67
+ if (options !== null && options !== void 0 && options.length) {
68
+ price = options.reduce(function (accumulator, currentValue) {
69
+ return accumulator + Number(currentValue.price) * Number(currentValue.num);
70
+ }, price);
71
+ }
72
+ return price * num;
73
+ };
74
+
75
+ /**
76
+ * 获取商品原始总价
77
+ * @description 当前总价计算基于商品数量为1
78
+ * @param item 商品
79
+ * @returns 商品原始总价
80
+ */
81
+ export var getOriginTotalPrice = function getOriginTotalPrice(params) {
82
+ var product = params.product,
83
+ bundle = params.bundle,
84
+ options = params.options,
85
+ variant = params.variant;
86
+ var num = (params === null || params === void 0 ? void 0 : params.num) || 1;
87
+ var price = Number(product.original_price);
88
+
89
+ // 组合规格
90
+ if (variant) {
91
+ price = Number(variant === null || variant === void 0 ? void 0 : variant.original_price);
92
+ }
93
+ if (isNaN(price) || price === 0) {
94
+ return undefined;
95
+ }
96
+
97
+ // 套餐
98
+ if (bundle !== null && bundle !== void 0 && bundle.length) {
99
+ price = bundle.reduce(function (accumulator, currentValue) {
100
+ return accumulator + Number(currentValue.price) * Number(currentValue.num);
101
+ }, price);
102
+ }
103
+
104
+ // 单规格
105
+ if (options !== null && options !== void 0 && options.length) {
106
+ price = options.reduce(function (accumulator, currentValue) {
107
+ return accumulator + Number(currentValue.price) * Number(currentValue.num);
108
+ }, price);
109
+ }
110
+ return price * num;
111
+ };
112
+ export var handleCartItemOrigin = function handleCartItemOrigin(cartItem, eventDetail) {
113
+ var productDetail = eventDetail.productDetail;
114
+ var originData = (cartItem === null || cartItem === void 0 ? void 0 : cartItem._originData) || {};
115
+ if (productDetail) {
116
+ var bundle = productDetail.bundle,
117
+ options = productDetail.options,
118
+ product_variant_id = productDetail.product_variant_id;
119
+ if (!originData.product) {
120
+ originData.product = {};
121
+ }
122
+ if (product_variant_id) {
123
+ originData.product.product_variant_id = product_variant_id;
124
+ }
125
+ if (bundle !== null && bundle !== void 0 && bundle.length) {
126
+ originData.product.product_bundle = formatBundleToOrigin(bundle);
127
+ }
128
+ if (options !== null && options !== void 0 && options.length) {
129
+ originData.product.product_option_item = formatOptionsToOrigin(options);
130
+ }
131
+ }
132
+ console.log('originData>>>>>>', originData);
133
+ return originData;
134
+ };
135
+ export var formatBundleToOrigin = function formatBundleToOrigin(bundle) {
136
+ if (!(bundle !== null && bundle !== void 0 && bundle.length)) return [];
137
+ return bundle.map(function (d) {
138
+ return {
139
+ bundle_group_id: d.group_id,
140
+ bundle_id: d.id,
141
+ bundle_product_id: (d === null || d === void 0 ? void 0 : d._bundle_product_id) || (d === null || d === void 0 ? void 0 : d.product_id),
142
+ bundle_variant_id: d.bundle_variant_id,
143
+ num: d.num,
144
+ extension_id: d.extension_id,
145
+ extension_type: d.extension_type,
146
+ option: formatOptionsToOrigin(d.option)
147
+ };
148
+ });
149
+ };
150
+ export var formatOptionsToOrigin = function formatOptionsToOrigin(options) {
151
+ if (!(options !== null && options !== void 0 && options.length)) {
152
+ return [];
153
+ }
154
+ return options.map(function (d) {
155
+ return {
156
+ num: d.num,
157
+ option_group_item_id: d.product_option_item_id,
158
+ option_group_id: d.option_group_id
159
+ };
160
+ });
161
+ };
@@ -24,4 +24,12 @@ export declare const formatProductBundle: (bundle: any) => any;
24
24
  * @Author: xiangfeng.xue
25
25
  * @Date: 2025-01-21 17:57
26
26
  */
27
- export declare const formatValues: (state: any, excludeDisabled?: boolean) => any;
27
+ export declare const formatValues: (state: any, excludeDisabled?: boolean, otherValue?: Record<string, any>) => any;
28
+ /**
29
+ * @title: 获取拉开表单弹窗参数
30
+ * @param state
31
+ */
32
+ export declare const getFormParams: (state: any) => {
33
+ product_id: any;
34
+ appointment_type: string;
35
+ };
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  /**
2
8
  * @title: 套餐单规格信息
3
9
  * @description:
@@ -78,8 +84,8 @@ var formatBookings = function formatBookings(list) {
78
84
  * @Author: xiangfeng.xue
79
85
  * @Date: 2025-01-21 17:57
80
86
  */
81
- export var formatValues = function formatValues(state, excludeDisabled) {
82
- var values = {
87
+ export var formatValues = function formatValues(state, excludeDisabled, otherValue) {
88
+ var values = _objectSpread({
83
89
  type: 'event_booking_v2',
84
90
  platform: 'H5',
85
91
  sales_channel: 'my_pisel',
@@ -87,7 +93,7 @@ export var formatValues = function formatValues(state, excludeDisabled) {
87
93
  bookings: [],
88
94
  shop_note: '',
89
95
  schedule_date: ''
90
- };
96
+ }, otherValue || {});
91
97
  var data = [];
92
98
  if (excludeDisabled) {
93
99
  var _state$cartData$cartI, _state$cartData$cartI2;
@@ -101,4 +107,20 @@ export var formatValues = function formatValues(state, excludeDisabled) {
101
107
  // 服务
102
108
  values.bookings = formatBookings(data);
103
109
  return values;
110
+ };
111
+
112
+ /**
113
+ * @title: 获取拉开表单弹窗参数
114
+ * @param state
115
+ */
116
+ export var getFormParams = function getFormParams(state) {
117
+ var _state$cartData;
118
+ var product_id = ((state === null || state === void 0 || (_state$cartData = state.cartData) === null || _state$cartData === void 0 ? void 0 : _state$cartData.cartItems) || []).map(function (item) {
119
+ var _item$_originData;
120
+ return (_item$_originData = item._originData) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.product) === null || _item$_originData === void 0 ? void 0 : _item$_originData.product_id;
121
+ });
122
+ return {
123
+ product_id: product_id,
124
+ appointment_type: "event_booking_v2"
125
+ };
104
126
  };
@@ -12,6 +12,8 @@ interface EventDetailContextType {
12
12
  data?: any;
13
13
  };
14
14
  currentBookingOption: any;
15
+ selectEventDetailProductDetail: (productDetail: any) => void;
16
+ checkBeforeSelectEventDetail: () => boolean;
15
17
  }
16
18
  interface EventDetailProviderProps {
17
19
  children: React.ReactNode;
@@ -46,11 +46,15 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
46
46
  var _useEvent = useEvent(),
47
47
  selectEvent = _useEvent.selectEvent;
48
48
  var customer = useLoginUser();
49
+ var currentBookingOptionRef = useRef(null);
49
50
  var _setDetail = function _setDetail(detailData) {
50
51
  detailRef.current = _objectSpread(_objectSpread({}, detailRef.current || {}), detailData || {});
51
- console.log(detailRef.current, '55555555');
52
52
  setDetail(_objectSpread({}, detailRef.current));
53
53
  };
54
+ var _setCurrentBookingOption = function _setCurrentBookingOption(id) {
55
+ currentBookingOptionRef.current = id;
56
+ setCurrentBookingOption(id);
57
+ };
54
58
  var onOpenEventDetail = function onOpenEventDetail(eventItem) {
55
59
  var _eventItem$_originDat;
56
60
  setOpen(true);
@@ -74,7 +78,8 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
74
78
  num: 100,
75
79
  skip: 1,
76
80
  customer_id: customer === null || customer === void 0 ? void 0 : customer.id,
77
- open_quotation: 1
81
+ open_quotation: 1,
82
+ is_eject: 1
78
83
  });
79
84
  getEventDetailSelectDate.run(eventItem.id, {
80
85
  days: 366
@@ -84,14 +89,22 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
84
89
  setOpen(false);
85
90
  _setDetail(null);
86
91
  detailRef.current = null;
92
+ setCurrentBookingOption(null);
93
+ currentBookingOptionRef.current = null;
87
94
  };
95
+
96
+ /**
97
+ * @title:选择活动详情
98
+ * @param productDetail 商品详情
99
+ */
88
100
  var onSelectEventDetail = function onSelectEventDetail() {
89
- var _detail$bookingOption;
101
+ var _detail$bookingOption, _detailRef$current;
90
102
  selectEvent(_objectSpread(_objectSpread({}, eventRef.current), {}, {
91
- eventDetail: _objectSpread(_objectSpread({}, detail), {}, {
103
+ eventDetail: _objectSpread(_objectSpread({}, detailRef.current || {}), {}, {
92
104
  bookingOptionItem: (_detail$bookingOption = detail.bookingOptions) === null || _detail$bookingOption === void 0 || (_detail$bookingOption = _detail$bookingOption.filter(function (v) {
93
- return v.value === currentBookingOption;
94
- })) === null || _detail$bookingOption === void 0 ? void 0 : _detail$bookingOption[0]
105
+ return v.value === currentBookingOptionRef.current;
106
+ })) === null || _detail$bookingOption === void 0 ? void 0 : _detail$bookingOption[0],
107
+ productDetail: (_detailRef$current = detailRef.current) === null || _detailRef$current === void 0 ? void 0 : _detailRef$current.productDetail
95
108
  })
96
109
  }));
97
110
  onCloseEventDetail();
@@ -122,11 +135,11 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
122
135
  var getEventDetailSelectDate = useRequest(getEventDetailSelectDateApi, {
123
136
  manual: true,
124
137
  onSuccess: function onSuccess(res) {
125
- var _detailRef$current, _detailRef$current2;
138
+ var _detailRef$current2, _detailRef$current3;
126
139
  var data = res.data;
127
140
  var dates = _toConsumableArray(data.dates || []);
128
- var startDateInfo = (_detailRef$current = detailRef.current) === null || _detailRef$current === void 0 || (_detailRef$current = _detailRef$current.selectDate) === null || _detailRef$current === void 0 ? void 0 : _detailRef$current.startDateInfo;
129
- var endDateInfo = (_detailRef$current2 = detailRef.current) === null || _detailRef$current2 === void 0 || (_detailRef$current2 = _detailRef$current2.selectDate) === null || _detailRef$current2 === void 0 ? void 0 : _detailRef$current2.endDateInfo;
141
+ var startDateInfo = (_detailRef$current2 = detailRef.current) === null || _detailRef$current2 === void 0 || (_detailRef$current2 = _detailRef$current2.selectDate) === null || _detailRef$current2 === void 0 ? void 0 : _detailRef$current2.startDateInfo;
142
+ var endDateInfo = (_detailRef$current3 = detailRef.current) === null || _detailRef$current3 === void 0 || (_detailRef$current3 = _detailRef$current3.selectDate) === null || _detailRef$current3 === void 0 ? void 0 : _detailRef$current3.endDateInfo;
130
143
  var selectDate = {
131
144
  dates: dates,
132
145
  _originData: {
@@ -188,13 +201,14 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
188
201
  var list = ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [];
189
202
  var current = null;
190
203
  var bookingOptions = list.map(function (v) {
204
+ var _current;
191
205
  var option = {
192
206
  value: v.id,
193
207
  label: v.title,
194
208
  price: v.price,
195
209
  _originData: v
196
210
  };
197
- if (!current || current.price > v.price) {
211
+ if (!current || Number(((_current = current) === null || _current === void 0 ? void 0 : _current.price) || 0) > Number(v.price || 0)) {
198
212
  current = _objectSpread({}, option);
199
213
  }
200
214
  return option;
@@ -217,9 +231,36 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
217
231
  introduction: _objectSpread(_objectSpread({}, introduction), {}, {
218
232
  price: option.price,
219
233
  origin_price: option.original_price
220
- })
234
+ }),
235
+ selectedProduct: option // 选中的活动关联的商品
221
236
  });
222
- setCurrentBookingOption(id);
237
+ _setCurrentBookingOption(id);
238
+ };
239
+
240
+ /**
241
+ * @title: 选择商品详情
242
+ * @param {any} productDetail 商品详情
243
+ */
244
+ var selectEventDetailProductDetail = function selectEventDetailProductDetail(productDetail) {
245
+ _setDetail({
246
+ productDetail: productDetail
247
+ });
248
+ };
249
+
250
+ /**
251
+ * @title: 校验is_eject为1的商品是否有拉起商品详情弹窗选中过
252
+ * @returns boolean
253
+ */
254
+ var checkBeforeSelectEventDetail = function checkBeforeSelectEventDetail() {
255
+ var _selectedProduct$_ori;
256
+ var _ref3 = detailRef.current || {},
257
+ selectedProduct = _ref3.selectedProduct,
258
+ productDetail = _ref3.productDetail;
259
+ console.log('selectedProduct', selectedProduct, productDetail);
260
+ if ((selectedProduct === null || selectedProduct === void 0 || (_selectedProduct$_ori = selectedProduct._originData) === null || _selectedProduct$_ori === void 0 ? void 0 : _selectedProduct$_ori.is_eject) === 1 && !productDetail) {
261
+ return false;
262
+ }
263
+ return true;
223
264
  };
224
265
  var contextValue = {
225
266
  detail: detail,
@@ -229,7 +270,9 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
229
270
  onSelectEventDetail: onSelectEventDetail,
230
271
  selectEventDetailBookingOptions: selectEventDetailBookingOptions,
231
272
  getEventDetailSelectDate: getEventDetailSelectDate,
232
- currentBookingOption: currentBookingOption
273
+ currentBookingOption: currentBookingOption,
274
+ selectEventDetailProductDetail: selectEventDetailProductDetail,
275
+ checkBeforeSelectEventDetail: checkBeforeSelectEventDetail
233
276
  };
234
277
  return /*#__PURE__*/React.createElement(EventDetailContext.Provider, {
235
278
  value: contextValue
@@ -22,8 +22,18 @@ export declare const getEventDetailBookingOptionsApi: (params: {
22
22
  skip: number;
23
23
  customer_id?: number;
24
24
  open_quotation?: number;
25
+ is_eject?: number;
25
26
  }) => Promise<any>;
26
27
  export declare const getEventDetailSelectDateApi: (id: number | string, params: {
27
28
  days: number;
28
29
  start_date?: string;
29
30
  }) => Promise<any>;
31
+ /**
32
+ * 批量查询指定商品的最新价格
33
+ * @param params
34
+ */
35
+ export declare const getProductPrice: (params: {
36
+ ids: number[];
37
+ customer_id: number;
38
+ schedule_date?: string;
39
+ }) => Promise<any>;
@@ -1,3 +1,7 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
1
5
  import { request } from "../../../utils";
2
6
  /**
3
7
  * @title: 获取活动列表
@@ -30,4 +34,25 @@ export var getEventDetailSelectDateApi = function getEventDetailSelectDateApi(id
30
34
  return request.getRequest().get("/h5/eventbookingv2/available-count/".concat(id), params, {
31
35
  useCache: true
32
36
  });
33
- };
37
+ };
38
+
39
+ /**
40
+ * 批量查询指定商品的最新价格
41
+ * @param params
42
+ */
43
+ export var getProductPrice = /*#__PURE__*/function () {
44
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
45
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
46
+ while (1) switch (_context.prev = _context.next) {
47
+ case 0:
48
+ return _context.abrupt("return", request.getRequest().post("/h5/product/query/price", params));
49
+ case 1:
50
+ case "end":
51
+ return _context.stop();
52
+ }
53
+ }, _callee);
54
+ }));
55
+ return function getProductPrice(_x) {
56
+ return _ref.apply(this, arguments);
57
+ };
58
+ }();
@@ -31,6 +31,7 @@ export var calculateTaxFee = function calculateTaxFee(shopInfo, items) {
31
31
  var _ref = shopInfo || {},
32
32
  is_price_include_tax = _ref.is_price_include_tax,
33
33
  tax_rate = _ref.tax_rate;
34
+ console.log('shopInfo>>>', is_price_include_tax, tax_rate);
34
35
  var totalTaxFee = items.reduce(function (sum, item) {
35
36
  var price = new Decimal(item.price || 0);
36
37
  var taxRate = new Decimal(tax_rate || 0).div(100);