@pisell/private-materials 3.3.33 → 3.3.34
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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +13 -13
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +6 -6
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +25 -4
- package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/Item/index.js +25 -45
- package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Content/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Content/index.js +36 -53
- package/es/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Form/index.js +161 -61
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Header/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Header/index.js +50 -64
- package/es/components/appointmentBooking/components/Resource/index.js +102 -119
- package/es/components/appointmentBooking/components/TimeSlicing/index.js +12 -5
- package/es/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
- package/es/components/appointmentBooking/context.js +3 -43
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
- package/es/components/appointmentBooking/deposit/index.d.ts +0 -1
- package/es/components/appointmentBooking/hooks.d.ts +3 -2
- package/es/components/appointmentBooking/hooks.js +209 -293
- package/es/components/appointmentBooking/index.d.ts +1 -0
- package/es/components/appointmentBooking/utils.d.ts +2 -88
- package/es/components/appointmentBooking/utils.js +63 -325
- package/es/components/booking/addons/model.js +5 -5
- package/es/components/booking/components/TabProduct/selectProductItem/index.js +4 -4
- package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
- package/es/components/booking/components/browserSelect/index.js +1 -1
- package/es/components/booking/components/footer/index.d.ts +1 -0
- package/es/components/booking/components/voucher/index.d.ts +0 -1
- package/es/components/booking/deposit/index.d.ts +1 -0
- package/es/components/booking/forms/model.js +5 -5
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/hooks/useClearCart.d.ts +0 -1
- package/es/components/booking/info/dateRange/index.d.ts +0 -1
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
- package/es/components/booking/info/index.d.ts +1 -0
- package/es/components/booking/info/service/Lists.d.ts +1 -0
- package/es/components/booking/info/service/addService/index.d.ts +1 -0
- package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
- package/es/components/booking/info/service/like/index.js +1 -1
- package/es/components/booking/info/service/serviceItem/index.d.ts +0 -1
- package/es/components/booking/info/utils.js +1 -1
- package/es/components/booking/info2/service/addService/index.d.ts +1 -0
- package/es/components/booking/info2/service/serviceItem/index.d.ts +0 -1
- package/es/components/booking/materiels/startTime/index.js +1 -1
- package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
- package/es/components/booking/notes/NoteBlock/index.js +11 -11
- package/es/components/booking/notes/model.js +5 -5
- package/es/components/booking/payments/model.js +5 -5
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +3 -3
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/es/components/eventBooking/index.d.ts +1 -0
- package/es/components/listComponent/index.js +5 -5
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/index.d.ts +0 -1
- package/es/components/productExtension/card/index.js +3 -3
- package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
- package/es/components/productExtension/fields/Forms/index.js +12 -12
- package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
- package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
- package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
- package/es/components/productExtension/server.js +2 -2
- package/es/components/productSelect/components/TabProduct/index.d.ts +0 -1
- package/es/components/productSelect/components/productGroup/index.d.ts +0 -1
- package/es/components/ruleSetting/ruleBorder/index.js +1 -1
- package/es/components/schedules/calendar/index.js +4 -4
- package/es/components/schedules/calendar/serve.js +2 -2
- package/es/components/schedules/components/CurrentDay/index.js +5 -5
- package/es/components/schedules/components/CurrentDay/serve.js +2 -2
- package/es/components/schedules/components/DropdownSort/index.js +1 -1
- package/es/components/schedules/components/ResourceList/index.js +1 -1
- package/es/components/schedules/components/Search/index.js +5 -5
- package/es/components/schedules/model.js +5 -5
- package/es/components/schedules/openHours/index.js +1 -1
- package/es/components/schedules/openHours/serve.js +2 -2
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
- package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
- package/es/components/schedules/products/serve.js +2 -2
- package/es/components/schedules/products/utils.js +5 -5
- package/es/components/schedules/resources/detail/detailContent.js +2 -2
- package/es/components/schedules/resources/detail/index.js +10 -10
- package/es/components/schedules/resources/list/index.js +2 -2
- package/es/components/schedules/resources/relationProduct/index.js +1 -1
- package/es/components/schedules/resources/serve.js +2 -2
- package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
- package/es/components/schedules/utils.d.ts +1 -1
- package/es/components/schedules/utils.js +4 -4
- package/es/components/selectModal/index.js +2 -2
- package/es/components/shoppingCart/components/Cart/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/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +0 -1
- package/es/hooks/useComponents.js +1 -1
- package/es/utils/index.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +5 -0
- package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +9 -33
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Content/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Content/index.js +21 -35
- package/lib/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Form/index.js +98 -54
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Header/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Header/index.js +20 -39
- package/lib/components/appointmentBooking/components/Resource/index.js +59 -41
- package/lib/components/appointmentBooking/components/TimeSlicing/index.js +7 -1
- package/lib/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
- package/lib/components/appointmentBooking/context.js +4 -48
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
- package/lib/components/appointmentBooking/deposit/index.d.ts +0 -1
- package/lib/components/appointmentBooking/hooks.d.ts +3 -2
- package/lib/components/appointmentBooking/hooks.js +57 -143
- package/lib/components/appointmentBooking/index.d.ts +1 -0
- package/lib/components/appointmentBooking/utils.d.ts +2 -88
- package/lib/components/appointmentBooking/utils.js +51 -191
- package/lib/components/booking/components/footer/index.d.ts +1 -0
- package/lib/components/booking/components/voucher/index.d.ts +0 -1
- package/lib/components/booking/deposit/index.d.ts +1 -0
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
- package/lib/components/booking/info/dateRange/index.d.ts +0 -1
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
- package/lib/components/booking/info/index.d.ts +1 -0
- package/lib/components/booking/info/service/Lists.d.ts +1 -0
- package/lib/components/booking/info/service/addService/index.d.ts +1 -0
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
- 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/utils.js +1 -1
- package/lib/components/booking/info2/service/addService/index.d.ts +1 -0
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +0 -1
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +3 -3
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/lib/components/eventBooking/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/index.d.ts +0 -1
- package/lib/components/productSelect/components/TabProduct/index.d.ts +0 -1
- package/lib/components/productSelect/components/productGroup/index.d.ts +0 -1
- package/lib/components/schedules/utils.d.ts +1 -1
- package/lib/components/schedules/utils.js +1 -1
- package/lib/components/shoppingCart/components/Cart/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/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +0 -1
- package/lib/utils/index.d.ts +1 -1
- package/package.json +4 -4
- package/es/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
- package/es/components/eventBooking/components/Provider/SelectProduct/index.js +0 -77
- package/es/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
- package/lib/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
- package/lib/components/eventBooking/components/Provider/SelectProduct/index.js +0 -69
- package/lib/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
|
@@ -17,9 +17,9 @@ import { useState, useEffect, useMemo } from 'react';
|
|
|
17
17
|
import { locales } from "@pisell/utils";
|
|
18
18
|
import { usePisellOS } from "../../hooks/useEngineContext";
|
|
19
19
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
20
|
-
import { sortResources, getCustomer,
|
|
20
|
+
import { sortResources, getCustomer, formatCartsResources, checkHasFormStep } from "./utils";
|
|
21
21
|
import { useAppointmentBookingContext } from "./context";
|
|
22
|
-
import {
|
|
22
|
+
import { checkHolder } from "./components/Cart/utils";
|
|
23
23
|
export var useAppointmentBooking = function useAppointmentBooking() {
|
|
24
24
|
var pisellOS = usePisellOS();
|
|
25
25
|
return pisellOS.getModule('appointmentBooking');
|
|
@@ -45,29 +45,12 @@ export var contextUtils = function contextUtils() {
|
|
|
45
45
|
export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
46
46
|
var _appointmentBooking$s;
|
|
47
47
|
var pisellOS = usePisellOS();
|
|
48
|
-
var
|
|
49
|
-
appointmentBooking =
|
|
50
|
-
setCurrentStep =
|
|
51
|
-
|
|
52
|
-
openPolicy =
|
|
53
|
-
setCarts = _ref.setCarts,
|
|
54
|
-
setLoading = _ref.setLoading,
|
|
55
|
-
currentSelectedResourcesRef = _ref.currentSelectedResourcesRef,
|
|
56
|
-
currentStepParams = _ref.currentStepParams,
|
|
57
|
-
setIsErrorHolder = _ref.setIsErrorHolder;
|
|
48
|
+
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
49
|
+
appointmentBooking = _useAppointmentBookin.appointmentBooking,
|
|
50
|
+
setCurrentStep = _useAppointmentBookin.setCurrentStep,
|
|
51
|
+
policyIdsRef = _useAppointmentBookin.policyIdsRef,
|
|
52
|
+
openPolicy = _useAppointmentBookin.openPolicy;
|
|
58
53
|
var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s = appointmentBooking.store) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.step) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.store) === null || _appointmentBooking$s === void 0 ? void 0 : _appointmentBooking$s.stepList) || [];
|
|
59
|
-
var _useAppointmentBookin = useAppointmentBookingLogin(),
|
|
60
|
-
isLogin = _useAppointmentBookin.isLogin,
|
|
61
|
-
openLoginModal = _useAppointmentBookin.openLoginModal;
|
|
62
|
-
var _useAppointmentBookin2 = useAppointmentBookingSetting(),
|
|
63
|
-
isFormSubject = _useAppointmentBookin2.isFormSubject;
|
|
64
|
-
var _useAppointmentBookin3 = useAppointmentBookingAccount(),
|
|
65
|
-
accountLists = _useAppointmentBookin3.accountLists,
|
|
66
|
-
getHolders = _useAppointmentBookin3.getHolders,
|
|
67
|
-
checkAccount = _useAppointmentBookin3.checkAccount;
|
|
68
|
-
var _useAppointmentBookin4 = useAppointmentBookingResource(),
|
|
69
|
-
getResourceList = _useAppointmentBookin4.getResourceList;
|
|
70
|
-
var utils = contextUtils();
|
|
71
54
|
|
|
72
55
|
// 判断是否是最后一步
|
|
73
56
|
var getCurrentAndLastStep = function getCurrentAndLastStep() {
|
|
@@ -77,7 +60,7 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
|
77
60
|
useEffect(function () {
|
|
78
61
|
getCurrentAndLastStep();
|
|
79
62
|
pisellOS.effects.on('appointmentBooking_step:changed', /*#__PURE__*/function () {
|
|
80
|
-
var
|
|
63
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
|
|
81
64
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
82
65
|
while (1) switch (_context.prev = _context.next) {
|
|
83
66
|
case 0:
|
|
@@ -91,7 +74,7 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
|
91
74
|
}, _callee);
|
|
92
75
|
}));
|
|
93
76
|
return function (_x) {
|
|
94
|
-
return
|
|
77
|
+
return _ref.apply(this, arguments);
|
|
95
78
|
};
|
|
96
79
|
}());
|
|
97
80
|
}, []);
|
|
@@ -139,146 +122,33 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
|
139
122
|
|
|
140
123
|
// 下一步
|
|
141
124
|
var nextStep = function nextStep() {
|
|
142
|
-
var
|
|
143
|
-
var
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
125
|
+
var _appointmentBooking$s2;
|
|
126
|
+
var currentStep = appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.getCurrentStep();
|
|
127
|
+
var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s2 = appointmentBooking.store) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.step) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.store) === null || _appointmentBooking$s2 === void 0 ? void 0 : _appointmentBooking$s2.stepList) || [];
|
|
128
|
+
|
|
129
|
+
// 倒数第二步
|
|
130
|
+
if ((currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) + 2 === (stepList === null || stepList === void 0 ? void 0 : stepList.length)) {
|
|
131
|
+
var _policyIdsRef$current;
|
|
132
|
+
// 如果没有同意资源上挂接的协议,则打开协议弹窗
|
|
133
|
+
if (policyIdsRef !== null && policyIdsRef !== void 0 && (_policyIdsRef$current = policyIdsRef.current) !== null && _policyIdsRef$current !== void 0 && _policyIdsRef$current.length) {
|
|
134
|
+
// 依次弹出所有协议
|
|
135
|
+
var idx = 0;
|
|
136
|
+
var showNextPolicy = function showNextPolicy() {
|
|
137
|
+
if (idx < policyIdsRef.current.length) {
|
|
138
|
+
openPolicy({
|
|
139
|
+
id: policyIdsRef.current[idx]
|
|
140
|
+
}, function () {
|
|
141
|
+
idx++;
|
|
142
|
+
showNextPolicy();
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
// 全部同意后,进入下一步
|
|
146
|
+
appointmentBooking.next();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
showNextPolicy();
|
|
154
150
|
return;
|
|
155
151
|
}
|
|
156
|
-
|
|
157
|
-
// 2. 插入表单步骤
|
|
158
|
-
currentSelectedResourcesRef === null || currentSelectedResourcesRef === void 0 || (_currentSelectedResou = currentSelectedResourcesRef.current) === null || _currentSelectedResou === void 0 || _currentSelectedResou.forEach(function (cart) {
|
|
159
|
-
var _selectedResource$ren, _selectedResource$ren2;
|
|
160
|
-
var selectedResource = cart === null || cart === void 0 ? void 0 : cart.currentSelectedResource;
|
|
161
|
-
var resourceItem = (selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.resourceItem) || {};
|
|
162
|
-
var formId = selectedResource === null || selectedResource === void 0 || (_selectedResource$ren = selectedResource.renderItem) === null || _selectedResource$ren === void 0 ? void 0 : _selectedResource$ren.resource_form_id;
|
|
163
|
-
var policyId = selectedResource === null || selectedResource === void 0 || (_selectedResource$ren2 = selectedResource.renderItem) === null || _selectedResource$ren2 === void 0 ? void 0 : _selectedResource$ren2.policy_id;
|
|
164
|
-
var formKey = "fill-form_@".concat(resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.form_id, "-").concat(resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.code, "-").concat(cart === null || cart === void 0 ? void 0 : cart._id, "-").concat(formId, "-").concat(policyId);
|
|
165
|
-
|
|
166
|
-
// 如果有表单id则插入表单步骤
|
|
167
|
-
if (formId) {
|
|
168
|
-
var description = locales.getText('pisell2.appointment.fill-form');
|
|
169
|
-
var beforeKey = getFormInsertBeforeKey(currentKey, stepList);
|
|
170
|
-
appointmentBooking.addStep({
|
|
171
|
-
key: formKey,
|
|
172
|
-
description: description
|
|
173
|
-
}, beforeKey);
|
|
174
|
-
} else {
|
|
175
|
-
appointmentBooking.removeStep(formKey);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// 3. 插入下一个资源步骤
|
|
180
|
-
var selectedResource = currentSelectedResourcesRef === null || currentSelectedResourcesRef === void 0 || (_currentSelectedResou2 = currentSelectedResourcesRef.current) === null || _currentSelectedResou2 === void 0 || (_currentSelectedResou2 = _currentSelectedResou2[0]) === null || _currentSelectedResou2 === void 0 ? void 0 : _currentSelectedResou2.currentSelectedResource;
|
|
181
|
-
if (selectedResource) {
|
|
182
|
-
var _selectedResource$res;
|
|
183
|
-
var originRenderLists = (selectedResource === null || selectedResource === void 0 || (_selectedResource$res = selectedResource.resourceItem) === null || _selectedResource$res === void 0 ? void 0 : _selectedResource$res.originRenderLists) || [];
|
|
184
|
-
var currentResourceIndex = originRenderLists === null || originRenderLists === void 0 ? void 0 : originRenderLists.findIndex(function (item) {
|
|
185
|
-
var _selectedResource$ren3;
|
|
186
|
-
return item.id === (selectedResource === null || selectedResource === void 0 || (_selectedResource$ren3 = selectedResource.renderItem) === null || _selectedResource$ren3 === void 0 ? void 0 : _selectedResource$ren3.form_id);
|
|
187
|
-
});
|
|
188
|
-
var nextResource = originRenderLists === null || originRenderLists === void 0 ? void 0 : originRenderLists[currentResourceIndex + 1];
|
|
189
|
-
var resourceKey = "select-resource_@".concat(nextResource === null || nextResource === void 0 ? void 0 : nextResource.form_id, "-").concat(nextResource === null || nextResource === void 0 ? void 0 : nextResource.code);
|
|
190
|
-
|
|
191
|
-
// 如果有下一个资源数据,则插入下一个资源步骤
|
|
192
|
-
if (nextResource) {
|
|
193
|
-
var _stepList;
|
|
194
|
-
var beforeKey = (_stepList = stepList[stepList.length - 2]) === null || _stepList === void 0 ? void 0 : _stepList.key;
|
|
195
|
-
appointmentBooking.addStep({
|
|
196
|
-
key: resourceKey,
|
|
197
|
-
description: ''
|
|
198
|
-
}, beforeKey);
|
|
199
|
-
} else {
|
|
200
|
-
appointmentBooking.removeStep(resourceKey);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// 4. 检测是否登录和打开协议弹窗
|
|
206
|
-
var nextStep = stepList[(currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.index) + 1];
|
|
207
|
-
if (nextStep !== null && nextStep !== void 0 && (_nextStep$key = nextStep.key) !== null && _nextStep$key !== void 0 && _nextStep$key.startsWith('select-resource_') || (nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) === 'confirm-information') {
|
|
208
|
-
var _currentSelectedResou3;
|
|
209
|
-
var _selectedResource = (_currentSelectedResou3 = currentSelectedResourcesRef.current) === null || _currentSelectedResou3 === void 0 || (_currentSelectedResou3 = _currentSelectedResou3[0]) === null || _currentSelectedResou3 === void 0 ? void 0 : _currentSelectedResou3.currentSelectedResource;
|
|
210
|
-
var renderItem = (_selectedResource === null || _selectedResource === void 0 ? void 0 : _selectedResource.renderItem) || {};
|
|
211
|
-
|
|
212
|
-
// 监测holder数据
|
|
213
|
-
var checkHolder = function checkHolder() {
|
|
214
|
-
setLoading(false);
|
|
215
|
-
var _checkAndGoNext = checkAndGoNext(isFormSubject, checkAccount, carts),
|
|
216
|
-
hasError = _checkAndGoNext.hasError,
|
|
217
|
-
updatedCartList = _checkAndGoNext.updatedCartList;
|
|
218
|
-
if (hasError) {
|
|
219
|
-
setIsErrorHolder(hasError);
|
|
220
|
-
setCarts(updatedCartList);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (!!(renderItem !== null && renderItem !== void 0 && renderItem.policy_id)) {
|
|
224
|
-
openPolicy({
|
|
225
|
-
id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id
|
|
226
|
-
}, function () {
|
|
227
|
-
return appointmentBooking.next();
|
|
228
|
-
});
|
|
229
|
-
} else {
|
|
230
|
-
return appointmentBooking.next();
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
// 检测是否登录
|
|
235
|
-
var checkLogin = function checkLogin() {
|
|
236
|
-
// 如果没有登录,则验证登录
|
|
237
|
-
if (!isLogin) {
|
|
238
|
-
return openLoginModal({
|
|
239
|
-
callback: function callback(status) {
|
|
240
|
-
if (status === 'success') {
|
|
241
|
-
if (!isFormSubject) {
|
|
242
|
-
var _utils$storage;
|
|
243
|
-
var user = JSON.parse((utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get('customer')) || '{}');
|
|
244
|
-
var currentUser = formatCustomer(user);
|
|
245
|
-
var meAccount = accountLists === null || accountLists === void 0 ? void 0 : accountLists.find(function (d) {
|
|
246
|
-
return !(d !== null && d !== void 0 && d.isGuest);
|
|
247
|
-
});
|
|
248
|
-
appointmentBooking.setLoginAccount(meAccount === null || meAccount === void 0 ? void 0 : meAccount.id, currentUser);
|
|
249
|
-
} else {
|
|
250
|
-
getHolders();
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// 继续后续流程
|
|
254
|
-
checkHolder();
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
} else {
|
|
259
|
-
return checkHolder();
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
// 如果下一步不是确认信息,则打开协议弹窗
|
|
264
|
-
if ((nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) !== 'confirm-information') {
|
|
265
|
-
if (!(renderItem !== null && renderItem !== void 0 && renderItem.policy_id)) {
|
|
266
|
-
return appointmentBooking.next();
|
|
267
|
-
}
|
|
268
|
-
return openPolicy({
|
|
269
|
-
id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id
|
|
270
|
-
}, function () {
|
|
271
|
-
// 触发购物车数据发生改变,重新得出当前的资源
|
|
272
|
-
var cartItem = carts === null || carts === void 0 ? void 0 : carts[0];
|
|
273
|
-
appointmentBooking.updateCart(_objectSpread({
|
|
274
|
-
_id: cartItem === null || cartItem === void 0 ? void 0 : cartItem._id
|
|
275
|
-
}, cartItem));
|
|
276
|
-
appointmentBooking.next();
|
|
277
|
-
});
|
|
278
|
-
} else {
|
|
279
|
-
// 如果下一步是确认信息,则检测是否需要登录和检测holder数据
|
|
280
|
-
return checkLogin();
|
|
281
|
-
}
|
|
282
152
|
}
|
|
283
153
|
appointmentBooking.next();
|
|
284
154
|
};
|
|
@@ -300,17 +170,19 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
|
300
170
|
* @Date: 2025-04-15 11:12
|
|
301
171
|
*/
|
|
302
172
|
export var useAppointmentBookingProduct = function useAppointmentBookingProduct() {
|
|
303
|
-
var
|
|
304
|
-
appointmentBooking =
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
173
|
+
var _useAppointmentBookin2 = useAppointmentBookingContext(),
|
|
174
|
+
appointmentBooking = _useAppointmentBookin2.appointmentBooking,
|
|
175
|
+
carts = _useAppointmentBookin2.carts;
|
|
176
|
+
var _ref2 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
|
|
177
|
+
productModuleParams = _ref2.productModuleParams;
|
|
178
|
+
var _ref3 = productModuleParams || {},
|
|
179
|
+
bookingProcess = _ref3.bookingProcess,
|
|
180
|
+
bookingSubject = _ref3.bookingSubject;
|
|
309
181
|
|
|
310
182
|
// 获取商品列表
|
|
311
183
|
var getProducts = /*#__PURE__*/function () {
|
|
312
|
-
var
|
|
313
|
-
var _dates$, dates,
|
|
184
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
185
|
+
var _dates$, dates, _ref5, _productModuleParams, _productList, _ref6, productModuleParams, productList;
|
|
314
186
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
315
187
|
while (1) switch (_context2.prev = _context2.next) {
|
|
316
188
|
case 0:
|
|
@@ -328,7 +200,7 @@ export var useAppointmentBookingProduct = function useAppointmentBookingProduct(
|
|
|
328
200
|
}
|
|
329
201
|
return _context2.abrupt("return");
|
|
330
202
|
case 6:
|
|
331
|
-
|
|
203
|
+
_ref5 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {}, _productModuleParams = _ref5.productModuleParams;
|
|
332
204
|
_context2.next = 9;
|
|
333
205
|
return appointmentBooking.loadProductByScheduleDate(_objectSpread({
|
|
334
206
|
date: (_dates$ = dates[0]) === null || _dates$ === void 0 ? void 0 : _dates$.date
|
|
@@ -338,7 +210,7 @@ export var useAppointmentBookingProduct = function useAppointmentBookingProduct(
|
|
|
338
210
|
return _context2.abrupt("return", _productList);
|
|
339
211
|
case 11:
|
|
340
212
|
// 先选商品
|
|
341
|
-
|
|
213
|
+
_ref6 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {}, productModuleParams = _ref6.productModuleParams;
|
|
342
214
|
_context2.next = 14;
|
|
343
215
|
return appointmentBooking.loadProducts(productModuleParams);
|
|
344
216
|
case 14:
|
|
@@ -351,13 +223,13 @@ export var useAppointmentBookingProduct = function useAppointmentBookingProduct(
|
|
|
351
223
|
}, _callee2);
|
|
352
224
|
}));
|
|
353
225
|
return function getProducts() {
|
|
354
|
-
return
|
|
226
|
+
return _ref4.apply(this, arguments);
|
|
355
227
|
};
|
|
356
228
|
}();
|
|
357
229
|
|
|
358
230
|
// 检测商品类型
|
|
359
231
|
var checkProductType = /*#__PURE__*/function () {
|
|
360
|
-
var
|
|
232
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(productId) {
|
|
361
233
|
var result;
|
|
362
234
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
363
235
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -374,7 +246,7 @@ export var useAppointmentBookingProduct = function useAppointmentBookingProduct(
|
|
|
374
246
|
}, _callee3);
|
|
375
247
|
}));
|
|
376
248
|
return function checkProductType(_x2) {
|
|
377
|
-
return
|
|
249
|
+
return _ref7.apply(this, arguments);
|
|
378
250
|
};
|
|
379
251
|
}();
|
|
380
252
|
return {
|
|
@@ -394,51 +266,32 @@ export var useAppointmentBookingCart = function useAppointmentBookingCart() {
|
|
|
394
266
|
var _appointmentBooking$o;
|
|
395
267
|
var pisellOS = usePisellOS();
|
|
396
268
|
var utils = contextUtils();
|
|
397
|
-
var
|
|
398
|
-
appointmentBooking =
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
bookingSubject = _ref11.bookingSubject;
|
|
269
|
+
var _useAppointmentBookin3 = useAppointmentBookingContext(),
|
|
270
|
+
appointmentBooking = _useAppointmentBookin3.appointmentBooking,
|
|
271
|
+
setCarts = _useAppointmentBookin3.setCarts,
|
|
272
|
+
setSummary = _useAppointmentBookin3.setSummary,
|
|
273
|
+
setIsAgreeDepositPolicy = _useAppointmentBookin3.setIsAgreeDepositPolicy;
|
|
274
|
+
var _ref8 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o = appointmentBooking.otherParams) === null || _appointmentBooking$o === void 0 ? void 0 : _appointmentBooking$o.productModuleParams) || {},
|
|
275
|
+
bookingSubject = _ref8.bookingSubject;
|
|
405
276
|
var getCartAndSummary = /*#__PURE__*/function () {
|
|
406
|
-
var
|
|
407
|
-
var
|
|
408
|
-
var locale, symbol, carts, accountLists, newCarts, summary;
|
|
277
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
278
|
+
var carts, newCarts, summary;
|
|
409
279
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
410
280
|
while (1) switch (_context4.prev = _context4.next) {
|
|
411
281
|
case 0:
|
|
412
|
-
|
|
413
|
-
symbol = (utils === null || utils === void 0 ? void 0 : utils.getSymbolic()) || '$';
|
|
414
|
-
_context4.next = 4;
|
|
282
|
+
_context4.next = 2;
|
|
415
283
|
return appointmentBooking.getCart();
|
|
416
|
-
case
|
|
284
|
+
case 2:
|
|
417
285
|
carts = _context4.sent;
|
|
418
|
-
_context4.next = 7;
|
|
419
|
-
return appointmentBooking.getAccounts();
|
|
420
|
-
case 7:
|
|
421
|
-
accountLists = _context4.sent;
|
|
422
286
|
newCarts = carts === null || carts === void 0 ? void 0 : carts.map(function (item) {
|
|
423
|
-
var _item$duration;
|
|
424
287
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
425
|
-
addHolderButtonText: utils === null || utils === void 0 ? void 0 : utils.translation(bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_name)
|
|
426
|
-
format: ['HH:mm', 'HH:mm'],
|
|
427
|
-
show_time: true,
|
|
428
|
-
duration_type: (item === null || item === void 0 || (_item$duration = item.duration) === null || _item$duration === void 0 ? void 0 : _item$duration.type) || 'minutes',
|
|
429
|
-
locale: locale,
|
|
430
|
-
symbol: symbol,
|
|
431
|
-
holders: formatHolder(accountLists),
|
|
432
|
-
allowClearHolder: true,
|
|
433
|
-
allowClearResource: true,
|
|
434
|
-
isErrorHolder: isErrorHolder || false,
|
|
435
|
-
isMultipleResource: true
|
|
288
|
+
addHolderButtonText: utils === null || utils === void 0 ? void 0 : utils.translation(bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_name)
|
|
436
289
|
});
|
|
437
290
|
});
|
|
438
291
|
setCarts(newCarts || []);
|
|
439
|
-
_context4.next =
|
|
292
|
+
_context4.next = 7;
|
|
440
293
|
return appointmentBooking.getSummary();
|
|
441
|
-
case
|
|
294
|
+
case 7:
|
|
442
295
|
summary = _context4.sent;
|
|
443
296
|
setSummary(summary || {});
|
|
444
297
|
|
|
@@ -446,14 +299,14 @@ export var useAppointmentBookingCart = function useAppointmentBookingCart() {
|
|
|
446
299
|
if (!carts.length) {
|
|
447
300
|
setIsAgreeDepositPolicy(false);
|
|
448
301
|
}
|
|
449
|
-
case
|
|
302
|
+
case 10:
|
|
450
303
|
case "end":
|
|
451
304
|
return _context4.stop();
|
|
452
305
|
}
|
|
453
306
|
}, _callee4);
|
|
454
307
|
}));
|
|
455
308
|
return function getCartAndSummary() {
|
|
456
|
-
return
|
|
309
|
+
return _ref9.apply(this, arguments);
|
|
457
310
|
};
|
|
458
311
|
}();
|
|
459
312
|
useEffect(function () {
|
|
@@ -484,8 +337,8 @@ export var useAppointmentBookingLogin = function useAppointmentBookingLogin() {
|
|
|
484
337
|
var utils = contextUtils();
|
|
485
338
|
var isLogin = !!(utils !== null && utils !== void 0 && (_utils$token = utils.token) !== null && _utils$token !== void 0 && (_utils$token$get = _utils$token.get) !== null && _utils$token$get !== void 0 && _utils$token$get.call(_utils$token));
|
|
486
339
|
var openLoginModal = function openLoginModal(params) {
|
|
487
|
-
var
|
|
488
|
-
callback =
|
|
340
|
+
var _ref11 = params || {},
|
|
341
|
+
callback = _ref11.callback;
|
|
489
342
|
utils.action({
|
|
490
343
|
type: 'pisell1.login',
|
|
491
344
|
data: {
|
|
@@ -516,13 +369,13 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
516
369
|
_useState2 = _slicedToArray(_useState, 2),
|
|
517
370
|
accountLists = _useState2[0],
|
|
518
371
|
setAccountLists = _useState2[1];
|
|
519
|
-
var
|
|
520
|
-
bookingSubject =
|
|
372
|
+
var _ref12 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o2 = appointmentBooking.otherParams) === null || _appointmentBooking$o2 === void 0 ? void 0 : _appointmentBooking$o2.productModuleParams) || {},
|
|
373
|
+
bookingSubject = _ref12.bookingSubject;
|
|
521
374
|
var form_id = bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id;
|
|
522
375
|
|
|
523
376
|
// 获取账户列表数据
|
|
524
377
|
var getAccountLists = /*#__PURE__*/function () {
|
|
525
|
-
var
|
|
378
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
526
379
|
var data;
|
|
527
380
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
528
381
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -539,13 +392,13 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
539
392
|
}, _callee6);
|
|
540
393
|
}));
|
|
541
394
|
return function getAccountLists() {
|
|
542
|
-
return
|
|
395
|
+
return _ref13.apply(this, arguments);
|
|
543
396
|
};
|
|
544
397
|
}();
|
|
545
398
|
useEffect(function () {
|
|
546
399
|
getAccountLists();
|
|
547
400
|
pisellOS.effects.on('appointmentBooking_accountList:changed', /*#__PURE__*/function () {
|
|
548
|
-
var
|
|
401
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(res) {
|
|
549
402
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
550
403
|
while (1) switch (_context7.prev = _context7.next) {
|
|
551
404
|
case 0:
|
|
@@ -560,14 +413,14 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
560
413
|
}, _callee7);
|
|
561
414
|
}));
|
|
562
415
|
return function (_x3) {
|
|
563
|
-
return
|
|
416
|
+
return _ref14.apply(this, arguments);
|
|
564
417
|
};
|
|
565
418
|
}());
|
|
566
419
|
}, []);
|
|
567
420
|
|
|
568
421
|
// 获取表单数据
|
|
569
422
|
var getHolders = /*#__PURE__*/function () {
|
|
570
|
-
var
|
|
423
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
571
424
|
var _utils$getStore$getSt;
|
|
572
425
|
var shop_id, customer, params, data, newData;
|
|
573
426
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
@@ -607,13 +460,13 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
607
460
|
}, _callee8);
|
|
608
461
|
}));
|
|
609
462
|
return function getHolders() {
|
|
610
|
-
return
|
|
463
|
+
return _ref15.apply(this, arguments);
|
|
611
464
|
};
|
|
612
465
|
}();
|
|
613
466
|
|
|
614
467
|
// 添加账户
|
|
615
468
|
var addAccount = /*#__PURE__*/function () {
|
|
616
|
-
var
|
|
469
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(val, type) {
|
|
617
470
|
var customer, result;
|
|
618
471
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
619
472
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -634,7 +487,7 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
634
487
|
}, _callee9);
|
|
635
488
|
}));
|
|
636
489
|
return function addAccount(_x4, _x5) {
|
|
637
|
-
return
|
|
490
|
+
return _ref16.apply(this, arguments);
|
|
638
491
|
};
|
|
639
492
|
}();
|
|
640
493
|
|
|
@@ -659,12 +512,14 @@ export var useAppointmentBookingAccount = function useAppointmentBookingAccount(
|
|
|
659
512
|
* @Date: 2025-04-15 11:29
|
|
660
513
|
*/
|
|
661
514
|
export var useAppointmentBookingResource = function useAppointmentBookingResource() {
|
|
662
|
-
var
|
|
663
|
-
appointmentBooking =
|
|
664
|
-
setResources =
|
|
665
|
-
setTimes =
|
|
666
|
-
|
|
667
|
-
|
|
515
|
+
var _useAppointmentBookin4 = useAppointmentBookingContext(),
|
|
516
|
+
appointmentBooking = _useAppointmentBookin4.appointmentBooking,
|
|
517
|
+
setResources = _useAppointmentBookin4.setResources,
|
|
518
|
+
setTimes = _useAppointmentBookin4.setTimes,
|
|
519
|
+
setResourceOtherParams = _useAppointmentBookin4.setResourceOtherParams,
|
|
520
|
+
resourceOtherParams = _useAppointmentBookin4.resourceOtherParams;
|
|
521
|
+
var _ref17 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
|
|
522
|
+
resourceSort = _ref17.resourceSort;
|
|
668
523
|
|
|
669
524
|
// 设置资源列表
|
|
670
525
|
var getResourceList = function getResourceList() {
|
|
@@ -688,7 +543,7 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
|
|
|
688
543
|
|
|
689
544
|
// 设置时间切片
|
|
690
545
|
var getResourceTimeSlot = /*#__PURE__*/function () {
|
|
691
|
-
var
|
|
546
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(index) {
|
|
692
547
|
var _getResourceList, resourceCodes, code, data;
|
|
693
548
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
694
549
|
while (1) switch (_context10.prev = _context10.next) {
|
|
@@ -707,12 +562,45 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
|
|
|
707
562
|
}, _callee10);
|
|
708
563
|
}));
|
|
709
564
|
return function getResourceTimeSlot(_x6) {
|
|
710
|
-
return
|
|
565
|
+
return _ref18.apply(this, arguments);
|
|
566
|
+
};
|
|
567
|
+
}();
|
|
568
|
+
|
|
569
|
+
// 获取自动分配
|
|
570
|
+
var autoSelectAllProductResources = /*#__PURE__*/function () {
|
|
571
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(index) {
|
|
572
|
+
var _getResourceList2, resourceCodes, code, data, res;
|
|
573
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
574
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
575
|
+
case 0:
|
|
576
|
+
_getResourceList2 = getResourceList(), resourceCodes = _getResourceList2.resourceCodes;
|
|
577
|
+
code = resourceCodes === null || resourceCodes === void 0 ? void 0 : resourceCodes[index || 0]; // 获取时间切片
|
|
578
|
+
_context11.next = 4;
|
|
579
|
+
return appointmentBooking.getTimeSlotByAllResources(code);
|
|
580
|
+
case 4:
|
|
581
|
+
data = _context11.sent;
|
|
582
|
+
_context11.next = 7;
|
|
583
|
+
return appointmentBooking.autoSelectAllProductResources(code);
|
|
584
|
+
case 7:
|
|
585
|
+
res = _context11.sent;
|
|
586
|
+
setResourceOtherParams(_objectSpread(_objectSpread(_objectSpread({}, resourceOtherParams), res), {}, {
|
|
587
|
+
resourceCodes: resourceCodes
|
|
588
|
+
}));
|
|
589
|
+
return _context11.abrupt("return", res);
|
|
590
|
+
case 10:
|
|
591
|
+
case "end":
|
|
592
|
+
return _context11.stop();
|
|
593
|
+
}
|
|
594
|
+
}, _callee11);
|
|
595
|
+
}));
|
|
596
|
+
return function autoSelectAllProductResources(_x7) {
|
|
597
|
+
return _ref19.apply(this, arguments);
|
|
711
598
|
};
|
|
712
599
|
}();
|
|
713
600
|
return {
|
|
714
601
|
getResourceTimeSlot: getResourceTimeSlot,
|
|
715
|
-
getResourceList: getResourceList
|
|
602
|
+
getResourceList: getResourceList,
|
|
603
|
+
autoSelectAllProductResources: autoSelectAllProductResources
|
|
716
604
|
};
|
|
717
605
|
};
|
|
718
606
|
|
|
@@ -724,73 +612,101 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
|
|
|
724
612
|
* @Date: 2025-04-21 11:47
|
|
725
613
|
*/
|
|
726
614
|
export var useIsSkipResourceStep = function useIsSkipResourceStep() {
|
|
727
|
-
var
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
615
|
+
var _appointmentBooking$s3;
|
|
616
|
+
var _useAppointmentBookin5 = useAppointmentBookingContext(),
|
|
617
|
+
currentStep = _useAppointmentBookin5.currentStep,
|
|
618
|
+
setCarts = _useAppointmentBookin5.setCarts,
|
|
619
|
+
setPolicyIds = _useAppointmentBookin5.setPolicyIds;
|
|
620
|
+
var _useAppointmentBookin6 = useAppointmentBookingResource(),
|
|
621
|
+
getResourceList = _useAppointmentBookin6.getResourceList,
|
|
622
|
+
autoSelectAllProductResources = _useAppointmentBookin6.autoSelectAllProductResources;
|
|
623
|
+
var _useAppointmentBookin7 = useAppointmentBookingSetting(),
|
|
624
|
+
isFormSubject = _useAppointmentBookin7.isFormSubject;
|
|
733
625
|
var appointmentBooking = useAppointmentBooking();
|
|
734
|
-
var
|
|
735
|
-
|
|
626
|
+
var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s3 = appointmentBooking.store) === null || _appointmentBooking$s3 === void 0 || (_appointmentBooking$s3 = _appointmentBooking$s3.step) === null || _appointmentBooking$s3 === void 0 || (_appointmentBooking$s3 = _appointmentBooking$s3.store) === null || _appointmentBooking$s3 === void 0 ? void 0 : _appointmentBooking$s3.stepList) || [];
|
|
627
|
+
var _useAppointmentBookin8 = useAppointmentBookingLogin(),
|
|
628
|
+
isLogin = _useAppointmentBookin8.isLogin,
|
|
629
|
+
openLoginModal = _useAppointmentBookin8.openLoginModal;
|
|
630
|
+
var _useAppointmentBookin9 = useAppointmentBookingAccount(),
|
|
631
|
+
getHolders = _useAppointmentBookin9.getHolders,
|
|
632
|
+
checkAccount = _useAppointmentBookin9.checkAccount;
|
|
633
|
+
var _useAppointmentBookin10 = useAppointmentBookingStep(),
|
|
634
|
+
nextStep = _useAppointmentBookin10.nextStep;
|
|
635
|
+
var utils = contextUtils();
|
|
736
636
|
var checkSkipResourceStep = /*#__PURE__*/function () {
|
|
737
|
-
var
|
|
738
|
-
var
|
|
739
|
-
return _regeneratorRuntime().wrap(function
|
|
740
|
-
while (1) switch (
|
|
637
|
+
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(isSkipUpdateFormStep) {
|
|
638
|
+
var accountLists, carts, _res$errorList, _resources$, res, _getResourceList3, resources, resultCarts;
|
|
639
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
640
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
741
641
|
case 0:
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
_context11.next = 4;
|
|
642
|
+
_context12.prev = 0;
|
|
643
|
+
_context12.next = 3;
|
|
745
644
|
return appointmentBooking.getAccounts();
|
|
746
|
-
case
|
|
747
|
-
accountLists =
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
nextStep();
|
|
754
|
-
return _context11.abrupt("return", true);
|
|
755
|
-
case 9:
|
|
645
|
+
case 3:
|
|
646
|
+
accountLists = _context12.sent;
|
|
647
|
+
_context12.next = 6;
|
|
648
|
+
return appointmentBooking.getCart();
|
|
649
|
+
case 6:
|
|
650
|
+
carts = _context12.sent;
|
|
756
651
|
if (!((accountLists === null || accountLists === void 0 ? void 0 : accountLists.length) === 1 || isFormSubject)) {
|
|
757
|
-
|
|
652
|
+
_context12.next = 20;
|
|
758
653
|
break;
|
|
759
654
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
// 如果跳过资源选择步骤,则执行跳过的逻辑
|
|
769
|
-
if (!_isSkip) {
|
|
770
|
-
_context11.next = 16;
|
|
655
|
+
_context12.next = 10;
|
|
656
|
+
return autoSelectAllProductResources();
|
|
657
|
+
case 10:
|
|
658
|
+
res = _context12.sent;
|
|
659
|
+
_getResourceList3 = getResourceList(), resources = _getResourceList3.resources; // 如果分配成功,并且只有一个资源则跳过资源选择步骤,默认选中该资源
|
|
660
|
+
if (!(!(res !== null && res !== void 0 && (_res$errorList = res.errorList) !== null && _res$errorList !== void 0 && _res$errorList.length) && (resources === null || resources === void 0 || (_resources$ = resources[0]) === null || _resources$ === void 0 || (_resources$ = _resources$.resources) === null || _resources$ === void 0 || (_resources$ = _resources$[0]) === null || _resources$ === void 0 || (_resources$ = _resources$.renderList) === null || _resources$ === void 0 ? void 0 : _resources$.length) === 1)) {
|
|
661
|
+
_context12.next = 17;
|
|
771
662
|
break;
|
|
772
663
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
664
|
+
if (!isSkipUpdateFormStep) {
|
|
665
|
+
resultCarts = formatCartsResources(carts, resources, setPolicyIds); // 如果当前资源有表单,则添加表单步骤,否则删除表单步骤
|
|
666
|
+
checkHasFormStep({
|
|
667
|
+
nextStep: nextStep,
|
|
668
|
+
isSkip: true,
|
|
669
|
+
openLoginModal: openLoginModal,
|
|
670
|
+
utils: utils,
|
|
671
|
+
accountLists: accountLists,
|
|
672
|
+
getHolders: getHolders,
|
|
673
|
+
checkHolder: checkHolder,
|
|
674
|
+
setCarts: setCarts,
|
|
675
|
+
checkAccount: checkAccount,
|
|
676
|
+
carts: carts,
|
|
677
|
+
isFormSubject: isFormSubject,
|
|
678
|
+
hasResourceFormId: (resultCarts === null || resultCarts === void 0 ? void 0 : resultCarts.length) > 0,
|
|
679
|
+
currentStep: currentStep,
|
|
680
|
+
stepList: stepList,
|
|
681
|
+
appointmentBooking: appointmentBooking,
|
|
682
|
+
locales: locales,
|
|
683
|
+
isLogin: isLogin
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
return _context12.abrupt("return", true);
|
|
687
|
+
case 17:
|
|
688
|
+
return _context12.abrupt("return", false);
|
|
689
|
+
case 18:
|
|
690
|
+
_context12.next = 21;
|
|
691
|
+
break;
|
|
779
692
|
case 20:
|
|
780
|
-
|
|
693
|
+
return _context12.abrupt("return", false);
|
|
694
|
+
case 21:
|
|
695
|
+
_context12.next = 27;
|
|
781
696
|
break;
|
|
782
|
-
case
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
697
|
+
case 23:
|
|
698
|
+
_context12.prev = 23;
|
|
699
|
+
_context12.t0 = _context12["catch"](0);
|
|
700
|
+
console.log(_context12.t0, 'checkSkipResourceStep33');
|
|
701
|
+
return _context12.abrupt("return", false);
|
|
702
|
+
case 27:
|
|
787
703
|
case "end":
|
|
788
|
-
return
|
|
704
|
+
return _context12.stop();
|
|
789
705
|
}
|
|
790
|
-
},
|
|
706
|
+
}, _callee12, null, [[0, 23]]);
|
|
791
707
|
}));
|
|
792
|
-
return function checkSkipResourceStep() {
|
|
793
|
-
return
|
|
708
|
+
return function checkSkipResourceStep(_x8) {
|
|
709
|
+
return _ref20.apply(this, arguments);
|
|
794
710
|
};
|
|
795
711
|
}();
|
|
796
712
|
return {
|
|
@@ -808,13 +724,13 @@ export var useIsSkipResourceStep = function useIsSkipResourceStep() {
|
|
|
808
724
|
export var useAppointmentBookingSetting = function useAppointmentBookingSetting() {
|
|
809
725
|
var _appointmentBooking$o3;
|
|
810
726
|
var utils = contextUtils();
|
|
811
|
-
var
|
|
812
|
-
appointmentBooking =
|
|
813
|
-
var
|
|
814
|
-
bookingProcess =
|
|
815
|
-
bookingSubject =
|
|
816
|
-
customPageId =
|
|
817
|
-
channel =
|
|
727
|
+
var _useAppointmentBookin11 = useAppointmentBookingContext(),
|
|
728
|
+
appointmentBooking = _useAppointmentBookin11.appointmentBooking;
|
|
729
|
+
var _ref21 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o3 = appointmentBooking.otherParams) === null || _appointmentBooking$o3 === void 0 ? void 0 : _appointmentBooking$o3.productModuleParams) || {},
|
|
730
|
+
bookingProcess = _ref21.bookingProcess,
|
|
731
|
+
bookingSubject = _ref21.bookingSubject,
|
|
732
|
+
customPageId = _ref21.customPageId,
|
|
733
|
+
channel = _ref21.channel;
|
|
818
734
|
|
|
819
735
|
// 设置缓存
|
|
820
736
|
var setOtherData = function setOtherData(key, val) {
|