@pisell/private-materials 3.3.45 → 3.3.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.js +3 -3
- package/es/businessModel/SalesModel/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/Item/index.js +3 -0
- package/es/components/appointmentBooking/components/Content/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Content/index.js +7 -1
- package/es/components/appointmentBooking/components/Header/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Header/index.js +2 -2
- package/es/components/appointmentBooking/components/Resource/index.js +30 -12
- package/es/components/appointmentBooking/components/Services/index.js +5 -2
- package/es/components/appointmentBooking/components/TimeSlicing/index.js +7 -4
- package/es/components/appointmentBooking/components/Voucher/index.js +1 -0
- package/es/components/appointmentBooking/context.js +7 -3
- package/es/components/appointmentBooking/hooks.js +129 -68
- package/es/components/appointmentBooking/index.d.ts +1 -0
- package/es/components/appointmentBooking/utils.js +6 -1
- package/es/components/booking/addons/index.js +31 -26
- package/es/components/booking/components/footer/amount.js +2 -2
- package/es/components/booking/components/footer/index.d.ts +1 -0
- package/es/components/booking/components/footer/utils.d.ts +9 -0
- package/es/components/booking/components/footer/utils.js +32 -10
- package/es/components/booking/info/service/Lists.d.ts +1 -0
- package/es/components/booking/info/service/addService/index.d.ts +1 -0
- package/es/components/booking/info/service/addService/index.js +2 -2
- package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
- package/es/components/booking/info/service2/Lists.d.ts +1 -0
- package/es/components/booking/info/service2/utils.d.ts +4 -1
- package/es/components/booking/info/service2/utils.js +21 -2
- package/es/components/booking/info/utils.js +1 -1
- package/es/components/booking/info2/service/addService/index.js +9 -6
- package/es/components/booking/info2/service/addTimeModal/index.d.ts +1 -0
- package/es/components/booking/info2/service/editService/index.js +56 -18
- package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
- package/es/components/booking/utils.d.ts +3 -2
- package/es/components/booking/utils.js +5 -0
- 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 +2 -2
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/es/components/eventBooking/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectResourcesTable/index.d.ts +1 -0
- package/es/components/productExtension/index.d.ts +1 -0
- package/es/components/ruleSetting/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/es/components/shoppingCart/index.d.ts +1 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +75 -26
- package/es/components/ticketBooking/components/notAvailable/index.d.ts +3 -0
- package/es/components/ticketBooking/components/notAvailable/index.js +39 -0
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
- package/es/components/ticketBooking/index.d.ts +1 -0
- package/es/components/ticketBooking/index.js +1 -1
- package/es/components/ticketBooking/locales.d.ts +6 -0
- package/es/components/ticketBooking/locales.js +9 -3
- package/es/components/ticketBooking/serve.js +98 -92
- package/es/components/ticketBooking/utils/index.d.ts +1 -0
- package/es/components/ticketBooking/utils/index.js +33 -0
- package/es/components/wallet/hooks/useWalletCard.d.ts +1 -0
- package/lib/businessModel/SalesModel/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +3 -0
- package/lib/components/appointmentBooking/components/Content/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Content/index.js +3 -1
- package/lib/components/appointmentBooking/components/Header/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Header/index.js +1 -1
- package/lib/components/appointmentBooking/components/Resource/index.js +15 -9
- package/lib/components/appointmentBooking/components/Services/index.js +3 -2
- package/lib/components/appointmentBooking/components/TimeSlicing/index.js +4 -3
- package/lib/components/appointmentBooking/components/Voucher/index.js +1 -0
- package/lib/components/appointmentBooking/context.js +7 -3
- package/lib/components/appointmentBooking/hooks.js +73 -12
- package/lib/components/appointmentBooking/index.d.ts +1 -0
- package/lib/components/appointmentBooking/utils.js +2 -0
- package/lib/components/booking/addons/index.js +27 -21
- package/lib/components/booking/components/footer/amount.js +1 -1
- package/lib/components/booking/components/footer/index.d.ts +1 -0
- package/lib/components/booking/components/footer/utils.d.ts +9 -0
- package/lib/components/booking/components/footer/utils.js +24 -7
- package/lib/components/booking/info/service/Lists.d.ts +1 -0
- package/lib/components/booking/info/service/addService/index.d.ts +1 -0
- package/lib/components/booking/info/service/addService/index.js +1 -1
- package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
- package/lib/components/booking/info/service2/Lists.d.ts +1 -0
- package/lib/components/booking/info/service2/utils.d.ts +4 -1
- package/lib/components/booking/info/service2/utils.js +21 -2
- package/lib/components/booking/info/utils.js +1 -1
- package/lib/components/booking/info2/service/addService/index.js +8 -5
- package/lib/components/booking/info2/service/addTimeModal/index.d.ts +1 -0
- package/lib/components/booking/info2/service/editService/index.js +59 -23
- package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
- package/lib/components/booking/utils.d.ts +3 -2
- package/lib/components/booking/utils.js +6 -0
- 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 +2 -2
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/lib/components/eventBooking/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/index.d.ts +1 -0
- package/lib/components/productExtension/index.d.ts +1 -0
- package/lib/components/ruleSetting/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/lib/components/shoppingCart/index.d.ts +1 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +74 -20
- package/lib/components/ticketBooking/components/notAvailable/index.d.ts +3 -0
- package/lib/components/ticketBooking/components/notAvailable/index.js +61 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
- package/lib/components/ticketBooking/index.d.ts +1 -0
- package/lib/components/ticketBooking/index.js +1 -1
- package/lib/components/ticketBooking/locales.d.ts +6 -0
- package/lib/components/ticketBooking/locales.js +9 -3
- package/lib/components/ticketBooking/serve.js +6 -2
- package/lib/components/ticketBooking/utils/index.d.ts +1 -0
- package/lib/components/ticketBooking/utils/index.js +33 -0
- package/lib/components/wallet/hooks/useWalletCard.d.ts +1 -0
- package/package.json +4 -4
|
@@ -121,7 +121,7 @@ var Header = () => {
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
if ((
|
|
124
|
+
if ((prevStepData == null ? void 0 : prevStepData.key) === "select-resource") {
|
|
125
125
|
stepList.forEach((item) => {
|
|
126
126
|
if (item.key.startsWith("fill-form_")) {
|
|
127
127
|
removeStep(item.key);
|
|
@@ -104,7 +104,8 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
104
104
|
);
|
|
105
105
|
}, [currentStepParams.key, resources]);
|
|
106
106
|
const renderLists = (0, import_react.useMemo)(() => {
|
|
107
|
-
|
|
107
|
+
const appointmentCarts = carts.filter((n) => !(appointmentBooking == null ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id)));
|
|
108
|
+
if (appointmentCarts.length > 1 || !(appointmentCarts == null ? void 0 : appointmentCarts.length)) {
|
|
108
109
|
return [];
|
|
109
110
|
}
|
|
110
111
|
return (0, import_utils.currentRenderLists)(resources, appointmentBoard == null ? void 0 : appointmentBoard.form_code);
|
|
@@ -122,11 +123,14 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
122
123
|
...res
|
|
123
124
|
});
|
|
124
125
|
getResourceList();
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const carts2 = await appointmentBooking.getCart();
|
|
127
|
+
const cartItem = carts2 == null ? void 0 : carts2[0];
|
|
128
|
+
if (cartItem == null ? void 0 : cartItem._id) {
|
|
129
|
+
appointmentBooking.updateCart({
|
|
130
|
+
_id: cartItem == null ? void 0 : cartItem._id,
|
|
131
|
+
...cartItem
|
|
132
|
+
});
|
|
133
|
+
}
|
|
130
134
|
};
|
|
131
135
|
autoSelectResources();
|
|
132
136
|
}, [appointmentBoard]);
|
|
@@ -138,15 +142,17 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
138
142
|
var _a;
|
|
139
143
|
setSelectedResource(e.id);
|
|
140
144
|
if (e.id) {
|
|
145
|
+
const index = carts.findIndex((n) => !(appointmentBooking == null ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id)));
|
|
141
146
|
return appointmentBooking.updateCart({
|
|
142
|
-
_id: (_a = carts == null ? void 0 : carts[
|
|
143
|
-
resources: (0, import_utils.updateCartResources)(carts == null ? void 0 : carts[
|
|
147
|
+
_id: (_a = carts == null ? void 0 : carts[index]) == null ? void 0 : _a._id,
|
|
148
|
+
resources: (0, import_utils.updateCartResources)(carts == null ? void 0 : carts[index], e)
|
|
144
149
|
});
|
|
145
150
|
}
|
|
146
151
|
};
|
|
147
152
|
(0, import_react.useEffect)(() => {
|
|
148
153
|
var _a, _b, _c;
|
|
149
|
-
const
|
|
154
|
+
const index = carts.findIndex((n) => !(appointmentBooking == null ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id)));
|
|
155
|
+
const selectedResource2 = (_c = (_b = (_a = carts == null ? void 0 : carts[index]) == null ? void 0 : _a._origin) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
|
|
150
156
|
(item) => (item == null ? void 0 : item.form_id) === (appointmentBoard == null ? void 0 : appointmentBoard.form_id)
|
|
151
157
|
);
|
|
152
158
|
setSelectedResource((selectedResource2 == null ? void 0 : selectedResource2.id) || 0);
|
|
@@ -81,7 +81,8 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
81
81
|
utils == null ? void 0 : utils.action({
|
|
82
82
|
type: "pisell1.productDetail",
|
|
83
83
|
data: {
|
|
84
|
-
detail: { ...item, open_deposit: 1 }
|
|
84
|
+
detail: { ...item, open_deposit: 1 },
|
|
85
|
+
setting: { can_input: true }
|
|
85
86
|
},
|
|
86
87
|
callback: async (data) => {
|
|
87
88
|
var _a, _b;
|
|
@@ -121,7 +122,7 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
121
122
|
} else {
|
|
122
123
|
const resources = ((_b = (_a = data == null ? void 0 : data.origin) == null ? void 0 : _a.product_resource) == null ? void 0 : _b.resources) || [];
|
|
123
124
|
const activeStatus = resources.find((item2) => item2.status === 1);
|
|
124
|
-
if (!activeStatus) {
|
|
125
|
+
if (!activeStatus && !appointmentBooking.isTargetNormalProduct(data == null ? void 0 : data.origin)) {
|
|
125
126
|
return (0, import_utils2.Toast)(
|
|
126
127
|
import_utils.locales.getText("pisell2.appointment.no.available.service")
|
|
127
128
|
);
|
|
@@ -69,10 +69,11 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
|
|
|
69
69
|
};
|
|
70
70
|
(0, import_react.useEffect)(() => {
|
|
71
71
|
var _a, _b, _c;
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
let appoimentBookingProductCart = carts.filter((item) => !appointmentBooking.isTargetCartIdNormalProduct(item == null ? void 0 : item._id));
|
|
73
|
+
if ((times == null ? void 0 : times.length) > 0 && (appoimentBookingProductCart == null ? void 0 : appoimentBookingProductCart.length) > 0) {
|
|
74
|
+
const startTime = ((_a = appoimentBookingProductCart == null ? void 0 : appoimentBookingProductCart[0]) == null ? void 0 : _a.start_time) || ((_b = times == null ? void 0 : times[0]) == null ? void 0 : _b.start_time);
|
|
74
75
|
setSelectedResource(startTime);
|
|
75
|
-
if ((_c =
|
|
76
|
+
if ((_c = appoimentBookingProductCart == null ? void 0 : appoimentBookingProductCart[0]) == null ? void 0 : _c.start_time) return;
|
|
76
77
|
getAutoSelect(times == null ? void 0 : times[0]);
|
|
77
78
|
}
|
|
78
79
|
}, [times, carts]);
|
|
@@ -105,15 +105,19 @@ var AppointmentBookingProvider = ({
|
|
|
105
105
|
if (!(carts == null ? void 0 : carts.length) || !(resources == null ? void 0 : resources.length)) {
|
|
106
106
|
return setCurrentSelectedResources(null);
|
|
107
107
|
}
|
|
108
|
-
const currentSelectedResources2 =
|
|
109
|
-
|
|
108
|
+
const currentSelectedResources2 = [];
|
|
109
|
+
carts.forEach((item) => {
|
|
110
|
+
if (appointmentBooking.isTargetCartIdNormalProduct(item == null ? void 0 : item._id)) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
currentSelectedResources2.push({
|
|
110
114
|
_id: item == null ? void 0 : item._id,
|
|
111
115
|
currentSelectedResource: (0, import_utils.getCartCurrentResourceData)(
|
|
112
116
|
item,
|
|
113
117
|
currentStepParams == null ? void 0 : currentStepParams.key,
|
|
114
118
|
resources
|
|
115
119
|
)
|
|
116
|
-
};
|
|
120
|
+
});
|
|
117
121
|
});
|
|
118
122
|
setCurrentSelectedResources(currentSelectedResources2);
|
|
119
123
|
appointmentBooking.setOtherData(
|
|
@@ -119,20 +119,78 @@ var useAppointmentBookingStep = () => {
|
|
|
119
119
|
});
|
|
120
120
|
};
|
|
121
121
|
const nextStep = () => {
|
|
122
|
-
var _a2, _b2, _c2, _d, _e;
|
|
122
|
+
var _a2, _b2, _c2, _d, _e, _f, _g;
|
|
123
123
|
let stepList2 = appointmentBooking.getStepList() || [];
|
|
124
124
|
const currentKey = currentStepParams == null ? void 0 : currentStepParams.key;
|
|
125
|
-
let nextStep2 = stepList2[(currentStepParams == null ? void 0 : currentStepParams.index) + 1];
|
|
126
125
|
const currentSelectedResources = appointmentBooking.getOtherData(
|
|
127
126
|
"current_selected_resources"
|
|
128
127
|
);
|
|
129
|
-
if (
|
|
128
|
+
if (!isRetailTemplate && currentKey === "select-service") {
|
|
129
|
+
const { bookingProcess } = ((_a2 = appointmentBooking == null ? void 0 : appointmentBooking.otherParams) == null ? void 0 : _a2.productModuleParams) || {};
|
|
130
|
+
const isDateSelectedFirst = bookingProcess === "date_first";
|
|
131
|
+
const hasResourceStep = stepList2 == null ? void 0 : stepList2.find(
|
|
132
|
+
(item) => (item == null ? void 0 : item.key) === "select-resource"
|
|
133
|
+
);
|
|
134
|
+
const hasSelectGuestStep = (_b2 = stepList2 == null ? void 0 : stepList2.find(
|
|
135
|
+
(item) => (item == null ? void 0 : item.key) === "select-guest"
|
|
136
|
+
)) == null ? void 0 : _b2.key;
|
|
137
|
+
const isAllNormalProduct = appointmentBooking == null ? void 0 : appointmentBooking.isCartAllNormalProducts();
|
|
138
|
+
if (isAllNormalProduct) {
|
|
139
|
+
removeStep("select-resource");
|
|
140
|
+
removeStep("select-time");
|
|
141
|
+
removeStep("fill-form");
|
|
142
|
+
if (!isDateSelectedFirst) {
|
|
143
|
+
removeStep("select-date");
|
|
144
|
+
}
|
|
145
|
+
} else if (!hasResourceStep) {
|
|
146
|
+
let targetKey = hasSelectGuestStep ? hasSelectGuestStep : "select-service";
|
|
147
|
+
const isHasDurationProduct = appointmentBooking == null ? void 0 : appointmentBooking.isCartHasDurationProduct();
|
|
148
|
+
if (isHasDurationProduct) {
|
|
149
|
+
if (!isDateSelectedFirst) {
|
|
150
|
+
appointmentBooking.addStep(
|
|
151
|
+
{
|
|
152
|
+
key: "select-date",
|
|
153
|
+
description: import_utils.locales.getText("pisell2.appointment.select.date")
|
|
154
|
+
},
|
|
155
|
+
targetKey
|
|
156
|
+
);
|
|
157
|
+
targetKey = "select-date";
|
|
158
|
+
}
|
|
159
|
+
appointmentBooking.addStep(
|
|
160
|
+
{
|
|
161
|
+
key: "select-resource",
|
|
162
|
+
description: import_utils.locales.getText("pisell2.appointment.select.resource")
|
|
163
|
+
},
|
|
164
|
+
targetKey
|
|
165
|
+
);
|
|
166
|
+
targetKey = "select-resource";
|
|
167
|
+
appointmentBooking.addStep(
|
|
168
|
+
{
|
|
169
|
+
key: "select-time",
|
|
170
|
+
description: import_utils.locales.getText("pisell2.appointment.select.time")
|
|
171
|
+
},
|
|
172
|
+
targetKey
|
|
173
|
+
);
|
|
174
|
+
} else {
|
|
175
|
+
appointmentBooking.addStep(
|
|
176
|
+
{
|
|
177
|
+
key: "select-resource",
|
|
178
|
+
description: import_utils.locales.getText("pisell2.appointment.select.resource")
|
|
179
|
+
},
|
|
180
|
+
targetKey
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
stepList2 = (appointmentBooking == null ? void 0 : appointmentBooking.getStepList()) || [];
|
|
185
|
+
}
|
|
186
|
+
let nextStep2 = stepList2[(currentStepParams == null ? void 0 : currentStepParams.index) + 1];
|
|
187
|
+
if (!isRetailTemplate && (nextStep2 == null ? void 0 : nextStep2.key) === "select-resource") {
|
|
130
188
|
const result = appointmentBooking.checkResourceListForDate();
|
|
131
189
|
if (!result) {
|
|
132
190
|
return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unuse.date"));
|
|
133
191
|
}
|
|
134
192
|
}
|
|
135
|
-
if (currentKey == null ? void 0 : currentKey.startsWith("select-resource")) {
|
|
193
|
+
if (!isRetailTemplate && (currentKey == null ? void 0 : currentKey.startsWith("select-resource"))) {
|
|
136
194
|
const { hasError, updatedCartList } = (0, import_utils2.checkAndMarkCartRenderError)(currentSelectedResources, appointmentBooking, utils);
|
|
137
195
|
if (hasError) {
|
|
138
196
|
setCurrentSelectedResources(updatedCartList);
|
|
@@ -155,9 +213,9 @@ var useAppointmentBookingStep = () => {
|
|
|
155
213
|
}
|
|
156
214
|
});
|
|
157
215
|
stepList2 = appointmentBooking.getStepList();
|
|
158
|
-
const selectedResource = (
|
|
216
|
+
const selectedResource = (_c2 = currentSelectedResources == null ? void 0 : currentSelectedResources[0]) == null ? void 0 : _c2.currentSelectedResource;
|
|
159
217
|
if (selectedResource) {
|
|
160
|
-
const originRenderLists = ((
|
|
218
|
+
const originRenderLists = ((_d = selectedResource == null ? void 0 : selectedResource.resourceItem) == null ? void 0 : _d.originRenderLists) || [];
|
|
161
219
|
const currentResourceIndex = originRenderLists == null ? void 0 : originRenderLists.findIndex((item) => {
|
|
162
220
|
var _a3;
|
|
163
221
|
return item.id === ((_a3 = selectedResource == null ? void 0 : selectedResource.renderItem) == null ? void 0 : _a3.form_id);
|
|
@@ -165,7 +223,7 @@ var useAppointmentBookingStep = () => {
|
|
|
165
223
|
const nextResource = originRenderLists == null ? void 0 : originRenderLists[currentResourceIndex + 1];
|
|
166
224
|
const resourceKey = `select-resource_@${nextResource == null ? void 0 : nextResource.form_id}-${nextResource == null ? void 0 : nextResource.code}`;
|
|
167
225
|
if (nextResource) {
|
|
168
|
-
const beforeKey = (
|
|
226
|
+
const beforeKey = (_e = stepList2[stepList2.length - 2]) == null ? void 0 : _e.key;
|
|
169
227
|
appointmentBooking.addStep({ key: resourceKey, description: "" }, beforeKey);
|
|
170
228
|
} else {
|
|
171
229
|
appointmentBooking.removeStep(resourceKey);
|
|
@@ -174,15 +232,16 @@ var useAppointmentBookingStep = () => {
|
|
|
174
232
|
}
|
|
175
233
|
stepList2 = appointmentBooking.getStepList();
|
|
176
234
|
nextStep2 = stepList2[(currentStepParams == null ? void 0 : currentStepParams.index) + 1];
|
|
177
|
-
if (((
|
|
178
|
-
const selectedResource = ((
|
|
235
|
+
if (((_f = nextStep2 == null ? void 0 : nextStep2.key) == null ? void 0 : _f.startsWith("select-resource_")) || (nextStep2 == null ? void 0 : nextStep2.key) === "confirm-information") {
|
|
236
|
+
const selectedResource = ((_g = currentSelectedResources == null ? void 0 : currentSelectedResources[0]) == null ? void 0 : _g.currentSelectedResource) || {};
|
|
179
237
|
const renderItem = (selectedResource == null ? void 0 : selectedResource.renderItem) || {};
|
|
180
238
|
const checkHolder = () => {
|
|
181
239
|
setLoading(false);
|
|
182
|
-
if (isRetailTemplate) {
|
|
240
|
+
if (isRetailTemplate || (appointmentBooking == null ? void 0 : appointmentBooking.isCartAllNormalProducts())) {
|
|
183
241
|
return appointmentBooking.next();
|
|
184
242
|
}
|
|
185
|
-
const
|
|
243
|
+
const appoimentCarts = carts.filter((n) => !(appointmentBooking == null ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id)));
|
|
244
|
+
const { hasError } = (0, import_utils2.checkAndGoNext)(isFormSubject, checkAccount, appoimentCarts);
|
|
186
245
|
setIsErrorHolder(hasError);
|
|
187
246
|
if (hasError) {
|
|
188
247
|
return;
|
|
@@ -208,7 +267,9 @@ var useAppointmentBookingStep = () => {
|
|
|
208
267
|
const meAccount = accountLists == null ? void 0 : accountLists.find((d) => !(d == null ? void 0 : d.isGuest));
|
|
209
268
|
appointmentBooking.setLoginAccount(meAccount == null ? void 0 : meAccount.id, currentUser);
|
|
210
269
|
} else {
|
|
211
|
-
|
|
270
|
+
if (!isRetailTemplate) {
|
|
271
|
+
getHolders();
|
|
272
|
+
}
|
|
212
273
|
}
|
|
213
274
|
checkHolder();
|
|
214
275
|
}
|
|
@@ -370,6 +370,7 @@ var getResourceTitle = (appointmentBooking, code, utils, originResource) => {
|
|
|
370
370
|
var checkAndMarkCartRenderError = (carts, appointmentBooking, utils) => {
|
|
371
371
|
try {
|
|
372
372
|
let hasError = false;
|
|
373
|
+
carts = carts.filter((n) => !appointmentBooking.isTargetCartIdNormalProduct(n._id));
|
|
373
374
|
const updatedCartList = carts == null ? void 0 : carts.map((cart) => {
|
|
374
375
|
const currentResource = cart == null ? void 0 : cart.currentSelectedResource;
|
|
375
376
|
if (!(currentResource == null ? void 0 : currentResource.renderItem)) {
|
|
@@ -394,6 +395,7 @@ var checkAndMarkCartRenderError = (carts, appointmentBooking, utils) => {
|
|
|
394
395
|
updatedCartList
|
|
395
396
|
};
|
|
396
397
|
} catch (error) {
|
|
398
|
+
console.error(error);
|
|
397
399
|
return {};
|
|
398
400
|
}
|
|
399
401
|
};
|
|
@@ -51,12 +51,13 @@ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext")
|
|
|
51
51
|
var formatProducts = (values) => {
|
|
52
52
|
let arr = [];
|
|
53
53
|
arr = values.map((item) => {
|
|
54
|
-
var _a, _b, _c;
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
55
55
|
return {
|
|
56
56
|
order_detail_id: item.order_detail_id || 0,
|
|
57
57
|
num: item._extend.quantity,
|
|
58
|
-
price: item
|
|
58
|
+
price: (0, import_utils.formatProductPrice)(item),
|
|
59
59
|
product_id: item.id,
|
|
60
|
+
discount_list: (item == null ? void 0 : item.discount_list) || [],
|
|
60
61
|
discount_amount: 0,
|
|
61
62
|
product_discount_reason: "",
|
|
62
63
|
is_charge_tax: item.is_charge_tax,
|
|
@@ -64,7 +65,9 @@ var formatProducts = (values) => {
|
|
|
64
65
|
discountway: "num",
|
|
65
66
|
discount_type: "discount",
|
|
66
67
|
bundle_edit: (_a = item._extend) == null ? void 0 : _a.bundle_edit,
|
|
67
|
-
product_bundle: (0, import_utils.formatProductBundle)((_c = (_b = item._extend) == null ? void 0 : _b.other) == null ? void 0 : _c.bundle)
|
|
68
|
+
product_bundle: (0, import_utils.formatProductBundle)((_c = (_b = item._extend) == null ? void 0 : _b.other) == null ? void 0 : _c.bundle),
|
|
69
|
+
"product_option_item": (0, import_utils.formatProductOption)((_e = (_d = item._extend) == null ? void 0 : _d.other) == null ? void 0 : _e.option),
|
|
70
|
+
"product_variant_id": ((_g = (_f = item._extend) == null ? void 0 : _f.other) == null ? void 0 : _g.product_variant_id) || 0
|
|
68
71
|
};
|
|
69
72
|
});
|
|
70
73
|
return arr;
|
|
@@ -93,7 +96,7 @@ var restoreProductOtherData = (data) => {
|
|
|
93
96
|
})
|
|
94
97
|
};
|
|
95
98
|
}),
|
|
96
|
-
product_variant_id: 0,
|
|
99
|
+
product_variant_id: detail.product_variant_id || 0,
|
|
97
100
|
quantity: Number(detail.product_quantity)
|
|
98
101
|
};
|
|
99
102
|
};
|
|
@@ -210,23 +213,23 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
210
213
|
const handleAddProduct = (item, type) => {
|
|
211
214
|
let _list = [...state.addons.value];
|
|
212
215
|
const isSession = (0, import_utils2.isSessionProduct)(item);
|
|
213
|
-
const isEject =
|
|
216
|
+
const isEject = (0, import_utils2.getIsEject)(item, type);
|
|
214
217
|
state.action({
|
|
215
218
|
type: "pisell1.handleOpenProductModal",
|
|
216
219
|
data: {
|
|
217
220
|
id: item.id,
|
|
218
221
|
date: state.date.value.format("YYYY-MM-DD"),
|
|
219
222
|
showConfig: {
|
|
220
|
-
option:
|
|
223
|
+
option: true,
|
|
221
224
|
session: isSession,
|
|
222
|
-
variant:
|
|
223
|
-
package: true
|
|
225
|
+
variant: true,
|
|
226
|
+
package: true,
|
|
227
|
+
number: true
|
|
224
228
|
},
|
|
225
229
|
is_eject: isEject ? 1 : 0,
|
|
226
230
|
isOS: isSession
|
|
227
231
|
},
|
|
228
232
|
callback: (e, extension_type, detail) => {
|
|
229
|
-
console.log("e", e);
|
|
230
233
|
const _detail = detail || item;
|
|
231
234
|
let product = {
|
|
232
235
|
..._detail,
|
|
@@ -235,15 +238,15 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
235
238
|
_extend: {
|
|
236
239
|
price: _detail.price,
|
|
237
240
|
other: e,
|
|
238
|
-
quantity: 1
|
|
241
|
+
quantity: (e == null ? void 0 : e.quantity) || 1
|
|
239
242
|
},
|
|
240
|
-
quantity: 1
|
|
243
|
+
quantity: (e == null ? void 0 : e.quantity) || 1
|
|
241
244
|
};
|
|
242
245
|
let _total = (0, import_utils2.getProductTotalPrice)(product);
|
|
243
246
|
product._extend.total = _total;
|
|
244
|
-
let _item = _list.find((d) => d._extend.other.
|
|
247
|
+
let _item = _list.find((d) => d._extend.other.rowKey === e.rowKey);
|
|
245
248
|
if (_item) {
|
|
246
|
-
_item._extend.quantity = _item.quantity +
|
|
249
|
+
_item._extend.quantity = _item._extend.quantity + product.quantity;
|
|
247
250
|
} else {
|
|
248
251
|
_list.push(product);
|
|
249
252
|
}
|
|
@@ -264,7 +267,7 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
264
267
|
let quantity = e.target.value;
|
|
265
268
|
let _list = [...state.addons.value];
|
|
266
269
|
if (quantity == 0) {
|
|
267
|
-
_list = _list.filter((d) => d.
|
|
270
|
+
_list = _list.filter((d) => d._id !== item._id);
|
|
268
271
|
} else {
|
|
269
272
|
let _item = {
|
|
270
273
|
...item,
|
|
@@ -273,12 +276,10 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
273
276
|
quantity: Number(e.target.value)
|
|
274
277
|
}
|
|
275
278
|
};
|
|
276
|
-
let _total = (0, import_utils2.getProductTotalPrice)(_item);
|
|
277
|
-
_item._extend.total = _total;
|
|
278
279
|
if (((_a2 = _item._extend) == null ? void 0 : _a2.bundle_edit) !== void 0) {
|
|
279
280
|
_item._extend.bundle_edit = 1;
|
|
280
281
|
}
|
|
281
|
-
_list = _list.map((d) => d.
|
|
282
|
+
_list = _list.map((d) => d._id === item._id ? _item : d);
|
|
282
283
|
}
|
|
283
284
|
dispatch({
|
|
284
285
|
type: "setAddons",
|
|
@@ -374,10 +375,11 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
374
375
|
id: item.id,
|
|
375
376
|
date: state.date.value.format("YYYY-MM-DD"),
|
|
376
377
|
showConfig: {
|
|
377
|
-
option:
|
|
378
|
+
option: true,
|
|
378
379
|
session: isSession,
|
|
379
|
-
variant:
|
|
380
|
-
package: true
|
|
380
|
+
variant: true,
|
|
381
|
+
package: true,
|
|
382
|
+
number: true
|
|
381
383
|
},
|
|
382
384
|
value: item._extend.other,
|
|
383
385
|
isOS: isSession
|
|
@@ -386,10 +388,14 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
386
388
|
var _a2;
|
|
387
389
|
const _detail = detail || item;
|
|
388
390
|
let product = {
|
|
391
|
+
...item,
|
|
389
392
|
..._detail,
|
|
393
|
+
// 编辑商品时清除折扣信息
|
|
394
|
+
discount_list: [],
|
|
390
395
|
_extend: {
|
|
391
396
|
...item._extend,
|
|
392
|
-
other: e
|
|
397
|
+
other: e,
|
|
398
|
+
quantity: (e == null ? void 0 : e.quantity) || 1
|
|
393
399
|
}
|
|
394
400
|
};
|
|
395
401
|
if (((_a2 = product._extend) == null ? void 0 : _a2.bundle_edit) !== void 0) {
|
|
@@ -44,7 +44,7 @@ var getProductAmount = (state, isEdit) => {
|
|
|
44
44
|
if (isEdit) {
|
|
45
45
|
if ((state == null ? void 0 : state.service) || (state == null ? void 0 : state.addons)) {
|
|
46
46
|
for (let item of state == null ? void 0 : state.service.value) {
|
|
47
|
-
if (isDay) {
|
|
47
|
+
if (isDay || (0, import_utils3.isNormalProductByDurationSchedule)(item)) {
|
|
48
48
|
const quantity = item._extend.quantity || 1;
|
|
49
49
|
price += Number(item._extend.total) * Number(quantity);
|
|
50
50
|
const _duration = (0, import_utils3.isDayBookingProduct)(item, state) ? item._extend.duration : 0;
|
|
@@ -27,5 +27,14 @@ export interface ResourceItem {
|
|
|
27
27
|
* @Author: jinglin.tan
|
|
28
28
|
*/
|
|
29
29
|
export declare const checkSubResourcesCapacity: (resource: ResourceItem) => void;
|
|
30
|
+
/**
|
|
31
|
+
* @title: 格式化商品单价
|
|
32
|
+
* @description:
|
|
33
|
+
* @param {any} item
|
|
34
|
+
* @return {*}
|
|
35
|
+
* @Author: WangHan
|
|
36
|
+
* @Date: 2024-12-23 12:05
|
|
37
|
+
*/
|
|
38
|
+
export declare const formatProductPrice: (item: any) => number;
|
|
30
39
|
export declare const formatValues: (state: any) => any;
|
|
31
40
|
export declare const checkHolderIsError: (state: any) => any;
|
|
@@ -33,6 +33,7 @@ __export(utils_exports, {
|
|
|
33
33
|
checkSubResourcesCapacity: () => checkSubResourcesCapacity,
|
|
34
34
|
formatProductBundle: () => formatProductBundle,
|
|
35
35
|
formatProductOption: () => formatProductOption,
|
|
36
|
+
formatProductPrice: () => formatProductPrice,
|
|
36
37
|
formatValues: () => formatValues
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(utils_exports);
|
|
@@ -70,7 +71,7 @@ var formatProductOption = (option) => {
|
|
|
70
71
|
return option.map((d) => {
|
|
71
72
|
return {
|
|
72
73
|
"num": d.num,
|
|
73
|
-
"option_group_item_id": d.product_option_item_id,
|
|
74
|
+
"option_group_item_id": d.product_option_item_id || d.option_group_item_id,
|
|
74
75
|
"option_group_id": d.option_group_id
|
|
75
76
|
// "add_price": Number(d?.add_price),
|
|
76
77
|
};
|
|
@@ -280,6 +281,9 @@ var formatBookings = (data, values) => {
|
|
|
280
281
|
return (_a = d._extend) == null ? void 0 : _a.holder_id;
|
|
281
282
|
});
|
|
282
283
|
}
|
|
284
|
+
if (!isDay && !isEvent) {
|
|
285
|
+
list = list.filter((item) => !(0, import_utils4.isNormalProductByDurationSchedule)(item));
|
|
286
|
+
}
|
|
283
287
|
let dayParams = {};
|
|
284
288
|
const eventOtherParams = data.eventOtherParams;
|
|
285
289
|
let bookings = [];
|
|
@@ -343,6 +347,16 @@ var formatRelationProducts = (data) => {
|
|
|
343
347
|
});
|
|
344
348
|
return relationProducts || [];
|
|
345
349
|
};
|
|
350
|
+
var formatNormalProducts = (data) => {
|
|
351
|
+
var _a;
|
|
352
|
+
let list = ((_a = data.service) == null ? void 0 : _a.value) || [];
|
|
353
|
+
list = list.filter((item) => (0, import_utils4.isNormalProductByDurationSchedule)(item));
|
|
354
|
+
let relationProducts = [];
|
|
355
|
+
relationProducts = list.map((item) => {
|
|
356
|
+
return formatProducts(item);
|
|
357
|
+
});
|
|
358
|
+
return relationProducts || [];
|
|
359
|
+
};
|
|
346
360
|
var formatHolder = (state, values) => {
|
|
347
361
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
348
362
|
const form_id = ((_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id) || 0;
|
|
@@ -361,7 +375,7 @@ var formatHolder = (state, values) => {
|
|
|
361
375
|
return obj;
|
|
362
376
|
};
|
|
363
377
|
var formatValues = (state) => {
|
|
364
|
-
var _a, _b, _c, _d, _e;
|
|
378
|
+
var _a, _b, _c, _d, _e, _f;
|
|
365
379
|
let values = {
|
|
366
380
|
type: state.renderType === "eventBooking" ? "event_booking_v2" : "appointment_booking",
|
|
367
381
|
platform: "shop",
|
|
@@ -391,11 +405,10 @@ var formatValues = (state) => {
|
|
|
391
405
|
...customer
|
|
392
406
|
};
|
|
393
407
|
values.holder = formatHolder(state, values);
|
|
394
|
-
if (isDay) {
|
|
395
|
-
values.relation_products = formatRelationProducts(state);
|
|
396
|
-
}
|
|
397
|
-
if (isEvent) {
|
|
408
|
+
if (isDay || isEvent) {
|
|
398
409
|
values.relation_products = formatRelationProducts(state);
|
|
410
|
+
} else {
|
|
411
|
+
values.relation_products = formatNormalProducts(state);
|
|
399
412
|
}
|
|
400
413
|
values.bookings = formatBookings(state, values);
|
|
401
414
|
if (((_c = (_b = values == null ? void 0 : values.bookings) == null ? void 0 : _b[0]) == null ? void 0 : _c.select_date) && !(state == null ? void 0 : state.bookingId)) {
|
|
@@ -406,12 +419,15 @@ var formatValues = (state) => {
|
|
|
406
419
|
if (isDay) {
|
|
407
420
|
values.metadata.is_multiday_appointment = 1;
|
|
408
421
|
}
|
|
422
|
+
if (!((_f = values == null ? void 0 : values.bookings) == null ? void 0 : _f.length)) {
|
|
423
|
+
values.type = "virtual";
|
|
424
|
+
}
|
|
409
425
|
return values;
|
|
410
426
|
};
|
|
411
427
|
var checkHolderIsError = (state) => {
|
|
412
428
|
var _a, _b;
|
|
413
429
|
const holderError = state.service.value.some((item) => {
|
|
414
|
-
return !item._extend.holder_id;
|
|
430
|
+
return !item._extend.holder_id && !(0, import_utils4.isNormalProductByDurationSchedule)(item);
|
|
415
431
|
});
|
|
416
432
|
const clientId = (_b = (_a = state.client) == null ? void 0 : _a.value) == null ? void 0 : _b.id;
|
|
417
433
|
if (holderError && (!clientId || clientId === 0 || clientId === 1)) {
|
|
@@ -427,5 +443,6 @@ var checkHolderIsError = (state) => {
|
|
|
427
443
|
checkSubResourcesCapacity,
|
|
428
444
|
formatProductBundle,
|
|
429
445
|
formatProductOption,
|
|
446
|
+
formatProductPrice,
|
|
430
447
|
formatValues
|
|
431
448
|
});
|
|
@@ -228,7 +228,7 @@ var Info = (props) => {
|
|
|
228
228
|
const handleSelectProduct = (0, import_ahooks.useMemoizedFn)(
|
|
229
229
|
(item, type) => {
|
|
230
230
|
const isSession = (0, import_utils2.isSessionProduct)(item);
|
|
231
|
-
let isEject =
|
|
231
|
+
let isEject = (0, import_utils2.getIsEject)(item, type);
|
|
232
232
|
if (isDay) {
|
|
233
233
|
isEject = type === "detail" || item.bundle_group_count > 0 || item.option_group_count > 0 || item.is_variant > 0;
|
|
234
234
|
}
|
|
@@ -55,6 +55,9 @@ export declare const handleChangeHolder: (products: any[], currentItem: any, oth
|
|
|
55
55
|
export declare const updateServices: (state: any, currentItem: any, type?: string, other?: any, actions?: any) => any;
|
|
56
56
|
export declare const formItems: (items: any[]) => any[];
|
|
57
57
|
export declare const getIsSubjectRequire: (state: any) => boolean;
|
|
58
|
+
export declare const isNormalProductByDurationSchedule: (item: any) => boolean;
|
|
59
|
+
export declare const isAllNormalProduct: (items: any[]) => boolean;
|
|
60
|
+
export declare const isAllNormalProductByState: (state: any) => boolean;
|
|
58
61
|
/**
|
|
59
62
|
* @title: 格式化商品数据
|
|
60
63
|
* @description:
|
|
@@ -241,4 +244,4 @@ export declare const updateAppointmentServicePrice: (state: any, { start_date, e
|
|
|
241
244
|
* @Author: WangHan
|
|
242
245
|
* @Date: 2024-12-24 11:32
|
|
243
246
|
*/
|
|
244
|
-
export declare const updateServicePrice: (state: any) => Promise<any
|
|
247
|
+
export declare const updateServicePrice: (state: any) => never[] | Promise<any>;
|