@pisell/private-materials 3.0.209 → 3.0.210

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 (67) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +6 -14
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +4 -4
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/Sales/Cart/index.d.ts +8 -5
  12. package/es/components/Sales/Cart/index.js +158 -37
  13. package/es/components/Sales/Cart/serve.d.ts +1 -0
  14. package/es/components/Sales/Cart/serve.js +5 -0
  15. package/es/components/Sales/Cart/types.d.ts +19 -0
  16. package/es/components/Sales/Cart/types.js +1 -0
  17. package/es/components/Sales/Checkout/index.js +3 -0
  18. package/es/components/booking/info/pet/index.js +3 -3
  19. package/es/components/booking/info/service2/utils.d.ts +1 -1
  20. package/es/components/eftposPay/amount.d.ts +1 -1
  21. package/es/components/eftposPay/app.d.ts +1 -1
  22. package/es/components/eftposPay/device.d.ts +1 -1
  23. package/es/components/eftposPay/store/index.d.ts +2 -2
  24. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +153 -37
  25. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +4 -0
  26. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.js +35 -0
  27. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.less +17 -0
  28. package/es/components/eventBooking/components/Provider/Event/index.js +8 -1
  29. package/es/components/eventBooking/components/Provider/OrderProductModal/index.js +12 -35
  30. package/es/components/eventBooking/components/Provider/Resource/index.js +22 -11
  31. package/es/components/eventBooking/components/Provider/SelectHolderModal.js +4 -1
  32. package/es/components/eventBooking/components/bookingDetailModal/index.js +55 -9
  33. package/es/components/eventBooking/components/progressBar/index.js +18 -2
  34. package/es/components/eventBooking/components/scheduleCalendar/calendarItem.js +8 -0
  35. package/es/components/eventBooking/index.js +1 -15
  36. package/es/components/eventBooking/locales.d.ts +33 -3
  37. package/es/components/eventBooking/locales.js +42 -6
  38. package/es/components/shoppingCart/components/Cart/Product.js +2 -2
  39. package/lib/components/Sales/Cart/index.d.ts +8 -5
  40. package/lib/components/Sales/Cart/index.js +97 -13
  41. package/lib/components/Sales/Cart/serve.d.ts +1 -0
  42. package/lib/components/Sales/Cart/serve.js +5 -0
  43. package/lib/components/Sales/Cart/types.d.ts +19 -0
  44. package/lib/components/Sales/Cart/types.js +17 -0
  45. package/lib/components/Sales/Checkout/index.js +1 -0
  46. package/lib/components/booking/info/pet/index.js +3 -3
  47. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  48. package/lib/components/eftposPay/amount.d.ts +1 -1
  49. package/lib/components/eftposPay/app.d.ts +1 -1
  50. package/lib/components/eftposPay/device.d.ts +1 -1
  51. package/lib/components/eftposPay/store/index.d.ts +2 -2
  52. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +62 -14
  53. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +4 -0
  54. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.js +61 -0
  55. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.less +17 -0
  56. package/lib/components/eventBooking/components/Provider/Event/index.js +20 -11
  57. package/lib/components/eventBooking/components/Provider/OrderProductModal/index.js +11 -26
  58. package/lib/components/eventBooking/components/Provider/Resource/index.js +12 -7
  59. package/lib/components/eventBooking/components/Provider/SelectHolderModal.js +2 -0
  60. package/lib/components/eventBooking/components/bookingDetailModal/index.js +21 -5
  61. package/lib/components/eventBooking/components/progressBar/index.js +8 -4
  62. package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.js +8 -0
  63. package/lib/components/eventBooking/index.js +0 -8
  64. package/lib/components/eventBooking/locales.d.ts +33 -3
  65. package/lib/components/eventBooking/locales.js +36 -6
  66. package/lib/components/shoppingCart/components/Cart/Product.js +2 -2
  67. package/package.json +4 -4
@@ -6,6 +6,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React, { useState } from 'react';
8
8
  import { PisellHeaderProgressBar, PisellModal } from '@pisell/materials';
9
+ import { useSales } from "../../../Sales";
9
10
  import { locales } from '@pisell/utils';
10
11
  import "./index.less";
11
12
  var ProgressBar = function ProgressBar(_ref) {
@@ -26,6 +27,8 @@ var ProgressBar = function ProgressBar(_ref) {
26
27
  _useState2 = _slicedToArray(_useState, 2),
27
28
  open = _useState2[0],
28
29
  setOpen = _useState2[1];
30
+ var _useSales = useSales(),
31
+ removeSessionStorage = _useSales.removeSessionStorage;
29
32
 
30
33
  /**
31
34
  * @title: 点击关闭
@@ -42,6 +45,20 @@ var ProgressBar = function ProgressBar(_ref) {
42
45
  onClose === null || onClose === void 0 ? void 0 : onClose();
43
46
  }
44
47
  };
48
+
49
+ /**
50
+ * @title: 点击退出
51
+ * @description:
52
+ * @return {*}
53
+ * @Author: WangHan
54
+ * @Date: 2025-02-10 17:46
55
+ */
56
+ var handleOk = function handleOk() {
57
+ onClose === null || onClose === void 0 ? void 0 : onClose();
58
+ setOpen(false);
59
+ // 清空数据
60
+ removeSessionStorage();
61
+ };
45
62
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellHeaderProgressBar, {
46
63
  className: "event-progress-bar",
47
64
  style: style,
@@ -69,8 +86,7 @@ var ProgressBar = function ProgressBar(_ref) {
69
86
  setOpen(false);
70
87
  },
71
88
  onOk: function onOk() {
72
- onClose === null || onClose === void 0 ? void 0 : onClose();
73
- setOpen(false);
89
+ return handleOk();
74
90
  }
75
91
  }));
76
92
  };
@@ -3,13 +3,20 @@ import dayjs from 'dayjs';
3
3
  import React, { useMemo } from 'react';
4
4
  import { Iconfont } from '@pisell/materials';
5
5
  import { formatBackgroundColors, formatMonthDisplay } from "../../utils";
6
+ import useEngineContext from "../../../../hooks/useEngineContext";
7
+ import zhCN from 'antd/es/date-picker/locale/zh_CN';
8
+ import enUS from 'antd/es/date-picker/locale/en_US';
6
9
  var CalendarItem = function CalendarItem(props) {
10
+ var _utils$storage, _utils$storage$get;
7
11
  var month = props.month,
8
12
  schedulesData = props.schedulesData,
9
13
  selectDate = props.selectDate,
10
14
  onSelect = props.onSelect,
11
15
  isEdit = props.isEdit,
12
16
  onChange = props.onChange;
17
+ var context = useEngineContext();
18
+ var utils = context.appHelper.utils || {};
19
+ var locale = utils !== null && utils !== void 0 && (_utils$storage = utils.storage) !== null && _utils$storage !== void 0 && (_utils$storage$get = _utils$storage.get('umi_locale')) !== null && _utils$storage$get !== void 0 && _utils$storage$get.includes('zh') ? zhCN : enUS;
13
20
  var scheduleMap = useMemo(function () {
14
21
  return new Map(schedulesData.map(function (schedule) {
15
22
  return [schedule.date, schedule];
@@ -54,6 +61,7 @@ var CalendarItem = function CalendarItem(props) {
54
61
  }, /*#__PURE__*/React.createElement(Iconfont, {
55
62
  type: "pisell2-chevron-right"
56
63
  }))), /*#__PURE__*/React.createElement(Calendar, {
64
+ locale: locale,
57
65
  headerRender: function headerRender() {
58
66
  return null;
59
67
  },
@@ -4,7 +4,7 @@ import Footer from "./components/Provider/Footer";
4
4
  import EventContent from "./components/Provider/Content";
5
5
  import { isMobile, locales } from '@pisell/utils';
6
6
  import useEngineContext from "../../hooks/useEngineContext";
7
- import SalesPage, { useInit, useStep, useResource, useCustomer, useSales } from "../Sales";
7
+ import SalesPage, { useInit, useStep, useResource, useSales } from "../Sales";
8
8
  import "./index.less";
9
9
  import localeTexts from "./locales";
10
10
  var Content = function Content() {
@@ -20,27 +20,13 @@ var Content = function Content() {
20
20
  currentStepData = _useStep.currentStepData;
21
21
  var _useResource = useResource(),
22
22
  getResourceList = _useResource.getResourceList;
23
- var _useCustomer = useCustomer(),
24
- openLoginModal = _useCustomer.openLoginModal,
25
- isLogin = _useCustomer.isLogin;
26
- var _useSales2 = useSales(),
27
- removeSessionStorage = _useSales2.removeSessionStorage;
28
23
  var _ref = data.initData || {},
29
24
  form_id = _ref.form_id,
30
25
  shop_id = _ref.shop_id;
31
26
  useEffect(function () {
32
- // 没有登录则打开登录弹窗
33
- if (!isLogin()) {
34
- openLoginModal({});
35
- }
36
27
  getBoardSetting.run({
37
28
  item_type: 'event_booking_v2'
38
29
  });
39
-
40
- // 清空数据
41
- return function () {
42
- removeSessionStorage();
43
- };
44
30
  }, []);
45
31
 
46
32
  /**
@@ -14,7 +14,7 @@ declare const _default: {
14
14
  'pisell2.event.close.exit': string;
15
15
  'pisell2.event.step': (step: number) => string;
16
16
  'pisell2.event.select.category': string;
17
- 'pisell2.event.select.campus': string;
17
+ 'pisell2.event.select.campus': (val: string) => string;
18
18
  'pisell2.event.select.event': string;
19
19
  'pisell2.event.cart': string;
20
20
  'pisell2.event.total': string;
@@ -58,6 +58,16 @@ declare const _default: {
58
58
  'pisell2.event.empty.event': string;
59
59
  'pisell2.event.error.holder': string;
60
60
  'pisell2.event.price.from': string;
61
+ 'pisell2.event.empty.holder.title': string;
62
+ 'pisell2.event.empty.holder.tip': string;
63
+ 'pisell2.event.empty.holder.continue.tip': string;
64
+ 'pisell2.event.empty.holder.go.back': string;
65
+ 'pisell2.event.empty.holder.continue.anyway': string;
66
+ 'pisell2.event.event.full.title': string;
67
+ 'pisell2.event.event.full.tip': string;
68
+ 'pisell2.event.event.full.ok': string;
69
+ 'pisell2.event.capacity.limit.reached.title': string;
70
+ 'pisell2.event.capacity.limit.reached.tip': string;
61
71
  };
62
72
  'zh-CN': {
63
73
  'pisell2.event.calendar.limit.unavailable': string;
@@ -75,7 +85,7 @@ declare const _default: {
75
85
  'pisell2.event.step': (step: number) => string;
76
86
  'pisell2.event.select.category': string;
77
87
  'pisell2.event.select.event': string;
78
- 'pisell2.event.select.campus': string;
88
+ 'pisell2.event.select.campus': (val: string) => string;
79
89
  'pisell2.event.cart': string;
80
90
  'pisell2.event.total': string;
81
91
  'pisell2.event.continue': string;
@@ -118,6 +128,16 @@ declare const _default: {
118
128
  'pisell2.event.empty.event': string;
119
129
  'pisell2.event.error.holder': string;
120
130
  'pisell2.event.price.from': string;
131
+ 'pisell2.event.empty.holder.title': string;
132
+ 'pisell2.event.empty.holder.tip': string;
133
+ 'pisell2.event.empty.holder.continue.tip': string;
134
+ 'pisell2.event.empty.holder.go.back': string;
135
+ 'pisell2.event.empty.holder.continue.anyway': string;
136
+ 'pisell2.event.event.full.title': string;
137
+ 'pisell2.event.event.full.tip': string;
138
+ 'pisell2.event.event.full.ok': string;
139
+ 'pisell2.event.capacity.limit.reached.title': string;
140
+ 'pisell2.event.capacity.limit.reached.tip': string;
121
141
  };
122
142
  'zh-HK': {
123
143
  'pisell2.event.calendar.limit.unavailable': string;
@@ -135,7 +155,7 @@ declare const _default: {
135
155
  'pisell2.event.step': (step: number) => string;
136
156
  'pisell2.event.select.category': string;
137
157
  'pisell2.event.select.event': string;
138
- 'pisell2.event.select.campus': string;
158
+ 'pisell2.event.select.campus': (val: string) => string;
139
159
  'pisell2.event.cart': string;
140
160
  'pisell2.event.total': string;
141
161
  'pisell2.event.continue': string;
@@ -178,6 +198,16 @@ declare const _default: {
178
198
  'pisell2.event.empty.event': string;
179
199
  'pisell2.event.error.holder': string;
180
200
  'pisell2.event.price.from': string;
201
+ 'pisell2.event.empty.holder.title': string;
202
+ 'pisell2.event.empty.holder.tip': string;
203
+ 'pisell2.event.empty.holder.continue.tip': string;
204
+ 'pisell2.event.empty.holder.go.back': string;
205
+ 'pisell2.event.empty.holder.continue.anyway': string;
206
+ 'pisell2.event.event.full.title': string;
207
+ 'pisell2.event.event.full.tip': string;
208
+ 'pisell2.event.event.full.ok': string;
209
+ 'pisell2.event.capacity.limit.reached.title': string;
210
+ 'pisell2.event.capacity.limit.reached.tip': string;
181
211
  };
182
212
  };
183
213
  export default _default;
@@ -16,7 +16,9 @@ export default {
16
16
  return "Step ".concat(step);
17
17
  },
18
18
  'pisell2.event.select.category': "Select category",
19
- 'pisell2.event.select.campus': "Please choose campus",
19
+ 'pisell2.event.select.campus': function pisell2EventSelectCampus(val) {
20
+ return "Please choose ".concat(val || 'resource');
21
+ },
20
22
  'pisell2.event.select.event': "Select event",
21
23
  'pisell2.event.cart': "Cart",
22
24
  'pisell2.event.total': "Total",
@@ -63,7 +65,17 @@ export default {
63
65
  'pisell2.event.create.form': "Create form",
64
66
  'pisell2.event.empty.event': "No event",
65
67
  'pisell2.event.error.holder': "You need to create a holder first",
66
- 'pisell2.event.price.from': 'From '
68
+ 'pisell2.event.price.from': 'From ',
69
+ 'pisell2.event.empty.holder.title': 'Empty holders found',
70
+ 'pisell2.event.empty.holder.tip': 'The following holders have no services added:',
71
+ 'pisell2.event.empty.holder.continue.tip': 'You can still proceed, but please check if you want to add any services.',
72
+ 'pisell2.event.empty.holder.go.back': 'Go back',
73
+ 'pisell2.event.empty.holder.continue.anyway': 'Continue anyway',
74
+ 'pisell2.event.event.full.title': 'Event full',
75
+ 'pisell2.event.event.full.tip': 'Sorry, this event has reached its maximum capacity. Please select another event.',
76
+ 'pisell2.event.event.full.ok': 'Ok',
77
+ 'pisell2.event.capacity.limit.reached.title': 'Capacity limit reached',
78
+ 'pisell2.event.capacity.limit.reached.tip': 'One or more events in your cart are no longer available due to full capacity. Please remove unavailable events from your cart to complete checkout.'
67
79
  },
68
80
  'zh-CN': {
69
81
  'pisell2.event.calendar.limit.unavailable': "不可预约",
@@ -83,7 +95,9 @@ export default {
83
95
  },
84
96
  'pisell2.event.select.category': "选择分类",
85
97
  'pisell2.event.select.event': "选择活动",
86
- 'pisell2.event.select.campus': "请选择校区",
98
+ 'pisell2.event.select.campus': function pisell2EventSelectCampus(val) {
99
+ return "\u8BF7\u9009\u62E9".concat(val || '资源');
100
+ },
87
101
  'pisell2.event.cart': "购物车",
88
102
  'pisell2.event.total': "总计",
89
103
  'pisell2.event.continue': "继续",
@@ -129,7 +143,17 @@ export default {
129
143
  'pisell2.event.create.form': "创建表单",
130
144
  'pisell2.event.empty.event': "暂无活动",
131
145
  'pisell2.event.error.holder': "您需要先创建一个持有人",
132
- 'pisell2.event.price.from': ' 起'
146
+ 'pisell2.event.price.from': ' 起',
147
+ 'pisell2.event.empty.holder.title': '发现空预约位',
148
+ 'pisell2.event.empty.holder.tip': '以下预约位未添加任何服务:',
149
+ 'pisell2.event.empty.holder.continue.tip': '您可以继续操作,但请确认是否需要添加服务。',
150
+ 'pisell2.event.empty.holder.go.back': '返回修改',
151
+ 'pisell2.event.empty.holder.continue.anyway': '继续操作',
152
+ 'pisell2.event.event.full.title': '活动已满',
153
+ 'pisell2.event.event.full.tip': '抱歉,当前活动名额已满。请选择其他活动。',
154
+ 'pisell2.event.event.full.ok': '好的',
155
+ 'pisell2.event.capacity.limit.reached.title': '活动名额已满',
156
+ 'pisell2.event.capacity.limit.reached.tip': '购物车中有一个或多个活动已达预约上限,请将已满额的活动从购物车中移除后再完成结算。'
133
157
  },
134
158
  'zh-HK': {
135
159
  'pisell2.event.calendar.limit.unavailable': "不可預約",
@@ -149,7 +173,9 @@ export default {
149
173
  },
150
174
  'pisell2.event.select.category': "選擇分類",
151
175
  'pisell2.event.select.event': "選擇活動",
152
- 'pisell2.event.select.campus': "請選擇校區",
176
+ 'pisell2.event.select.campus': function pisell2EventSelectCampus(val) {
177
+ return "\u8ACB\u9078\u64C7".concat(val || '資源');
178
+ },
153
179
  'pisell2.event.cart': "購物車",
154
180
  'pisell2.event.total': "總計",
155
181
  'pisell2.event.continue': "繼續",
@@ -195,6 +221,16 @@ export default {
195
221
  'pisell2.event.create.form': "創建表單",
196
222
  'pisell2.event.empty.event': "暫無活動",
197
223
  'pisell2.event.error.holder': "您需要先創建一個持有人",
198
- 'pisell2.event.price.from': ' 起'
224
+ 'pisell2.event.price.from': ' 起',
225
+ 'pisell2.event.empty.holder.title': '發現空預約位',
226
+ 'pisell2.event.empty.holder.tip': '以下預約位未添加任何服務:',
227
+ 'pisell2.event.empty.holder.continue.tip': '您可以繼續操作,但請確認是否需要添加服務。',
228
+ 'pisell2.event.empty.holder.go.back': '返回修改',
229
+ 'pisell2.event.empty.holder.continue.anyway': '繼續操作',
230
+ 'pisell2.event.event.full.title': '活動已滿',
231
+ 'pisell2.event.event.full.tip': '抱歉,當前活動名額已滿。請選擇其他活動。',
232
+ 'pisell2.event.event.full.ok': '好的',
233
+ 'pisell2.event.capacity.limit.reached.title': '活動名額已滿',
234
+ 'pisell2.event.capacity.limit.reached.tip': '購物車中有一個或多個活動已達預約上限,請將已滿額的活動從購物車中移除後再完成結算。'
199
235
  }
200
236
  };
@@ -30,7 +30,7 @@ var Product = function Product(props) {
30
30
  * @Date: 2024-11-28 22:02
31
31
  */
32
32
  var handleChange = function handleChange(item, type, other) {
33
- if (disabledEdit) return;
33
+ if (disabledEdit && !(other !== null && other !== void 0 && other.disabled)) return;
34
34
  onChange(item, type, other);
35
35
  };
36
36
  var productParams = useMemo(function () {
@@ -50,7 +50,7 @@ var Product = function Product(props) {
50
50
  return _onAction === null || _onAction === void 0 ? void 0 : _onAction(e);
51
51
  },
52
52
  onDelete: function onDelete(e) {
53
- return handleChange(e, 'delete');
53
+ return handleChange(e, 'delete', item);
54
54
  },
55
55
  onNote: function onNote(e) {
56
56
  return handleChange(e, 'note', {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { TUpdateDisabledCartItem } from './types';
2
3
  interface CartItem {
3
4
  _id: string;
4
5
  [key: string]: any;
@@ -27,11 +28,13 @@ interface CartContextType {
27
28
  addHolderToCartItem: (holderItem: any) => void;
28
29
  cartDataHolderList: any;
29
30
  addNoteToCartItem: (cartItem: CartItem) => void;
30
- updateDisabledCartItem: (params: Array<{
31
- relation_id: number;
32
- product_id: number;
33
- type: string;
34
- }>) => void;
31
+ updateDisabledCartItem: TUpdateDisabledCartItem;
32
+ getWithoutCartItemsHolderNames: () => Array<string>;
33
+ checkBeforeAddToCartResquest: any;
34
+ checkBeforeAddToCart: () => Promise<{
35
+ result: boolean;
36
+ num: number;
37
+ }>;
35
38
  }
36
39
  interface CartProviderProps {
37
40
  children: React.ReactNode;
@@ -39,7 +39,10 @@ var import_react = __toESM(require("react"));
39
39
  var import_dayjs = __toESM(require("dayjs"));
40
40
  var import_utils = require("@pisell/utils");
41
41
  var import_SalesModel = require("../../../businessModel/SalesModel");
42
+ var import_serve = require("./serve");
42
43
  var import_Customer = require("../Customer");
44
+ var import_ahooks = require("ahooks");
45
+ var import_utils2 = require("../Checkout/utils");
43
46
  var defaultState = {
44
47
  cartItems: [],
45
48
  currentCartItem: null
@@ -51,7 +54,7 @@ var CartProvider = ({ children }) => {
51
54
  const { appUtils, getUserInfo } = (0, import_Customer.useCustomer)();
52
55
  const { data, setData, hooks, getCurrentData } = (0, import_SalesModel.useSales)();
53
56
  const [openCart, setOpen] = (0, import_react.useState)(false);
54
- const {} = hooks;
57
+ const checkRef = (0, import_react.useRef)(null);
55
58
  const cartData = (0, import_react.useMemo)(() => {
56
59
  return data.cartData || defaultState;
57
60
  }, [data]);
@@ -178,23 +181,66 @@ var CartProvider = ({ children }) => {
178
181
  setCurrentCartItem(cartItem);
179
182
  return cartItem;
180
183
  };
181
- const addToCart = () => {
184
+ const checkBeforeAddToCartResquest = (0, import_ahooks.useRequest)(import_serve.checkBeforeAddToCartApi, {
185
+ manual: true,
186
+ onSuccess: (res) => {
187
+ var _a, _b;
188
+ if ((_a = res.data) == null ? void 0 : _a.length) {
189
+ const isUnavailable = checkCartItemIsUnavailable(
190
+ res.data,
191
+ checkRef.current.cartItem
192
+ );
193
+ checkRef.current.callback({
194
+ result: isUnavailable ? false : true,
195
+ num: isUnavailable ? (_b = res.data) == null ? void 0 : _b.length : 0
196
+ });
197
+ } else {
198
+ checkRef.current.callback({ result: true });
199
+ }
200
+ }
201
+ });
202
+ const checkBeforeAddToCart = () => {
203
+ return new Promise((resolve) => {
204
+ const _cartData = getCurrentData().cartData;
205
+ const newCartItem = createCartItemData() || {};
206
+ const params = (0, import_utils2.formatValues)({
207
+ cartData: {
208
+ cartItems: [..._cartData.cartItems || [], newCartItem]
209
+ }
210
+ });
211
+ checkRef.current = {
212
+ callback: (res) => {
213
+ resolve(res);
214
+ checkRef.current = null;
215
+ },
216
+ cartItem: newCartItem
217
+ };
218
+ checkBeforeAddToCartResquest.runAsync(params);
219
+ });
220
+ };
221
+ const createCartItemData = () => {
182
222
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
183
223
  const _cartData = getCurrentData().cartData;
184
- const { _id, eventItem = {}, holderItem = {} } = _cartData.currentCartItem;
185
224
  if (_cartData.currentCartItem) {
225
+ const {
226
+ _id,
227
+ eventItem = {},
228
+ holderItem = {}
229
+ } = _cartData.currentCartItem || {};
186
230
  const bookingOptionData = (_b = (_a = eventItem == null ? void 0 : eventItem.eventDetail) == null ? void 0 : _a.bookingOptionItem) == null ? void 0 : _b._originData;
187
231
  const startDateInfo = (_d = (_c = eventItem == null ? void 0 : eventItem.eventDetail) == null ? void 0 : _c.selectDate) == null ? void 0 : _d.startDateInfo;
188
232
  const startTime = (_f = (_e = startDateInfo == null ? void 0 : startDateInfo.times) == null ? void 0 : _e[0]) == null ? void 0 : _f.start_at;
189
233
  const endDateInfo = (_h = (_g = eventItem == null ? void 0 : eventItem.eventDetail) == null ? void 0 : _g.selectDate) == null ? void 0 : _h.endDateInfo;
190
234
  const endTime = (_k = (_j = (_i = endDateInfo == null ? void 0 : endDateInfo.times) == null ? void 0 : _i.slice(-1)) == null ? void 0 : _j[0]) == null ? void 0 : _k.end_at;
235
+ const originTotal = Number((bookingOptionData == null ? void 0 : bookingOptionData.original_price) || "");
191
236
  const newCartItem = {
192
237
  _id,
193
238
  id: eventItem.id,
194
239
  name: eventItem.title,
195
240
  price: bookingOptionData == null ? void 0 : bookingOptionData.price,
196
241
  total: bookingOptionData == null ? void 0 : bookingOptionData.price,
197
- origin_total: bookingOptionData == null ? void 0 : bookingOptionData.original_price,
242
+ // 排除原始价格为0的场景
243
+ origin_total: isNaN(originTotal) || originTotal === 0 ? void 0 : bookingOptionData == null ? void 0 : bookingOptionData.original_price,
198
244
  num: 1,
199
245
  image: eventItem.image,
200
246
  isShowNote: true,
@@ -228,7 +274,9 @@ var CartProvider = ({ children }) => {
228
274
  metadata: {
229
275
  end_date_text: (endDateInfo == null ? void 0 : endDateInfo.date) || null,
230
276
  end_time_text: endTime ? (0, import_dayjs.default)(endTime || "").format("HH:mm") : null
231
- }
277
+ },
278
+ event_unique_identifier: _id
279
+ // 传递给接口用于商品可用性检测的比对
232
280
  }
233
281
  };
234
282
  if (holderItem == null ? void 0 : holderItem._originData) {
@@ -238,8 +286,16 @@ var CartProvider = ({ children }) => {
238
286
  form_record: ((_n = holderItem == null ? void 0 : holderItem._originData) == null ? void 0 : _n.form_record_id) ? [(_o = holderItem == null ? void 0 : holderItem._originData) == null ? void 0 : _o.form_record_id] : null
239
287
  };
240
288
  }
289
+ return newCartItem;
290
+ }
291
+ return null;
292
+ };
293
+ const addToCart = () => {
294
+ const _cartData = getCurrentData().cartData;
295
+ const newCartItem = createCartItemData();
296
+ if (_cartData.currentCartItem && newCartItem) {
241
297
  setCartData({
242
- cartItems: [..._cartData.cartItems, newCartItem],
298
+ cartItems: [..._cartData.cartItems || [], newCartItem],
243
299
  currentCartItem: null
244
300
  });
245
301
  }
@@ -353,16 +409,30 @@ var CartProvider = ({ children }) => {
353
409
  }
354
410
  return null;
355
411
  };
412
+ const checkCartItemIsUnavailable = (list, item) => {
413
+ var _a, _b, _c, _d;
414
+ const productId = (_b = (_a = item._originData) == null ? void 0 : _a.product) == null ? void 0 : _b.product_id;
415
+ const relationId = (_c = item._originData) == null ? void 0 : _c.relation_id;
416
+ const eventUniqueIdentifier = (_d = item._originData) == null ? void 0 : _d.event_unique_identifier;
417
+ return list.find((res) => {
418
+ var _a2;
419
+ const checkType = ["available_capacity"];
420
+ const isTypeIncludes = ((_a2 = res.details) == null ? void 0 : _a2.find((v) => {
421
+ var _a3;
422
+ return (_a3 = checkType.includes) == null ? void 0 : _a3.call(checkType, v.type || "");
423
+ })) !== void 0;
424
+ if (isTypeIncludes) {
425
+ return res.product_id === productId && res.relation_id === relationId && res.event_unique_identifier === eventUniqueIdentifier;
426
+ }
427
+ return false;
428
+ }) !== void 0;
429
+ };
356
430
  const updateDisabledCartItem = (list) => {
357
431
  const currentCartItems = getCurrentData().cartData.cartItems || [];
358
432
  if ((list == null ? void 0 : list.length) && currentCartItems.length) {
359
433
  const newCartItems = currentCartItems.map((item) => {
360
- var _a, _b, _c;
361
- const productId = (_b = (_a = item._originData) == null ? void 0 : _a.product) == null ? void 0 : _b.product_id;
362
- const relationId = (_c = item._originData) == null ? void 0 : _c.relation_id;
363
- if (list.find(
364
- (v) => v.product_id === productId && v.relation_id === relationId
365
- ) !== void 0) {
434
+ const isUnavailable = checkCartItemIsUnavailable(list, item);
435
+ if (isUnavailable) {
366
436
  item.disabled = true;
367
437
  } else {
368
438
  item.disabled = false;
@@ -372,6 +442,17 @@ var CartProvider = ({ children }) => {
372
442
  setCartData({ cartItems: newCartItems });
373
443
  }
374
444
  };
445
+ const getWithoutCartItemsHolderNames = () => {
446
+ var _a;
447
+ const list = [];
448
+ (_a = cartDataHolderList == null ? void 0 : cartDataHolderList.forEach) == null ? void 0 : _a.call(cartDataHolderList, (v) => {
449
+ var _a2;
450
+ if (!((_a2 = v == null ? void 0 : v.children) == null ? void 0 : _a2.length)) {
451
+ list.push((v == null ? void 0 : v.name) || "");
452
+ }
453
+ });
454
+ return list;
455
+ };
375
456
  const contextValue = {
376
457
  createCartItem,
377
458
  createCartItemFromEvent,
@@ -392,7 +473,10 @@ var CartProvider = ({ children }) => {
392
473
  addHolderToCartItem,
393
474
  cartDataHolderList,
394
475
  addNoteToCartItem,
395
- updateDisabledCartItem
476
+ updateDisabledCartItem,
477
+ getWithoutCartItemsHolderNames,
478
+ checkBeforeAddToCartResquest,
479
+ checkBeforeAddToCart
396
480
  };
397
481
  return /* @__PURE__ */ import_react.default.createElement(CartContext.Provider, { value: contextValue }, children);
398
482
  };
@@ -1 +1,2 @@
1
1
  export declare const getResourceListApi: () => Promise<any>;
2
+ export declare const checkBeforeAddToCartApi: (data: any) => Promise<any>;
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/components/Sales/Cart/serve.ts
20
20
  var serve_exports = {};
21
21
  __export(serve_exports, {
22
+ checkBeforeAddToCartApi: () => checkBeforeAddToCartApi,
22
23
  getResourceListApi: () => getResourceListApi
23
24
  });
24
25
  module.exports = __toCommonJS(serve_exports);
@@ -26,7 +27,11 @@ var import_utils = require("../../../utils");
26
27
  var getResourceListApi = () => {
27
28
  return import_utils.request.getRequest().get("/api/resource/list", {});
28
29
  };
30
+ var checkBeforeAddToCartApi = (data) => {
31
+ return import_utils.request.getRequest().post("/h5/eventbookingv2/order/check-config", data);
32
+ };
29
33
  // Annotate the CommonJS export names for ESM import in node:
30
34
  0 && (module.exports = {
35
+ checkBeforeAddToCartApi,
31
36
  getResourceListApi
32
37
  });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * available_capacity(容量)、deadline_day(截止日期)、future_day(预定天数)
3
+ */
4
+ export declare type TCartItemUnavailableType = 'available_capacity' | 'deadline_day' | 'future_day';
5
+ /**
6
+ * 商品不可用原因
7
+ */
8
+ export interface IUnavailableResult {
9
+ event_unique_identifier: number;
10
+ relation_id: number;
11
+ product_id: number;
12
+ details?: Array<{
13
+ type: TCartItemUnavailableType;
14
+ }>;
15
+ }
16
+ /**
17
+ * 更新失效的购物车商品
18
+ */
19
+ export declare type TUpdateDisabledCartItem = (list: Array<IUnavailableResult>) => void;
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/components/Sales/Cart/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
@@ -70,6 +70,7 @@ var CheckoutProvider = ({
70
70
  manual: true,
71
71
  onSuccess: (res) => {
72
72
  onPay(res.data);
73
+ checkoutCallback.current({ success: true });
73
74
  }
74
75
  });
75
76
  const onCheckBeforeBooking = (data2) => {
@@ -75,7 +75,7 @@ var Pet = (props) => {
75
75
  return ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.appointment_subject) || {};
76
76
  }, [(_d = (_c = (_b = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _b.config) == null ? void 0 : _c.basic) == null ? void 0 : _d.appointment_subject]);
77
77
  const petForm = (0, import_react.useMemo)(() => {
78
- var _a2;
78
+ var _a2, _b2, _c2;
79
79
  let _holder = (_a2 = state.bookingConfig) == null ? void 0 : _a2.holder;
80
80
  if (!_holder) {
81
81
  return null;
@@ -84,8 +84,8 @@ var Pet = (props) => {
84
84
  ..._holder,
85
85
  ..._holder == null ? void 0 : _holder.form,
86
86
  options: [],
87
- form_id: _holder.form.id,
88
- field: _holder.form.form_field,
87
+ form_id: (_b2 = _holder == null ? void 0 : _holder.form) == null ? void 0 : _b2.id,
88
+ field: (_c2 = _holder == null ? void 0 : _holder.form) == null ? void 0 : _c2.form_field,
89
89
  relation_type: "appointment_booking",
90
90
  form_record: []
91
91
  };
@@ -237,4 +237,4 @@ export declare const updateAppointmentServicePrice: (state: any, { start_date, e
237
237
  * @Author: WangHan
238
238
  * @Date: 2024-12-24 11:32
239
239
  */
240
- export declare const updateServicePrice: (state: any) => never[] | Promise<any>;
240
+ export declare const updateServicePrice: (state: any) => Promise<any> | never[];
@@ -9,7 +9,7 @@ import { PosProps } from './const';
9
9
  */
10
10
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
11
11
  className?: string | undefined;
12
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
12
+ onChange?: ((status: "page" | "success" | "fail", params?: string | {
13
13
  [keys: string]: unknown;
14
14
  } | undefined, other?: any) => void) | undefined;
15
15
  onClose: () => void;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { PosProps, RouteType } from './const';
3
- declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "mode" | "type" | "getApi"> & {
3
+ declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "type" | "mode" | "getApi"> & {
4
4
  action: RouteType;
5
5
  device_number: string | number;
6
6
  api: ReturnType<PosProps['getApi']>;
@@ -11,7 +11,7 @@ import './device.less';
11
11
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
12
12
  api: PayProps['api'];
13
13
  className?: string | undefined;
14
- onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
14
+ onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
15
15
  [keys: string]: unknown;
16
16
  } | undefined, other?: any) => void) | undefined;
17
17
  onClose: () => void;
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "success" | "warn" | "loading" | "fail" | "question";
177
+ status: "loading" | "success" | "warn" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -308,7 +308,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "success" | "warn" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */