@pisell/private-materials 3.0.154 → 3.0.156
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 +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +6 -6
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- 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 +21 -7
- package/es/components/booking/deposit/EditDepositModal/index.less +3 -0
- package/es/components/booking/forms/model.d.ts +2 -1
- 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 +3 -3
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +38 -34
- package/es/components/booking/info/clientVariant/vertical/index.d.ts +1 -1
- package/es/components/booking/info/clientVariant/vertical/index.js +30 -13
- package/es/components/booking/info/clientVariant/vertical/index.less +30 -12
- 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/main.js +10 -1
- package/es/components/booking/info/service/addService/index.js +10 -8
- 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 +3 -2
- 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/info2/utilsByBooking.js +2 -3
- package/es/components/booking/model.d.ts +2 -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/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +2 -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 +16 -12
- package/lib/components/booking/deposit/EditDepositModal/index.less +3 -0
- package/lib/components/booking/forms/model.d.ts +2 -1
- 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 +3 -3
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +39 -9
- package/lib/components/booking/info/clientVariant/vertical/index.d.ts +1 -1
- package/lib/components/booking/info/clientVariant/vertical/index.js +52 -31
- package/lib/components/booking/info/clientVariant/vertical/index.less +30 -12
- 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/main.js +14 -1
- package/lib/components/booking/info/service/addService/index.js +3 -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 +8 -7
- 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/info2/utilsByBooking.js +1 -2
- package/lib/components/booking/model.d.ts +2 -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/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +2 -1
- package/package.json +4 -4
|
@@ -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 () {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { FormState } from "../model";
|
|
2
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
|
|
3
4
|
state: FormState;
|
|
4
5
|
} & {
|
|
5
6
|
dispatch: (params: {
|
|
@@ -32,6 +32,7 @@ import { image, locales } from '@pisell/utils';
|
|
|
32
32
|
import { isWalkIn as getIsWalkIn } from "../../utils";
|
|
33
33
|
import { getFranchiseeCustomerInfo, getFranchiseeCustomerList } from "./serve";
|
|
34
34
|
import { useMemoizedFn } from 'ahooks';
|
|
35
|
+
var isLoadClient = false;
|
|
35
36
|
var Client = function Client() {
|
|
36
37
|
var _state$client$value2, _state$client$value3, _state$client$value4, _state$client$value5, _state$client$value6, _state$client$value7;
|
|
37
38
|
var modalRef = useRef();
|
|
@@ -52,9 +53,10 @@ var Client = function Client() {
|
|
|
52
53
|
setFranchiseeLoading = _useState6[1];
|
|
53
54
|
var _useState7 = useState({
|
|
54
55
|
skip: 1,
|
|
55
|
-
num:
|
|
56
|
+
num: 10,
|
|
56
57
|
total: 0,
|
|
57
|
-
search: ''
|
|
58
|
+
search: '',
|
|
59
|
+
sort_by: 'id'
|
|
58
60
|
}),
|
|
59
61
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
60
62
|
params = _useState8[0],
|
|
@@ -79,14 +81,24 @@ var Client = function Client() {
|
|
|
79
81
|
}, [state.disabledEdit]);
|
|
80
82
|
var getClients = /*#__PURE__*/function () {
|
|
81
83
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
82
|
-
var customer_id, resetParams, _setLoading, api, data, list, _payload, customerItem, totalList;
|
|
84
|
+
var customer_id, resetParams, _setLoading, _state$client, _state$client$clients, api, data, list, _payload, customerItem, totalList;
|
|
83
85
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
84
86
|
while (1) switch (_context.prev = _context.next) {
|
|
85
87
|
case 0:
|
|
86
88
|
customer_id = _ref.customer_id, resetParams = _objectWithoutProperties(_ref, _excluded);
|
|
87
|
-
|
|
89
|
+
if (resetParams.skip === 1) {
|
|
90
|
+
// 搜索时展示loading
|
|
91
|
+
if (resetParams.search) {
|
|
92
|
+
_setLoading = setLoading;
|
|
93
|
+
} else {
|
|
94
|
+
_setLoading = isLoadClient || state !== null && state !== void 0 && (_state$client = state.client) !== null && _state$client !== void 0 && (_state$client$clients = _state$client.clients) !== null && _state$client$clients !== void 0 && _state$client$clients.length ? function () {} : setLoading;
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
_setLoading = setLoadLoading;
|
|
98
|
+
}
|
|
99
|
+
// let _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
|
|
88
100
|
_setLoading(true);
|
|
89
|
-
api = state.isFranchisee ? getFranchiseeCustomerList : state.apis.
|
|
101
|
+
api = state.isFranchisee ? getFranchiseeCustomerList : state.apis.getClientsEs;
|
|
90
102
|
_context.next = 6;
|
|
91
103
|
return api(_objectSpread(_objectSpread({}, resetParams), !state.isFranchisee ? {
|
|
92
104
|
_config: {
|
|
@@ -126,9 +138,11 @@ var Client = function Client() {
|
|
|
126
138
|
type: 'setClient',
|
|
127
139
|
payload: _payload
|
|
128
140
|
});
|
|
129
|
-
|
|
141
|
+
setLoading(false);
|
|
142
|
+
setLoadLoading(false);
|
|
143
|
+
isLoadClient = true;
|
|
130
144
|
return _context.abrupt("return", {});
|
|
131
|
-
case
|
|
145
|
+
case 19:
|
|
132
146
|
case "end":
|
|
133
147
|
return _context.stop();
|
|
134
148
|
}
|
|
@@ -153,7 +167,8 @@ var Client = function Client() {
|
|
|
153
167
|
if (getIsWalkIn(item === null || item === void 0 ? void 0 : item.id)) {
|
|
154
168
|
return locales.getText('pisell2.text.select-a-customer');
|
|
155
169
|
}
|
|
156
|
-
|
|
170
|
+
var firstLastName = item.first_name || item.last_name ? "".concat(item.first_name, " ").concat(item.last_name) : "";
|
|
171
|
+
return item.name || (item.display_name || '').trim() || (item.nickname || '').trim() || firstLastName.trim() || '';
|
|
157
172
|
}, [locales.localeMap]);
|
|
158
173
|
|
|
159
174
|
/**
|
|
@@ -280,12 +295,17 @@ var Client = function Client() {
|
|
|
280
295
|
showReceiveAddress: false,
|
|
281
296
|
showAcceptsMarketing: false
|
|
282
297
|
},
|
|
283
|
-
callback: function callback(customer_id) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
298
|
+
callback: function callback(customer_id, params) {
|
|
299
|
+
var _params$, _params$2, _state$client2;
|
|
300
|
+
// 创建后本地数据处理到数组
|
|
301
|
+
dispatch({
|
|
302
|
+
type: 'setClient',
|
|
303
|
+
payload: {
|
|
304
|
+
clients: [].concat(_toConsumableArray(params !== null && params !== void 0 && (_params$ = params[0]) !== null && _params$ !== void 0 && _params$.customer ? [_objectSpread(_objectSpread({}, params === null || params === void 0 ? void 0 : (_params$2 = params[0]) === null || _params$2 === void 0 ? void 0 : _params$2.customer), {}, {
|
|
305
|
+
id: customer_id
|
|
306
|
+
})] : []), _toConsumableArray(((_state$client2 = state.client) === null || _state$client2 === void 0 ? void 0 : _state$client2.clients) || []))
|
|
307
|
+
}
|
|
308
|
+
});
|
|
289
309
|
}
|
|
290
310
|
});
|
|
291
311
|
});
|
|
@@ -384,7 +404,7 @@ var Client = function Client() {
|
|
|
384
404
|
mode: "single",
|
|
385
405
|
createItemText: locales.getText('pisell2.text.create-new-customer'),
|
|
386
406
|
closeCallback: function closeCallback() {
|
|
387
|
-
searchChange('');
|
|
407
|
+
// searchChange('');
|
|
388
408
|
},
|
|
389
409
|
optionRender: function optionRender(item) {
|
|
390
410
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { FormState } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormState } from '../../../model';
|
|
3
3
|
interface useClientFnParams {
|
|
4
4
|
state: any;
|
|
5
5
|
setGlobalState: (val: any) => void;
|
|
@@ -7,7 +7,7 @@ interface useClientFnParams {
|
|
|
7
7
|
onRemoveClient?: () => void;
|
|
8
8
|
}
|
|
9
9
|
declare const useClientFn: (_params: useClientFnParams) => {
|
|
10
|
-
setClient: (client: Partial<FormState[
|
|
10
|
+
setClient: (client: Partial<FormState['client']>) => void;
|
|
11
11
|
isWalkIn: boolean;
|
|
12
12
|
handleSelectClient: (value: any) => Promise<unknown>;
|
|
13
13
|
menuChange: (e: any) => void;
|
|
@@ -16,7 +16,7 @@ declare const useClientFn: (_params: useClientFnParams) => {
|
|
|
16
16
|
key: string;
|
|
17
17
|
label: any;
|
|
18
18
|
}[];
|
|
19
|
-
handleCreateItem: () => void;
|
|
19
|
+
handleCreateItem: (cb?: () => void) => void;
|
|
20
20
|
getClients: ({ customer_id, customer_ids, ...resetParams }: {
|
|
21
21
|
customer_id?: number | undefined;
|
|
22
22
|
skip?: number | undefined;
|
|
@@ -20,12 +20,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
20
20
|
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; }
|
|
21
21
|
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; } }
|
|
22
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from
|
|
23
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24
24
|
import { isWalkIn as getIsWalkIn } from "../../../utils";
|
|
25
25
|
import { getFranchiseeCustomerInfo, getFranchiseeCustomerList } from "../../client/serve";
|
|
26
26
|
import { walkInData } from "../../model";
|
|
27
|
-
import { locales } from
|
|
28
|
-
import { Button } from
|
|
27
|
+
import { locales } from '@pisell/utils';
|
|
28
|
+
import { Button } from 'antd';
|
|
29
|
+
import useIsLowSpeedNetwork from "./useIsLowSpeedNetwork";
|
|
30
|
+
var isLoadClient = false;
|
|
29
31
|
var useClientFn = function useClientFn(_params) {
|
|
30
32
|
var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2, _state$bookingConfig$3, _state$bookingConfig6, _state$bookingConfig7, _state$bookingConfig8, _state$client$value2;
|
|
31
33
|
var state = _params.state,
|
|
@@ -44,12 +46,13 @@ var useClientFn = function useClientFn(_params) {
|
|
|
44
46
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
47
|
franchiseeLoading = _useState6[0],
|
|
46
48
|
setFranchiseeLoading = _useState6[1];
|
|
49
|
+
var isLowSpeedNetwork = useIsLowSpeedNetwork();
|
|
47
50
|
var _useState7 = useState({
|
|
48
51
|
skip: 1,
|
|
49
|
-
num:
|
|
52
|
+
num: 5,
|
|
50
53
|
total: 0,
|
|
51
|
-
search:
|
|
52
|
-
with: [
|
|
54
|
+
search: '',
|
|
55
|
+
with: ['formRecord'],
|
|
53
56
|
relation_form_id: 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$.basic) === null || _state$bookingConfig$2 === void 0 ? void 0 : (_state$bookingConfig$3 = _state$bookingConfig$2.appointment_subject) === null || _state$bookingConfig$3 === void 0 ? void 0 : _state$bookingConfig$3.form_id
|
|
54
57
|
}),
|
|
55
58
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -73,16 +76,27 @@ var useClientFn = function useClientFn(_params) {
|
|
|
73
76
|
}, [(_state$client$value2 = state.client.value) === null || _state$client$value2 === void 0 ? void 0 : _state$client$value2.id]);
|
|
74
77
|
var getClients = /*#__PURE__*/function () {
|
|
75
78
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, returnResult) {
|
|
76
|
-
var customer_id, customer_ids, resetParams, _setLoading, api, data, list, _payload, customerItem, totalList;
|
|
79
|
+
var customer_id, customer_ids, resetParams, _setLoading, _state$client, _state$client$clients, api, data, list, _payload, customerItem, totalList;
|
|
77
80
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
78
81
|
while (1) switch (_context.prev = _context.next) {
|
|
79
82
|
case 0:
|
|
80
83
|
customer_id = _ref.customer_id, customer_ids = _ref.customer_ids, resetParams = _objectWithoutProperties(_ref, _excluded);
|
|
81
|
-
|
|
84
|
+
if (resetParams.skip === 1) {
|
|
85
|
+
// 搜索时展示loading
|
|
86
|
+
if (resetParams.search) {
|
|
87
|
+
_setLoading = setLoading;
|
|
88
|
+
} else {
|
|
89
|
+
_setLoading = isLoadClient || state !== null && state !== void 0 && (_state$client = state.client) !== null && _state$client !== void 0 && (_state$client$clients = _state$client.clients) !== null && _state$client$clients !== void 0 && _state$client$clients.length ? function () {} : setLoading;
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
_setLoading = setLoadLoading;
|
|
93
|
+
}
|
|
82
94
|
_setLoading(true);
|
|
83
95
|
api = state.isFranchisee ? getFranchiseeCustomerList : state.apis.getClients;
|
|
84
96
|
_context.next = 6;
|
|
85
|
-
return api(_objectSpread(_objectSpread(_objectSpread({}, resetParams),
|
|
97
|
+
return api(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, resetParams), resetParams.search ? {
|
|
98
|
+
num: 10
|
|
99
|
+
} : {}), state.isFranchisee ? {
|
|
86
100
|
franchisee_customer_ids: customer_ids
|
|
87
101
|
} : {
|
|
88
102
|
customer_ids: customer_ids
|
|
@@ -136,9 +150,11 @@ var useClientFn = function useClientFn(_params) {
|
|
|
136
150
|
setGlobalState({
|
|
137
151
|
client: _objectSpread(_objectSpread({}, stateRef.current.client), _payload)
|
|
138
152
|
});
|
|
139
|
-
|
|
153
|
+
isLoadClient = true;
|
|
154
|
+
setLoading(false);
|
|
155
|
+
setLoadLoading(false);
|
|
140
156
|
return _context.abrupt("return", {});
|
|
141
|
-
case
|
|
157
|
+
case 21:
|
|
142
158
|
case "end":
|
|
143
159
|
return _context.stop();
|
|
144
160
|
}
|
|
@@ -157,14 +173,14 @@ var useClientFn = function useClientFn(_params) {
|
|
|
157
173
|
showModal: true
|
|
158
174
|
});
|
|
159
175
|
getClients(_objectSpread(_objectSpread({}, paramsRef.current), {}, {
|
|
160
|
-
search: val ||
|
|
176
|
+
search: val || '',
|
|
161
177
|
skip: 1
|
|
162
178
|
}));
|
|
163
179
|
(_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.open();
|
|
164
180
|
};
|
|
165
181
|
var handleViewClient = function handleViewClient() {
|
|
166
182
|
state.action({
|
|
167
|
-
type:
|
|
183
|
+
type: 'pisell1.handleOpenCustomerModal',
|
|
168
184
|
data: {
|
|
169
185
|
id: state.client.value.id
|
|
170
186
|
},
|
|
@@ -176,7 +192,7 @@ var useClientFn = function useClientFn(_params) {
|
|
|
176
192
|
handleSelectClient([data]);
|
|
177
193
|
}
|
|
178
194
|
getClients(_objectSpread(_objectSpread({}, state.client.clientsParams), {}, {
|
|
179
|
-
search:
|
|
195
|
+
search: '',
|
|
180
196
|
customer_id: data === null || data === void 0 ? void 0 : data.id,
|
|
181
197
|
skip: 1
|
|
182
198
|
}));
|
|
@@ -188,12 +204,12 @@ var useClientFn = function useClientFn(_params) {
|
|
|
188
204
|
// { key: "view", label: locales.getText("pisell2.text.view-profile") },
|
|
189
205
|
// { key: "change", label: locales.getText("pisell2.text.change-customer") },
|
|
190
206
|
{
|
|
191
|
-
key:
|
|
192
|
-
label: locales.getText(
|
|
207
|
+
key: 'remove',
|
|
208
|
+
label: locales.getText('pisell2.text.remove-customer')
|
|
193
209
|
}];
|
|
194
210
|
if (state.disabledEdit) {
|
|
195
211
|
list = list.filter(function (d) {
|
|
196
|
-
return d.key ===
|
|
212
|
+
return d.key === 'view';
|
|
197
213
|
});
|
|
198
214
|
}
|
|
199
215
|
return list;
|
|
@@ -262,16 +278,17 @@ var useClientFn = function useClientFn(_params) {
|
|
|
262
278
|
}();
|
|
263
279
|
var getNickname = useCallback(function (item) {
|
|
264
280
|
if (getIsWalkIn(item === null || item === void 0 ? void 0 : item.id)) {
|
|
265
|
-
return locales.getText(
|
|
281
|
+
return locales.getText('pisell2.text.select-a-customer');
|
|
266
282
|
}
|
|
267
|
-
|
|
283
|
+
var firstLastName = item.first_name || item.last_name ? "".concat(item.first_name, " ").concat(item.last_name) : "";
|
|
284
|
+
return item.name || (item.display_name || '').trim() || (item.nickname || '').trim() || firstLastName.trim() || '';
|
|
268
285
|
}, [locales.localeMap]);
|
|
269
286
|
useEffect(function () {
|
|
270
287
|
if (state.action) {
|
|
271
288
|
state.action({
|
|
272
|
-
type:
|
|
289
|
+
type: 'pisell1.registerPlugin',
|
|
273
290
|
data: {
|
|
274
|
-
pluginList: [
|
|
291
|
+
pluginList: ['CustomerDetailPlugin']
|
|
275
292
|
}
|
|
276
293
|
});
|
|
277
294
|
}
|
|
@@ -329,22 +346,32 @@ var useClientFn = function useClientFn(_params) {
|
|
|
329
346
|
return _ref4.apply(this, arguments);
|
|
330
347
|
};
|
|
331
348
|
}();
|
|
332
|
-
var handleCreateItem = function handleCreateItem() {
|
|
349
|
+
var handleCreateItem = function handleCreateItem(cb) {
|
|
333
350
|
state.action({
|
|
334
|
-
type:
|
|
351
|
+
type: 'pisell1.handleOpenAddCustomerModal',
|
|
335
352
|
data: {
|
|
336
353
|
showReceiveAddress: false,
|
|
337
354
|
showAcceptsMarketing: false
|
|
338
355
|
},
|
|
339
|
-
callback: function callback(customer_id) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
356
|
+
callback: function callback(customer_id, params) {
|
|
357
|
+
var _params$, _params$2, _state$client2;
|
|
358
|
+
cb === null || cb === void 0 ? void 0 : cb();
|
|
359
|
+
setClient({
|
|
360
|
+
clients: [].concat(_toConsumableArray(params !== null && params !== void 0 && (_params$ = params[0]) !== null && _params$ !== void 0 && _params$.customer ? [_objectSpread(_objectSpread({}, params === null || params === void 0 ? void 0 : (_params$2 = params[0]) === null || _params$2 === void 0 ? void 0 : _params$2.customer), {}, {
|
|
361
|
+
id: customer_id,
|
|
362
|
+
form_record: []
|
|
363
|
+
})] : []), _toConsumableArray(((_state$client2 = state.client) === null || _state$client2 === void 0 ? void 0 : _state$client2.clients) || []))
|
|
364
|
+
});
|
|
365
|
+
// getClients({
|
|
366
|
+
// ...state.client.clientsParams,
|
|
367
|
+
// search: '',
|
|
368
|
+
// customer_id,
|
|
369
|
+
// skip: 1,
|
|
370
|
+
// });
|
|
345
371
|
}
|
|
346
372
|
});
|
|
347
373
|
};
|
|
374
|
+
|
|
348
375
|
var searchChange = function searchChange(search) {
|
|
349
376
|
var _params = _objectSpread(_objectSpread({}, paramsRef.current), {}, {
|
|
350
377
|
skip: 1,
|
|
@@ -357,8 +384,8 @@ var useClientFn = function useClientFn(_params) {
|
|
|
357
384
|
return show ? /*#__PURE__*/React.createElement("div", {
|
|
358
385
|
className: "",
|
|
359
386
|
style: {
|
|
360
|
-
textAlign:
|
|
361
|
-
padding:
|
|
387
|
+
textAlign: 'center',
|
|
388
|
+
padding: '16px 0'
|
|
362
389
|
}
|
|
363
390
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
364
391
|
loading: loadLoading,
|
|
@@ -368,7 +395,7 @@ var useClientFn = function useClientFn(_params) {
|
|
|
368
395
|
});
|
|
369
396
|
getClients(_objectSpread({}, _params));
|
|
370
397
|
}
|
|
371
|
-
}, locales.getText(
|
|
398
|
+
}, locales.getText('pisell2.text.load-more'))) : null;
|
|
372
399
|
}, [loadLoading, params, state.client.clients.length]);
|
|
373
400
|
return {
|
|
374
401
|
setClient: setClient,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useMemo, useRef } from 'react';
|
|
2
|
+
import { useNetwork } from "ahooks";
|
|
3
|
+
var useIsLowSpeedNetwork = function useIsLowSpeedNetwork() {
|
|
4
|
+
var networkState = useNetwork();
|
|
5
|
+
var isLowSpeedNetwork = useRef(false);
|
|
6
|
+
|
|
7
|
+
// 低速网络
|
|
8
|
+
var isLowSpeedNetworkMemo = useMemo(function () {
|
|
9
|
+
return ['slow-2g', '2g', '3g'].includes((networkState === null || networkState === void 0 ? void 0 : networkState.effectiveType) || '') || ((networkState === null || networkState === void 0 ? void 0 : networkState.downlink) || 20) <= 1 || ((networkState === null || networkState === void 0 ? void 0 : networkState.rtt) || 0) > 500;
|
|
10
|
+
}, [networkState]);
|
|
11
|
+
isLowSpeedNetwork.current = isLowSpeedNetworkMemo;
|
|
12
|
+
return isLowSpeedNetwork;
|
|
13
|
+
};
|
|
14
|
+
export default useIsLowSpeedNetwork;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SelectDrawer.less';
|
|
3
3
|
interface SelectDrawerProps {
|
|
4
4
|
autoFocus?: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
handleSelectClient: (val: any) => void;
|
|
7
|
-
handleCreateItem: () => void;
|
|
7
|
+
handleCreateItem: (cb: () => void) => void;
|
|
8
8
|
handleSelectPet: (val: any) => void;
|
|
9
9
|
childrenValue: any[];
|
|
10
10
|
formData: any;
|