@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
|
@@ -43,7 +43,8 @@ var Forms = Provider(function (props) {
|
|
|
43
43
|
addCallback = props.addCallback,
|
|
44
44
|
client = props.client,
|
|
45
45
|
loading = props.loading,
|
|
46
|
-
addButtonProps = props.addButtonProps
|
|
46
|
+
addButtonProps = props.addButtonProps,
|
|
47
|
+
drawerProps = props.drawerProps;
|
|
47
48
|
|
|
48
49
|
// 新增数据
|
|
49
50
|
var onAction = useMemoizedFn( /*#__PURE__*/function () {
|
|
@@ -171,6 +172,7 @@ var Forms = Provider(function (props) {
|
|
|
171
172
|
onChange: function onChange(val) {
|
|
172
173
|
onValueChange(d, val);
|
|
173
174
|
},
|
|
175
|
+
drawerProps: drawerProps,
|
|
174
176
|
onAdd: function onAdd() {
|
|
175
177
|
onAction(d, true);
|
|
176
178
|
},
|
|
@@ -194,6 +196,6 @@ var Forms = Provider(function (props) {
|
|
|
194
196
|
optionRender: optionRender
|
|
195
197
|
})));
|
|
196
198
|
}));
|
|
197
|
-
}, [forms, hideTitle, modalOpen, value, loading, client === null || client === void 0 ? void 0 : client.id, addButtonProps, customSelectProps, optionRender]);
|
|
199
|
+
}, [forms, hideTitle, modalOpen, value, loading, client === null || client === void 0 ? void 0 : client.id, addButtonProps, customSelectProps, optionRender, drawerProps]);
|
|
198
200
|
});
|
|
199
201
|
export default Forms;
|
|
@@ -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: {
|
|
@@ -7,5 +7,5 @@ import "./index.less";
|
|
|
7
7
|
* @Author: zhiwei.Wang
|
|
8
8
|
* @Date: 2024-01-30 17:06
|
|
9
9
|
*/
|
|
10
|
-
declare const Single: ({ value, onChange, form, mode, optionRender, loading, customSelectProps, onAdd, addButtonProps, modalOpen, watch, }: any) => React.JSX.Element;
|
|
10
|
+
declare const Single: ({ value, onChange, form, mode, optionRender, loading, customSelectProps, onAdd, addButtonProps, modalOpen, watch, drawerProps, }: any) => React.JSX.Element;
|
|
11
11
|
export default Single;
|
|
@@ -41,7 +41,8 @@ var Single = function Single(_ref) {
|
|
|
41
41
|
onAdd = _ref.onAdd,
|
|
42
42
|
addButtonProps = _ref.addButtonProps,
|
|
43
43
|
modalOpen = _ref.modalOpen,
|
|
44
|
-
watch = _ref.watch
|
|
44
|
+
watch = _ref.watch,
|
|
45
|
+
drawerProps = _ref.drawerProps;
|
|
45
46
|
// const primaryField = useMemo(() => {
|
|
46
47
|
// return field.field[0]?.key || "";
|
|
47
48
|
// }, [field]);
|
|
@@ -234,10 +235,10 @@ var Single = function Single(_ref) {
|
|
|
234
235
|
},
|
|
235
236
|
name: ((_form$form3 = form.form) === null || _form$form3 === void 0 ? void 0 : _form$form3.title) || "-",
|
|
236
237
|
addButtonProps: _addButtonProps,
|
|
237
|
-
drawerProps: {
|
|
238
|
+
drawerProps: _objectSpread({
|
|
238
239
|
title: "".concat(locales.getText("pisell2.text.select"), " ").concat(((_form$form4 = form.form) === null || _form$form4 === void 0 ? void 0 : _form$form4.title) || "-"),
|
|
239
240
|
destroyOnClose: true
|
|
240
|
-
},
|
|
241
|
+
}, drawerProps || {}),
|
|
241
242
|
optionRender: _optionRender,
|
|
242
243
|
rowKey: "form_record_id"
|
|
243
244
|
}, customSelectProps || {})));
|
|
@@ -0,0 +1,33 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
7
|
+
import React, { useRef } from 'react';
|
|
8
|
+
import AddService from "../service/addService";
|
|
9
|
+
var AddServiceVariant = function AddServiceVariant(props) {
|
|
10
|
+
var globalState = props.globalState,
|
|
11
|
+
setGlobalState = props.setGlobalState;
|
|
12
|
+
var stateRef = useRef(globalState);
|
|
13
|
+
stateRef.current = globalState;
|
|
14
|
+
var dispatch = function dispatch(_ref) {
|
|
15
|
+
var type = _ref.type,
|
|
16
|
+
payload = _ref.payload;
|
|
17
|
+
if (type === 'setService') {
|
|
18
|
+
setGlobalState({
|
|
19
|
+
service: _objectSpread(_objectSpread({}, stateRef.current.service), payload)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/React.createElement(AddService, {
|
|
24
|
+
renderMode: "current",
|
|
25
|
+
dispatch: dispatch,
|
|
26
|
+
state: globalState,
|
|
27
|
+
drawerProps: {
|
|
28
|
+
open: true,
|
|
29
|
+
getContainer: false
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export default AddServiceVariant;
|
|
@@ -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;
|
|
@@ -18,6 +18,7 @@ interface SelectDrawerProps {
|
|
|
18
18
|
handleAddPet: any;
|
|
19
19
|
modalOpen: boolean;
|
|
20
20
|
franchiseeLoading?: number;
|
|
21
|
+
showHeader?: boolean;
|
|
21
22
|
}
|
|
22
23
|
declare const _default: React.ForwardRefExoticComponent<SelectDrawerProps & React.RefAttributes<unknown>>;
|
|
23
24
|
export default _default;
|