@pisell/private-materials 3.4.79 → 3.4.80

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 (145) 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/addons/model.d.ts +10 -1
  12. package/es/components/booking/forms/model.d.ts +10 -1
  13. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
  14. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  15. package/es/components/booking/info/model.d.ts +10 -1
  16. package/es/components/booking/model.d.ts +9 -1
  17. package/es/components/booking/notes/model.d.ts +10 -1
  18. package/es/components/booking/payments/model.d.ts +10 -1
  19. package/es/components/booking/utils.d.ts +2 -2
  20. package/es/components/ecocup/components/AddCustomerModal/index.js +3 -3
  21. package/es/components/ecocup/components/CupInfoCard/index.d.ts +3 -1
  22. package/es/components/ecocup/components/CupInfoCard/index.js +4 -2
  23. package/es/components/ecocup/components/CupStatusModal/hooks.d.ts +32 -1
  24. package/es/components/ecocup/components/CupStatusModal/hooks.js +109 -1
  25. package/es/components/ecocup/components/CupStatusModal/index.js +164 -30
  26. package/es/components/ecocup/components/CupStatusModal/index.less +48 -10
  27. package/es/components/ecocup/components/CustomerAndCupModal/index.js +1 -1
  28. package/es/components/ecocup/components/CustomerCard/index.d.ts +3 -1
  29. package/es/components/ecocup/components/CustomerCard/index.js +9 -6
  30. package/es/components/ecocup/components/PageHeader/index.d.ts +2 -0
  31. package/es/components/ecocup/components/PageHeader/index.js +15 -5
  32. package/es/components/ecocup/components/PageHeader/index.less +16 -4
  33. package/es/components/ecocup/components/SearchBar/index.d.ts +1 -0
  34. package/es/components/ecocup/components/SearchBar/index.js +33 -3
  35. package/es/components/ecocup/components/SettingModal/const.d.ts +6 -0
  36. package/es/components/ecocup/components/SettingModal/const.js +17 -0
  37. package/es/components/ecocup/components/SettingModal/index.d.ts +9 -0
  38. package/es/components/ecocup/components/SettingModal/index.js +253 -0
  39. package/es/components/ecocup/components/SettingModal/index.less +9 -0
  40. package/es/components/ecocup/cupList/const.d.ts +8 -1
  41. package/es/components/ecocup/cupList/const.js +14 -1
  42. package/es/components/ecocup/cupList/hooks/index.d.ts +2 -2
  43. package/es/components/ecocup/cupList/hooks/index.js +2 -2
  44. package/es/components/ecocup/cupList/hooks/useColumns.d.ts +2 -1
  45. package/es/components/ecocup/cupList/hooks/useColumns.js +4 -6
  46. package/es/components/ecocup/cupList/hooks/useCupApi.d.ts +12 -3
  47. package/es/components/ecocup/cupList/hooks/useCupApi.js +148 -8
  48. package/es/components/ecocup/cupList/hooks/useSummary.js +9 -7
  49. package/es/components/ecocup/cupList/index.js +60 -12
  50. package/es/components/ecocup/cupList/index.less +62 -16
  51. package/es/components/ecocup/cupProject/const.js +8 -2
  52. package/es/components/ecocup/cupProject/index.js +10 -1
  53. package/es/components/ecocup/hooks.d.ts +8 -0
  54. package/es/components/ecocup/hooks.js +18 -1
  55. package/es/components/ecocup/locales.d.ts +93 -3
  56. package/es/components/ecocup/locales.js +124 -25
  57. package/es/components/ecocup/utils/download.d.ts +7 -0
  58. package/es/components/ecocup/utils/download.js +34 -0
  59. package/es/components/ecocup/utils/index.d.ts +2 -0
  60. package/es/components/ecocup/utils/index.js +2 -0
  61. package/es/components/eftpos/hooks.d.ts +1 -0
  62. package/es/components/eftposPay/amount.d.ts +1 -1
  63. package/es/components/eftposPay/device.d.ts +1 -1
  64. package/es/components/eftposPay/hooks.d.ts +2 -2
  65. package/es/components/eftposPay/store/index.d.ts +5 -5
  66. package/es/components/eftposPay/tyro/hooks.d.ts +1 -0
  67. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
  68. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  69. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
  70. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
  71. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
  72. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  73. package/es/components/pay/toC/model.d.ts +9 -1
  74. package/es/components/schedules/model.d.ts +9 -1
  75. package/es/hooks/usePaymentLogger.d.ts +1 -0
  76. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  77. package/lib/components/booking/addons/model.d.ts +10 -1
  78. package/lib/components/booking/forms/model.d.ts +10 -1
  79. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
  80. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  81. package/lib/components/booking/info/model.d.ts +10 -1
  82. package/lib/components/booking/model.d.ts +9 -1
  83. package/lib/components/booking/notes/model.d.ts +10 -1
  84. package/lib/components/booking/payments/model.d.ts +10 -1
  85. package/lib/components/booking/utils.d.ts +2 -2
  86. package/lib/components/ecocup/components/AddCustomerModal/index.js +2 -2
  87. package/lib/components/ecocup/components/CupInfoCard/index.d.ts +3 -1
  88. package/lib/components/ecocup/components/CupInfoCard/index.js +2 -2
  89. package/lib/components/ecocup/components/CupStatusModal/hooks.d.ts +32 -1
  90. package/lib/components/ecocup/components/CupStatusModal/hooks.js +62 -2
  91. package/lib/components/ecocup/components/CupStatusModal/index.js +103 -22
  92. package/lib/components/ecocup/components/CupStatusModal/index.less +48 -10
  93. package/lib/components/ecocup/components/CustomerAndCupModal/index.js +1 -1
  94. package/lib/components/ecocup/components/CustomerCard/index.d.ts +3 -1
  95. package/lib/components/ecocup/components/CustomerCard/index.js +13 -3
  96. package/lib/components/ecocup/components/PageHeader/index.d.ts +2 -0
  97. package/lib/components/ecocup/components/PageHeader/index.js +10 -3
  98. package/lib/components/ecocup/components/PageHeader/index.less +16 -4
  99. package/lib/components/ecocup/components/SearchBar/index.d.ts +1 -0
  100. package/lib/components/ecocup/components/SearchBar/index.js +15 -2
  101. package/lib/components/ecocup/components/SettingModal/const.d.ts +6 -0
  102. package/lib/components/ecocup/components/SettingModal/const.js +48 -0
  103. package/lib/components/ecocup/components/SettingModal/index.d.ts +9 -0
  104. package/lib/components/ecocup/components/SettingModal/index.js +199 -0
  105. package/lib/components/ecocup/components/SettingModal/index.less +9 -0
  106. package/lib/components/ecocup/cupList/const.d.ts +8 -1
  107. package/lib/components/ecocup/cupList/const.js +18 -0
  108. package/lib/components/ecocup/cupList/hooks/index.d.ts +2 -2
  109. package/lib/components/ecocup/cupList/hooks/index.js +4 -0
  110. package/lib/components/ecocup/cupList/hooks/useColumns.d.ts +2 -1
  111. package/lib/components/ecocup/cupList/hooks/useColumns.js +2 -4
  112. package/lib/components/ecocup/cupList/hooks/useCupApi.d.ts +12 -3
  113. package/lib/components/ecocup/cupList/hooks/useCupApi.js +123 -8
  114. package/lib/components/ecocup/cupList/hooks/useSummary.js +22 -14
  115. package/lib/components/ecocup/cupList/index.js +70 -16
  116. package/lib/components/ecocup/cupList/index.less +62 -16
  117. package/lib/components/ecocup/cupProject/const.js +8 -1
  118. package/lib/components/ecocup/cupProject/index.js +10 -1
  119. package/lib/components/ecocup/hooks.d.ts +8 -0
  120. package/lib/components/ecocup/hooks.js +15 -1
  121. package/lib/components/ecocup/locales.d.ts +93 -3
  122. package/lib/components/ecocup/locales.js +118 -25
  123. package/lib/components/ecocup/utils/download.d.ts +7 -0
  124. package/lib/components/ecocup/utils/download.js +47 -0
  125. package/lib/components/ecocup/utils/index.d.ts +2 -0
  126. package/lib/components/ecocup/utils/index.js +42 -0
  127. package/lib/components/eftpos/hooks.d.ts +1 -0
  128. package/lib/components/eftposPay/amount.d.ts +1 -1
  129. package/lib/components/eftposPay/device.d.ts +1 -1
  130. package/lib/components/eftposPay/hooks.d.ts +2 -2
  131. package/lib/components/eftposPay/store/index.d.ts +5 -5
  132. package/lib/components/eftposPay/tyro/hooks.d.ts +1 -0
  133. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
  134. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  135. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
  136. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
  137. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
  138. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  139. package/lib/components/pay/toC/model.d.ts +9 -1
  140. package/lib/components/schedules/model.d.ts +9 -1
  141. package/lib/hooks/usePaymentLogger.d.ts +1 -0
  142. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  143. package/lowcode/eco-cup-list/meta.ts +1 -1
  144. package/lowcode/eco-customer-list/meta.ts +1 -1
  145. package/package.json +3 -3
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const useIsLowSpeedNetwork: () => import("react").MutableRefObject<boolean>;
2
3
  export default useIsLowSpeedNetwork;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { EditServiceRef } from "../service/editService";
3
2
  declare const useInfoHolder: (state: any, dispatch: any) => {
4
3
  detailRef: import("react").MutableRefObject<EditServiceRef | undefined>;
@@ -1,5 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { FormState } from '../model';
1
3
  export declare const walkInData: {
2
4
  id: number;
3
5
  nickname: string;
4
6
  };
5
- export declare const Provider: any, Context: any;
7
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
8
+ state: FormState;
9
+ } & {
10
+ dispatch: (params: {
11
+ type: string;
12
+ payload: any;
13
+ }) => void;
14
+ }>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface FormState {
2
3
  amountSymbol: string;
3
4
  apis: {
@@ -108,4 +109,11 @@ export declare const walkInData: {
108
109
  id: number;
109
110
  nickname: string;
110
111
  };
111
- export declare const Provider: any, Context: any;
112
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
113
+ state: FormState;
114
+ } & {
115
+ dispatch: (params: {
116
+ type: string;
117
+ payload: any;
118
+ }) => void;
119
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -166,10 +166,10 @@ export declare const getProductTotalPrice: (item: any) => number;
166
166
  export declare const getDuration: (duration: number | {
167
167
  type: string;
168
168
  value: number;
169
- }) => number | {
169
+ }) => number | "flexible" | {
170
170
  type: string;
171
171
  value: number;
172
- } | "flexible";
172
+ };
173
173
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
174
174
  export declare const getIsEdit: (state: any) => boolean;
175
175
  export {};
@@ -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
  };
@@ -1,22 +1,35 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ 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
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
5
  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
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
12
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
13
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
14
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
- import React, { useMemo } from 'react';
11
- import { PisellModal, Icon, PisellToast } from '@pisell/materials';
15
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
+ 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; }
19
+ 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; } }
20
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
+ import React, { useEffect, useMemo, useState } from 'react';
22
+ import { PisellModal, Icon, PisellToast, Button } from '@pisell/materials';
12
23
  import { locales } from '@pisell/utils';
13
24
  import { ECupActionType, ECupScanStatus, ECupStatus } from "../../types";
14
25
  import "./index.less";
15
26
  import CupInfoCard from "../CupInfoCard";
16
27
  import CustomerCard from "../CustomerCard";
17
- import { useCupAction } from "./hooks";
28
+ import { useCupAction, useCupListStatistics, useBatchCupAction } from "./hooks";
29
+ import SearchBar from "../SearchBar";
30
+ var SCAN_LISTENER_KEY = 'eco-cup-status-modal-scan-listener';
18
31
  var CupStatusModal = function CupStatusModal(props) {
19
- var _cupData$current_shop;
32
+ var _cupStatistics$unique, _cupList$, _cupList$2;
20
33
  var visible = props.visible,
21
34
  onCancel = props.onCancel,
22
35
  onOk = props.onOk,
@@ -25,7 +38,33 @@ var CupStatusModal = function CupStatusModal(props) {
25
38
  scanStatus = _ref.scanStatus,
26
39
  cupData = _ref.cupData;
27
40
  var cupAction = useCupAction();
28
- var isRed = scanStatus !== ECupScanStatus.OTHER_IN_STOCK && scanStatus !== ECupScanStatus.OTHER_RENT;
41
+ // 杯子列表
42
+ var _useState = useState([]),
43
+ _useState2 = _slicedToArray(_useState, 2),
44
+ cupList = _useState2[0],
45
+ setCupList = _useState2[1];
46
+ var batchCupAction = useBatchCupAction();
47
+ useEffect(function () {
48
+ if (!cupData) {
49
+ setCupList([]);
50
+ return;
51
+ }
52
+ var initialCups = Array.isArray(cupData) ? cupData : [cupData];
53
+ setCupList(initialCups);
54
+ }, [cupData]);
55
+
56
+ /**
57
+ * @description: OTHER_RENT 状态
58
+ * @param {*} useMemo
59
+ * @return {*}
60
+ */
61
+ var otherRentStatus = useMemo(function () {
62
+ return scanStatus === ECupScanStatus.OTHER_RENT;
63
+ }, [scanStatus]);
64
+ var isRed = !otherRentStatus;
65
+
66
+ // 使用自定义 hook 统计杯子列表信息
67
+ var cupStatistics = useCupListStatistics(cupList);
29
68
  var lineStyle = useMemo(function () {
30
69
  if (isRed) {
31
70
  return {
@@ -41,11 +80,15 @@ var CupStatusModal = function CupStatusModal(props) {
41
80
 
42
81
  // 杯子信息卡片类型
43
82
  var cupInfoCardType = useMemo(function () {
44
- if (scanStatus === ECupScanStatus.OTHER_IN_STOCK || scanStatus === ECupScanStatus.IN_STOCK) {
83
+ if (scanStatus === ECupScanStatus.OTHER_IN_STOCK) {
84
+ // 杯子归属信息
85
+ return 'otherBelongInfo';
86
+ }
87
+ if (scanStatus === ECupScanStatus.IN_STOCK) {
45
88
  // 展示归属信息
46
89
  return 'belongInfo';
47
90
  }
48
- if (scanStatus === ECupScanStatus.OTHER_RENT || scanStatus === ECupScanStatus.RENT) {
91
+ if (otherRentStatus || scanStatus === ECupScanStatus.RENT) {
49
92
  // 展示借出信息
50
93
  return 'rentInfo';
51
94
  }
@@ -61,7 +104,7 @@ var CupStatusModal = function CupStatusModal(props) {
61
104
  };
62
105
  var _onOk = /*#__PURE__*/function () {
63
106
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
64
- var type, result;
107
+ var type, result, ids;
65
108
  return _regeneratorRuntime().wrap(function _callee$(_context) {
66
109
  while (1) switch (_context.prev = _context.next) {
67
110
  case 0:
@@ -71,7 +114,7 @@ var CupStatusModal = function CupStatusModal(props) {
71
114
  }
72
115
  return _context.abrupt("return");
73
116
  case 2:
74
- type = scanStatus === ECupScanStatus.OTHER_IN_STOCK ? ECupActionType.TRANSFER : scanStatus === ECupScanStatus.OTHER_RENT ? ECupActionType.RETURN : '';
117
+ type = otherRentStatus ? ECupActionType.RETURN : '';
75
118
  if (type) {
76
119
  _context.next = 6;
77
120
  break;
@@ -79,17 +122,32 @@ var CupStatusModal = function CupStatusModal(props) {
79
122
  onOk === null || onOk === void 0 || onOk();
80
123
  return _context.abrupt("return");
81
124
  case 6:
82
- _context.next = 8;
125
+ if (!otherRentStatus) {
126
+ _context.next = 13;
127
+ break;
128
+ }
129
+ ids = cupList.map(function (cup) {
130
+ return (cup === null || cup === void 0 ? void 0 : cup.eco_cup_id) || (cup === null || cup === void 0 ? void 0 : cup.id);
131
+ });
132
+ _context.next = 10;
133
+ return batchCupAction.run(ids);
134
+ case 10:
135
+ result = _context.sent;
136
+ _context.next = 16;
137
+ break;
138
+ case 13:
139
+ _context.next = 15;
83
140
  return cupAction.run((cupData === null || cupData === void 0 ? void 0 : cupData.eco_cup_id) || (cupData === null || cupData === void 0 ? void 0 : cupData.id), type);
84
- case 8:
141
+ case 15:
85
142
  result = _context.sent;
143
+ case 16:
86
144
  if (result) {
87
145
  PisellToast({
88
146
  content: locales.getText("pisell2.text.ecocup.toast.success-".concat(type))
89
147
  });
90
148
  onOk === null || onOk === void 0 || onOk();
91
149
  }
92
- case 10:
150
+ case 17:
93
151
  case "end":
94
152
  return _context.stop();
95
153
  }
@@ -99,49 +157,125 @@ var CupStatusModal = function CupStatusModal(props) {
99
157
  return _ref2.apply(this, arguments);
100
158
  };
101
159
  }();
160
+
161
+ /**
162
+ * @description: 搜索结果回调,将新杯子添加到列表
163
+ */
164
+ var onSearchResult = function onSearchResult(result) {
165
+ var _result$data2;
166
+ // 判断杯子是否已经在列表中
167
+ if (cupList.find(function (c) {
168
+ var _result$data;
169
+ return (c === null || c === void 0 ? void 0 : c.id) === (result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.id);
170
+ })) {
171
+ return;
172
+ }
173
+
174
+ // 判断杯子是否已经租出
175
+ if ((result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.status) !== ECupStatus.RENT) {
176
+ return;
177
+ }
178
+
179
+ // 将新杯子添加到列表
180
+ setCupList([].concat(_toConsumableArray(cupList), [result === null || result === void 0 ? void 0 : result.data]));
181
+ };
182
+
183
+ /**
184
+ * @description: 从列表中移除杯子
185
+ */
186
+ var removeCupFromList = function removeCupFromList(cupId) {
187
+ setCupList(cupList.filter(function (cup) {
188
+ return (cup === null || cup === void 0 ? void 0 : cup.id) !== cupId;
189
+ }));
190
+ };
191
+ var renderSearchBar = function renderSearchBar() {
192
+ return /*#__PURE__*/React.createElement("div", {
193
+ className: "pisell2-ecocup-customer-first-modal-search-bar"
194
+ }, /*#__PURE__*/React.createElement(SearchBar, {
195
+ scanListenerKey: SCAN_LISTENER_KEY,
196
+ searchType: "cup",
197
+ placeholder: locales.getText('pisell2.text.ecocup.customer-first-modal.search-bar.placeholder'),
198
+ onSearchResult: onSearchResult,
199
+ onCupStatusValidate: onSearchResult
200
+ }));
201
+ };
202
+ var showRemove = useMemo(function () {
203
+ return (cupList === null || cupList === void 0 ? void 0 : cupList.length) > 1 && otherRentStatus;
204
+ }, [cupList.length, otherRentStatus]);
102
205
  return /*#__PURE__*/React.createElement(PisellModal, {
103
206
  headerDivider: false,
104
207
  open: visible,
105
208
  onCancel: _onCancel,
106
209
  onOk: _onOk,
107
- title: locales.getText("pisell2.text.ecocup.cup-status-modal.title-".concat(scanStatus)),
108
- cancelText: locales.getText('pisell2.text.ecocup.button.dismiss'),
109
- okText: isRed ? locales.getText('pisell2.text.ecocup.button.confirm') : scanStatus === ECupScanStatus.OTHER_IN_STOCK ? locales.getText('pisell2.text.ecocup.button.transfer') : locales.getText('pisell2.text.ecocup.button.mark-as-return'),
210
+ title: otherRentStatus ? locales.getText("pisell2.text.ecocup.cup-status-modal.title-".concat(scanStatus))(cupList.length) : locales.getText("pisell2.text.ecocup.cup-status-modal.title-".concat(scanStatus)),
211
+ cancelText: otherRentStatus ? locales.getText('pisell2.text.ecocup.button.cancel') : locales.getText('pisell2.text.ecocup.button.dismiss'),
212
+ okText: isRed ? locales.getText('pisell2.text.ecocup.button.confirm') : locales.getText('pisell2.text.ecocup.button.return'),
110
213
  okButtonProps: {
111
214
  loading: cupAction === null || cupAction === void 0 ? void 0 : cupAction.loading
112
215
  },
113
216
  cancelVisible: !isRed,
114
217
  width: 580
115
218
  }, /*#__PURE__*/React.createElement("div", {
116
- className: "pisell2-ecocup-cup-status-modal-content"
117
- }, /*#__PURE__*/React.createElement("div", {
118
- className: "pisell2-ecocup-cup-status-modal-content-cup",
119
- style: _objectSpread({}, lineStyle)
120
- }, /*#__PURE__*/React.createElement(Icon, {
121
- type: "RestOutlined",
122
- size: 24
123
- }), /*#__PURE__*/React.createElement("span", {
219
+ className: "pisell2-ecocup-cup-status-modal-content",
124
220
  style: {
125
- color: !isRed ? '#667085' : '#F04438'
221
+ gap: otherRentStatus ? '20px' : '32px'
126
222
  }
127
- }, locales.getText('pisell2.text.ecocup.cup-id')), /*#__PURE__*/React.createElement("span", null, (cupData === null || cupData === void 0 ? void 0 : cupData.eco_cup_code) || (cupData === null || cupData === void 0 ? void 0 : cupData.code) || '')), /*#__PURE__*/React.createElement("div", {
223
+ }, otherRentStatus ? /*#__PURE__*/React.createElement("div", {
224
+ className: "pisell2-ecocup-cup-status-modal-content-search"
225
+ }, /*#__PURE__*/React.createElement("span", {
226
+ className: "tip-text"
227
+ }, locales.getText('pisell2.text.ecocup.cup-status-modal.search-bar.title')), renderSearchBar()) : null, /*#__PURE__*/React.createElement("div", {
228
+ className: "pisell2-ecocup-cup-status-modal-content-cup-lists"
229
+ }, cupList.map(function (cup, index) {
230
+ return /*#__PURE__*/React.createElement("div", {
231
+ key: (cup === null || cup === void 0 ? void 0 : cup.id) || index,
232
+ className: "pisell2-ecocup-cup-status-modal-content-cup",
233
+ style: _objectSpread(_objectSpread({}, lineStyle), {}, {
234
+ justifyContent: showRemove ? 'space-between' : 'center'
235
+ })
236
+ }, /*#__PURE__*/React.createElement("div", {
237
+ className: "pisell2-ecocup-cup-status-modal-content-cup-info"
238
+ }, /*#__PURE__*/React.createElement(Icon, {
239
+ type: "RestOutlined",
240
+ size: 24
241
+ }), /*#__PURE__*/React.createElement("span", {
242
+ style: {
243
+ color: !isRed ? '#667085' : '#F04438'
244
+ }
245
+ }, locales.getText('pisell2.text.ecocup.cup-id')), /*#__PURE__*/React.createElement("span", null, (cup === null || cup === void 0 ? void 0 : cup.eco_cup_code) || (cup === null || cup === void 0 ? void 0 : cup.code) || '')), showRemove && /*#__PURE__*/React.createElement(Button, {
246
+ type: "primary",
247
+ icon: /*#__PURE__*/React.createElement(Icon, {
248
+ type: "pisell2-trash-01",
249
+ size: 24,
250
+ color: "#7F56DA"
251
+ }),
252
+ onClick: function onClick() {
253
+ return removeCupFromList(cup === null || cup === void 0 ? void 0 : cup.id);
254
+ },
255
+ className: "info-remove"
256
+ }, locales.getText('pisell2.text.ecocup.button.remove')));
257
+ })), /*#__PURE__*/React.createElement("div", {
128
258
  className: "pisell2-ecocup-cup-status-modal-content-info"
129
259
  }, /*#__PURE__*/React.createElement("div", {
130
260
  style: {
131
261
  flex: 1
132
262
  }
133
- }, cupData !== null && cupData !== void 0 && cupData.current_shop && cupInfoCardType ? /*#__PURE__*/React.createElement(CupInfoCard, {
263
+ }, (cupStatistics !== null && cupStatistics !== void 0 && cupStatistics.uniqueShop || cupStatistics !== null && cupStatistics !== void 0 && cupStatistics.hasMultipleShops) && cupInfoCardType ? /*#__PURE__*/React.createElement(CupInfoCard, {
134
264
  type: cupInfoCardType,
135
265
  data: {
136
- shop: cupData === null || cupData === void 0 || (_cupData$current_shop = cupData.current_shop) === null || _cupData$current_shop === void 0 ? void 0 : _cupData$current_shop.name,
137
- time: cupData === null || cupData === void 0 ? void 0 : cupData.operated_at
266
+ shop: cupStatistics === null || cupStatistics === void 0 || (_cupStatistics$unique = cupStatistics.uniqueShop) === null || _cupStatistics$unique === void 0 ? void 0 : _cupStatistics$unique.name,
267
+ time: cupStatistics === null || cupStatistics === void 0 ? void 0 : cupStatistics.uniqueTime,
268
+ isMultipleTime: cupStatistics === null || cupStatistics === void 0 ? void 0 : cupStatistics.hasMultipleTimes,
269
+ isMultipleShop: cupStatistics === null || cupStatistics === void 0 ? void 0 : cupStatistics.hasMultipleShops
138
270
  }
139
271
  }) : null), /*#__PURE__*/React.createElement("div", {
140
272
  style: {
141
273
  flex: 1
142
274
  }
143
- }, (cupData === null || cupData === void 0 ? void 0 : cupData.status) === ECupStatus.RENT ? cupData !== null && cupData !== void 0 && cupData.customer ? /*#__PURE__*/React.createElement(CustomerCard, (cupData === null || cupData === void 0 ? void 0 : cupData.customer) || {}) : null : (cupData === null || cupData === void 0 ? void 0 : cupData.status) === ECupStatus.IN_STOCK ? null : /*#__PURE__*/React.createElement("div", {
275
+ }, (cupList === null || cupList === void 0 || (_cupList$ = cupList[0]) === null || _cupList$ === void 0 ? void 0 : _cupList$.status) === ECupStatus.RENT ? cupStatistics !== null && cupStatistics !== void 0 && cupStatistics.uniqueCustomer || cupStatistics !== null && cupStatistics !== void 0 && cupStatistics.hasMultipleCustomers ? /*#__PURE__*/React.createElement(CustomerCard, _extends({}, (cupStatistics === null || cupStatistics === void 0 ? void 0 : cupStatistics.uniqueCustomer) || {}, {
276
+ isMultiple: cupStatistics === null || cupStatistics === void 0 ? void 0 : cupStatistics.hasMultipleCustomers
277
+ })) : null : /*#__PURE__*/React.createElement("div", {
144
278
  className: "pisell2-ecocup-cup-status-modal-content-info-tip"
145
- }, locales.getText('pisell2.text.ecocup.cup-status-modal.tip'))))));
279
+ }, (cupList === null || cupList === void 0 || (_cupList$2 = cupList[0]) === null || _cupList$2 === void 0 ? void 0 : _cupList$2.status) === ECupStatus.IN_STOCK ? locales.getText('pisell2.text.ecocup.cup-status-modal.tip-in-stock') : locales.getText('pisell2.text.ecocup.cup-status-modal.tip'))))));
146
280
  };
147
281
  export default CupStatusModal;