@pisell/private-materials 3.2.19 → 3.2.20
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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.js +3 -3
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +40 -70
- package/es/components/appointmentBooking/components/Cart/Item/Total.js +3 -5
- package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +3 -0
- package/es/components/appointmentBooking/components/Cart/Item/index.js +10 -6
- package/es/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Footer/index.js +4 -11
- package/es/components/appointmentBooking/components/Resource/index.js +13 -3
- package/es/components/appointmentBooking/components/Services/index.js +13 -1
- package/es/components/appointmentBooking/components/TimeSlicing/index.js +1 -1
- package/es/components/appointmentBooking/context.d.ts +4 -0
- package/es/components/appointmentBooking/context.js +14 -1
- package/es/components/appointmentBooking/hooks.d.ts +2 -1
- package/es/components/appointmentBooking/hooks.js +32 -3
- package/es/components/appointmentBooking/locales.d.ts +3 -0
- package/es/components/appointmentBooking/locales.js +6 -3
- package/es/components/appointmentBooking/utils.d.ts +1 -0
- package/es/components/appointmentBooking/utils.js +28 -0
- package/es/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/es/components/booking/info/date/index.d.ts +0 -1
- package/es/components/booking/info/dateRange/index.d.ts +0 -1
- package/es/components/booking/info/notes/index.d.ts +0 -1
- package/es/components/booking/info/service/actions/index.d.ts +0 -1
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
- package/es/components/booking/info/service/serviceItem/index.d.ts +0 -1
- package/es/components/booking/info/service/serviceList/index.d.ts +0 -1
- package/es/components/booking/info/service2/Lists.d.ts +0 -1
- package/es/components/booking/info/service2/utils.d.ts +240 -0
- package/es/components/booking/info/utils.js +1 -1
- package/es/components/booking/info2/service/actions/index.d.ts +0 -1
- package/es/components/booking/info2/service/serviceItem/index.d.ts +0 -1
- package/es/components/booking/info2/service/serviceList/index.d.ts +0 -1
- package/es/components/booking/materiels/duration/index.d.ts +0 -1
- package/es/components/booking/materiels/holder/index.d.ts +0 -1
- package/es/components/booking/materiels/startTime/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +3 -0
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Cart/Product.d.ts +0 -1
- package/es/components/shoppingCart/components/Cart/Product.js +7 -3
- package/es/components/shoppingCart/components/Cart/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/es/components/shoppingCart/index.d.ts +0 -1
- package/es/components/shoppingCart/status.js +2 -1
- package/es/components/shoppingCart/type.d.ts +2 -0
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +22 -15
- package/lib/components/appointmentBooking/components/Cart/Item/Total.js +2 -5
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +3 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +7 -4
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Footer/index.js +3 -8
- package/lib/components/appointmentBooking/components/Resource/index.js +15 -3
- package/lib/components/appointmentBooking/components/Services/index.js +5 -1
- package/lib/components/appointmentBooking/components/TimeSlicing/index.js +1 -1
- package/lib/components/appointmentBooking/context.d.ts +4 -0
- package/lib/components/appointmentBooking/context.js +10 -1
- package/lib/components/appointmentBooking/hooks.d.ts +2 -1
- package/lib/components/appointmentBooking/hooks.js +12 -2
- package/lib/components/appointmentBooking/locales.d.ts +3 -0
- package/lib/components/appointmentBooking/locales.js +6 -3
- package/lib/components/appointmentBooking/utils.d.ts +1 -0
- package/lib/components/appointmentBooking/utils.js +30 -0
- package/lib/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/lib/components/booking/info/date/index.d.ts +0 -1
- package/lib/components/booking/info/dateRange/index.d.ts +0 -1
- package/lib/components/booking/info/notes/index.d.ts +0 -1
- package/lib/components/booking/info/service/actions/index.d.ts +0 -1
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
- package/lib/components/booking/info/service/serviceItem/index.d.ts +0 -1
- package/lib/components/booking/info/service/serviceList/index.d.ts +0 -1
- package/lib/components/booking/info/service2/Lists.d.ts +0 -1
- package/lib/components/booking/info/service2/utils.d.ts +240 -0
- package/lib/components/booking/info/utils.js +1 -1
- package/lib/components/booking/info2/service/actions/index.d.ts +0 -1
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +0 -1
- package/lib/components/booking/info2/service/serviceList/index.d.ts +0 -1
- package/lib/components/booking/materiels/duration/index.d.ts +0 -1
- package/lib/components/booking/materiels/holder/index.d.ts +0 -1
- package/lib/components/booking/materiels/startTime/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +3 -0
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +0 -1
- package/lib/components/shoppingCart/components/Cart/Product.js +19 -3
- package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/lib/components/shoppingCart/index.d.ts +0 -1
- package/lib/components/shoppingCart/status.js +2 -1
- package/lib/components/shoppingCart/type.d.ts +2 -0
- package/package.json +4 -4
|
@@ -23,62 +23,31 @@ import { formatValues } from "../../../../Sales/Checkout/utils";
|
|
|
23
23
|
// import OrderProductModal from '../../OrderProductModal/index';
|
|
24
24
|
// import EmptyHolderModal from '../../EmptyHolderModal';
|
|
25
25
|
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
26
|
-
import {
|
|
26
|
+
import { useAppointmentBookingLogin } from "../../../hooks";
|
|
27
27
|
import { useAppointmentBookingContext } from "../../../context";
|
|
28
28
|
import "./index.less";
|
|
29
29
|
var ContinueButton = function ContinueButton() {
|
|
30
30
|
var context = useEngineContext();
|
|
31
|
-
// const { data } = useSales();
|
|
32
|
-
// const { onHolderOpen } = useHolder();
|
|
33
|
-
// const { checkHolder, onCloseCart, cartData, getWithoutCartItemsHolderNames } =
|
|
34
|
-
// useCart();
|
|
35
|
-
// const { currentStepData, nextStep, isLastStep } = useStep();
|
|
36
|
-
// const {
|
|
37
|
-
// onCheckout,
|
|
38
|
-
// createBooking,
|
|
39
|
-
// onCheckBeforeBooking,
|
|
40
|
-
// checkBeforeBooking,
|
|
41
|
-
// } = useCheckout();
|
|
42
|
-
// const { openLoginModal, isLogin } = useCustomer();
|
|
43
31
|
var utils = context.appHelper.utils || {};
|
|
44
|
-
var
|
|
32
|
+
var _useState = useState(false),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
loading = _useState2[0],
|
|
35
|
+
setLoading = _useState2[1];
|
|
45
36
|
var _useAppointmentBookin = useAppointmentBookingLogin(),
|
|
46
37
|
isLogin = _useAppointmentBookin.isLogin,
|
|
47
38
|
openLoginModal = _useAppointmentBookin.openLoginModal;
|
|
48
|
-
// const { currentStep, isLastStep } = useAppointmentBookingStep();
|
|
49
39
|
var _useAppointmentBookin2 = useAppointmentBookingContext(),
|
|
50
40
|
currentStep = _useAppointmentBookin2.currentStep,
|
|
51
41
|
isLastStep = _useAppointmentBookin2.isLastStep,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// 下单之前是否检测失败
|
|
56
|
-
var _useState = useState(false),
|
|
57
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
-
openCheckout = _useState2[0],
|
|
59
|
-
setOpenCheckout = _useState2[1];
|
|
60
|
-
// 检测失败的商品数量
|
|
61
|
-
var _useState3 = useState(0),
|
|
62
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
-
checkedNumber = _useState4[0],
|
|
64
|
-
setCheckedNumber = _useState4[1];
|
|
65
|
-
var _useState5 = useState(false),
|
|
66
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
67
|
-
openEmptyHolder = _useState6[0],
|
|
68
|
-
setOpenEmptyHolder = _useState6[1];
|
|
69
|
-
// const { removeSessionStorage } = useSales();
|
|
70
|
-
|
|
42
|
+
carts = _useAppointmentBookin2.carts,
|
|
43
|
+
appointmentBooking = _useAppointmentBookin2.appointmentBooking;
|
|
71
44
|
var data = {};
|
|
72
|
-
var currentStepData = {
|
|
73
|
-
key: 'select-event'
|
|
74
|
-
};
|
|
75
45
|
var createBooking = {
|
|
76
46
|
loading: false
|
|
77
47
|
};
|
|
78
48
|
var checkBeforeBooking = {
|
|
79
49
|
loading: false
|
|
80
50
|
};
|
|
81
|
-
var cartData = {};
|
|
82
51
|
|
|
83
52
|
/**
|
|
84
53
|
* @title: 下单
|
|
@@ -125,49 +94,52 @@ var ContinueButton = function ContinueButton() {
|
|
|
125
94
|
*/
|
|
126
95
|
var handleNextStep = /*#__PURE__*/function () {
|
|
127
96
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
97
|
+
var res;
|
|
128
98
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
129
99
|
while (1) switch (_context2.prev = _context2.next) {
|
|
130
100
|
case 0:
|
|
131
101
|
if (!isLastStep) {
|
|
132
|
-
_context2.next =
|
|
102
|
+
_context2.next = 16;
|
|
133
103
|
break;
|
|
134
104
|
}
|
|
135
|
-
|
|
136
|
-
|
|
105
|
+
setLoading(true);
|
|
106
|
+
_context2.prev = 2;
|
|
107
|
+
_context2.next = 5;
|
|
108
|
+
return appointmentBooking.submitOrder();
|
|
109
|
+
case 5:
|
|
110
|
+
res = _context2.sent;
|
|
111
|
+
console.log(isLastStep, isLogin, res, 'wh9896788');
|
|
112
|
+
utils.action({
|
|
113
|
+
type: 'pisell1.payment',
|
|
114
|
+
data: res === null || res === void 0 ? void 0 : res.data,
|
|
115
|
+
callback: function callback(e) {
|
|
116
|
+
console.log(e, 'wh9896788');
|
|
117
|
+
// checkoutCallback.current && checkoutCallback.current(e);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
setLoading(false);
|
|
121
|
+
_context2.next = 15;
|
|
122
|
+
break;
|
|
123
|
+
case 11:
|
|
124
|
+
_context2.prev = 11;
|
|
125
|
+
_context2.t0 = _context2["catch"](2);
|
|
126
|
+
console.log(isLastStep, isLogin, _context2.t0, 'wh9896788');
|
|
127
|
+
setLoading(false);
|
|
128
|
+
case 15:
|
|
129
|
+
return _context2.abrupt("return");
|
|
130
|
+
case 16:
|
|
137
131
|
return _context2.abrupt("return", appointmentBooking.next());
|
|
138
|
-
case
|
|
132
|
+
case 17:
|
|
139
133
|
case "end":
|
|
140
134
|
return _context2.stop();
|
|
141
135
|
}
|
|
142
|
-
}, _callee2);
|
|
136
|
+
}, _callee2, null, [[2, 11]]);
|
|
143
137
|
}));
|
|
144
138
|
return function handleNextStep() {
|
|
145
139
|
return _ref2.apply(this, arguments);
|
|
146
140
|
};
|
|
147
141
|
}();
|
|
148
142
|
|
|
149
|
-
/**
|
|
150
|
-
* @title: 判断是打开holder弹窗还是进行下一步
|
|
151
|
-
* @description:
|
|
152
|
-
* @return {*}
|
|
153
|
-
* @Author: WangHan
|
|
154
|
-
* @Date: 2025-02-08 14:00
|
|
155
|
-
*/
|
|
156
|
-
var handleHolder = function handleHolder() {
|
|
157
|
-
// const isHolder = checkHolder();
|
|
158
|
-
// // 如果没有绑定holder,则打开绑定holder弹窗
|
|
159
|
-
// if (!isHolder) {
|
|
160
|
-
// onHolderOpen();
|
|
161
|
-
// return;
|
|
162
|
-
// }
|
|
163
|
-
// // 验证holder是否为空
|
|
164
|
-
// const emptyHolders = getWithoutCartItemsHolderNames();
|
|
165
|
-
// if (emptyHolders?.length > 0) {
|
|
166
|
-
// return setOpenEmptyHolder(true);
|
|
167
|
-
// }
|
|
168
|
-
// handleNextStep();
|
|
169
|
-
};
|
|
170
|
-
|
|
171
143
|
/**
|
|
172
144
|
* @title: 点击继续
|
|
173
145
|
* @description:
|
|
@@ -191,14 +163,12 @@ var ContinueButton = function ContinueButton() {
|
|
|
191
163
|
return _context3.abrupt("return", openLoginModal({
|
|
192
164
|
callback: function callback(status) {
|
|
193
165
|
if (status === 'success') {
|
|
194
|
-
// handleHolder();
|
|
195
166
|
handleNextStep();
|
|
196
167
|
}
|
|
197
168
|
}
|
|
198
169
|
}));
|
|
199
170
|
case 3:
|
|
200
171
|
handleNextStep();
|
|
201
|
-
// handleHolder();
|
|
202
172
|
case 4:
|
|
203
173
|
case "end":
|
|
204
174
|
return _context3.stop();
|
|
@@ -224,7 +194,7 @@ var ContinueButton = function ContinueButton() {
|
|
|
224
194
|
} else {
|
|
225
195
|
return locales.getText('pisell2.event.close.continue');
|
|
226
196
|
}
|
|
227
|
-
}, [
|
|
197
|
+
}, [isLastStep]);
|
|
228
198
|
|
|
229
199
|
/**
|
|
230
200
|
* @title: 确认按钮loading
|
|
@@ -239,13 +209,13 @@ var ContinueButton = function ContinueButton() {
|
|
|
239
209
|
return (createBooking === null || createBooking === void 0 ? void 0 : createBooking.loading) || (checkBeforeBooking === null || checkBeforeBooking === void 0 ? void 0 : checkBeforeBooking.loading);
|
|
240
210
|
}, [isLastStep, createBooking === null || createBooking === void 0 ? void 0 : createBooking.loading, checkBeforeBooking === null || checkBeforeBooking === void 0 ? void 0 : checkBeforeBooking.loading]);
|
|
241
211
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
242
|
-
disabled: !(
|
|
212
|
+
disabled: !(carts !== null && carts !== void 0 && carts.length),
|
|
243
213
|
size: "large",
|
|
244
214
|
type: "primary",
|
|
245
215
|
onClick: function onClick() {
|
|
246
216
|
return handleContinue();
|
|
247
217
|
},
|
|
248
|
-
loading:
|
|
218
|
+
loading: loading
|
|
249
219
|
}, continueText));
|
|
250
220
|
};
|
|
251
221
|
export default ContinueButton;
|
|
@@ -5,17 +5,15 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { locales } from '@pisell/utils';
|
|
7
7
|
import { PisellText } from '@pisell/materials';
|
|
8
|
-
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
9
8
|
import "./index.less";
|
|
10
9
|
import classNames from 'classnames';
|
|
11
10
|
import { useAppointmentBookingContext } from "../../../context";
|
|
12
11
|
var Total = function Total(_ref) {
|
|
13
|
-
var _context$appHelper, _context$appHelper$ge;
|
|
14
12
|
var className = _ref.className,
|
|
15
13
|
isFooter = _ref.isFooter;
|
|
16
|
-
var context = useEngineContext();
|
|
17
14
|
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
18
|
-
summary = _useAppointmentBookin.summary
|
|
15
|
+
summary = _useAppointmentBookin.summary,
|
|
16
|
+
symbolic = _useAppointmentBookin.symbolic;
|
|
19
17
|
var taxTitle = summary.taxTitle,
|
|
20
18
|
totalTaxFee = summary.totalTaxFee,
|
|
21
19
|
isPriceIncludeTax = summary.isPriceIncludeTax,
|
|
@@ -37,7 +35,7 @@ var Total = function Total(_ref) {
|
|
|
37
35
|
className: "event-amount"
|
|
38
36
|
}) : null), isPriceIncludeTax && Number(totalTaxFee) > 0 ? /*#__PURE__*/React.createElement("span", {
|
|
39
37
|
className: "gst"
|
|
40
|
-
}, locales.getText('pisell2.event.total.gst')("".concat(isFooter ? "".concat(taxTitle, ": ") : taxTitle), "".concat(
|
|
38
|
+
}, locales.getText('pisell2.event.total.gst')("".concat(isFooter ? "".concat(taxTitle, ": ") : taxTitle), "".concat(symbolic).concat(totalTaxFee))) : null), !isFooter ? /*#__PURE__*/React.createElement(PisellText.Amount, {
|
|
41
39
|
value: total,
|
|
42
40
|
showCurrencySymbol: true,
|
|
43
41
|
className: "event-amount"
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { isMobile, locales } from '@pisell/utils';
|
|
3
3
|
import ShoppingCart from "../../../../shoppingCart";
|
|
4
|
-
// import SelectHolderModal from '../../../../';
|
|
5
4
|
import ContinueButton from "../ContinueButton";
|
|
6
5
|
import { useAppointmentBookingAccount, useAppointmentBooking } from "../../../hooks";
|
|
7
6
|
import { useAppointmentBookingContext } from "../../../context";
|
|
8
7
|
import Total from "./Total";
|
|
9
|
-
import { formatHolder } from "../../../utils";
|
|
8
|
+
import { formatHolder, formatCarts } from "../../../utils";
|
|
10
9
|
import "./index.less";
|
|
11
10
|
var CartItem = function CartItem() {
|
|
11
|
+
var _currentStep$step, _currentStep$step2;
|
|
12
12
|
var appointmentBooking = useAppointmentBooking();
|
|
13
13
|
var appointmentBookingAccount = useAppointmentBookingAccount();
|
|
14
14
|
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
15
15
|
carts = _useAppointmentBookin.carts,
|
|
16
16
|
summary = _useAppointmentBookin.summary,
|
|
17
|
-
isLastStep = _useAppointmentBookin.isLastStep
|
|
17
|
+
isLastStep = _useAppointmentBookin.isLastStep,
|
|
18
|
+
currentStep = _useAppointmentBookin.currentStep,
|
|
19
|
+
resources = _useAppointmentBookin.resources;
|
|
18
20
|
var accountLists = appointmentBookingAccount.accountLists;
|
|
19
|
-
console.log(summary, carts, 'accountLists');
|
|
21
|
+
console.log(summary, carts, formatCarts(carts, resources), 'accountLists');
|
|
20
22
|
var holderIds = useMemo(function () {
|
|
21
23
|
return accountLists.map(function (item) {
|
|
22
24
|
return item.id;
|
|
@@ -51,10 +53,12 @@ var CartItem = function CartItem() {
|
|
|
51
53
|
className: "content"
|
|
52
54
|
}, /*#__PURE__*/React.createElement(ShoppingCart, {
|
|
53
55
|
productParams: {
|
|
54
|
-
products: carts,
|
|
56
|
+
products: formatCarts(carts, resources),
|
|
55
57
|
hideAddBtn: false,
|
|
56
58
|
holders: holders,
|
|
57
|
-
disabledEdit: isLastStep
|
|
59
|
+
disabledEdit: isLastStep,
|
|
60
|
+
isShowChangeResource: (currentStep === null || currentStep === void 0 || (_currentStep$step = currentStep.step) === null || _currentStep$step === void 0 ? void 0 : _currentStep$step.key) === 'select-resource',
|
|
61
|
+
isShowDelete: (currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.index) < 2
|
|
58
62
|
},
|
|
59
63
|
collapseParams: {
|
|
60
64
|
activeKey: holderIds,
|
|
@@ -9,24 +9,17 @@ import { SectionFooters, Button, Badge, Image } from '@pisell/materials';
|
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
import ContinueButton from "../Cart/ContinueButton";
|
|
11
11
|
import shoppingCartSvg from "../../assets/shopping-cart.svg";
|
|
12
|
-
import {
|
|
12
|
+
import { useAppointmentBookingContext } from "../../context";
|
|
13
13
|
import Cart from "../Cart";
|
|
14
14
|
import Total from "../Cart/Item/Total";
|
|
15
15
|
import "./index.less";
|
|
16
16
|
var Footer = function Footer() {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var appointmentBookingCart = useAppointmentBookingCart();
|
|
17
|
+
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
18
|
+
carts = _useAppointmentBookin.carts;
|
|
20
19
|
var _useState = useState(false),
|
|
21
20
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22
21
|
open = _useState2[0],
|
|
23
22
|
setOpen = _useState2[1];
|
|
24
|
-
// const { open } = useHolder();
|
|
25
|
-
// const { onOpenCart, openCart, onCloseCart, cartData } = useCart();
|
|
26
|
-
// const { total } = useSummary();
|
|
27
|
-
var cartData = {
|
|
28
|
-
cartItems: [1, 2]
|
|
29
|
-
};
|
|
30
23
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SectionFooters, {
|
|
31
24
|
className: "section-footer-wrap",
|
|
32
25
|
left: /*#__PURE__*/React.createElement(Total, {
|
|
@@ -36,7 +29,7 @@ var Footer = function Footer() {
|
|
|
36
29
|
right: /*#__PURE__*/React.createElement("div", {
|
|
37
30
|
className: "section-footer-right"
|
|
38
31
|
}, /*#__PURE__*/React.createElement(Badge, {
|
|
39
|
-
count: (
|
|
32
|
+
count: (carts === null || carts === void 0 ? void 0 : carts.length) || 0
|
|
40
33
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
41
34
|
size: "large",
|
|
42
35
|
onClick: function onClick() {
|
|
@@ -22,15 +22,25 @@ var Resource = function Resource(_ref) {
|
|
|
22
22
|
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
23
23
|
appointmentBooking = _useAppointmentBookin.appointmentBooking,
|
|
24
24
|
resources = _useAppointmentBookin.resources,
|
|
25
|
-
carts = _useAppointmentBookin.carts
|
|
25
|
+
carts = _useAppointmentBookin.carts,
|
|
26
|
+
resourceOtherParams = _useAppointmentBookin.resourceOtherParams;
|
|
26
27
|
var _useAppointmentBookin2 = useAppointmentBookingResource(),
|
|
27
28
|
getResourceList = _useAppointmentBookin2.getResourceList,
|
|
28
|
-
getResourceTimeSlot = _useAppointmentBookin2.getResourceTimeSlot
|
|
29
|
+
getResourceTimeSlot = _useAppointmentBookin2.getResourceTimeSlot,
|
|
30
|
+
autoSelectAllProductResources = _useAppointmentBookin2.autoSelectAllProductResources;
|
|
29
31
|
// const { products } = useAppointmentBookingCart();
|
|
30
32
|
console.log(resources, carts, appointmentBooking, 'lists, products');
|
|
31
33
|
useEffect(function () {
|
|
32
|
-
getResourceList();
|
|
34
|
+
var _resources = getResourceList();
|
|
35
|
+
autoSelectAllProductResources('resources');
|
|
33
36
|
}, []);
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
var _resourceOtherParams$;
|
|
39
|
+
console.log(resourceOtherParams === null || resourceOtherParams === void 0 ? void 0 : resourceOtherParams.errorList, 'errorListerrorListerrorList');
|
|
40
|
+
if ((resourceOtherParams === null || resourceOtherParams === void 0 || (_resourceOtherParams$ = resourceOtherParams.errorList) === null || _resourceOtherParams$ === void 0 ? void 0 : _resourceOtherParams$.length) > 0) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}, [resourceOtherParams === null || resourceOtherParams === void 0 ? void 0 : resourceOtherParams.errorList]);
|
|
34
44
|
var anyResource = [{
|
|
35
45
|
id: 0,
|
|
36
46
|
image: 'https://cdn-partners-api.fresha.com/employee-avatars/processed/399178/medium/3b77991b-0ee2-4d0f-9d6f-a7501b39afcd-tempImageHYe20U.jpg',
|
|
@@ -47,11 +47,23 @@ var Services = function Services() {
|
|
|
47
47
|
detail: item
|
|
48
48
|
},
|
|
49
49
|
callback: function callback(data) {
|
|
50
|
+
var _data$origin;
|
|
51
|
+
var resources = (data === null || data === void 0 || (_data$origin = data.origin) === null || _data$origin === void 0 || (_data$origin = _data$origin.product_resource) === null || _data$origin === void 0 ? void 0 : _data$origin.resources) || [];
|
|
52
|
+
var activeStatus = resources.find(function (item) {
|
|
53
|
+
return item.status === 1;
|
|
54
|
+
});
|
|
55
|
+
if (!activeStatus) {
|
|
56
|
+
// console.log(PisellToast, 'PisellToast');
|
|
57
|
+
// return PisellToast({
|
|
58
|
+
// content: locales.getText(
|
|
59
|
+
// 'pisell2.appointment.no.available.service'
|
|
60
|
+
// ),
|
|
61
|
+
// });
|
|
62
|
+
}
|
|
50
63
|
var product = _objectSpread(_objectSpread({}, data), {}, {
|
|
51
64
|
options: (data === null || data === void 0 ? void 0 : data.option) || []
|
|
52
65
|
});
|
|
53
66
|
delete product.option;
|
|
54
|
-
console.log(product, data, appointmentBooking.storeProduct, 'wh978796');
|
|
55
67
|
appointmentBooking.storeProduct(product);
|
|
56
68
|
}
|
|
57
69
|
});
|
|
@@ -48,7 +48,7 @@ var Resource = function Resource(_ref) {
|
|
|
48
48
|
_context.next = 8;
|
|
49
49
|
return appointmentBooking.submitTimeSlot({
|
|
50
50
|
resourceProductData: resources === null || resources === void 0 ? void 0 : resources[0],
|
|
51
|
-
|
|
51
|
+
selectedResources: _resources,
|
|
52
52
|
timeSlots: e
|
|
53
53
|
});
|
|
54
54
|
case 8:
|
|
@@ -15,6 +15,10 @@ interface AppointmentBookingContextType {
|
|
|
15
15
|
isLastStep?: boolean;
|
|
16
16
|
setIsLastStep: (val: boolean) => void;
|
|
17
17
|
setCurrentStep: (val: any) => void;
|
|
18
|
+
appHelper?: any;
|
|
19
|
+
symbolic?: any;
|
|
20
|
+
resourceOtherParams?: any;
|
|
21
|
+
setResourceOtherParams: (val: any) => void;
|
|
18
22
|
}
|
|
19
23
|
export declare const AppointmentBookingProvider: ({ children, }: {
|
|
20
24
|
children: ReactNode;
|
|
@@ -6,8 +6,10 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React, { createContext, useContext, useState } from 'react';
|
|
8
8
|
import { useAppointmentBooking } from "./hooks";
|
|
9
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
9
10
|
var AppointmentBookingContext = /*#__PURE__*/createContext(undefined);
|
|
10
11
|
export var AppointmentBookingProvider = function AppointmentBookingProvider(_ref) {
|
|
12
|
+
var _appHelper$utils;
|
|
11
13
|
var children = _ref.children;
|
|
12
14
|
var appointmentBooking = useAppointmentBooking();
|
|
13
15
|
// 商品列表
|
|
@@ -40,6 +42,13 @@ export var AppointmentBookingProvider = function AppointmentBookingProvider(_ref
|
|
|
40
42
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
41
43
|
carts = _useState14[0],
|
|
42
44
|
setCarts = _useState14[1];
|
|
45
|
+
var _useState15 = useState({}),
|
|
46
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
47
|
+
resourceOtherParams = _useState16[0],
|
|
48
|
+
setResourceOtherParams = _useState16[1];
|
|
49
|
+
var _useEngineContext = useEngineContext(),
|
|
50
|
+
appHelper = _useEngineContext.appHelper;
|
|
51
|
+
var symbolic = appHelper === null || appHelper === void 0 || (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 ? void 0 : _appHelper$utils.getSymbolic();
|
|
43
52
|
console.log(3234234, times, resources);
|
|
44
53
|
var value = {
|
|
45
54
|
appointmentBooking: appointmentBooking,
|
|
@@ -56,7 +65,11 @@ export var AppointmentBookingProvider = function AppointmentBookingProvider(_ref
|
|
|
56
65
|
setSummary: setSummary,
|
|
57
66
|
setCurrentStep: setCurrentStep,
|
|
58
67
|
setIsLastStep: setIsLastStep,
|
|
59
|
-
setCarts: setCarts
|
|
68
|
+
setCarts: setCarts,
|
|
69
|
+
appHelper: appHelper,
|
|
70
|
+
symbolic: symbolic,
|
|
71
|
+
resourceOtherParams: resourceOtherParams,
|
|
72
|
+
setResourceOtherParams: setResourceOtherParams
|
|
60
73
|
};
|
|
61
74
|
return /*#__PURE__*/React.createElement(AppointmentBookingContext.Provider, {
|
|
62
75
|
value: value
|
|
@@ -19,5 +19,6 @@ export declare const useAppointmentBookingAccount: () => {
|
|
|
19
19
|
};
|
|
20
20
|
export declare const useAppointmentBookingResource: () => {
|
|
21
21
|
getResourceTimeSlot: (params: any) => Promise<void>;
|
|
22
|
-
getResourceList: () => Promise<
|
|
22
|
+
getResourceList: () => Promise<any>;
|
|
23
|
+
autoSelectAllProductResources: (code: string) => Promise<void>;
|
|
23
24
|
};
|
|
@@ -190,9 +190,12 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
|
|
|
190
190
|
var _useAppointmentBookin4 = useAppointmentBookingContext(),
|
|
191
191
|
appointmentBooking = _useAppointmentBookin4.appointmentBooking,
|
|
192
192
|
setResources = _useAppointmentBookin4.setResources,
|
|
193
|
-
setTimes = _useAppointmentBookin4.setTimes
|
|
193
|
+
setTimes = _useAppointmentBookin4.setTimes,
|
|
194
|
+
setResourceOtherParams = _useAppointmentBookin4.setResourceOtherParams,
|
|
195
|
+
resourceOtherParams = _useAppointmentBookin4.resourceOtherParams;
|
|
194
196
|
var _ref5 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
|
|
195
197
|
resourceSort = _ref5.resourceSort;
|
|
198
|
+
console.log(appointmentBooking, 'appointmentBooking22');
|
|
196
199
|
|
|
197
200
|
// 设置时间切片
|
|
198
201
|
var getResourceTimeSlot = /*#__PURE__*/function () {
|
|
@@ -231,7 +234,8 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
|
|
|
231
234
|
});
|
|
232
235
|
});
|
|
233
236
|
setResources(resources || []);
|
|
234
|
-
|
|
237
|
+
return _context5.abrupt("return", resources);
|
|
238
|
+
case 4:
|
|
235
239
|
case "end":
|
|
236
240
|
return _context5.stop();
|
|
237
241
|
}
|
|
@@ -241,8 +245,33 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
|
|
|
241
245
|
return _ref7.apply(this, arguments);
|
|
242
246
|
};
|
|
243
247
|
}();
|
|
248
|
+
|
|
249
|
+
// 获取自动分配
|
|
250
|
+
var autoSelectAllProductResources = /*#__PURE__*/function () {
|
|
251
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code) {
|
|
252
|
+
var res;
|
|
253
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
254
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
255
|
+
case 0:
|
|
256
|
+
_context6.next = 2;
|
|
257
|
+
return appointmentBooking.autoSelectAllProductResources(code);
|
|
258
|
+
case 2:
|
|
259
|
+
res = _context6.sent;
|
|
260
|
+
console.log(res, 'autoSelectAllProductResources');
|
|
261
|
+
setResourceOtherParams(_objectSpread(_objectSpread({}, resourceOtherParams), res));
|
|
262
|
+
case 5:
|
|
263
|
+
case "end":
|
|
264
|
+
return _context6.stop();
|
|
265
|
+
}
|
|
266
|
+
}, _callee6);
|
|
267
|
+
}));
|
|
268
|
+
return function autoSelectAllProductResources(_x5) {
|
|
269
|
+
return _ref8.apply(this, arguments);
|
|
270
|
+
};
|
|
271
|
+
}();
|
|
244
272
|
return {
|
|
245
273
|
getResourceTimeSlot: getResourceTimeSlot,
|
|
246
|
-
getResourceList: getResourceList
|
|
274
|
+
getResourceList: getResourceList,
|
|
275
|
+
autoSelectAllProductResources: autoSelectAllProductResources
|
|
247
276
|
};
|
|
248
277
|
};
|
|
@@ -74,6 +74,7 @@ declare const _default: {
|
|
|
74
74
|
'pisell2.appointment.add.guest': string;
|
|
75
75
|
'pisell2.appointment.edit.service': string;
|
|
76
76
|
'pisell2.appointment.remove.guest': string;
|
|
77
|
+
'pisell2.appointment.no.available.service': string;
|
|
77
78
|
};
|
|
78
79
|
'zh-CN': {
|
|
79
80
|
'pisell2.event.calendar.limit.unavailable': string;
|
|
@@ -150,6 +151,7 @@ declare const _default: {
|
|
|
150
151
|
'pisell2.appointment.add.guest': string;
|
|
151
152
|
'pisell2.appointment.edit.service': string;
|
|
152
153
|
'pisell2.appointment.remove.guest': string;
|
|
154
|
+
'pisell2.appointment.no.available.service': string;
|
|
153
155
|
};
|
|
154
156
|
'zh-HK': {
|
|
155
157
|
'pisell2.event.calendar.limit.unavailable': string;
|
|
@@ -226,6 +228,7 @@ declare const _default: {
|
|
|
226
228
|
'pisell2.appointment.add.guest': string;
|
|
227
229
|
'pisell2.appointment.edit.service': string;
|
|
228
230
|
'pisell2.appointment.remove.guest': string;
|
|
231
|
+
'pisell2.appointment.no.available.service': string;
|
|
229
232
|
};
|
|
230
233
|
};
|
|
231
234
|
export default _default;
|
|
@@ -87,7 +87,8 @@ export default {
|
|
|
87
87
|
},
|
|
88
88
|
'pisell2.appointment.add.guest': "Add guest",
|
|
89
89
|
'pisell2.appointment.edit.service': "Edit services",
|
|
90
|
-
'pisell2.appointment.remove.guest': "Remove guest"
|
|
90
|
+
'pisell2.appointment.remove.guest': "Remove guest",
|
|
91
|
+
'pisell2.appointment.no.available.service': "No available times for this service. Please choose another."
|
|
91
92
|
},
|
|
92
93
|
'zh-CN': {
|
|
93
94
|
'pisell2.event.calendar.limit.unavailable': "不可预约",
|
|
@@ -177,7 +178,8 @@ export default {
|
|
|
177
178
|
},
|
|
178
179
|
'pisell2.appointment.add.guest': "添加预约人",
|
|
179
180
|
'pisell2.appointment.edit.service': "编辑服务",
|
|
180
|
-
'pisell2.appointment.remove.guest': "移除预约人"
|
|
181
|
+
'pisell2.appointment.remove.guest': "移除预约人",
|
|
182
|
+
'pisell2.appointment.no.available.service': "此服务无可用时间,请选择其他服务。"
|
|
181
183
|
},
|
|
182
184
|
'zh-HK': {
|
|
183
185
|
'pisell2.event.calendar.limit.unavailable': "不可預約",
|
|
@@ -267,6 +269,7 @@ export default {
|
|
|
267
269
|
},
|
|
268
270
|
'pisell2.appointment.add.guest': "添加預約人",
|
|
269
271
|
'pisell2.appointment.edit.service': "編輯服務",
|
|
270
|
-
'pisell2.appointment.remove.guest': "移除預約人"
|
|
272
|
+
'pisell2.appointment.remove.guest': "移除預約人",
|
|
273
|
+
'pisell2.appointment.no.available.service': "此服务无可用时间,请选择其他服务。"
|
|
271
274
|
}
|
|
272
275
|
};
|
|
@@ -45,6 +45,7 @@ export declare const formatMonthDisplay: (dateString: string) => string;
|
|
|
45
45
|
export declare const resourceTitle: (data: any) => any;
|
|
46
46
|
export declare const formatHolder: (data: any[]) => any[];
|
|
47
47
|
export declare const formatGuest: (data: any[], products: any) => any[];
|
|
48
|
+
export declare const formatCarts: (data: any[], resources: any[]) => any[];
|
|
48
49
|
/**
|
|
49
50
|
* @title: 对资源进行排序
|
|
50
51
|
* @description:
|
|
@@ -128,6 +128,34 @@ export var formatGuest = function formatGuest(data, products) {
|
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
130
|
};
|
|
131
|
+
export var formatCarts = function formatCarts(data, resources) {
|
|
132
|
+
var _utils$storage2;
|
|
133
|
+
var context = useEngineContext();
|
|
134
|
+
var utils = context.appHelper.utils || {};
|
|
135
|
+
var locale = (utils === null || utils === void 0 || (_utils$storage2 = utils.storage) === null || _utils$storage2 === void 0 ? void 0 : _utils$storage2.get('umi_locale')) || 'en-US';
|
|
136
|
+
var symbol = (utils === null || utils === void 0 ? void 0 : utils.getSymbolic()) || '$';
|
|
137
|
+
console.log(resources, data, 'wh987utils');
|
|
138
|
+
return data === null || data === void 0 ? void 0 : data.map(function (d) {
|
|
139
|
+
var _currentResource$reso, _currentResources;
|
|
140
|
+
var currentResource = resources.find(function (r) {
|
|
141
|
+
return (d === null || d === void 0 ? void 0 : d._id) === (r === null || r === void 0 ? void 0 : r._id);
|
|
142
|
+
});
|
|
143
|
+
var currentResources = currentResource === null || currentResource === void 0 || (_currentResource$reso = currentResource.resources) === null || _currentResource$reso === void 0 || (_currentResource$reso = _currentResource$reso[0]) === null || _currentResource$reso === void 0 ? void 0 : _currentResource$reso.renderList;
|
|
144
|
+
currentResources = (_currentResources = currentResources) === null || _currentResources === void 0 ? void 0 : _currentResources.map(function (d) {
|
|
145
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
146
|
+
label: d === null || d === void 0 ? void 0 : d.main_field
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
150
|
+
format: ['HH:mm', 'HH:mm'],
|
|
151
|
+
show_time: true,
|
|
152
|
+
duration_type: d.duration.type,
|
|
153
|
+
locale: locale,
|
|
154
|
+
symbol: symbol,
|
|
155
|
+
resources: currentResources
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
};
|
|
131
159
|
|
|
132
160
|
/**
|
|
133
161
|
* @title: 对资源进行排序
|