@pisell/private-materials 3.0.74 → 3.0.76
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/preview.js +4 -4
- 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 +6 -6
- package/es/components/booking/components/drawer/index.d.ts +1 -0
- package/es/components/booking/components/drawer/index.js +5 -0
- package/es/components/booking/components/drawer/index.less +10 -3
- package/es/components/booking/info/service/actions/index.js +1 -1
- package/es/components/booking/info/service/addService/index.js +2 -2
- package/es/components/booking/info/service/addTimeModal/index.js +168 -129
- package/es/components/booking/info/service/addTimeModal/index.less +15 -10
- package/es/components/booking/info/service/addTimeModal/utils.d.ts +31 -12
- package/es/components/booking/info/service/addTimeModal/utils.js +108 -30
- package/es/components/booking/locales.d.ts +3 -0
- package/es/components/booking/locales.js +5 -2
- package/lib/components/booking/components/drawer/index.d.ts +1 -0
- package/lib/components/booking/components/drawer/index.js +4 -0
- package/lib/components/booking/components/drawer/index.less +10 -3
- package/lib/components/booking/info/service/actions/index.js +1 -1
- package/lib/components/booking/info/service/addService/index.js +13 -1
- package/lib/components/booking/info/service/addTimeModal/index.js +96 -109
- package/lib/components/booking/info/service/addTimeModal/index.less +15 -10
- package/lib/components/booking/info/service/addTimeModal/utils.d.ts +31 -12
- package/lib/components/booking/info/service/addTimeModal/utils.js +64 -38
- package/lib/components/booking/locales.d.ts +3 -0
- package/lib/components/booking/locales.js +5 -2
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import dayjs from "dayjs";
|
|
8
|
-
import { getDiscountTime } from "../../../utils";
|
|
8
|
+
import { getDiscountTime, getEndDate } from "../../../utils";
|
|
9
9
|
import { locales } from '@pisell/utils';
|
|
10
10
|
import { intersectionBy } from 'lodash';
|
|
11
11
|
var getIsAddH = function getIsAddH(pre, current) {
|
|
@@ -19,59 +19,121 @@ var getIsAddH = function getIsAddH(pre, current) {
|
|
|
19
19
|
}
|
|
20
20
|
return getDiscountTime(currentH * 60);
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @title: 根据商品生成加时列表
|
|
25
|
+
* @description:
|
|
26
|
+
* @param {any} config
|
|
27
|
+
* @param {number} price
|
|
28
|
+
* @return {*}
|
|
29
|
+
* @Author: zhiwei.Wang
|
|
30
|
+
* @Date: 2024-07-01 09:34
|
|
31
|
+
*/
|
|
32
|
+
export var getAddTimeSplits = function getAddTimeSplits(product, cacheItem, currentResourceTimeEndDate) {
|
|
33
|
+
var _product$add_time = product.add_time,
|
|
34
|
+
add_time = _product$add_time === void 0 ? {
|
|
35
|
+
calculate_type: "select_quantity",
|
|
36
|
+
// 最大时长
|
|
37
|
+
max_add_time: 30,
|
|
38
|
+
// 最小时长
|
|
39
|
+
min_add_time: 30,
|
|
40
|
+
// 关联产品
|
|
41
|
+
relation_product: {
|
|
42
|
+
type: "product_all",
|
|
43
|
+
products: []
|
|
44
|
+
},
|
|
45
|
+
// 单位切片
|
|
46
|
+
unit_duration: 30
|
|
47
|
+
} : _product$add_time,
|
|
48
|
+
_product$price = product.price,
|
|
49
|
+
price = _product$price === void 0 ? 0 : _product$price;
|
|
50
|
+
|
|
51
|
+
// 灵活时长
|
|
52
|
+
if (add_time.additional_time_options === 'unlimited') {
|
|
53
|
+
// 1. 当前服务的时长和结束时间
|
|
54
|
+
// 2. 当前资源的结束时间
|
|
55
|
+
// 3. 当前店铺的结束时间
|
|
56
|
+
var maxEndDate = getEndDate(cacheItem._extend.startDate, 'flexible', currentResourceTimeEndDate);
|
|
57
|
+
var _value = maxEndDate.diff(cacheItem._extend.endDate, 'minute');
|
|
58
|
+
// 店铺营业时间大于当前服务的结束时间, 则取店铺营业时间, 否则就不可选
|
|
59
|
+
if (_value > 0) {
|
|
60
|
+
return [{
|
|
61
|
+
label: locales.getText('page.booking.text.unlimited'),
|
|
62
|
+
value: _value,
|
|
63
|
+
price: price
|
|
64
|
+
}];
|
|
65
|
+
} else {
|
|
66
|
+
// 如果当前服务已经选择到了最大时间, 则不可选
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 开始时间
|
|
23
72
|
var startTime = dayjs().startOf("day");
|
|
24
|
-
|
|
25
|
-
|
|
73
|
+
|
|
74
|
+
// 最大加时时间
|
|
75
|
+
var endTime = startTime.add(add_time.max_add_time, "minute");
|
|
76
|
+
var timeSlice = (add_time === null || add_time === void 0 ? void 0 : add_time.unit_duration) || 5; // 切片时间间隔(分钟)
|
|
26
77
|
|
|
27
78
|
var arr = [];
|
|
28
79
|
var currentTime = startTime;
|
|
29
80
|
var lastDuration = 0;
|
|
30
81
|
while (currentTime.isBefore(endTime)) {
|
|
31
82
|
var nextTime = currentTime;
|
|
83
|
+
|
|
84
|
+
// 从最小加时时间开始计算
|
|
32
85
|
if (lastDuration === 0) {
|
|
33
|
-
nextTime = nextTime.add(
|
|
86
|
+
nextTime = nextTime.add(add_time.min_add_time, "minute");
|
|
34
87
|
} else {
|
|
35
88
|
nextTime = currentTime.add(timeSlice, "minute");
|
|
36
89
|
}
|
|
90
|
+
|
|
91
|
+
// 根据切片生成新的时间
|
|
37
92
|
var durationValue = nextTime.diff(startTime, "minute");
|
|
38
93
|
|
|
39
|
-
//
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
arr.push({
|
|
44
|
-
label: isAddH,
|
|
45
|
-
value: 0,
|
|
46
|
-
readonly: true
|
|
47
|
-
});
|
|
48
|
-
}
|
|
94
|
+
// 根据时间 生成label
|
|
95
|
+
var durationLabel = "".concat(durationValue, " ").concat(locales.getText('pisell2.text.min'));
|
|
96
|
+
|
|
97
|
+
// 大于60分钟的格式化成小时
|
|
49
98
|
if (durationValue >= 60) {
|
|
50
|
-
|
|
51
|
-
arr.push({
|
|
52
|
-
label: durationLabel,
|
|
53
|
-
value: durationValue,
|
|
54
|
-
price: durationValue / timeSlice * price
|
|
55
|
-
});
|
|
56
|
-
} else {
|
|
57
|
-
var _durationLabel = "".concat(durationValue, " ").concat(locales.getText('pisell2.text.min'));
|
|
58
|
-
arr.push({
|
|
59
|
-
label: _durationLabel,
|
|
60
|
-
value: durationValue,
|
|
61
|
-
price: durationValue / timeSlice * price
|
|
62
|
-
});
|
|
99
|
+
durationLabel = getDiscountTime(durationValue);
|
|
63
100
|
}
|
|
101
|
+
arr.push({
|
|
102
|
+
label: durationLabel,
|
|
103
|
+
value: durationValue,
|
|
104
|
+
price: durationValue / timeSlice * price
|
|
105
|
+
});
|
|
64
106
|
lastDuration = durationValue;
|
|
65
107
|
currentTime = nextTime;
|
|
66
108
|
}
|
|
67
109
|
return arr;
|
|
68
110
|
};
|
|
69
|
-
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @title: 判断当前商品是否可用
|
|
114
|
+
* @description:
|
|
115
|
+
* @param {any} relationProduct
|
|
116
|
+
* @param {any} currentItem
|
|
117
|
+
* @return {*}
|
|
118
|
+
* @Author: zhiwei.Wang
|
|
119
|
+
* @Date: 2024-07-01 09:33
|
|
120
|
+
*/
|
|
121
|
+
export var isUsableProduct = function isUsableProduct(addTime, currentItem) {
|
|
122
|
+
var _addTime$relation_pro;
|
|
70
123
|
// 商品类型
|
|
71
|
-
var type =
|
|
124
|
+
var type = (_addTime$relation_pro = addTime.relation_product) === null || _addTime$relation_pro === void 0 ? void 0 : _addTime$relation_pro.type;
|
|
125
|
+
var relationProduct = addTime.relation_product || [];
|
|
72
126
|
if (!currentItem) {
|
|
73
127
|
return false;
|
|
74
128
|
}
|
|
129
|
+
if (addTime.additional_time_options === 'unlimited') {
|
|
130
|
+
var maxEndDate = getEndDate(currentItem._extend.startDate, 'flexible', '');
|
|
131
|
+
// 当前服务的结束时间大于店铺的营业时间, 过滤
|
|
132
|
+
if (currentItem._extend.endDate.isAfter(maxEndDate)) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
75
137
|
// 全部商品
|
|
76
138
|
if (type === "product_all") {
|
|
77
139
|
return true;
|
|
@@ -93,4 +155,20 @@ export var isUsableProduct = function isUsableProduct(relationProduct, currentIt
|
|
|
93
155
|
});
|
|
94
156
|
}
|
|
95
157
|
}
|
|
158
|
+
};
|
|
159
|
+
export var addTimeRowKey = {
|
|
160
|
+
// 创建, 增加前缀
|
|
161
|
+
create: function create(product_id, time) {
|
|
162
|
+
return "".concat(product_id, "_").concat(time);
|
|
163
|
+
},
|
|
164
|
+
// 格式化, 去除前缀
|
|
165
|
+
getValue: function getValue(str) {
|
|
166
|
+
var arr = str.split("_");
|
|
167
|
+
var id = arr[0] || 0;
|
|
168
|
+
var time = arr[1] || 0;
|
|
169
|
+
return {
|
|
170
|
+
product_id: Number(id),
|
|
171
|
+
time: time === 'flexible' ? time : Number(arr[1] || 0)
|
|
172
|
+
};
|
|
173
|
+
}
|
|
96
174
|
};
|
|
@@ -154,6 +154,7 @@ declare const _default: {
|
|
|
154
154
|
'page.booking.text.unavailable': string;
|
|
155
155
|
'page.booking.text.available': string;
|
|
156
156
|
'page.booking.text.fully-booked': string;
|
|
157
|
+
'page.booking.text.unlimited': string;
|
|
157
158
|
'pisell2.text.terminal-edit-message': string;
|
|
158
159
|
};
|
|
159
160
|
'zh-CN': {
|
|
@@ -312,6 +313,7 @@ declare const _default: {
|
|
|
312
313
|
'page.booking.text.unavailable': string;
|
|
313
314
|
'page.booking.text.available': string;
|
|
314
315
|
'page.booking.text.fully-booked': string;
|
|
316
|
+
'page.booking.text.unlimited': string;
|
|
315
317
|
};
|
|
316
318
|
'zh-HK': {
|
|
317
319
|
'pisell2.text.refunded-amount': string;
|
|
@@ -469,6 +471,7 @@ declare const _default: {
|
|
|
469
471
|
'page.booking.text.unavailable': string;
|
|
470
472
|
'page.booking.text.available': string;
|
|
471
473
|
'page.booking.text.fully-booked': string;
|
|
474
|
+
'page.booking.text.unlimited': string;
|
|
472
475
|
};
|
|
473
476
|
};
|
|
474
477
|
export default _default;
|
|
@@ -169,6 +169,7 @@ export default {
|
|
|
169
169
|
'page.booking.text.unavailable': 'Unavailable',
|
|
170
170
|
'page.booking.text.available': 'Available',
|
|
171
171
|
'page.booking.text.fully-booked': 'Fully booked',
|
|
172
|
+
'page.booking.text.unlimited': 'Unlimited',
|
|
172
173
|
'pisell2.text.terminal-edit-message': "This operation cannot be performed. To proceed, please use the Pisell Terminal."
|
|
173
174
|
},
|
|
174
175
|
'zh-CN': {
|
|
@@ -346,7 +347,8 @@ export default {
|
|
|
346
347
|
'page.booking.text.add-time-success': '加时成功',
|
|
347
348
|
'page.booking.text.unavailable': '不可用',
|
|
348
349
|
'page.booking.text.available': '可用',
|
|
349
|
-
'page.booking.text.fully-booked': '已约满'
|
|
350
|
+
'page.booking.text.fully-booked': '已约满',
|
|
351
|
+
'page.booking.text.unlimited': '无限制'
|
|
350
352
|
},
|
|
351
353
|
'zh-HK': {
|
|
352
354
|
'pisell2.text.refunded-amount': '已退金額',
|
|
@@ -523,6 +525,7 @@ export default {
|
|
|
523
525
|
'page.booking.text.add-time-success': '加時成功!',
|
|
524
526
|
'page.booking.text.unavailable': '不可用',
|
|
525
527
|
'page.booking.text.available': '可用',
|
|
526
|
-
'page.booking.text.fully-booked': '已約滿'
|
|
528
|
+
'page.booking.text.fully-booked': '已約滿',
|
|
529
|
+
'page.booking.text.unlimited': '無限制'
|
|
527
530
|
}
|
|
528
531
|
};
|
|
@@ -38,6 +38,7 @@ var import_ArrowLeft = __toESM(require("@pisell/icon/es/ArrowLeft"));
|
|
|
38
38
|
var import_index = require("./index.less");
|
|
39
39
|
var import_classnames = __toESM(require("classnames"));
|
|
40
40
|
var Drawer = (props) => {
|
|
41
|
+
const { hideScrollBar = true } = props;
|
|
41
42
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
42
43
|
import_antd.Drawer,
|
|
43
44
|
{
|
|
@@ -45,6 +46,9 @@ var Drawer = (props) => {
|
|
|
45
46
|
closable: false,
|
|
46
47
|
zIndex: 999,
|
|
47
48
|
...props,
|
|
49
|
+
className: (0, import_classnames.default)("pisell-lowcode__booking-drawer", props.className, {
|
|
50
|
+
"pisell-lowcode__booking-drawer-hide-scrollbar": hideScrollBar
|
|
51
|
+
}),
|
|
48
52
|
title: false,
|
|
49
53
|
bodyStyle: { padding: 0 },
|
|
50
54
|
push: false,
|
|
@@ -28,12 +28,19 @@
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
|
|
32
|
+
.pisell-lowcode__booking-drawer-hide-scrollbar {
|
|
33
|
+
&.pisell-lowcode-drawer-body {
|
|
34
|
+
|
|
35
|
+
&::-webkit-scrollbar {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|
|
42
|
+
|
|
43
|
+
|
|
37
44
|
.pisell-lowcode__booking-drawer-title-no-wrap {
|
|
38
45
|
display: inline;
|
|
39
46
|
}
|
|
@@ -59,7 +59,7 @@ var Actions = ({ currentService }) => {
|
|
|
59
59
|
};
|
|
60
60
|
const addTimeProducts = (0, import_react.useMemo)(() => {
|
|
61
61
|
return (state.addTimeProducts || []).some(
|
|
62
|
-
(item) => (0, import_utils2.isUsableProduct)(item.add_time
|
|
62
|
+
(item) => (0, import_utils2.isUsableProduct)(item.add_time, currentService)
|
|
63
63
|
);
|
|
64
64
|
}, [state.addTimeProducts, currentService]);
|
|
65
65
|
const showAddTimeButton = (0, import_react.useMemo)(() => {
|
|
@@ -47,7 +47,19 @@ 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 shopList = [
|
|
50
|
+
var shopList = [
|
|
51
|
+
2886,
|
|
52
|
+
4422,
|
|
53
|
+
5538,
|
|
54
|
+
6930,
|
|
55
|
+
6814,
|
|
56
|
+
6813,
|
|
57
|
+
6812,
|
|
58
|
+
6087,
|
|
59
|
+
6303,
|
|
60
|
+
6080,
|
|
61
|
+
6978
|
|
62
|
+
];
|
|
51
63
|
var Info = () => {
|
|
52
64
|
var _a, _b, _c, _d;
|
|
53
65
|
const [search, setSearch] = (0, import_react.useState)("");
|
|
@@ -43,6 +43,7 @@ var import_footer = __toESM(require("../../../components/footer"));
|
|
|
43
43
|
var import_serve = require("./serve");
|
|
44
44
|
var import_utils2 = require("./utils");
|
|
45
45
|
var import_classnames = __toESM(require("classnames"));
|
|
46
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
46
47
|
var import_browserSelect = __toESM(require("../../../components/browserSelect"));
|
|
47
48
|
var import_utils3 = require("../../../utils");
|
|
48
49
|
var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
|
|
@@ -58,13 +59,12 @@ var AddTimeModal = () => {
|
|
|
58
59
|
const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
|
|
59
60
|
const [isEdit, setIsEdit] = (0, import_react.useState)(false);
|
|
60
61
|
const [loading, setLoading] = (0, import_react.useState)("");
|
|
61
|
-
const [
|
|
62
|
-
const [currentTime, setCurrentTime] = (0, import_react.useState)(null);
|
|
62
|
+
const [recordKey, setRecordKey] = (0, import_react.useState)("");
|
|
63
63
|
const [number, setNumber] = (0, import_react.useState)(1);
|
|
64
64
|
const originServices = (0, import_react.useRef)([]);
|
|
65
65
|
const [renderList, setRenderList] = (0, import_react.useState)([]);
|
|
66
66
|
const context = (0, import_useEngineContext.default)();
|
|
67
|
-
const {
|
|
67
|
+
const { interaction } = (_a = context.appHelper) == null ? void 0 : _a.utils;
|
|
68
68
|
const statusMap = {
|
|
69
69
|
available: {
|
|
70
70
|
label: import_utils.locales.getText("page.booking.text.available"),
|
|
@@ -92,17 +92,22 @@ var AddTimeModal = () => {
|
|
|
92
92
|
button_rows: 1
|
|
93
93
|
};
|
|
94
94
|
}, [(_c = (_b = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _b.config) == null ? void 0 : _c.information_tab]);
|
|
95
|
-
const
|
|
96
|
-
return (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}, [renderList, state.service.cacheItem]);
|
|
95
|
+
const currentProductId = (0, import_react.useMemo)(() => {
|
|
96
|
+
return import_utils2.addTimeRowKey.getValue(recordKey).product_id;
|
|
97
|
+
}, [recordKey]);
|
|
98
|
+
const currentTime = (0, import_react.useMemo)(() => {
|
|
99
|
+
let _time = import_utils2.addTimeRowKey.getValue(recordKey).time || "";
|
|
100
|
+
return _time;
|
|
101
|
+
}, [recordKey]);
|
|
103
102
|
const currentProduct = (0, import_react.useMemo)(() => {
|
|
104
|
-
return (renderList || []).find((d) => d.id
|
|
103
|
+
return (renderList || []).find((d) => d.id == currentProductId);
|
|
105
104
|
}, [renderList, currentProductId]);
|
|
105
|
+
const currentTimeItem = (0, import_react.useMemo)(() => {
|
|
106
|
+
var _a2;
|
|
107
|
+
return ((_a2 = currentProduct == null ? void 0 : currentProduct.times) == null ? void 0 : _a2.find((d) => d.value == currentTime)) || {
|
|
108
|
+
price: 0
|
|
109
|
+
};
|
|
110
|
+
}, [currentTime, currentProduct]);
|
|
106
111
|
const currentResource = (0, import_react.useMemo)(() => {
|
|
107
112
|
var _a2;
|
|
108
113
|
const list = ((_a2 = state.service) == null ? void 0 : _a2.resourcesOrigin) || [];
|
|
@@ -114,6 +119,24 @@ var AddTimeModal = () => {
|
|
|
114
119
|
);
|
|
115
120
|
return item;
|
|
116
121
|
}, [state.service.cacheItem, state.service.resourcesOrigin]);
|
|
122
|
+
const currentResourceTimeEndDate = (0, import_react.useMemo)(() => {
|
|
123
|
+
var _a2;
|
|
124
|
+
try {
|
|
125
|
+
if (!currentResource || !((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend)) {
|
|
126
|
+
return "";
|
|
127
|
+
}
|
|
128
|
+
let timeItem = currentResource == null ? void 0 : currentResource.times.find(
|
|
129
|
+
(_time) => _time.item_id === state.service.cacheItem._extend.relation_id
|
|
130
|
+
);
|
|
131
|
+
const timeEndDate = (0, import_dayjs.default)(
|
|
132
|
+
timeItem.end_date + " " + timeItem.end_time
|
|
133
|
+
).add(1, "second");
|
|
134
|
+
return timeEndDate;
|
|
135
|
+
} catch (err) {
|
|
136
|
+
console.log("err", err);
|
|
137
|
+
}
|
|
138
|
+
return "";
|
|
139
|
+
}, [state.service.cacheItem, currentResource]);
|
|
117
140
|
const getTimeUsableStatus = (time) => {
|
|
118
141
|
var _a2, _b2;
|
|
119
142
|
if (!((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend) || !currentResource) {
|
|
@@ -147,53 +170,15 @@ var AddTimeModal = () => {
|
|
|
147
170
|
});
|
|
148
171
|
if (!((_b2 = res._extend) == null ? void 0 : _b2.isUsable)) {
|
|
149
172
|
return {
|
|
173
|
+
// maxEndTime:
|
|
150
174
|
status: statusMap.unavailable,
|
|
151
|
-
message: import_utils.locales.getText("
|
|
152
|
-
currentResource.room_name || currentResource.name,
|
|
153
|
-
startText,
|
|
154
|
-
endText
|
|
155
|
-
)
|
|
175
|
+
message: `${currentResource.room_name || currentResource.name} ${import_utils.locales.getText("pisell2.text.status.service-error-2")}`
|
|
156
176
|
};
|
|
157
177
|
}
|
|
158
178
|
} catch (err) {
|
|
159
179
|
}
|
|
160
180
|
return { status: statusMap.available };
|
|
161
181
|
};
|
|
162
|
-
const times = (0, import_react.useMemo)(() => {
|
|
163
|
-
let config = (currentProduct == null ? void 0 : currentProduct.add_time) || {
|
|
164
|
-
calculate_type: "select_quantity",
|
|
165
|
-
// 最大时长
|
|
166
|
-
max_add_time: 30,
|
|
167
|
-
// 最小时长
|
|
168
|
-
min_add_time: 30,
|
|
169
|
-
// 关联产品
|
|
170
|
-
relation_product: { type: "product_all", products: [] },
|
|
171
|
-
// 单位切片
|
|
172
|
-
unit_duration: 30
|
|
173
|
-
};
|
|
174
|
-
return (0, import_utils2.getAddTimeSplits)(config, (currentProduct == null ? void 0 : currentProduct.price) || 0).map((d) => {
|
|
175
|
-
return {
|
|
176
|
-
...d,
|
|
177
|
-
status: getTimeUsableStatus(d.value)
|
|
178
|
-
};
|
|
179
|
-
});
|
|
180
|
-
}, [currentProduct]);
|
|
181
|
-
(0, import_react.useEffect)(() => {
|
|
182
|
-
if (state.service.addTimeModal && state.service.cacheItem && currentProduct && times.length) {
|
|
183
|
-
if (!currentTime) {
|
|
184
|
-
setCurrentTime(times[0].value);
|
|
185
|
-
setNumber(1);
|
|
186
|
-
setIsEdit(true);
|
|
187
|
-
updateServices.run();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}, [
|
|
191
|
-
times,
|
|
192
|
-
currentTime,
|
|
193
|
-
state.service.addTimeModal,
|
|
194
|
-
state.service.cacheItem,
|
|
195
|
-
currentProduct
|
|
196
|
-
]);
|
|
197
182
|
const _getAddTimeProducts = async () => {
|
|
198
183
|
var _a2, _b2, _c2, _d2;
|
|
199
184
|
const data = await (0, import_serve.getAddTimeProducts)(
|
|
@@ -215,23 +200,37 @@ var AddTimeModal = () => {
|
|
|
215
200
|
setLoading("list");
|
|
216
201
|
const newList = await _getAddTimeProducts();
|
|
217
202
|
let list = newList.map((d) => {
|
|
218
|
-
let isUsable = (0, import_utils2.isUsableProduct)(
|
|
219
|
-
d.add_time.relation_product,
|
|
220
|
-
state.service.cacheItem
|
|
221
|
-
);
|
|
203
|
+
let isUsable = (0, import_utils2.isUsableProduct)(d.add_time, state.service.cacheItem);
|
|
222
204
|
return {
|
|
223
205
|
...d,
|
|
224
|
-
usable: isUsable
|
|
206
|
+
usable: isUsable,
|
|
207
|
+
// 可用的商品生成加时列表
|
|
208
|
+
times: isUsable ? (0, import_utils2.getAddTimeSplits)(
|
|
209
|
+
d,
|
|
210
|
+
state.service.cacheItem,
|
|
211
|
+
currentResourceTimeEndDate
|
|
212
|
+
).map((time) => {
|
|
213
|
+
return {
|
|
214
|
+
...time,
|
|
215
|
+
status: getTimeUsableStatus(time.value)
|
|
216
|
+
};
|
|
217
|
+
}) : void 0
|
|
225
218
|
};
|
|
226
|
-
}).filter((d) => d.usable).sort((a, b) => b.sort - a.sort);
|
|
219
|
+
}).filter((d) => d.usable && d.times.length).sort((a, b) => b.sort - a.sort);
|
|
227
220
|
setRenderList(list);
|
|
228
221
|
if (list.length) {
|
|
229
222
|
setDefaultProduct(list);
|
|
230
223
|
}
|
|
231
224
|
setLoading("");
|
|
225
|
+
setIsEdit(true);
|
|
232
226
|
};
|
|
233
227
|
const setDefaultProduct = (list) => {
|
|
234
|
-
|
|
228
|
+
try {
|
|
229
|
+
let productId = list[0].id;
|
|
230
|
+
let time = list[0].times[0].value;
|
|
231
|
+
setRecordKey(import_utils2.addTimeRowKey.create(productId, time));
|
|
232
|
+
} catch (err) {
|
|
233
|
+
}
|
|
235
234
|
};
|
|
236
235
|
(0, import_ahooks.useUpdateEffect)(() => {
|
|
237
236
|
if (state.service.addTimeModal) {
|
|
@@ -241,16 +240,13 @@ var AddTimeModal = () => {
|
|
|
241
240
|
updateServices.run();
|
|
242
241
|
}
|
|
243
242
|
}, [state.service.addTimeModal]);
|
|
244
|
-
const onSelectItem = (item) => {
|
|
245
|
-
|
|
243
|
+
const onSelectItem = (pItem, item) => {
|
|
244
|
+
setRecordKey(import_utils2.addTimeRowKey.create(pItem.id, item.value));
|
|
246
245
|
setIsEdit(true);
|
|
247
246
|
updateServices.run();
|
|
248
247
|
};
|
|
249
|
-
const currentTimeItem = (0, import_react.useMemo)(() => {
|
|
250
|
-
return times.find((d) => d.value === currentTime) || { price: 0 };
|
|
251
|
-
}, [currentTime, times]);
|
|
252
248
|
const newService = (0, import_react.useMemo)(() => {
|
|
253
|
-
if (!currentProduct || !
|
|
249
|
+
if (!currentProduct || !state.service.cacheItem) {
|
|
254
250
|
return null;
|
|
255
251
|
}
|
|
256
252
|
const relation_product = {
|
|
@@ -406,10 +402,6 @@ var AddTimeModal = () => {
|
|
|
406
402
|
}
|
|
407
403
|
state == null ? void 0 : state.action("init");
|
|
408
404
|
};
|
|
409
|
-
const productChange = (e) => {
|
|
410
|
-
setCurrentProductId(e);
|
|
411
|
-
setCurrentTime(null);
|
|
412
|
-
};
|
|
413
405
|
(0, import_react.useEffect)(() => {
|
|
414
406
|
if (!state.modalOpen) {
|
|
415
407
|
onCancel();
|
|
@@ -417,8 +409,7 @@ var AddTimeModal = () => {
|
|
|
417
409
|
}, [state.modalOpen]);
|
|
418
410
|
const onCancel = () => {
|
|
419
411
|
setIsEdit(false);
|
|
420
|
-
|
|
421
|
-
setCurrentTime(null);
|
|
412
|
+
setRecordKey("");
|
|
422
413
|
resetService();
|
|
423
414
|
setTimeout(() => {
|
|
424
415
|
dispatch({
|
|
@@ -429,7 +420,6 @@ var AddTimeModal = () => {
|
|
|
429
420
|
});
|
|
430
421
|
}, 50);
|
|
431
422
|
};
|
|
432
|
-
console.log("newService.duration", currentTimeItem);
|
|
433
423
|
const updateTime = (0, import_react.useMemo)(() => {
|
|
434
424
|
if (!newService) {
|
|
435
425
|
return "";
|
|
@@ -460,18 +450,9 @@ var AddTimeModal = () => {
|
|
|
460
450
|
title: import_utils.locales.getText("page.booking.text.add-time"),
|
|
461
451
|
rootClassName: "booking-server-wrap",
|
|
462
452
|
onClose: onCancel,
|
|
463
|
-
header: addTimeProducts.length > 1 && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-header" }, /* @__PURE__ */ import_react.default.createElement(
|
|
464
|
-
import_antd.Select,
|
|
465
|
-
{
|
|
466
|
-
options: addTimeProducts,
|
|
467
|
-
style: { width: "100%" },
|
|
468
|
-
size: "large",
|
|
469
|
-
loading: loading === "list",
|
|
470
|
-
value: currentProductId,
|
|
471
|
-
onChange: productChange
|
|
472
|
-
}
|
|
473
|
-
)),
|
|
474
453
|
footerStyle: { padding: "10px 32px 20px" },
|
|
454
|
+
hideScrollBar: false,
|
|
455
|
+
bodyStyle: { position: "relative" },
|
|
475
456
|
footer: /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-total-wrap" }, currentTimeItem && ((_d = currentTimeItem == null ? void 0 : currentTimeItem.status) == null ? void 0 : _d.message) ? /* @__PURE__ */ import_react.default.createElement(
|
|
476
457
|
import_antd.Alert,
|
|
477
458
|
{
|
|
@@ -530,36 +511,42 @@ var AddTimeModal = () => {
|
|
|
530
511
|
}
|
|
531
512
|
))
|
|
532
513
|
},
|
|
533
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-body" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: loading === "list", active: true, round: true }, /* @__PURE__ */ import_react.default.createElement("div", { className: "
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
537
|
-
}
|
|
538
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
539
|
-
"div",
|
|
540
|
-
{
|
|
541
|
-
className: (0, import_classnames.default)(
|
|
542
|
-
"pisell-lowcode__booking-add-time-child-card",
|
|
543
|
-
{
|
|
544
|
-
"pisell-lowcode__booking-add-time-child-card-active": currentTime === child.value
|
|
545
|
-
}
|
|
546
|
-
),
|
|
547
|
-
onClick: () => {
|
|
548
|
-
onSelectItem(child);
|
|
549
|
-
}
|
|
550
|
-
},
|
|
551
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left-time" }, child.label), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left-price" }, (0, import_utils.formatAmount)(child.price, 2, state.amountSymbol))),
|
|
552
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
514
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-body" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: loading === "list", active: true, round: true }, /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, renderList.map((d) => {
|
|
515
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-hours" }, d.title), d.times ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-list" }, d.times.map((child) => {
|
|
516
|
+
var _a2, _b2, _c2, _d2;
|
|
517
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
553
518
|
"div",
|
|
554
519
|
{
|
|
555
|
-
className:
|
|
556
|
-
|
|
557
|
-
|
|
520
|
+
className: (0, import_classnames.default)(
|
|
521
|
+
"pisell-lowcode__booking-add-time-child-card",
|
|
522
|
+
{
|
|
523
|
+
"pisell-lowcode__booking-add-time-child-card-active": recordKey === import_utils2.addTimeRowKey.create(d.id, child.value)
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
onClick: () => {
|
|
527
|
+
if (!child.value) {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
onSelectItem(d, child);
|
|
558
531
|
}
|
|
559
532
|
},
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
533
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left-time" }, child.label), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left-price" }, (0, import_utils.formatAmount)(
|
|
534
|
+
child.price,
|
|
535
|
+
2,
|
|
536
|
+
state.amountSymbol
|
|
537
|
+
))),
|
|
538
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
539
|
+
"div",
|
|
540
|
+
{
|
|
541
|
+
className: "pisell-lowcode__booking-add-time-child-card-right",
|
|
542
|
+
style: {
|
|
543
|
+
color: (_b2 = (_a2 = child.status) == null ? void 0 : _a2.status) == null ? void 0 : _b2.color
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
(_d2 = (_c2 = child.status) == null ? void 0 : _c2.status) == null ? void 0 : _d2.label
|
|
547
|
+
)
|
|
548
|
+
);
|
|
549
|
+
})) : null);
|
|
563
550
|
}))), /* @__PURE__ */ import_react.default.createElement("div", { className: "" }))
|
|
564
551
|
);
|
|
565
552
|
};
|
|
@@ -10,22 +10,27 @@
|
|
|
10
10
|
width: 100%;
|
|
11
11
|
height: 100%;
|
|
12
12
|
|
|
13
|
+
.pisell-lowcode__booking-add-time-hours {
|
|
14
|
+
padding: 6px;
|
|
15
|
+
color: var(--Gray-900, #101828);
|
|
16
|
+
font-size: 14px;
|
|
17
|
+
font-style: normal;
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
background: var(--Gray-50, #F9FAFB);
|
|
20
|
+
margin: 10px 0;
|
|
21
|
+
flex: 0 0 100%;
|
|
22
|
+
position: sticky;
|
|
23
|
+
top: 95px;
|
|
24
|
+
z-index: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
13
27
|
.pisell-lowcode__booking-add-time-child-card-list {
|
|
14
28
|
width: 100%;
|
|
15
29
|
display: flex;
|
|
16
30
|
flex-wrap: wrap;
|
|
17
31
|
gap: 10px;
|
|
18
32
|
|
|
19
|
-
|
|
20
|
-
padding: 6px;
|
|
21
|
-
color: var(--Gray-900, #101828);
|
|
22
|
-
font-size: 14px;
|
|
23
|
-
font-style: normal;
|
|
24
|
-
font-weight: 500;
|
|
25
|
-
background: var(--Gray-50, #F9FAFB);
|
|
26
|
-
margin: 10px 0;
|
|
27
|
-
flex: 0 0 100%;
|
|
28
|
-
}
|
|
33
|
+
|
|
29
34
|
|
|
30
35
|
.pisell-lowcode__booking-add-time-child-card {
|
|
31
36
|
flex: 0 0 calc(50% - 5px);
|