Commit 8c9714061568612aba5c52a017ea3651d462da4d

Authored by boyang
2 parents 6329b78d 58558396

Merge branch 'feature-PrivatePocket' into 'dev'

feat: 新增隐私钱包消费记录



See merge request !37
.umirc.ts
@@ -130,7 +130,7 @@ export default defineConfig({ @@ -130,7 +130,7 @@ export default defineConfig({
130 ], 130 ],
131 }, 131 },
132 { 132 {
133 - name: '预存管理', 133 + name: '账户管理',
134 path: '/prepaid', 134 path: '/prepaid',
135 icon: 'AccountBookOutlined', 135 icon: 'AccountBookOutlined',
136 access: 'canReadAdminAndFinanceAndSales', 136 access: 'canReadAdminAndFinanceAndSales',
src/pages/Prepaid/PrivatePocket/index.tsx
@@ -9,6 +9,7 @@ import { formatDateTime } from '@/utils'; @@ -9,6 +9,7 @@ import { formatDateTime } from '@/utils';
9 import { ActionType, ProTable } from '@ant-design/pro-components'; 9 import { ActionType, ProTable } from '@ant-design/pro-components';
10 import { Button, message } from 'antd'; 10 import { Button, message } from 'antd';
11 import { useRef, useState } from 'react'; 11 import { useRef, useState } from 'react';
  12 +import BalanceChangeRecordsModal from '../components/BalanceChangeRecordsModal';
12 import AddPrivatePocketModal from './components/AddPrivatePocketModal'; 13 import AddPrivatePocketModal from './components/AddPrivatePocketModal';
13 import { PRIVATE_POCKET_COLUMNS } from './constant'; 14 import { PRIVATE_POCKET_COLUMNS } from './constant';
14 import './index.less'; 15 import './index.less';
@@ -16,6 +17,11 @@ import './index.less'; @@ -16,6 +17,11 @@ import './index.less';
16 const PrivatePocketPage = () => { 17 const PrivatePocketPage = () => {
17 const actionRef = useRef<ActionType>(); 18 const actionRef = useRef<ActionType>();
18 const [addModalVisible, setAddModalVisible] = useState<boolean>(false); 19 const [addModalVisible, setAddModalVisible] = useState<boolean>(false);
  20 + const [currentOptRecord, setCurrentOptRecord] = useState(null);
  21 + const [
  22 + balanceChangeRecordsModalVisible,
  23 + setBalanceChangeRecordsModalVisible,
  24 + ] = useState<boolean>(false);
19 25
20 const reloadTable = () => { 26 const reloadTable = () => {
21 actionRef.current?.reload(); 27 actionRef.current?.reload();
@@ -60,6 +66,20 @@ const PrivatePocketPage = () =&gt; { @@ -60,6 +66,20 @@ const PrivatePocketPage = () =&gt; {
60 let btns = []; 66 let btns = [];
61 67
62 btns.push( 68 btns.push(
  69 + <Button
  70 + className="p-0"
  71 + key="view"
  72 + type="link"
  73 + onClick={() => {
  74 + setCurrentOptRecord(record);
  75 + setBalanceChangeRecordsModalVisible(true);
  76 + }}
  77 + >
  78 + 消费记录
  79 + </Button>,
  80 + );
  81 +
  82 + btns.push(
63 <ButtonConfirm 83 <ButtonConfirm
64 key="delete" 84 key="delete"
65 className="p-0" 85 className="p-0"
@@ -148,6 +168,17 @@ const PrivatePocketPage = () =&gt; { @@ -148,6 +168,17 @@ const PrivatePocketPage = () =&gt; {
148 }} 168 }}
149 /> 169 />
150 )} 170 )}
  171 +
  172 + {balanceChangeRecordsModalVisible && (
  173 + <BalanceChangeRecordsModal
  174 + setVisible={setBalanceChangeRecordsModalVisible}
  175 + userInfoObj={currentOptRecord}
  176 + onClose={() => {
  177 + setBalanceChangeRecordsModalVisible(false);
  178 + reloadTable();
  179 + }}
  180 + />
  181 + )}
151 </div> 182 </div>
152 ); 183 );
153 }; 184 };
src/pages/Prepaid/components/RechargePrepaymentModal.tsx
@@ -33,7 +33,6 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; { @@ -33,7 +33,6 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
33 rechargeType: string; // 充值类型 33 rechargeType: string; // 充值类型
34 }>(); 34 }>();
35 const [salesCodeOptions, setSalesCodeOptions] = useState([]); 35 const [salesCodeOptions, setSalesCodeOptions] = useState([]);
36 - const [setRechargeType] = useState<string>('normal'); // 默认普通充值  
37 const [isCreate, setIsCreate] = useState(true); 36 const [isCreate, setIsCreate] = useState(true);
38 const [fileList, setFileList] = useState<UploadFile[]>([]); 37 const [fileList, setFileList] = useState<UploadFile[]>([]);
39 const [previewOpen, setPreviewOpen] = useState(false); 38 const [previewOpen, setPreviewOpen] = useState(false);
@@ -245,8 +244,8 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; { @@ -245,8 +244,8 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
245 }, 244 },
246 }} 245 }}
247 onFinish={async (values) => { 246 onFinish={async (values) => {
248 - // 隐私钱包充值不需要凭证  
249 - if (values.rechargeType !== 'privatePocket' && fileList.length <= 0) { 247 + // 所有充值类型都需要凭证
  248 + if (fileList.length <= 0) {
250 message.error('凭证不能为空'); 249 message.error('凭证不能为空');
251 return; 250 return;
252 } 251 }
@@ -282,10 +281,7 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; { @@ -282,10 +281,7 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
282 } 281 }
283 } 282 }
284 // 所有充值类型都传递rechargeType参数 283 // 所有充值类型都传递rechargeType参数
285 - // 如果是隐私钱包充值且不需要凭证,直接创建空凭证数组  
286 - if (values.rechargeType === 'privatePocket' && fileList.length <= 0) {  
287 - values.proofImages = [];  
288 - } 284 + // 所有充值类型都需要凭证
289 // 普通充值流程 285 // 普通充值流程
290 let res = await postServiceOrderFileProcess({ 286 let res = await postServiceOrderFileProcess({
291 data: formData, 287 data: formData,
@@ -439,11 +435,7 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; { @@ -439,11 +435,7 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
439 normal: '普通充值', 435 normal: '普通充值',
440 privatePocket: '隐私钱包充值', 436 privatePocket: '隐私钱包充值',
441 }} 437 }}
442 - fieldProps={{  
443 - onChange: (value) => {  
444 - setRechargeType(value);  
445 - },  
446 - }} 438 + // No special handling needed for different recharge types now
447 rules={[{ required: true, message: '请选择充值类型' }]} 439 rules={[{ required: true, message: '请选择充值类型' }]}
448 /> 440 />
449 <ProFormDigit 441 <ProFormDigit