@pisell/private-materials 3.3.16 → 3.3.17
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.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +3 -3
- package/es/components/Sales/Summary/utils.d.ts +1 -1
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +4 -16
- package/es/components/appointmentBooking/components/Cart/Item/Total.js +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.js +40 -13
- package/es/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/utils.d.ts +20 -0
- package/es/components/appointmentBooking/components/Cart/utils.js +67 -1
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +2 -3
- package/es/components/appointmentBooking/components/Content/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Content/index.js +50 -7
- package/es/components/appointmentBooking/components/Date/index.js +10 -2
- package/es/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Form/index.js +61 -49
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Header/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Header/index.js +5 -4
- package/es/components/appointmentBooking/components/Services/index.js +2 -4
- package/es/components/appointmentBooking/components/Voucher/index.js +1 -1
- package/es/components/appointmentBooking/context.d.ts +5 -1
- package/es/components/appointmentBooking/context.js +37 -14
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +1 -0
- package/es/components/appointmentBooking/deposit/index.d.ts +1 -0
- package/es/components/appointmentBooking/hooks.js +7 -19
- package/es/components/appointmentBooking/locales.d.ts +3 -0
- package/es/components/appointmentBooking/locales.js +196 -193
- package/es/components/appointmentBooking/utils.js +21 -13
- package/es/components/booking/components/customSelect/index.js +2 -0
- package/es/components/booking/components/footer/index.d.ts +0 -1
- package/es/components/booking/components/footer/index.js +27 -22
- package/es/components/booking/components/footer/utils.d.ts +1 -0
- package/es/components/booking/components/footer/utils.js +17 -2
- package/es/components/booking/components/voucher/index.d.ts +1 -0
- package/es/components/booking/forms/footer.d.ts +1 -0
- package/es/components/booking/forms/forms.d.ts +4 -0
- package/es/components/booking/forms/forms.js +14 -3
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/es/components/booking/forms/single/index.d.ts +1 -2
- package/es/components/booking/forms/single/index.js +33 -26
- package/es/components/booking/hooks/useClearCart.d.ts +1 -0
- package/es/components/booking/info/client/index.js +24 -3
- package/es/components/booking/info/client/index.less +39 -0
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/es/components/booking/info/clientVariant/hooks/useClientFn.js +10 -1
- package/es/components/booking/info/clientVariant/utils.d.ts +1 -0
- package/es/components/booking/info/clientVariant/utils.js +6 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +17 -2
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.less +17 -0
- package/es/components/booking/info/clientVariant/vertical/index.js +29 -4
- package/es/components/booking/info/clientVariant/vertical/index.less +18 -0
- package/es/components/booking/info/dateRange/index.d.ts +1 -0
- package/es/components/booking/info/hooks/useAddHolder.d.ts +8 -1
- package/es/components/booking/info/hooks/useAddHolder.js +131 -31
- package/es/components/booking/info/hooks/useGetHolderList.d.ts +2 -0
- package/es/components/booking/info/hooks/useGetHolderList.js +48 -0
- package/es/components/booking/info/hooks/useHolderConfig.js +2 -2
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/es/components/booking/info/hooks/useInfoHolder.js +4 -41
- package/es/components/booking/info/pet/index.js +83 -8
- package/es/components/booking/info/pet/serve.d.ts +1 -0
- package/es/components/booking/info/pet/serve.js +27 -0
- package/es/components/booking/info/service/Lists.d.ts +0 -1
- package/es/components/booking/info/service/Lists.js +2 -1
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
- package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
- package/es/components/booking/info/service2/utils.d.ts +2 -0
- package/es/components/booking/info/service2/utils.js +20 -10
- package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
- package/es/components/booking/info2/utilsByBooking.d.ts +1 -0
- package/es/components/booking/info2/utilsByBooking.js +9 -1
- package/es/components/booking/locales.d.ts +21 -0
- package/es/components/booking/locales.js +42 -3
- package/es/components/booking/utils.js +3 -1
- 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 +1 -0
- package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/index.d.ts +1 -0
- package/es/components/productSelect/components/TabProduct/index.d.ts +1 -0
- package/es/components/productSelect/components/productGroup/index.d.ts +1 -0
- package/es/components/shoppingCart/Provider.js +0 -1
- package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Render/index.js +0 -1
- package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useClearCart.js +0 -2
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +2 -3
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/components/ticketBooking/index.js +5 -6
- package/es/components/ticketBooking/components/timeBar/index.d.ts +1 -0
- package/es/components/ticketBooking/index.d.ts +5 -2
- package/es/components/ticketBooking/index.js +20 -5
- package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/lib/components/Sales/Summary/utils.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +4 -8
- package/lib/components/appointmentBooking/components/Cart/Item/Total.js +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +27 -11
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/utils.d.ts +20 -0
- package/lib/components/appointmentBooking/components/Cart/utils.js +32 -2
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +3 -3
- package/lib/components/appointmentBooking/components/Content/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Content/index.js +26 -1
- package/lib/components/appointmentBooking/components/Date/index.js +4 -0
- package/lib/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Form/index.js +48 -36
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Header/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Header/index.js +5 -4
- package/lib/components/appointmentBooking/components/Services/index.js +4 -6
- package/lib/components/appointmentBooking/components/Voucher/index.js +2 -4
- package/lib/components/appointmentBooking/context.d.ts +5 -1
- package/lib/components/appointmentBooking/context.js +17 -5
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +1 -0
- package/lib/components/appointmentBooking/deposit/index.d.ts +1 -0
- package/lib/components/appointmentBooking/hooks.js +1 -12
- package/lib/components/appointmentBooking/locales.d.ts +3 -0
- package/lib/components/appointmentBooking/locales.js +4 -1
- package/lib/components/appointmentBooking/utils.js +19 -13
- package/lib/components/booking/components/customSelect/index.js +2 -0
- package/lib/components/booking/components/footer/index.d.ts +0 -1
- package/lib/components/booking/components/footer/index.js +3 -1
- package/lib/components/booking/components/footer/utils.d.ts +1 -0
- package/lib/components/booking/components/footer/utils.js +16 -1
- package/lib/components/booking/components/voucher/index.d.ts +1 -0
- package/lib/components/booking/forms/footer.d.ts +1 -0
- package/lib/components/booking/forms/forms.d.ts +4 -0
- package/lib/components/booking/forms/forms.js +13 -3
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/lib/components/booking/forms/single/index.d.ts +1 -2
- package/lib/components/booking/forms/single/index.js +13 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +1 -0
- package/lib/components/booking/info/client/index.js +20 -3
- package/lib/components/booking/info/client/index.less +39 -0
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +8 -1
- package/lib/components/booking/info/clientVariant/utils.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/utils.js +34 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +11 -3
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.less +17 -0
- package/lib/components/booking/info/clientVariant/vertical/index.js +31 -6
- package/lib/components/booking/info/clientVariant/vertical/index.less +18 -0
- package/lib/components/booking/info/dateRange/index.d.ts +1 -0
- package/lib/components/booking/info/hooks/useAddHolder.d.ts +8 -1
- package/lib/components/booking/info/hooks/useAddHolder.js +88 -16
- package/lib/components/booking/info/hooks/useGetHolderList.d.ts +2 -0
- package/lib/components/booking/info/hooks/useGetHolderList.js +61 -0
- package/lib/components/booking/info/hooks/useHolderConfig.js +2 -2
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/lib/components/booking/info/hooks/useInfoHolder.js +2 -21
- package/lib/components/booking/info/pet/index.js +57 -10
- package/lib/components/booking/info/pet/serve.d.ts +1 -0
- package/lib/components/booking/info/pet/serve.js +33 -0
- package/lib/components/booking/info/service/Lists.d.ts +0 -1
- package/lib/components/booking/info/service/Lists.js +1 -1
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
- package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
- package/lib/components/booking/info/service2/utils.d.ts +2 -0
- package/lib/components/booking/info/service2/utils.js +17 -7
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
- package/lib/components/booking/info2/utilsByBooking.d.ts +1 -0
- package/lib/components/booking/info2/utilsByBooking.js +8 -1
- package/lib/components/booking/locales.d.ts +21 -0
- package/lib/components/booking/locales.js +42 -3
- package/lib/components/booking/utils.js +3 -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 +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/index.d.ts +1 -0
- package/lib/components/productSelect/components/TabProduct/index.d.ts +1 -0
- package/lib/components/productSelect/components/productGroup/index.d.ts +1 -0
- package/lib/components/shoppingCart/Provider.js +0 -1
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Render/index.js +0 -1
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useClearCart.js +1 -2
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +2 -3
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.js +4 -3
- package/lib/components/ticketBooking/components/timeBar/index.d.ts +1 -0
- package/lib/components/ticketBooking/index.d.ts +5 -2
- package/lib/components/ticketBooking/index.js +13 -4
- package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/lowcode/ticket-booking/meta.ts +26 -0
- package/package.json +2 -2
|
@@ -25,7 +25,7 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
|
|
|
25
25
|
* @return {*}
|
|
26
26
|
* @Author: xiangfeng.xue
|
|
27
27
|
*/
|
|
28
|
-
export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00"
|
|
28
|
+
export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
|
|
29
29
|
/**
|
|
30
30
|
* 计算所有价格明细
|
|
31
31
|
* @param items - 购物车商品数组
|
|
@@ -29,7 +29,8 @@ var ContinueButton = function ContinueButton(_ref) {
|
|
|
29
29
|
appointmentBooking = _useAppointmentBookin3.appointmentBooking,
|
|
30
30
|
setCarts = _useAppointmentBookin3.setCarts,
|
|
31
31
|
loading = _useAppointmentBookin3.loading,
|
|
32
|
-
setIsErrorHolder = _useAppointmentBookin3.setIsErrorHolder
|
|
32
|
+
setIsErrorHolder = _useAppointmentBookin3.setIsErrorHolder,
|
|
33
|
+
isLastStep = _useAppointmentBookin3.isLastStep;
|
|
33
34
|
var _useAppointmentBookin4 = useAppointmentBookingSetting(),
|
|
34
35
|
isFormSubject = _useAppointmentBookin4.isFormSubject;
|
|
35
36
|
var stepList = useMemo(function () {
|
|
@@ -37,19 +38,6 @@ var ContinueButton = function ContinueButton(_ref) {
|
|
|
37
38
|
return 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;
|
|
38
39
|
}, [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]);
|
|
39
40
|
|
|
40
|
-
/**
|
|
41
|
-
* @title: 清空数据
|
|
42
|
-
* @description:
|
|
43
|
-
* @return {*}
|
|
44
|
-
* @Author: WangHan
|
|
45
|
-
* @Date: 2025-04-16 17:55
|
|
46
|
-
*/
|
|
47
|
-
var clearData = function clearData() {
|
|
48
|
-
var _shopDiscount$destroy;
|
|
49
|
-
appointmentBooking.destroy();
|
|
50
|
-
shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$destroy = shopDiscount.destroy) === null || _shopDiscount$destroy === void 0 || _shopDiscount$destroy.call(shopDiscount);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
41
|
/**
|
|
54
42
|
* @title: 检测holder主体数据是否选择
|
|
55
43
|
* @description:
|
|
@@ -164,12 +152,12 @@ var ContinueButton = function ContinueButton(_ref) {
|
|
|
164
152
|
* @Date: 2025-01-17 16:10
|
|
165
153
|
*/
|
|
166
154
|
var continueText = useMemo(function () {
|
|
167
|
-
if (
|
|
155
|
+
if (isLastStep) {
|
|
168
156
|
return locales.getText('pisell2.event.checkout');
|
|
169
157
|
} else {
|
|
170
158
|
return locales.getText('pisell2.event.close.continue');
|
|
171
159
|
}
|
|
172
|
-
}, [
|
|
160
|
+
}, [isLastStep]);
|
|
173
161
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
174
162
|
disabled: !(carts !== null && carts !== void 0 && carts.length),
|
|
175
163
|
size: "large",
|
|
@@ -19,7 +19,6 @@ var Total = function Total(_ref) {
|
|
|
19
19
|
isPriceIncludeTax = summary.isPriceIncludeTax,
|
|
20
20
|
total = summary.total,
|
|
21
21
|
deposit = summary.deposit;
|
|
22
|
-
console.log(summary, 'summarysummary');
|
|
23
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
24
23
|
className: "appointment-total-wrap ".concat(className, " ").concat(deposit !== null && deposit !== void 0 && deposit.hasDeposit ? 'appointment-total-deposit-wrap' : '')
|
|
25
24
|
}, !isPriceIncludeTax && Number(totalTaxFee) > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -19,9 +19,10 @@ import VoucherCard from "../../Voucher";
|
|
|
19
19
|
import Total from "./Total";
|
|
20
20
|
import Deposit from "../../Deposit";
|
|
21
21
|
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
22
|
+
import { handleAddHolder } from "../utils";
|
|
22
23
|
import "./index.less";
|
|
23
24
|
var CartItem = function CartItem(_ref) {
|
|
24
|
-
var _context$appHelper, _businessUtils$getApp, _currentStep$step, _currentStep$step2
|
|
25
|
+
var _context$appHelper, _businessUtils$getApp, _currentStep$step, _currentStep$step2;
|
|
25
26
|
var onNext = _ref.onNext;
|
|
26
27
|
var appointmentBooking = useAppointmentBooking();
|
|
27
28
|
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
@@ -31,7 +32,7 @@ var CartItem = function CartItem(_ref) {
|
|
|
31
32
|
setResourceOtherParams = _useAppointmentBookin.setResourceOtherParams,
|
|
32
33
|
resourceOtherParams = _useAppointmentBookin.resourceOtherParams,
|
|
33
34
|
summary = _useAppointmentBookin.summary,
|
|
34
|
-
|
|
35
|
+
isLastStep = _useAppointmentBookin.isLastStep;
|
|
35
36
|
var _useAppointmentBookin2 = useAppointmentBookingAccount(),
|
|
36
37
|
accountLists = _useAppointmentBookin2.accountLists,
|
|
37
38
|
getHolders = _useAppointmentBookin2.getHolders,
|
|
@@ -40,7 +41,8 @@ var CartItem = function CartItem(_ref) {
|
|
|
40
41
|
var _useAppointmentBookin3 = useAppointmentBookingResource(),
|
|
41
42
|
getResourceList = _useAppointmentBookin3.getResourceList;
|
|
42
43
|
var _useAppointmentBookin4 = useAppointmentBookingSetting(),
|
|
43
|
-
isFormSubject = _useAppointmentBookin4.isFormSubject
|
|
44
|
+
isFormSubject = _useAppointmentBookin4.isFormSubject,
|
|
45
|
+
bookingSubject = _useAppointmentBookin4.bookingSubject;
|
|
44
46
|
var _useAppointmentBookin5 = useAppointmentBookingLogin(),
|
|
45
47
|
isLogin = _useAppointmentBookin5.isLogin;
|
|
46
48
|
var context = useEngineContext();
|
|
@@ -125,8 +127,10 @@ var CartItem = function CartItem(_ref) {
|
|
|
125
127
|
|
|
126
128
|
// 添加holder
|
|
127
129
|
if (type === 'add_holder') {
|
|
130
|
+
// 关联的表单id
|
|
131
|
+
var relationShipFormId = bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.relationship_form_id;
|
|
128
132
|
return openForm({
|
|
129
|
-
form_id: form_id,
|
|
133
|
+
form_id: relationShipFormId || (bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id),
|
|
130
134
|
title: locales.getText('pisell2.event.create.form'),
|
|
131
135
|
utils: utils,
|
|
132
136
|
callback: function () {
|
|
@@ -136,18 +140,41 @@ var CartItem = function CartItem(_ref) {
|
|
|
136
140
|
while (1) switch (_context.prev = _context.next) {
|
|
137
141
|
case 0:
|
|
138
142
|
if (!((res === null || res === void 0 ? void 0 : res.status) === 'success')) {
|
|
139
|
-
_context.next =
|
|
143
|
+
_context.next = 12;
|
|
140
144
|
break;
|
|
141
145
|
}
|
|
142
|
-
|
|
146
|
+
result = undefined; // 未关联表,则将接口返回的数据作为holder数据
|
|
147
|
+
if (relationShipFormId) {
|
|
148
|
+
_context.next = 8;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
_context.next = 5;
|
|
143
152
|
return addAccount(res === null || res === void 0 ? void 0 : res.values, 'holder');
|
|
144
|
-
case
|
|
153
|
+
case 5:
|
|
145
154
|
result = _context.sent;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
155
|
+
_context.next = 11;
|
|
156
|
+
break;
|
|
157
|
+
case 8:
|
|
158
|
+
_context.next = 10;
|
|
159
|
+
return handleAddHolder({
|
|
160
|
+
res: res,
|
|
161
|
+
bookingSubject: bookingSubject,
|
|
162
|
+
accountLists: accountLists,
|
|
163
|
+
cartItem: e,
|
|
164
|
+
getHolders: getHolders,
|
|
165
|
+
appointmentBooking: appointmentBooking
|
|
149
166
|
});
|
|
150
|
-
case
|
|
167
|
+
case 10:
|
|
168
|
+
result = _context.sent;
|
|
169
|
+
case 11:
|
|
170
|
+
// 更新购物车的holder数据
|
|
171
|
+
if (result) {
|
|
172
|
+
appointmentBooking.updateCart({
|
|
173
|
+
_id: e === null || e === void 0 ? void 0 : e._id,
|
|
174
|
+
account: result
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
case 12:
|
|
151
178
|
case "end":
|
|
152
179
|
return _context.stop();
|
|
153
180
|
}
|
|
@@ -170,11 +197,11 @@ var CartItem = function CartItem(_ref) {
|
|
|
170
197
|
products: formatCarts(carts, resources, accountLists),
|
|
171
198
|
hideAddBtn: false,
|
|
172
199
|
holders: holders,
|
|
173
|
-
disabledEdit:
|
|
200
|
+
disabledEdit: isLastStep,
|
|
174
201
|
isShowChangeResource: (currentStep === null || currentStep === void 0 || (_currentStep$step = currentStep.step) === null || _currentStep$step === void 0 ? void 0 : _currentStep$step.key) === 'select-resource',
|
|
175
202
|
isShowDelete: (currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.key) === 'select-service',
|
|
176
203
|
isShowPackageNote: false,
|
|
177
|
-
isShowChangeHolder:
|
|
204
|
+
isShowChangeHolder: isLastStep ? false : isFormSubject && isLogin,
|
|
178
205
|
isShowHolder: isFormSubject,
|
|
179
206
|
isShowAddHolderButton: true
|
|
180
207
|
},
|
|
@@ -33,4 +33,24 @@ interface CheckResourceParams {
|
|
|
33
33
|
carts: any[];
|
|
34
34
|
}
|
|
35
35
|
export declare type StepKey = 'select-resource' | 'fill-form' | 'select-time' | 'confirm-information' | 'select-service' | 'select-date' | 'select-guest';
|
|
36
|
+
interface AddHolderParams {
|
|
37
|
+
res: any;
|
|
38
|
+
bookingSubject: any;
|
|
39
|
+
accountLists: any[];
|
|
40
|
+
cartItem: any;
|
|
41
|
+
getHolders: () => void;
|
|
42
|
+
appointmentBooking: any;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @title: 添加holder
|
|
46
|
+
* @description:
|
|
47
|
+
* @param {any} res
|
|
48
|
+
* @param {any} bookingSubject
|
|
49
|
+
* @param {any} accountLists
|
|
50
|
+
* @param {any} e
|
|
51
|
+
* @return {*}
|
|
52
|
+
* @Author: WangHan
|
|
53
|
+
* @Date: 2025-05-10 18:25
|
|
54
|
+
*/
|
|
55
|
+
export declare const handleAddHolder: ({ res, bookingSubject, accountLists, cartItem, getHolders, appointmentBooking }: AddHolderParams) => Promise<any>;
|
|
36
56
|
export {};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -101,4 +107,64 @@ export var checkResource = function checkResource(_ref4) {
|
|
|
101
107
|
return false;
|
|
102
108
|
};
|
|
103
109
|
|
|
104
|
-
// 定义步骤 key 类型
|
|
110
|
+
// 定义步骤 key 类型
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @title: 添加holder
|
|
114
|
+
* @description:
|
|
115
|
+
* @param {any} res
|
|
116
|
+
* @param {any} bookingSubject
|
|
117
|
+
* @param {any} accountLists
|
|
118
|
+
* @param {any} e
|
|
119
|
+
* @return {*}
|
|
120
|
+
* @Author: WangHan
|
|
121
|
+
* @Date: 2025-05-10 18:25
|
|
122
|
+
*/
|
|
123
|
+
export var handleAddHolder = /*#__PURE__*/function () {
|
|
124
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
|
|
125
|
+
var res, bookingSubject, accountLists, cartItem, getHolders, appointmentBooking, _res$values, result, relationShipForms, currentForm, form_record_id, oldAccount, newAccountLists, newAccount;
|
|
126
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
127
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
res = _ref5.res, bookingSubject = _ref5.bookingSubject, accountLists = _ref5.accountLists, cartItem = _ref5.cartItem, getHolders = _ref5.getHolders, appointmentBooking = _ref5.appointmentBooking;
|
|
130
|
+
_context2.prev = 1;
|
|
131
|
+
result = undefined; // 所有被关联的表数据
|
|
132
|
+
relationShipForms = (res === null || res === void 0 || (_res$values = res.values) === null || _res$values === void 0 ? void 0 : _res$values.form_to_form_value) || []; // 找到当前的表数据
|
|
133
|
+
currentForm = relationShipForms.find(function (item) {
|
|
134
|
+
return item.form_id === (bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id);
|
|
135
|
+
}); // 找到当前新创建的表
|
|
136
|
+
form_record_id = Math.max.apply(Math, _toConsumableArray((currentForm === null || currentForm === void 0 ? void 0 : currentForm.form_data_value) || []));
|
|
137
|
+
oldAccount = accountLists.find(function (item) {
|
|
138
|
+
return item.id === form_record_id;
|
|
139
|
+
}); // 重新获取holder列表
|
|
140
|
+
_context2.next = 9;
|
|
141
|
+
return getHolders();
|
|
142
|
+
case 9:
|
|
143
|
+
_context2.next = 11;
|
|
144
|
+
return appointmentBooking.getAccounts();
|
|
145
|
+
case 11:
|
|
146
|
+
newAccountLists = _context2.sent;
|
|
147
|
+
// 编辑已有的表单, 判断当前购物车中是否有holder数据,没有则更新列表的第一条数据
|
|
148
|
+
if (oldAccount) {
|
|
149
|
+
result = !(cartItem !== null && cartItem !== void 0 && cartItem.holder_id) ? _objectSpread({}, accountLists === null || accountLists === void 0 ? void 0 : accountLists[0]) : undefined;
|
|
150
|
+
} else {
|
|
151
|
+
// 创建表单
|
|
152
|
+
newAccount = newAccountLists.find(function (item) {
|
|
153
|
+
return item.id === form_record_id;
|
|
154
|
+
});
|
|
155
|
+
result = _objectSpread({}, newAccount || (newAccountLists === null || newAccountLists === void 0 ? void 0 : newAccountLists[0]));
|
|
156
|
+
}
|
|
157
|
+
return _context2.abrupt("return", result);
|
|
158
|
+
case 16:
|
|
159
|
+
_context2.prev = 16;
|
|
160
|
+
_context2.t0 = _context2["catch"](1);
|
|
161
|
+
case 18:
|
|
162
|
+
case "end":
|
|
163
|
+
return _context2.stop();
|
|
164
|
+
}
|
|
165
|
+
}, _callee2, null, [[1, 16]]);
|
|
166
|
+
}));
|
|
167
|
+
return function handleAddHolder(_x2) {
|
|
168
|
+
return _ref6.apply(this, arguments);
|
|
169
|
+
};
|
|
170
|
+
}();
|
|
@@ -53,7 +53,6 @@ var ConfirmInformation = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
53
53
|
var _utils$history;
|
|
54
54
|
var url = "/payment-finish/success?order_id=".concat(order_id, "&amount=").concat(Number(amount));
|
|
55
55
|
utils === null || utils === void 0 || (_utils$history = utils.history) === null || _utils$history === void 0 || _utils$history.replace(url);
|
|
56
|
-
clearData();
|
|
57
56
|
setLoading(false);
|
|
58
57
|
};
|
|
59
58
|
|
|
@@ -96,10 +95,10 @@ var ConfirmInformation = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
96
95
|
type: 'pisell1.payment',
|
|
97
96
|
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
98
97
|
total_amount: _total
|
|
99
|
-
})
|
|
98
|
+
}),
|
|
99
|
+
callback: function callback(e) {}
|
|
100
100
|
});
|
|
101
101
|
setTimeout(function () {
|
|
102
|
-
clearData();
|
|
103
102
|
setLoading(false);
|
|
104
103
|
}, 200);
|
|
105
104
|
_context.next = 24;
|
|
@@ -23,10 +23,11 @@ import Guest from "../Guest";
|
|
|
23
23
|
import Form from "../Form";
|
|
24
24
|
import ConfirmInformation from "../ConfirmInformation";
|
|
25
25
|
import { useAppointmentBookingContext } from "../../context";
|
|
26
|
-
import
|
|
26
|
+
import PolicyModal from "../../deposit/components/PolicyModal";
|
|
27
|
+
import { useAppointmentBookingCart, useAppointmentBookingStep, useAppointmentBookingSetting, useAppointmentBookingLogin, useAppointmentBookingAccount, useShopDiscount } from "../../hooks";
|
|
27
28
|
import "./index.less";
|
|
28
29
|
var Layout = function Layout() {
|
|
29
|
-
var _currentStep$step, _currentStep$step3, _currentStep$step4, _currentStep$step6, _currentStep$
|
|
30
|
+
var _currentStep$step, _currentStep$step3, _currentStep$step4, _currentStep$step6, _currentStep$step8;
|
|
30
31
|
var stepRef = useRef();
|
|
31
32
|
var formRef = useRef();
|
|
32
33
|
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
@@ -47,17 +48,30 @@ var Layout = function Layout() {
|
|
|
47
48
|
var _useAppointmentBookin5 = useAppointmentBookingStep(),
|
|
48
49
|
removeStep = _useAppointmentBookin5.removeStep,
|
|
49
50
|
stepList = _useAppointmentBookin5.stepList;
|
|
51
|
+
var _useShopDiscount = useShopDiscount(),
|
|
52
|
+
shopDiscount = _useShopDiscount.shopDiscount;
|
|
53
|
+
var _useState = useState(false),
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
showAgreement = _useState2[0],
|
|
56
|
+
setShowAgreement = _useState2[1];
|
|
57
|
+
var _useState3 = useState({}),
|
|
58
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
+
agreementContent = _useState4[0],
|
|
60
|
+
setAgreementContent = _useState4[1];
|
|
50
61
|
|
|
51
62
|
// 不要删除
|
|
52
63
|
useAppointmentBookingCart();
|
|
53
64
|
useAppointmentBookingStep();
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
params =
|
|
57
|
-
setParams =
|
|
65
|
+
var _useState5 = useState({}),
|
|
66
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
67
|
+
params = _useState6[0],
|
|
68
|
+
setParams = _useState6[1];
|
|
58
69
|
useEffect(function () {
|
|
59
70
|
return function () {
|
|
71
|
+
var _shopDiscount$destroy;
|
|
60
72
|
setIsAgreeDepositPolicy(false);
|
|
73
|
+
appointmentBooking.destroy();
|
|
74
|
+
shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$destroy = shopDiscount.destroy) === null || _shopDiscount$destroy === void 0 || _shopDiscount$destroy.call(shopDiscount);
|
|
61
75
|
};
|
|
62
76
|
}, []);
|
|
63
77
|
useEffect(function () {
|
|
@@ -162,17 +176,46 @@ var Layout = function Layout() {
|
|
|
162
176
|
}
|
|
163
177
|
}));
|
|
164
178
|
}, [isDateSelectedFirst, currentStep === null || currentStep === void 0 || (_currentStep$step6 = currentStep.step) === null || _currentStep$step6 === void 0 ? void 0 : _currentStep$step6.key]);
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @title: 是否显示底部
|
|
182
|
+
* @description:
|
|
183
|
+
* @param {*} useMemo
|
|
184
|
+
* @return {*}
|
|
185
|
+
* @Author: WangHan
|
|
186
|
+
* @Date: 2025-05-10 17:42
|
|
187
|
+
*/
|
|
188
|
+
var isFooter = useMemo(function () {
|
|
189
|
+
var _currentStep$step7;
|
|
190
|
+
if (!isMobile()) return false;
|
|
191
|
+
var key = currentStep === null || currentStep === void 0 || (_currentStep$step7 = currentStep.step) === null || _currentStep$step7 === void 0 ? void 0 : _currentStep$step7.key;
|
|
192
|
+
|
|
193
|
+
// 先选日期并且当前步骤是选择日期,则不显示底部
|
|
194
|
+
if (isDateSelectedFirst && key === 'select-date') return false;
|
|
195
|
+
return key !== 'confirm-information';
|
|
196
|
+
}, [isDateSelectedFirst, currentStep === null || currentStep === void 0 || (_currentStep$step8 = currentStep.step) === null || _currentStep$step8 === void 0 ? void 0 : _currentStep$step8.key]);
|
|
197
|
+
var handleAgreementOk = function handleAgreementOk() {
|
|
198
|
+
setShowAgreement(false);
|
|
199
|
+
// goToNextForm();
|
|
200
|
+
};
|
|
165
201
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement("div", {
|
|
166
202
|
className: "parallel-content-wrap ".concat(isMobile() ? 'parallel-content-mobile-wrap' : '')
|
|
167
203
|
}, /*#__PURE__*/React.createElement("div", {
|
|
168
204
|
className: "parallel-content-left"
|
|
169
|
-
}, Com), isShowCartCom),
|
|
205
|
+
}, Com), isShowCartCom), isFooter ? /*#__PURE__*/React.createElement(Footer
|
|
170
206
|
// isOpen={params?.isOpen}
|
|
171
207
|
, {
|
|
172
208
|
onNext: function onNext() {
|
|
173
209
|
var _stepRef$current2, _stepRef$current2$nex;
|
|
174
210
|
return stepRef === null || stepRef === void 0 || (_stepRef$current2 = stepRef.current) === null || _stepRef$current2 === void 0 || (_stepRef$current2$nex = _stepRef$current2.next) === null || _stepRef$current2$nex === void 0 ? void 0 : _stepRef$current2$nex.call(_stepRef$current2);
|
|
175
211
|
}
|
|
212
|
+
}) : null, showAgreement ? /*#__PURE__*/React.createElement(PolicyModal, {
|
|
213
|
+
open: showAgreement,
|
|
214
|
+
onCancel: handleAgreementOk,
|
|
215
|
+
item: agreementContent,
|
|
216
|
+
onChange: function onChange() {
|
|
217
|
+
return setLoading(false);
|
|
218
|
+
}
|
|
176
219
|
}) : null);
|
|
177
220
|
};
|
|
178
221
|
export default Layout;
|
|
@@ -55,7 +55,7 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
55
55
|
return {
|
|
56
56
|
next: function () {
|
|
57
57
|
var _next2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
58
|
-
var data;
|
|
58
|
+
var data, result;
|
|
59
59
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
60
60
|
while (1) switch (_context.prev = _context.next) {
|
|
61
61
|
case 0:
|
|
@@ -69,8 +69,16 @@ var Date = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
69
|
}
|
|
70
70
|
return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unselect.date')));
|
|
71
71
|
case 5:
|
|
72
|
+
// 判断选定的日期是否存在可用的预约
|
|
73
|
+
result = appointmentBooking.checkResourceListForDate();
|
|
74
|
+
if (result) {
|
|
75
|
+
_context.next = 8;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unuse.date')));
|
|
79
|
+
case 8:
|
|
72
80
|
appointmentBooking.next();
|
|
73
|
-
case
|
|
81
|
+
case 9:
|
|
74
82
|
case "end":
|
|
75
83
|
return _context.stop();
|
|
76
84
|
}
|
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useMemo, useRef, useState, useImperativeHandle, forwardRef } from 'react';
|
|
13
|
+
import React, { useMemo, useRef, useState, useImperativeHandle, forwardRef, useEffect } from 'react';
|
|
14
14
|
import useComponents from "../../../../hooks/useComponents";
|
|
15
15
|
import { formatForms, formatCarts, updateLists, updateBookingFormStorage } from "../../utils";
|
|
16
16
|
import { useAppointmentBookingContext } from "../../context";
|
|
@@ -35,6 +35,14 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
35
35
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
36
36
|
formStatus = _useState8[0],
|
|
37
37
|
setFormStatus = _useState8[1];
|
|
38
|
+
var _useState9 = useState(false),
|
|
39
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
40
|
+
isClearData = _useState10[0],
|
|
41
|
+
setIsClearData = _useState10[1];
|
|
42
|
+
var _useState11 = useState(0),
|
|
43
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
44
|
+
formId = _useState12[0],
|
|
45
|
+
setFormId = _useState12[1];
|
|
38
46
|
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
39
47
|
carts = _useAppointmentBookin.carts,
|
|
40
48
|
appointmentBooking = _useAppointmentBookin.appointmentBooking,
|
|
@@ -55,6 +63,9 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
55
63
|
});
|
|
56
64
|
var key = 'booking_form';
|
|
57
65
|
|
|
66
|
+
// 获取本地存储
|
|
67
|
+
var formStorage = getOtherData('booking_form') || {};
|
|
68
|
+
|
|
58
69
|
/**
|
|
59
70
|
* @title: 获取资源列表
|
|
60
71
|
* @description:
|
|
@@ -67,25 +78,15 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
67
78
|
var _resource = getResourceList();
|
|
68
79
|
return (_resource === null || _resource === void 0 ? void 0 : _resource.resources) || [];
|
|
69
80
|
}, []);
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @title: 获取本地存储表单
|
|
73
|
-
* @description:
|
|
74
|
-
* @param {*} useMemo
|
|
75
|
-
* @return {*}
|
|
76
|
-
* @Author: WangHan
|
|
77
|
-
* @Date: 2025-05-06 10:00
|
|
78
|
-
*/
|
|
79
|
-
var formStorage = useMemo(function () {
|
|
80
|
-
return getOtherData(key);
|
|
81
|
-
}, []);
|
|
82
81
|
var newCarts = formatCarts(carts, resources);
|
|
83
82
|
var forms = useMemo(function () {
|
|
84
83
|
if (!(newCarts !== null && newCarts !== void 0 && newCarts.length) || !(resources !== null && resources !== void 0 && resources.length)) return [];
|
|
85
84
|
return formatForms(newCarts) || [];
|
|
86
85
|
}, [newCarts, resources]);
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
useEffect(function () {
|
|
87
|
+
var _forms$currentFormInd;
|
|
88
|
+
if (!(forms !== null && forms !== void 0 && forms.length)) return;
|
|
89
|
+
setFormId((forms === null || forms === void 0 || (_forms$currentFormInd = forms[currentFormIndex]) === null || _forms$currentFormInd === void 0 ? void 0 : _forms$currentFormInd.form_id) || 0);
|
|
89
90
|
}, [forms, currentFormIndex]);
|
|
90
91
|
var _useComponents = useComponents({
|
|
91
92
|
components: ['FormCard']
|
|
@@ -104,7 +105,9 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
104
105
|
var nextIndex = currentFormIndex + 1;
|
|
105
106
|
if (nextIndex < forms.length) {
|
|
106
107
|
var _forms$nextIndex, _forms$nextIndex2;
|
|
108
|
+
setIsClearData(true);
|
|
107
109
|
setCurrentFormIndex(nextIndex);
|
|
110
|
+
|
|
108
111
|
// 如果下一个表单没有id但有协议,直接弹协议
|
|
109
112
|
if (!(forms !== null && forms !== void 0 && (_forms$nextIndex = forms[nextIndex]) !== null && _forms$nextIndex !== void 0 && _forms$nextIndex.form_id) && forms !== null && forms !== void 0 && (_forms$nextIndex2 = forms[nextIndex]) !== null && _forms$nextIndex2 !== void 0 && _forms$nextIndex2.policy_id) {
|
|
110
113
|
var _forms$nextIndex3;
|
|
@@ -113,6 +116,8 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
113
116
|
id: forms === null || forms === void 0 || (_forms$nextIndex3 = forms[nextIndex]) === null || _forms$nextIndex3 === void 0 ? void 0 : _forms$nextIndex3.policy_id
|
|
114
117
|
});
|
|
115
118
|
setShowAgreement(true);
|
|
119
|
+
} else {
|
|
120
|
+
setLoading(false);
|
|
116
121
|
}
|
|
117
122
|
} else {
|
|
118
123
|
appointmentBooking.next();
|
|
@@ -131,7 +136,7 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
131
136
|
if (status === 'error') {
|
|
132
137
|
setLoading(false);
|
|
133
138
|
}
|
|
134
|
-
var newFormStatus = updateLists(formStatus, 'id',
|
|
139
|
+
var newFormStatus = updateLists(formStatus, 'id', formId, {
|
|
135
140
|
status: status
|
|
136
141
|
});
|
|
137
142
|
setFormStatus(newFormStatus);
|
|
@@ -146,16 +151,18 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
146
151
|
* @Date: 2025-04-28 11:32
|
|
147
152
|
*/
|
|
148
153
|
var setFormStorage = function setFormStorage(values) {
|
|
154
|
+
var _forms$currentFormInd2;
|
|
155
|
+
var cart_id = forms === null || forms === void 0 || (_forms$currentFormInd2 = forms[currentFormIndex]) === null || _forms$currentFormInd2 === void 0 ? void 0 : _forms$currentFormInd2.cart_id;
|
|
149
156
|
var oldData = getOtherData(key);
|
|
150
|
-
var newData = updateBookingFormStorage(oldData,
|
|
157
|
+
var newData = updateBookingFormStorage(oldData, cart_id, values);
|
|
151
158
|
setOtherData(key, _objectSpread({}, newData));
|
|
152
159
|
|
|
153
160
|
// 更新表单购物车
|
|
154
161
|
appointmentBooking.updateCart({
|
|
155
|
-
_id:
|
|
162
|
+
_id: cart_id,
|
|
156
163
|
relationForms: [{
|
|
157
|
-
form_id:
|
|
158
|
-
form_record_ids: [
|
|
164
|
+
form_id: formId,
|
|
165
|
+
form_record_ids: [values === null || values === void 0 ? void 0 : values.form_record_id]
|
|
159
166
|
}]
|
|
160
167
|
});
|
|
161
168
|
};
|
|
@@ -170,14 +177,17 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
170
177
|
* @Date: 2025-04-28 11:34
|
|
171
178
|
*/
|
|
172
179
|
var handleFormFinish = function handleFormFinish(status, values) {
|
|
180
|
+
setIsClearData(false);
|
|
173
181
|
updateFormStatus(status);
|
|
174
182
|
if (status === 'success') {
|
|
183
|
+
var _forms$currentFormInd3;
|
|
175
184
|
setFormStorage(values);
|
|
176
185
|
|
|
177
186
|
// 判断当前表单是否有协议
|
|
178
|
-
if (
|
|
187
|
+
if (forms !== null && forms !== void 0 && (_forms$currentFormInd3 = forms[currentFormIndex]) !== null && _forms$currentFormInd3 !== void 0 && _forms$currentFormInd3.policy_id) {
|
|
188
|
+
var _forms$currentFormInd4;
|
|
179
189
|
setAgreementContent({
|
|
180
|
-
id:
|
|
190
|
+
id: forms === null || forms === void 0 || (_forms$currentFormInd4 = forms[currentFormIndex]) === null || _forms$currentFormInd4 === void 0 ? void 0 : _forms$currentFormInd4.policy_id
|
|
181
191
|
});
|
|
182
192
|
setShowAgreement(true);
|
|
183
193
|
} else {
|
|
@@ -189,33 +199,35 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
189
199
|
setShowAgreement(false);
|
|
190
200
|
goToNextForm();
|
|
191
201
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
202
|
+
var formCom = useMemo(function () {
|
|
203
|
+
var _forms$currentFormInd5;
|
|
204
|
+
if (!formId) return;
|
|
205
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
className: "appointment-form-wrap"
|
|
207
|
+
}, /*#__PURE__*/React.createElement(FormCard, {
|
|
208
|
+
id: formId,
|
|
209
|
+
ref: manualRef,
|
|
210
|
+
isGetLastData: false,
|
|
211
|
+
setting: {
|
|
212
|
+
isHidden: 1
|
|
213
|
+
},
|
|
214
|
+
formWrapStyle: {
|
|
215
|
+
padding: '16px'
|
|
216
|
+
},
|
|
217
|
+
isV2API: true,
|
|
218
|
+
isShowSkeleton: true,
|
|
219
|
+
onSubmit: function onSubmit(status, values) {
|
|
220
|
+
handleFormFinish(status, values);
|
|
221
|
+
},
|
|
222
|
+
onFinishFailed: function onFinishFailed(e) {
|
|
223
|
+
updateFormStatus('error');
|
|
224
|
+
},
|
|
225
|
+
onFormValueChange: function onFormValueChange(values) {},
|
|
226
|
+
defaultValues: (formStorage === null || formStorage === void 0 ? void 0 : formStorage[forms === null || forms === void 0 || (_forms$currentFormInd5 = forms[currentFormIndex]) === null || _forms$currentFormInd5 === void 0 ? void 0 : _forms$currentFormInd5.cart_id]) || {},
|
|
227
|
+
isClearData: false
|
|
228
|
+
}));
|
|
229
|
+
}, [currentFormIndex, formId]);
|
|
230
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, formCom, showAgreement ? /*#__PURE__*/React.createElement(PolicyModal, {
|
|
219
231
|
open: showAgreement,
|
|
220
232
|
onCancel: handleAgreementOk,
|
|
221
233
|
item: agreementContent,
|