@pisell/private-materials 6.3.100 → 6.3.102

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 (115) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  11. package/es/components/booking/info/header/index.js +7 -7
  12. package/es/components/booking/info/header/index.less +5 -5
  13. package/es/components/ecocup/components/AddCustomerModal/index.js +3 -3
  14. package/es/components/ecocup/components/CupInfoCard/index.d.ts +3 -1
  15. package/es/components/ecocup/components/CupInfoCard/index.js +4 -2
  16. package/es/components/ecocup/components/CupStatusModal/hooks.d.ts +32 -1
  17. package/es/components/ecocup/components/CupStatusModal/hooks.js +109 -1
  18. package/es/components/ecocup/components/CupStatusModal/index.js +164 -30
  19. package/es/components/ecocup/components/CupStatusModal/index.less +48 -10
  20. package/es/components/ecocup/components/CustomerAndCupModal/index.js +1 -1
  21. package/es/components/ecocup/components/CustomerCard/index.d.ts +3 -1
  22. package/es/components/ecocup/components/CustomerCard/index.js +9 -6
  23. package/es/components/ecocup/components/PageHeader/index.d.ts +2 -0
  24. package/es/components/ecocup/components/PageHeader/index.js +15 -5
  25. package/es/components/ecocup/components/PageHeader/index.less +16 -4
  26. package/es/components/ecocup/components/SearchBar/index.d.ts +1 -0
  27. package/es/components/ecocup/components/SearchBar/index.js +33 -3
  28. package/es/components/ecocup/components/SettingModal/const.d.ts +6 -0
  29. package/es/components/ecocup/components/SettingModal/const.js +17 -0
  30. package/es/components/ecocup/components/SettingModal/index.d.ts +9 -0
  31. package/es/components/ecocup/components/SettingModal/index.js +253 -0
  32. package/es/components/ecocup/components/SettingModal/index.less +9 -0
  33. package/es/components/ecocup/cupList/const.d.ts +8 -1
  34. package/es/components/ecocup/cupList/const.js +14 -1
  35. package/es/components/ecocup/cupList/hooks/index.d.ts +2 -2
  36. package/es/components/ecocup/cupList/hooks/index.js +2 -2
  37. package/es/components/ecocup/cupList/hooks/useColumns.d.ts +2 -1
  38. package/es/components/ecocup/cupList/hooks/useColumns.js +4 -6
  39. package/es/components/ecocup/cupList/hooks/useCupApi.d.ts +12 -3
  40. package/es/components/ecocup/cupList/hooks/useCupApi.js +148 -8
  41. package/es/components/ecocup/cupList/hooks/useSummary.js +9 -7
  42. package/es/components/ecocup/cupList/index.js +60 -12
  43. package/es/components/ecocup/cupList/index.less +62 -16
  44. package/es/components/ecocup/cupProject/const.js +8 -2
  45. package/es/components/ecocup/cupProject/index.js +10 -1
  46. package/es/components/ecocup/hooks.d.ts +8 -0
  47. package/es/components/ecocup/hooks.js +29 -12
  48. package/es/components/ecocup/locales.d.ts +93 -3
  49. package/es/components/ecocup/locales.js +124 -25
  50. package/es/components/ecocup/utils/download.d.ts +7 -0
  51. package/es/components/ecocup/utils/download.js +34 -0
  52. package/es/components/ecocup/utils/index.d.ts +2 -0
  53. package/es/components/ecocup/utils/index.js +2 -0
  54. package/es/hooks/useLocale.js +8 -1
  55. package/es/pro/Cards/components/SKUCard/index.d.ts +0 -1
  56. package/es/pro/Cards/components/SKUCard/index.js +0 -1
  57. package/es/pro/Cards/components/SKUCard/types.d.ts +2 -2
  58. package/es/pro/Login2.0/Login2.js +8 -8
  59. package/es/pro/Login2.0/locales.d.ts +5 -0
  60. package/es/pro/Login2.0/locales.js +5 -0
  61. package/es/pro/comprehensiveSearch/components/searchSection/index.js +3 -2
  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/hooks/useLocale.js +7 -2
  106. package/lib/pro/Cards/components/SKUCard/index.d.ts +0 -1
  107. package/lib/pro/Cards/components/SKUCard/index.js +0 -1
  108. package/lib/pro/Cards/components/SKUCard/types.d.ts +2 -2
  109. package/lib/pro/Login2.0/Login2.js +8 -8
  110. package/lib/pro/Login2.0/locales.d.ts +5 -0
  111. package/lib/pro/Login2.0/locales.js +5 -0
  112. package/lib/pro/comprehensiveSearch/components/searchSection/index.js +3 -2
  113. package/lowcode/eco-cup-list/meta.ts +1 -1
  114. package/lowcode/eco-customer-list/meta.ts +1 -1
  115. package/package.json +3 -3
@@ -4,32 +4,70 @@
4
4
  flex-direction: column;
5
5
  gap: 32px;
6
6
 
7
+ &-cup-lists {
8
+ display: flex;
9
+ align-items: center;
10
+ flex-direction: column;
11
+ gap: 4px;
12
+ }
13
+
7
14
  &-cup {
8
15
  height: 60px;
9
16
  padding: 0 16px;
10
17
  display: flex;
11
18
  flex-direction: row;
12
19
  align-items: center;
13
- justify-content: center;
20
+ justify-content: space-between;
14
21
  border-radius: 8px;
15
22
  gap: 8px;
23
+ width: 100%;
24
+
25
+ .info-remove {
26
+ display: flex;
27
+ flex-direction: row;
28
+ align-items: center;
29
+ justify-content: center;
30
+ border-radius: 8px;
31
+ border: 1px solid #7f56da;
32
+ background: #f6f2ff;
33
+ color: #7F56DA;
34
+ }
35
+ }
36
+
37
+ &-cup-info {
38
+ display: flex;
39
+ align-items: center;
40
+ gap: 8px;
16
41
 
17
- & > span {
42
+ &>span {
18
43
  font-size: 20px;
19
44
  font-weight: 300;
20
45
  }
21
46
  }
22
47
 
48
+ &-search {
49
+ display: flex;
50
+ flex-direction: column;
51
+ gap: 8px;
52
+ .tip-text {
53
+ font-size: 14px;
54
+ font-weight: 500;
55
+ color: rgb(127, 86, 218);
56
+ text-align: center;
57
+ }
58
+ }
59
+
23
60
  &-info {
24
61
  display: flex;
25
62
  align-items: center;
26
- justify-content: space-between;
27
-
28
- &-tip {
29
- flex: 1;
30
- color: #d92d20;
31
- font-size: 16px;
32
- font-weight: 400;
63
+ gap: 8px;
64
+ &>div:nth-child(2) {
65
+ display: flex;
66
+ justify-content: flex-end;
33
67
  }
34
68
  }
35
- }
69
+
70
+ .comprehensive-search__search-section .comprehensive-search__search-button {
71
+ min-width: 60px !important;
72
+ }
73
+ }
@@ -195,7 +195,7 @@ var CustomerAndCupModal = function CustomerAndCupModal(props) {
195
195
  onCancel: _onCancel,
196
196
  onOk: _onOk,
197
197
  okText: locales.getText('pisell2.text.ecocup.button.confirm'),
198
- cancelText: locales.getText('pisell2.text.ecocup.button.cancel'),
198
+ cancelText: locales.getText('pisell2.text.ecocup.button.dismiss'),
199
199
  okButtonProps: {
200
200
  disabled: newCups.length === 0 || isOverMax || isLoading || !(customerData !== null && customerData !== void 0 && customerData.id),
201
201
  loading: isLoading
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
3
  import { ICustomer } from '../../types';
4
- interface IProps extends ICustomer {
4
+ interface IProps extends Partial<ICustomer> {
5
+ /** 是否为多个客户,为 true 时显示 "Multiple customers" */
6
+ isMultiple?: boolean;
5
7
  }
6
8
  declare const CustomerCard: (props: IProps) => React.JSX.Element | null;
7
9
  export default CustomerCard;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { image as imageAli } from '@pisell/utils';
2
+ import { image as imageAli, locales } from '@pisell/utils';
3
3
  import "./index.less";
4
4
  var CustomerCard = function CustomerCard(props) {
5
5
  var _name$charAt;
@@ -8,8 +8,9 @@ var CustomerCard = function CustomerCard(props) {
8
8
  display_name = props.display_name,
9
9
  phone = props.phone,
10
10
  country_calling_code = props.country_calling_code,
11
- cover = props.cover;
12
- if (!id && !nickname && !display_name && !phone) {
11
+ cover = props.cover,
12
+ isMultiple = props.isMultiple;
13
+ if (!id && !nickname && !display_name && !phone && !isMultiple) {
13
14
  return null;
14
15
  }
15
16
  var phoneStr = phone ? "".concat(country_calling_code, " ").concat(phone) : '-';
@@ -18,7 +19,9 @@ var CustomerCard = function CustomerCard(props) {
18
19
  className: "pisell2-ecocup-customer-card"
19
20
  }, /*#__PURE__*/React.createElement("div", {
20
21
  className: "pisell2-ecocup-customer-card-avatar"
21
- }, cover ? /*#__PURE__*/React.createElement("img", {
22
+ }, isMultiple ? /*#__PURE__*/React.createElement("div", {
23
+ className: "pisell2-ecocup-customer-card-avatar-text"
24
+ }) : cover ? /*#__PURE__*/React.createElement("img", {
22
25
  src: imageAli.ali(cover, 360),
23
26
  alt: "avatar"
24
27
  }) : /*#__PURE__*/React.createElement("div", {
@@ -27,8 +30,8 @@ var CustomerCard = function CustomerCard(props) {
27
30
  className: "pisell2-ecocup-customer-card-info"
28
31
  }, /*#__PURE__*/React.createElement("div", {
29
32
  className: "pisell2-ecocup-customer-card-info-name"
30
- }, name || ''), /*#__PURE__*/React.createElement("div", {
33
+ }, isMultiple ? locales.getText('pisell2.text.ecocup.cup-info-card.title.multiple-customer') : name || ''), /*#__PURE__*/React.createElement("div", {
31
34
  className: "pisell2-ecocup-customer-card-info-phone"
32
- }, phoneStr || '')));
35
+ }, isMultiple ? '-' : phoneStr || ''), isMultiple ? /*#__PURE__*/React.createElement("div", null, "-") : null));
33
36
  };
34
37
  export default CustomerCard;
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import './index.less';
3
3
  interface CustomPageHeaderProps {
4
4
  title: string;
5
+ rightContent?: React.ReactNode;
6
+ isReturn?: boolean;
5
7
  }
6
8
  declare const CustomPageHeader: (props: CustomPageHeaderProps) => React.JSX.Element;
7
9
  export default CustomPageHeader;
@@ -7,13 +7,16 @@ import "./index.less";
7
7
  var prefixCls = 'ecocup-page-header';
8
8
  var CustomPageHeader = function CustomPageHeader(props) {
9
9
  var _context$appHelper;
10
- var title = props.title;
10
+ var title = props.title,
11
+ rightContent = props.rightContent,
12
+ _props$isReturn = props.isReturn,
13
+ isReturn = _props$isReturn === void 0 ? true : _props$isReturn;
11
14
  var context = useEngineContext();
12
15
  var _ref = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
13
16
  history = _ref.history;
14
17
  var app = useGetApp();
15
18
  var onBack = function onBack() {
16
- console.log('onBack', app, history);
19
+ if (!isReturn) return;
17
20
  if (app !== null && app !== void 0 && app.history) {
18
21
  var _app$history;
19
22
  (_app$history = app.history) === null || _app$history === void 0 || _app$history.goBack();
@@ -25,13 +28,20 @@ var CustomPageHeader = function CustomPageHeader(props) {
25
28
  return /*#__PURE__*/React.createElement("div", {
26
29
  className: prefixCls,
27
30
  onClick: onBack
28
- }, /*#__PURE__*/React.createElement(LeftOutlined, {
31
+ }, /*#__PURE__*/React.createElement("div", {
32
+ className: "".concat(prefixCls, "-left-container")
33
+ }, isReturn ? /*#__PURE__*/React.createElement(LeftOutlined, {
29
34
  style: {
30
35
  fontSize: 18
31
36
  }
32
- }), /*#__PURE__*/React.createElement(PageHeader, {
37
+ }) : null, /*#__PURE__*/React.createElement(PageHeader, {
33
38
  title: title,
34
39
  showTitle: true
35
- }));
40
+ })), /*#__PURE__*/React.createElement("div", {
41
+ className: "".concat(prefixCls, "-right-container"),
42
+ onClick: function onClick(e) {
43
+ return e.stopPropagation();
44
+ }
45
+ }, rightContent || ''));
36
46
  };
37
47
  export default CustomPageHeader;
@@ -3,8 +3,8 @@
3
3
  .@{prefixCls} {
4
4
  display: flex;
5
5
  align-items: center;
6
- gap: 16px;
7
- width: max-content;
6
+ justify-content: space-between;
7
+ width: 100%;
8
8
  margin-bottom: 12px;
9
9
  cursor: pointer;
10
10
  color: #fff;
@@ -13,7 +13,19 @@
13
13
  margin: 0;
14
14
  }
15
15
 
16
- .pisell-lowcode-page-header-title{
16
+ .pisell-lowcode-page-header-title {
17
17
  color: #fff !important;
18
18
  }
19
- }
19
+
20
+ &-left-container {
21
+ display: flex;
22
+ align-items: center;
23
+ gap: 16px;
24
+ }
25
+
26
+ &-right-container {
27
+ flex-shrink: 0;
28
+ display: flex;
29
+ justify-content: flex-end;
30
+ }
31
+ }
@@ -8,6 +8,7 @@ interface SearchBarProps {
8
8
  searchType?: 'customer' | 'cup';
9
9
  onSearchResult?: (v: any) => void;
10
10
  customerId?: string;
11
+ onCupStatusValidate?: (data: any) => void;
11
12
  }
12
13
  declare const SearchBar: (props: SearchBarProps) => React.JSX.Element;
13
14
  export default SearchBar;
@@ -10,10 +10,11 @@ import { locales } from '@pisell/utils';
10
10
  import { PisellToast } from '@pisell/materials';
11
11
  import "./index.less";
12
12
  import SearchSection from "../../../../pro/comprehensiveSearch/components/searchSection";
13
- import { useModal, useScanListener } from "../../hooks";
13
+ import { useModal, useScanListener, useGetShopId } from "../../hooks";
14
14
  import { SEARCH_BAR_RESULT_HEADER_CONFIG } from "./const";
15
15
  import { useSearch, useCupScanStatus } from "./hooks";
16
16
  import CupStatusModal from "../CupStatusModal";
17
+ import { ECupScanStatus } from "../../types";
17
18
  import dayjs from 'dayjs';
18
19
  var SearchBar = function SearchBar(props) {
19
20
  var scanListenerKey = props.scanListenerKey,
@@ -23,7 +24,8 @@ var SearchBar = function SearchBar(props) {
23
24
  onSearch = props.onSearch,
24
25
  searchType = props.searchType,
25
26
  onSearchResult = props.onSearchResult,
26
- customerId = props.customerId;
27
+ customerId = props.customerId,
28
+ onCupStatusValidate = props.onCupStatusValidate;
27
29
  var _useState = useState(''),
28
30
  _useState2 = _slicedToArray(_useState, 2),
29
31
  value = _useState2[0],
@@ -43,6 +45,7 @@ var SearchBar = function SearchBar(props) {
43
45
  var _useCupScanStatus = useCupScanStatus(),
44
46
  getCupScanStatus = _useCupScanStatus.getCupScanStatus;
45
47
  var cupStatusModal = useModal('ecocup-cup-status-modal');
48
+ var shopId = useGetShopId();
46
49
 
47
50
  // 点击搜索结果回调
48
51
  var onSelectResult = useMemoizedFn(function (type, item) {
@@ -76,6 +79,33 @@ var SearchBar = function SearchBar(props) {
76
79
  var _res$data;
77
80
  var _cupData = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data[0]) || null;
78
81
  var scanStatus = getCupScanStatus(_cupData, customerId);
82
+ console.log(scanStatus, _cupData, shopId, 'sjdhfjj');
83
+
84
+ // 自定义杯子状态函数验证
85
+ if (onCupStatusValidate) {
86
+ // 当前杯子属于当前店铺并且在库中
87
+ // if (_cupData?.status == ECupStatus.IN_STOCK) {
88
+ // if (_cupData?.current_shop_id == shopId) {
89
+ // cupStatusModal.open({
90
+ // data: {
91
+ // scanStatus: ECupScanStatus.IN_STOCK,
92
+ // cupData: _cupData || { code: str },
93
+ // },
94
+ // });
95
+ // return;
96
+ // }
97
+ // }
98
+
99
+ if (scanStatus && scanStatus === ECupScanStatus.OTHER_RENT) {
100
+ onCupStatusValidate === null || onCupStatusValidate === void 0 || onCupStatusValidate({
101
+ data: _cupData || {
102
+ code: str
103
+ }
104
+ });
105
+ setValue('');
106
+ return;
107
+ }
108
+ }
79
109
  if (scanStatus) {
80
110
  cupStatusModal.open({
81
111
  data: {
@@ -212,7 +242,7 @@ var SearchBar = function SearchBar(props) {
212
242
  return (v === null || v === void 0 ? void 0 : v.name) == 'admin';
213
243
  }) ? 'Admin' : tags !== null && tags !== void 0 && (_tags$find2 = tags.find) !== null && _tags$find2 !== void 0 && _tags$find2.call(tags, function (v) {
214
244
  return (v === null || v === void 0 ? void 0 : v.name) == 'business';
215
- }) ? 'Business' : 'Normal')));
245
+ }) ? 'Business' : 'Regular')));
216
246
  }))) : null, cupStatusModal.visible && /*#__PURE__*/React.createElement(CupStatusModal, cupStatusModal.modalProps));
217
247
  };
218
248
  export default SearchBar;
@@ -0,0 +1,6 @@
1
+ export declare const formItemsConfig: {
2
+ name: string;
3
+ labelKey: string;
4
+ placeholderKey: string;
5
+ requiredMessageKey: string;
6
+ }[];
@@ -0,0 +1,17 @@
1
+ // 表单配置数组
2
+ export var formItemsConfig = [{
3
+ name: 'regular',
4
+ labelKey: 'pisell2.text.ecocup.setting.regular',
5
+ placeholderKey: 'pisell2.text.ecocup.setting.regular-placeholder',
6
+ requiredMessageKey: 'pisell2.text.ecocup.setting.regular-required'
7
+ }, {
8
+ name: 'business',
9
+ labelKey: 'pisell2.text.ecocup.setting.business',
10
+ placeholderKey: 'pisell2.text.ecocup.setting.business-placeholder',
11
+ requiredMessageKey: 'pisell2.text.ecocup.setting.business-required'
12
+ }, {
13
+ name: 'admin',
14
+ labelKey: 'pisell2.text.ecocup.setting.admin',
15
+ placeholderKey: 'pisell2.text.ecocup.setting.admin-placeholder',
16
+ requiredMessageKey: 'pisell2.text.ecocup.setting.admin-required'
17
+ }];
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface IProps {
4
+ visible: boolean;
5
+ data?: Record<string, any>;
6
+ onCancel: () => void;
7
+ }
8
+ declare const SettingModal: (props: IProps) => React.JSX.Element;
9
+ export default SettingModal;
@@ -0,0 +1,253 @@
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
+ var _excluded = ["expire"];
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ 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; }
6
+ 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); } }
7
+ 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); }); }; }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ 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."); }
10
+ 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); }
11
+ 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; }
12
+ 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; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ import React, { useState, useEffect } from 'react';
15
+ import { PisellModal, FormItemInputNumber, PisellToast } from '@pisell/materials';
16
+ import { locales } from '@pisell/utils';
17
+ import { Form } from 'antd';
18
+ import "./index.less";
19
+ import { useRequest } from "../../hooks";
20
+ import { formItemsConfig } from "./const";
21
+ var SettingModal = function SettingModal(props) {
22
+ var visible = props.visible,
23
+ onCancel = props.onCancel;
24
+ var _Form$useForm = Form.useForm(),
25
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
26
+ form = _Form$useForm2[0];
27
+ var _useRequest = useRequest(),
28
+ post = _useRequest.post,
29
+ get = _useRequest.get;
30
+ var _useState = useState(false),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ loading = _useState2[0],
33
+ setLoading = _useState2[1];
34
+ var _onCancel = function _onCancel() {
35
+ if (loading) return;
36
+ onCancel === null || onCancel === void 0 || onCancel();
37
+ form.resetFields();
38
+ };
39
+ var _onOk = /*#__PURE__*/function () {
40
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
41
+ var values, result;
42
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
43
+ while (1) switch (_context.prev = _context.next) {
44
+ case 0:
45
+ if (!loading) {
46
+ _context.next = 2;
47
+ break;
48
+ }
49
+ return _context.abrupt("return");
50
+ case 2:
51
+ _context.prev = 2;
52
+ _context.next = 5;
53
+ return form.validateFields();
54
+ case 5:
55
+ values = _context.sent;
56
+ _context.next = 8;
57
+ return postSetting(values);
58
+ case 8:
59
+ result = _context.sent;
60
+ if (result) {
61
+ _context.next = 11;
62
+ break;
63
+ }
64
+ return _context.abrupt("return");
65
+ case 11:
66
+ _onCancel();
67
+ _context.next = 17;
68
+ break;
69
+ case 14:
70
+ _context.prev = 14;
71
+ _context.t0 = _context["catch"](2);
72
+ console.error(_context.t0);
73
+ case 17:
74
+ case "end":
75
+ return _context.stop();
76
+ }
77
+ }, _callee, null, [[2, 14]]);
78
+ }));
79
+ return function _onOk() {
80
+ return _ref.apply(this, arguments);
81
+ };
82
+ }();
83
+
84
+ /**
85
+ * @description: 获取设置信息
86
+ * @return {*}
87
+ */
88
+ var getSetting = /*#__PURE__*/function () {
89
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
90
+ var params, res, data, expireConfig, rentConfig, formValues;
91
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
92
+ while (1) switch (_context2.prev = _context2.next) {
93
+ case 0:
94
+ params = {
95
+ keys: ['eco_cup_customer_rent_config', 'eco_cup_rent_expire_config']
96
+ };
97
+ _context2.next = 3;
98
+ return get('/shop/metadata/many', params);
99
+ case 3:
100
+ res = _context2.sent;
101
+ if ((res === null || res === void 0 ? void 0 : res.code) == 200) {
102
+ data = res.data;
103
+ expireConfig = (data === null || data === void 0 ? void 0 : data.eco_cup_rent_expire_config) || {};
104
+ rentConfig = (data === null || data === void 0 ? void 0 : data.eco_cup_customer_rent_config) || []; // 构建表单字段对象
105
+ formValues = {
106
+ expire: (expireConfig === null || expireConfig === void 0 ? void 0 : expireConfig.expire) || 30
107
+ }; // 遍历租赁配置数组,将每个成员类型的 max_rent_count 设置到对应字段
108
+ rentConfig.forEach(function (item) {
109
+ if (item !== null && item !== void 0 && item.name) {
110
+ formValues[item.name] = Number(item === null || item === void 0 ? void 0 : item.max_rent_count) || undefined;
111
+ }
112
+ });
113
+ form.setFieldsValue(formValues);
114
+ }
115
+ case 5:
116
+ case "end":
117
+ return _context2.stop();
118
+ }
119
+ }, _callee2);
120
+ }));
121
+ return function getSetting() {
122
+ return _ref2.apply(this, arguments);
123
+ };
124
+ }();
125
+ useEffect(function () {
126
+ getSetting();
127
+ }, []);
128
+
129
+ /**
130
+ * @description: 提交设置信息
131
+ * @param {Record<string, any>} values - 表单值
132
+ * @return {Promise<boolean>}
133
+ */
134
+ var postSetting = /*#__PURE__*/function () {
135
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(values) {
136
+ var expire, membershipValues, eco_cup_customer_rent_config, params, res;
137
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
138
+ while (1) switch (_context3.prev = _context3.next) {
139
+ case 0:
140
+ expire = values.expire, membershipValues = _objectWithoutProperties(values, _excluded); // 动态生成租赁配置数组
141
+ eco_cup_customer_rent_config = formItemsConfig.map(function (config) {
142
+ return {
143
+ name: config.name,
144
+ max_rent_count: membershipValues[config.name]
145
+ };
146
+ }); // 构建参数
147
+ params = {
148
+ eco_cup_customer_rent_config: eco_cup_customer_rent_config,
149
+ eco_cup_rent_expire_config: {
150
+ expire: expire,
151
+ unit: 'day'
152
+ }
153
+ };
154
+ _context3.prev = 3;
155
+ setLoading(true);
156
+ _context3.next = 7;
157
+ return post('/shop/metadata/many', params);
158
+ case 7:
159
+ res = _context3.sent;
160
+ if (!((res === null || res === void 0 ? void 0 : res.code) == 200)) {
161
+ _context3.next = 11;
162
+ break;
163
+ }
164
+ PisellToast({
165
+ content: locales.getText('pisell2.text.ecocup.setting.success')
166
+ });
167
+ return _context3.abrupt("return", true);
168
+ case 11:
169
+ return _context3.abrupt("return", false);
170
+ case 14:
171
+ _context3.prev = 14;
172
+ _context3.t0 = _context3["catch"](3);
173
+ console.error('提交设置失败:', _context3.t0);
174
+ return _context3.abrupt("return", false);
175
+ case 18:
176
+ _context3.prev = 18;
177
+ setLoading(false);
178
+ return _context3.finish(18);
179
+ case 21:
180
+ case "end":
181
+ return _context3.stop();
182
+ }
183
+ }, _callee3, null, [[3, 14, 18, 21]]);
184
+ }));
185
+ return function postSetting(_x) {
186
+ return _ref3.apply(this, arguments);
187
+ };
188
+ }();
189
+ return /*#__PURE__*/React.createElement(PisellModal, {
190
+ open: visible,
191
+ headerDivider: true,
192
+ title: locales.getText('pisell2.text.cup-project.footer.button.setting'),
193
+ onCancel: _onCancel,
194
+ onOk: _onOk,
195
+ okText: locales.getText('pisell2.text.ecocup.button.confirm'),
196
+ cancelText: locales.getText('pisell2.text.ecocup.button.cancel'),
197
+ width: 680,
198
+ centered: true,
199
+ destroyOnClose: true,
200
+ wrapClassName: "pisell2-ecocup-add-customer-modal",
201
+ okButtonProps: {
202
+ loading: loading
203
+ }
204
+ }, /*#__PURE__*/React.createElement("div", {
205
+ className: "pisell2-ecocup-add-customer-modal-content"
206
+ }, /*#__PURE__*/React.createElement(Form, {
207
+ form: form,
208
+ size: "large"
209
+ }, formItemsConfig.map(function (config) {
210
+ return /*#__PURE__*/React.createElement(FormItemInputNumber, {
211
+ key: config.name,
212
+ renderMode: "edit",
213
+ name: config.name,
214
+ label: locales.getText(config.labelKey),
215
+ placeholder: locales.getText(config.placeholderKey),
216
+ maxobj: {
217
+ enabled: true,
218
+ max: 9999,
219
+ message: locales.getText('pisell2.text.ecocup.setting.max-rent-count-max')
220
+ },
221
+ minobj: {
222
+ enabled: true,
223
+ min: 0,
224
+ message: locales.getText('pisell2.text.ecocup.setting.max-rent-count-min')
225
+ },
226
+ requiredobj: {
227
+ required: true,
228
+ message: locales.getText(config.requiredMessageKey)
229
+ }
230
+ });
231
+ }), /*#__PURE__*/React.createElement(FormItemInputNumber, {
232
+ renderMode: "edit",
233
+ name: "expire",
234
+ label: locales.getText('pisell2.text.ecocup.setting.expire-time'),
235
+ placeholder: locales.getText('pisell2.text.ecocup.setting.expire-time-placeholder'),
236
+ maxobj: {
237
+ enabled: true,
238
+ max: 365,
239
+ message: locales.getText('pisell2.text.ecocup.setting.expire-time-max')
240
+ },
241
+ minobj: {
242
+ enabled: true,
243
+ min: 0,
244
+ message: locales.getText('pisell2.text.ecocup.setting.expire-time-min')
245
+ },
246
+ suffix: locales.getText('pisell2.text.ecocup.setting.days'),
247
+ requiredobj: {
248
+ required: true,
249
+ message: locales.getText('pisell2.text.ecocup.setting.expire-time-required')
250
+ }
251
+ }))));
252
+ };
253
+ export default SettingModal;
@@ -0,0 +1,9 @@
1
+ .pisell2-ecocup-add-customer-modal-content {
2
+ padding: 24px 0;
3
+
4
+ .pisell2-ecocup-add-customer-modal-content-name-wrap {
5
+ display: flex;
6
+ flex-direction: row;
7
+ gap: 16px;
8
+ }
9
+ }
@@ -130,4 +130,11 @@ declare const FILTER: (locales: any, isNormalShop: boolean, ecoShopLists?: any,
130
130
  };
131
131
  })[];
132
132
  };
133
- export { STATUS_TEXT_MAP, STATUS_COLOR_MAP, SORT_SETTINGS, COLUMN_SETTING, FILTER, };
133
+ declare const HEADER_RIGHT_OPTIONS: {
134
+ languageKey: string;
135
+ key: string;
136
+ size: string;
137
+ icon: string;
138
+ type: string;
139
+ }[];
140
+ export { STATUS_TEXT_MAP, STATUS_COLOR_MAP, SORT_SETTINGS, COLUMN_SETTING, FILTER, HEADER_RIGHT_OPTIONS };
@@ -303,4 +303,17 @@ var FILTER = function FILTER(locales, isNormalShop, ecoShopLists, isPartner, cur
303
303
  ]
304
304
  };
305
305
  };
306
- export { STATUS_TEXT_MAP, STATUS_COLOR_MAP, SORT_SETTINGS, COLUMN_SETTING, FILTER };
306
+ var HEADER_RIGHT_OPTIONS = [{
307
+ languageKey: 'pisell2.text.ecocup.share.title',
308
+ key: 'share',
309
+ size: 'large',
310
+ icon: 'pisell2-share-06',
311
+ type: 'default'
312
+ }, {
313
+ languageKey: 'pisell2.text.ecocup.export.title',
314
+ key: 'export',
315
+ size: 'large',
316
+ icon: 'pisell2-download-01',
317
+ type: 'default'
318
+ }];
319
+ export { STATUS_TEXT_MAP, STATUS_COLOR_MAP, SORT_SETTINGS, COLUMN_SETTING, FILTER, HEADER_RIGHT_OPTIONS };