@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.
Files changed (87) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +6 -6
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +5 -5
  11. package/es/components/booking/addons/index.js +10 -7
  12. package/es/components/booking/addons/model.d.ts +2 -1
  13. package/es/components/booking/components/TabProduct/index.js +1 -1
  14. package/es/components/booking/components/customSelect/index.js +5 -1
  15. package/es/components/booking/components/drawer/index.d.ts +3 -3
  16. package/es/components/booking/components/drawer/index.js +15 -13
  17. package/es/components/booking/components/drawer/index.less +8 -6
  18. package/es/components/booking/components/footer/index.js +21 -7
  19. package/es/components/booking/deposit/EditDepositModal/index.less +3 -0
  20. package/es/components/booking/forms/model.d.ts +2 -1
  21. package/es/components/booking/info/client/index.js +35 -15
  22. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +4 -4
  23. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +59 -32
  24. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +3 -0
  25. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.js +14 -0
  26. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +3 -3
  27. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +38 -34
  28. package/es/components/booking/info/clientVariant/vertical/index.d.ts +1 -1
  29. package/es/components/booking/info/clientVariant/vertical/index.js +30 -13
  30. package/es/components/booking/info/clientVariant/vertical/index.less +30 -12
  31. package/es/components/booking/info/date/index.js +1 -0
  32. package/es/components/booking/info/date/index.less +2 -0
  33. package/es/components/booking/info/header/index.js +13 -12
  34. package/es/components/booking/info/main.js +10 -1
  35. package/es/components/booking/info/service/addService/index.js +10 -8
  36. package/es/components/booking/info/service/addTimeModal/index.js +1 -0
  37. package/es/components/booking/info/service/addTimeModal/index.less +1 -1
  38. package/es/components/booking/info/service/editService/index.js +3 -2
  39. package/es/components/booking/info/service/serviceList/index.js +2 -1
  40. package/es/components/booking/info/utils.js +1 -1
  41. package/es/components/booking/info2/index.js +10 -1
  42. package/es/components/booking/info2/utilsByBooking.js +2 -3
  43. package/es/components/booking/model.d.ts +2 -0
  44. package/es/components/booking/notes/index.d.ts +1 -1
  45. package/es/components/booking/notes/model.d.ts +2 -1
  46. package/es/components/booking/payments/model.d.ts +2 -1
  47. package/es/components/schedules/index.d.ts +1 -1
  48. package/es/components/schedules/model.d.ts +2 -1
  49. package/lib/components/booking/addons/index.js +2 -5
  50. package/lib/components/booking/addons/model.d.ts +2 -1
  51. package/lib/components/booking/components/TabProduct/index.js +1 -1
  52. package/lib/components/booking/components/customSelect/index.js +2 -1
  53. package/lib/components/booking/components/drawer/index.d.ts +3 -3
  54. package/lib/components/booking/components/drawer/index.js +13 -11
  55. package/lib/components/booking/components/drawer/index.less +8 -6
  56. package/lib/components/booking/components/footer/index.js +16 -12
  57. package/lib/components/booking/deposit/EditDepositModal/index.less +3 -0
  58. package/lib/components/booking/forms/model.d.ts +2 -1
  59. package/lib/components/booking/info/client/index.js +33 -21
  60. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +4 -4
  61. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +33 -13
  62. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +3 -0
  63. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.js +36 -0
  64. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +3 -3
  65. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +39 -9
  66. package/lib/components/booking/info/clientVariant/vertical/index.d.ts +1 -1
  67. package/lib/components/booking/info/clientVariant/vertical/index.js +52 -31
  68. package/lib/components/booking/info/clientVariant/vertical/index.less +30 -12
  69. package/lib/components/booking/info/date/index.js +1 -0
  70. package/lib/components/booking/info/date/index.less +2 -0
  71. package/lib/components/booking/info/header/index.js +14 -12
  72. package/lib/components/booking/info/main.js +14 -1
  73. package/lib/components/booking/info/service/addService/index.js +3 -1
  74. package/lib/components/booking/info/service/addTimeModal/index.js +1 -0
  75. package/lib/components/booking/info/service/addTimeModal/index.less +1 -1
  76. package/lib/components/booking/info/service/editService/index.js +8 -7
  77. package/lib/components/booking/info/service/serviceList/index.js +4 -3
  78. package/lib/components/booking/info/utils.js +1 -1
  79. package/lib/components/booking/info2/index.js +14 -1
  80. package/lib/components/booking/info2/utilsByBooking.js +1 -2
  81. package/lib/components/booking/model.d.ts +2 -0
  82. package/lib/components/booking/notes/index.d.ts +1 -1
  83. package/lib/components/booking/notes/model.d.ts +2 -1
  84. package/lib/components/booking/payments/model.d.ts +2 -1
  85. package/lib/components/schedules/index.d.ts +1 -1
  86. package/lib/components/schedules/model.d.ts +2 -1
  87. 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
- useEffect(function () {
165
- // addons 只有详情阶段之后才可以进行
166
- if (state.bookingDetail) {
167
- init();
168
- }
169
- }, [state.bookingDetail]);
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) => (props: any) => JSX.Element, Context: import("react").Context<{
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: "100px"
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: 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 "react";
2
- import { DrawerProps } from "antd";
3
- import "./index.less";
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 "react";
3
- import { Drawer as OriginDrawer } from "antd";
4
- import ArrowLeft from "@pisell/icon/es/ArrowLeft";
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 "classnames";
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: "600px",
21
+ width: '600px',
22
22
  closable: false,
23
23
  zIndex: 999
24
24
  }, props, {
25
- className: classNames("pisell-lowcode__booking-drawer", props.className, {
26
- "pisell-lowcode__booking-drawer-hide-scrollbar": hideScrollBar
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("pisell-lowcode__booking-drawer-title-wrap")
36
- }, showGoBack && /*#__PURE__*/React.createElement(ArrowLeft, {
37
- className: "pisell-lowcode__booking-drawer-back",
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("pisell-lowcode__booking-drawer-title", {
44
- "pisell-lowcode__booking-drawer-title-no-wrap": props.titleNoWrap
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: 32px;
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
- /* Display sm/Medium */
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, _store$getState, _store$getState$call, _store$getState$call$, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingConfig8, _state$bookingConfig9, _state$addons2, _state$addons4, _state$bookingDetail11;
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
- var isShowPaymentLink = store === null || store === void 0 ? void 0 : (_store$getState = store.getState) === null || _store$getState === void 0 ? void 0 : (_store$getState$call = _store$getState.call(store)) === null || _store$getState$call === void 0 ? void 0 : (_store$getState$call$ = _store$getState$call.global) === null || _store$getState$call$ === void 0 ? void 0 : _store$getState$call$.paymentLinkBtnShow;
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
- useEffect(function () {
128
- store === null || store === void 0 ? void 0 : store.dispatch({
129
- type: 'global/_getPaymentLinkBtnShow'
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 () {
@@ -3,6 +3,9 @@
3
3
  display: flex;
4
4
  gap: 12px;
5
5
  }
6
+ .pisell-lowcode-modal-header {
7
+ padding: 0 0 10px;
8
+ }
6
9
  .pisell-lowcode__edit-deposit-modal-field-list {
7
10
  display: flex;
8
11
  flex-direction: column;
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { FormState } from "../model";
2
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
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: 50,
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
- _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
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.getClients;
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
- _setLoading(false);
141
+ setLoading(false);
142
+ setLoadLoading(false);
143
+ isLoadClient = true;
130
144
  return _context.abrupt("return", {});
131
- case 17:
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
- return item.name || (item.display_name || '').trim() || (item.nickname || '').trim() || '';
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
- getClients(_objectSpread(_objectSpread({}, state.client.clientsParams), {}, {
285
- search: '',
286
- customer_id: customer_id,
287
- skip: 1
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 "react";
2
- import { FormState } from "../../../model";
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["client"]>) => void;
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 "react";
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 "@pisell/utils";
28
- import { Button } from "antd";
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: 50,
52
+ num: 5,
50
53
  total: 0,
51
- search: "",
52
- with: ["formRecord"],
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
- _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
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), state.isFranchisee ? {
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
- _setLoading(false);
153
+ isLoadClient = true;
154
+ setLoading(false);
155
+ setLoadLoading(false);
140
156
  return _context.abrupt("return", {});
141
- case 19:
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: "pisell1.handleOpenCustomerModal",
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: "remove",
192
- label: locales.getText("pisell2.text.remove-customer")
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 === "view";
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("pisell2.text.select-a-customer");
281
+ return locales.getText('pisell2.text.select-a-customer');
266
282
  }
267
- return item.name || (item.display_name || "").trim() || (item.nickname || "").trim() || "";
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: "pisell1.registerPlugin",
289
+ type: 'pisell1.registerPlugin',
273
290
  data: {
274
- pluginList: ["CustomerDetailPlugin"]
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: "pisell1.handleOpenAddCustomerModal",
351
+ type: 'pisell1.handleOpenAddCustomerModal',
335
352
  data: {
336
353
  showReceiveAddress: false,
337
354
  showAcceptsMarketing: false
338
355
  },
339
- callback: function callback(customer_id) {
340
- getClients(_objectSpread(_objectSpread({}, state.client.clientsParams), {}, {
341
- search: "",
342
- customer_id: customer_id,
343
- skip: 1
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: "center",
361
- padding: "16px 0"
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("pisell2.text.load-more"))) : null;
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,3 @@
1
+ /// <reference types="react" />
2
+ declare const useIsLowSpeedNetwork: () => import("react").MutableRefObject<boolean>;
3
+ export default useIsLowSpeedNetwork;
@@ -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 "react";
2
- import "./SelectDrawer.less";
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;