@pisell/private-materials 3.0.74 → 3.0.75
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/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/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
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @title: 根据商品生成加时列表
|
|
3
|
+
* @description:
|
|
4
|
+
* @param {any} config
|
|
5
|
+
* @param {number} price
|
|
6
|
+
* @return {*}
|
|
7
|
+
* @Author: zhiwei.Wang
|
|
8
|
+
* @Date: 2024-07-01 09:34
|
|
9
|
+
*/
|
|
10
|
+
export declare const getAddTimeSplits: (product: any, cacheItem: any, currentResourceTimeEndDate: any) => {
|
|
11
|
+
label: any;
|
|
12
|
+
value: any;
|
|
13
|
+
price: any;
|
|
14
|
+
}[];
|
|
15
|
+
/**
|
|
16
|
+
* @title: 判断当前商品是否可用
|
|
17
|
+
* @description:
|
|
18
|
+
* @param {any} relationProduct
|
|
19
|
+
* @param {any} currentItem
|
|
20
|
+
* @return {*}
|
|
21
|
+
* @Author: zhiwei.Wang
|
|
22
|
+
* @Date: 2024-07-01 09:33
|
|
23
|
+
*/
|
|
24
|
+
export declare const isUsableProduct: (addTime: any, currentItem: any) => any;
|
|
25
|
+
export declare const addTimeRowKey: {
|
|
26
|
+
create: (product_id: number, time: number) => string;
|
|
27
|
+
getValue: (str: string) => {
|
|
28
|
+
product_id: number;
|
|
29
|
+
time: number | string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/components/booking/info/service/addTimeModal/utils.ts
|
|
30
30
|
var utils_exports = {};
|
|
31
31
|
__export(utils_exports, {
|
|
32
|
+
addTimeRowKey: () => addTimeRowKey,
|
|
32
33
|
getAddTimeSplits: () => getAddTimeSplits,
|
|
33
34
|
isUsableProduct: () => isUsableProduct
|
|
34
35
|
});
|
|
@@ -37,66 +38,74 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
37
38
|
var import_utils = require("../../../utils");
|
|
38
39
|
var import_utils2 = require("@pisell/utils");
|
|
39
40
|
var import_lodash = require("lodash");
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
var getAddTimeSplits = (product, cacheItem, currentResourceTimeEndDate) => {
|
|
42
|
+
const { add_time = {
|
|
43
|
+
calculate_type: "select_quantity",
|
|
44
|
+
// 最大时长
|
|
45
|
+
max_add_time: 30,
|
|
46
|
+
// 最小时长
|
|
47
|
+
min_add_time: 30,
|
|
48
|
+
// 关联产品
|
|
49
|
+
relation_product: { type: "product_all", products: [] },
|
|
50
|
+
// 单位切片
|
|
51
|
+
unit_duration: 30
|
|
52
|
+
}, price = 0 } = product;
|
|
53
|
+
if (add_time.additional_time_options === "unlimited") {
|
|
54
|
+
let maxEndDate = (0, import_utils.getEndDate)(cacheItem._extend.startDate, "flexible", currentResourceTimeEndDate);
|
|
55
|
+
let _value = maxEndDate.diff(cacheItem._extend.endDate, "minute");
|
|
56
|
+
if (_value > 0) {
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
label: import_utils2.locales.getText("page.booking.text.unlimited"),
|
|
60
|
+
value: _value,
|
|
61
|
+
price
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
} else {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
48
67
|
}
|
|
49
|
-
return (0, import_utils.getDiscountTime)(currentH * 60);
|
|
50
|
-
};
|
|
51
|
-
var getAddTimeSplits = (config, price) => {
|
|
52
68
|
const startTime = (0, import_dayjs.default)().startOf("day");
|
|
53
|
-
const endTime = startTime.add(
|
|
54
|
-
const timeSlice = (
|
|
69
|
+
const endTime = startTime.add(add_time.max_add_time, "minute");
|
|
70
|
+
const timeSlice = (add_time == null ? void 0 : add_time.unit_duration) || 5;
|
|
55
71
|
let arr = [];
|
|
56
72
|
let currentTime = startTime;
|
|
57
73
|
let lastDuration = 0;
|
|
58
74
|
while (currentTime.isBefore(endTime)) {
|
|
59
75
|
let nextTime = currentTime;
|
|
60
76
|
if (lastDuration === 0) {
|
|
61
|
-
nextTime = nextTime.add(
|
|
77
|
+
nextTime = nextTime.add(add_time.min_add_time, "minute");
|
|
62
78
|
} else {
|
|
63
79
|
nextTime = currentTime.add(timeSlice, "minute");
|
|
64
80
|
}
|
|
65
81
|
const durationValue = nextTime.diff(startTime, "minute");
|
|
66
|
-
|
|
67
|
-
console.log("isAddH", isAddH);
|
|
68
|
-
if (isAddH) {
|
|
69
|
-
arr.push({
|
|
70
|
-
label: isAddH,
|
|
71
|
-
value: 0,
|
|
72
|
-
readonly: true
|
|
73
|
-
});
|
|
74
|
-
}
|
|
82
|
+
let durationLabel = `${durationValue} ${import_utils2.locales.getText("pisell2.text.min")}`;
|
|
75
83
|
if (durationValue >= 60) {
|
|
76
|
-
|
|
77
|
-
arr.push({
|
|
78
|
-
label: durationLabel,
|
|
79
|
-
value: durationValue,
|
|
80
|
-
price: durationValue / timeSlice * price
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
const durationLabel = `${durationValue} ${import_utils2.locales.getText("pisell2.text.min")}`;
|
|
84
|
-
arr.push({
|
|
85
|
-
label: durationLabel,
|
|
86
|
-
value: durationValue,
|
|
87
|
-
price: durationValue / timeSlice * price
|
|
88
|
-
});
|
|
84
|
+
durationLabel = (0, import_utils.getDiscountTime)(durationValue);
|
|
89
85
|
}
|
|
86
|
+
arr.push({
|
|
87
|
+
label: durationLabel,
|
|
88
|
+
value: durationValue,
|
|
89
|
+
price: durationValue / timeSlice * price
|
|
90
|
+
});
|
|
90
91
|
lastDuration = durationValue;
|
|
91
92
|
currentTime = nextTime;
|
|
92
93
|
}
|
|
93
94
|
return arr;
|
|
94
95
|
};
|
|
95
|
-
var isUsableProduct = (
|
|
96
|
-
|
|
96
|
+
var isUsableProduct = (addTime, currentItem) => {
|
|
97
|
+
var _a;
|
|
98
|
+
const type = (_a = addTime.relation_product) == null ? void 0 : _a.type;
|
|
99
|
+
const relationProduct = addTime.relation_product || [];
|
|
97
100
|
if (!currentItem) {
|
|
98
101
|
return false;
|
|
99
102
|
}
|
|
103
|
+
if (addTime.additional_time_options === "unlimited") {
|
|
104
|
+
let maxEndDate = (0, import_utils.getEndDate)(currentItem._extend.startDate, "flexible", "");
|
|
105
|
+
if (currentItem._extend.endDate.isAfter(maxEndDate)) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
100
109
|
if (type === "product_all") {
|
|
101
110
|
return true;
|
|
102
111
|
} else {
|
|
@@ -122,8 +131,25 @@ var isUsableProduct = (relationProduct, currentItem) => {
|
|
|
122
131
|
}
|
|
123
132
|
}
|
|
124
133
|
};
|
|
134
|
+
var addTimeRowKey = {
|
|
135
|
+
// 创建, 增加前缀
|
|
136
|
+
create: (product_id, time) => {
|
|
137
|
+
return `${product_id}_${time}`;
|
|
138
|
+
},
|
|
139
|
+
// 格式化, 去除前缀
|
|
140
|
+
getValue: (str) => {
|
|
141
|
+
let arr = str.split("_");
|
|
142
|
+
let id = arr[0] || 0;
|
|
143
|
+
let time = arr[1] || 0;
|
|
144
|
+
return {
|
|
145
|
+
product_id: Number(id),
|
|
146
|
+
time: time === "flexible" ? time : Number(arr[1] || 0)
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
};
|
|
125
150
|
// Annotate the CommonJS export names for ESM import in node:
|
|
126
151
|
0 && (module.exports = {
|
|
152
|
+
addTimeRowKey,
|
|
127
153
|
getAddTimeSplits,
|
|
128
154
|
isUsableProduct
|
|
129
155
|
});
|
|
@@ -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;
|
|
@@ -187,6 +187,7 @@ var locales_default = {
|
|
|
187
187
|
"page.booking.text.unavailable": "Unavailable",
|
|
188
188
|
"page.booking.text.available": "Available",
|
|
189
189
|
"page.booking.text.fully-booked": "Fully booked",
|
|
190
|
+
"page.booking.text.unlimited": "Unlimited",
|
|
190
191
|
"pisell2.text.terminal-edit-message": "This operation cannot be performed. To proceed, please use the Pisell Terminal."
|
|
191
192
|
},
|
|
192
193
|
"zh-CN": {
|
|
@@ -358,7 +359,8 @@ var locales_default = {
|
|
|
358
359
|
"page.booking.text.add-time-success": "加时成功",
|
|
359
360
|
"page.booking.text.unavailable": "不可用",
|
|
360
361
|
"page.booking.text.available": "可用",
|
|
361
|
-
"page.booking.text.fully-booked": "已约满"
|
|
362
|
+
"page.booking.text.fully-booked": "已约满",
|
|
363
|
+
"page.booking.text.unlimited": "无限制"
|
|
362
364
|
},
|
|
363
365
|
"zh-HK": {
|
|
364
366
|
"pisell2.text.refunded-amount": "已退金額",
|
|
@@ -529,6 +531,7 @@ var locales_default = {
|
|
|
529
531
|
"page.booking.text.add-time-success": "加時成功!",
|
|
530
532
|
"page.booking.text.unavailable": "不可用",
|
|
531
533
|
"page.booking.text.available": "可用",
|
|
532
|
-
"page.booking.text.fully-booked": "已約滿"
|
|
534
|
+
"page.booking.text.fully-booked": "已約滿",
|
|
535
|
+
"page.booking.text.unlimited": "無限制"
|
|
533
536
|
}
|
|
534
537
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.75",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"react-infinite-scroll-component": "^6.1.0",
|
|
60
60
|
"rc-virtual-list": "^3.11.3",
|
|
61
61
|
"@pisell/utils": "1.0.25",
|
|
62
|
-
"@pisell/
|
|
63
|
-
"@pisell/
|
|
62
|
+
"@pisell/date-picker": "1.0.74",
|
|
63
|
+
"@pisell/icon": "0.0.8"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": "^18.0.0",
|