@pisell/materials 2.2.39 → 2.2.40
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 +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +24 -24
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +14 -14
- package/dist/umd/materials.min.css +1 -0
- package/dist/umd/materials.min.js +1 -0
- package/dist/umd/static/DotsSix.57d66266.svg +1 -0
- package/dist/umd/static/arrow-left.e542294f.svg +1 -0
- package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
- package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
- package/dist/umd/static/help-circle.31c9be40.svg +1 -0
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
- package/es/components/collapse/index.js +27 -4
- package/es/components/productCard/components/Action/index.js +1 -1
- package/es/components/productCard/components/AmountFooter/index.d.ts +1 -1
- package/es/components/productCard/components/AmountFooter/index.js +30 -10
- package/es/components/productCard/components/AmountFooter/index.less +11 -0
- package/es/components/productCard/components/Header/index.js +22 -14
- package/es/components/productCard/components/MultiDay/index.d.ts +4 -0
- package/es/components/productCard/components/MultiDay/index.js +79 -0
- package/es/components/productCard/components/MultiDay/index.less +34 -0
- package/es/components/productCard/components/MultiDay/utils.d.ts +14 -0
- package/es/components/productCard/components/MultiDay/utils.js +54 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.js +11 -5
- package/es/components/productCard/components/Packages/components/options/index.js +2 -2
- package/es/components/productCard/components/Packages/index.js +1 -2
- package/es/components/productCard/components/Sales/index.js +2 -2
- package/es/components/productCard/components/Time/index.js +15 -13
- package/es/components/productCard/index.d.ts +1 -1
- package/es/components/productCard/index.js +34 -20
- package/es/components/productCard/index.less +3 -2
- package/es/components/productCard/status.d.ts +24 -1
- package/es/components/productCard/status.js +52 -2
- package/es/components/productCard/types.d.ts +60 -1
- package/es/components/productCard/utils.d.ts +10 -144
- package/es/components/productCard/utils.js +36 -673
- package/es/components/table/Table/utils.d.ts +1 -1
- package/lib/components/collapse/index.js +30 -4
- package/lib/components/productCard/components/Action/index.js +1 -1
- package/lib/components/productCard/components/AmountFooter/index.d.ts +1 -1
- package/lib/components/productCard/components/AmountFooter/index.js +33 -9
- package/lib/components/productCard/components/AmountFooter/index.less +11 -0
- package/lib/components/productCard/components/Header/index.js +16 -8
- package/lib/components/productCard/components/MultiDay/index.d.ts +4 -0
- package/lib/components/productCard/components/MultiDay/index.js +72 -0
- package/lib/components/productCard/components/MultiDay/index.less +34 -0
- package/lib/components/productCard/components/MultiDay/utils.d.ts +14 -0
- package/lib/components/productCard/components/MultiDay/utils.js +77 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.js +2 -1
- package/lib/components/productCard/components/Packages/components/options/index.js +2 -2
- package/lib/components/productCard/components/Packages/index.js +1 -1
- package/lib/components/productCard/components/Sales/index.js +1 -2
- package/lib/components/productCard/components/Time/index.js +14 -11
- package/lib/components/productCard/index.d.ts +1 -1
- package/lib/components/productCard/index.js +32 -20
- package/lib/components/productCard/index.less +3 -2
- package/lib/components/productCard/status.d.ts +24 -1
- package/lib/components/productCard/status.js +35 -2
- package/lib/components/productCard/types.d.ts +60 -1
- package/lib/components/productCard/utils.d.ts +10 -144
- package/lib/components/productCard/utils.js +30 -567
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/package.json +1 -1
- package/es/components/table/Actions/component/ExportImport/utils/index.d.ts +0 -9
- package/es/components/table/Actions/component/ExportImport/utils/index.js +0 -11
- package/lib/components/table/Actions/component/ExportImport/utils/index.d.ts +0 -9
- package/lib/components/table/Actions/component/ExportImport/utils/index.js +0 -31
|
@@ -1,141 +1,46 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
-
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); }
|
|
16
1
|
import dayjs from 'dayjs';
|
|
17
2
|
import { locales } from '@pisell/utils';
|
|
18
|
-
import { intersectionBy } from 'lodash';
|
|
19
3
|
import 'dayjs/locale/zh-cn';
|
|
20
4
|
import 'dayjs/locale/en';
|
|
21
5
|
import 'dayjs/locale/zh-tw';
|
|
22
|
-
var Request = /*#__PURE__*/function () {
|
|
23
|
-
function Request() {
|
|
24
|
-
_classCallCheck(this, Request);
|
|
25
|
-
_defineProperty(this, "request", {});
|
|
26
|
-
}
|
|
27
|
-
_createClass(Request, [{
|
|
28
|
-
key: "setRequest",
|
|
29
|
-
value: function setRequest(val) {
|
|
30
|
-
this.request = val;
|
|
31
|
-
}
|
|
32
|
-
}, {
|
|
33
|
-
key: "getRequest",
|
|
34
|
-
value: function getRequest() {
|
|
35
|
-
return this.request;
|
|
36
|
-
}
|
|
37
|
-
}]);
|
|
38
|
-
return Request;
|
|
39
|
-
}();
|
|
40
|
-
export var request = new Request();
|
|
41
6
|
|
|
42
7
|
/**
|
|
43
|
-
* @title:
|
|
44
|
-
* @description:
|
|
45
|
-
* @param {
|
|
46
|
-
* @return {*}
|
|
47
|
-
* @Author: zhiwei.Wang
|
|
48
|
-
* @Date: 2024-04-26 14:00
|
|
49
|
-
*/
|
|
50
|
-
export var getDiscountTime = function getDiscountTime(service_times) {
|
|
51
|
-
if (!service_times) {
|
|
52
|
-
return '';
|
|
53
|
-
}
|
|
54
|
-
if (service_times < 60) {
|
|
55
|
-
return "".concat(service_times, " ").concat(locales.getText('pisell2.text.min'));
|
|
56
|
-
} else {
|
|
57
|
-
var str = '';
|
|
58
|
-
var hours = Math.floor(service_times / 60);
|
|
59
|
-
var minutes = service_times % 60;
|
|
60
|
-
str += "".concat(hours).concat(locales.getText('pisell2.text.h'));
|
|
61
|
-
if (minutes > 0) {
|
|
62
|
-
str += " ".concat(minutes).concat(locales.getText('pisell2.text.min'));
|
|
63
|
-
}
|
|
64
|
-
return str;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @title: 时间切片
|
|
70
|
-
* @description:
|
|
71
|
-
* @param {any} config
|
|
72
|
-
* @param {string} locale
|
|
8
|
+
* @title: 是否英文
|
|
9
|
+
* @description:
|
|
10
|
+
* @param {any} item
|
|
73
11
|
* @return {*}
|
|
74
|
-
* @Author:
|
|
75
|
-
* @Date: 2024-
|
|
12
|
+
* @Author: WangHan
|
|
13
|
+
* @Date: 2024-12-28 22:49
|
|
76
14
|
*/
|
|
77
|
-
export var
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var timeSlices = [];
|
|
86
|
-
var durationSlicesBasedOnTime = [];
|
|
87
|
-
var currentTime = startTime;
|
|
88
|
-
while (currentTime.isBefore(endTime)) {
|
|
89
|
-
var timeLabel = currentTime.format('hh:mm A');
|
|
90
|
-
var timeValue = currentTime.format('HH:mm');
|
|
91
|
-
timeSlices.push({
|
|
92
|
-
label: timeLabel,
|
|
93
|
-
value: timeValue
|
|
94
|
-
});
|
|
95
|
-
var nextTime = currentTime.add(timeSlice, 'minute');
|
|
96
|
-
var durationValue = nextTime.diff(startTime, 'minute');
|
|
97
|
-
if (durationValue > 60) {
|
|
98
|
-
var durationLabel = getDiscountTime(durationValue);
|
|
99
|
-
durationSlicesBasedOnTime.push({
|
|
100
|
-
label: durationLabel,
|
|
101
|
-
value: durationValue
|
|
102
|
-
});
|
|
103
|
-
} else {
|
|
104
|
-
var _durationLabel = "".concat(durationValue, " ").concat(locales.getText('pisell2.text.min'));
|
|
105
|
-
durationSlicesBasedOnTime.push({
|
|
106
|
-
label: _durationLabel,
|
|
107
|
-
value: durationValue
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
currentTime = nextTime;
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
timeSlices: timeSlices,
|
|
114
|
-
durationSlicesBasedOnTime: durationSlicesBasedOnTime
|
|
15
|
+
export var isEn = function isEn(item) {
|
|
16
|
+
var locale = (item === null || item === void 0 ? void 0 : item.locale) || 'en-US';
|
|
17
|
+
var _isEn = locale === 'en-US' || locale === 'en';
|
|
18
|
+
var localeTypes = {
|
|
19
|
+
'en-US': 'en',
|
|
20
|
+
'zh-CN': 'zh-cn',
|
|
21
|
+
'zh-HK': 'zh-tw'
|
|
115
22
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// 获取当前时间
|
|
119
|
-
export var getNowTime = function getNowTime() {
|
|
120
|
-
return dayjs().format('HH:mm');
|
|
121
|
-
};
|
|
122
|
-
export var isNowTime = function isNowTime(time) {
|
|
123
|
-
return time === 'now';
|
|
23
|
+
dayjs.locale(localeTypes[locale]);
|
|
24
|
+
return _isEn;
|
|
124
25
|
};
|
|
125
26
|
|
|
126
27
|
/**
|
|
127
|
-
* @title:
|
|
128
|
-
* @description:
|
|
129
|
-
* @param {
|
|
28
|
+
* @title: 跨日预约时间
|
|
29
|
+
* @description:
|
|
30
|
+
* @param {any} item
|
|
130
31
|
* @return {*}
|
|
131
|
-
* @Author:
|
|
132
|
-
* @Date: 2024-
|
|
32
|
+
* @Author: WangHan
|
|
33
|
+
* @Date: 2024-12-28 22:50
|
|
133
34
|
*/
|
|
134
|
-
export var
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
35
|
+
export var formatMultiDayDate = function formatMultiDayDate(item) {
|
|
36
|
+
var _isEn = isEn(item);
|
|
37
|
+
|
|
38
|
+
// 跨日
|
|
39
|
+
var startDate = dayjs(item === null || item === void 0 ? void 0 : item.start_date);
|
|
40
|
+
var endDate = dayjs(item === null || item === void 0 ? void 0 : item.end_date);
|
|
41
|
+
var _format = _isEn ? 'ddd, DD/MM/YYYY' : 'YYYY-MM-DD,ddd';
|
|
42
|
+
var date = "".concat(startDate.format(_format), " ~ ").concat(endDate.format(_format));
|
|
43
|
+
return date;
|
|
139
44
|
};
|
|
140
45
|
|
|
141
46
|
/**
|
|
@@ -148,8 +53,7 @@ export var getServeStartTime = function getServeStartTime(start_time) {
|
|
|
148
53
|
* @Date: 2024-04-26 14:04
|
|
149
54
|
*/
|
|
150
55
|
export var getServiceTime = function getServiceTime(item, currentDate) {
|
|
151
|
-
|
|
152
|
-
if (!currentDate || !(item !== null && item !== void 0 && (_item$_extend = item._extend) !== null && _item$_extend !== void 0 && _item$_extend.start_time) || !dayjs(currentDate).isValid()) return '';
|
|
56
|
+
if (!dayjs(currentDate).isValid()) return '';
|
|
153
57
|
var locale = (item === null || item === void 0 ? void 0 : item.locale) || 'en-US';
|
|
154
58
|
var isEn = locale === 'en-US' || locale === 'en';
|
|
155
59
|
var localeTypes = {
|
|
@@ -158,552 +62,11 @@ export var getServiceTime = function getServiceTime(item, currentDate) {
|
|
|
158
62
|
'zh-HK': 'zh-tw'
|
|
159
63
|
};
|
|
160
64
|
dayjs.locale(localeTypes[locale]);
|
|
161
|
-
|
|
162
|
-
var
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
var _startDate = dayjs(item === null || item === void 0 ? void 0 : (_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 ? void 0 : _item$_extend4.start_date);
|
|
169
|
-
var endDate = dayjs(item === null || item === void 0 ? void 0 : (_item$_extend5 = item._extend) === null || _item$_extend5 === void 0 ? void 0 : _item$_extend5.end_date);
|
|
170
|
-
var diffInDays = endDate.diff(_startDate, 'day');
|
|
171
|
-
var _format = isEn ? 'ddd, DD/MM/YYYY' : 'YYYY-MM-DD,ddd';
|
|
172
|
-
var date = "".concat(_startDate.format(_format), " ~ ").concat(endDate.format(_format));
|
|
173
|
-
var _duration = "".concat(diffInDays, " ").concat(locales.getText('pisell2.product.card.day')(diffInDays));
|
|
174
|
-
return "".concat(date, " (").concat(_duration, ")");
|
|
175
|
-
}
|
|
176
|
-
var endTime = startDate.add(flexibleObj.getValue(item === null || item === void 0 ? void 0 : (_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.duration), 'minute').format('HH:mm');
|
|
177
|
-
var duration = getDiscountTime(flexibleObj.getValue(item === null || item === void 0 ? void 0 : (_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.duration));
|
|
178
|
-
return "".concat(startTime, " - ").concat(endTime, " ( ").concat(duration, " )");
|
|
179
|
-
};
|
|
180
|
-
export var findNextSlice = function findNextSlice(_ref) {
|
|
181
|
-
var _ref$timeSlices = _ref.timeSlices,
|
|
182
|
-
timeSlices = _ref$timeSlices === void 0 ? [] : _ref$timeSlices,
|
|
183
|
-
_ref$index = _ref.index,
|
|
184
|
-
index = _ref$index === void 0 ? 0 : _ref$index,
|
|
185
|
-
_ref$date = _ref.date,
|
|
186
|
-
date = _ref$date === void 0 ? '' : _ref$date;
|
|
187
|
-
var currentTimeValue = date || dayjs().format('HH:mm');
|
|
188
|
-
|
|
189
|
-
// 遍历时间切片数组,找到最接近的下一个切片时间
|
|
190
|
-
for (var i = 0; i < timeSlices.length; i++) {
|
|
191
|
-
// 排除掉当前时间
|
|
192
|
-
if (timeSlices[i].value !== 'now') {
|
|
193
|
-
if (timeSlices[i].value >= currentTimeValue) {
|
|
194
|
-
return timeSlices[i].value;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// 如果没有找到比当前时间大的切片时间,则返回第一个切片时间作为下一个切片时间
|
|
200
|
-
return timeSlices[index].value;
|
|
201
|
-
};
|
|
202
|
-
export var findNextDuration = function findNextDuration(current, array, defaultValue) {
|
|
203
|
-
for (var i = 0; i < array.length; i++) {
|
|
204
|
-
if (array[i].value == (current === null || current === void 0 ? void 0 : current.value)) {
|
|
205
|
-
return array[i].value;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return defaultValue || array[0].value;
|
|
209
|
-
};
|
|
210
|
-
export var formatProductListByCategory = function formatProductListByCategory(list, filterItem) {
|
|
211
|
-
var _list = list || [];
|
|
212
|
-
if (filterItem) {
|
|
213
|
-
_list = _list.filter(filterItem);
|
|
214
|
-
}
|
|
215
|
-
var categoryObject = {};
|
|
216
|
-
for (var i = 0; i < _list.length; i++) {
|
|
217
|
-
var productItem = _list[i];
|
|
218
|
-
if ((productItem.category || []).length) {
|
|
219
|
-
for (var j = 0; j < productItem.category.length; j++) {
|
|
220
|
-
var categoryItem = productItem.category[j];
|
|
221
|
-
// categoryItem.name = categoryItem.title;
|
|
222
|
-
if (!categoryObject[categoryItem.id]) {
|
|
223
|
-
categoryObject[categoryItem.id] = _objectSpread(_objectSpread({}, categoryItem), {}, {
|
|
224
|
-
products: []
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
categoryObject[categoryItem.id] = _objectSpread(_objectSpread({}, categoryItem), {}, {
|
|
228
|
-
products: [].concat(_toConsumableArray(categoryObject[categoryItem.id].products), [productItem])
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
} else {
|
|
232
|
-
if (!categoryObject['other']) {
|
|
233
|
-
categoryObject['other'] = {
|
|
234
|
-
id: 0,
|
|
235
|
-
title: locales.getText('pisell2.text.other'),
|
|
236
|
-
name: locales.getText('pisell2.text.other'),
|
|
237
|
-
cover: '',
|
|
238
|
-
products: []
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
categoryObject['other'] = _objectSpread(_objectSpread({}, categoryObject['other']), {}, {
|
|
242
|
-
products: [].concat(_toConsumableArray(categoryObject['other'].products), [productItem])
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return Object.values(categoryObject).sort(function (a, b) {
|
|
247
|
-
return b.sort - a.sort;
|
|
248
|
-
});
|
|
249
|
-
};
|
|
250
|
-
export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cacheItem) {
|
|
251
|
-
var startDate = dayjs(cacheItem._extend.start_date.format('YYYY-MM-DD') + ' ' + getServeStartTime(cacheItem._extend.start_time));
|
|
252
|
-
var isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
|
|
253
|
-
|
|
254
|
-
// 是否在最大预约数量的区间内
|
|
255
|
-
var isMaxLimitRange = false;
|
|
256
|
-
|
|
257
|
-
// 是否在日期范围内
|
|
258
|
-
var isDateRange = false;
|
|
259
|
-
var time = _objectSpread({}, item);
|
|
260
|
-
// 已预约的数量 + 当前数量 <= 最大可预约数量 为可预约
|
|
261
|
-
if (time.max_participants_limit == 0) {
|
|
262
|
-
isMaxLimitRange = true;
|
|
263
|
-
} else {
|
|
264
|
-
// unknown 为 未知的, 需要掉接口确认是否可用
|
|
265
|
-
isMaxLimitRange = 'unknown';
|
|
266
|
-
}
|
|
267
|
-
var timeStartDate = dayjs(time.start_date + ' ' + time.start_time).subtract(1, 'second');
|
|
268
|
-
var timeEndDate = dayjs(time.end_date + ' ' + time.end_time).add(1, 'second');
|
|
269
|
-
var bol;
|
|
270
|
-
|
|
271
|
-
// 灵活时长的 只判断开始时间是否在范围内
|
|
272
|
-
if (isFlexible) {
|
|
273
|
-
bol = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
|
|
274
|
-
} else {
|
|
275
|
-
// 其余判断 开始时间 和 结束时间 是否都在范围内
|
|
276
|
-
var endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), 'minute');
|
|
277
|
-
bol = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// 是否在时间范围内
|
|
281
|
-
if (bol) {
|
|
282
|
-
isDateRange = true;
|
|
283
|
-
}
|
|
284
|
-
// 是否可用
|
|
285
|
-
var isUsable = isDateRange;
|
|
286
|
-
|
|
287
|
-
// 储存到拓展数据内
|
|
288
|
-
time._extend = {
|
|
289
|
-
isMaxLimitRange: isMaxLimitRange,
|
|
290
|
-
isDateRange: isDateRange,
|
|
291
|
-
isUsable: isUsable
|
|
292
|
-
};
|
|
293
|
-
return time;
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* @title: 查找是否有可用的time
|
|
298
|
-
* @description:
|
|
299
|
-
* @param {any} resourceItem
|
|
300
|
-
* @return {*}
|
|
301
|
-
* @Author: zhiwei.Wang
|
|
302
|
-
* @Date: 2024-01-09 13:57
|
|
303
|
-
*/
|
|
304
|
-
export var formatTimes = function formatTimes(resourceItem, cacheItem) {
|
|
305
|
-
// 可用的time列表
|
|
306
|
-
var usableTimes = [];
|
|
307
|
-
var _resourceItem = _objectSpread({}, resourceItem);
|
|
308
|
-
// 循环times 区分可用和不可用的 并打上标记
|
|
309
|
-
_resourceItem.times = _resourceItem.times.map(function (time) {
|
|
310
|
-
var _time = getResourceTimeIsUsable(time, cacheItem);
|
|
311
|
-
// 取出可用的列表
|
|
312
|
-
if (_time !== null && _time !== void 0 && _time._extend.isUsable) {
|
|
313
|
-
usableTimes.push(_time);
|
|
314
|
-
}
|
|
315
|
-
return _time;
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
// 获取第一个最佳的time
|
|
319
|
-
var _time = (usableTimes || []).sort(function (a, b) {
|
|
320
|
-
var aEndDate = dayjs(a.end_date + ' ' + a.end_time).valueOf();
|
|
321
|
-
var bEndDate = dayjs(b.end_date + ' ' + b.end_time).valueOf();
|
|
322
|
-
return aEndDate - bEndDate;
|
|
323
|
-
})[0];
|
|
324
|
-
resourceItem._extend = _objectSpread(_objectSpread({}, resourceItem._extend), {}, {
|
|
325
|
-
usableTime: _time
|
|
326
|
-
});
|
|
327
|
-
return resourceItem;
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* @title:
|
|
332
|
-
* @description: 查找是否有可用的商品
|
|
333
|
-
* @param {any} resourceItem
|
|
334
|
-
* @param {any} currentItem
|
|
335
|
-
* @return {*}
|
|
336
|
-
* @Author: zhiwei.Wang
|
|
337
|
-
* @Date: 2024-01-09 13:59
|
|
338
|
-
*/
|
|
339
|
-
var formatResourceProducts = function formatResourceProducts(resourceItem, currentItem) {
|
|
340
|
-
var usableProduct = false;
|
|
341
|
-
var _resourceItem = _objectSpread({}, resourceItem);
|
|
342
|
-
// 商品类型
|
|
343
|
-
var type = _resourceItem.partyroom_package.type;
|
|
344
|
-
|
|
345
|
-
// 全部商品
|
|
346
|
-
if (type === 'product_all') {
|
|
347
|
-
usableProduct = true;
|
|
348
|
-
} else {
|
|
349
|
-
if (type === 'product_collection') {
|
|
350
|
-
var _resourceItem$partyro;
|
|
351
|
-
// 取交集 intersectionBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); // => [{ 'x': 2 }]
|
|
352
|
-
usableProduct = !!intersectionBy(((_resourceItem$partyro = _resourceItem.partyroom_package) === null || _resourceItem$partyro === void 0 ? void 0 : _resourceItem$partyro.products.map(function (item) {
|
|
353
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
354
|
-
id: item.product_collection_id
|
|
355
|
-
});
|
|
356
|
-
})) || [], currentItem.collection || [], 'id').length;
|
|
357
|
-
} else {
|
|
358
|
-
usableProduct = _resourceItem.partyroom_package.products.some(function (item) {
|
|
359
|
-
// 判断商品
|
|
360
|
-
if (type === 'products') {
|
|
361
|
-
if (item.product_id == currentItem.product_id) {
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
resourceItem._extend = _objectSpread(_objectSpread({}, resourceItem._extend), {}, {
|
|
369
|
-
// 是否可用
|
|
370
|
-
usableProduct: usableProduct
|
|
371
|
-
});
|
|
372
|
-
return resourceItem;
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* @title: 获取店铺的营业结束时间
|
|
377
|
-
* @description:
|
|
378
|
-
* @return {*}
|
|
379
|
-
* @Author: zhiwei.Wang
|
|
380
|
-
* @Date: 2024-02-23 10:00
|
|
381
|
-
*/
|
|
382
|
-
export var getShopOpeningHours = function getShopOpeningHours() {
|
|
383
|
-
return localStorage.getItem('shopOpeningHours') || '23:59';
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* @title: 对灵活时长进行处理
|
|
388
|
-
* @description:
|
|
389
|
-
* @return {*}
|
|
390
|
-
* @Author: zhiwei.Wang
|
|
391
|
-
* @Date: 2024-02-23 10:00
|
|
392
|
-
*/
|
|
393
|
-
export var flexibleObj = {
|
|
394
|
-
// 创建, 增加前缀
|
|
395
|
-
create: function create(num) {
|
|
396
|
-
return "flexible_".concat(num);
|
|
397
|
-
},
|
|
398
|
-
// 格式化, 去除前缀
|
|
399
|
-
getValue: function getValue(str) {
|
|
400
|
-
if (typeof str === 'string' && flexibleObj.isFlexible(str)) {
|
|
401
|
-
return Number(str.replace('flexible_', ''));
|
|
402
|
-
}
|
|
403
|
-
return str;
|
|
404
|
-
},
|
|
405
|
-
// 判断当前时长是否为灵活时长
|
|
406
|
-
isFlexible: function isFlexible(str) {
|
|
407
|
-
if (typeof str !== 'string') {
|
|
408
|
-
return false;
|
|
409
|
-
}
|
|
410
|
-
return str.indexOf('flexible_') > -1;
|
|
411
|
-
},
|
|
412
|
-
add: function add(current, duration) {
|
|
413
|
-
if (flexibleObj.isFlexible(current)) {
|
|
414
|
-
return flexibleObj.create(flexibleObj.getValue(current) + duration);
|
|
415
|
-
} else {
|
|
416
|
-
return Number(current) + duration;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* @title: 获取结束时间
|
|
423
|
-
* @description: 取 endDate | 店铺营业时间 最小的那一个
|
|
424
|
-
* @param {any} startDate
|
|
425
|
-
* @param {string} duration
|
|
426
|
-
* @param {any} endDate
|
|
427
|
-
* @return {*}
|
|
428
|
-
* @Author: zhiwei.Wang
|
|
429
|
-
* @Date: 2024-02-23 10:01
|
|
430
|
-
*/
|
|
431
|
-
export var getEndDate = function getEndDate(startDate, duration, endDate) {
|
|
432
|
-
if (duration === 'flexible') {
|
|
433
|
-
// 店铺营业结束时间
|
|
434
|
-
var openingDate = dayjs(startDate.format('YYYY-MM-DD') + ' ' + getShopOpeningHours());
|
|
435
|
-
|
|
436
|
-
// 如果选择的开始时间 > 店铺的营业时间, 店铺营业时间向后推一天
|
|
437
|
-
if (dayjs(startDate).isAfter(openingDate)) {
|
|
438
|
-
openingDate = openingDate.add(1, 'day');
|
|
439
|
-
}
|
|
440
|
-
if (!endDate) {
|
|
441
|
-
return openingDate;
|
|
442
|
-
}
|
|
443
|
-
endDate = dayjs(endDate);
|
|
444
|
-
|
|
445
|
-
// 如果最佳time时间 大于 店铺营业结束时间, 则 取店铺营业时间, 否则为time的结束时间
|
|
446
|
-
if (endDate.isAfter(openingDate)) {
|
|
447
|
-
return openingDate;
|
|
448
|
-
}
|
|
449
|
-
return endDate;
|
|
450
|
-
}
|
|
451
|
-
return startDate.add(duration, 'minute');
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
// export const get
|
|
455
|
-
|
|
456
|
-
export var getServiceTimes = function getServiceTimes(service) {
|
|
457
|
-
var startDate = dayjs(dayjs(service._extend.start_date).format('YYYY-MM-DD ') + getServeStartTime(service._extend.start_time));
|
|
458
|
-
var endDate = startDate.add(flexibleObj.getValue(service._extend.duration), 'minute');
|
|
459
|
-
return {
|
|
460
|
-
startDate: startDate,
|
|
461
|
-
endDate: endDate
|
|
462
|
-
};
|
|
463
|
-
};
|
|
464
|
-
export var getErrorList = function getErrorList(resource, cacheItem) {
|
|
465
|
-
if (!(cacheItem !== null && cacheItem !== void 0 && cacheItem.id)) {
|
|
466
|
-
return [{
|
|
467
|
-
label: locales.getText('pisell2.text.no-product-added'),
|
|
468
|
-
type: 'products'
|
|
469
|
-
}];
|
|
470
|
-
}
|
|
471
|
-
if (!resource || !resource._extend || !cacheItem) {
|
|
472
|
-
return [];
|
|
473
|
-
}
|
|
474
|
-
var list = [];
|
|
475
|
-
// 当前资源不可用
|
|
476
|
-
if (!resource.usable) {
|
|
477
|
-
var _resource$_extend, _resource$_extend2;
|
|
478
|
-
// 挂接的商品不可用
|
|
479
|
-
if (!(resource !== null && resource !== void 0 && (_resource$_extend = resource._extend) !== null && _resource$_extend !== void 0 && _resource$_extend.usableProduct)) {
|
|
480
|
-
list.push({
|
|
481
|
-
label: locales.getText('pisell1.text.resource-error-message-1')(resource.labelText, cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.title),
|
|
482
|
-
type: 'product'
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
var _getServiceTimes = getServiceTimes(cacheItem),
|
|
486
|
-
startDate = _getServiceTimes.startDate,
|
|
487
|
-
endDate = _getServiceTimes.endDate;
|
|
488
|
-
// 如果跨天 结束时间前面加一个明天
|
|
489
|
-
var startText = startDate.format('hh:mm A');
|
|
490
|
-
var endText = endDate.format('hh:mm A');
|
|
491
|
-
if (dayjs(endDate).isAfter(startDate, 'day')) {
|
|
492
|
-
endText = locales.getText('pisell1.text.tomorrow') + endText;
|
|
493
|
-
}
|
|
494
|
-
if (!((_resource$_extend2 = resource._extend) !== null && _resource$_extend2 !== void 0 && _resource$_extend2.usableTime)) {
|
|
495
|
-
list.push({
|
|
496
|
-
label: locales.getText('pisell1.text.resource-error-message-2')(resource.labelText, startText, endText),
|
|
497
|
-
type: 'time'
|
|
498
|
-
});
|
|
499
|
-
} else {
|
|
500
|
-
var _resource$_extend3;
|
|
501
|
-
if (!((_resource$_extend3 = resource._extend) !== null && _resource$_extend3 !== void 0 && _resource$_extend3.usableTime._extend.isMaxLimitRange)) {
|
|
502
|
-
list.push({
|
|
503
|
-
label: locales.getText('pisell1.text.resource-error-message-3')(resource.labelText, startText, endText),
|
|
504
|
-
type: 'limit'
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
return list;
|
|
510
|
-
};
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* @title: 格式化资源, 添加自定义参数
|
|
514
|
-
* @description:
|
|
515
|
-
* @param {any} resourceItem
|
|
516
|
-
* @return {*}
|
|
517
|
-
* @Author: zhiwei.Wang
|
|
518
|
-
* @Date: 2024-01-09 13:40
|
|
519
|
-
*/
|
|
520
|
-
export var formatResource = function formatResource(resourceItem, cacheItem, formatLabel) {
|
|
521
|
-
// 当前资源
|
|
522
|
-
var _resourceItem = _objectSpread({}, resourceItem);
|
|
523
|
-
|
|
524
|
-
// 格式化times里面的数据
|
|
525
|
-
_resourceItem = formatTimes(_resourceItem, cacheItem);
|
|
526
|
-
|
|
527
|
-
// 格式化partyroom_package 里面的数据
|
|
528
|
-
_resourceItem = formatResourceProducts(_resourceItem, cacheItem);
|
|
529
|
-
|
|
530
|
-
// 格式化label
|
|
531
|
-
_resourceItem.labelText = _resourceItem.room_name || _resourceItem.name;
|
|
532
|
-
var usable = _resourceItem._extend.usableTime && _resourceItem._extend.usableProduct;
|
|
533
|
-
_resourceItem.usable = usable;
|
|
534
|
-
if (formatLabel) {
|
|
535
|
-
_resourceItem.label = formatLabel(_resourceItem);
|
|
536
|
-
}
|
|
537
|
-
return _resourceItem;
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
// 获取最后一个服务商品
|
|
541
|
-
export var getLastServer = function getLastServer(list) {
|
|
542
|
-
return list[list.length - 1];
|
|
543
|
-
};
|
|
544
|
-
export var getCacheParams = function getCacheParams() {
|
|
545
|
-
// 从缓存里读默认参数, 如果有 则需要默认选中某些参数, 添加完商品后则删除
|
|
546
|
-
var sessionData = sessionStorage.getItem('pisell2.booking.serviceParams');
|
|
547
|
-
var data = sessionData ? JSON.parse(sessionData) : null;
|
|
548
|
-
return data === null || data === void 0 ? void 0 : data.serviceParams;
|
|
549
|
-
};
|
|
550
|
-
export var deleteCacheParams = function deleteCacheParams() {
|
|
551
|
-
sessionStorage.removeItem('pisell2.booking.serviceParams');
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* @title: 创建一个服务商品
|
|
556
|
-
* @description:
|
|
557
|
-
* @param {any} state
|
|
558
|
-
* @param {any} item
|
|
559
|
-
* @return {*}
|
|
560
|
-
* @Author: zhiwei.Wang
|
|
561
|
-
* @Date: 2024-01-26 14:09
|
|
562
|
-
*/
|
|
563
|
-
export var getServerItemExtend = function getServerItemExtend(state, cacheItem, timeObj) {
|
|
564
|
-
var _cacheItem$duration;
|
|
565
|
-
// 编辑直接返回原数据
|
|
566
|
-
if (!cacheItem.new && cacheItem._extend.endDate) {
|
|
567
|
-
return cacheItem._extend;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// 获取上一个服务商品
|
|
571
|
-
var lastServer = getLastServer(state.service.value);
|
|
572
|
-
|
|
573
|
-
// 下一个商品的扩展参数
|
|
574
|
-
var _extend = {
|
|
575
|
-
duration: findNextDuration(cacheItem.duration, timeObj.durationSlicesBasedOnTime, cacheItem === null || cacheItem === void 0 ? void 0 : (_cacheItem$duration = cacheItem.duration) === null || _cacheItem$duration === void 0 ? void 0 : _cacheItem$duration.value)
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
// 如果有上一个商品, 将上一个商品的某些参数 设置到新商品上
|
|
579
|
-
if (lastServer) {
|
|
580
|
-
// 选中上一个商品的资源
|
|
581
|
-
_extend.resource = lastServer._extend.resource;
|
|
582
|
-
var lastServerStartDate = lastServer._extend.startDate;
|
|
583
|
-
var lastServerEndDate = lastServer._extend.endDate;
|
|
584
|
-
// 如果上个服务商品的结束时间跨天, 那么设置为最后一个时间段, 不跨天则取上一个的结束时间
|
|
585
|
-
if (dayjs(lastServerEndDate).isAfter(lastServerStartDate, 'day')) {
|
|
586
|
-
_extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1].value;
|
|
587
|
-
} else {
|
|
588
|
-
_extend.start_time = lastServerEndDate.format('HH:mm');
|
|
589
|
-
}
|
|
590
|
-
} else {
|
|
591
|
-
// 没有上一个商品 资源为 0
|
|
592
|
-
// _extend.resource = 0;
|
|
593
|
-
|
|
594
|
-
var findNextSliceProps = {
|
|
595
|
-
timeSlices: timeObj.timeSlices,
|
|
596
|
-
index: 0,
|
|
597
|
-
date: ''
|
|
598
|
-
};
|
|
599
|
-
|
|
600
|
-
// 从缓存里读默认参数, 如果有 则需要默认选中某些参数, 添加完商品后则删除
|
|
601
|
-
var serviceParams = getCacheParams();
|
|
602
|
-
if (serviceParams) {
|
|
603
|
-
var str = serviceParams.start_date;
|
|
604
|
-
if (str) {
|
|
605
|
-
// 选中开始时间
|
|
606
|
-
findNextSliceProps.date = dayjs(str).format('HH:mm');
|
|
607
|
-
}
|
|
608
|
-
// 选中资源
|
|
609
|
-
var resourceId = Number(serviceParams.resource_id);
|
|
610
|
-
if (resourceId || resourceId === 0) {
|
|
611
|
-
_extend.resource = resourceId;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
// 只有选择了带 HH:mm的日期才选中, 否则使用当前日期
|
|
616
|
-
if (findNextSliceProps.date && findNextSliceProps.date !== '00:00') {
|
|
617
|
-
_extend.start_time = findNextSlice(findNextSliceProps);
|
|
618
|
-
} else {
|
|
619
|
-
if (cacheItem.currentDefaultTime) {
|
|
620
|
-
_extend.start_time = cacheItem.currentDefaultTime;
|
|
621
|
-
} else {
|
|
622
|
-
// 没有预设日期, 则使用当前 https://www.yuque.com/feg4xm/manual/tzvrnt05ifihkndg
|
|
623
|
-
_extend.start_time = dayjs().format('HH:mm');
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
_extend = _objectSpread(_objectSpread({}, _extend), cacheItem._extend);
|
|
628
|
-
return _extend;
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
// 商品价格: (商品价格 + (套餐价格 + 单规格价格 * 单规格数量) * 套餐数量) * 商品数量
|
|
632
|
-
export var getProductTotalPrice = function getProductTotalPrice(item) {
|
|
633
|
-
var _item$_extend8;
|
|
634
|
-
var price = 0;
|
|
635
|
-
price += Number(item._extend.price);
|
|
636
|
-
var other = (_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.other;
|
|
637
|
-
if (other !== null && other !== void 0 && other.bundle) {
|
|
638
|
-
// bundle
|
|
639
|
-
price = other === null || other === void 0 ? void 0 : other.bundle.reduce(function (accumulator, currentValue) {
|
|
640
|
-
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
641
|
-
}, price);
|
|
642
|
-
}
|
|
643
|
-
price = price;
|
|
644
|
-
return price;
|
|
645
|
-
};
|
|
646
|
-
/**
|
|
647
|
-
* @title: 判断 duration
|
|
648
|
-
* @description: 用于处理不同格式的duration
|
|
649
|
-
* @param {number} duration
|
|
650
|
-
* @return {*}
|
|
651
|
-
* @Author: zhiwei.Wang
|
|
652
|
-
* @Date: 2024-02-23 10:02
|
|
653
|
-
*/
|
|
654
|
-
export var getDuration = function getDuration(duration) {
|
|
655
|
-
// number 为 minutes
|
|
656
|
-
if (typeof duration === 'number') {
|
|
657
|
-
return duration;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// 对象结构 判断是分钟还是灵活时长
|
|
661
|
-
if (_typeof(duration) === 'object') {
|
|
662
|
-
if (duration.type === 'minutes') {
|
|
663
|
-
return duration.value;
|
|
664
|
-
}
|
|
665
|
-
if (duration.type === 'flexible') {
|
|
666
|
-
return 'flexible';
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
return duration;
|
|
670
|
-
};
|
|
671
|
-
export var isWalkIn = function isWalkIn(customer_id) {
|
|
672
|
-
if (customer_id === undefined) {
|
|
673
|
-
return true;
|
|
674
|
-
}
|
|
675
|
-
if (typeof customer_id === 'string') {
|
|
676
|
-
return ['', '0', '1'].includes(customer_id);
|
|
677
|
-
}
|
|
678
|
-
return [0, 1].includes(customer_id);
|
|
679
|
-
};
|
|
680
|
-
export var getIsEdit = function getIsEdit(state) {
|
|
681
|
-
var _state$addons, _state$client, _state$date, _state$pet, _state$service, _state$notes, _state$contacts;
|
|
682
|
-
if ((_state$addons = state.addons) !== null && _state$addons !== void 0 && _state$addons.edit) {
|
|
683
|
-
return true;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
// info 是否有编辑
|
|
687
|
-
if (!state.bookingId) {
|
|
688
|
-
return true;
|
|
689
|
-
}
|
|
690
|
-
if ((_state$client = state.client) !== null && _state$client !== void 0 && _state$client.edit) {
|
|
691
|
-
return true;
|
|
692
|
-
}
|
|
693
|
-
if ((_state$date = state.date) !== null && _state$date !== void 0 && _state$date.edit) {
|
|
694
|
-
return true;
|
|
695
|
-
}
|
|
696
|
-
if ((_state$pet = state.pet) !== null && _state$pet !== void 0 && _state$pet.edit) {
|
|
697
|
-
return true;
|
|
698
|
-
}
|
|
699
|
-
if ((_state$service = state.service) !== null && _state$service !== void 0 && _state$service.edit) {
|
|
700
|
-
return true;
|
|
701
|
-
}
|
|
702
|
-
if ((_state$notes = state.notes) !== null && _state$notes !== void 0 && _state$notes.edit) {
|
|
703
|
-
return true;
|
|
704
|
-
}
|
|
705
|
-
if ((_state$contacts = state.contacts) !== null && _state$contacts !== void 0 && _state$contacts.edit) {
|
|
706
|
-
return true;
|
|
707
|
-
}
|
|
708
|
-
return false;
|
|
65
|
+
var startDate = dayjs(item === null || item === void 0 ? void 0 : item.start_date);
|
|
66
|
+
var endDate = dayjs(item === null || item === void 0 ? void 0 : item.end_date);
|
|
67
|
+
var diffInDays = endDate.diff(startDate, 'day');
|
|
68
|
+
var _format = isEn ? 'ddd, DD/MM/YYYY' : 'YYYY-MM-DD,ddd';
|
|
69
|
+
var date = "".concat(startDate.format(_format), " ~ ").concat(endDate.format(_format));
|
|
70
|
+
var duration = "".concat(diffInDays, " ").concat(locales.getText('pisell2.product.card.day')(diffInDays));
|
|
71
|
+
return "".concat(date, " (").concat(duration, ")");
|
|
709
72
|
};
|