Commit 585583969d92a19cdde9711582b3ac4a0470b65a
1 parent
c816aaf1
feat: 新增隐私钱包消费记录
Showing
3 changed files
with
36 additions
and
13 deletions
.umirc.ts
src/pages/Prepaid/PrivatePocket/index.tsx
... | ... | @@ -9,6 +9,7 @@ import { formatDateTime } from '@/utils'; |
9 | 9 | import { ActionType, ProTable } from '@ant-design/pro-components'; |
10 | 10 | import { Button, message } from 'antd'; |
11 | 11 | import { useRef, useState } from 'react'; |
12 | +import BalanceChangeRecordsModal from '../components/BalanceChangeRecordsModal'; | |
12 | 13 | import AddPrivatePocketModal from './components/AddPrivatePocketModal'; |
13 | 14 | import { PRIVATE_POCKET_COLUMNS } from './constant'; |
14 | 15 | import './index.less'; |
... | ... | @@ -16,6 +17,11 @@ import './index.less'; |
16 | 17 | const PrivatePocketPage = () => { |
17 | 18 | const actionRef = useRef<ActionType>(); |
18 | 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 | 26 | const reloadTable = () => { |
21 | 27 | actionRef.current?.reload(); |
... | ... | @@ -60,6 +66,20 @@ const PrivatePocketPage = () => { |
60 | 66 | let btns = []; |
61 | 67 | |
62 | 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 | 83 | <ButtonConfirm |
64 | 84 | key="delete" |
65 | 85 | className="p-0" |
... | ... | @@ -148,6 +168,17 @@ const PrivatePocketPage = () => { |
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 | 182 | </div> |
152 | 183 | ); |
153 | 184 | }; | ... | ... |
src/pages/Prepaid/components/RechargePrepaymentModal.tsx
... | ... | @@ -33,7 +33,6 @@ export default ({ setVisible, prepaymentObject, onClose }) => { |
33 | 33 | rechargeType: string; // 充值类型 |
34 | 34 | }>(); |
35 | 35 | const [salesCodeOptions, setSalesCodeOptions] = useState([]); |
36 | - const [setRechargeType] = useState<string>('normal'); // 默认普通充值 | |
37 | 36 | const [isCreate, setIsCreate] = useState(true); |
38 | 37 | const [fileList, setFileList] = useState<UploadFile[]>([]); |
39 | 38 | const [previewOpen, setPreviewOpen] = useState(false); |
... | ... | @@ -245,8 +244,8 @@ export default ({ setVisible, prepaymentObject, onClose }) => { |
245 | 244 | }, |
246 | 245 | }} |
247 | 246 | onFinish={async (values) => { |
248 | - // 隐私钱包充值不需要凭证 | |
249 | - if (values.rechargeType !== 'privatePocket' && fileList.length <= 0) { | |
247 | + // 所有充值类型都需要凭证 | |
248 | + if (fileList.length <= 0) { | |
250 | 249 | message.error('凭证不能为空'); |
251 | 250 | return; |
252 | 251 | } |
... | ... | @@ -282,10 +281,7 @@ export default ({ setVisible, prepaymentObject, onClose }) => { |
282 | 281 | } |
283 | 282 | } |
284 | 283 | // 所有充值类型都传递rechargeType参数 |
285 | - // 如果是隐私钱包充值且不需要凭证,直接创建空凭证数组 | |
286 | - if (values.rechargeType === 'privatePocket' && fileList.length <= 0) { | |
287 | - values.proofImages = []; | |
288 | - } | |
284 | + // 所有充值类型都需要凭证 | |
289 | 285 | // 普通充值流程 |
290 | 286 | let res = await postServiceOrderFileProcess({ |
291 | 287 | data: formData, |
... | ... | @@ -439,11 +435,7 @@ export default ({ setVisible, prepaymentObject, onClose }) => { |
439 | 435 | normal: '普通充值', |
440 | 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 | 439 | rules={[{ required: true, message: '请选择充值类型' }]} |
448 | 440 | /> |
449 | 441 | <ProFormDigit | ... | ... |