@pisell/private-materials 6.3.99 → 6.3.101

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 (113) 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 +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/components/footer/index.js +26 -20
  12. package/es/components/booking/info/header/index.js +7 -7
  13. package/es/components/booking/info/header/index.less +5 -5
  14. package/es/components/ecocup/components/AddCustomerModal/index.js +3 -3
  15. package/es/components/ecocup/components/CupInfoCard/index.d.ts +3 -1
  16. package/es/components/ecocup/components/CupInfoCard/index.js +4 -2
  17. package/es/components/ecocup/components/CupStatusModal/hooks.d.ts +32 -1
  18. package/es/components/ecocup/components/CupStatusModal/hooks.js +109 -1
  19. package/es/components/ecocup/components/CupStatusModal/index.js +164 -30
  20. package/es/components/ecocup/components/CupStatusModal/index.less +48 -10
  21. package/es/components/ecocup/components/CustomerAndCupModal/index.js +1 -1
  22. package/es/components/ecocup/components/CustomerCard/index.d.ts +3 -1
  23. package/es/components/ecocup/components/CustomerCard/index.js +9 -6
  24. package/es/components/ecocup/components/PageHeader/index.d.ts +2 -0
  25. package/es/components/ecocup/components/PageHeader/index.js +15 -5
  26. package/es/components/ecocup/components/PageHeader/index.less +16 -4
  27. package/es/components/ecocup/components/SearchBar/index.d.ts +1 -0
  28. package/es/components/ecocup/components/SearchBar/index.js +33 -3
  29. package/es/components/ecocup/components/SettingModal/const.d.ts +6 -0
  30. package/es/components/ecocup/components/SettingModal/const.js +17 -0
  31. package/es/components/ecocup/components/SettingModal/index.d.ts +9 -0
  32. package/es/components/ecocup/components/SettingModal/index.js +253 -0
  33. package/es/components/ecocup/components/SettingModal/index.less +9 -0
  34. package/es/components/ecocup/cupList/const.d.ts +8 -1
  35. package/es/components/ecocup/cupList/const.js +14 -1
  36. package/es/components/ecocup/cupList/hooks/index.d.ts +2 -2
  37. package/es/components/ecocup/cupList/hooks/index.js +2 -2
  38. package/es/components/ecocup/cupList/hooks/useColumns.d.ts +2 -1
  39. package/es/components/ecocup/cupList/hooks/useColumns.js +4 -6
  40. package/es/components/ecocup/cupList/hooks/useCupApi.d.ts +12 -3
  41. package/es/components/ecocup/cupList/hooks/useCupApi.js +148 -8
  42. package/es/components/ecocup/cupList/hooks/useSummary.js +9 -7
  43. package/es/components/ecocup/cupList/index.js +60 -12
  44. package/es/components/ecocup/cupList/index.less +62 -16
  45. package/es/components/ecocup/cupProject/const.js +8 -2
  46. package/es/components/ecocup/cupProject/index.js +10 -1
  47. package/es/components/ecocup/hooks.d.ts +8 -0
  48. package/es/components/ecocup/hooks.js +29 -12
  49. package/es/components/ecocup/locales.d.ts +93 -3
  50. package/es/components/ecocup/locales.js +124 -25
  51. package/es/components/ecocup/utils/download.d.ts +7 -0
  52. package/es/components/ecocup/utils/download.js +34 -0
  53. package/es/components/ecocup/utils/index.d.ts +2 -0
  54. package/es/components/ecocup/utils/index.js +2 -0
  55. package/es/components/eftpos/hooks.d.ts +1 -0
  56. package/es/components/eftposPay/hooks.d.ts +1 -1
  57. package/es/components/eftposPay/store/index.d.ts +1 -1
  58. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  59. package/es/hooks/useLocale.js +8 -1
  60. package/es/pro/comprehensiveSearch/components/searchSection/index.js +3 -2
  61. package/lib/components/booking/components/footer/index.js +5 -0
  62. package/lib/components/booking/info/header/index.js +7 -7
  63. package/lib/components/booking/info/header/index.less +5 -5
  64. package/lib/components/ecocup/components/AddCustomerModal/index.js +2 -2
  65. package/lib/components/ecocup/components/CupInfoCard/index.d.ts +3 -1
  66. package/lib/components/ecocup/components/CupInfoCard/index.js +2 -2
  67. package/lib/components/ecocup/components/CupStatusModal/hooks.d.ts +32 -1
  68. package/lib/components/ecocup/components/CupStatusModal/hooks.js +62 -2
  69. package/lib/components/ecocup/components/CupStatusModal/index.js +103 -22
  70. package/lib/components/ecocup/components/CupStatusModal/index.less +48 -10
  71. package/lib/components/ecocup/components/CustomerAndCupModal/index.js +1 -1
  72. package/lib/components/ecocup/components/CustomerCard/index.d.ts +3 -1
  73. package/lib/components/ecocup/components/CustomerCard/index.js +13 -3
  74. package/lib/components/ecocup/components/PageHeader/index.d.ts +2 -0
  75. package/lib/components/ecocup/components/PageHeader/index.js +10 -3
  76. package/lib/components/ecocup/components/PageHeader/index.less +16 -4
  77. package/lib/components/ecocup/components/SearchBar/index.d.ts +1 -0
  78. package/lib/components/ecocup/components/SearchBar/index.js +15 -2
  79. package/lib/components/ecocup/components/SettingModal/const.d.ts +6 -0
  80. package/lib/components/ecocup/components/SettingModal/const.js +48 -0
  81. package/lib/components/ecocup/components/SettingModal/index.d.ts +9 -0
  82. package/lib/components/ecocup/components/SettingModal/index.js +199 -0
  83. package/lib/components/ecocup/components/SettingModal/index.less +9 -0
  84. package/lib/components/ecocup/cupList/const.d.ts +8 -1
  85. package/lib/components/ecocup/cupList/const.js +18 -0
  86. package/lib/components/ecocup/cupList/hooks/index.d.ts +2 -2
  87. package/lib/components/ecocup/cupList/hooks/index.js +4 -0
  88. package/lib/components/ecocup/cupList/hooks/useColumns.d.ts +2 -1
  89. package/lib/components/ecocup/cupList/hooks/useColumns.js +2 -4
  90. package/lib/components/ecocup/cupList/hooks/useCupApi.d.ts +12 -3
  91. package/lib/components/ecocup/cupList/hooks/useCupApi.js +123 -8
  92. package/lib/components/ecocup/cupList/hooks/useSummary.js +22 -14
  93. package/lib/components/ecocup/cupList/index.js +70 -16
  94. package/lib/components/ecocup/cupList/index.less +62 -16
  95. package/lib/components/ecocup/cupProject/const.js +8 -1
  96. package/lib/components/ecocup/cupProject/index.js +10 -1
  97. package/lib/components/ecocup/hooks.d.ts +8 -0
  98. package/lib/components/ecocup/hooks.js +18 -4
  99. package/lib/components/ecocup/locales.d.ts +93 -3
  100. package/lib/components/ecocup/locales.js +118 -25
  101. package/lib/components/ecocup/utils/download.d.ts +7 -0
  102. package/lib/components/ecocup/utils/download.js +47 -0
  103. package/lib/components/ecocup/utils/index.d.ts +2 -0
  104. package/lib/components/ecocup/utils/index.js +42 -0
  105. package/lib/components/eftpos/hooks.d.ts +1 -0
  106. package/lib/components/eftposPay/hooks.d.ts +1 -1
  107. package/lib/components/eftposPay/store/index.d.ts +1 -1
  108. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  109. package/lib/hooks/useLocale.js +7 -2
  110. package/lib/pro/comprehensiveSearch/components/searchSection/index.js +3 -2
  111. package/lowcode/eco-cup-list/meta.ts +1 -1
  112. package/lowcode/eco-customer-list/meta.ts +1 -1
  113. package/package.json +3 -3
@@ -427,7 +427,7 @@ var Footer = function Footer(props) {
427
427
  */
428
428
  var handleSave = /*#__PURE__*/function () {
429
429
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref4) {
430
- var type, _ref4$messageShow, messageShow, isHasDayProducts, _setLoading, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, _store$getState, _window, callbackData, values, api;
430
+ var type, _ref4$messageShow, messageShow, isHasDayProducts, _setLoading, loadingTimer, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, _store$getState, _window, callbackData, values, api;
431
431
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
432
432
  while (1) switch (_context4.prev = _context4.next) {
433
433
  case 0:
@@ -452,27 +452,31 @@ var Footer = function Footer(props) {
452
452
  // 区分loading, 是点击的checkout 还是save
453
453
  _setLoading = type === 'checkout' ? setCheckoutLoading : setLoading;
454
454
  _setLoading(true);
455
+ // 超时保护: 超过20秒自动关闭loading
456
+ loadingTimer = setTimeout(function () {
457
+ _setLoading(false);
458
+ }, 20000);
455
459
  _getApis = getApis(), createBooking = _getApis.createBooking, editBooking = _getApis.editBooking;
456
460
  editApi = state.renderType === 'eventBooking' ? editEventBooking : editBooking;
457
461
  createApi = state.renderType === 'eventBooking' ? createEventBooking : createBooking;
458
462
  saveOtherValue = {};
459
463
  if (!(type === 'save')) {
460
- _context4.next = 20;
464
+ _context4.next = 21;
461
465
  break;
462
466
  }
463
- _context4.next = 16;
467
+ _context4.next = 17;
464
468
  return state === null || state === void 0 || (_state$onSave = state.onSave) === null || _state$onSave === void 0 ? void 0 : _state$onSave.call(state, state.client);
465
- case 16:
469
+ case 17:
466
470
  _context4.t0 = _context4.sent;
467
471
  if (_context4.t0) {
468
- _context4.next = 19;
472
+ _context4.next = 20;
469
473
  break;
470
474
  }
471
475
  _context4.t0 = {};
472
- case 19:
473
- saveOtherValue = _context4.t0;
474
476
  case 20:
475
- _context4.prev = 20;
477
+ saveOtherValue = _context4.t0;
478
+ case 21:
479
+ _context4.prev = 21;
476
480
  callbackData = null; // 格式化提交的参数
477
481
  values = formatValues(_objectSpread(_objectSpread({}, state), saveOtherValue)); // 区分是新增还是编辑
478
482
  api = state.bookingId ? editApi : createApi; // 增加日志记录
@@ -528,43 +532,45 @@ var Footer = function Footer(props) {
528
532
 
529
533
  // 如果有addons改动, 则先保存
530
534
  if (!addonsEdit) {
531
- _context4.next = 28;
535
+ _context4.next = 29;
532
536
  break;
533
537
  }
534
- _context4.next = 28;
538
+ _context4.next = 29;
535
539
  return handleSaveAddons();
536
- case 28:
540
+ case 29:
537
541
  if (!infoEdit) {
538
- _context4.next = 33;
542
+ _context4.next = 34;
539
543
  break;
540
544
  }
541
- _context4.next = 31;
545
+ _context4.next = 32;
542
546
  return api(values, state.bookingId);
543
- case 31:
547
+ case 32:
544
548
  callbackData = _context4.sent;
545
549
  if (messageShow) {
546
550
  message.success(locales.getText(state.bookingId ? 'pisell2.text.appointment-updated' : 'pisell2.text.created-successfully'));
547
551
  }
548
- case 33:
552
+ case 34:
549
553
  // 回调关闭弹窗
550
554
  state === null || state === void 0 || state.callback(callbackData, type);
555
+ clearTimeout(loadingTimer);
551
556
  _setLoading(false);
552
557
 
553
558
  // return数据 checkout时需要
554
559
  return _context4.abrupt("return", callbackData || values);
555
- case 38:
556
- _context4.prev = 38;
557
- _context4.t1 = _context4["catch"](20);
560
+ case 40:
561
+ _context4.prev = 40;
562
+ _context4.t1 = _context4["catch"](21);
558
563
  console.log(_context4.t1);
559
564
  if ((_context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.code) === 70101) {
560
565
  message.error(_context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.message);
561
566
  }
567
+ clearTimeout(loadingTimer);
562
568
  _setLoading(false);
563
- case 43:
569
+ case 46:
564
570
  case "end":
565
571
  return _context4.stop();
566
572
  }
567
- }, _callee4, null, [[20, 38]]);
573
+ }, _callee4, null, [[21, 40]]);
568
574
  }));
569
575
  return function handleSave(_x2) {
570
576
  return _ref5.apply(this, arguments);
@@ -52,19 +52,19 @@ var header = function header(_ref) {
52
52
  var statusList = [{
53
53
  label: locales.getText('pisell2.text.status.new'),
54
54
  key: 'new',
55
- color: '#079455'
55
+ color: '#91caff'
56
56
  }, {
57
57
  label: locales.getText('pisell2.text.status.confirmed'),
58
58
  key: 'confirmed',
59
- color: '#7F56D9'
59
+ color: '#b7eb8f'
60
60
  }, {
61
61
  label: locales.getText('pisell2.text.status.arrived'),
62
62
  key: 'arrived',
63
- color: '#088AB2'
63
+ color: '#d3adf7'
64
64
  }, {
65
65
  label: locales.getText('pisell2.text.status.started'),
66
66
  key: 'started',
67
- color: '#155EEF'
67
+ color: '#fffb8f'
68
68
  }, {
69
69
  label: /*#__PURE__*/React.createElement("span", {
70
70
  style: {
@@ -72,7 +72,7 @@ var header = function header(_ref) {
72
72
  }
73
73
  }, locales.getText('pisell2.text.status.cancelled')),
74
74
  key: 'cancelled',
75
- color: '#DC6803'
75
+ color: '#bfbfbf'
76
76
  }, {
77
77
  label: /*#__PURE__*/React.createElement("span", {
78
78
  style: {
@@ -80,11 +80,11 @@ var header = function header(_ref) {
80
80
  }
81
81
  }, locales.getText('pisell2.text.status.no_show')),
82
82
  key: 'no_show',
83
- color: '#D92D20'
83
+ color: '#ffa39e'
84
84
  }, {
85
85
  label: locales.getText('pisell2.text.status.completed'),
86
86
  key: 'completed',
87
- color: '#4A5578'
87
+ color: '#ffd591'
88
88
  }];
89
89
 
90
90
  // 销售渠道
@@ -21,7 +21,7 @@
21
21
 
22
22
  .booking-order-sales-channel {
23
23
  width: 100%;
24
- color: var(--Base-White, #FFF);
24
+ color: var(--Gray-900, #101828);
25
25
  font-size: 14px;
26
26
  font-style: normal;
27
27
  font-weight: 400;
@@ -37,7 +37,7 @@
37
37
  }
38
38
 
39
39
  .booking-header-left {
40
- color: var(--Base-White, #FFF);
40
+ color: var(--Gray-900, #101828);
41
41
  font-size: 18px;
42
42
  font-style: normal;
43
43
  font-weight: 400;
@@ -48,17 +48,17 @@
48
48
  display: flex;
49
49
  align-items: center;
50
50
  gap: 10px;
51
- color: var(--Base-White, #FFF) !important;
51
+ color: var(--Gray-900, #101828) !important;
52
52
  font-size: 18px;
53
53
  font-style: normal;
54
54
  font-weight: 400;
55
55
  cursor: pointer;
56
- border: 1px solid #fff;
56
+ border: 1px solid var(--Gray-900, #101828);
57
57
  padding: 4px 12px;
58
58
  border-radius: 24px;
59
59
 
60
60
  span {
61
- color: var(--Base-White, #FFF) !important;
61
+ color: var(--Gray-900, #101828) !important;
62
62
  }
63
63
 
64
64
  .booking-header-right-status-icon {
@@ -200,10 +200,10 @@ var AddCustomerModal = function AddCustomerModal(props) {
200
200
  renderMode: "edit",
201
201
  name: "membership",
202
202
  label: locales.getText('pisell2.text.ecocup.add-customer-modal.membership'),
203
- defaultValue: "normal",
203
+ defaultValue: "regular",
204
204
  options: [{
205
- label: 'Normal',
206
- value: 'normal'
205
+ label: 'Regular',
206
+ value: 'regular'
207
207
  }, {
208
208
  label: 'Business',
209
209
  value: 'business'
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
3
  interface IProps {
4
- type: 'rentInfo' | 'markInfo' | 'belongInfo';
4
+ type: 'rentInfo' | 'markInfo' | 'belongInfo' | 'otherBelongInfo';
5
5
  data: Record<string, any>;
6
+ isMultipleShop?: boolean;
7
+ isMultipleTime?: boolean;
6
8
  }
7
9
  declare const CupInfoCard: (props: IProps) => React.JSX.Element;
8
10
  export default CupInfoCard;
@@ -4,9 +4,11 @@ import dayjs from 'dayjs';
4
4
  import "./index.less";
5
5
  var CupInfoCard = function CupInfoCard(props) {
6
6
  var type = props.type,
7
- data = props.data;
7
+ data = props.data,
8
+ isMultipleShop = props.isMultipleShop,
9
+ isMultipleTime = props.isMultipleTime;
8
10
  return /*#__PURE__*/React.createElement("div", {
9
11
  className: "pisell2-ecocup-cup-info-card"
10
- }, /*#__PURE__*/React.createElement("div", null, locales.getText("pisell2.text.ecocup.cup-info-card.title.".concat(type))), /*#__PURE__*/React.createElement("div", null, (data === null || data === void 0 ? void 0 : data.shop) || '-'), /*#__PURE__*/React.createElement("div", null, data !== null && data !== void 0 && data.time ? dayjs(data === null || data === void 0 ? void 0 : data.time).format('HH:mm DD/MM/YYYY') : '-'));
12
+ }, /*#__PURE__*/React.createElement("div", null, locales.getText("pisell2.text.ecocup.cup-info-card.title.".concat(type))), isMultipleShop ? locales.getText('pisell2.text.ecocup.cup-info-card.title.multiple-shop') : /*#__PURE__*/React.createElement("div", null, (data === null || data === void 0 ? void 0 : data.shop) || '-'), isMultipleTime ? locales.getText('pisell2.text.ecocup.cup-info-card.title.multiple-time') : /*#__PURE__*/React.createElement("div", null, data !== null && data !== void 0 && data.time ? dayjs(data === null || data === void 0 ? void 0 : data.time).format('HH:mm DD/MM/YYYY') : '-'));
11
13
  };
12
14
  export default CupInfoCard;
@@ -1,5 +1,36 @@
1
- import { ECupActionType } from '../../types';
1
+ import { ECupActionType, ICup } from '../../types';
2
2
  export declare const useCupAction: () => {
3
3
  run: (this: unknown, cupId: string, action: ECupActionType) => Promise<boolean>;
4
4
  loading: boolean;
5
5
  };
6
+ /**
7
+ * @description: 批量归还杯子
8
+ * @return {*}
9
+ */
10
+ export declare const useBatchCupAction: () => {
11
+ run: (this: unknown, eco_cup_ids: number[] | string[]) => Promise<boolean>;
12
+ loading: boolean;
13
+ };
14
+ /**
15
+ * @description: 统计杯子列表中的客户、店铺、时间数量
16
+ * @param {ICup[]} cupList - 杯子列表
17
+ * @return {object} 返回统计信息和是否为多个的标识
18
+ */
19
+ export declare const useCupListStatistics: (cupList: ICup[]) => {
20
+ hasMultipleCustomers: boolean;
21
+ hasMultipleShops: boolean;
22
+ hasMultipleTimes: boolean;
23
+ uniqueCustomer: import("../../types").ICustomer | undefined;
24
+ uniqueShop: {
25
+ id: string;
26
+ name: string;
27
+ } | undefined;
28
+ uniqueTime: string | undefined;
29
+ } | {
30
+ hasMultipleCustomers: boolean;
31
+ hasMultipleShops: boolean;
32
+ hasMultipleTimes: boolean;
33
+ uniqueCustomer: null;
34
+ uniqueShop: null;
35
+ uniqueTime: null;
36
+ };
@@ -8,7 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { useState } from 'react';
11
+ import { useState, useMemo } from 'react';
12
12
  import { useMemoizedFn } from 'ahooks';
13
13
  import { useGetGoalShopInfo, useRequest } from "../../hooks";
14
14
  export var useCupAction = function useCupAction() {
@@ -65,4 +65,112 @@ export var useCupAction = function useCupAction() {
65
65
  run: run,
66
66
  loading: loading
67
67
  };
68
+ };
69
+
70
+ /**
71
+ * @description: 批量归还杯子
72
+ * @return {*}
73
+ */
74
+ export var useBatchCupAction = function useBatchCupAction() {
75
+ var _useRequest2 = useRequest(),
76
+ post = _useRequest2.post;
77
+ var _useState3 = useState(false),
78
+ _useState4 = _slicedToArray(_useState3, 2),
79
+ loading = _useState4[0],
80
+ setLoading = _useState4[1];
81
+ var run = useMemoizedFn( /*#__PURE__*/function () {
82
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eco_cup_ids) {
83
+ var res;
84
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
85
+ while (1) switch (_context2.prev = _context2.next) {
86
+ case 0:
87
+ _context2.prev = 0;
88
+ setLoading(true);
89
+ _context2.next = 4;
90
+ return post('/shop/wallet/eco/cups-return', {
91
+ eco_cup_ids: eco_cup_ids
92
+ });
93
+ case 4:
94
+ res = _context2.sent;
95
+ if (!((res === null || res === void 0 ? void 0 : res.code) == 200)) {
96
+ _context2.next = 7;
97
+ break;
98
+ }
99
+ return _context2.abrupt("return", true);
100
+ case 7:
101
+ return _context2.abrupt("return", false);
102
+ case 10:
103
+ _context2.prev = 10;
104
+ _context2.t0 = _context2["catch"](0);
105
+ console.error(_context2.t0);
106
+ return _context2.abrupt("return", false);
107
+ case 14:
108
+ _context2.prev = 14;
109
+ setLoading(false);
110
+ return _context2.finish(14);
111
+ case 17:
112
+ case "end":
113
+ return _context2.stop();
114
+ }
115
+ }, _callee2, null, [[0, 10, 14, 17]]);
116
+ }));
117
+ return function (_x3) {
118
+ return _ref2.apply(this, arguments);
119
+ };
120
+ }());
121
+ return {
122
+ run: run,
123
+ loading: loading
124
+ };
125
+ };
126
+
127
+ /**
128
+ * @description: 统计杯子列表中的客户、店铺、时间数量
129
+ * @param {ICup[]} cupList - 杯子列表
130
+ * @return {object} 返回统计信息和是否为多个的标识
131
+ */
132
+ export var useCupListStatistics = function useCupListStatistics(cupList) {
133
+ return useMemo(function () {
134
+ var _cupList$, _cupList$2, _cupList$3;
135
+ if (cupList.length === 0) {
136
+ return {
137
+ hasMultipleCustomers: false,
138
+ hasMultipleShops: false,
139
+ hasMultipleTimes: false,
140
+ uniqueCustomer: null,
141
+ uniqueShop: null,
142
+ uniqueTime: null
143
+ };
144
+ }
145
+
146
+ // 收集所有唯一的客户ID
147
+ var customerIds = new Set(cupList.map(function (cup) {
148
+ return cup === null || cup === void 0 ? void 0 : cup.customer_id;
149
+ }).filter(function (id) {
150
+ return id;
151
+ }));
152
+
153
+ // 收集所有唯一的店铺ID(current_shop)
154
+ var shopIds = new Set(cupList.map(function (cup) {
155
+ return cup === null || cup === void 0 ? void 0 : cup.current_shop_id;
156
+ }).filter(function (id) {
157
+ return id;
158
+ }));
159
+
160
+ // 收集所有唯一的时间(operated_at)
161
+ var times = new Set(cupList.map(function (cup) {
162
+ return cup === null || cup === void 0 ? void 0 : cup.operated_at;
163
+ }).filter(function (time) {
164
+ return time;
165
+ }));
166
+ var result = {
167
+ hasMultipleCustomers: customerIds.size > 1,
168
+ hasMultipleShops: shopIds.size > 1,
169
+ hasMultipleTimes: times.size > 1,
170
+ uniqueCustomer: (_cupList$ = cupList[0]) === null || _cupList$ === void 0 ? void 0 : _cupList$.customer,
171
+ uniqueShop: (_cupList$2 = cupList[0]) === null || _cupList$2 === void 0 ? void 0 : _cupList$2.current_shop,
172
+ uniqueTime: (_cupList$3 = cupList[0]) === null || _cupList$3 === void 0 ? void 0 : _cupList$3.operated_at
173
+ };
174
+ return result;
175
+ }, [cupList]);
68
176
  };