@pisell/private-materials 3.3.26 → 3.3.27
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 +8 -8
- 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 +5 -5
- package/es/components/Sales/Customer/index.js +3 -1
- package/es/components/Sales/Event/Detail.js +5 -1
- package/es/components/Sales/Event/serve.d.ts +3 -0
- package/es/components/Sales/Init/index.d.ts +1 -0
- package/es/components/Sales/Init/index.js +3 -2
- package/es/components/Sales/Step/index.d.ts +2 -0
- package/es/components/Sales/Step/index.js +13 -4
- package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +5 -5
- package/es/components/appointmentBooking/components/Content/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Services/index.js +2 -0
- package/es/components/appointmentBooking/deposit/index.js +2 -2
- package/es/components/appointmentBooking/index.d.ts +1 -0
- package/es/components/booking/components/footer/utils.js +16 -15
- package/es/components/booking/hooks/useQuotation.d.ts +4 -0
- package/es/components/booking/hooks/useQuotation.js +256 -0
- package/es/components/booking/info/index.d.ts +0 -1
- package/es/components/booking/info/service/addService/index.d.ts +1 -0
- package/es/components/booking/info/service/addService/index.js +4 -4
- package/es/components/booking/info/service/editService/index.js +6 -3
- package/es/components/booking/info/service/index.js +4 -1
- package/es/components/booking/info/service2/Group/utils.js +1 -1
- package/es/components/booking/info/service2/hooks/useSelectPet.js +6 -4
- package/es/components/booking/info/service2/index.js +4 -1
- package/es/components/booking/info2/service/addService/index.d.ts +1 -0
- package/es/components/booking/info2/service/addService/index.js +29 -9
- package/es/components/booking/info2/service/editService/index.js +2 -0
- package/es/components/booking/info2/service/index.js +4 -1
- package/es/components/booking/locales.d.ts +6 -0
- package/es/components/booking/locales.js +9 -3
- package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/es/components/eftposPay/component/fail/index.d.ts +1 -0
- package/es/components/eftposPay/component/fail/unknow.d.ts +1 -0
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.d.ts +1 -0
- package/es/components/eftposPay/pay.d.ts +1 -0
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +122 -31
- package/es/components/eventBooking/components/Provider/Event/index.js +20 -4
- package/es/components/eventBooking/components/Provider/Resource/index.js +26 -5
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.d.ts +2 -2
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.js +1 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.js +5 -2
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.js +7 -2
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +3 -0
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.js +60 -0
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.less +63 -0
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimes/index.d.ts +9 -0
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimes/index.js +59 -0
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimes/index.less +7 -0
- package/es/components/eventBooking/components/scheduleCalendar/index.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/index.js +30 -21
- package/es/components/eventBooking/components/scheduleCalendar/index.less +2 -0
- package/es/components/eventBooking/index.d.ts +1 -0
- package/es/components/eventBooking/index.js +2 -2
- package/es/components/eventBooking/locales.d.ts +6 -0
- package/es/components/eventBooking/locales.js +166 -160
- package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +3 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.js +3 -2
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +5 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +73 -20
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.less +30 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +2 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +2 -1
- package/es/components/pay/toC/WalletPassBlock/components/WalletAvailable/index.d.ts +16 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletAvailable/index.js +60 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletAvailable/index.less +38 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletBestValueFound/index.d.ts +17 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletBestValueFound/index.js +98 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletBestValueFound/index.less +133 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +7 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.js +34 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.less +23 -0
- package/es/components/pay/toC/WalletPassBlock/index.d.ts +9 -2
- package/es/components/pay/toC/WalletPassBlock/index.js +119 -21
- package/es/components/pay/toC/WalletPassBlock/index.less +82 -13
- package/es/components/pay/toC/index.js +138 -89
- package/es/components/pay/toC/locales.d.ts +69 -3
- package/es/components/pay/toC/locales.js +132 -6
- package/es/components/pay/toC/model.d.ts +4 -0
- package/es/components/pay/toC/model.js +9 -0
- package/es/components/pay/toC/serve.d.ts +23 -0
- package/es/components/pay/toC/serve.js +34 -2
- package/es/components/pay/toC/utils.d.ts +3 -1
- package/es/components/pay/toC/utils.js +8 -3
- package/es/components/productSelect/components/productGroup/index.less +4 -12
- package/es/components/productSelect/index.less +1 -1
- package/es/components/ruleSetting/index.d.ts +1 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +15 -20
- package/es/components/ticketBooking/components/menuBar/index.less +0 -1
- package/es/components/ticketBooking/components/ticketBooking/index.less +2 -4
- package/es/hooks/useLocale.d.ts +2 -0
- package/es/hooks/useLocale.js +7 -0
- package/es/hooks/useLoginUser.d.ts +2 -0
- package/es/hooks/useLoginUser.js +19 -0
- package/lib/components/Sales/Customer/index.js +3 -1
- package/lib/components/Sales/Event/Detail.js +5 -1
- package/lib/components/Sales/Event/serve.d.ts +3 -0
- package/lib/components/Sales/Init/index.d.ts +1 -0
- package/lib/components/Sales/Init/index.js +3 -2
- package/lib/components/Sales/Step/index.d.ts +2 -0
- package/lib/components/Sales/Step/index.js +13 -4
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +2 -2
- package/lib/components/appointmentBooking/components/Content/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Services/index.js +2 -0
- package/lib/components/appointmentBooking/deposit/index.js +2 -2
- package/lib/components/appointmentBooking/index.d.ts +1 -0
- package/lib/components/booking/components/footer/utils.js +5 -4
- package/lib/components/booking/hooks/useQuotation.d.ts +4 -0
- package/lib/components/booking/hooks/useQuotation.js +210 -0
- package/lib/components/booking/info/index.d.ts +0 -1
- package/lib/components/booking/info/service/addService/index.d.ts +1 -0
- package/lib/components/booking/info/service/addService/index.js +2 -3
- package/lib/components/booking/info/service/editService/index.js +5 -2
- package/lib/components/booking/info/service/index.js +3 -1
- package/lib/components/booking/info/service2/Group/utils.js +2 -2
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +5 -3
- package/lib/components/booking/info/service2/index.js +3 -1
- package/lib/components/booking/info2/service/addService/index.d.ts +1 -0
- package/lib/components/booking/info2/service/addService/index.js +25 -17
- package/lib/components/booking/info2/service/editService/index.js +2 -1
- package/lib/components/booking/info2/service/index.js +3 -1
- package/lib/components/booking/locales.d.ts +6 -0
- package/lib/components/booking/locales.js +9 -3
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/lib/components/eftposPay/component/fail/index.d.ts +1 -0
- package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -0
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.d.ts +1 -0
- package/lib/components/eftposPay/pay.d.ts +1 -0
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +52 -4
- package/lib/components/eventBooking/components/Provider/Event/index.js +15 -3
- package/lib/components/eventBooking/components/Provider/Resource/index.js +16 -3
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.d.ts +2 -2
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.js +7 -7
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.js +3 -1
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.js +6 -5
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +3 -0
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.js +75 -0
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.less +63 -0
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimes/index.d.ts +9 -0
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimes/index.js +64 -0
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimes/index.less +7 -0
- package/lib/components/eventBooking/components/scheduleCalendar/index.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/index.js +17 -11
- package/lib/components/eventBooking/components/scheduleCalendar/index.less +2 -0
- package/lib/components/eventBooking/index.d.ts +1 -0
- package/lib/components/eventBooking/index.js +2 -2
- package/lib/components/eventBooking/locales.d.ts +6 -0
- package/lib/components/eventBooking/locales.js +10 -4
- package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +3 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.js +2 -2
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +5 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +52 -11
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.less +30 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +2 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +2 -1
- package/lib/components/pay/toC/WalletPassBlock/components/WalletAvailable/index.d.ts +16 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletAvailable/index.js +87 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletAvailable/index.less +38 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletBestValueFound/index.d.ts +17 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletBestValueFound/index.js +103 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletBestValueFound/index.less +133 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +7 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.js +52 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.less +23 -0
- package/lib/components/pay/toC/WalletPassBlock/index.d.ts +9 -2
- package/lib/components/pay/toC/WalletPassBlock/index.js +115 -20
- package/lib/components/pay/toC/WalletPassBlock/index.less +82 -13
- package/lib/components/pay/toC/index.js +35 -9
- package/lib/components/pay/toC/locales.d.ts +69 -3
- package/lib/components/pay/toC/locales.js +72 -6
- package/lib/components/pay/toC/model.d.ts +4 -0
- package/lib/components/pay/toC/model.js +10 -0
- package/lib/components/pay/toC/serve.d.ts +23 -0
- package/lib/components/pay/toC/serve.js +12 -6
- package/lib/components/pay/toC/utils.d.ts +3 -1
- package/lib/components/pay/toC/utils.js +8 -3
- package/lib/components/productSelect/components/productGroup/index.less +4 -12
- package/lib/components/productSelect/index.less +1 -1
- package/lib/components/ruleSetting/index.d.ts +1 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +13 -16
- package/lib/components/ticketBooking/components/menuBar/index.less +0 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.less +2 -4
- package/lib/hooks/useLocale.d.ts +2 -0
- package/lib/hooks/useLocale.js +41 -0
- package/lib/hooks/useLoginUser.d.ts +2 -0
- package/lib/hooks/useLoginUser.js +50 -0
- package/package.json +3 -3
|
@@ -19,6 +19,7 @@ import { getEventDetailBookingOptionsApi, getEventDetailIntroductionApi, getEven
|
|
|
19
19
|
import { useRequest } from 'ahooks';
|
|
20
20
|
import { useEvent } from "./index";
|
|
21
21
|
import { getIamgeFromMedia } from "../utils";
|
|
22
|
+
import useLoginUser from "../../../hooks/useLoginUser";
|
|
22
23
|
|
|
23
24
|
// 定义步骤数据接口
|
|
24
25
|
|
|
@@ -44,6 +45,7 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
|
|
|
44
45
|
setCurrentBookingOption = _useState6[1];
|
|
45
46
|
var _useEvent = useEvent(),
|
|
46
47
|
selectEvent = _useEvent.selectEvent;
|
|
48
|
+
var customer = useLoginUser();
|
|
47
49
|
var _setDetail = function _setDetail(detailData) {
|
|
48
50
|
detailRef.current = _objectSpread(_objectSpread({}, detailRef.current || {}), detailData || {});
|
|
49
51
|
console.log(detailRef.current, '55555555');
|
|
@@ -70,7 +72,9 @@ export var EventDetailProvider = function EventDetailProvider(_ref) {
|
|
|
70
72
|
getEventDetailBookingOptions.run({
|
|
71
73
|
ids: ((_eventItem$_originDat = eventItem._originData) === null || _eventItem$_originDat === void 0 ? void 0 : _eventItem$_originDat.relation_product_ids) || [],
|
|
72
74
|
num: 100,
|
|
73
|
-
skip: 1
|
|
75
|
+
skip: 1,
|
|
76
|
+
customer_id: customer === null || customer === void 0 ? void 0 : customer.id,
|
|
77
|
+
open_quotation: 1
|
|
74
78
|
});
|
|
75
79
|
getEventDetailSelectDate.run(eventItem.id, {
|
|
76
80
|
days: 366
|
|
@@ -10,6 +10,7 @@ export declare const getEventListApi: (params: {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
skip?: number;
|
|
12
12
|
num?: number;
|
|
13
|
+
open_quotation: number;
|
|
13
14
|
}) => Promise<any>;
|
|
14
15
|
export declare const getEventDetailIntroductionApi: (eventItemId: number | string) => Promise<any>;
|
|
15
16
|
export declare const getEventDetailTeacherApi: (params: {
|
|
@@ -19,6 +20,8 @@ export declare const getEventDetailBookingOptionsApi: (params: {
|
|
|
19
20
|
ids: number | string;
|
|
20
21
|
num: number;
|
|
21
22
|
skip: number;
|
|
23
|
+
customer_id?: number;
|
|
24
|
+
open_quotation?: number;
|
|
22
25
|
}) => Promise<any>;
|
|
23
26
|
export declare const getEventDetailSelectDateApi: (id: number | string, params: {
|
|
24
27
|
days: number;
|
|
@@ -84,12 +84,13 @@ export var InitProvider = function InitProvider(_ref) {
|
|
|
84
84
|
var getBoardSetting = useRequest(getBoardSettingApi, {
|
|
85
85
|
manual: true,
|
|
86
86
|
onSuccess: function onSuccess(res) {
|
|
87
|
-
var _res$data, _res$data2, _appUtils$getStore;
|
|
87
|
+
var _res$data, _res$data2, _appUtils$getStore, _res$data3;
|
|
88
88
|
setInitData({
|
|
89
89
|
boardSetting: res === null || res === void 0 ? void 0 : res.data,
|
|
90
90
|
form_id: res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.config) === null || _res$data === void 0 || (_res$data = _res$data.resource) === null || _res$data === void 0 || (_res$data = _res$data.booking_event_v2_resource) === null || _res$data === void 0 ? void 0 : _res$data.form_id,
|
|
91
91
|
shop_id: res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.shop_id,
|
|
92
|
-
shop: (_appUtils$getStore = appUtils.getStore()) === null || _appUtils$getStore === void 0 || (_appUtils$getStore = _appUtils$getStore.getState()) === null || _appUtils$getStore === void 0 || (_appUtils$getStore = _appUtils$getStore.core) === null || _appUtils$getStore === void 0 || (_appUtils$getStore = _appUtils$getStore.core) === null || _appUtils$getStore === void 0 ? void 0 : _appUtils$getStore.shop
|
|
92
|
+
shop: (_appUtils$getStore = appUtils.getStore()) === null || _appUtils$getStore === void 0 || (_appUtils$getStore = _appUtils$getStore.getState()) === null || _appUtils$getStore === void 0 || (_appUtils$getStore = _appUtils$getStore.core) === null || _appUtils$getStore === void 0 || (_appUtils$getStore = _appUtils$getStore.core) === null || _appUtils$getStore === void 0 ? void 0 : _appUtils$getStore.shop,
|
|
93
|
+
scheduleDisplayType: res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 || (_res$data3 = _res$data3.config) === null || _res$data3 === void 0 || (_res$data3 = _res$data3.product_display_setting) === null || _res$data3 === void 0 || (_res$data3 = _res$data3.booking_event_v2_schedule_display_format) === null || _res$data3 === void 0 ? void 0 : _res$data3.value
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
});
|
|
@@ -7,6 +7,7 @@ interface Step {
|
|
|
7
7
|
declare type StepKey = 'select-category' | 'select-event' | 'confirm-information';
|
|
8
8
|
interface StepData {
|
|
9
9
|
currentStep: StepKey;
|
|
10
|
+
isAutoOperate?: boolean;
|
|
10
11
|
}
|
|
11
12
|
interface StepContextType {
|
|
12
13
|
setStepData: (data: Partial<StepData>) => void;
|
|
@@ -18,6 +19,7 @@ interface StepContextType {
|
|
|
18
19
|
isLastStep: boolean;
|
|
19
20
|
isFirstStep: boolean;
|
|
20
21
|
isTwoStep: boolean;
|
|
22
|
+
changeAutoOperate: (newAutoOperate: boolean) => void;
|
|
21
23
|
}
|
|
22
24
|
interface StepProviderProps {
|
|
23
25
|
children: React.ReactNode;
|
|
@@ -40,7 +40,8 @@ var stepMaps = steps.reduce(function (acc, step) {
|
|
|
40
40
|
|
|
41
41
|
// 默认步骤状态
|
|
42
42
|
var defaultState = {
|
|
43
|
-
currentStep: steps[0].key
|
|
43
|
+
currentStep: steps[0].key,
|
|
44
|
+
isAutoOperate: true
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
// 创建步骤上下文
|
|
@@ -97,7 +98,8 @@ export var StepProvider = function StepProvider(_ref) {
|
|
|
97
98
|
var nextStep = getNextStep();
|
|
98
99
|
if (nextStep) {
|
|
99
100
|
setStepData({
|
|
100
|
-
currentStep: nextStep
|
|
101
|
+
currentStep: nextStep,
|
|
102
|
+
isAutoOperate: true
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
};
|
|
@@ -107,7 +109,8 @@ export var StepProvider = function StepProvider(_ref) {
|
|
|
107
109
|
var prevStep = getPrevStep();
|
|
108
110
|
if (prevStep) {
|
|
109
111
|
setStepData({
|
|
110
|
-
currentStep: prevStep
|
|
112
|
+
currentStep: prevStep,
|
|
113
|
+
isAutoOperate: false
|
|
111
114
|
});
|
|
112
115
|
} else {
|
|
113
116
|
closePage();
|
|
@@ -162,6 +165,11 @@ export var StepProvider = function StepProvider(_ref) {
|
|
|
162
165
|
var isTwoStep = useMemo(function () {
|
|
163
166
|
return (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.key) === steps[1].key;
|
|
164
167
|
}, [currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.key]);
|
|
168
|
+
var changeAutoOperate = function changeAutoOperate(newAutoOperate) {
|
|
169
|
+
setStepData({
|
|
170
|
+
isAutoOperate: newAutoOperate
|
|
171
|
+
});
|
|
172
|
+
};
|
|
165
173
|
var contextValue = {
|
|
166
174
|
setStepData: setStepData,
|
|
167
175
|
currentStepData: currentStepData,
|
|
@@ -171,7 +179,8 @@ export var StepProvider = function StepProvider(_ref) {
|
|
|
171
179
|
toFirstStep: toFirstStep,
|
|
172
180
|
isFirstStep: isFirstStep,
|
|
173
181
|
isLastStep: isLastStep,
|
|
174
|
-
isTwoStep: isTwoStep
|
|
182
|
+
isTwoStep: isTwoStep,
|
|
183
|
+
changeAutoOperate: changeAutoOperate
|
|
175
184
|
};
|
|
176
185
|
return /*#__PURE__*/React.createElement(StepContext.Provider, {
|
|
177
186
|
value: contextValue
|
|
@@ -65,18 +65,18 @@ var ConfirmInformation = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
65
65
|
*/
|
|
66
66
|
var handleNext = /*#__PURE__*/function () {
|
|
67
67
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
68
|
-
var
|
|
68
|
+
var _deposit$protocols;
|
|
69
69
|
var deposit, _yield$appointmentBoo, data, _ref2, is_deposit, deposit_amount, total_amount, order_id, _total, freeResult;
|
|
70
70
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
71
71
|
while (1) switch (_context.prev = _context.next) {
|
|
72
72
|
case 0:
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
deposit = summary.deposit; // 如果未同意定金政策,则提示
|
|
74
|
+
if (!(deposit !== null && deposit !== void 0 && deposit.hasDeposit && (deposit === null || deposit === void 0 || (_deposit$protocols = deposit.protocols) === null || _deposit$protocols === void 0 ? void 0 : _deposit$protocols.length) > 0 && !isAgreeDepositPolicy)) {
|
|
75
|
+
_context.next = 3;
|
|
75
76
|
break;
|
|
76
77
|
}
|
|
77
78
|
return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.deposit.agree.policy')));
|
|
78
|
-
case
|
|
79
|
-
deposit = summary.deposit;
|
|
79
|
+
case 3:
|
|
80
80
|
setLoading(true);
|
|
81
81
|
_context.prev = 4;
|
|
82
82
|
_context.next = 7;
|
|
@@ -67,7 +67,7 @@ var Deposit = function Deposit(props) {
|
|
|
67
67
|
value: total,
|
|
68
68
|
showCurrencySymbol: true,
|
|
69
69
|
className: "amount"
|
|
70
|
-
}), /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.appointment.deposit.amount.tip2')))), /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
}), /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.appointment.deposit.amount.tip2')))), (protocols === null || protocols === void 0 ? void 0 : protocols.length) > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
71
71
|
className: "checkbox-wrap",
|
|
72
72
|
onClick: function onClick() {
|
|
73
73
|
return handleAgreed();
|
|
@@ -90,7 +90,7 @@ var Deposit = function Deposit(props) {
|
|
|
90
90
|
}, item === null || item === void 0 ? void 0 : item.title, /*#__PURE__*/React.createElement("span", {
|
|
91
91
|
className: "symbol"
|
|
92
92
|
}, _policyText(item, index)));
|
|
93
|
-
}))))), /*#__PURE__*/React.createElement(PolicyModal, {
|
|
93
|
+
})))) : null), /*#__PURE__*/React.createElement(PolicyModal, {
|
|
94
94
|
open: visible,
|
|
95
95
|
onCancel: function onCancel() {
|
|
96
96
|
return setVisible(false);
|
|
@@ -277,7 +277,7 @@ var formatMetaData = function formatMetaData(item) {
|
|
|
277
277
|
* @Date: 2024-12-07 14:21
|
|
278
278
|
*/
|
|
279
279
|
var formatProducts = function formatProducts(item) {
|
|
280
|
-
var _item$_extend10, _item$_extend11, _item$_extend12;
|
|
280
|
+
var _item$_extend10, _item$_extend11, _item$_extend12, _item$_extend13;
|
|
281
281
|
var total = Number(item._extend.total);
|
|
282
282
|
var origin_total = Number(item._extend.origin_total);
|
|
283
283
|
var discount_amount = origin_total - total;
|
|
@@ -293,6 +293,7 @@ var formatProducts = function formatProducts(item) {
|
|
|
293
293
|
return {
|
|
294
294
|
"num": item._extend.quantity,
|
|
295
295
|
"price": formatProductPrice(item),
|
|
296
|
+
"source_product_price": (_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.price,
|
|
296
297
|
"product_id": (item === null || item === void 0 ? void 0 : item.product_id) || item.id,
|
|
297
298
|
"discount_amount": notManualDiscount.length > 0 ? 0 : discount_amount,
|
|
298
299
|
"product_discount_reason": item._extend.discount_reason || '',
|
|
@@ -302,10 +303,10 @@ var formatProducts = function formatProducts(item) {
|
|
|
302
303
|
"discount_per": item._extend.discount_per,
|
|
303
304
|
"discount_type": item._extend.discount_type || discount_type,
|
|
304
305
|
"order_detail_id": item._extend.order_detail_id || 0,
|
|
305
|
-
"product_bundle": formatProductBundle((_item$
|
|
306
|
+
"product_bundle": formatProductBundle((_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 || (_item$_extend11 = _item$_extend11.other) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.bundle),
|
|
306
307
|
"bundle_edit": item._extend.bundle_edit,
|
|
307
|
-
"product_option_item": formatProductOption((_item$
|
|
308
|
-
"product_variant_id": ((_item$
|
|
308
|
+
"product_option_item": formatProductOption((_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 || (_item$_extend12 = _item$_extend12.other) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.option),
|
|
309
|
+
"product_variant_id": ((_item$_extend13 = item._extend) === null || _item$_extend13 === void 0 || (_item$_extend13 = _item$_extend13.other) === null || _item$_extend13 === void 0 ? void 0 : _item$_extend13.product_variant_id) || 0,
|
|
309
310
|
"discount_list": notManualDiscount,
|
|
310
311
|
metadata: formatMetaData(item)
|
|
311
312
|
};
|
|
@@ -325,8 +326,8 @@ var formatDayRelationProducts = function formatDayRelationProducts(data, booking
|
|
|
325
326
|
|
|
326
327
|
// 过滤出卡片中的普通商品
|
|
327
328
|
var relation_products = list === null || list === void 0 ? void 0 : list.filter(function (item) {
|
|
328
|
-
var _item$
|
|
329
|
-
var holderId = (_item$
|
|
329
|
+
var _item$_extend14;
|
|
330
|
+
var holderId = (_item$_extend14 = item._extend) === null || _item$_extend14 === void 0 ? void 0 : _item$_extend14.holder_id;
|
|
330
331
|
var bookingHolderId = booking_item._extend.holder_id;
|
|
331
332
|
var isDayBookingProduct = appointmentTypes.includes(item.extension_type);
|
|
332
333
|
return holderId && holderId === bookingHolderId && !isDayBookingProduct;
|
|
@@ -352,15 +353,15 @@ var formatAppointmentProductLists = function formatAppointmentProductLists(data)
|
|
|
352
353
|
|
|
353
354
|
// 找出预约商品
|
|
354
355
|
list = list.filter(function (item) {
|
|
355
|
-
var _item$
|
|
356
|
-
return ((_item$
|
|
356
|
+
var _item$_extend15;
|
|
357
|
+
return ((_item$_extend15 = item._extend) === null || _item$_extend15 === void 0 ? void 0 : _item$_extend15.holder_id) && appointmentTypes.includes(item.extension_type);
|
|
357
358
|
});
|
|
358
359
|
|
|
359
360
|
// 对预约商品列表根据holder_id进行分组
|
|
360
361
|
var groupMap = new Map();
|
|
361
362
|
list.forEach(function (item) {
|
|
362
|
-
var _item$
|
|
363
|
-
var key = (_item$
|
|
363
|
+
var _item$_extend16;
|
|
364
|
+
var key = (_item$_extend16 = item._extend) === null || _item$_extend16 === void 0 ? void 0 : _item$_extend16.holder_id; // 分组键
|
|
364
365
|
if (!groupMap.has(key)) {
|
|
365
366
|
groupMap.set(key, []);
|
|
366
367
|
}
|
|
@@ -422,9 +423,9 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
422
423
|
|
|
423
424
|
// 跨日预约下的普通商品
|
|
424
425
|
if (isDay) {
|
|
425
|
-
var _item$
|
|
426
|
-
var startDate = ((_item$
|
|
427
|
-
var endDate = ((_item$
|
|
426
|
+
var _item$_extend17, _item$_extend18, _item$_extend19, _item$_extend20;
|
|
427
|
+
var startDate = ((_item$_extend17 = item._extend) === null || _item$_extend17 === void 0 ? void 0 : _item$_extend17.startDate) || ((_item$_extend18 = item._extend) === null || _item$_extend18 === void 0 ? void 0 : _item$_extend18.start_date);
|
|
428
|
+
var endDate = ((_item$_extend19 = item._extend) === null || _item$_extend19 === void 0 ? void 0 : _item$_extend19.endDate) || ((_item$_extend20 = item._extend) === null || _item$_extend20 === void 0 ? void 0 : _item$_extend20.end_date);
|
|
428
429
|
var _formatDayTime = formatDayTime({
|
|
429
430
|
startDate: startDate,
|
|
430
431
|
endDate: endDate
|
|
@@ -485,8 +486,8 @@ var formatRelationProducts = function formatRelationProducts(data) {
|
|
|
485
486
|
var list = ((_data$service = data.service) === null || _data$service === void 0 ? void 0 : _data$service.value) || [];
|
|
486
487
|
// open items 下的商品
|
|
487
488
|
list = list.filter(function (item) {
|
|
488
|
-
var _item$
|
|
489
|
-
return !((_item$
|
|
489
|
+
var _item$_extend21;
|
|
490
|
+
return !((_item$_extend21 = item._extend) !== null && _item$_extend21 !== void 0 && _item$_extend21.holder_id);
|
|
490
491
|
});
|
|
491
492
|
var relationProducts = [];
|
|
492
493
|
relationProducts = list.map(function (item) {
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
17
|
+
import { getProductTotalPrice } from "../utils";
|
|
18
|
+
import useEngineContext from "../../../../es/hooks/useEngineContext";
|
|
19
|
+
import { locales } from "@pisell/utils";
|
|
20
|
+
import { PisellModal } from "@pisell/materials";
|
|
21
|
+
var formatBundleItemMap = function formatBundleItemMap(product) {
|
|
22
|
+
return product.bundle_group.reduce(function (pre, cur) {
|
|
23
|
+
var curObj = {};
|
|
24
|
+
cur.bundle_item.forEach(function (item) {
|
|
25
|
+
curObj[item.id] = item;
|
|
26
|
+
});
|
|
27
|
+
return _objectSpread(_objectSpread({}, pre), curObj);
|
|
28
|
+
}, {});
|
|
29
|
+
};
|
|
30
|
+
var setNewCartValue = function setNewCartValue(cartValue, newProducts) {
|
|
31
|
+
if (!newProducts.length) {
|
|
32
|
+
return {
|
|
33
|
+
isChange: false,
|
|
34
|
+
value: cartValue
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 是否有报价单价格有改动
|
|
39
|
+
var isChange = false;
|
|
40
|
+
|
|
41
|
+
// 是否是套餐内子商品变更
|
|
42
|
+
var isBundleChange = false;
|
|
43
|
+
|
|
44
|
+
// 是否套餐子商品被删除
|
|
45
|
+
var isNotFoundBundle = false;
|
|
46
|
+
var notFoundProducts = [];
|
|
47
|
+
var value = cartValue.map(function (item) {
|
|
48
|
+
var _item$_extend, _item$_extend2;
|
|
49
|
+
var newProduct = newProducts.find(function (newItem) {
|
|
50
|
+
return newItem.id === item.product_id;
|
|
51
|
+
});
|
|
52
|
+
if (!newProduct) {
|
|
53
|
+
return item;
|
|
54
|
+
}
|
|
55
|
+
// 是否报价单变更价格更新
|
|
56
|
+
var isChangePrice = newProduct.price != item.price;
|
|
57
|
+
var bundleItemMap = formatBundleItemMap(newProduct);
|
|
58
|
+
var newBundle = (((_item$_extend = item._extend) === null || _item$_extend === void 0 || (_item$_extend = _item$_extend.other) === null || _item$_extend === void 0 ? void 0 : _item$_extend.bundle) || []).map(function (bundle) {
|
|
59
|
+
if (!bundleItemMap[bundle.id]) {
|
|
60
|
+
isNotFoundBundle = true;
|
|
61
|
+
if (!notFoundProducts.some(function (p) {
|
|
62
|
+
return p._id === bundle._id;
|
|
63
|
+
})) {
|
|
64
|
+
notFoundProducts.push(item);
|
|
65
|
+
}
|
|
66
|
+
return bundle;
|
|
67
|
+
}
|
|
68
|
+
if (bundle.price != bundleItemMap[bundle.id].price) {
|
|
69
|
+
isChangePrice = true;
|
|
70
|
+
isBundleChange = true;
|
|
71
|
+
}
|
|
72
|
+
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
73
|
+
base_price: bundleItemMap[bundle.id].base_price,
|
|
74
|
+
price: bundleItemMap[bundle.id].price
|
|
75
|
+
// product_price: bundleItemMap[item.id].product_price,
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// 价格都没有变动时返回原始信息
|
|
80
|
+
if (!isChangePrice) {
|
|
81
|
+
return item;
|
|
82
|
+
} else {
|
|
83
|
+
isChange = true;
|
|
84
|
+
}
|
|
85
|
+
var newItem = _objectSpread(_objectSpread({}, item), {}, {
|
|
86
|
+
original_price: newProduct.original_price,
|
|
87
|
+
price: newProduct.price,
|
|
88
|
+
base_price: newProduct.base_price,
|
|
89
|
+
_extend: _objectSpread(_objectSpread({}, item._extend), {}, {
|
|
90
|
+
price: newProduct.price,
|
|
91
|
+
// total: newProduct.total,
|
|
92
|
+
bundle_edit: isBundleChange ? 1 : item._extend.bundle_edit,
|
|
93
|
+
other: _objectSpread(_objectSpread({}, item._extend.other), {}, {
|
|
94
|
+
option: (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 || (_item$_extend2 = _item$_extend2.other) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.option,
|
|
95
|
+
bundle: newBundle
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
var total = getProductTotalPrice(newItem);
|
|
100
|
+
newItem._extend.total = total;
|
|
101
|
+
newItem._extend.origin_total = total;
|
|
102
|
+
return newItem;
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
isChange: isChange,
|
|
106
|
+
value: value,
|
|
107
|
+
isNotFoundBundle: isNotFoundBundle,
|
|
108
|
+
notFoundProducts: notFoundProducts
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
var useQuotation = function useQuotation(state, dispatch) {
|
|
112
|
+
var _state$client3;
|
|
113
|
+
var context = useEngineContext();
|
|
114
|
+
var _useState = useState(false),
|
|
115
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
116
|
+
open = _useState2[0],
|
|
117
|
+
setOpen = _useState2[1];
|
|
118
|
+
var _useState3 = useState([]),
|
|
119
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
120
|
+
products = _useState4[0],
|
|
121
|
+
setProducts = _useState4[1];
|
|
122
|
+
var cartValueRef = useRef(state.service.value || []);
|
|
123
|
+
cartValueRef.current = state.service.value;
|
|
124
|
+
var getCartQuotation = /*#__PURE__*/function () {
|
|
125
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
126
|
+
var data;
|
|
127
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
128
|
+
while (1) switch (_context.prev = _context.next) {
|
|
129
|
+
case 0:
|
|
130
|
+
if (cartValueRef.current.length) {
|
|
131
|
+
_context.next = 2;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
return _context.abrupt("return");
|
|
135
|
+
case 2:
|
|
136
|
+
_context.next = 4;
|
|
137
|
+
return state.apis.getServices({
|
|
138
|
+
skip: 1,
|
|
139
|
+
num: 500,
|
|
140
|
+
extension_type: state.renderType === 'eventBooking' ? undefined : ['product_appointment', 'appointment_ticket', 'service_product', 'session_product', 'session_ticket'],
|
|
141
|
+
with: ['category', 'resourceRelation'],
|
|
142
|
+
ids: cartValueRef.current.map(function (item) {
|
|
143
|
+
return item.product_id;
|
|
144
|
+
}),
|
|
145
|
+
open_quotation: 1,
|
|
146
|
+
with_schedule: 1,
|
|
147
|
+
with_count: ['bundleGroup', 'optionGroup'],
|
|
148
|
+
order_by_string: 'sort:desc',
|
|
149
|
+
status: 'published',
|
|
150
|
+
schedule_date: params === null || params === void 0 ? void 0 : params.schedule_date,
|
|
151
|
+
customer_id: params === null || params === void 0 ? void 0 : params.customer_id,
|
|
152
|
+
open_bundle: 1
|
|
153
|
+
});
|
|
154
|
+
case 4:
|
|
155
|
+
data = _context.sent;
|
|
156
|
+
return _context.abrupt("return", data);
|
|
157
|
+
case 6:
|
|
158
|
+
case "end":
|
|
159
|
+
return _context.stop();
|
|
160
|
+
}
|
|
161
|
+
}, _callee);
|
|
162
|
+
}));
|
|
163
|
+
return function getCartQuotation(_x) {
|
|
164
|
+
return _ref.apply(this, arguments);
|
|
165
|
+
};
|
|
166
|
+
}();
|
|
167
|
+
var currentDate = useMemo(function () {
|
|
168
|
+
return state.date.value.format('YYYY-MM-DD');
|
|
169
|
+
}, [state.date.value]);
|
|
170
|
+
var updateCartQuotation = /*#__PURE__*/function () {
|
|
171
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
172
|
+
var data, _setNewCartValue, isChange, newCartValue, isNotFoundBundle, notFoundProducts;
|
|
173
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
174
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
175
|
+
case 0:
|
|
176
|
+
_context2.next = 2;
|
|
177
|
+
return getCartQuotation(params);
|
|
178
|
+
case 2:
|
|
179
|
+
data = _context2.sent;
|
|
180
|
+
if (data) {
|
|
181
|
+
_context2.next = 5;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
return _context2.abrupt("return");
|
|
185
|
+
case 5:
|
|
186
|
+
_setNewCartValue = setNewCartValue(cartValueRef.current, data.list), isChange = _setNewCartValue.isChange, newCartValue = _setNewCartValue.value, isNotFoundBundle = _setNewCartValue.isNotFoundBundle, notFoundProducts = _setNewCartValue.notFoundProducts;
|
|
187
|
+
if (!isNotFoundBundle) {
|
|
188
|
+
_context2.next = 10;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
setProducts(notFoundProducts);
|
|
192
|
+
setOpen(true);
|
|
193
|
+
return _context2.abrupt("return");
|
|
194
|
+
case 10:
|
|
195
|
+
if (isChange) {
|
|
196
|
+
_context2.next = 12;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
return _context2.abrupt("return");
|
|
200
|
+
case 12:
|
|
201
|
+
dispatch({
|
|
202
|
+
type: "setService",
|
|
203
|
+
payload: {
|
|
204
|
+
value: newCartValue,
|
|
205
|
+
edit: true
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
case 13:
|
|
209
|
+
case "end":
|
|
210
|
+
return _context2.stop();
|
|
211
|
+
}
|
|
212
|
+
}, _callee2);
|
|
213
|
+
}));
|
|
214
|
+
return function updateCartQuotation(_x2) {
|
|
215
|
+
return _ref2.apply(this, arguments);
|
|
216
|
+
};
|
|
217
|
+
}();
|
|
218
|
+
var isEditClientOrDate = useMemo(function () {
|
|
219
|
+
var _state$client, _state$date;
|
|
220
|
+
return (state === null || state === void 0 || (_state$client = state.client) === null || _state$client === void 0 ? void 0 : _state$client.edit) || (state === null || state === void 0 || (_state$date = state.date) === null || _state$date === void 0 ? void 0 : _state$date.edit);
|
|
221
|
+
}, [state]);
|
|
222
|
+
useEffect(function () {
|
|
223
|
+
var _context$appHelper, _context$appHelper$ge, _state$client2;
|
|
224
|
+
var isQuotation = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.businessUtils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getAppByModal) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper, 'quotation');
|
|
225
|
+
|
|
226
|
+
// 没有报价单不走该流程 没有更新客户信息或者日期不更新不走该流程
|
|
227
|
+
if (!isQuotation || !isEditClientOrDate) return;
|
|
228
|
+
updateCartQuotation({
|
|
229
|
+
customer_id: (_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id,
|
|
230
|
+
schedule_date: currentDate
|
|
231
|
+
});
|
|
232
|
+
}, [(_state$client3 = state.client) === null || _state$client3 === void 0 || (_state$client3 = _state$client3.value) === null || _state$client3 === void 0 ? void 0 : _state$client3.id, currentDate, isEditClientOrDate]);
|
|
233
|
+
var dom = useMemo(function () {
|
|
234
|
+
return /*#__PURE__*/React.createElement(PisellModal.Information, {
|
|
235
|
+
open: open,
|
|
236
|
+
platform: "pc",
|
|
237
|
+
title: locales.getText('pisell2.text.quotation.product.change.title'),
|
|
238
|
+
describe: /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.text.quotation.product.change.describe'), products.map(function (item) {
|
|
239
|
+
return /*#__PURE__*/React.createElement("div", null, item === null || item === void 0 ? void 0 : item.product_title);
|
|
240
|
+
})),
|
|
241
|
+
okText: locales.getText('pisell2.text.ok'),
|
|
242
|
+
closable: true,
|
|
243
|
+
cancelVisible: false,
|
|
244
|
+
onOk: function onOk() {
|
|
245
|
+
return setOpen(false);
|
|
246
|
+
},
|
|
247
|
+
onCancel: function onCancel() {
|
|
248
|
+
return setOpen(false);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}, [open, products]);
|
|
252
|
+
return {
|
|
253
|
+
dom: dom
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
export default useQuotation;
|
|
@@ -126,9 +126,8 @@ var Info = function Info(props) {
|
|
|
126
126
|
*/
|
|
127
127
|
var customerId = useMemo(function () {
|
|
128
128
|
var _state$client;
|
|
129
|
-
if (!isDay) return undefined;
|
|
130
129
|
return ((_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id) || 1;
|
|
131
|
-
}, [(_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id
|
|
130
|
+
}, [(_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id]);
|
|
132
131
|
|
|
133
132
|
/**
|
|
134
133
|
* @title: 如果商品只有一个, 则自动设置默认商品
|
|
@@ -248,7 +247,7 @@ var Info = function Info(props) {
|
|
|
248
247
|
dayParams = {}; // 跨日预约
|
|
249
248
|
if (isDay && !isEventBooking(state)) {
|
|
250
249
|
dayParams.extension_type = ['normal', 'product_appointment'];
|
|
251
|
-
dayParams.customer_id = customerId;
|
|
250
|
+
// dayParams.customer_id = customerId;
|
|
252
251
|
}
|
|
253
252
|
_context2.next = 9;
|
|
254
253
|
return state.apis.getServices(_objectSpread({
|
|
@@ -262,7 +261,8 @@ var Info = function Info(props) {
|
|
|
262
261
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
263
262
|
order_by_string: 'sort:desc',
|
|
264
263
|
status: 'published',
|
|
265
|
-
schedule_date: params === null || params === void 0 ? void 0 : params.schedule_date
|
|
264
|
+
schedule_date: params === null || params === void 0 ? void 0 : params.schedule_date,
|
|
265
|
+
customer_id: customerId
|
|
266
266
|
}, dayParams));
|
|
267
267
|
case 9:
|
|
268
268
|
data = _context2.sent;
|