@pisell/materials 3.0.58 → 3.0.59
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 +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +30 -30
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +23 -23
- package/es/index.d.ts +2 -4
- package/es/index.js +2 -7
- package/lib/index.d.ts +2 -4
- package/lib/index.js +32 -38
- package/lowcode/collapse/meta.ts +1 -85
- package/lowcode/date-picker.range-picker/meta.ts +0 -20
- package/package.json +3 -3
- package/es/components/cardPro/index.d.ts +0 -4
- package/es/components/cardPro/index.js +0 -69
- package/es/components/cardPro/index.less +0 -55
- package/es/components/collapse/index.d.ts +0 -15
- package/es/components/collapse/index.js +0 -80
- package/es/components/collapse/index.less +0 -0
- package/es/components/productCard/components/Action/index.d.ts +0 -4
- package/es/components/productCard/components/Action/index.js +0 -21
- package/es/components/productCard/components/Action/index.less +0 -14
- package/es/components/productCard/components/AmountFooter/index.d.ts +0 -4
- package/es/components/productCard/components/AmountFooter/index.js +0 -38
- package/es/components/productCard/components/AmountFooter/index.less +0 -39
- package/es/components/productCard/components/Divider/index.d.ts +0 -4
- package/es/components/productCard/components/Divider/index.js +0 -11
- package/es/components/productCard/components/Divider/index.less +0 -13
- package/es/components/productCard/components/Header/index.d.ts +0 -4
- package/es/components/productCard/components/Header/index.js +0 -70
- package/es/components/productCard/components/Header/index.less +0 -63
- package/es/components/productCard/components/Note/index.d.ts +0 -4
- package/es/components/productCard/components/Note/index.js +0 -25
- package/es/components/productCard/components/Note/index.less +0 -20
- package/es/components/productCard/components/Packages/components/collapsibleList/index.d.ts +0 -10
- package/es/components/productCard/components/Packages/components/collapsibleList/index.js +0 -96
- package/es/components/productCard/components/Packages/components/collapsibleList/index.less +0 -53
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +0 -2
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.js +0 -33
- package/es/components/productCard/components/Packages/components/options/index.d.ts +0 -4
- package/es/components/productCard/components/Packages/components/options/index.js +0 -23
- package/es/components/productCard/components/Packages/components/options/index.less +0 -29
- package/es/components/productCard/components/Packages/index.d.ts +0 -4
- package/es/components/productCard/components/Packages/index.js +0 -32
- package/es/components/productCard/components/Packages/index.less +0 -17
- package/es/components/productCard/components/Packages/utils.d.ts +0 -20
- package/es/components/productCard/components/Packages/utils.js +0 -40
- package/es/components/productCard/components/Sales/index.d.ts +0 -4
- package/es/components/productCard/components/Sales/index.js +0 -39
- package/es/components/productCard/components/Sales/index.less +0 -18
- package/es/components/productCard/components/Time/components/Like/index.d.ts +0 -9
- package/es/components/productCard/components/Time/components/Like/index.js +0 -26
- package/es/components/productCard/components/Time/components/Like/index.less +0 -6
- package/es/components/productCard/components/Time/components/Like/like-heart.png +0 -0
- package/es/components/productCard/components/Time/components/Like/like-hide-heart.png +0 -0
- package/es/components/productCard/components/Time/index.d.ts +0 -4
- package/es/components/productCard/components/Time/index.js +0 -44
- package/es/components/productCard/components/Time/index.less +0 -35
- package/es/components/productCard/hooks/useOpenNote.d.ts +0 -3
- package/es/components/productCard/hooks/useOpenNote.js +0 -66
- package/es/components/productCard/index.d.ts +0 -5
- package/es/components/productCard/index.js +0 -131
- package/es/components/productCard/index.less +0 -53
- package/es/components/productCard/locales.d.ts +0 -42
- package/es/components/productCard/locales.js +0 -47
- package/es/components/productCard/status.d.ts +0 -9
- package/es/components/productCard/status.js +0 -15
- package/es/components/productCard/types.d.ts +0 -17
- package/es/components/productCard/types.js +0 -1
- package/es/components/productCard/utils.d.ts +0 -165
- package/es/components/productCard/utils.js +0 -709
- package/lib/components/cardPro/index.d.ts +0 -4
- package/lib/components/cardPro/index.js +0 -101
- package/lib/components/cardPro/index.less +0 -55
- package/lib/components/collapse/index.d.ts +0 -15
- package/lib/components/collapse/index.js +0 -83
- package/lib/components/collapse/index.less +0 -0
- package/lib/components/productCard/components/Action/index.d.ts +0 -4
- package/lib/components/productCard/components/Action/index.js +0 -55
- package/lib/components/productCard/components/Action/index.less +0 -14
- package/lib/components/productCard/components/AmountFooter/index.d.ts +0 -4
- package/lib/components/productCard/components/AmountFooter/index.js +0 -61
- package/lib/components/productCard/components/AmountFooter/index.less +0 -39
- package/lib/components/productCard/components/Divider/index.d.ts +0 -4
- package/lib/components/productCard/components/Divider/index.js +0 -50
- package/lib/components/productCard/components/Divider/index.less +0 -13
- package/lib/components/productCard/components/Header/index.d.ts +0 -4
- package/lib/components/productCard/components/Header/index.js +0 -82
- package/lib/components/productCard/components/Header/index.less +0 -63
- package/lib/components/productCard/components/Note/index.d.ts +0 -4
- package/lib/components/productCard/components/Note/index.js +0 -56
- package/lib/components/productCard/components/Note/index.less +0 -20
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.d.ts +0 -10
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.js +0 -93
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.less +0 -53
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +0 -2
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.js +0 -52
- package/lib/components/productCard/components/Packages/components/options/index.d.ts +0 -4
- package/lib/components/productCard/components/Packages/components/options/index.js +0 -73
- package/lib/components/productCard/components/Packages/components/options/index.less +0 -29
- package/lib/components/productCard/components/Packages/index.d.ts +0 -4
- package/lib/components/productCard/components/Packages/index.js +0 -56
- package/lib/components/productCard/components/Packages/index.less +0 -17
- package/lib/components/productCard/components/Packages/utils.d.ts +0 -20
- package/lib/components/productCard/components/Packages/utils.js +0 -44
- package/lib/components/productCard/components/Sales/index.d.ts +0 -4
- package/lib/components/productCard/components/Sales/index.js +0 -61
- package/lib/components/productCard/components/Sales/index.less +0 -18
- package/lib/components/productCard/components/Time/components/Like/index.d.ts +0 -9
- package/lib/components/productCard/components/Time/components/Like/index.js +0 -64
- package/lib/components/productCard/components/Time/components/Like/index.less +0 -6
- package/lib/components/productCard/components/Time/components/Like/like-heart.png +0 -0
- package/lib/components/productCard/components/Time/components/Like/like-hide-heart.png +0 -0
- package/lib/components/productCard/components/Time/index.d.ts +0 -4
- package/lib/components/productCard/components/Time/index.js +0 -64
- package/lib/components/productCard/components/Time/index.less +0 -35
- package/lib/components/productCard/hooks/useOpenNote.d.ts +0 -3
- package/lib/components/productCard/hooks/useOpenNote.js +0 -84
- package/lib/components/productCard/index.d.ts +0 -5
- package/lib/components/productCard/index.js +0 -160
- package/lib/components/productCard/index.less +0 -53
- package/lib/components/productCard/locales.d.ts +0 -42
- package/lib/components/productCard/locales.js +0 -65
- package/lib/components/productCard/status.d.ts +0 -9
- package/lib/components/productCard/status.js +0 -36
- package/lib/components/productCard/types.d.ts +0 -17
- package/lib/components/productCard/types.js +0 -17
- package/lib/components/productCard/utils.d.ts +0 -165
- package/lib/components/productCard/utils.js +0 -622
- package/lowcode/card-pro/meta.ts +0 -338
- package/lowcode/card-pro/snippe.ts +0 -39
- package/lowcode/product-card/meta.ts +0 -92
- package/lowcode/product-card/snippets.ts +0 -23
|
@@ -1,622 +0,0 @@
|
|
|
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/productCard/utils.ts
|
|
30
|
-
var utils_exports = {};
|
|
31
|
-
__export(utils_exports, {
|
|
32
|
-
deleteCacheParams: () => deleteCacheParams,
|
|
33
|
-
findNextDuration: () => findNextDuration,
|
|
34
|
-
findNextSlice: () => findNextSlice,
|
|
35
|
-
flexibleObj: () => flexibleObj,
|
|
36
|
-
formatProductListByCategory: () => formatProductListByCategory,
|
|
37
|
-
formatResource: () => formatResource,
|
|
38
|
-
formatTimes: () => formatTimes,
|
|
39
|
-
getCacheParams: () => getCacheParams,
|
|
40
|
-
getDiscountTime: () => getDiscountTime,
|
|
41
|
-
getDuration: () => getDuration,
|
|
42
|
-
getEndDate: () => getEndDate,
|
|
43
|
-
getErrorList: () => getErrorList,
|
|
44
|
-
getIsEdit: () => getIsEdit,
|
|
45
|
-
getLastServer: () => getLastServer,
|
|
46
|
-
getNowTime: () => getNowTime,
|
|
47
|
-
getProductTotalPrice: () => getProductTotalPrice,
|
|
48
|
-
getResourceTimeIsUsable: () => getResourceTimeIsUsable,
|
|
49
|
-
getServeStartTime: () => getServeStartTime,
|
|
50
|
-
getServerItemExtend: () => getServerItemExtend,
|
|
51
|
-
getServiceTime: () => getServiceTime,
|
|
52
|
-
getServiceTimes: () => getServiceTimes,
|
|
53
|
-
getShopOpeningHours: () => getShopOpeningHours,
|
|
54
|
-
isNowTime: () => isNowTime,
|
|
55
|
-
isWalkIn: () => isWalkIn,
|
|
56
|
-
request: () => request,
|
|
57
|
-
sliceDayIntoFiveMinutes: () => sliceDayIntoFiveMinutes
|
|
58
|
-
});
|
|
59
|
-
module.exports = __toCommonJS(utils_exports);
|
|
60
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
61
|
-
var import_utils = require("@pisell/utils");
|
|
62
|
-
var import_lodash = require("lodash");
|
|
63
|
-
var import_zh_cn = require("dayjs/locale/zh-cn");
|
|
64
|
-
var import_en = require("dayjs/locale/en");
|
|
65
|
-
var import_zh_tw = require("dayjs/locale/zh-tw");
|
|
66
|
-
var Request = class {
|
|
67
|
-
constructor() {
|
|
68
|
-
this.request = {};
|
|
69
|
-
}
|
|
70
|
-
setRequest(val) {
|
|
71
|
-
this.request = val;
|
|
72
|
-
}
|
|
73
|
-
getRequest() {
|
|
74
|
-
return this.request;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
var request = new Request();
|
|
78
|
-
var getDiscountTime = (service_times) => {
|
|
79
|
-
if (!service_times) {
|
|
80
|
-
return "";
|
|
81
|
-
}
|
|
82
|
-
if (service_times < 60) {
|
|
83
|
-
return `${service_times} ${import_utils.locales.getText("pisell2.text.min")}`;
|
|
84
|
-
} else {
|
|
85
|
-
let str = "";
|
|
86
|
-
const hours = Math.floor(service_times / 60);
|
|
87
|
-
const minutes = service_times % 60;
|
|
88
|
-
str += `${hours}${import_utils.locales.getText("pisell2.text.h")}`;
|
|
89
|
-
if (minutes > 0) {
|
|
90
|
-
str += ` ${minutes}${import_utils.locales.getText("pisell2.text.min")}`;
|
|
91
|
-
}
|
|
92
|
-
return str;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
var sliceDayIntoFiveMinutes = (config, locale) => {
|
|
96
|
-
let _locale = locale;
|
|
97
|
-
let dayjsLocale = _locale === "en-US" || _locale === "en" ? "en" : "zh-cn";
|
|
98
|
-
import_dayjs.default.locale(dayjsLocale);
|
|
99
|
-
const startTime = (0, import_dayjs.default)().startOf("day");
|
|
100
|
-
const endTime = (0, import_dayjs.default)().endOf("day");
|
|
101
|
-
const timeSlice = (config == null ? void 0 : config.value) || 5;
|
|
102
|
-
let timeSlices = [];
|
|
103
|
-
let durationSlicesBasedOnTime = [];
|
|
104
|
-
let currentTime = startTime;
|
|
105
|
-
while (currentTime.isBefore(endTime)) {
|
|
106
|
-
const timeLabel = currentTime.format("hh:mm A");
|
|
107
|
-
const timeValue = currentTime.format("HH:mm");
|
|
108
|
-
timeSlices.push({ label: timeLabel, value: timeValue });
|
|
109
|
-
const nextTime = currentTime.add(timeSlice, "minute");
|
|
110
|
-
const durationValue = nextTime.diff(startTime, "minute");
|
|
111
|
-
if (durationValue > 60) {
|
|
112
|
-
const durationLabel = getDiscountTime(durationValue);
|
|
113
|
-
durationSlicesBasedOnTime.push({
|
|
114
|
-
label: durationLabel,
|
|
115
|
-
value: durationValue
|
|
116
|
-
});
|
|
117
|
-
} else {
|
|
118
|
-
const durationLabel = `${durationValue} ${import_utils.locales.getText(
|
|
119
|
-
"pisell2.text.min"
|
|
120
|
-
)}`;
|
|
121
|
-
durationSlicesBasedOnTime.push({
|
|
122
|
-
label: durationLabel,
|
|
123
|
-
value: durationValue
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
currentTime = nextTime;
|
|
127
|
-
}
|
|
128
|
-
return { timeSlices, durationSlicesBasedOnTime };
|
|
129
|
-
};
|
|
130
|
-
var getNowTime = () => {
|
|
131
|
-
return (0, import_dayjs.default)().format("HH:mm");
|
|
132
|
-
};
|
|
133
|
-
var isNowTime = (time) => {
|
|
134
|
-
return time === "now";
|
|
135
|
-
};
|
|
136
|
-
var getServeStartTime = (start_time) => {
|
|
137
|
-
if (isNowTime(start_time)) {
|
|
138
|
-
return getNowTime();
|
|
139
|
-
}
|
|
140
|
-
return start_time;
|
|
141
|
-
};
|
|
142
|
-
var getServiceTime = (item, currentDate) => {
|
|
143
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
144
|
-
if (!currentDate || !((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.start_time) || !(0, import_dayjs.default)(currentDate).isValid())
|
|
145
|
-
return "";
|
|
146
|
-
const locale = (item == null ? void 0 : item.locale) || "en-US";
|
|
147
|
-
const isEn = locale === "en-US" || locale === "en";
|
|
148
|
-
const localeTypes = {
|
|
149
|
-
"en-US": "en",
|
|
150
|
-
"zh-CN": "zh-cn",
|
|
151
|
-
"zh-HK": "zh-tw"
|
|
152
|
-
};
|
|
153
|
-
import_dayjs.default.locale(localeTypes[locale]);
|
|
154
|
-
console.log(locale, "wh_locale");
|
|
155
|
-
const startDate = (0, import_dayjs.default)(
|
|
156
|
-
(currentDate == null ? void 0 : currentDate.format("YYYY-MM-DD")) + " " + getServeStartTime((_b = item == null ? void 0 : item._extend) == null ? void 0 : _b.start_time)
|
|
157
|
-
);
|
|
158
|
-
const startTime = startDate.format("HH:mm");
|
|
159
|
-
if (((_c = item == null ? void 0 : item._extend) == null ? void 0 : _c.sub_type) === "days") {
|
|
160
|
-
const startDate2 = (0, import_dayjs.default)((_d = item == null ? void 0 : item._extend) == null ? void 0 : _d.start_date);
|
|
161
|
-
const endDate = (0, import_dayjs.default)((_e = item == null ? void 0 : item._extend) == null ? void 0 : _e.end_date);
|
|
162
|
-
const diffInDays = endDate.diff(startDate2, "day");
|
|
163
|
-
const _format = isEn ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
|
|
164
|
-
const date = `${startDate2.format(_format)} ~ ${endDate.format(_format)}`;
|
|
165
|
-
const duration2 = `${diffInDays} ${import_utils.locales.getText("pisell2.product.card.day")(diffInDays)}`;
|
|
166
|
-
return `${date} (${duration2})`;
|
|
167
|
-
}
|
|
168
|
-
const endTime = startDate.add(flexibleObj.getValue((_f = item == null ? void 0 : item._extend) == null ? void 0 : _f.duration), "minute").format("HH:mm");
|
|
169
|
-
const duration = getDiscountTime(flexibleObj.getValue((_g = item == null ? void 0 : item._extend) == null ? void 0 : _g.duration));
|
|
170
|
-
return `${startTime} - ${endTime} ( ${duration} )`;
|
|
171
|
-
};
|
|
172
|
-
var findNextSlice = ({
|
|
173
|
-
timeSlices = [],
|
|
174
|
-
index = 0,
|
|
175
|
-
date = ""
|
|
176
|
-
}) => {
|
|
177
|
-
const currentTimeValue = date || (0, import_dayjs.default)().format("HH:mm");
|
|
178
|
-
for (let i = 0; i < timeSlices.length; i++) {
|
|
179
|
-
if (timeSlices[i].value !== "now") {
|
|
180
|
-
if (timeSlices[i].value >= currentTimeValue) {
|
|
181
|
-
return timeSlices[i].value;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return timeSlices[index].value;
|
|
186
|
-
};
|
|
187
|
-
var findNextDuration = (current, array, defaultValue) => {
|
|
188
|
-
for (let i = 0; i < array.length; i++) {
|
|
189
|
-
if (array[i].value == (current == null ? void 0 : current.value)) {
|
|
190
|
-
return array[i].value;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return defaultValue || array[0].value;
|
|
194
|
-
};
|
|
195
|
-
var formatProductListByCategory = (list, filterItem) => {
|
|
196
|
-
let _list = list || [];
|
|
197
|
-
if (filterItem) {
|
|
198
|
-
_list = _list.filter(filterItem);
|
|
199
|
-
}
|
|
200
|
-
let categoryObject = {};
|
|
201
|
-
for (let i = 0; i < _list.length; i++) {
|
|
202
|
-
const productItem = _list[i];
|
|
203
|
-
if ((productItem.category || []).length) {
|
|
204
|
-
for (let j = 0; j < productItem.category.length; j++) {
|
|
205
|
-
let categoryItem = productItem.category[j];
|
|
206
|
-
if (!categoryObject[categoryItem.id]) {
|
|
207
|
-
categoryObject[categoryItem.id] = {
|
|
208
|
-
...categoryItem,
|
|
209
|
-
products: []
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
categoryObject[categoryItem.id] = {
|
|
213
|
-
...categoryItem,
|
|
214
|
-
products: [...categoryObject[categoryItem.id].products, productItem]
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
} else {
|
|
218
|
-
if (!categoryObject["other"]) {
|
|
219
|
-
categoryObject["other"] = {
|
|
220
|
-
id: 0,
|
|
221
|
-
title: import_utils.locales.getText("pisell2.text.other"),
|
|
222
|
-
name: import_utils.locales.getText("pisell2.text.other"),
|
|
223
|
-
cover: "",
|
|
224
|
-
products: []
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
categoryObject["other"] = {
|
|
228
|
-
...categoryObject["other"],
|
|
229
|
-
products: [...categoryObject["other"].products, productItem]
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return Object.values(categoryObject).sort((a, b) => b.sort - a.sort);
|
|
234
|
-
};
|
|
235
|
-
var getResourceTimeIsUsable = (item, cacheItem) => {
|
|
236
|
-
const startDate = (0, import_dayjs.default)(
|
|
237
|
-
cacheItem._extend.start_date.format("YYYY-MM-DD") + " " + getServeStartTime(cacheItem._extend.start_time)
|
|
238
|
-
);
|
|
239
|
-
const isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
|
|
240
|
-
let isMaxLimitRange = false;
|
|
241
|
-
let isDateRange = false;
|
|
242
|
-
let time = { ...item };
|
|
243
|
-
if (time.max_participants_limit == 0) {
|
|
244
|
-
isMaxLimitRange = true;
|
|
245
|
-
} else {
|
|
246
|
-
isMaxLimitRange = "unknown";
|
|
247
|
-
}
|
|
248
|
-
const timeStartDate = (0, import_dayjs.default)(time.start_date + " " + time.start_time).subtract(
|
|
249
|
-
1,
|
|
250
|
-
"second"
|
|
251
|
-
);
|
|
252
|
-
const timeEndDate = (0, import_dayjs.default)(time.end_date + " " + time.end_time).add(
|
|
253
|
-
1,
|
|
254
|
-
"second"
|
|
255
|
-
);
|
|
256
|
-
let bol;
|
|
257
|
-
if (isFlexible) {
|
|
258
|
-
bol = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
|
|
259
|
-
} else {
|
|
260
|
-
let endDate = startDate.add(
|
|
261
|
-
flexibleObj.getValue(cacheItem._extend.duration),
|
|
262
|
-
"minute"
|
|
263
|
-
);
|
|
264
|
-
bol = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
|
|
265
|
-
}
|
|
266
|
-
if (bol) {
|
|
267
|
-
isDateRange = true;
|
|
268
|
-
}
|
|
269
|
-
const isUsable = isDateRange;
|
|
270
|
-
time._extend = {
|
|
271
|
-
isMaxLimitRange,
|
|
272
|
-
isDateRange,
|
|
273
|
-
isUsable
|
|
274
|
-
};
|
|
275
|
-
return time;
|
|
276
|
-
};
|
|
277
|
-
var formatTimes = (resourceItem, cacheItem) => {
|
|
278
|
-
let usableTimes = [];
|
|
279
|
-
let _resourceItem = { ...resourceItem };
|
|
280
|
-
_resourceItem.times = _resourceItem.times.map((time) => {
|
|
281
|
-
let _time2 = getResourceTimeIsUsable(time, cacheItem);
|
|
282
|
-
if (_time2 == null ? void 0 : _time2._extend.isUsable) {
|
|
283
|
-
usableTimes.push(_time2);
|
|
284
|
-
}
|
|
285
|
-
return _time2;
|
|
286
|
-
});
|
|
287
|
-
let _time = (usableTimes || []).sort((a, b) => {
|
|
288
|
-
const aEndDate = (0, import_dayjs.default)(a.end_date + " " + a.end_time).valueOf();
|
|
289
|
-
const bEndDate = (0, import_dayjs.default)(b.end_date + " " + b.end_time).valueOf();
|
|
290
|
-
return aEndDate - bEndDate;
|
|
291
|
-
})[0];
|
|
292
|
-
resourceItem._extend = {
|
|
293
|
-
...resourceItem._extend,
|
|
294
|
-
usableTime: _time
|
|
295
|
-
};
|
|
296
|
-
return resourceItem;
|
|
297
|
-
};
|
|
298
|
-
var formatResourceProducts = (resourceItem, currentItem) => {
|
|
299
|
-
var _a;
|
|
300
|
-
let usableProduct = false;
|
|
301
|
-
let _resourceItem = { ...resourceItem };
|
|
302
|
-
const type = _resourceItem.partyroom_package.type;
|
|
303
|
-
if (type === "product_all") {
|
|
304
|
-
usableProduct = true;
|
|
305
|
-
} else {
|
|
306
|
-
if (type === "product_collection") {
|
|
307
|
-
usableProduct = !!(0, import_lodash.intersectionBy)(
|
|
308
|
-
((_a = _resourceItem.partyroom_package) == null ? void 0 : _a.products.map((item) => ({
|
|
309
|
-
...item,
|
|
310
|
-
id: item.product_collection_id
|
|
311
|
-
}))) || [],
|
|
312
|
-
currentItem.collection || [],
|
|
313
|
-
"id"
|
|
314
|
-
).length;
|
|
315
|
-
} else {
|
|
316
|
-
usableProduct = _resourceItem.partyroom_package.products.some(
|
|
317
|
-
(item) => {
|
|
318
|
-
if (type === "products") {
|
|
319
|
-
if (item.product_id == currentItem.product_id) {
|
|
320
|
-
return true;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
resourceItem._extend = {
|
|
328
|
-
...resourceItem._extend,
|
|
329
|
-
// 是否可用
|
|
330
|
-
usableProduct
|
|
331
|
-
};
|
|
332
|
-
return resourceItem;
|
|
333
|
-
};
|
|
334
|
-
var getShopOpeningHours = () => {
|
|
335
|
-
return localStorage.getItem("shopOpeningHours") || "23:59";
|
|
336
|
-
};
|
|
337
|
-
var flexibleObj = {
|
|
338
|
-
// 创建, 增加前缀
|
|
339
|
-
create: (num) => {
|
|
340
|
-
return `flexible_${num}`;
|
|
341
|
-
},
|
|
342
|
-
// 格式化, 去除前缀
|
|
343
|
-
getValue: (str) => {
|
|
344
|
-
if (typeof str === "string" && flexibleObj.isFlexible(str)) {
|
|
345
|
-
return Number(str.replace("flexible_", ""));
|
|
346
|
-
}
|
|
347
|
-
return str;
|
|
348
|
-
},
|
|
349
|
-
// 判断当前时长是否为灵活时长
|
|
350
|
-
isFlexible: (str) => {
|
|
351
|
-
if (typeof str !== "string") {
|
|
352
|
-
return false;
|
|
353
|
-
}
|
|
354
|
-
return str.indexOf("flexible_") > -1;
|
|
355
|
-
},
|
|
356
|
-
add: (current, duration) => {
|
|
357
|
-
if (flexibleObj.isFlexible(current)) {
|
|
358
|
-
return flexibleObj.create(
|
|
359
|
-
flexibleObj.getValue(current) + duration
|
|
360
|
-
);
|
|
361
|
-
} else {
|
|
362
|
-
return Number(current) + duration;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
var getEndDate = (startDate, duration, endDate) => {
|
|
367
|
-
if (duration === "flexible") {
|
|
368
|
-
let openingDate = (0, import_dayjs.default)(
|
|
369
|
-
startDate.format("YYYY-MM-DD") + " " + getShopOpeningHours()
|
|
370
|
-
);
|
|
371
|
-
if ((0, import_dayjs.default)(startDate).isAfter(openingDate)) {
|
|
372
|
-
openingDate = openingDate.add(1, "day");
|
|
373
|
-
}
|
|
374
|
-
if (!endDate) {
|
|
375
|
-
return openingDate;
|
|
376
|
-
}
|
|
377
|
-
endDate = (0, import_dayjs.default)(endDate);
|
|
378
|
-
if (endDate.isAfter(openingDate)) {
|
|
379
|
-
return openingDate;
|
|
380
|
-
}
|
|
381
|
-
return endDate;
|
|
382
|
-
}
|
|
383
|
-
return startDate.add(duration, "minute");
|
|
384
|
-
};
|
|
385
|
-
var getServiceTimes = (service) => {
|
|
386
|
-
const startDate = (0, import_dayjs.default)(
|
|
387
|
-
(0, import_dayjs.default)(service._extend.start_date).format("YYYY-MM-DD ") + getServeStartTime(service._extend.start_time)
|
|
388
|
-
);
|
|
389
|
-
const endDate = startDate.add(
|
|
390
|
-
flexibleObj.getValue(service._extend.duration),
|
|
391
|
-
"minute"
|
|
392
|
-
);
|
|
393
|
-
return {
|
|
394
|
-
startDate,
|
|
395
|
-
endDate
|
|
396
|
-
};
|
|
397
|
-
};
|
|
398
|
-
var getErrorList = (resource, cacheItem) => {
|
|
399
|
-
var _a, _b, _c;
|
|
400
|
-
if (!(cacheItem == null ? void 0 : cacheItem.id)) {
|
|
401
|
-
return [
|
|
402
|
-
{
|
|
403
|
-
label: import_utils.locales.getText("pisell2.text.no-product-added"),
|
|
404
|
-
type: "products"
|
|
405
|
-
}
|
|
406
|
-
];
|
|
407
|
-
}
|
|
408
|
-
if (!resource || !resource._extend || !cacheItem) {
|
|
409
|
-
return [];
|
|
410
|
-
}
|
|
411
|
-
let list = [];
|
|
412
|
-
if (!resource.usable) {
|
|
413
|
-
if (!((_a = resource == null ? void 0 : resource._extend) == null ? void 0 : _a.usableProduct)) {
|
|
414
|
-
list.push({
|
|
415
|
-
label: import_utils.locales.getText("pisell1.text.resource-error-message-1")(
|
|
416
|
-
resource.labelText,
|
|
417
|
-
cacheItem == null ? void 0 : cacheItem.title
|
|
418
|
-
),
|
|
419
|
-
type: "product"
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
const { startDate, endDate } = getServiceTimes(cacheItem);
|
|
423
|
-
const startText = startDate.format("hh:mm A");
|
|
424
|
-
let endText = endDate.format("hh:mm A");
|
|
425
|
-
if ((0, import_dayjs.default)(endDate).isAfter(startDate, "day")) {
|
|
426
|
-
endText = import_utils.locales.getText("pisell1.text.tomorrow") + endText;
|
|
427
|
-
}
|
|
428
|
-
if (!((_b = resource._extend) == null ? void 0 : _b.usableTime)) {
|
|
429
|
-
list.push({
|
|
430
|
-
label: import_utils.locales.getText("pisell1.text.resource-error-message-2")(
|
|
431
|
-
resource.labelText,
|
|
432
|
-
startText,
|
|
433
|
-
endText
|
|
434
|
-
),
|
|
435
|
-
type: "time"
|
|
436
|
-
});
|
|
437
|
-
} else {
|
|
438
|
-
if (!((_c = resource._extend) == null ? void 0 : _c.usableTime._extend.isMaxLimitRange)) {
|
|
439
|
-
list.push({
|
|
440
|
-
label: import_utils.locales.getText("pisell1.text.resource-error-message-3")(
|
|
441
|
-
resource.labelText,
|
|
442
|
-
startText,
|
|
443
|
-
endText
|
|
444
|
-
),
|
|
445
|
-
type: "limit"
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
return list;
|
|
451
|
-
};
|
|
452
|
-
var formatResource = (resourceItem, cacheItem, formatLabel) => {
|
|
453
|
-
let _resourceItem = { ...resourceItem };
|
|
454
|
-
_resourceItem = formatTimes(_resourceItem, cacheItem);
|
|
455
|
-
_resourceItem = formatResourceProducts(_resourceItem, cacheItem);
|
|
456
|
-
_resourceItem.labelText = _resourceItem.room_name || _resourceItem.name;
|
|
457
|
-
const usable = _resourceItem._extend.usableTime && _resourceItem._extend.usableProduct;
|
|
458
|
-
_resourceItem.usable = usable;
|
|
459
|
-
if (formatLabel) {
|
|
460
|
-
_resourceItem.label = formatLabel(_resourceItem);
|
|
461
|
-
}
|
|
462
|
-
return _resourceItem;
|
|
463
|
-
};
|
|
464
|
-
var getLastServer = (list) => {
|
|
465
|
-
return list[list.length - 1];
|
|
466
|
-
};
|
|
467
|
-
var getCacheParams = () => {
|
|
468
|
-
const sessionData = sessionStorage.getItem("pisell2.booking.serviceParams");
|
|
469
|
-
const data = sessionData ? JSON.parse(sessionData) : null;
|
|
470
|
-
return data == null ? void 0 : data.serviceParams;
|
|
471
|
-
};
|
|
472
|
-
var deleteCacheParams = () => {
|
|
473
|
-
sessionStorage.removeItem("pisell2.booking.serviceParams");
|
|
474
|
-
};
|
|
475
|
-
var getServerItemExtend = (state, cacheItem, timeObj) => {
|
|
476
|
-
var _a;
|
|
477
|
-
if (!cacheItem.new && cacheItem._extend.endDate) {
|
|
478
|
-
return cacheItem._extend;
|
|
479
|
-
}
|
|
480
|
-
let lastServer = getLastServer(state.service.value);
|
|
481
|
-
let _extend = {
|
|
482
|
-
duration: findNextDuration(
|
|
483
|
-
cacheItem.duration,
|
|
484
|
-
timeObj.durationSlicesBasedOnTime,
|
|
485
|
-
(_a = cacheItem == null ? void 0 : cacheItem.duration) == null ? void 0 : _a.value
|
|
486
|
-
)
|
|
487
|
-
};
|
|
488
|
-
if (lastServer) {
|
|
489
|
-
_extend.resource = lastServer._extend.resource;
|
|
490
|
-
let lastServerStartDate = lastServer._extend.startDate;
|
|
491
|
-
let lastServerEndDate = lastServer._extend.endDate;
|
|
492
|
-
if ((0, import_dayjs.default)(lastServerEndDate).isAfter(lastServerStartDate, "day")) {
|
|
493
|
-
_extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1].value;
|
|
494
|
-
} else {
|
|
495
|
-
_extend.start_time = lastServerEndDate.format("HH:mm");
|
|
496
|
-
}
|
|
497
|
-
} else {
|
|
498
|
-
let findNextSliceProps = {
|
|
499
|
-
timeSlices: timeObj.timeSlices,
|
|
500
|
-
index: 0,
|
|
501
|
-
date: ""
|
|
502
|
-
};
|
|
503
|
-
const serviceParams = getCacheParams();
|
|
504
|
-
if (serviceParams) {
|
|
505
|
-
let str = serviceParams.start_date;
|
|
506
|
-
if (str) {
|
|
507
|
-
findNextSliceProps.date = (0, import_dayjs.default)(str).format("HH:mm");
|
|
508
|
-
}
|
|
509
|
-
let resourceId = Number(serviceParams.resource_id);
|
|
510
|
-
if (resourceId || resourceId === 0) {
|
|
511
|
-
_extend.resource = resourceId;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
if (findNextSliceProps.date && findNextSliceProps.date !== "00:00") {
|
|
515
|
-
_extend.start_time = findNextSlice(findNextSliceProps);
|
|
516
|
-
} else {
|
|
517
|
-
if (cacheItem.currentDefaultTime) {
|
|
518
|
-
_extend.start_time = cacheItem.currentDefaultTime;
|
|
519
|
-
} else {
|
|
520
|
-
_extend.start_time = (0, import_dayjs.default)().format("HH:mm");
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
_extend = {
|
|
525
|
-
..._extend,
|
|
526
|
-
...cacheItem._extend
|
|
527
|
-
};
|
|
528
|
-
return _extend;
|
|
529
|
-
};
|
|
530
|
-
var getProductTotalPrice = (item) => {
|
|
531
|
-
var _a;
|
|
532
|
-
let price = 0;
|
|
533
|
-
price += Number(item._extend.price);
|
|
534
|
-
let other = (_a = item._extend) == null ? void 0 : _a.other;
|
|
535
|
-
if (other == null ? void 0 : other.bundle) {
|
|
536
|
-
price = other == null ? void 0 : other.bundle.reduce((accumulator, currentValue) => {
|
|
537
|
-
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
538
|
-
}, price);
|
|
539
|
-
}
|
|
540
|
-
price = price;
|
|
541
|
-
return price;
|
|
542
|
-
};
|
|
543
|
-
var getDuration = (duration) => {
|
|
544
|
-
if (typeof duration === "number") {
|
|
545
|
-
return duration;
|
|
546
|
-
}
|
|
547
|
-
if (typeof duration === "object") {
|
|
548
|
-
if (duration.type === "minutes") {
|
|
549
|
-
return duration.value;
|
|
550
|
-
}
|
|
551
|
-
if (duration.type === "flexible") {
|
|
552
|
-
return "flexible";
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
return duration;
|
|
556
|
-
};
|
|
557
|
-
var isWalkIn = (customer_id) => {
|
|
558
|
-
if (customer_id === void 0) {
|
|
559
|
-
return true;
|
|
560
|
-
}
|
|
561
|
-
if (typeof customer_id === "string") {
|
|
562
|
-
return ["", "0", "1"].includes(customer_id);
|
|
563
|
-
}
|
|
564
|
-
return [0, 1].includes(customer_id);
|
|
565
|
-
};
|
|
566
|
-
var getIsEdit = (state) => {
|
|
567
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
568
|
-
if ((_a = state.addons) == null ? void 0 : _a.edit) {
|
|
569
|
-
return true;
|
|
570
|
-
}
|
|
571
|
-
if (!state.bookingId) {
|
|
572
|
-
return true;
|
|
573
|
-
}
|
|
574
|
-
if ((_b = state.client) == null ? void 0 : _b.edit) {
|
|
575
|
-
return true;
|
|
576
|
-
}
|
|
577
|
-
if ((_c = state.date) == null ? void 0 : _c.edit) {
|
|
578
|
-
return true;
|
|
579
|
-
}
|
|
580
|
-
if ((_d = state.pet) == null ? void 0 : _d.edit) {
|
|
581
|
-
return true;
|
|
582
|
-
}
|
|
583
|
-
if ((_e = state.service) == null ? void 0 : _e.edit) {
|
|
584
|
-
return true;
|
|
585
|
-
}
|
|
586
|
-
if ((_f = state.notes) == null ? void 0 : _f.edit) {
|
|
587
|
-
return true;
|
|
588
|
-
}
|
|
589
|
-
if ((_g = state.contacts) == null ? void 0 : _g.edit) {
|
|
590
|
-
return true;
|
|
591
|
-
}
|
|
592
|
-
return false;
|
|
593
|
-
};
|
|
594
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
595
|
-
0 && (module.exports = {
|
|
596
|
-
deleteCacheParams,
|
|
597
|
-
findNextDuration,
|
|
598
|
-
findNextSlice,
|
|
599
|
-
flexibleObj,
|
|
600
|
-
formatProductListByCategory,
|
|
601
|
-
formatResource,
|
|
602
|
-
formatTimes,
|
|
603
|
-
getCacheParams,
|
|
604
|
-
getDiscountTime,
|
|
605
|
-
getDuration,
|
|
606
|
-
getEndDate,
|
|
607
|
-
getErrorList,
|
|
608
|
-
getIsEdit,
|
|
609
|
-
getLastServer,
|
|
610
|
-
getNowTime,
|
|
611
|
-
getProductTotalPrice,
|
|
612
|
-
getResourceTimeIsUsable,
|
|
613
|
-
getServeStartTime,
|
|
614
|
-
getServerItemExtend,
|
|
615
|
-
getServiceTime,
|
|
616
|
-
getServiceTimes,
|
|
617
|
-
getShopOpeningHours,
|
|
618
|
-
isNowTime,
|
|
619
|
-
isWalkIn,
|
|
620
|
-
request,
|
|
621
|
-
sliceDayIntoFiveMinutes
|
|
622
|
-
});
|