@pisell/private-materials 3.0.166 → 3.0.167
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/render/default/view.js +9 -9
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/addons/model.d.ts +1 -2
- package/es/components/booking/forms/model.d.ts +1 -2
- package/es/components/booking/info/utils.js +1 -1
- package/es/components/booking/info2/service/addService/utils.js +26 -13
- package/es/components/booking/info2/service/editService/index.js +29 -25
- package/es/components/booking/info2/utilsByBooking.js +46 -34
- package/es/components/booking/materiels/duration/index.d.ts +2 -2
- package/es/components/booking/materiels/duration/index.js +11 -11
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -2
- package/es/components/booking/payments/model.d.ts +1 -2
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -2
- package/lib/components/booking/addons/model.d.ts +1 -2
- package/lib/components/booking/forms/model.d.ts +1 -2
- package/lib/components/booking/info/utils.js +1 -1
- package/lib/components/booking/info2/service/addService/utils.js +13 -11
- package/lib/components/booking/info2/service/editService/index.js +20 -15
- package/lib/components/booking/info2/utilsByBooking.js +22 -14
- package/lib/components/booking/materiels/duration/index.d.ts +2 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -2
- package/lib/components/booking/payments/model.d.ts +1 -2
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/package.json +3 -3
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -88,6 +88,6 @@ export var isBooking4Shop = function isBooking4Shop(shopId, renderType) {
|
|
|
88
88
|
if (renderType === 'eventBooking') {
|
|
89
89
|
return false;
|
|
90
90
|
}
|
|
91
|
-
var booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007];
|
|
91
|
+
var booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320];
|
|
92
92
|
return booking4Shops.includes(shopId);
|
|
93
93
|
};
|
|
@@ -80,9 +80,9 @@ export var getFlexibleOption = function getFlexibleOption(_ref2) {
|
|
|
80
80
|
});
|
|
81
81
|
var _duration = _durationProps.duration;
|
|
82
82
|
if (_duration === 'flexible') {
|
|
83
|
-
var _durationProps$usable, _durationProps$usable2;
|
|
83
|
+
var _durationProps$usable, _durationProps$usable2, _durationProps$usable3, _durationProps$usable4, _durationProps$usable5, _durationProps$usable6;
|
|
84
84
|
// 获取结束时间
|
|
85
|
-
var endDate = getEndDate(_durationProps.startDate, _duration, (_durationProps$usable = _durationProps.usableTime) !== null && _durationProps$usable !== void 0 && _durationProps$usable.end_at ? dayjs((_durationProps$
|
|
85
|
+
var endDate = getEndDate(_durationProps.startDate, _duration, (_durationProps$usable = _durationProps.usableTime) !== null && _durationProps$usable !== void 0 && (_durationProps$usable2 = _durationProps$usable._extend) !== null && _durationProps$usable2 !== void 0 && (_durationProps$usable3 = _durationProps$usable2.usableTime) !== null && _durationProps$usable3 !== void 0 && _durationProps$usable3.end_at ? dayjs((_durationProps$usable4 = _durationProps.usableTime) === null || _durationProps$usable4 === void 0 ? void 0 : (_durationProps$usable5 = _durationProps$usable4._extend) === null || _durationProps$usable5 === void 0 ? void 0 : (_durationProps$usable6 = _durationProps$usable5.usableTime) === null || _durationProps$usable6 === void 0 ? void 0 : _durationProps$usable6.end_at) : null);
|
|
86
86
|
// 转换为分钟
|
|
87
87
|
var timeValue = endDate.diff(_durationProps.startDate, 'minute');
|
|
88
88
|
return {
|
|
@@ -239,7 +239,7 @@ export var setDefaultResource = function setDefaultResource(_ref6) {
|
|
|
239
239
|
var defaultResource = item.renderList.filter(function (d) {
|
|
240
240
|
return d.is_default == 1 || d.id === resourceId;
|
|
241
241
|
}).map(function (d) {
|
|
242
|
-
return {
|
|
242
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
243
243
|
relation_type: d.relation_type,
|
|
244
244
|
form_id: item.form_id,
|
|
245
245
|
relation_id: d.id,
|
|
@@ -250,7 +250,7 @@ export var setDefaultResource = function setDefaultResource(_ref6) {
|
|
|
250
250
|
form_name: item.title,
|
|
251
251
|
resource_name: d.main_field
|
|
252
252
|
}
|
|
253
|
-
};
|
|
253
|
+
});
|
|
254
254
|
});
|
|
255
255
|
obj[item.form_id] = defaultResource;
|
|
256
256
|
};
|
|
@@ -465,11 +465,13 @@ export var getProductExtend = function getProductExtend(_ref8) {
|
|
|
465
465
|
|
|
466
466
|
// 再次计算, 灵活时长
|
|
467
467
|
if (getDuration(_cacheItem === null || _cacheItem === void 0 ? void 0 : _cacheItem.duration)) {
|
|
468
|
-
_cacheItem._data.
|
|
469
|
-
cacheItem:
|
|
468
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
469
|
+
cacheItem: _cacheItem,
|
|
470
|
+
useStartTime: _cacheItem._extend.start_time,
|
|
470
471
|
currentResource: _cacheItem._extend.resource,
|
|
471
472
|
state: state
|
|
472
473
|
});
|
|
474
|
+
_cacheItem._extend.duration = _cacheItem._data.timeObj.durationSlicesBasedOnTime[0].value;
|
|
473
475
|
}
|
|
474
476
|
|
|
475
477
|
// 如果只有一种类型的资源 & 单选,还按照之前的逻辑处理:自动选中,不会打开Edit service抽屉。
|
|
@@ -479,13 +481,14 @@ export var getProductExtend = function getProductExtend(_ref8) {
|
|
|
479
481
|
}
|
|
480
482
|
_cacheItem._time = new Date().getTime();
|
|
481
483
|
} else {
|
|
482
|
-
if (!_cacheItem._data.
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
484
|
+
// if (!_cacheItem._data.timeObj) {
|
|
485
|
+
// _cacheItem._data.timeObj = getTimeObj({
|
|
486
|
+
// cacheItem: _cacheItem,
|
|
487
|
+
// currentResource: _cacheItem._extend.resource,
|
|
488
|
+
// state,
|
|
489
|
+
// });
|
|
490
|
+
// }
|
|
491
|
+
|
|
489
492
|
if (!_cacheItem._data.capacitys) {
|
|
490
493
|
// 容量
|
|
491
494
|
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
@@ -504,7 +507,17 @@ export var getProductExtend = function getProductExtend(_ref8) {
|
|
|
504
507
|
_cacheItem._data.resources = _list2;
|
|
505
508
|
_cacheItem._data.resourceMaps = _maps;
|
|
506
509
|
}
|
|
510
|
+
|
|
511
|
+
// if (!_cacheItem._data.timeObj) {
|
|
512
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
513
|
+
cacheItem: _cacheItem,
|
|
514
|
+
useStartTime: _cacheItem._extend.start_time,
|
|
515
|
+
currentResource: _cacheItem._extend.resource,
|
|
516
|
+
state: state
|
|
517
|
+
});
|
|
518
|
+
// }
|
|
507
519
|
}
|
|
520
|
+
|
|
508
521
|
console.log('_cacheItem_cacheItem', _cacheItem);
|
|
509
522
|
return _cacheItem;
|
|
510
523
|
};
|
|
@@ -31,10 +31,10 @@ import { useUpdateEffect, useMemoizedFn } from 'ahooks';
|
|
|
31
31
|
// import SelectTime from "../../../../../../../materials/src/components/select-time";
|
|
32
32
|
import { getServiceTimes, deleteCacheParams, getProductTotalPrice } from "../../../utils";
|
|
33
33
|
import { getErrorList } from "../../utilsByBooking";
|
|
34
|
-
import { formatResources, getDurationProps, getFlexibleOption } from "../addService/utils";
|
|
34
|
+
import { formatResources, getDurationProps, getFlexibleOption, getTimeObj } from "../addService/utils";
|
|
35
35
|
var submitLock = false;
|
|
36
36
|
var Info = function Info(_, ref) {
|
|
37
|
-
var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$
|
|
37
|
+
var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$service$cacheI4, _state$service$cacheI5, _state$service$cacheI6, _state$service$cacheI7, _state$service3, _state$service3$cache, _state$service5, _state$service5$cache, _state$service5$cache2, _state$service5$cache3, _window$BaseMaterials, _state$service$cacheI8, _state$service6, _state$service6$cache, _state$service6$cache2, _state$service$cacheI9, _state$service$cacheI10, _state$service$cacheI11, _state$service$cacheI12, _state$bookingConfig5, _state$bookingConfig6, _state$bookingConfig7, _state$bookingConfig8, _state$service$resour;
|
|
38
38
|
var _Form$useForm = Form.useForm(),
|
|
39
39
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
40
40
|
form = _Form$useForm2[0];
|
|
@@ -112,10 +112,14 @@ var Info = function Info(_, ref) {
|
|
|
112
112
|
* @Date: 2024-01-09 13:37
|
|
113
113
|
*/
|
|
114
114
|
var timeObj = useMemo(function () {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
return getTimeObj({
|
|
116
|
+
durationProps: durationProps,
|
|
117
|
+
useStartTime: useStartTime,
|
|
118
|
+
currentResource: currentResource,
|
|
119
|
+
state: state,
|
|
120
|
+
useDuration: useDuration
|
|
121
|
+
});
|
|
122
|
+
}, [durationProps, useStartTime, currentResource, state, useDuration]);
|
|
119
123
|
// 由于灵活时长的结束时间随时变动, 这里发现如果当前选择的值没有在列表内,则选择最新的灵活时长值
|
|
120
124
|
useEffect(function () {
|
|
121
125
|
try {
|
|
@@ -137,12 +141,12 @@ var Info = function Info(_, ref) {
|
|
|
137
141
|
* @Date: 2024-01-09 13:59
|
|
138
142
|
*/
|
|
139
143
|
var handleDeleteProduct = function handleDeleteProduct() {
|
|
140
|
-
var _state$service$
|
|
144
|
+
var _state$service$cacheI;
|
|
141
145
|
if (state.channelDisabledEdit) {
|
|
142
146
|
return;
|
|
143
147
|
}
|
|
144
148
|
var _list = _toConsumableArray(state.service.value);
|
|
145
|
-
var _id = (_state$service$
|
|
149
|
+
var _id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
|
|
146
150
|
_list = _list.filter(function (d) {
|
|
147
151
|
return d._id !== _id;
|
|
148
152
|
});
|
|
@@ -165,8 +169,8 @@ var Info = function Info(_, ref) {
|
|
|
165
169
|
* @Date: 2024-01-09 14:03
|
|
166
170
|
*/
|
|
167
171
|
var getDiscount = function getDiscount() {
|
|
168
|
-
var _state$service$
|
|
169
|
-
var oPrice = Number(((_state$service$
|
|
172
|
+
var _state$service$cacheI2;
|
|
173
|
+
var oPrice = Number(((_state$service$cacheI2 = state.service.cacheItem) === null || _state$service$cacheI2 === void 0 ? void 0 : _state$service$cacheI2._extend.origin_total) || 0);
|
|
170
174
|
var cPrice = Number(useTotal || 0);
|
|
171
175
|
var discount = '';
|
|
172
176
|
// 原价 = 现价 为无折扣
|
|
@@ -273,12 +277,12 @@ var Info = function Info(_, ref) {
|
|
|
273
277
|
* @Date: 2024-01-09 14:06
|
|
274
278
|
*/
|
|
275
279
|
var isReason = useMemo(function () {
|
|
276
|
-
var _state$service$
|
|
277
|
-
var oPrice = Number(((_state$service$
|
|
280
|
+
var _state$service$cacheI3;
|
|
281
|
+
var oPrice = Number(((_state$service$cacheI3 = state.service.cacheItem) === null || _state$service$cacheI3 === void 0 ? void 0 : _state$service$cacheI3._extend.origin_total) || 0);
|
|
278
282
|
var cPrice = Number(useTotal || 0);
|
|
279
283
|
// 原价 !== 现价
|
|
280
284
|
return cPrice !== oPrice;
|
|
281
|
-
}, [useTotal, (_state$service$
|
|
285
|
+
}, [useTotal, (_state$service$cacheI4 = state.service.cacheItem) === null || _state$service$cacheI4 === void 0 ? void 0 : (_state$service$cacheI5 = _state$service$cacheI4._extend) === null || _state$service$cacheI5 === void 0 ? void 0 : _state$service$cacheI5.origin_total]);
|
|
282
286
|
var getResources = function getResources() {
|
|
283
287
|
var res = formatResources({
|
|
284
288
|
cacheItem: getCurrentCacheItem(),
|
|
@@ -352,18 +356,18 @@ var Info = function Info(_, ref) {
|
|
|
352
356
|
*/
|
|
353
357
|
useEffect(function () {
|
|
354
358
|
getDiscount();
|
|
355
|
-
}, [useTotal, (_state$service$
|
|
359
|
+
}, [useTotal, (_state$service$cacheI6 = state.service.cacheItem) === null || _state$service$cacheI6 === void 0 ? void 0 : (_state$service$cacheI7 = _state$service$cacheI6._extend) === null || _state$service$cacheI7 === void 0 ? void 0 : _state$service$cacheI7.origin_total]);
|
|
356
360
|
var isDiscount = useMemo(function () {
|
|
357
|
-
var _state$
|
|
358
|
-
if (!((_state$
|
|
361
|
+
var _state$service, _state$service2, _state$service2$cache;
|
|
362
|
+
if (!((_state$service = state.service) !== null && _state$service !== void 0 && _state$service.cacheItem)) {
|
|
359
363
|
return false;
|
|
360
364
|
}
|
|
361
|
-
return useTotal != ((_state$
|
|
362
|
-
}, [useTotal, (_state$
|
|
365
|
+
return useTotal != ((_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : (_state$service2$cache = _state$service2.cacheItem) === null || _state$service2$cache === void 0 ? void 0 : _state$service2$cache._extend.origin_total);
|
|
366
|
+
}, [useTotal, (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : (_state$service3$cache = _state$service3.cacheItem) === null || _state$service3$cache === void 0 ? void 0 : _state$service3$cache._extend.origin_total]);
|
|
363
367
|
var bundles = useMemo(function () {
|
|
364
|
-
var _state$
|
|
365
|
-
return ((_state$
|
|
366
|
-
}, [(_state$
|
|
368
|
+
var _state$service4, _state$service4$cache, _state$service4$cache2, _state$service4$cache3;
|
|
369
|
+
return ((_state$service4 = state.service) === null || _state$service4 === void 0 ? void 0 : (_state$service4$cache = _state$service4.cacheItem) === null || _state$service4$cache === void 0 ? void 0 : (_state$service4$cache2 = _state$service4$cache._extend) === null || _state$service4$cache2 === void 0 ? void 0 : (_state$service4$cache3 = _state$service4$cache2.other) === null || _state$service4$cache3 === void 0 ? void 0 : _state$service4$cache3.bundle) || [];
|
|
370
|
+
}, [(_state$service5 = state.service) === null || _state$service5 === void 0 ? void 0 : (_state$service5$cache = _state$service5.cacheItem) === null || _state$service5$cache === void 0 ? void 0 : (_state$service5$cache2 = _state$service5$cache._extend) === null || _state$service5$cache2 === void 0 ? void 0 : (_state$service5$cache3 = _state$service5$cache2.other) === null || _state$service5$cache3 === void 0 ? void 0 : _state$service5$cache3.bundle]);
|
|
367
371
|
|
|
368
372
|
/**
|
|
369
373
|
* @title: 编辑商品
|
|
@@ -470,7 +474,7 @@ var Info = function Info(_, ref) {
|
|
|
470
474
|
,
|
|
471
475
|
zIndex: state.service.changeService ? 999 : 1000,
|
|
472
476
|
forceRender: true,
|
|
473
|
-
open: state.service.editModal && !((_state$service$
|
|
477
|
+
open: state.service.editModal && !((_state$service$cacheI8 = state.service.cacheItem) !== null && _state$service$cacheI8 !== void 0 && _state$service$cacheI8.autoClose),
|
|
474
478
|
title: locales.getText('pisell2.text.edit-service'),
|
|
475
479
|
onClose: function onClose() {
|
|
476
480
|
dispatch({
|
|
@@ -503,7 +507,7 @@ var Info = function Info(_, ref) {
|
|
|
503
507
|
className: "current-service-info-name-wrap"
|
|
504
508
|
}, /*#__PURE__*/React.createElement("div", {
|
|
505
509
|
className: "current-service-info-name"
|
|
506
|
-
}, ((_state$
|
|
510
|
+
}, ((_state$service6 = state.service) === null || _state$service6 === void 0 ? void 0 : (_state$service6$cache = _state$service6.cacheItem) === null || _state$service6$cache === void 0 ? void 0 : (_state$service6$cache2 = _state$service6$cache._extend) === null || _state$service6$cache2 === void 0 ? void 0 : _state$service6$cache2.product_name) || '-'), /*#__PURE__*/React.createElement(Button, {
|
|
507
511
|
onClick: handleEdit
|
|
508
512
|
}, locales.getText('pisell2.text.edit')), !state.isBookingCreatePage && /*#__PURE__*/React.createElement(Button, {
|
|
509
513
|
onClick: handleChange
|
|
@@ -532,8 +536,8 @@ var Info = function Info(_, ref) {
|
|
|
532
536
|
width: '100%'
|
|
533
537
|
},
|
|
534
538
|
min: 0,
|
|
535
|
-
max: ((_state$service$
|
|
536
|
-
placeholder: ((_state$service$
|
|
539
|
+
max: ((_state$service$cacheI9 = state.service.cacheItem) === null || _state$service$cacheI9 === void 0 ? void 0 : (_state$service$cacheI10 = _state$service$cacheI9._extend) === null || _state$service$cacheI10 === void 0 ? void 0 : _state$service$cacheI10.origin_total) || 0,
|
|
540
|
+
placeholder: ((_state$service$cacheI11 = state.service.cacheItem) === null || _state$service$cacheI11 === void 0 ? void 0 : (_state$service$cacheI12 = _state$service$cacheI11._extend) === null || _state$service$cacheI12 === void 0 ? void 0 : _state$service$cacheI12.origin_total) || '0'
|
|
537
541
|
}))), /*#__PURE__*/React.createElement(Col, {
|
|
538
542
|
span: 12
|
|
539
543
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
@@ -71,6 +71,8 @@ export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cach
|
|
|
71
71
|
// 已预约的列表
|
|
72
72
|
var eventList = time.event_list || [];
|
|
73
73
|
var endDate = null;
|
|
74
|
+
// 是否去计算数量
|
|
75
|
+
var isCalcCount = true;
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
78
|
* 从这里为判断是否在时间范围内
|
|
@@ -84,6 +86,14 @@ export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cach
|
|
|
84
86
|
}, dayjs(eventList[0].end_at));
|
|
85
87
|
}
|
|
86
88
|
isDateRange = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
|
|
89
|
+
|
|
90
|
+
// 如果灵活时长不在范围内, 则认为是已约满
|
|
91
|
+
if (!isDateRange && eventList.length) {
|
|
92
|
+
isCalcCount = false;
|
|
93
|
+
isDateRange = true;
|
|
94
|
+
isCountRange = false;
|
|
95
|
+
}
|
|
96
|
+
// debugger
|
|
87
97
|
} else {
|
|
88
98
|
// 其余判断 开始时间 和 结束时间 是否都在范围内
|
|
89
99
|
endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), "minute");
|
|
@@ -94,46 +104,48 @@ export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cach
|
|
|
94
104
|
isDateRange = true;
|
|
95
105
|
}
|
|
96
106
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
if (isCalcCount) {
|
|
108
|
+
// 如果 预约人数超过总容量, 则不可用
|
|
109
|
+
// if (totalCount < currentCount) {
|
|
110
|
+
// isCountRange = false;
|
|
111
|
+
// } else {
|
|
112
|
+
/**
|
|
113
|
+
* 从这里判断预约量
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
// 取出已预约列表和当前预约重叠的时间段
|
|
117
|
+
var conflict = (time.event_list || []).filter(function (d) {
|
|
118
|
+
return isConflict({
|
|
119
|
+
start_at: d.start_at,
|
|
120
|
+
end_at: d.end_at
|
|
121
|
+
}, {
|
|
122
|
+
start_at: startDate,
|
|
123
|
+
end_at: endDate
|
|
124
|
+
});
|
|
113
125
|
});
|
|
114
|
-
});
|
|
115
126
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
// 同一时间段内只能进行一个预约,无论容量是否已满。
|
|
128
|
+
if (resourceItem.resourceType === 'single') {
|
|
129
|
+
// 0代表着不重叠,则满足条件
|
|
130
|
+
if (conflict.length === 0) {
|
|
131
|
+
isCountRange = true;
|
|
132
|
+
} else {
|
|
133
|
+
isCountRange = false;
|
|
134
|
+
}
|
|
121
135
|
} else {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
} else {
|
|
125
|
-
// 减去重叠的总量
|
|
126
|
-
var conflictCount = getUseableEventCount(conflict, resourceItem.capacity);
|
|
136
|
+
// 减去重叠的总量
|
|
137
|
+
var conflictCount = getUseableEventCount(conflict, resourceItem.capacity);
|
|
127
138
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
// 当前预约量 <= 总剩余容量
|
|
140
|
+
if (currentCount <= conflictCount) {
|
|
141
|
+
isCountRange = true;
|
|
142
|
+
} else {
|
|
143
|
+
isCountRange = false;
|
|
144
|
+
}
|
|
133
145
|
}
|
|
134
|
-
}
|
|
135
146
|
|
|
136
|
-
|
|
147
|
+
// }
|
|
148
|
+
}
|
|
137
149
|
|
|
138
150
|
// 是否可用 只判断是否在日期范围内,
|
|
139
151
|
var isUsable = isDateRange && isCountRange;
|
|
@@ -3,14 +3,14 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
3
3
|
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); }
|
|
4
4
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
import { Select } from
|
|
7
|
-
import React, { useCallback, useEffect, useMemo } from
|
|
6
|
+
import { Select } from 'antd';
|
|
7
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
8
8
|
import { sliceDayIntoFiveMinutes, getEndDate, flexibleObj, getDiscountTime } from "../../utils";
|
|
9
|
-
import dayjs from
|
|
10
|
-
import { locales } from
|
|
9
|
+
import dayjs from 'dayjs';
|
|
10
|
+
import { locales } from '@pisell/utils';
|
|
11
11
|
var Duration = function Duration(props) {
|
|
12
12
|
var _props$locale = props.locale,
|
|
13
|
-
locale = _props$locale === void 0 ?
|
|
13
|
+
locale = _props$locale === void 0 ? 'en' : _props$locale,
|
|
14
14
|
_props$slice = props.slice,
|
|
15
15
|
slice = _props$slice === void 0 ? 5 : _props$slice,
|
|
16
16
|
timeObjChange = props.timeObjChange,
|
|
@@ -34,15 +34,15 @@ var Duration = function Duration(props) {
|
|
|
34
34
|
}
|
|
35
35
|
var _sliceDayIntoFiveMinu = sliceDayIntoFiveMinutes(slice, locale),
|
|
36
36
|
durationSlicesBasedOnTime = _sliceDayIntoFiveMinu.durationSlicesBasedOnTime;
|
|
37
|
-
var _duration = _typeof(duration) ===
|
|
37
|
+
var _duration = _typeof(duration) === 'object' ? duration.type : duration;
|
|
38
38
|
// 灵活时长
|
|
39
|
-
if (_duration ===
|
|
39
|
+
if (_duration === 'flexible') {
|
|
40
40
|
var endDate = getEndDate(startDate, _duration, usableTime !== null && usableTime !== void 0 && usableTime.end_at ? dayjs(usableTime === null || usableTime === void 0 ? void 0 : usableTime.end_at) : null);
|
|
41
|
-
var timeValue = endDate.diff(startDate,
|
|
41
|
+
var timeValue = endDate.diff(startDate, 'minute');
|
|
42
42
|
|
|
43
43
|
// 动态获取结束时间
|
|
44
44
|
durationSlicesBasedOnTime.unshift({
|
|
45
|
-
label: locales.getText(
|
|
45
|
+
label: locales.getText('pisell2.text.flexible'),
|
|
46
46
|
value: flexibleObj.create(timeValue)
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -62,8 +62,8 @@ var Duration = function Duration(props) {
|
|
|
62
62
|
timeObjChange === null || timeObjChange === void 0 ? void 0 : timeObjChange(times);
|
|
63
63
|
}, [times]);
|
|
64
64
|
var renderOptions = useCallback(function (array) {
|
|
65
|
-
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
66
|
-
var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
65
|
+
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
|
|
66
|
+
var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
|
|
67
67
|
return array.map(function (d) {
|
|
68
68
|
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
69
69
|
value: d[value],
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
3
2
|
import dayjs from "dayjs";
|
|
4
3
|
export interface FormState {
|
|
@@ -69,7 +68,7 @@ export interface FormState {
|
|
|
69
68
|
};
|
|
70
69
|
setGlobalState: Function | null;
|
|
71
70
|
}
|
|
72
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
71
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
73
72
|
state: FormState;
|
|
74
73
|
} & {
|
|
75
74
|
dispatch: (params: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -83,7 +83,7 @@ var isBooking4Shop = (shopId, renderType) => {
|
|
|
83
83
|
if (renderType === "eventBooking") {
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
|
-
const booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007];
|
|
86
|
+
const booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320];
|
|
87
87
|
return booking4Shops.includes(shopId);
|
|
88
88
|
};
|
|
89
89
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -90,7 +90,7 @@ var getFlexibleOption = ({
|
|
|
90
90
|
slice,
|
|
91
91
|
durationProps
|
|
92
92
|
}) => {
|
|
93
|
-
var _a, _b;
|
|
93
|
+
var _a, _b, _c, _d, _e, _f;
|
|
94
94
|
const _durationProps = durationProps || getDurationProps({
|
|
95
95
|
cacheItem,
|
|
96
96
|
useStartTime,
|
|
@@ -102,7 +102,7 @@ var getFlexibleOption = ({
|
|
|
102
102
|
let endDate = (0, import_utils.getEndDate)(
|
|
103
103
|
_durationProps.startDate,
|
|
104
104
|
_duration,
|
|
105
|
-
((_a = _durationProps.usableTime) == null ? void 0 : _a.end_at) ? (0, import_dayjs.default)((
|
|
105
|
+
((_c = (_b = (_a = _durationProps.usableTime) == null ? void 0 : _a._extend) == null ? void 0 : _b.usableTime) == null ? void 0 : _c.end_at) ? (0, import_dayjs.default)((_f = (_e = (_d = _durationProps.usableTime) == null ? void 0 : _d._extend) == null ? void 0 : _e.usableTime) == null ? void 0 : _f.end_at) : null
|
|
106
106
|
);
|
|
107
107
|
let timeValue = endDate.diff(_durationProps.startDate, "minute");
|
|
108
108
|
return {
|
|
@@ -197,6 +197,7 @@ var setDefaultResource = ({ cacheItem, resources }) => {
|
|
|
197
197
|
for (let item of resources) {
|
|
198
198
|
let defaultResource = item.renderList.filter((d) => d.is_default == 1 || d.id === resourceId).map((d) => {
|
|
199
199
|
return {
|
|
200
|
+
...d,
|
|
200
201
|
relation_type: d.relation_type,
|
|
201
202
|
form_id: item.form_id,
|
|
202
203
|
relation_id: d.id,
|
|
@@ -324,11 +325,13 @@ var getProductExtend = ({ cacheItem, state }) => {
|
|
|
324
325
|
resources: _cacheItem._data.resources
|
|
325
326
|
});
|
|
326
327
|
if ((0, import_utils.getDuration)(_cacheItem == null ? void 0 : _cacheItem.duration)) {
|
|
327
|
-
_cacheItem._data.
|
|
328
|
-
cacheItem,
|
|
328
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
329
|
+
cacheItem: _cacheItem,
|
|
330
|
+
useStartTime: _cacheItem._extend.start_time,
|
|
329
331
|
currentResource: _cacheItem._extend.resource,
|
|
330
332
|
state
|
|
331
333
|
});
|
|
334
|
+
_cacheItem._extend.duration = _cacheItem._data.timeObj.durationSlicesBasedOnTime[0].value;
|
|
332
335
|
}
|
|
333
336
|
_cacheItem.autoClose = getIsAutoClose(_cacheItem);
|
|
334
337
|
if (_cacheItem._extend.bundle_edit !== void 0) {
|
|
@@ -336,13 +339,6 @@ var getProductExtend = ({ cacheItem, state }) => {
|
|
|
336
339
|
}
|
|
337
340
|
_cacheItem._time = (/* @__PURE__ */ new Date()).getTime();
|
|
338
341
|
} else {
|
|
339
|
-
if (!_cacheItem._data._timeObj) {
|
|
340
|
-
_cacheItem._data._timeObj = getTimeObj({
|
|
341
|
-
cacheItem,
|
|
342
|
-
currentResource: _cacheItem._extend.resource,
|
|
343
|
-
state
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
342
|
if (!_cacheItem._data.capacitys) {
|
|
347
343
|
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
348
344
|
}
|
|
@@ -360,6 +356,12 @@ var getProductExtend = ({ cacheItem, state }) => {
|
|
|
360
356
|
_cacheItem._data.resources = list;
|
|
361
357
|
_cacheItem._data.resourceMaps = maps;
|
|
362
358
|
}
|
|
359
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
360
|
+
cacheItem: _cacheItem,
|
|
361
|
+
useStartTime: _cacheItem._extend.start_time,
|
|
362
|
+
currentResource: _cacheItem._extend.resource,
|
|
363
|
+
state
|
|
364
|
+
});
|
|
363
365
|
}
|
|
364
366
|
console.log("_cacheItem_cacheItem", _cacheItem);
|
|
365
367
|
return _cacheItem;
|