@pisell/private-materials 3.0.155 → 3.0.157-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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/addons/index.js +10 -7
- package/es/components/booking/addons/model.d.ts +2 -1
- package/es/components/booking/components/TabProduct/index.js +1 -1
- package/es/components/booking/components/customSelect/index.js +5 -1
- package/es/components/booking/components/drawer/index.d.ts +3 -3
- package/es/components/booking/components/drawer/index.js +15 -13
- package/es/components/booking/components/drawer/index.less +8 -6
- package/es/components/booking/components/footer/index.js +24 -10
- package/es/components/booking/dashboard/index.d.ts +20 -0
- package/es/components/booking/dashboard/index.js +253 -0
- package/es/components/booking/dashboard/serve.d.ts +1 -0
- package/es/components/booking/dashboard/serve.js +27 -0
- package/es/components/booking/deposit/EditDepositModal/index.less +3 -0
- package/es/components/booking/forms/forms.d.ts +1 -0
- package/es/components/booking/forms/forms.js +4 -2
- package/es/components/booking/forms/model.d.ts +2 -1
- package/es/components/booking/forms/single/index.d.ts +1 -1
- package/es/components/booking/forms/single/index.js +4 -3
- package/es/components/booking/info/addServiceVariant/index.d.ts +7 -0
- package/es/components/booking/info/addServiceVariant/index.js +33 -0
- package/es/components/booking/info/client/index.js +35 -15
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +4 -4
- package/es/components/booking/info/clientVariant/hooks/useClientFn.js +59 -32
- package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +3 -0
- package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.js +14 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +4 -3
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +41 -35
- package/es/components/booking/info/clientVariant/vertical/index.d.ts +1 -1
- package/es/components/booking/info/clientVariant/vertical/index.js +32 -14
- package/es/components/booking/info/clientVariant/vertical/index.less +37 -11
- package/es/components/booking/info/date/index.js +1 -0
- package/es/components/booking/info/date/index.less +2 -0
- package/es/components/booking/info/header/index.js +13 -12
- package/es/components/booking/info/index.less +9 -0
- package/es/components/booking/info/main.js +10 -1
- package/es/components/booking/info/pet/index.js +1 -1
- package/es/components/booking/info/service/addService/index.d.ts +8 -2
- package/es/components/booking/info/service/addService/index.js +92 -44
- package/es/components/booking/info/service/addService/index.less +27 -1
- package/es/components/booking/info/service/addTimeModal/index.js +1 -0
- package/es/components/booking/info/service/addTimeModal/index.less +1 -1
- package/es/components/booking/info/service/editService/index.js +14 -15
- package/es/components/booking/info/service/serviceList/index.js +2 -1
- package/es/components/booking/info/utils.js +1 -1
- package/es/components/booking/info2/index.js +10 -1
- package/es/components/booking/locales.d.ts +48 -0
- package/es/components/booking/locales.js +51 -3
- package/es/components/booking/model.d.ts +4 -0
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +2 -1
- package/es/components/booking/payments/model.d.ts +2 -1
- package/es/components/booking/utils.d.ts +1 -1
- package/es/components/booking/utils.js +54 -51
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +2 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/lib/components/booking/addons/index.js +2 -5
- package/lib/components/booking/addons/model.d.ts +2 -1
- package/lib/components/booking/components/TabProduct/index.js +1 -1
- package/lib/components/booking/components/customSelect/index.js +2 -1
- package/lib/components/booking/components/drawer/index.d.ts +3 -3
- package/lib/components/booking/components/drawer/index.js +13 -11
- package/lib/components/booking/components/drawer/index.less +8 -6
- package/lib/components/booking/components/footer/index.js +19 -15
- package/lib/components/booking/dashboard/index.d.ts +20 -0
- package/lib/components/booking/dashboard/index.js +251 -0
- package/lib/components/booking/dashboard/serve.d.ts +1 -0
- package/lib/components/booking/dashboard/serve.js +33 -0
- package/lib/components/booking/deposit/EditDepositModal/index.less +3 -0
- package/lib/components/booking/forms/forms.d.ts +1 -0
- package/lib/components/booking/forms/forms.js +5 -2
- package/lib/components/booking/forms/model.d.ts +2 -1
- package/lib/components/booking/forms/single/index.d.ts +1 -1
- package/lib/components/booking/forms/single/index.js +4 -2
- package/lib/components/booking/info/addServiceVariant/index.d.ts +7 -0
- package/lib/components/booking/info/addServiceVariant/index.js +58 -0
- package/lib/components/booking/info/client/index.js +33 -21
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +4 -4
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +33 -13
- package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +3 -0
- package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.js +36 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +4 -3
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +43 -11
- package/lib/components/booking/info/clientVariant/vertical/index.d.ts +1 -1
- package/lib/components/booking/info/clientVariant/vertical/index.js +121 -88
- package/lib/components/booking/info/clientVariant/vertical/index.less +37 -11
- package/lib/components/booking/info/date/index.js +1 -0
- package/lib/components/booking/info/date/index.less +2 -0
- package/lib/components/booking/info/header/index.js +14 -12
- package/lib/components/booking/info/index.less +9 -0
- package/lib/components/booking/info/main.js +14 -1
- package/lib/components/booking/info/pet/index.js +2 -1
- package/lib/components/booking/info/service/addService/index.d.ts +8 -2
- package/lib/components/booking/info/service/addService/index.js +69 -30
- package/lib/components/booking/info/service/addService/index.less +27 -1
- package/lib/components/booking/info/service/addTimeModal/index.js +1 -0
- package/lib/components/booking/info/service/addTimeModal/index.less +1 -1
- package/lib/components/booking/info/service/editService/index.js +17 -13
- package/lib/components/booking/info/service/serviceList/index.js +4 -3
- package/lib/components/booking/info/utils.js +1 -1
- package/lib/components/booking/info2/index.js +14 -1
- package/lib/components/booking/locales.d.ts +48 -0
- package/lib/components/booking/locales.js +51 -3
- package/lib/components/booking/model.d.ts +4 -0
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +2 -1
- package/lib/components/booking/payments/model.d.ts +2 -1
- package/lib/components/booking/utils.d.ts +1 -1
- package/lib/components/booking/utils.js +57 -22
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lowcode/booking-dashboard/meta.ts +137 -0
- package/lowcode/booking-vertical-add-service/meta.ts +124 -0
- package/lowcode/vertical-add-service/meta.ts +71 -0
- package/package.json +3 -3
|
@@ -36,7 +36,7 @@ import TabProduct from "../components/TabProduct";
|
|
|
36
36
|
import EmptyBooking from "../components/emptyBooking";
|
|
37
37
|
import Footer from "../components/footer";
|
|
38
38
|
import { formatProductBundle } from "../components/footer/utils";
|
|
39
|
-
import { formatProductListByCategory, getProductTotalPrice } from "../utils";
|
|
39
|
+
import { formatProductListByCategory, getProductTotalPrice, request } from "../utils";
|
|
40
40
|
import { locales, getUniqueId } from '@pisell/utils';
|
|
41
41
|
import "./index.less";
|
|
42
42
|
import useEngineContext from "../../../hooks/useEngineContext";
|
|
@@ -136,6 +136,7 @@ var Addons = Provider(function (props) {
|
|
|
136
136
|
var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
137
137
|
isTerminal = _ref.isTerminal,
|
|
138
138
|
interaction = _ref.interaction;
|
|
139
|
+
request.setRequest(context.appHelper.utils.request);
|
|
139
140
|
useEffect(function () {
|
|
140
141
|
dispatch({
|
|
141
142
|
type: 'setState',
|
|
@@ -161,12 +162,13 @@ var Addons = Provider(function (props) {
|
|
|
161
162
|
var init = function init() {
|
|
162
163
|
getAddonsByOrderId();
|
|
163
164
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
165
|
+
|
|
166
|
+
// useEffect(() => {
|
|
167
|
+
// // addons 只有详情阶段之后才可以进行
|
|
168
|
+
// if (state.bookingId) {
|
|
169
|
+
// init();
|
|
170
|
+
// }
|
|
171
|
+
// }, [state.bookingId]);
|
|
170
172
|
|
|
171
173
|
// 这里暂时不用了, 用页面上的 refreshBookingDetail 统一更新
|
|
172
174
|
useEffect(function () {
|
|
@@ -549,6 +551,7 @@ var Addons = Provider(function (props) {
|
|
|
549
551
|
})) : /*#__PURE__*/React.createElement(EmptyBooking, {
|
|
550
552
|
description: locales.getText('pisell1.text.no-addons')
|
|
551
553
|
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
554
|
+
titleNoWrap: true,
|
|
552
555
|
open: state.addons.showModal,
|
|
553
556
|
title: locales.getText('pisell2.text.addons'),
|
|
554
557
|
onClose: function onClose() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { FormState } from "../model";
|
|
2
|
-
export declare const Provider: (ComponentUi: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
3
4
|
state: FormState;
|
|
4
5
|
} & {
|
|
5
6
|
dispatch: (params: {
|
|
@@ -109,7 +109,7 @@ var TabProduct = function TabProduct(props) {
|
|
|
109
109
|
}, /*#__PURE__*/React.createElement("div", {
|
|
110
110
|
className: "booking-tabs-wrap",
|
|
111
111
|
style: {
|
|
112
|
-
top: "
|
|
112
|
+
top: "67px"
|
|
113
113
|
}
|
|
114
114
|
}, /*#__PURE__*/React.createElement(Card, {
|
|
115
115
|
className: "booking-tabs",
|
|
@@ -411,6 +411,7 @@ var CustomSelect = function CustomSelect(props, ref) {
|
|
|
411
411
|
onClose: function onClose() {
|
|
412
412
|
closeDrawer(true);
|
|
413
413
|
},
|
|
414
|
+
titleNoWrap: true,
|
|
414
415
|
header: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
|
|
415
416
|
ref: searchRef,
|
|
416
417
|
prefix: /*#__PURE__*/React.createElement(SearchLg, null),
|
|
@@ -454,7 +455,10 @@ var CustomSelect = function CustomSelect(props, ref) {
|
|
|
454
455
|
}), /*#__PURE__*/React.createElement(List, {
|
|
455
456
|
itemLayout: "horizontal",
|
|
456
457
|
dataSource: renderList,
|
|
457
|
-
loading:
|
|
458
|
+
loading: {
|
|
459
|
+
spinning: !!loading,
|
|
460
|
+
delay: 500
|
|
461
|
+
},
|
|
458
462
|
loadMore: loadMore,
|
|
459
463
|
renderItem: function renderItem(item) {
|
|
460
464
|
return /*#__PURE__*/React.createElement(List.Item, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { DrawerProps } from
|
|
3
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawerProps } from 'antd';
|
|
3
|
+
import './index.less';
|
|
4
4
|
export interface PisellDrawerProps extends DrawerProps {
|
|
5
5
|
header?: React.ReactNode;
|
|
6
6
|
titleNoWrap?: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import React from
|
|
3
|
-
import { Drawer as OriginDrawer } from
|
|
4
|
-
import ArrowLeft from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Drawer as OriginDrawer } from 'antd';
|
|
4
|
+
import ArrowLeft from '@pisell/icon/es/ArrowLeft';
|
|
5
5
|
import "./index.less";
|
|
6
|
-
import classNames from
|
|
6
|
+
import classNames from 'classnames';
|
|
7
7
|
/**
|
|
8
8
|
* @title: 自定义抽屉
|
|
9
9
|
* @description:
|
|
@@ -18,12 +18,12 @@ var Drawer = function Drawer(props) {
|
|
|
18
18
|
_props$showGoBack = props.showGoBack,
|
|
19
19
|
showGoBack = _props$showGoBack === void 0 ? true : _props$showGoBack;
|
|
20
20
|
return /*#__PURE__*/React.createElement(OriginDrawer, _extends({
|
|
21
|
-
width:
|
|
21
|
+
width: '600px',
|
|
22
22
|
closable: false,
|
|
23
23
|
zIndex: 999
|
|
24
24
|
}, props, {
|
|
25
|
-
className: classNames(
|
|
26
|
-
|
|
25
|
+
className: classNames('pisell-lowcode__booking-drawer', props.className, {
|
|
26
|
+
'pisell-lowcode__booking-drawer-hide-scrollbar': hideScrollBar
|
|
27
27
|
}),
|
|
28
28
|
title: false,
|
|
29
29
|
bodyStyle: {
|
|
@@ -32,17 +32,19 @@ var Drawer = function Drawer(props) {
|
|
|
32
32
|
push: false,
|
|
33
33
|
mask: false
|
|
34
34
|
}), /*#__PURE__*/React.createElement("div", {
|
|
35
|
-
className: classNames(
|
|
36
|
-
},
|
|
37
|
-
className: "pisell-lowcode__booking-drawer-
|
|
35
|
+
className: classNames('pisell-lowcode__booking-drawer-title-wrap')
|
|
36
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "pisell-lowcode__booking-drawer-title-line",
|
|
38
38
|
onClick: function onClick(e) {
|
|
39
39
|
var _props$onClose;
|
|
40
40
|
(_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props, e);
|
|
41
41
|
}
|
|
42
|
+
}, showGoBack && /*#__PURE__*/React.createElement(ArrowLeft, {
|
|
43
|
+
className: "pisell-lowcode__booking-drawer-back"
|
|
42
44
|
}), /*#__PURE__*/React.createElement("div", {
|
|
43
|
-
className: classNames(
|
|
44
|
-
|
|
45
|
+
className: classNames('pisell-lowcode__booking-drawer-title', {
|
|
46
|
+
'pisell-lowcode__booking-drawer-title-no-wrap': props.titleNoWrap
|
|
45
47
|
})
|
|
46
|
-
}, props.title), props.header), /*#__PURE__*/React.createElement("div", null, props.children));
|
|
48
|
+
}, props.title)), props.header), /*#__PURE__*/React.createElement("div", null, props.children));
|
|
47
49
|
};
|
|
48
50
|
export default Drawer;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.pisell-lowcode__booking-drawer-title-wrap {
|
|
2
|
-
cursor: pointer;
|
|
3
2
|
position: sticky;
|
|
4
3
|
top: 0;
|
|
5
4
|
left: 0;
|
|
@@ -9,18 +8,21 @@
|
|
|
9
8
|
padding: 24px 32px 0 32px;
|
|
10
9
|
|
|
11
10
|
|
|
11
|
+
.pisell-lowcode__booking-drawer-title-line {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
.pisell-lowcode__booking-drawer-back {
|
|
14
|
-
font-size:
|
|
16
|
+
font-size: 18px !important;
|
|
15
17
|
color: #000000;
|
|
18
|
+
margin-right: 6px;
|
|
19
|
+
cursor: pointer;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
.pisell-lowcode__booking-drawer-title {
|
|
19
23
|
color: var(--base-black, #000);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
font-size: 30px;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
font-size: 18px !important;
|
|
24
26
|
font-style: normal;
|
|
25
27
|
font-weight: 500;
|
|
26
28
|
line-height: 38px;
|
|
@@ -42,7 +42,7 @@ import { isBooking4Shop } from "../../info/utils";
|
|
|
42
42
|
* @Date: 2024-01-30 16:51
|
|
43
43
|
*/
|
|
44
44
|
var Footer = function Footer(props) {
|
|
45
|
-
var _context$appHelper,
|
|
45
|
+
var _context$appHelper, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingConfig8, _state$bookingConfig9, _state$addons2, _state$addons4, _state$bookingDetail11;
|
|
46
46
|
var state = props.state,
|
|
47
47
|
buttons = props.buttons,
|
|
48
48
|
dispatch = props.dispatch,
|
|
@@ -62,13 +62,25 @@ var Footer = function Footer(props) {
|
|
|
62
62
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
63
|
checkoutLoading = _useState6[0],
|
|
64
64
|
setCheckoutLoading = _useState6[1];
|
|
65
|
+
var _useState7 = useState(false),
|
|
66
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
+
isShowPaymentLink = _useState8[0],
|
|
68
|
+
setIsShowPaymentLink = _useState8[1];
|
|
65
69
|
var context = useEngineContext();
|
|
66
70
|
var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
|
|
67
71
|
isTerminal = _context$appHelper$ut.isTerminal,
|
|
68
72
|
interaction = _context$appHelper$ut.interaction,
|
|
69
73
|
store = _context$appHelper$ut.store,
|
|
70
74
|
storage = _context$appHelper$ut.storage;
|
|
71
|
-
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
store === null || store === void 0 ? void 0 : store.dispatch({
|
|
77
|
+
type: 'global/_getMetadataMap',
|
|
78
|
+
callback: function callback(data) {
|
|
79
|
+
console.log(data, 'data');
|
|
80
|
+
setIsShowPaymentLink(!!data['payment_collection_link_config_switch']);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}, []);
|
|
72
84
|
var _Modal$useModal = Modal.useModal(),
|
|
73
85
|
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
74
86
|
modal = _Modal$useModal2[0],
|
|
@@ -124,11 +136,13 @@ var Footer = function Footer(props) {
|
|
|
124
136
|
});
|
|
125
137
|
}
|
|
126
138
|
}, [state.bookingDetail]);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
139
|
+
|
|
140
|
+
// useEffect(() => {
|
|
141
|
+
// console.log('_getPaymentLinkBtnShow_getPaymentLinkBtnShow');
|
|
142
|
+
// // store?.dispatch({
|
|
143
|
+
// // type: 'global/_getPaymentLinkBtnShow',
|
|
144
|
+
// // });
|
|
145
|
+
// }, []);
|
|
132
146
|
|
|
133
147
|
// board 配置
|
|
134
148
|
var params = useMemo(function () {
|
|
@@ -906,7 +920,7 @@ var Footer = function Footer(props) {
|
|
|
906
920
|
}
|
|
907
921
|
if (transaction_habit_selection.button_rows == 1) {
|
|
908
922
|
if (state.appointment_status !== 'cancelled') {
|
|
909
|
-
if (!state.disabledEdit) {
|
|
923
|
+
if (!state.disabledEdit && !state.isBookingCreatePage) {
|
|
910
924
|
arr.push(actionMap.sale);
|
|
911
925
|
}
|
|
912
926
|
}
|
|
@@ -1047,7 +1061,7 @@ var Footer = function Footer(props) {
|
|
|
1047
1061
|
if (!state.bookingDetail) {
|
|
1048
1062
|
return true;
|
|
1049
1063
|
}
|
|
1050
|
-
if (!((_state$addons3 = state.addons) !== null && _state$addons3 !== void 0 && _state$addons3.load) && state.renderType !== 'eventBooking') {
|
|
1064
|
+
if (!((_state$addons3 = state.addons) !== null && _state$addons3 !== void 0 && _state$addons3.load) && state.renderType !== 'eventBooking' && !state.isBookingCreatePage) {
|
|
1051
1065
|
return true;
|
|
1052
1066
|
}
|
|
1053
1067
|
}
|
|
@@ -1197,7 +1211,7 @@ var Footer = function Footer(props) {
|
|
|
1197
1211
|
style: {
|
|
1198
1212
|
marginTop: 12
|
|
1199
1213
|
}
|
|
1200
|
-
}, state.appointment_status !== 'cancelled' ? /*#__PURE__*/React.createElement(Button, {
|
|
1214
|
+
}, state.appointment_status !== 'cancelled' && !state.isBookingCreatePage ? /*#__PURE__*/React.createElement(Button, {
|
|
1201
1215
|
onClick: function onClick() {
|
|
1202
1216
|
return handleSale();
|
|
1203
1217
|
},
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BookingDashboardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
backgroundColors?: string[];
|
|
4
|
+
labelColor?: string;
|
|
5
|
+
valueColor?: string;
|
|
6
|
+
otherParams?: Record<string, any>;
|
|
7
|
+
refreshKey?: string;
|
|
8
|
+
onDataChange?: (data: {
|
|
9
|
+
groupsOnSiteNow: string | number;
|
|
10
|
+
peopleOnSiteNow: string | number;
|
|
11
|
+
totalVisitorsToday: string | number;
|
|
12
|
+
ongoing: string | number;
|
|
13
|
+
upcoming: string | number;
|
|
14
|
+
overdue: string | number;
|
|
15
|
+
completed: string | number;
|
|
16
|
+
departed: string | number;
|
|
17
|
+
}, dataList: string[]) => void;
|
|
18
|
+
}
|
|
19
|
+
declare const BookingDashboard: (props: BookingDashboardProps) => React.JSX.Element;
|
|
20
|
+
export default BookingDashboard;
|
|
@@ -0,0 +1,253 @@
|
|
|
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
|
+
var _excluded = ["otherParams", "backgroundColors", "labelColor", "valueColor", "refreshKey", "onDataChange"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
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); }
|
|
10
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; } }
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
import React, { useEffect, useState } from 'react';
|
|
21
|
+
import { PisellStatisticList } from '@pisell/materials';
|
|
22
|
+
import { isArr, locales } from '@pisell/utils';
|
|
23
|
+
import dayjs from 'dayjs';
|
|
24
|
+
import useEngineContext from "../../../hooks/useEngineContext";
|
|
25
|
+
import { request } from "../utils";
|
|
26
|
+
import { getBookingList } from "./serve";
|
|
27
|
+
import localeTexts from "../locales";
|
|
28
|
+
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
29
|
+
var BookingDashboard = function BookingDashboard(props) {
|
|
30
|
+
var _props$otherParams = props.otherParams,
|
|
31
|
+
otherParams = _props$otherParams === void 0 ? {} : _props$otherParams,
|
|
32
|
+
backgroundColors = props.backgroundColors,
|
|
33
|
+
labelColor = props.labelColor,
|
|
34
|
+
valueColor = props.valueColor,
|
|
35
|
+
refreshKey = props.refreshKey,
|
|
36
|
+
onDataChange = props.onDataChange,
|
|
37
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
38
|
+
var context = useEngineContext();
|
|
39
|
+
request.setRequest(context.appHelper.utils.request);
|
|
40
|
+
var _useState = useState([
|
|
41
|
+
// 当前在场团体
|
|
42
|
+
{
|
|
43
|
+
label: locales.getText('pisell2.booking.dashboard.groups-on-site-now'),
|
|
44
|
+
value: '-',
|
|
45
|
+
tip: locales.getText('pisell2.booking.dashboard.groups-on-site-now-tip')
|
|
46
|
+
},
|
|
47
|
+
// 当前在场人数
|
|
48
|
+
{
|
|
49
|
+
label: locales.getText('pisell2.booking.dashboard.people-on-site-now'),
|
|
50
|
+
value: '-',
|
|
51
|
+
tip: locales.getText('pisell2.booking.dashboard.people-on-site-now-tip')
|
|
52
|
+
},
|
|
53
|
+
// 今日游客总数
|
|
54
|
+
{
|
|
55
|
+
label: locales.getText('pisell2.booking.dashboard.total-visitors-today'),
|
|
56
|
+
value: '-',
|
|
57
|
+
tip: locales.getText('pisell2.booking.dashboard.total-visitors-today-tip')
|
|
58
|
+
},
|
|
59
|
+
// 正在进行中的游客
|
|
60
|
+
{
|
|
61
|
+
label: locales.getText('pisell2.booking.dashboard.ongoing-visitors'),
|
|
62
|
+
value: '-',
|
|
63
|
+
tip: locales.getText('pisell2.booking.dashboard.ongoing-visitors-tip')
|
|
64
|
+
},
|
|
65
|
+
// 即将到达的游客
|
|
66
|
+
{
|
|
67
|
+
label: locales.getText('pisell2.booking.dashboard.upcoming-visitors'),
|
|
68
|
+
value: '-',
|
|
69
|
+
tip: locales.getText('pisell2.booking.dashboard.upcoming-visitors-tip')
|
|
70
|
+
},
|
|
71
|
+
// 超时的游客
|
|
72
|
+
{
|
|
73
|
+
label: locales.getText('pisell2.booking.dashboard.overdue-visitors'),
|
|
74
|
+
value: '-',
|
|
75
|
+
tip: locales.getText('pisell2.booking.dashboard.overdue-visitors-tip')
|
|
76
|
+
},
|
|
77
|
+
// 已完成的游客
|
|
78
|
+
{
|
|
79
|
+
label: locales.getText('pisell2.booking.dashboard.completed-visitors'),
|
|
80
|
+
value: '-',
|
|
81
|
+
tip: locales.getText('pisell2.booking.dashboard.completed-visitors-tip')
|
|
82
|
+
},
|
|
83
|
+
// 已离场的游客
|
|
84
|
+
{
|
|
85
|
+
label: locales.getText('pisell2.booking.dashboard.departed-visitors'),
|
|
86
|
+
value: '-',
|
|
87
|
+
tip: locales.getText('pisell2.booking.dashboard.departed-visitors-tip')
|
|
88
|
+
}]),
|
|
89
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
90
|
+
data = _useState2[0],
|
|
91
|
+
setData = _useState2[1];
|
|
92
|
+
var _useState3 = useState([]),
|
|
93
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
94
|
+
bookingData = _useState4[0],
|
|
95
|
+
setBookingData = _useState4[1];
|
|
96
|
+
var getData = /*#__PURE__*/function () {
|
|
97
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
98
|
+
var data;
|
|
99
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
100
|
+
while (1) switch (_context.prev = _context.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
_context.next = 2;
|
|
103
|
+
return getBookingList(_objectSpread(_objectSpread({}, otherParams), {}, {
|
|
104
|
+
item_type: 'appointment_booking',
|
|
105
|
+
parent_id: 0,
|
|
106
|
+
with: ['children'],
|
|
107
|
+
child_booking: 0,
|
|
108
|
+
skip: 1,
|
|
109
|
+
num: 1000
|
|
110
|
+
}));
|
|
111
|
+
case 2:
|
|
112
|
+
data = _context.sent;
|
|
113
|
+
setBookingData(data.list);
|
|
114
|
+
case 4:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context.stop();
|
|
117
|
+
}
|
|
118
|
+
}, _callee);
|
|
119
|
+
}));
|
|
120
|
+
return function getData() {
|
|
121
|
+
return _ref.apply(this, arguments);
|
|
122
|
+
};
|
|
123
|
+
}();
|
|
124
|
+
var calcBookingDataCount = function calcBookingDataCount(data) {
|
|
125
|
+
// 当前在场团体
|
|
126
|
+
var groupsOnSiteNow = '-';
|
|
127
|
+
// 当前在场人数
|
|
128
|
+
var peopleOnSiteNow = '-';
|
|
129
|
+
// 今日游客总数
|
|
130
|
+
var totalVisitorsToday = 0;
|
|
131
|
+
// 正在进行中的游客
|
|
132
|
+
var ongoing = 0;
|
|
133
|
+
// 即将到达的游客
|
|
134
|
+
var upcoming = 0;
|
|
135
|
+
// 超时的游客
|
|
136
|
+
var overdue = '-';
|
|
137
|
+
// 已完成的游客
|
|
138
|
+
var completed = 0;
|
|
139
|
+
// 已离场的游客
|
|
140
|
+
var departed = '-';
|
|
141
|
+
data.forEach(function (item) {
|
|
142
|
+
if (isArr(item.children)) {
|
|
143
|
+
item.children.forEach(function (child) {
|
|
144
|
+
var start = dayjs("".concat(child.start_date, " ").concat(child.start_time));
|
|
145
|
+
var end = dayjs("".concat(child.end_date, " ").concat(child.end_time));
|
|
146
|
+
|
|
147
|
+
// 今日游客总数
|
|
148
|
+
totalVisitorsToday += child.number;
|
|
149
|
+
// 正在进行中的游客
|
|
150
|
+
if (start < dayjs() && end > dayjs()) {
|
|
151
|
+
ongoing += child.number || 1;
|
|
152
|
+
}
|
|
153
|
+
// 即将到达的游客
|
|
154
|
+
if (dayjs() < start) {
|
|
155
|
+
upcoming += child.number || 1;
|
|
156
|
+
}
|
|
157
|
+
// 已完成的游客
|
|
158
|
+
if (dayjs() > end) {
|
|
159
|
+
completed += child.number || 1;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange({
|
|
165
|
+
groupsOnSiteNow: groupsOnSiteNow,
|
|
166
|
+
peopleOnSiteNow: peopleOnSiteNow,
|
|
167
|
+
totalVisitorsToday: totalVisitorsToday,
|
|
168
|
+
ongoing: ongoing,
|
|
169
|
+
upcoming: upcoming,
|
|
170
|
+
overdue: overdue,
|
|
171
|
+
completed: completed,
|
|
172
|
+
departed: departed
|
|
173
|
+
}, data);
|
|
174
|
+
setData([
|
|
175
|
+
// 当前在场团体
|
|
176
|
+
{
|
|
177
|
+
label: locales.getText('pisell2.booking.dashboard.groups-on-site-now'),
|
|
178
|
+
tip: locales.getText('pisell2.booking.dashboard.groups-on-site-now-tip'),
|
|
179
|
+
value: "".concat(groupsOnSiteNow)
|
|
180
|
+
},
|
|
181
|
+
// 当前在场人数
|
|
182
|
+
{
|
|
183
|
+
label: locales.getText('pisell2.booking.dashboard.people-on-site-now'),
|
|
184
|
+
tip: locales.getText('pisell2.booking.dashboard.people-on-site-now-tip'),
|
|
185
|
+
value: "".concat(peopleOnSiteNow)
|
|
186
|
+
},
|
|
187
|
+
// 今日游客总数
|
|
188
|
+
{
|
|
189
|
+
label: locales.getText('pisell2.booking.dashboard.total-visitors-today'),
|
|
190
|
+
tip: locales.getText('pisell2.booking.dashboard.total-visitors-today-tip'),
|
|
191
|
+
value: "".concat(totalVisitorsToday)
|
|
192
|
+
},
|
|
193
|
+
// 正在进行中的游客
|
|
194
|
+
{
|
|
195
|
+
label: locales.getText('pisell2.booking.dashboard.ongoing-visitors'),
|
|
196
|
+
tip: locales.getText('pisell2.booking.dashboard.ongoing-visitors-tip'),
|
|
197
|
+
value: "".concat(ongoing)
|
|
198
|
+
},
|
|
199
|
+
// 即将到达的游客
|
|
200
|
+
{
|
|
201
|
+
label: locales.getText('pisell2.booking.dashboard.upcoming-visitors'),
|
|
202
|
+
tip: locales.getText('pisell2.booking.dashboard.upcoming-visitors-tip'),
|
|
203
|
+
value: "".concat(upcoming)
|
|
204
|
+
},
|
|
205
|
+
// 超时的游客
|
|
206
|
+
{
|
|
207
|
+
label: locales.getText('pisell2.booking.dashboard.overdue-visitors'),
|
|
208
|
+
tip: locales.getText('pisell2.booking.dashboard.overdue-visitors-tip'),
|
|
209
|
+
value: "".concat(overdue)
|
|
210
|
+
},
|
|
211
|
+
// 已完成的游客
|
|
212
|
+
{
|
|
213
|
+
label: locales.getText('pisell2.booking.dashboard.completed-visitors'),
|
|
214
|
+
tip: locales.getText('pisell2.booking.dashboard.completed-visitors-tip'),
|
|
215
|
+
value: "".concat(completed)
|
|
216
|
+
},
|
|
217
|
+
// 已离场的游客
|
|
218
|
+
{
|
|
219
|
+
label: locales.getText('pisell2.booking.dashboard.departed-visitors'),
|
|
220
|
+
tip: locales.getText('pisell2.booking.dashboard.departed-visitors-tip'),
|
|
221
|
+
value: "".concat(departed)
|
|
222
|
+
}]);
|
|
223
|
+
};
|
|
224
|
+
useEffect(function () {
|
|
225
|
+
calcBookingDataCount(bookingData);
|
|
226
|
+
|
|
227
|
+
// 每分钟重新计算预约数据
|
|
228
|
+
var timer = setInterval(function () {
|
|
229
|
+
calcBookingDataCount(bookingData);
|
|
230
|
+
}, 60 * 1000);
|
|
231
|
+
return function () {
|
|
232
|
+
clearInterval(timer);
|
|
233
|
+
};
|
|
234
|
+
}, [bookingData]);
|
|
235
|
+
useEffect(function () {
|
|
236
|
+
getData();
|
|
237
|
+
|
|
238
|
+
// 10分钟更新一次数据
|
|
239
|
+
var timer = setInterval(function () {
|
|
240
|
+
getData();
|
|
241
|
+
}, 10 * 60 * 1000);
|
|
242
|
+
return function () {
|
|
243
|
+
clearInterval(timer);
|
|
244
|
+
};
|
|
245
|
+
}, [JSON.stringify(otherParams), refreshKey]);
|
|
246
|
+
return /*#__PURE__*/React.createElement(PisellStatisticList, _extends({}, others, {
|
|
247
|
+
data: data,
|
|
248
|
+
backgroundColors: backgroundColors,
|
|
249
|
+
labelColor: labelColor,
|
|
250
|
+
valueColor: valueColor
|
|
251
|
+
}));
|
|
252
|
+
};
|
|
253
|
+
export default BookingDashboard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBookingList: (params: any) => Promise<any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { request } from "../utils";
|
|
6
|
+
export var getBookingList = /*#__PURE__*/function () {
|
|
7
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
8
|
+
var _yield$request$getReq, data;
|
|
9
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10
|
+
while (1) switch (_context.prev = _context.next) {
|
|
11
|
+
case 0:
|
|
12
|
+
_context.next = 2;
|
|
13
|
+
return request.getRequest().get("/shop/schedule/booking", params);
|
|
14
|
+
case 2:
|
|
15
|
+
_yield$request$getReq = _context.sent;
|
|
16
|
+
data = _yield$request$getReq.data;
|
|
17
|
+
return _context.abrupt("return", data);
|
|
18
|
+
case 5:
|
|
19
|
+
case "end":
|
|
20
|
+
return _context.stop();
|
|
21
|
+
}
|
|
22
|
+
}, _callee);
|
|
23
|
+
}));
|
|
24
|
+
return function getBookingList(_x) {
|
|
25
|
+
return _ref.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
}();
|