@pisell/private-materials 3.3.68 → 3.3.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/es/components/appointmentBooking/components/Cart/Item/index.js +4 -2
- package/es/components/appointmentBooking/components/Services/index.js +25 -32
- package/es/components/appointmentBooking/components/Voucher/index.js +13 -0
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +6 -7
- package/es/components/appointmentBooking/locales.js +3 -3
- package/es/components/booking/addons/index.js +9 -2
- package/es/components/booking/addons/model.js +5 -0
- package/es/components/booking/components/TabProduct/selectProductItem/index.js +3 -1
- package/es/components/booking/components/TabProduct/selectProductItem/index.less +6 -0
- package/es/components/booking/components/footer/index.js +9 -3
- package/es/components/booking/components/footer/utils.js +73 -35
- package/es/components/booking/components/voucher/index.js +110 -66
- package/es/components/booking/components/voucher/utils.d.ts +4 -0
- package/es/components/booking/components/voucher/utils.js +15 -0
- package/es/components/booking/hooks/useQuotation.d.ts +1 -0
- package/es/components/booking/hooks/useQuotation.js +16 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info/service2/utils.js +6 -2
- package/es/components/booking/info2/index.js +9 -4
- package/es/components/booking/info2/serve.d.ts +1 -1
- package/es/components/booking/info2/serve.js +12 -8
- package/es/components/booking/info2/service/addService/index.js +2 -2
- package/es/components/booking/info2/service/editService/index.js +5 -2
- package/es/components/booking/info2/utils.d.ts +1 -1
- package/es/components/booking/info2/utils.js +3 -2
- package/es/components/booking/info2/utilsByBooking.d.ts +1 -1
- package/es/components/booking/info2/utilsByBooking.js +5 -3
- package/es/components/booking/locales.d.ts +3 -0
- package/es/components/booking/locales.js +6 -3
- package/es/components/booking/utils.d.ts +2 -2
- 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 +2 -2
- package/es/components/eftposPay/store/index.d.ts +5 -5
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +5 -4
- package/es/components/ticketBooking/components/ticketBooking/index.js +4 -2
- package/es/components/ticketBooking/utils/index.d.ts +5 -1
- package/es/components/ticketBooking/utils/index.js +50 -5
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +5 -4
- package/lib/components/appointmentBooking/components/Services/index.js +6 -14
- package/lib/components/appointmentBooking/components/Voucher/index.js +9 -0
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +0 -1
- package/lib/components/appointmentBooking/locales.js +3 -3
- package/lib/components/booking/addons/index.js +10 -2
- package/lib/components/booking/addons/model.js +3 -0
- package/lib/components/booking/components/TabProduct/selectProductItem/index.js +5 -1
- package/lib/components/booking/components/TabProduct/selectProductItem/index.less +6 -0
- package/lib/components/booking/components/footer/index.js +10 -5
- package/lib/components/booking/components/footer/utils.js +47 -11
- package/lib/components/booking/components/voucher/index.js +111 -67
- package/lib/components/booking/components/voucher/utils.d.ts +4 -0
- package/lib/components/booking/components/voucher/utils.js +43 -0
- package/lib/components/booking/hooks/useQuotation.d.ts +1 -0
- package/lib/components/booking/hooks/useQuotation.js +19 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info/service2/utils.js +3 -1
- package/lib/components/booking/info2/index.js +9 -9
- package/lib/components/booking/info2/serve.d.ts +1 -1
- package/lib/components/booking/info2/serve.js +1 -1
- package/lib/components/booking/info2/service/addService/index.js +2 -2
- package/lib/components/booking/info2/service/editService/index.js +5 -2
- package/lib/components/booking/info2/utils.d.ts +1 -1
- package/lib/components/booking/info2/utils.js +2 -2
- package/lib/components/booking/info2/utilsByBooking.d.ts +1 -1
- package/lib/components/booking/info2/utilsByBooking.js +3 -2
- package/lib/components/booking/locales.d.ts +3 -0
- package/lib/components/booking/locales.js +6 -3
- package/lib/components/booking/utils.d.ts +2 -2
- 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 +2 -2
- package/lib/components/eftposPay/store/index.d.ts +5 -5
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +5 -3
- package/lib/components/ticketBooking/components/ticketBooking/index.js +4 -2
- package/lib/components/ticketBooking/utils/index.d.ts +5 -1
- package/lib/components/ticketBooking/utils/index.js +44 -4
- package/package.json +2 -2
|
@@ -42,6 +42,7 @@ var import_materials = require("@pisell/materials");
|
|
|
42
42
|
var import_useIsBooking4Shop = require("../../hooks/useIsBooking4Shop");
|
|
43
43
|
var import_index = require("./index.less");
|
|
44
44
|
var import_ahooks = require("ahooks");
|
|
45
|
+
var import_utils2 = require("./utils");
|
|
45
46
|
var ShopDiscountHooks = {
|
|
46
47
|
onInited: "shopDiscount:onInited",
|
|
47
48
|
onDestroy: "shopDiscount:onDestroy",
|
|
@@ -54,37 +55,33 @@ var ShopDiscountHooks = {
|
|
|
54
55
|
};
|
|
55
56
|
var services = {};
|
|
56
57
|
var VoucherCard = (props) => {
|
|
57
|
-
var _a, _b;
|
|
58
|
+
var _a, _b, _c, _d;
|
|
58
59
|
const context = (0, import_useEngineContext.default)();
|
|
59
|
-
const { state, dispatch } = props;
|
|
60
|
+
const { state, dispatch, source } = props;
|
|
60
61
|
const [showDetail, setShowDetail] = (0, import_react.useState)(false);
|
|
61
62
|
const { pisellos } = (_a = context.appHelper) == null ? void 0 : _a.utils;
|
|
62
63
|
const [code, setCode] = (0, import_react.useState)("");
|
|
63
64
|
const [discountList, setDisCountList] = (0, import_react.useState)([]);
|
|
64
|
-
const
|
|
65
|
+
const serviceValueRef = (0, import_react.useRef)(state.service.value);
|
|
66
|
+
const addonsValueRef = (0, import_react.useRef)(state.addons.value);
|
|
65
67
|
const isBooking4Shop = (0, import_useIsBooking4Shop.useIsBooking4Shop)(state);
|
|
66
68
|
const shopDiscount = pisellos.getModule("shopDiscount");
|
|
67
69
|
services = state.service;
|
|
68
|
-
|
|
69
|
-
if (!isBooking4Shop) return [];
|
|
70
|
-
const shopDiscount2 = pisellos.getModule("shopDiscount");
|
|
71
|
-
return discountList.filter((item) => !!item.isAvailable).map((discount) => {
|
|
72
|
-
return {
|
|
73
|
-
...discount,
|
|
74
|
-
savedAmount: shopDiscount2.calcDiscountApplicableProductTotalPrice(discount)
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
}, [discountList, isBooking4Shop]);
|
|
78
|
-
(0, import_react.useEffect)(() => {
|
|
70
|
+
(0, import_ahooks.useDebounceEffect)(() => {
|
|
79
71
|
if (isBooking4Shop) {
|
|
80
72
|
shopDiscount.setCustomer(state.client.value);
|
|
81
73
|
}
|
|
82
|
-
}, [(_b = state.client.value) == null ? void 0 : _b.id, isBooking4Shop]
|
|
74
|
+
}, [(_b = state.client.value) == null ? void 0 : _b.id, isBooking4Shop], {
|
|
75
|
+
wait: 200
|
|
76
|
+
});
|
|
83
77
|
(0, import_react.useEffect)(() => {
|
|
84
78
|
if (isBooking4Shop) {
|
|
85
|
-
shopDiscount.setProductList(
|
|
79
|
+
shopDiscount.setProductList([
|
|
80
|
+
...state.service.value,
|
|
81
|
+
...state.addons.value
|
|
82
|
+
]);
|
|
86
83
|
}
|
|
87
|
-
}, [state.service.value, isBooking4Shop]);
|
|
84
|
+
}, [state.service.value, state.addons.value, isBooking4Shop]);
|
|
88
85
|
const serviceMemo = (0, import_react.useMemo)(() => {
|
|
89
86
|
var _a2;
|
|
90
87
|
const val = (_a2 = state.service.value || []) == null ? void 0 : _a2.map((value) => {
|
|
@@ -92,7 +89,6 @@ var VoucherCard = (props) => {
|
|
|
92
89
|
return {
|
|
93
90
|
booking_id: value.booking_id,
|
|
94
91
|
id: value.id,
|
|
95
|
-
_id: value._id,
|
|
96
92
|
price: value.price,
|
|
97
93
|
total: (_a3 = value == null ? void 0 : value._extend) == null ? void 0 : _a3.total,
|
|
98
94
|
discount_list: value.discount_list,
|
|
@@ -101,89 +97,141 @@ var VoucherCard = (props) => {
|
|
|
101
97
|
});
|
|
102
98
|
return val;
|
|
103
99
|
}, [state.service.value]);
|
|
100
|
+
const addonsMemo = (0, import_react.useMemo)(() => {
|
|
101
|
+
var _a2;
|
|
102
|
+
const val = (_a2 = state.addons.value || []) == null ? void 0 : _a2.map((value) => {
|
|
103
|
+
var _a3, _b2;
|
|
104
|
+
return {
|
|
105
|
+
booking_id: value.booking_id,
|
|
106
|
+
id: value.id,
|
|
107
|
+
_id: value._id,
|
|
108
|
+
price: value.price,
|
|
109
|
+
total: (_a3 = value == null ? void 0 : value._extend) == null ? void 0 : _a3.total,
|
|
110
|
+
discount_list: value.discount_list,
|
|
111
|
+
_key: value._key,
|
|
112
|
+
num: (_b2 = value == null ? void 0 : value._extend) == null ? void 0 : _b2.quantity
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
return val;
|
|
116
|
+
}, [state.addons.value]);
|
|
117
|
+
const disabled = (0, import_react.useMemo)(() => {
|
|
118
|
+
var _a2;
|
|
119
|
+
if (["paid", "partially_paid"].includes((_a2 = state.bookingDetail) == null ? void 0 : _a2.payment_status) && [...addonsMemo, ...serviceMemo].every((item) => item.booking_id)) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
return false;
|
|
123
|
+
}, [state, addonsMemo, serviceMemo]);
|
|
104
124
|
const { run } = (0, import_ahooks.useDebounceFn)(
|
|
105
125
|
() => {
|
|
106
126
|
var _a2, _b2;
|
|
107
|
-
if (
|
|
127
|
+
if (serviceValueRef.current === state.service.value && addonsValueRef.current === state.addons.value || !((_b2 = (_a2 = state.service) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length)) {
|
|
108
128
|
return;
|
|
109
129
|
}
|
|
110
130
|
if (isBooking4Shop) {
|
|
111
|
-
const val = shopDiscount.calcDiscount(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
});
|
|
131
|
+
const val = shopDiscount.calcDiscount([
|
|
132
|
+
...state.service.value,
|
|
133
|
+
...state.addons.value
|
|
134
|
+
]);
|
|
135
|
+
console.log("input: ", state.service.value);
|
|
136
|
+
console.log("output: ", val);
|
|
137
|
+
productListToValue(val.productList);
|
|
120
138
|
}
|
|
121
139
|
},
|
|
122
140
|
{ wait: 500 }
|
|
123
141
|
);
|
|
124
142
|
(0, import_react.useEffect)(() => {
|
|
125
143
|
run();
|
|
126
|
-
}, [JSON.stringify(serviceMemo), isBooking4Shop]);
|
|
144
|
+
}, [JSON.stringify(serviceMemo), JSON.stringify(addonsMemo), isBooking4Shop]);
|
|
127
145
|
const fn = (0, import_ahooks.useMemoizedFn)((result) => {
|
|
128
146
|
var _a2;
|
|
129
147
|
if (!(result == null ? void 0 : result.productList) || ((_a2 = result == null ? void 0 : result.productList) == null ? void 0 : _a2.some((item) => !item))) {
|
|
130
148
|
return;
|
|
131
149
|
}
|
|
132
|
-
|
|
133
|
-
type: "setService",
|
|
134
|
-
payload: {
|
|
135
|
-
...services,
|
|
136
|
-
value: result.productList
|
|
137
|
-
}
|
|
138
|
-
});
|
|
150
|
+
productListToValue(result.productList);
|
|
139
151
|
});
|
|
140
152
|
(0, import_react.useEffect)(() => {
|
|
141
153
|
if (!isBooking4Shop) return;
|
|
154
|
+
const onScanCustomerChange = (customer) => {
|
|
155
|
+
dispatch({
|
|
156
|
+
type: "setClient",
|
|
157
|
+
payload: {
|
|
158
|
+
value: customer
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const onDiscountListChange = (discount) => {
|
|
163
|
+
setDisCountList(discount);
|
|
164
|
+
};
|
|
142
165
|
pisellos.effects.on(
|
|
143
166
|
ShopDiscountHooks.onScanCustomerChange,
|
|
144
|
-
|
|
145
|
-
dispatch({
|
|
146
|
-
type: "setClient",
|
|
147
|
-
payload: {
|
|
148
|
-
value: customer
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
167
|
+
onScanCustomerChange
|
|
152
168
|
);
|
|
153
169
|
pisellos.effects.on(ShopDiscountHooks.onLoadPrepareCalcResult, fn);
|
|
154
170
|
pisellos.effects.on(
|
|
155
171
|
ShopDiscountHooks.onDiscountListChange,
|
|
156
|
-
|
|
157
|
-
setDisCountList(discount);
|
|
158
|
-
}
|
|
172
|
+
onDiscountListChange
|
|
159
173
|
);
|
|
160
174
|
return () => {
|
|
161
175
|
shopDiscount.clear();
|
|
162
|
-
pisellos.effects.off(ShopDiscountHooks.onCustomerChange);
|
|
163
|
-
pisellos.effects.off(ShopDiscountHooks.onLoadPrepareCalcResult);
|
|
164
|
-
pisellos.effects.off(ShopDiscountHooks.onDiscountListChange);
|
|
176
|
+
pisellos.effects.off(ShopDiscountHooks.onCustomerChange, onScanCustomerChange);
|
|
177
|
+
pisellos.effects.off(ShopDiscountHooks.onLoadPrepareCalcResult, fn);
|
|
178
|
+
pisellos.effects.off(ShopDiscountHooks.onDiscountListChange, onDiscountListChange);
|
|
165
179
|
};
|
|
166
180
|
}, [state.bookingId, isBooking4Shop, fn]);
|
|
181
|
+
const productListToValue = (0, import_ahooks.useMemoizedFn)((list, edit) => {
|
|
182
|
+
const { serviceList, addonsList } = (0, import_utils2.getServiceAddons)(list);
|
|
183
|
+
serviceValueRef.current = serviceList;
|
|
184
|
+
addonsValueRef.current = addonsList;
|
|
185
|
+
let other = {};
|
|
186
|
+
if (edit) {
|
|
187
|
+
other = {
|
|
188
|
+
edit: true
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
dispatch({
|
|
192
|
+
type: "setService",
|
|
193
|
+
payload: {
|
|
194
|
+
value: serviceList,
|
|
195
|
+
...other
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
dispatch({
|
|
199
|
+
type: "setAddons",
|
|
200
|
+
payload: {
|
|
201
|
+
value: addonsList,
|
|
202
|
+
...other
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
});
|
|
167
206
|
const onScanCode = async () => {
|
|
168
207
|
const val = await shopDiscount.scanCode(code);
|
|
169
208
|
console.log(val);
|
|
170
209
|
if (val == null ? void 0 : val.isAvailable) {
|
|
171
|
-
|
|
172
|
-
dispatch({
|
|
173
|
-
type: "setService",
|
|
174
|
-
payload: {
|
|
175
|
-
value: val.productList,
|
|
176
|
-
edit: true
|
|
177
|
-
}
|
|
178
|
-
});
|
|
210
|
+
productListToValue(val.productList, true);
|
|
179
211
|
setCode("");
|
|
180
212
|
} else {
|
|
181
213
|
(0, import_materials.PisellToast)({
|
|
182
|
-
content: import_utils.locales.getText("pisell2.text.goodpass.code-invalid")
|
|
214
|
+
content: val.type === "server" ? import_utils.locales.getText("pisell2.text.goodpass.code-invalid") : import_utils.locales.getText("pisell2.text.goodpass.code-invalid-cart")
|
|
183
215
|
});
|
|
184
216
|
}
|
|
185
217
|
};
|
|
218
|
+
const availableData = (0, import_react.useMemo)(() => {
|
|
219
|
+
if (!isBooking4Shop) return [];
|
|
220
|
+
const shopDiscount2 = pisellos.getModule("shopDiscount");
|
|
221
|
+
return discountList.filter((item) => !!item.isAvailable).map((discount) => {
|
|
222
|
+
return {
|
|
223
|
+
...discount,
|
|
224
|
+
isDisabled: discount.isDisabled || discount.isDisabledForProductUsed || disabled,
|
|
225
|
+
savedAmount: shopDiscount2.calcDiscountApplicableProductTotalPrice(discount)
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
}, [discountList, isBooking4Shop, disabled]);
|
|
186
229
|
if (!isBooking4Shop) return null;
|
|
230
|
+
const mixedSort = (val) => {
|
|
231
|
+
return [...val].sort((a, b) => {
|
|
232
|
+
return Number(b == null ? void 0 : b.isSelected) - Number(a == null ? void 0 : a.isSelected);
|
|
233
|
+
});
|
|
234
|
+
};
|
|
187
235
|
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-voucher-container" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-title" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "voucher-title-left" }, import_utils.locales.getText("pisell2.text.goodpass")), /* @__PURE__ */ import_react.default.createElement(
|
|
188
236
|
"span",
|
|
189
237
|
{
|
|
@@ -214,7 +262,8 @@ var VoucherCard = (props) => {
|
|
|
214
262
|
import_materials.PisellGoodPassCard,
|
|
215
263
|
{
|
|
216
264
|
style: { width: "100%" },
|
|
217
|
-
dataSource: availableData,
|
|
265
|
+
dataSource: ((_d = (_c = state.service) == null ? void 0 : _c.value) == null ? void 0 : _d.length) ? availableData : [],
|
|
266
|
+
mixedSort,
|
|
218
267
|
onChange: (val) => {
|
|
219
268
|
const shopDiscount2 = pisellos.getModule("shopDiscount");
|
|
220
269
|
const detail = shopDiscount2.setDiscountSelected({
|
|
@@ -222,13 +271,7 @@ var VoucherCard = (props) => {
|
|
|
222
271
|
isSelected: val.isSelected
|
|
223
272
|
});
|
|
224
273
|
console.log("setDiscountSelected:", detail);
|
|
225
|
-
|
|
226
|
-
type: "setService",
|
|
227
|
-
payload: {
|
|
228
|
-
edit: true,
|
|
229
|
-
value: detail.productList
|
|
230
|
-
}
|
|
231
|
-
});
|
|
274
|
+
productListToValue(detail.productList, true);
|
|
232
275
|
}
|
|
233
276
|
}
|
|
234
277
|
) : null,
|
|
@@ -241,6 +284,7 @@ var VoucherCard = (props) => {
|
|
|
241
284
|
setCode((_a2 = e.target) == null ? void 0 : _a2.value);
|
|
242
285
|
},
|
|
243
286
|
size: "small",
|
|
287
|
+
allowClear: true,
|
|
244
288
|
placeholder: import_utils.locales.getText("pisell2.text.goodpass.enter-code")
|
|
245
289
|
}
|
|
246
290
|
)), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { size: "small", onClick: onScanCode, disabled: !code }, import_utils.locales.getText("pisell2.text.apply")))
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/booking/components/voucher/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
getServiceAddons: () => getServiceAddons
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(utils_exports);
|
|
25
|
+
var getServiceAddons = (list) => {
|
|
26
|
+
const serviceList = [];
|
|
27
|
+
const addonsList = [];
|
|
28
|
+
list.forEach((item) => {
|
|
29
|
+
if (item.isAddons) {
|
|
30
|
+
addonsList.push(item);
|
|
31
|
+
} else {
|
|
32
|
+
serviceList.push(item);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
serviceList,
|
|
37
|
+
addonsList
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
getServiceAddons
|
|
43
|
+
});
|
|
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/components/booking/hooks/useQuotation.tsx
|
|
30
30
|
var useQuotation_exports = {};
|
|
31
31
|
__export(useQuotation_exports, {
|
|
32
|
+
calculateTotalPrice: () => calculateTotalPrice,
|
|
32
33
|
default: () => useQuotation_default
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(useQuotation_exports);
|
|
@@ -38,6 +39,7 @@ var import_useEngineContext = __toESM(require("../../../../es/hooks/useEngineCon
|
|
|
38
39
|
var import_utils2 = require("@pisell/utils");
|
|
39
40
|
var import_materials = require("@pisell/materials");
|
|
40
41
|
var import_serve = require("../info/service/serve");
|
|
42
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
41
43
|
var formatBundleItemMap = (product) => {
|
|
42
44
|
return product.bundle_group.reduce((pre, cur) => {
|
|
43
45
|
const curObj = {};
|
|
@@ -50,6 +52,13 @@ var formatBundleItemMap = (product) => {
|
|
|
50
52
|
};
|
|
51
53
|
}, {});
|
|
52
54
|
};
|
|
55
|
+
var calculateTotalPrice = (data) => {
|
|
56
|
+
const _price = data.reduce((total, item) => {
|
|
57
|
+
const _price2 = (item == null ? void 0 : item.price) || (item == null ? void 0 : item.add_price);
|
|
58
|
+
return total + _price2 * item.num;
|
|
59
|
+
}, 0);
|
|
60
|
+
return parseFloat(_price);
|
|
61
|
+
};
|
|
53
62
|
var setNewCartValue = (cartValue, newProducts) => {
|
|
54
63
|
if (!newProducts.length) {
|
|
55
64
|
return {
|
|
@@ -81,10 +90,15 @@ var setNewCartValue = (cartValue, newProducts) => {
|
|
|
81
90
|
isChangePrice = true;
|
|
82
91
|
isBundleChange = true;
|
|
83
92
|
}
|
|
93
|
+
if (bundleItemMap[bundle.id].price_type === "markdown") {
|
|
94
|
+
bundleItemMap[bundle.id].price = new import_decimal.default(bundleItemMap[bundle.id].price || 0).mul(-1).toNumber();
|
|
95
|
+
}
|
|
96
|
+
const selectBundleInfo = item._extend.other.bundle.find((item2) => item2.id === bundle.id);
|
|
97
|
+
const optionPrice = calculateTotalPrice((selectBundleInfo == null ? void 0 : selectBundleInfo.option) || []);
|
|
84
98
|
return {
|
|
85
99
|
...bundle,
|
|
86
100
|
base_price: bundleItemMap[bundle.id].base_price,
|
|
87
|
-
price: bundleItemMap[bundle.id].price
|
|
101
|
+
price: new import_decimal.default(bundleItemMap[bundle.id].price || 0).add(optionPrice).toNumber()
|
|
88
102
|
// product_price: bundleItemMap[item.id].product_price,
|
|
89
103
|
};
|
|
90
104
|
});
|
|
@@ -194,3 +208,7 @@ var useQuotation = (state, dispatch) => {
|
|
|
194
208
|
};
|
|
195
209
|
};
|
|
196
210
|
var useQuotation_default = useQuotation;
|
|
211
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
212
|
+
0 && (module.exports = {
|
|
213
|
+
calculateTotalPrice
|
|
214
|
+
});
|
|
@@ -244,4 +244,4 @@ export declare const updateAppointmentServicePrice: (state: any, { start_date, e
|
|
|
244
244
|
* @Author: WangHan
|
|
245
245
|
* @Date: 2024-12-24 11:32
|
|
246
246
|
*/
|
|
247
|
-
export declare const updateServicePrice: (state: any) => never[]
|
|
247
|
+
export declare const updateServicePrice: (state: any) => Promise<any> | never[];
|
|
@@ -178,7 +178,7 @@ var handleChangeHolder = (products, currentItem, other) => {
|
|
|
178
178
|
...item,
|
|
179
179
|
_extend: {
|
|
180
180
|
...item._extend,
|
|
181
|
-
holder_id: other.id
|
|
181
|
+
holder_id: (0, import_utils2.isArr)(other) ? other.map((item2) => item2.id) : item._extend.quantity > 1 ? [other.id] : other.id
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
}
|
|
@@ -514,6 +514,8 @@ var getGeneralParams = (item, state, isParallelResource) => {
|
|
|
514
514
|
actionText: import_utils2.locales.getText("page.booking.text.add-time"),
|
|
515
515
|
isMultipleResource: true,
|
|
516
516
|
multiResources,
|
|
517
|
+
holderMaxCount: item == null ? void 0 : item._extend.quantity,
|
|
518
|
+
holderMode: (item == null ? void 0 : item._extend.quantity) > 1 ? "multiple" : void 0,
|
|
517
519
|
isErrorHolder: getIsSubjectRequire(state),
|
|
518
520
|
addHolderButtonText: ((_c = (_b = formData == null ? void 0 : formData[0]) == null ? void 0 : _b.form) == null ? void 0 : _c.title) || "",
|
|
519
521
|
holder_id: (_d = item == null ? void 0 : item._extend) == null ? void 0 : _d.holder_id,
|
|
@@ -56,6 +56,7 @@ var import_antd = require("antd");
|
|
|
56
56
|
var import_classnames = __toESM(require("classnames"));
|
|
57
57
|
var import_useCreateBookingPageHeader = __toESM(require("../hooks/useCreateBookingPageHeader"));
|
|
58
58
|
var import_locales2 = require("../../../utils/locales");
|
|
59
|
+
var import_ahooks = require("ahooks");
|
|
59
60
|
var defaultModules = {
|
|
60
61
|
client: 1,
|
|
61
62
|
date: 1,
|
|
@@ -164,13 +165,10 @@ var Info = (0, import_model.Provider)((props) => {
|
|
|
164
165
|
}
|
|
165
166
|
try {
|
|
166
167
|
setTimeout(async () => {
|
|
167
|
-
var _a2;
|
|
168
|
-
let data = await (0, import_serve.getResourceList)(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
(_a2 = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a2.bookingId
|
|
173
|
-
);
|
|
168
|
+
var _a2, _b2, _c2, _d2;
|
|
169
|
+
let data = await (0, import_serve.getResourceList)({
|
|
170
|
+
date: currentDate
|
|
171
|
+
}, (_d2 = (_c2 = (_b2 = (_a2 = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a2.service) == null ? void 0 : _b2.value) == null ? void 0 : _c2.map) == null ? void 0 : _d2.call(_c2, (item) => item == null ? void 0 : item.booking_id));
|
|
174
172
|
data.date = currentDate;
|
|
175
173
|
localStorage.setItem("bookingResourceList", JSON.stringify(data));
|
|
176
174
|
modal.dispatch({
|
|
@@ -186,11 +184,13 @@ var Info = (0, import_model.Provider)((props) => {
|
|
|
186
184
|
console.log(err, "err");
|
|
187
185
|
}
|
|
188
186
|
};
|
|
189
|
-
(0,
|
|
187
|
+
(0, import_ahooks.useDebounceEffect)(() => {
|
|
190
188
|
if (currentDate) {
|
|
191
189
|
getResourcesData();
|
|
192
190
|
}
|
|
193
|
-
}, [currentDate]
|
|
191
|
+
}, [currentDate], {
|
|
192
|
+
wait: 300
|
|
193
|
+
});
|
|
194
194
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, !!modal.state.setGlobalState ? /* @__PURE__ */ import_react.default.createElement(
|
|
195
195
|
import_tabPane.default,
|
|
196
196
|
{
|
|
@@ -26,7 +26,7 @@ __export(serve_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(serve_exports);
|
|
27
27
|
var import_utils = require("../utils");
|
|
28
28
|
var import_utils2 = require("./utils");
|
|
29
|
-
var getResourceList = async (params, bookingId) => {
|
|
29
|
+
var getResourceList = async (params, bookingId = []) => {
|
|
30
30
|
let { data } = await import_utils.request.getRequest().get(`/shop/schedule/resource/list`, params);
|
|
31
31
|
return (0, import_utils2.getFormatResourceListAndMap)(data, bookingId);
|
|
32
32
|
};
|
|
@@ -47,7 +47,7 @@ var import_utils2 = require("./utils");
|
|
|
47
47
|
var import_utils3 = require("../../../utils");
|
|
48
48
|
var import_utils4 = require("@pisell/utils");
|
|
49
49
|
var import_ahooks = require("ahooks");
|
|
50
|
-
var import_utils5 = require("
|
|
50
|
+
var import_utils5 = require("../../../../ticketBooking/utils");
|
|
51
51
|
var shopList = [
|
|
52
52
|
2886,
|
|
53
53
|
4422,
|
|
@@ -202,7 +202,7 @@ var Info = (props) => {
|
|
|
202
202
|
session: isSession,
|
|
203
203
|
variant: true,
|
|
204
204
|
package: true,
|
|
205
|
-
number: (0, import_utils5.
|
|
205
|
+
number: (0, import_utils5.getIsShowNumber)(item, state)
|
|
206
206
|
},
|
|
207
207
|
is_eject: isEject ? 1 : 0,
|
|
208
208
|
isOnlySession,
|
|
@@ -51,6 +51,7 @@ var import_utils4 = require("../addService/utils");
|
|
|
51
51
|
var import_materials = require("@pisell/materials");
|
|
52
52
|
var import_utils5 = require("../../../info/utils");
|
|
53
53
|
var import_utils6 = require("../../../info/service2/utils");
|
|
54
|
+
var import_utils7 = require("../../../../ticketBooking/utils");
|
|
54
55
|
var submitLock = false;
|
|
55
56
|
var Info = (_, ref) => {
|
|
56
57
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
@@ -191,9 +192,11 @@ var Info = (_, ref) => {
|
|
|
191
192
|
}
|
|
192
193
|
_item._extend = _extend;
|
|
193
194
|
_item._time = (/* @__PURE__ */ new Date()).getTime();
|
|
195
|
+
_item._serviceKey = (0, import_utils7.genServiceKey)(_item);
|
|
194
196
|
let _id = _item == null ? void 0 : _item._id;
|
|
195
197
|
if (!_list.some((d) => d._id === _id)) {
|
|
196
|
-
|
|
198
|
+
const detail = (0, import_utils7.addService)(_list, _item, state);
|
|
199
|
+
_list = detail.list;
|
|
197
200
|
} else {
|
|
198
201
|
if (isChangeTotal.current) {
|
|
199
202
|
delete _item.discount_list;
|
|
@@ -332,7 +335,7 @@ var Info = (_, ref) => {
|
|
|
332
335
|
session: isSession,
|
|
333
336
|
variant: true,
|
|
334
337
|
package: true,
|
|
335
|
-
number: (0,
|
|
338
|
+
number: (0, import_utils7.getIsShowNumber)(item, state)
|
|
336
339
|
},
|
|
337
340
|
isOS: isSession,
|
|
338
341
|
customer_id: (_e2 = (_d2 = state.client) == null ? void 0 : _d2.value) == null ? void 0 : _e2.id,
|
|
@@ -23,7 +23,7 @@ __export(utils_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(utils_exports);
|
|
25
25
|
var import_mock = require("../mock");
|
|
26
|
-
var getFormatResourceListAndMap = (data, bookingId) => {
|
|
26
|
+
var getFormatResourceListAndMap = (data, bookingId = []) => {
|
|
27
27
|
let resourceList = (data || {}).concat([(0, import_mock.getNoResource2)({})]);
|
|
28
28
|
const map = resourceList.reduce((prev, item) => {
|
|
29
29
|
prev[item.id] = item;
|
|
@@ -37,7 +37,7 @@ var getFormatResourceListAndMap = (data, bookingId) => {
|
|
|
37
37
|
let pax = 0;
|
|
38
38
|
(((_a2 = map[cur]) == null ? void 0 : _a2.times) || []).forEach((time) => {
|
|
39
39
|
time.event_list.forEach((event) => {
|
|
40
|
-
if (event.id
|
|
40
|
+
if (!bookingId.includes(event.id)) {
|
|
41
41
|
pax += (event == null ? void 0 : event.pax) || 0;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const getResourceTimeIsUsable: (item: any, cacheItem: any, resourceItem: any) => any;
|
|
2
|
-
export declare const getSumCapacity: ({ cacheItem }: any) => number;
|
|
2
|
+
export declare const getSumCapacity: ({ cacheItem }: any, isCalcQuantity?: boolean) => number;
|
|
3
3
|
/**
|
|
4
4
|
* @title: 查找是否有可用的time
|
|
5
5
|
* @description:
|
|
@@ -114,12 +114,13 @@ var getResourceTimeIsUsable = (item, cacheItem, resourceItem) => {
|
|
|
114
114
|
};
|
|
115
115
|
return time;
|
|
116
116
|
};
|
|
117
|
-
var getSumCapacity = ({ cacheItem }) => {
|
|
117
|
+
var getSumCapacity = ({ cacheItem }, isCalcQuantity = true) => {
|
|
118
|
+
var _a;
|
|
118
119
|
let sum = 0;
|
|
119
120
|
for (let item of cacheItem._extend.capacity || []) {
|
|
120
121
|
sum += item.value;
|
|
121
122
|
}
|
|
122
|
-
return sum;
|
|
123
|
+
return sum * (isCalcQuantity ? ((_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.quantity) || 1 : 1);
|
|
123
124
|
};
|
|
124
125
|
var formatTimes = (resourceItem, cacheItem) => {
|
|
125
126
|
let usableTimes = [];
|
|
@@ -261,6 +261,7 @@ declare const _default: {
|
|
|
261
261
|
'pisell2.text.goodpass.code': string;
|
|
262
262
|
'pisell2.text.goodpass.enter-code': string;
|
|
263
263
|
'pisell2.text.goodpass.code-invalid': string;
|
|
264
|
+
'pisell2.text.goodpass.code-invalid-cart': string;
|
|
264
265
|
'pisell2.text.status.valid': string;
|
|
265
266
|
'pisell2.text.status.expired': string;
|
|
266
267
|
'pisell2.text.validity.expired': (str: string) => string;
|
|
@@ -531,6 +532,7 @@ declare const _default: {
|
|
|
531
532
|
'pisell2.text.goodpass.code': string;
|
|
532
533
|
'pisell2.text.goodpass.enter-code': string;
|
|
533
534
|
'pisell2.text.goodpass.code-invalid': string;
|
|
535
|
+
'pisell2.text.goodpass.code-invalid-cart': string;
|
|
534
536
|
'pisell2.text.status.valid': string;
|
|
535
537
|
'pisell2.text.status.expired': string;
|
|
536
538
|
'pisell2.text.validity.expired': (str: string) => string;
|
|
@@ -801,6 +803,7 @@ declare const _default: {
|
|
|
801
803
|
'pisell2.text.goodpass.code': string;
|
|
802
804
|
'pisell2.text.goodpass.enter-code': string;
|
|
803
805
|
'pisell2.text.goodpass.code-invalid': string;
|
|
806
|
+
'pisell2.text.goodpass.code-invalid-cart': string;
|
|
804
807
|
'pisell2.text.status.valid': string;
|
|
805
808
|
'pisell2.text.status.expired': string;
|
|
806
809
|
'pisell2.text.validity.expired': (str: string) => string;
|
|
@@ -311,12 +311,13 @@ var locales_default = {
|
|
|
311
311
|
"pisell2.text.send-form-reminder-tooltip": "Refresh forms",
|
|
312
312
|
"pisell2.text.send-form-reminder-refresh": "Forms refreshed successfully",
|
|
313
313
|
"pisell2.text.send-form-reminder-error-message": "Please select at least one reminder method",
|
|
314
|
-
"pisell2.text.goodpass": "
|
|
314
|
+
"pisell2.text.goodpass": "Promotion",
|
|
315
315
|
"pisell2.text.goodpass.product-vouchers": "Product Vouchers",
|
|
316
316
|
"pisell2.text.goodpass.view-more": "View More",
|
|
317
317
|
"pisell2.text.goodpass.code": "Code",
|
|
318
318
|
"pisell2.text.goodpass.enter-code": "Enter Code",
|
|
319
319
|
"pisell2.text.goodpass.code-invalid": "Current code is invalid",
|
|
320
|
+
"pisell2.text.goodpass.code-invalid-cart": "No eligible items in the cart",
|
|
320
321
|
"pisell2.text.status.valid": "Valid",
|
|
321
322
|
"pisell2.text.status.expired": "Expired",
|
|
322
323
|
"pisell2.text.validity.expired": (str) => {
|
|
@@ -613,12 +614,13 @@ var locales_default = {
|
|
|
613
614
|
"pisell2.text.send-form-reminder-tooltip": "刷新表单",
|
|
614
615
|
"pisell2.text.send-form-reminder-refresh": "已刷新表单",
|
|
615
616
|
"pisell2.text.send-form-reminder-error-message": "请至少选择一种提醒方式",
|
|
616
|
-
"pisell2.text.goodpass": "
|
|
617
|
+
"pisell2.text.goodpass": "促销",
|
|
617
618
|
"pisell2.text.goodpass.product-vouchers": "商品兑换券",
|
|
618
619
|
"pisell2.text.goodpass.view-more": "查看更多",
|
|
619
620
|
"pisell2.text.goodpass.code": "券码",
|
|
620
621
|
"pisell2.text.goodpass.enter-code": "请输入券码",
|
|
621
622
|
"pisell2.text.goodpass.code-invalid": "当前券码不可用",
|
|
623
|
+
"pisell2.text.goodpass.code-invalid-cart": "当前购物车中无可用商品",
|
|
622
624
|
"pisell2.text.status.valid": "有效",
|
|
623
625
|
"pisell2.text.status.expired": "已过期",
|
|
624
626
|
"pisell2.text.validity.expired": (str) => {
|
|
@@ -915,12 +917,13 @@ var locales_default = {
|
|
|
915
917
|
"pisell2.text.send-form-reminder-tooltip": "刷新表單",
|
|
916
918
|
"pisell2.text.send-form-reminder-refresh": "已刷新表單",
|
|
917
919
|
"pisell2.text.send-form-reminder-error-message": "請至少選擇一種提醒方式",
|
|
918
|
-
"pisell2.text.goodpass": "
|
|
920
|
+
"pisell2.text.goodpass": "促銷",
|
|
919
921
|
"pisell2.text.goodpass.product-vouchers": "商品兌換券",
|
|
920
922
|
"pisell2.text.goodpass.view-more": "查看更多",
|
|
921
923
|
"pisell2.text.goodpass.code": "券碼",
|
|
922
924
|
"pisell2.text.goodpass.enter-code": "請輸入券碼",
|
|
923
925
|
"pisell2.text.goodpass.code-invalid": "當前券碼不可用",
|
|
926
|
+
"pisell2.text.goodpass.code-invalid-cart": "當前購物車中無可用商品",
|
|
924
927
|
"pisell2.text.status.valid": "有效",
|
|
925
928
|
"pisell2.text.status.expired": "已過期",
|
|
926
929
|
"pisell2.text.validity.expired": (str) => {
|
|
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
|
|
|
165
165
|
export declare const getDuration: (duration: number | {
|
|
166
166
|
type: string;
|
|
167
167
|
value: number;
|
|
168
|
-
}) => number | {
|
|
168
|
+
}) => number | "flexible" | {
|
|
169
169
|
type: string;
|
|
170
170
|
value: number;
|
|
171
|
-
}
|
|
171
|
+
};
|
|
172
172
|
export declare const isWalkIn: (customer_id?: number | string) => boolean;
|
|
173
173
|
export declare const getIsEdit: (state: any) => boolean;
|
|
174
174
|
export {};
|