@pisell/private-materials 3.0.16 → 3.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/booking/addons/index.d.ts +1 -1
- package/es/components/booking/addons/index.js +148 -32
- package/es/components/booking/addons/model.d.ts +1 -2
- package/es/components/booking/components/TabProduct/selectProductItem/index.js +21 -8
- package/es/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
- package/es/components/booking/components/collapsibleList/index.d.ts +11 -0
- package/es/components/booking/components/collapsibleList/index.js +99 -0
- package/es/components/booking/components/collapsibleList/index.less +61 -0
- package/es/components/booking/components/collapsibleList/utils.d.ts +2 -0
- package/es/components/booking/components/collapsibleList/utils.js +21 -0
- package/es/components/booking/components/footer/amount.js +9 -10
- package/es/components/booking/components/footer/utils.d.ts +18 -0
- package/es/components/booking/components/footer/utils.js +76 -4
- package/es/components/booking/forms/forms.d.ts +1 -1
- package/es/components/booking/forms/index.d.ts +1 -1
- package/es/components/booking/forms/model.d.ts +1 -2
- package/es/components/booking/forms/single/index.js +16 -82
- package/es/components/booking/index.d.ts +1 -1
- package/es/components/booking/info/index.d.ts +1 -1
- package/es/components/booking/info/model.d.ts +1 -2
- package/es/components/booking/info/service/addService/index.js +47 -24
- package/es/components/booking/info/service/editService/index.js +49 -24
- package/es/components/booking/info/service/editService/index.less +21 -0
- package/es/components/booking/info/service/index.d.ts +2 -2
- package/es/components/booking/info/service/index.js +5 -129
- package/es/components/booking/info/service/index.less +0 -100
- package/es/components/booking/info/service/serviceItem/index.d.ts +4 -0
- package/es/components/booking/info/service/serviceItem/index.js +63 -0
- package/es/components/booking/info/service/serviceItem/index.less +97 -0
- package/es/components/booking/info/service/serviceList/index.d.ts +4 -0
- package/es/components/booking/info/service/serviceList/index.js +105 -0
- package/es/components/booking/info/service/serviceList/index.less +0 -0
- package/es/components/booking/model.d.ts +1 -2
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -2
- package/es/components/booking/payments/index.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -2
- package/es/components/booking/utils.d.ts +1 -0
- package/es/components/booking/utils.js +15 -0
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -2
- package/lib/components/booking/addons/index.d.ts +1 -1
- package/lib/components/booking/addons/index.js +159 -35
- package/lib/components/booking/addons/model.d.ts +1 -2
- package/lib/components/booking/components/TabProduct/selectProductItem/index.js +33 -8
- package/lib/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
- package/lib/components/booking/components/collapsibleList/index.d.ts +11 -0
- package/lib/components/booking/components/collapsibleList/index.js +94 -0
- package/lib/components/booking/components/collapsibleList/index.less +61 -0
- package/lib/components/booking/components/collapsibleList/utils.d.ts +2 -0
- package/lib/components/booking/components/collapsibleList/utils.js +46 -0
- package/lib/components/booking/components/footer/amount.js +9 -10
- package/lib/components/booking/components/footer/utils.d.ts +18 -0
- package/lib/components/booking/components/footer/utils.js +46 -7
- package/lib/components/booking/forms/forms.d.ts +1 -1
- package/lib/components/booking/forms/index.d.ts +1 -1
- package/lib/components/booking/forms/model.d.ts +1 -2
- package/lib/components/booking/forms/single/index.js +12 -48
- package/lib/components/booking/index.d.ts +1 -1
- package/lib/components/booking/info/index.d.ts +1 -1
- package/lib/components/booking/info/model.d.ts +1 -2
- package/lib/components/booking/info/service/addService/index.js +57 -36
- package/lib/components/booking/info/service/editService/index.js +76 -56
- package/lib/components/booking/info/service/editService/index.less +21 -0
- package/lib/components/booking/info/service/index.d.ts +2 -2
- package/lib/components/booking/info/service/index.js +4 -112
- package/lib/components/booking/info/service/index.less +0 -100
- package/lib/components/booking/info/service/serviceItem/index.d.ts +4 -0
- package/lib/components/booking/info/service/serviceItem/index.js +98 -0
- package/lib/components/booking/info/service/serviceItem/index.less +97 -0
- package/lib/components/booking/info/service/serviceList/index.d.ts +4 -0
- package/lib/components/booking/info/service/serviceList/index.js +129 -0
- package/lib/components/booking/info/service/serviceList/index.less +0 -0
- package/lib/components/booking/model.d.ts +1 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -2
- package/lib/components/booking/payments/index.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -2
- package/lib/components/booking/utils.d.ts +1 -0
- package/lib/components/booking/utils.js +15 -0
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/package.json +1 -1
|
@@ -41,15 +41,17 @@ var import_utils = require("@pisell/utils");
|
|
|
41
41
|
var import_duration = __toESM(require("../../../materiels/duration"));
|
|
42
42
|
var import_antd = require("antd");
|
|
43
43
|
var import_index = require("./index.less");
|
|
44
|
+
var import_collapsibleList = __toESM(require("../../../components/collapsibleList"));
|
|
45
|
+
var import_utils2 = require("../../../components/collapsibleList/utils");
|
|
44
46
|
var import_dayjs = __toESM(require("dayjs"));
|
|
45
47
|
var import_ahooks = require("ahooks");
|
|
46
|
-
var
|
|
48
|
+
var import_utils3 = require("../../../utils");
|
|
47
49
|
var import_like = __toESM(require("../like"));
|
|
48
50
|
var import_mock = require("../../../mock");
|
|
49
51
|
var Info = () => {
|
|
50
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
51
53
|
const [form] = import_antd.Form.useForm();
|
|
52
|
-
const
|
|
54
|
+
const useTotal = import_antd.Form.useWatch("total", form);
|
|
53
55
|
const useLikeStatus = import_antd.Form.useWatch("like_status", form);
|
|
54
56
|
const useResource = import_antd.Form.useWatch("resource", form);
|
|
55
57
|
const useStartTime = import_antd.Form.useWatch("start_time", form);
|
|
@@ -80,7 +82,7 @@ var Info = () => {
|
|
|
80
82
|
(0, import_dayjs.default)(_cacheItem._extend.start_date).format("YYYY-MM-DD ") + (useStartTime || "00:00")
|
|
81
83
|
),
|
|
82
84
|
usableTime: (_a2 = currentResource == null ? void 0 : currentResource._extend) == null ? void 0 : _a2.usableTime,
|
|
83
|
-
duration: (0,
|
|
85
|
+
duration: (0, import_utils3.getDuration)(_cacheItem == null ? void 0 : _cacheItem.duration),
|
|
84
86
|
locale: import_utils.locales.locale,
|
|
85
87
|
slice: (_d2 = (_c2 = (_b2 = state.bookingConfig) == null ? void 0 : _b2.config) == null ? void 0 : _c2.basic) == null ? void 0 : _d2.service_time,
|
|
86
88
|
selectProps: { size: "large" }
|
|
@@ -96,7 +98,7 @@ var Info = () => {
|
|
|
96
98
|
var _a2, _b2;
|
|
97
99
|
let _duration = durationProps.duration;
|
|
98
100
|
if (_duration === "flexible") {
|
|
99
|
-
let endDate = (0,
|
|
101
|
+
let endDate = (0, import_utils3.getEndDate)(
|
|
100
102
|
durationProps.startDate,
|
|
101
103
|
_duration,
|
|
102
104
|
((_a2 = durationProps.usableTime) == null ? void 0 : _a2.end_at) ? (0, import_dayjs.default)((_b2 = durationProps.usableTime) == null ? void 0 : _b2.end_at) : null
|
|
@@ -104,14 +106,14 @@ var Info = () => {
|
|
|
104
106
|
let timeValue = endDate.diff(durationProps.startDate, "minute");
|
|
105
107
|
return {
|
|
106
108
|
label: import_utils.locales.getText("pisell2.text.flexible"),
|
|
107
|
-
value:
|
|
109
|
+
value: import_utils3.flexibleObj.create(timeValue)
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
112
|
return null;
|
|
111
113
|
}, [durationProps, import_utils.locales.locale]);
|
|
112
114
|
const timeObj = (0, import_react.useMemo)(() => {
|
|
113
115
|
var _a2, _b2, _c2;
|
|
114
|
-
let obj = (0,
|
|
116
|
+
let obj = (0, import_utils3.sliceDayIntoFiveMinutes)(
|
|
115
117
|
(_c2 = (_b2 = (_a2 = state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.service_time,
|
|
116
118
|
import_utils.locales.locale
|
|
117
119
|
);
|
|
@@ -121,7 +123,7 @@ var Info = () => {
|
|
|
121
123
|
}
|
|
122
124
|
if (useDuration && !durationSlicesBasedOnTime.some((d) => d.value === useDuration)) {
|
|
123
125
|
durationSlicesBasedOnTime.unshift({
|
|
124
|
-
label: (0,
|
|
126
|
+
label: (0, import_utils3.getDiscountTime)(useDuration),
|
|
125
127
|
value: useDuration,
|
|
126
128
|
//@ts-ignore
|
|
127
129
|
disabled: true
|
|
@@ -145,36 +147,39 @@ var Info = () => {
|
|
|
145
147
|
}
|
|
146
148
|
}, [useDuration, flexibleOption]);
|
|
147
149
|
const getResources = async (cacheItem) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
let _list = [(0, import_mock.getNoResource)()].concat((data == null ? void 0 : data.list) || []);
|
|
157
|
-
const _cacheItem = cacheItem || getCurrentCacheItem();
|
|
158
|
-
if (!_cacheItem._extend) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
_list = _list.map(
|
|
162
|
-
(d) => (0, import_utils2.formatResource)(d, _cacheItem, (item) => {
|
|
163
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: "resource-option" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "like-wrap" }), item.labelText, !item.usable && /* @__PURE__ */ import_react.default.createElement(import_AlertTriangle.default, { className: "resource-option-alert-icon" }));
|
|
164
|
-
})
|
|
165
|
-
);
|
|
166
|
-
_list = _list.sort((a, b) => b.usable ? 1 : -1);
|
|
167
|
-
if (useResource && !_list.find((d) => d.form_record_id === useResource)) {
|
|
168
|
-
form.setFieldsValue({
|
|
169
|
-
resource: 0
|
|
150
|
+
try {
|
|
151
|
+
setResourceLoading(true);
|
|
152
|
+
let data = await state.apis.getResources({
|
|
153
|
+
skip: 1,
|
|
154
|
+
num: 1e3,
|
|
155
|
+
with_date_times: state.date.value.format("YYYY-MM-DD"),
|
|
156
|
+
codes: ["resources", "therapist", "table"],
|
|
157
|
+
_config: { abort: true }
|
|
170
158
|
});
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
resources: _list
|
|
159
|
+
let _list = [(0, import_mock.getNoResource)()].concat((data == null ? void 0 : data.list) || []);
|
|
160
|
+
const _cacheItem = cacheItem || getCurrentCacheItem();
|
|
161
|
+
if (!_cacheItem._extend) {
|
|
162
|
+
return;
|
|
176
163
|
}
|
|
177
|
-
|
|
164
|
+
_list = _list.map(
|
|
165
|
+
(d) => (0, import_utils3.formatResource)(d, _cacheItem, (item) => {
|
|
166
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "resource-option" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "like-wrap" }), item.labelText, !item.usable && /* @__PURE__ */ import_react.default.createElement(import_AlertTriangle.default, { className: "resource-option-alert-icon" }));
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
_list = _list.sort((a, b) => b.usable ? 1 : -1);
|
|
170
|
+
if (useResource && !_list.find((d) => d.form_record_id === useResource)) {
|
|
171
|
+
form.setFieldsValue({
|
|
172
|
+
resource: 0
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
dispatch({
|
|
176
|
+
type: "setService",
|
|
177
|
+
payload: {
|
|
178
|
+
resources: _list
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
} catch (err) {
|
|
182
|
+
}
|
|
178
183
|
setResourceLoading(false);
|
|
179
184
|
};
|
|
180
185
|
const handleDeleteProduct = () => {
|
|
@@ -224,8 +229,8 @@ var Info = () => {
|
|
|
224
229
|
};
|
|
225
230
|
const getDiscount = () => {
|
|
226
231
|
var _a2;
|
|
227
|
-
let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2.
|
|
228
|
-
let cPrice = Number(
|
|
232
|
+
let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
|
|
233
|
+
let cPrice = Number(useTotal || 0);
|
|
229
234
|
let discount = "";
|
|
230
235
|
if (cPrice === oPrice) {
|
|
231
236
|
discount = import_utils.locales.getText("pisell2.text.status.no-discount");
|
|
@@ -247,13 +252,16 @@ var Info = () => {
|
|
|
247
252
|
..._item._extend,
|
|
248
253
|
...values
|
|
249
254
|
};
|
|
250
|
-
const { startDate, endDate } = (0,
|
|
255
|
+
const { startDate, endDate } = (0, import_utils3.getServiceTimes)({ _extend });
|
|
251
256
|
_extend.startDate = startDate;
|
|
252
257
|
_extend.endDate = endDate;
|
|
253
258
|
const { relation_type, item_id, schedule_id } = ((_a2 = currentResource == null ? void 0 : currentResource._extend) == null ? void 0 : _a2.usableTime) || {};
|
|
254
259
|
_extend.relation_type = relation_type || "form";
|
|
255
260
|
_extend.relation_id = item_id || (currentResource == null ? void 0 : currentResource.form_record_id) || 0;
|
|
256
261
|
_extend.schedule_id = schedule_id || 0;
|
|
262
|
+
if (_extend.bundle_edit !== void 0) {
|
|
263
|
+
_extend.bundle_edit = 1;
|
|
264
|
+
}
|
|
257
265
|
_item._extend = _extend;
|
|
258
266
|
if ((_b2 = state.service.cacheItem) == null ? void 0 : _b2.new) {
|
|
259
267
|
_list.push(_item);
|
|
@@ -261,7 +269,7 @@ var Info = () => {
|
|
|
261
269
|
let _id = _item == null ? void 0 : _item._id;
|
|
262
270
|
_list = _list.map((d) => d._id === _id ? { ..._item, new: 0 } : d);
|
|
263
271
|
}
|
|
264
|
-
(0,
|
|
272
|
+
(0, import_utils3.deleteCacheParams)();
|
|
265
273
|
dispatch({
|
|
266
274
|
type: "setService",
|
|
267
275
|
payload: {
|
|
@@ -276,7 +284,7 @@ var Info = () => {
|
|
|
276
284
|
const setEditData = (0, import_ahooks.useMemoizedFn)(() => {
|
|
277
285
|
if (state.service.editModal) {
|
|
278
286
|
let cacheItem = state.service.cacheItem;
|
|
279
|
-
form.setFieldsValue((0,
|
|
287
|
+
form.setFieldsValue((0, import_utils3.getServerItemExtend)(state, cacheItem, timeObj));
|
|
280
288
|
if (state.renderType !== "eventBooking") {
|
|
281
289
|
getResources();
|
|
282
290
|
}
|
|
@@ -286,12 +294,12 @@ var Info = () => {
|
|
|
286
294
|
});
|
|
287
295
|
const isReason = (0, import_react.useMemo)(() => {
|
|
288
296
|
var _a2;
|
|
289
|
-
let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2.
|
|
290
|
-
let cPrice = Number(
|
|
297
|
+
let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
|
|
298
|
+
let cPrice = Number(useTotal || 0);
|
|
291
299
|
return cPrice !== oPrice;
|
|
292
|
-
}, [
|
|
300
|
+
}, [useTotal, state.service.cacheItem]);
|
|
293
301
|
const errorList = (0, import_react.useMemo)(() => {
|
|
294
|
-
return (0,
|
|
302
|
+
return (0, import_utils3.getErrorList)(currentResource, getCurrentCacheItem());
|
|
295
303
|
}, [currentResource, useDuration, useStartTime]);
|
|
296
304
|
(0, import_ahooks.useUpdateEffect)(() => {
|
|
297
305
|
if (useStartTime && useDuration && state.renderType !== "eventBooking") {
|
|
@@ -306,19 +314,23 @@ var Info = () => {
|
|
|
306
314
|
}, [useResource, useStartTime, useDuration]);
|
|
307
315
|
(0, import_react.useEffect)(() => {
|
|
308
316
|
getDiscount();
|
|
309
|
-
}, [
|
|
317
|
+
}, [useTotal, state.service.cacheItem]);
|
|
310
318
|
const isDiscount = (0, import_react.useMemo)(() => {
|
|
311
319
|
var _a2, _b2, _c2;
|
|
312
320
|
if (!((_a2 = state.service) == null ? void 0 : _a2.cacheItem)) {
|
|
313
321
|
return false;
|
|
314
322
|
}
|
|
315
|
-
return
|
|
316
|
-
}, [
|
|
323
|
+
return useTotal != ((_c2 = (_b2 = state.service) == null ? void 0 : _b2.cacheItem) == null ? void 0 : _c2._extend.origin_total);
|
|
324
|
+
}, [useTotal, (_e = (_d = state.service) == null ? void 0 : _d.cacheItem) == null ? void 0 : _e._extend.origin_total]);
|
|
317
325
|
(0, import_react.useEffect)(() => {
|
|
318
326
|
if (useResource === 0) {
|
|
319
327
|
handleLikeResource("common");
|
|
320
328
|
}
|
|
321
329
|
}, [useResource]);
|
|
330
|
+
const bundles = (0, import_react.useMemo)(() => {
|
|
331
|
+
var _a2, _b2, _c2, _d2;
|
|
332
|
+
return ((_d2 = (_c2 = (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._extend) == null ? void 0 : _c2.other) == null ? void 0 : _d2.bundle) || [];
|
|
333
|
+
}, [(_f = state.service) == null ? void 0 : _f.cacheItem]);
|
|
322
334
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
323
335
|
import_drawer.default,
|
|
324
336
|
{
|
|
@@ -336,10 +348,9 @@ var Info = () => {
|
|
|
336
348
|
}
|
|
337
349
|
},
|
|
338
350
|
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-body-edit" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { layout: "vertical", form, onFinish }, /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { style: { width: "100%" }, gutter: [16, 0] }, /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "product_name" }, /* @__PURE__ */ import_react.default.createElement(
|
|
339
|
-
|
|
351
|
+
"div",
|
|
340
352
|
{
|
|
341
|
-
|
|
342
|
-
open: false,
|
|
353
|
+
className: "current-service-info",
|
|
343
354
|
onClick: () => {
|
|
344
355
|
if (state.channelDisabledEdit) {
|
|
345
356
|
return;
|
|
@@ -352,12 +363,21 @@ var Info = () => {
|
|
|
352
363
|
}
|
|
353
364
|
});
|
|
354
365
|
}
|
|
355
|
-
}
|
|
366
|
+
},
|
|
367
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name" }, ((_i = (_h = (_g = state.service) == null ? void 0 : _g.cacheItem) == null ? void 0 : _h._extend) == null ? void 0 : _i.product_name) || "-"),
|
|
368
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
369
|
+
import_collapsibleList.default,
|
|
370
|
+
{
|
|
371
|
+
style: { marginTop: bundles.length ? "8px" : 0 },
|
|
372
|
+
list: bundles,
|
|
373
|
+
renderItem: (item) => (0, import_utils2.renderBundles)(item, state.amountSymbol)
|
|
374
|
+
}
|
|
375
|
+
)
|
|
356
376
|
))), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
|
|
357
377
|
import_antd.Form.Item,
|
|
358
378
|
{
|
|
359
379
|
label: import_utils.locales.getText("pisell2.text.price"),
|
|
360
|
-
name: "
|
|
380
|
+
name: "total",
|
|
361
381
|
rules: [{ required: true }]
|
|
362
382
|
},
|
|
363
383
|
/* @__PURE__ */ import_react.default.createElement(
|
|
@@ -369,8 +389,8 @@ var Info = () => {
|
|
|
369
389
|
precision: 2,
|
|
370
390
|
style: { width: "100%" },
|
|
371
391
|
min: 0,
|
|
372
|
-
max: ((
|
|
373
|
-
placeholder: ((
|
|
392
|
+
max: ((_k = (_j = state.service.cacheItem) == null ? void 0 : _j._extend) == null ? void 0 : _k.origin_total) || 0,
|
|
393
|
+
placeholder: ((_m = (_l = state.service.cacheItem) == null ? void 0 : _l._extend) == null ? void 0 : _m.origin_total) || "0"
|
|
374
394
|
}
|
|
375
395
|
)
|
|
376
396
|
)), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -388,7 +408,7 @@ var Info = () => {
|
|
|
388
408
|
allowClear: isDiscount,
|
|
389
409
|
onChange: (e) => {
|
|
390
410
|
form.setFieldsValue({
|
|
391
|
-
|
|
411
|
+
total: state.service.cacheItem._extend.origin_total
|
|
392
412
|
});
|
|
393
413
|
}
|
|
394
414
|
}
|
|
@@ -84,4 +84,25 @@
|
|
|
84
84
|
.like-resource {}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.current-service-info {
|
|
90
|
+
min-height: 40px;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
background-color: #ffffff;
|
|
93
|
+
border: 1px solid #D0D5DD;
|
|
94
|
+
border-radius: 10px;
|
|
95
|
+
transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
padding: 11px;
|
|
98
|
+
|
|
99
|
+
.current-service-info-name {
|
|
100
|
+
font-size: 16px;
|
|
101
|
+
color: #101828;
|
|
102
|
+
font-weight: 650;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&:hover {
|
|
106
|
+
border-color: #7f56d9;
|
|
107
|
+
}
|
|
87
108
|
}
|
|
@@ -33,122 +33,14 @@ __export(service_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(service_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_model = require("../model");
|
|
37
|
-
var import_utils = require("@pisell/utils");
|
|
38
36
|
var import_addService = __toESM(require("./addService"));
|
|
39
37
|
var import_editService = __toESM(require("./editService"));
|
|
40
|
-
var import_antd = require("antd");
|
|
41
38
|
var import_index = require("./index.less");
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var import_like = __toESM(require("./like"));
|
|
45
|
-
var Info = () => {
|
|
46
|
-
const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
|
|
47
|
-
const errorTypes = {
|
|
48
|
-
product: import_utils.locales.getText("pisell2.text.status.service-error-1"),
|
|
49
|
-
time: import_utils.locales.getText("pisell2.text.status.service-error-2"),
|
|
50
|
-
maxLimit: import_utils.locales.getText("pisell2.text.status.service-error-3")
|
|
51
|
-
};
|
|
52
|
-
const handleEditService = (item) => {
|
|
53
|
-
if (state.disabledEdit) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
dispatch({
|
|
57
|
-
type: "setService",
|
|
58
|
-
payload: {
|
|
59
|
-
editModal: true,
|
|
60
|
-
cacheItem: { ...item, new: 0 }
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
const getResourceItem = (0, import_react.useCallback)(
|
|
65
|
-
(id) => {
|
|
66
|
-
if (id === 0) {
|
|
67
|
-
return (0, import_mock.getNoResource)();
|
|
68
|
-
}
|
|
69
|
-
return state.service.resources.find((d) => d.form_record_id === id);
|
|
70
|
-
},
|
|
71
|
-
[state.service.resources]
|
|
72
|
-
);
|
|
73
|
-
const getErrorMessage = (0, import_react.useCallback)((service, resourceItem) => {
|
|
74
|
-
const errorList = (0, import_utils2.getErrorList)(resourceItem, service);
|
|
75
|
-
let errorMessage = "";
|
|
76
|
-
if (!service.id) {
|
|
77
|
-
return errorList[0].label;
|
|
78
|
-
}
|
|
79
|
-
if (errorList.length) {
|
|
80
|
-
if (errorList.length > 1) {
|
|
81
|
-
errorMessage = `${errorList.length} ${import_utils.locales.getText(
|
|
82
|
-
"pisell2.text.warnings"
|
|
83
|
-
)}`;
|
|
84
|
-
} else {
|
|
85
|
-
errorMessage = (resourceItem == null ? void 0 : resourceItem.labelText) + " " + errorTypes[errorList[0].type];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return errorMessage;
|
|
89
|
-
}, []);
|
|
90
|
-
const handleLike = (status, item) => {
|
|
91
|
-
if (state.disabledEdit) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
let _list = [...state.service.value];
|
|
95
|
-
let _id = item == null ? void 0 : item._id;
|
|
96
|
-
_list = _list.map(
|
|
97
|
-
(d) => d._id === _id ? {
|
|
98
|
-
...d,
|
|
99
|
-
_extend: {
|
|
100
|
-
...d._extend,
|
|
101
|
-
like_status: status
|
|
102
|
-
}
|
|
103
|
-
} : d
|
|
104
|
-
);
|
|
105
|
-
dispatch({
|
|
106
|
-
type: "setService",
|
|
107
|
-
payload: {
|
|
108
|
-
value: _list,
|
|
109
|
-
edit: true
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
};
|
|
39
|
+
var import_serviceList = __toESM(require("./serviceList"));
|
|
40
|
+
var Service = () => {
|
|
113
41
|
(0, import_react.useEffect)(() => {
|
|
114
42
|
document.body.id = "body";
|
|
115
43
|
}, []);
|
|
116
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-wrap" }, /* @__PURE__ */ import_react.default.createElement(
|
|
117
|
-
var _a, _b, _c, _d, _e;
|
|
118
|
-
const resourceItem = getResourceItem((_a = d._extend) == null ? void 0 : _a.resource);
|
|
119
|
-
let errorMessage = getErrorMessage(d, resourceItem);
|
|
120
|
-
let resourceName = (resourceItem == null ? void 0 : resourceItem.labelText) || d.relation_form_name;
|
|
121
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
122
|
-
"div",
|
|
123
|
-
{
|
|
124
|
-
key: d._id,
|
|
125
|
-
className: "pisell-lowcode__booking-service-item",
|
|
126
|
-
onClick: () => {
|
|
127
|
-
handleEditService(d);
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
d.id ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-title" }, d.title) : null,
|
|
131
|
-
d._extend ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, state.renderType !== "eventBooking" && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-date" }, (0, import_utils2.getServiceTime)(d, state.date.value)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-technician" }, d._extend.resource ? /* @__PURE__ */ import_react.default.createElement(
|
|
132
|
-
import_like.default,
|
|
133
|
-
{
|
|
134
|
-
style: { marginRight: 4 },
|
|
135
|
-
status: d._extend.like_status,
|
|
136
|
-
onChange: (e) => {
|
|
137
|
-
handleLike(e, d);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
) : null, resourceName)) : null,
|
|
141
|
-
d.id ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-price-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-price" }, (0, import_utils.formatAmount)((_b = d._extend) == null ? void 0 : _b.price, 2, state.amountSymbol)), Number((_c = d._extend) == null ? void 0 : _c.price) != Number(d.price) ? /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-original-price" }, (0, import_utils.formatAmount)(d.price, 2, state.amountSymbol)) : null), ((_d = d._extend) == null ? void 0 : _d.discount_reason) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-discount-reason" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.text.discount-reason"), ":"), " ", (_e = d._extend) == null ? void 0 : _e.discount_reason) : null) : null,
|
|
142
|
-
errorMessage ? /* @__PURE__ */ import_react.default.createElement(
|
|
143
|
-
import_antd.Alert,
|
|
144
|
-
{
|
|
145
|
-
message: errorMessage,
|
|
146
|
-
type: "warning",
|
|
147
|
-
showIcon: true,
|
|
148
|
-
className: "pisell-lowcode__booking-service-item-error"
|
|
149
|
-
}
|
|
150
|
-
) : null
|
|
151
|
-
);
|
|
152
|
-
})), /* @__PURE__ */ import_react.default.createElement(import_addService.default, null)), /* @__PURE__ */ import_react.default.createElement(import_editService.default, null));
|
|
44
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-wrap" }, /* @__PURE__ */ import_react.default.createElement(import_serviceList.default, null), /* @__PURE__ */ import_react.default.createElement(import_addService.default, null)), /* @__PURE__ */ import_react.default.createElement(import_editService.default, null));
|
|
153
45
|
};
|
|
154
|
-
var service_default =
|
|
46
|
+
var service_default = Service;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
.pisell-lowcode__booking-service-wrap {
|
|
2
|
-
margin-top: 16px;
|
|
3
|
-
}
|
|
4
|
-
.pisell-lowcode__booking-service-item {
|
|
5
|
-
width: 100%;
|
|
6
|
-
border-radius: 8px;
|
|
7
|
-
border: 1px solid #D5D7DA;
|
|
8
|
-
margin-bottom: 16px;
|
|
9
|
-
position: relative;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
padding: 16px 20px;
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
gap: 4px;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
background-color: #fff;
|
|
18
|
-
|
|
19
|
-
&:last-child {
|
|
20
|
-
margin-bottom: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&::before {
|
|
24
|
-
content: '';
|
|
25
|
-
position: absolute;
|
|
26
|
-
left: 0;
|
|
27
|
-
top: 0;
|
|
28
|
-
width: 6px;
|
|
29
|
-
height: 100%;
|
|
30
|
-
background: #80BCFE;
|
|
31
|
-
z-index: 2;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.pisell-lowcode__booking-service-item-title {
|
|
35
|
-
color: var(--gray-900, #101828);
|
|
36
|
-
|
|
37
|
-
font-size: 16px;
|
|
38
|
-
font-style: normal;
|
|
39
|
-
font-weight: 600;
|
|
40
|
-
line-height: 24px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.pisell-lowcode__booking-service-item-date {
|
|
44
|
-
color: var(--gray-500, #667085);
|
|
45
|
-
|
|
46
|
-
font-size: 14px;
|
|
47
|
-
font-style: normal;
|
|
48
|
-
font-weight: 400;
|
|
49
|
-
line-height: 20px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.pisell-lowcode__booking-service-item-technician {
|
|
53
|
-
color: var(--gray-500, #667085);
|
|
54
|
-
|
|
55
|
-
font-size: 14px;
|
|
56
|
-
font-style: normal;
|
|
57
|
-
font-weight: 400;
|
|
58
|
-
line-height: 20px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.pisell-lowcode__booking-service-item-price-wrap {
|
|
62
|
-
.pisell-lowcode__booking-service-item-price {
|
|
63
|
-
color: var(--gray-500, #667085);
|
|
64
|
-
|
|
65
|
-
font-size: 14px;
|
|
66
|
-
font-style: normal;
|
|
67
|
-
font-weight: 400;
|
|
68
|
-
line-height: 20px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.pisell-lowcode__booking-service-item-original-price {
|
|
72
|
-
color: var(--gray-500, #667085);
|
|
73
|
-
|
|
74
|
-
font-size: 14px;
|
|
75
|
-
font-style: normal;
|
|
76
|
-
font-weight: 400;
|
|
77
|
-
line-height: 20px;
|
|
78
|
-
margin-left: 8px;
|
|
79
|
-
text-decoration: line-through;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.pisell-lowcode__booking-service-item-discount-reason {
|
|
86
|
-
color: var(--gray-500, #667085);
|
|
87
|
-
|
|
88
|
-
font-size: 14px;
|
|
89
|
-
font-style: normal;
|
|
90
|
-
font-weight: 400;
|
|
91
|
-
line-height: 20px;
|
|
92
|
-
white-space: break-spaces;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.pisell-lowcode__booking-service-item-error {
|
|
96
|
-
border: none;
|
|
97
|
-
margin: 0 -20px -16px;
|
|
98
|
-
border-radius: 0 0 8px 8px;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/booking/info/service/serviceItem/index.tsx
|
|
30
|
+
var serviceItem_exports = {};
|
|
31
|
+
__export(serviceItem_exports, {
|
|
32
|
+
default: () => serviceItem_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(serviceItem_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_like = __toESM(require("../like"));
|
|
37
|
+
var import_utils = require("../../../utils");
|
|
38
|
+
var import_utils2 = require("@pisell/utils");
|
|
39
|
+
var import_collapsibleList = __toESM(require("../../../components/collapsibleList"));
|
|
40
|
+
var import_utils3 = require("../../../components/collapsibleList/utils");
|
|
41
|
+
var import_antd = require("antd");
|
|
42
|
+
var import_index = require("./index.less");
|
|
43
|
+
var ServiceItem = ({
|
|
44
|
+
d,
|
|
45
|
+
handleEditService,
|
|
46
|
+
state,
|
|
47
|
+
handleLike,
|
|
48
|
+
resourceItem,
|
|
49
|
+
errorMessage
|
|
50
|
+
}) => {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
52
|
+
let resourceName = (resourceItem == null ? void 0 : resourceItem.labelText) || d.relation_form_name;
|
|
53
|
+
const isDiscount = (0, import_react.useMemo)(() => {
|
|
54
|
+
var _a2, _b2;
|
|
55
|
+
return Number((_a2 = d._extend) == null ? void 0 : _a2.total) != Number((_b2 = d._extend) == null ? void 0 : _b2.origin_total);
|
|
56
|
+
}, [(_a = d._extend) == null ? void 0 : _a.total, (_b = d._extend) == null ? void 0 : _b.origin_total]);
|
|
57
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
key: d._id,
|
|
61
|
+
className: "pisell-lowcode__booking-service-item",
|
|
62
|
+
onClick: () => {
|
|
63
|
+
handleEditService(d);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
d.id ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-title" }, d.title) : null,
|
|
67
|
+
d._extend ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-date" }, (0, import_utils.getServiceTime)(d, state.date.value)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-technician" }, d._extend.resource ? /* @__PURE__ */ import_react.default.createElement(
|
|
68
|
+
import_like.default,
|
|
69
|
+
{
|
|
70
|
+
style: { marginRight: 4 },
|
|
71
|
+
status: d._extend.like_status,
|
|
72
|
+
onChange: (e) => {
|
|
73
|
+
handleLike(e, d);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
) : null, resourceName)) : null,
|
|
77
|
+
(((_d = (_c = d._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.bundle) || []).length ? /* @__PURE__ */ import_react.default.createElement(
|
|
78
|
+
import_collapsibleList.default,
|
|
79
|
+
{
|
|
80
|
+
border: true,
|
|
81
|
+
list: ((_f = (_e = d._extend) == null ? void 0 : _e.other) == null ? void 0 : _f.bundle) || [],
|
|
82
|
+
renderItem: (item) => (0, import_utils3.renderBundles)(item, state.amountSymbol)
|
|
83
|
+
}
|
|
84
|
+
) : null,
|
|
85
|
+
d.id ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-price-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-price" }, (0, import_utils2.formatAmount)((_g = d._extend) == null ? void 0 : _g.total, 2, state.amountSymbol)), isDiscount ? /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-original-price" }, (0, import_utils2.formatAmount)(d._extend.origin_total, 2, state.amountSymbol)) : null)) : null,
|
|
86
|
+
isDiscount && ((_h = d._extend) == null ? void 0 : _h.discount_reason) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-discount-reason" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils2.locales.getText("pisell2.text.discount-reason"), ":"), " ", (_i = d._extend) == null ? void 0 : _i.discount_reason) : null,
|
|
87
|
+
errorMessage ? /* @__PURE__ */ import_react.default.createElement(
|
|
88
|
+
import_antd.Alert,
|
|
89
|
+
{
|
|
90
|
+
message: errorMessage,
|
|
91
|
+
type: "warning",
|
|
92
|
+
showIcon: true,
|
|
93
|
+
className: "pisell-lowcode__booking-service-item-error"
|
|
94
|
+
}
|
|
95
|
+
) : null
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
var serviceItem_default = ServiceItem;
|