@pisell/private-materials 3.0.126 → 3.0.128-gray
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +2 -2
- package/build/lowcode/render/default/view.js +8 -8
- package/build/lowcode/view.js +4 -4
- package/es/components/booking/components/TabProduct/index.js +63 -60
- package/es/components/booking/components/customSelect/index.d.ts +1 -1
- package/es/components/booking/forms/forms.d.ts +2 -2
- package/es/components/booking/forms/forms.js +61 -58
- package/es/components/booking/info/client/index.d.ts +4 -4
- package/es/components/booking/info/client/index.js +94 -90
- package/es/components/booking/info/clientVariant/vertical/index.js +5 -4
- package/es/components/booking/info/header/index.js +2 -2
- package/es/components/booking/info/index.js +1 -1
- package/es/components/booking/info/pet/index.d.ts +3 -3
- package/es/components/booking/info/pet/index.js +135 -131
- package/es/components/booking/info/service/addService/index.js +47 -45
- package/es/components/booking/info/service/addTimeModal/index.d.ts +2 -2
- package/es/components/booking/info/service/addTimeModal/index.js +218 -225
- package/es/components/booking/info/service/editService/index.js +194 -192
- package/es/components/booking/info/service/index.d.ts +2 -2
- package/es/components/booking/info/service/index.js +1 -1
- package/es/components/booking/locales.d.ts +6 -6
- package/es/components/booking/locales.js +6 -6
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/booking/components/TabProduct/index.js +61 -58
- package/lib/components/booking/components/customSelect/index.d.ts +1 -1
- package/lib/components/booking/forms/forms.d.ts +2 -2
- package/lib/components/booking/forms/forms.js +90 -75
- package/lib/components/booking/info/client/index.d.ts +4 -4
- package/lib/components/booking/info/client/index.js +59 -48
- package/lib/components/booking/info/clientVariant/vertical/index.js +5 -4
- package/lib/components/booking/info/header/index.js +1 -1
- package/lib/components/booking/info/index.js +1 -1
- package/lib/components/booking/info/pet/index.d.ts +3 -3
- package/lib/components/booking/info/pet/index.js +113 -84
- package/lib/components/booking/info/service/addService/index.js +112 -99
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +2 -2
- package/lib/components/booking/info/service/addTimeModal/index.js +154 -127
- package/lib/components/booking/info/service/editService/index.js +196 -171
- package/lib/components/booking/info/service/index.d.ts +2 -2
- package/lib/components/booking/info/service/index.js +1 -1
- package/lib/components/booking/locales.d.ts +6 -6
- package/lib/components/booking/locales.js +6 -6
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/package.json +4 -4
|
@@ -13,18 +13,18 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
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; }
|
|
14
14
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
import React, { useContext, useEffect, useMemo, useState, useRef } from
|
|
16
|
+
import React, { useContext, useEffect, useMemo, useState, useRef } from 'react';
|
|
17
17
|
import Drawer from "../../../components/drawer";
|
|
18
18
|
import { Context } from "../../model";
|
|
19
|
-
import { Button, Skeleton, message, Alert } from
|
|
19
|
+
import { Button, Skeleton, message, Alert } from 'antd';
|
|
20
20
|
import "./index.less";
|
|
21
|
-
import { locales, formatAmount, createArray, formatDate } from
|
|
22
|
-
import { useUpdateEffect, useDebounceFn } from
|
|
21
|
+
import { locales, formatAmount, createArray, formatDate } from '@pisell/utils';
|
|
22
|
+
import { useUpdateEffect, useDebounceFn, useMemoizedFn } from 'ahooks';
|
|
23
23
|
import Footer from "../../../components/footer";
|
|
24
24
|
import { saveAddTimeProduct, getAddTimeProducts } from "./serve";
|
|
25
25
|
import { getAddTimeSplits, isUsableProduct, addTimeRowKey } from "./utils";
|
|
26
|
-
import classNames from
|
|
27
|
-
import dayjs from
|
|
26
|
+
import classNames from 'classnames';
|
|
27
|
+
import dayjs from 'dayjs';
|
|
28
28
|
import BrowserSelect from "../../../components/browserSelect";
|
|
29
29
|
import { isNowTime, getNowTime, getDiscountTime, getResourceTimeIsUsable, flexibleObj, isWalkIn } from "../../../utils";
|
|
30
30
|
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
@@ -38,7 +38,7 @@ var numberList = createArray(100, function (d, i) {
|
|
|
38
38
|
return item;
|
|
39
39
|
});
|
|
40
40
|
var AddTimeModal = function AddTimeModal() {
|
|
41
|
-
var _context$appHelper, _state$bookingConfig2, _state$bookingConfig3, _currentTimeItem$
|
|
41
|
+
var _context$appHelper, _state$bookingConfig2, _state$bookingConfig3, _currentTimeItem$stat2, _currentProduct$add_t2;
|
|
42
42
|
var _useContext = useContext(Context),
|
|
43
43
|
state = _useContext.state,
|
|
44
44
|
dispatch = _useContext.dispatch;
|
|
@@ -46,12 +46,12 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
46
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
47
47
|
isEdit = _useState2[0],
|
|
48
48
|
setIsEdit = _useState2[1];
|
|
49
|
-
var _useState3 = useState(
|
|
49
|
+
var _useState3 = useState(''),
|
|
50
50
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
51
|
loading = _useState4[0],
|
|
52
52
|
setLoading = _useState4[1];
|
|
53
53
|
// id_time
|
|
54
|
-
var _useState5 = useState(
|
|
54
|
+
var _useState5 = useState(''),
|
|
55
55
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
56
56
|
recordKey = _useState6[0],
|
|
57
57
|
setRecordKey = _useState6[1];
|
|
@@ -69,16 +69,16 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
69
69
|
interaction = _context$appHelper$ut.interaction;
|
|
70
70
|
var statusMap = {
|
|
71
71
|
available: {
|
|
72
|
-
label: locales.getText(
|
|
73
|
-
color:
|
|
72
|
+
label: locales.getText('page.booking.text.available'),
|
|
73
|
+
color: '#079455'
|
|
74
74
|
},
|
|
75
75
|
fully_booked: {
|
|
76
|
-
label: locales.getText(
|
|
77
|
-
color:
|
|
76
|
+
label: locales.getText('page.booking.text.fully-booked'),
|
|
77
|
+
color: '#DC6803'
|
|
78
78
|
},
|
|
79
79
|
unavailable: {
|
|
80
|
-
label: locales.getText(
|
|
81
|
-
color:
|
|
80
|
+
label: locales.getText('page.booking.text.unavailable'),
|
|
81
|
+
color: '#98A2B3'
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
|
|
@@ -93,7 +93,7 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
93
93
|
var transaction_habit_selection = useMemo(function () {
|
|
94
94
|
var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
|
|
95
95
|
return (state === null || state === void 0 ? void 0 : (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.information_tab) === null || _state$bookingConfig$2 === void 0 ? void 0 : _state$bookingConfig$2.transaction_habit_selection) || {
|
|
96
|
-
type:
|
|
96
|
+
type: 'service_now_pay_later',
|
|
97
97
|
button_rows: 1
|
|
98
98
|
};
|
|
99
99
|
}, [state === null || state === void 0 ? void 0 : (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : (_state$bookingConfig3 = _state$bookingConfig2.config) === null || _state$bookingConfig3 === void 0 ? void 0 : _state$bookingConfig3.information_tab]);
|
|
@@ -105,7 +105,7 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
105
105
|
|
|
106
106
|
// 当前time
|
|
107
107
|
var currentTime = useMemo(function () {
|
|
108
|
-
var _time = addTimeRowKey.getValue(recordKey).time ||
|
|
108
|
+
var _time = addTimeRowKey.getValue(recordKey).time || '';
|
|
109
109
|
return _time;
|
|
110
110
|
}, [recordKey]);
|
|
111
111
|
|
|
@@ -138,17 +138,17 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
138
138
|
try {
|
|
139
139
|
var _state$service$cacheI3;
|
|
140
140
|
if (!currentResource || !((_state$service$cacheI3 = state.service.cacheItem) !== null && _state$service$cacheI3 !== void 0 && _state$service$cacheI3._extend)) {
|
|
141
|
-
return
|
|
141
|
+
return '';
|
|
142
142
|
}
|
|
143
143
|
var timeItem = currentResource === null || currentResource === void 0 ? void 0 : currentResource.times.find(function (_time) {
|
|
144
144
|
return _time.item_id === state.service.cacheItem._extend.relation_id;
|
|
145
145
|
});
|
|
146
|
-
var timeEndDate = dayjs(timeItem.end_date +
|
|
146
|
+
var timeEndDate = dayjs(timeItem.end_date + ' ' + timeItem.end_time).add(1, 'second');
|
|
147
147
|
return timeEndDate;
|
|
148
148
|
} catch (err) {
|
|
149
|
-
console.log(
|
|
149
|
+
console.log('err', err);
|
|
150
150
|
}
|
|
151
|
-
return
|
|
151
|
+
return '';
|
|
152
152
|
}, [state.service.cacheItem, currentResource]);
|
|
153
153
|
var getTimeUsableStatus = function getTimeUsableStatus(time) {
|
|
154
154
|
var _state$service$cacheI4;
|
|
@@ -163,11 +163,11 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
163
163
|
var _extend = _objectSpread({}, state.service.cacheItem._extend);
|
|
164
164
|
|
|
165
165
|
// 结束时间加上加时
|
|
166
|
-
_extend.endDate = _extend.endDate.add(time,
|
|
166
|
+
_extend.endDate = _extend.endDate.add(time, 'minutes');
|
|
167
167
|
_extend.start_date = _extend.startDate;
|
|
168
168
|
_extend.end_date = _extend.endDate;
|
|
169
|
-
_extend.end_time = _extend.endDate.format(
|
|
170
|
-
_extend.start_time = _extend.startDate.format(
|
|
169
|
+
_extend.end_time = _extend.endDate.format('HH:mm');
|
|
170
|
+
_extend.start_time = _extend.startDate.format('HH:mm');
|
|
171
171
|
|
|
172
172
|
// 时长加上加时
|
|
173
173
|
_extend.duration = flexibleObj.add(_extend.duration, time);
|
|
@@ -177,10 +177,10 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
// 如果跨天 结束时间前面加一个明天
|
|
180
|
-
var startText = _extend.startDate.format(
|
|
181
|
-
var endText = _extend.endDate.format(
|
|
182
|
-
if (_extend.endDate.isAfter(_extend.startDate,
|
|
183
|
-
endText = locales.getText(
|
|
180
|
+
var startText = _extend.startDate.format('hh:mm A');
|
|
181
|
+
var endText = _extend.endDate.format('hh:mm A');
|
|
182
|
+
if (_extend.endDate.isAfter(_extend.startDate, 'day')) {
|
|
183
|
+
endText = locales.getText('pisell1.text.tomorrow') + endText;
|
|
184
184
|
}
|
|
185
185
|
var timeItem = currentResource === null || currentResource === void 0 ? void 0 : currentResource.times.find(function (_time) {
|
|
186
186
|
return _time.item_id === _extend.relation_id;
|
|
@@ -192,7 +192,7 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
192
192
|
return {
|
|
193
193
|
// maxEndTime:
|
|
194
194
|
status: statusMap.unavailable,
|
|
195
|
-
message: "".concat(currentResource.room_name || currentResource.name, " ").concat(locales.getText(
|
|
195
|
+
message: "".concat(currentResource.room_name || currentResource.name, " ").concat(locales.getText('pisell2.text.status.service-error-2'))
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
} catch (err) {}
|
|
@@ -252,9 +252,9 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
252
252
|
skip: 1,
|
|
253
253
|
num: 500,
|
|
254
254
|
open_quotation: 1,
|
|
255
|
-
schedule_date: state.date.value.format(
|
|
255
|
+
schedule_date: state.date.value.format('YYYY-MM-DD'),
|
|
256
256
|
customer_id: isWalkIn((_state$client = state.client) === null || _state$client === void 0 ? void 0 : (_state$client$value = _state$client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id) ? undefined : (_state$client2 = state.client) === null || _state$client2 === void 0 ? void 0 : (_state$client2$value = _state$client2.value) === null || _state$client2$value === void 0 ? void 0 : _state$client2$value.id,
|
|
257
|
-
extension_type: [
|
|
257
|
+
extension_type: ['product_add_time']
|
|
258
258
|
}, {
|
|
259
259
|
useCache: true
|
|
260
260
|
});
|
|
@@ -279,7 +279,7 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
279
279
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
280
280
|
while (1) switch (_context2.prev = _context2.next) {
|
|
281
281
|
case 0:
|
|
282
|
-
setLoading(
|
|
282
|
+
setLoading('list');
|
|
283
283
|
_context2.next = 3;
|
|
284
284
|
return _getAddTimeProducts();
|
|
285
285
|
case 3:
|
|
@@ -305,7 +305,7 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
305
305
|
if (list.length) {
|
|
306
306
|
setDefaultProduct(list);
|
|
307
307
|
}
|
|
308
|
-
setLoading(
|
|
308
|
+
setLoading('');
|
|
309
309
|
setIsEdit(true);
|
|
310
310
|
case 9:
|
|
311
311
|
case "end":
|
|
@@ -338,11 +338,11 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
338
338
|
}, [state.service.addTimeModal]);
|
|
339
339
|
|
|
340
340
|
// 选择
|
|
341
|
-
var onSelectItem = function
|
|
341
|
+
var onSelectItem = useMemoizedFn(function (pItem, item) {
|
|
342
342
|
setRecordKey(addTimeRowKey.create(pItem.id, item.value));
|
|
343
343
|
setIsEdit(true);
|
|
344
344
|
updateServices.run();
|
|
345
|
-
};
|
|
345
|
+
});
|
|
346
346
|
|
|
347
347
|
// 临时模拟出的新服务
|
|
348
348
|
var newService = useMemo(function () {
|
|
@@ -357,10 +357,10 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
357
357
|
price: currentTimeItem.price || 0,
|
|
358
358
|
product_id: currentProduct.id,
|
|
359
359
|
discount_amount: 0,
|
|
360
|
-
product_discount_reason:
|
|
360
|
+
product_discount_reason: '',
|
|
361
361
|
is_charge_tax: currentProduct.is_charge_tax,
|
|
362
|
-
discountway:
|
|
363
|
-
discount_type:
|
|
362
|
+
discountway: 'num',
|
|
363
|
+
discount_type: 'discount'
|
|
364
364
|
};
|
|
365
365
|
|
|
366
366
|
// 当前子预约
|
|
@@ -368,11 +368,11 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
368
368
|
var relation_products = [relation_product];
|
|
369
369
|
|
|
370
370
|
// 结束时间加上加时
|
|
371
|
-
_extend.endDate = _extend.endDate.add(relation_product.product_add_schedule_time,
|
|
372
|
-
var start_date = _extend.startDate.format(
|
|
373
|
-
var end_date = _extend.endDate.format(
|
|
374
|
-
var end_time = _extend.endDate.format(
|
|
375
|
-
var start_time = _extend.startDate.format(
|
|
371
|
+
_extend.endDate = _extend.endDate.add(relation_product.product_add_schedule_time, 'minutes');
|
|
372
|
+
var start_date = _extend.startDate.format('YYYY-MM-DD');
|
|
373
|
+
var end_date = _extend.endDate.format('YYYY-MM-DD');
|
|
374
|
+
var end_time = _extend.endDate.format('HH:mm');
|
|
375
|
+
var start_time = _extend.startDate.format('HH:mm');
|
|
376
376
|
|
|
377
377
|
// 时长加上加时
|
|
378
378
|
var duration = flexibleObj.add(_extend.duration, relation_product.product_add_schedule_time);
|
|
@@ -413,14 +413,14 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
413
413
|
var _edit = (_originServices$curre2 = originServices.current) === null || _originServices$curre2 === void 0 ? void 0 : _originServices$curre2.edit;
|
|
414
414
|
originServices.current = null;
|
|
415
415
|
dispatch({
|
|
416
|
-
type:
|
|
416
|
+
type: 'setService',
|
|
417
417
|
payload: {
|
|
418
418
|
value: _val,
|
|
419
419
|
edit: _edit
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
422
|
};
|
|
423
|
-
var createNewServices = function
|
|
423
|
+
var createNewServices = useMemoizedFn(function () {
|
|
424
424
|
var _state$service2;
|
|
425
425
|
var _list = ((_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value) || [];
|
|
426
426
|
if (!originServices.current) {
|
|
@@ -437,7 +437,7 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
437
437
|
return _item;
|
|
438
438
|
});
|
|
439
439
|
dispatch({
|
|
440
|
-
type:
|
|
440
|
+
type: 'setService',
|
|
441
441
|
payload: {
|
|
442
442
|
value: _list,
|
|
443
443
|
edit: true
|
|
@@ -446,7 +446,7 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
446
446
|
} else {
|
|
447
447
|
resetService();
|
|
448
448
|
}
|
|
449
|
-
};
|
|
449
|
+
});
|
|
450
450
|
var goCheckout = /*#__PURE__*/function () {
|
|
451
451
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
452
452
|
var _interaction$utils, _interaction$utils$po;
|
|
@@ -458,15 +458,15 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
458
458
|
break;
|
|
459
459
|
}
|
|
460
460
|
return _context3.abrupt("return", interaction === null || interaction === void 0 ? void 0 : (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 ? void 0 : (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 ? void 0 : _interaction$utils$po.call(_interaction$utils, {
|
|
461
|
-
module:
|
|
462
|
-
key:
|
|
461
|
+
module: 'booking',
|
|
462
|
+
key: 'booking_checkout',
|
|
463
463
|
data: {
|
|
464
464
|
order_id: state.bookingId
|
|
465
465
|
}
|
|
466
466
|
}));
|
|
467
467
|
case 2:
|
|
468
468
|
state.action({
|
|
469
|
-
type:
|
|
469
|
+
type: 'pisell1.handlePayment',
|
|
470
470
|
data: {
|
|
471
471
|
orderId: state.bookingId
|
|
472
472
|
},
|
|
@@ -484,214 +484,207 @@ var AddTimeModal = function AddTimeModal() {
|
|
|
484
484
|
return _ref3.apply(this, arguments);
|
|
485
485
|
};
|
|
486
486
|
}();
|
|
487
|
-
var handleCheckout = /*#__PURE__*/function () {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (!isEdit) {
|
|
493
|
-
_context4.next = 3;
|
|
494
|
-
break;
|
|
495
|
-
}
|
|
487
|
+
var handleCheckout = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
488
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
489
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
490
|
+
case 0:
|
|
491
|
+
if (!isEdit) {
|
|
496
492
|
_context4.next = 3;
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
case 3:
|
|
524
|
-
setLoading(loadingType);
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
_context4.next = 3;
|
|
496
|
+
return handleSave('checkout');
|
|
497
|
+
case 3:
|
|
498
|
+
goCheckout();
|
|
499
|
+
case 4:
|
|
500
|
+
case "end":
|
|
501
|
+
return _context4.stop();
|
|
502
|
+
}
|
|
503
|
+
}, _callee4);
|
|
504
|
+
})));
|
|
505
|
+
var handleSave = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
506
|
+
var loadingType,
|
|
507
|
+
_args5 = arguments;
|
|
508
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
509
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
510
|
+
case 0:
|
|
511
|
+
loadingType = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : 'save';
|
|
512
|
+
if (!(currentTime === null)) {
|
|
513
|
+
_context5.next = 3;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
return _context5.abrupt("return");
|
|
517
|
+
case 3:
|
|
518
|
+
setLoading(loadingType);
|
|
525
519
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
520
|
+
// save
|
|
521
|
+
_context5.next = 6;
|
|
522
|
+
return saveAddTimeProduct({
|
|
523
|
+
orderId: state.bookingId,
|
|
524
|
+
params: _objectSpread(_objectSpread({}, newService), {}, {
|
|
525
|
+
_extend: undefined
|
|
526
|
+
})
|
|
527
|
+
});
|
|
528
|
+
case 6:
|
|
529
|
+
// 更新外部预约列表
|
|
530
|
+
setLoading('');
|
|
531
|
+
message.success(locales.getText('page.booking.text.add-time-success'));
|
|
538
532
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
return function handleSave() {
|
|
556
|
-
return _ref5.apply(this, arguments);
|
|
557
|
-
};
|
|
558
|
-
}();
|
|
533
|
+
// close
|
|
534
|
+
onCancel();
|
|
535
|
+
if (!(loadingType === 'checkout')) {
|
|
536
|
+
_context5.next = 11;
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
return _context5.abrupt("return");
|
|
540
|
+
case 11:
|
|
541
|
+
// 回调关闭弹窗
|
|
542
|
+
state === null || state === void 0 ? void 0 : state.action('init');
|
|
543
|
+
case 12:
|
|
544
|
+
case "end":
|
|
545
|
+
return _context5.stop();
|
|
546
|
+
}
|
|
547
|
+
}, _callee5);
|
|
548
|
+
})));
|
|
559
549
|
useEffect(function () {
|
|
560
550
|
if (!state.modalOpen) {
|
|
561
551
|
onCancel();
|
|
562
552
|
}
|
|
563
553
|
}, [state.modalOpen]);
|
|
564
|
-
var onCancel = function
|
|
554
|
+
var onCancel = useMemoizedFn(function () {
|
|
565
555
|
setIsEdit(false);
|
|
566
|
-
setRecordKey(
|
|
556
|
+
setRecordKey('');
|
|
567
557
|
resetService();
|
|
568
558
|
setTimeout(function () {
|
|
569
559
|
dispatch({
|
|
570
|
-
type:
|
|
560
|
+
type: 'setService',
|
|
571
561
|
payload: {
|
|
572
562
|
addTimeModal: false
|
|
573
563
|
}
|
|
574
564
|
});
|
|
575
565
|
}, 50);
|
|
576
|
-
};
|
|
566
|
+
});
|
|
577
567
|
var updateTime = useMemo(function () {
|
|
578
568
|
if (!newService) {
|
|
579
|
-
return
|
|
569
|
+
return '';
|
|
580
570
|
}
|
|
581
571
|
var startTime = newService.start_time;
|
|
582
572
|
var endTime = newService.end_time;
|
|
583
573
|
var hours = getDiscountTime(flexibleObj.getValue(newService.duration));
|
|
584
574
|
if (newService.start_date !== newService.end_date) {
|
|
585
575
|
var locale = state.locale;
|
|
586
|
-
var format = locale ===
|
|
576
|
+
var format = locale === 'en' || locale === 'en-US' ? 'HH:mm DD/MM' : 'MM-DD HH:mm';
|
|
587
577
|
startTime = formatDate("".concat(newService.start_date, " ").concat(newService.start_time), format);
|
|
588
578
|
endTime = formatDate("".concat(newService.end_date, " ").concat(newService.end_time), format);
|
|
589
579
|
}
|
|
590
|
-
return "".concat(locales.getText(
|
|
580
|
+
return "".concat(locales.getText('page.booking.text.update-time'), ": ").concat(startTime, " ~ ").concat(endTime, " (").concat(hours, ")");
|
|
591
581
|
}, [newService, state.locale]);
|
|
592
|
-
return
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
className: "pisell-lowcode__booking-add-time-total-wrap"
|
|
606
|
-
}, currentTimeItem && currentTimeItem !== null && currentTimeItem !== void 0 && (_currentTimeItem$stat = currentTimeItem.status) !== null && _currentTimeItem$stat !== void 0 && _currentTimeItem$stat.message ? /*#__PURE__*/React.createElement(Alert, {
|
|
607
|
-
message: currentTimeItem.status.message,
|
|
608
|
-
type: "warning",
|
|
609
|
-
showIcon: true,
|
|
610
|
-
style: {
|
|
611
|
-
marginBottom: 12
|
|
612
|
-
}
|
|
613
|
-
}) : null, newService ? /*#__PURE__*/React.createElement("div", {
|
|
614
|
-
className: "pisell-lowcode__booking-add-time-summary-wrap"
|
|
615
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
616
|
-
className: "pisell-lowcode__booking-add-time-summary"
|
|
617
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
618
|
-
className: "pisell-lowcode__booking-add-time-summary-time"
|
|
619
|
-
}, updateTime), /*#__PURE__*/React.createElement("div", {
|
|
620
|
-
className: "pisell-lowcode__booking-add-time-summary-total"
|
|
621
|
-
}, locales.getText("pisell1.text.subtotal"), ":", " ", formatAmount((currentTimeItem.price || 0) * number, 2, state.amountSymbol))), (currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$add_t = currentProduct.add_time) === null || _currentProduct$add_t === void 0 ? void 0 : _currentProduct$add_t.calculate_type) === "select_quantity" && /*#__PURE__*/React.createElement("div", {
|
|
622
|
-
className: "pisell-lowcode__booking-add-time-quantity-wrap"
|
|
623
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
624
|
-
className: "pisell-lowcode__booking-add-time-quantity"
|
|
625
|
-
}, locales.getText("page.booking.text.quantity")), " ", /*#__PURE__*/React.createElement(BrowserSelect, {
|
|
626
|
-
value: number,
|
|
627
|
-
onChange: function onChange(e) {
|
|
628
|
-
setNumber(Number(e.target.value));
|
|
629
|
-
updateServices.run();
|
|
582
|
+
return useMemo(function () {
|
|
583
|
+
var _currentTimeItem$stat, _currentProduct$add_t;
|
|
584
|
+
return /*#__PURE__*/React.createElement(Drawer, {
|
|
585
|
+
open: state.service.addTimeModal,
|
|
586
|
+
title: locales.getText('page.booking.text.add-time'),
|
|
587
|
+
rootClassName: "booking-server-wrap",
|
|
588
|
+
onClose: onCancel,
|
|
589
|
+
footerStyle: {
|
|
590
|
+
padding: '10px 32px 20px'
|
|
591
|
+
},
|
|
592
|
+
hideScrollBar: false,
|
|
593
|
+
bodyStyle: {
|
|
594
|
+
position: 'relative'
|
|
630
595
|
},
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
type: transaction_habit_selection.type === "service_now_pay_later" ? "default" : "primary",
|
|
640
|
-
disabled: loading === "list" || !isEdit || !currentTime,
|
|
641
|
-
onClick: handleCheckout,
|
|
642
|
-
loading: loading === "checkout"
|
|
643
|
-
}, locales.getText("pisell2.text.checkout")), /*#__PURE__*/React.createElement(Button, {
|
|
644
|
-
className: "pisell-lowcode__booking-footer-buttons-item",
|
|
645
|
-
type: transaction_habit_selection.type === "service_now_pay_later" ? "primary" : "default",
|
|
646
|
-
disabled: loading === "list" || !isEdit || !currentTime,
|
|
647
|
-
loading: loading === "save",
|
|
648
|
-
onClick: function onClick() {
|
|
649
|
-
handleSave("save");
|
|
596
|
+
footer: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
597
|
+
className: "pisell-lowcode__booking-add-time-total-wrap"
|
|
598
|
+
}, currentTimeItem && currentTimeItem !== null && currentTimeItem !== void 0 && (_currentTimeItem$stat = currentTimeItem.status) !== null && _currentTimeItem$stat !== void 0 && _currentTimeItem$stat.message ? /*#__PURE__*/React.createElement(Alert, {
|
|
599
|
+
message: currentTimeItem.status.message,
|
|
600
|
+
type: "warning",
|
|
601
|
+
showIcon: true,
|
|
602
|
+
style: {
|
|
603
|
+
marginBottom: 12
|
|
650
604
|
}
|
|
651
|
-
},
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
605
|
+
}) : null, newService ? /*#__PURE__*/React.createElement("div", {
|
|
606
|
+
className: "pisell-lowcode__booking-add-time-summary-wrap"
|
|
607
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
608
|
+
className: "pisell-lowcode__booking-add-time-summary"
|
|
609
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
610
|
+
className: "pisell-lowcode__booking-add-time-summary-time"
|
|
611
|
+
}, updateTime), /*#__PURE__*/React.createElement("div", {
|
|
612
|
+
className: "pisell-lowcode__booking-add-time-summary-total"
|
|
613
|
+
}, locales.getText('pisell1.text.subtotal'), ":", ' ', formatAmount((currentTimeItem.price || 0) * number, 2, state.amountSymbol))), (currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$add_t = currentProduct.add_time) === null || _currentProduct$add_t === void 0 ? void 0 : _currentProduct$add_t.calculate_type) === 'select_quantity' && /*#__PURE__*/React.createElement("div", {
|
|
614
|
+
className: "pisell-lowcode__booking-add-time-quantity-wrap"
|
|
615
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
616
|
+
className: "pisell-lowcode__booking-add-time-quantity"
|
|
617
|
+
}, locales.getText('page.booking.text.quantity')), ' ', /*#__PURE__*/React.createElement(BrowserSelect, {
|
|
618
|
+
value: number,
|
|
619
|
+
onChange: function onChange(e) {
|
|
620
|
+
setNumber(Number(e.target.value));
|
|
621
|
+
updateServices.run();
|
|
622
|
+
},
|
|
623
|
+
className: "pisell-lowcode__booking-add-time-quantity-select",
|
|
624
|
+
options: numberList
|
|
625
|
+
}))) : null), /*#__PURE__*/React.createElement(Footer, {
|
|
626
|
+
state: state,
|
|
627
|
+
dispatch: dispatch,
|
|
628
|
+
source: "addTime",
|
|
629
|
+
buttons: [/*#__PURE__*/React.createElement(Button, {
|
|
630
|
+
className: "pisell-lowcode__booking-footer-buttons-item",
|
|
631
|
+
type: transaction_habit_selection.type === 'service_now_pay_later' ? 'default' : 'primary',
|
|
632
|
+
disabled: loading === 'list' || !isEdit || !currentTime,
|
|
633
|
+
onClick: handleCheckout,
|
|
634
|
+
loading: loading === 'checkout'
|
|
635
|
+
}, locales.getText('pisell2.text.checkout')), /*#__PURE__*/React.createElement(Button, {
|
|
636
|
+
className: "pisell-lowcode__booking-footer-buttons-item",
|
|
637
|
+
type: transaction_habit_selection.type === 'service_now_pay_later' ? 'primary' : 'default',
|
|
638
|
+
disabled: loading === 'list' || !isEdit || !currentTime,
|
|
639
|
+
loading: loading === 'save',
|
|
640
|
+
onClick: function onClick() {
|
|
641
|
+
handleSave('save');
|
|
642
|
+
}
|
|
643
|
+
}, locales.getText('pisell2.text.save'))]
|
|
644
|
+
}))
|
|
664
645
|
}, /*#__PURE__*/React.createElement("div", {
|
|
665
|
-
className: "pisell-lowcode__booking-add-time-
|
|
666
|
-
},
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
646
|
+
className: "pisell-lowcode__booking-add-time-body"
|
|
647
|
+
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
648
|
+
loading: loading === 'list',
|
|
649
|
+
active: true,
|
|
650
|
+
round: true
|
|
651
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
652
|
+
className: ""
|
|
653
|
+
}, renderList.map(function (d) {
|
|
670
654
|
return /*#__PURE__*/React.createElement("div", {
|
|
671
|
-
className:
|
|
672
|
-
"pisell-lowcode__booking-add-time-child-card-active": recordKey === addTimeRowKey.create(d.id, child.value)
|
|
673
|
-
}),
|
|
674
|
-
onClick: function onClick() {
|
|
675
|
-
if (!child.value) {
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
678
|
-
onSelectItem(d, child);
|
|
679
|
-
}
|
|
680
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
681
|
-
className: "pisell-lowcode__booking-add-time-child-card-left"
|
|
655
|
+
className: ""
|
|
682
656
|
}, /*#__PURE__*/React.createElement("div", {
|
|
683
|
-
className: "pisell-lowcode__booking-add-time-
|
|
684
|
-
},
|
|
685
|
-
className: "pisell-lowcode__booking-add-time-child-card-
|
|
686
|
-
},
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
657
|
+
className: "pisell-lowcode__booking-add-time-hours"
|
|
658
|
+
}, d.title), d.times ? /*#__PURE__*/React.createElement("div", {
|
|
659
|
+
className: "pisell-lowcode__booking-add-time-child-card-list"
|
|
660
|
+
}, d.times.map(function (child) {
|
|
661
|
+
var _child$status, _child$status$status, _child$status2, _child$status2$status;
|
|
662
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
663
|
+
className: classNames('pisell-lowcode__booking-add-time-child-card', {
|
|
664
|
+
'pisell-lowcode__booking-add-time-child-card-active': recordKey === addTimeRowKey.create(d.id, child.value)
|
|
665
|
+
}),
|
|
666
|
+
onClick: function onClick() {
|
|
667
|
+
if (!child.value) {
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
onSelectItem(d, child);
|
|
671
|
+
}
|
|
672
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
673
|
+
className: "pisell-lowcode__booking-add-time-child-card-left"
|
|
674
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
675
|
+
className: "pisell-lowcode__booking-add-time-child-card-left-time"
|
|
676
|
+
}, child.label), /*#__PURE__*/React.createElement("div", {
|
|
677
|
+
className: "pisell-lowcode__booking-add-time-child-card-left-price"
|
|
678
|
+
}, formatAmount(child.price, 2, state.amountSymbol))), /*#__PURE__*/React.createElement("div", {
|
|
679
|
+
className: "pisell-lowcode__booking-add-time-child-card-right",
|
|
680
|
+
style: {
|
|
681
|
+
color: (_child$status = child.status) === null || _child$status === void 0 ? void 0 : (_child$status$status = _child$status.status) === null || _child$status$status === void 0 ? void 0 : _child$status$status.color
|
|
682
|
+
}
|
|
683
|
+
}, (_child$status2 = child.status) === null || _child$status2 === void 0 ? void 0 : (_child$status2$status = _child$status2.status) === null || _child$status2$status === void 0 ? void 0 : _child$status2$status.label));
|
|
684
|
+
})) : null);
|
|
685
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
686
|
+
className: ""
|
|
687
|
+
})));
|
|
688
|
+
}, [state.service.addTimeModal, locales, currentTimeItem, currentTimeItem === null || currentTimeItem === void 0 ? void 0 : (_currentTimeItem$stat2 = currentTimeItem.status) === null || _currentTimeItem$stat2 === void 0 ? void 0 : _currentTimeItem$stat2.message, newService, updateTime, currentTimeItem.price, number, state.amountSymbol, currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$add_t2 = currentProduct.add_time) === null || _currentProduct$add_t2 === void 0 ? void 0 : _currentProduct$add_t2.calculate_type, numberList, updateServices.run, state, dispatch, transaction_habit_selection.type, loading, isEdit, currentTime, transaction_habit_selection.type, renderList, recordKey]);
|
|
696
689
|
};
|
|
697
690
|
export default AddTimeModal;
|