Commit 31c83c5a01a40c7d8f7e10bdb7a5528d73ebd01c
1 parent
53ad288e
feat: update 发票核销
Showing
4 changed files
with
75 additions
and
20 deletions
src/pages/Invoice/components/InvoiceVerificationModal.tsx
1 | +import ButtonConfirm from '@/components/ButtomConfirm'; | |
1 | 2 | import EllipsisDiv from '@/components/Div/EllipsisDiv'; |
2 | 3 | import { INVOCING_STATUS, PAYEE_OPTIONS } from '@/pages/Order/constant'; |
3 | -import { postServiceInvoiceQueryInvoiceDetail } from '@/services'; | |
4 | +import { | |
5 | + postServiceInvoiceCancelInvoiceAndBankStatement, | |
6 | + postServiceInvoiceQueryInvoiceDetail, | |
7 | +} from '@/services'; | |
4 | 8 | import { enumValueToLabel, formatDateTime } from '@/utils'; |
5 | 9 | import { formatDate } from '@/utils/time'; |
6 | 10 | import { PlusOutlined } from '@ant-design/icons'; |
... | ... | @@ -12,6 +16,7 @@ import { |
12 | 16 | Divider, |
13 | 17 | Flex, |
14 | 18 | Form, |
19 | + message, | |
15 | 20 | } from 'antd'; |
16 | 21 | import { useEffect, useState } from 'react'; |
17 | 22 | import { BANK_STATEMENT_COLUMNS, INVOICE_STATUS } from '../constant'; |
... | ... | @@ -205,25 +210,24 @@ export default ({ invoiceId, setVisible, onClose }) => { |
205 | 210 | fixed: 'right', |
206 | 211 | width: 70, |
207 | 212 | render: (text, record) => [ |
208 | - <Button | |
213 | + <ButtonConfirm | |
214 | + key="delete" | |
209 | 215 | className="p-0" |
210 | - key="choose" | |
211 | - type="link" | |
212 | - onClick={() => { | |
213 | - //去掉表格中对应的数据 | |
214 | - let newBankData = bankData.filter((item) => { | |
215 | - return item.id !== record.id; | |
216 | + title={'确认删除此项吗?'} | |
217 | + text="删除" | |
218 | + onConfirm={async () => { | |
219 | + let res = await postServiceInvoiceCancelInvoiceAndBankStatement({ | |
220 | + data: { | |
221 | + invoiceId: invoiceId, | |
222 | + cancelId: [record.id], | |
223 | + }, | |
216 | 224 | }); |
217 | - setBankData(newBankData); | |
218 | - | |
219 | - //添加到已选中区域中 | |
220 | - let newSelectedStatement = [...selectedStatement]; | |
221 | - newSelectedStatement.push(record); | |
222 | - setSelectedStatement(newSelectedStatement); | |
225 | + if (res) { | |
226 | + message.success(res.message); | |
227 | + loadInvoiceData(); | |
228 | + } | |
223 | 229 | }} |
224 | - > | |
225 | - 选中 | |
226 | - </Button>, | |
230 | + />, | |
227 | 231 | ], |
228 | 232 | }); |
229 | 233 | ... | ... |
src/pages/Order/index.tsx
... | ... | @@ -25,8 +25,10 @@ import { |
25 | 25 | QuestionCircleOutlined, |
26 | 26 | } from '@ant-design/icons'; |
27 | 27 | import { |
28 | + ActionType, | |
28 | 29 | PageContainer, |
29 | 30 | ProColumns, |
31 | + ProFormInstance, | |
30 | 32 | ProTable, |
31 | 33 | } from '@ant-design/pro-components'; |
32 | 34 | import { history } from '@umijs/max'; |
... | ... | @@ -45,7 +47,7 @@ import { |
45 | 47 | message, |
46 | 48 | } from 'antd'; |
47 | 49 | import { cloneDeep } from 'lodash'; |
48 | -import React, { Key, useRef, useState } from 'react'; | |
50 | +import React, { Key, useEffect, useRef, useState } from 'react'; | |
49 | 51 | import OrderPrintModal from '../OrderPrint/OrderPrintModal'; |
50 | 52 | import AfterSalesDrawer from './components/AfterSalesDrawer'; |
51 | 53 | import ApplyForInvoicingModal from './components/ApplyForInvoicingModal'; |
... | ... | @@ -143,7 +145,8 @@ const OrderPage = () => { |
143 | 145 | const [mainOrderSelectedRows, setMainOrderSelectedRows] = useState([]); //选中的主订单集合 |
144 | 146 | const [onlyShowFinancialToBeProcessed, setOnlyShowFinancialToBeProcessed] = |
145 | 147 | useState(false); |
146 | - const mainTableRef = useRef(); | |
148 | + const mainTableRef = useRef<ActionType>(); | |
149 | + const mainTableFormRef = useRef<ProFormInstance>(); | |
147 | 150 | let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储 |
148 | 151 | const [messageApi, contextHolder] = message.useMessage(); |
149 | 152 | |
... | ... | @@ -2322,6 +2325,15 @@ const OrderPage = () => { |
2322 | 2325 | return toolBtns; |
2323 | 2326 | } |
2324 | 2327 | |
2328 | + useEffect(() => { | |
2329 | + // 使用URLSearchParams来解析查询参数 | |
2330 | + const params = new URLSearchParams(location.search); | |
2331 | + const id = params.get('id'); | |
2332 | + if (id) { | |
2333 | + mainTableFormRef.current?.setFieldValue('id', id); | |
2334 | + } | |
2335 | + }, []); | |
2336 | + | |
2325 | 2337 | return ( |
2326 | 2338 | <PageContainer |
2327 | 2339 | className="order-page-container" |
... | ... | @@ -2365,6 +2377,7 @@ const OrderPage = () => { |
2365 | 2377 | // tableStyle={{backgroundColor:'red'}} |
2366 | 2378 | |
2367 | 2379 | actionRef={mainTableRef} |
2380 | + formRef={mainTableFormRef} | |
2368 | 2381 | expandIconColumnIndex={-1} |
2369 | 2382 | columns={mainOrdersColumns} |
2370 | 2383 | rowKey="id" |
... | ... | @@ -2396,6 +2409,12 @@ const OrderPage = () => { |
2396 | 2409 | filter, |
2397 | 2410 | ) => { |
2398 | 2411 | //订单id处理 |
2412 | + /** | |
2413 | + * 以params中的id为主,如果params没id,则取url中的id | |
2414 | + * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来 | |
2415 | + */ | |
2416 | + let orderIds = mainTableFormRef.current?.getFieldValue('id'); | |
2417 | + params.id = params.id || orderIds; | |
2399 | 2418 | if (params.id !== '') { |
2400 | 2419 | if (params.id?.indexOf(',')) { |
2401 | 2420 | params.id = params.id.split(','); | ... | ... |
src/services/definition.ts
... | ... | @@ -324,6 +324,20 @@ export interface AuditVO { |
324 | 324 | total?: number; |
325 | 325 | } |
326 | 326 | |
327 | +export interface CancelInvoiceAndBankStatementDto { | |
328 | + /** | |
329 | + * @description | |
330 | + * 取消关联的银行流水id集合 | |
331 | + */ | |
332 | + cancelId?: Array<number>; | |
333 | + /** | |
334 | + * @description | |
335 | + * 发票id | |
336 | + * @format int64 | |
337 | + */ | |
338 | + invoiceId?: number; | |
339 | +} | |
340 | + | |
327 | 341 | export interface CaptchaMessageVO { |
328 | 342 | /** @format int32 */ |
329 | 343 | current?: number; | ... | ... |
src/services/request.ts
... | ... | @@ -22,6 +22,7 @@ import type { |
22 | 22 | AdminUserRegisterVO, |
23 | 23 | AdminUserVO, |
24 | 24 | AuditVO, |
25 | + CancelInvoiceAndBankStatementDto, | |
25 | 26 | CaptchaMessageVO, |
26 | 27 | DictionaryQueryVO, |
27 | 28 | DictionaryVO, |
... | ... | @@ -5119,6 +5120,20 @@ export const postServiceBankStatementQueryBankStatement = |
5119 | 5120 | return request; |
5120 | 5121 | })(); |
5121 | 5122 | |
5123 | +/** @description request parameter type for postServiceInvoiceCancelInvoiceAndBankStatement */ | |
5124 | +export interface PostServiceInvoiceCancelInvoiceAndBankStatementOption { | |
5125 | + /** | |
5126 | + * @description | |
5127 | + * dto | |
5128 | + */ | |
5129 | + body: { | |
5130 | + /** | |
5131 | + @description | |
5132 | + dto */ | |
5133 | + dto: CancelInvoiceAndBankStatementDto; | |
5134 | + }; | |
5135 | +} | |
5136 | + | |
5122 | 5137 | /** @description response type for postServiceInvoiceCancelInvoiceAndBankStatement */ |
5123 | 5138 | export interface PostServiceInvoiceCancelInvoiceAndBankStatementResponse { |
5124 | 5139 | /** |
... | ... | @@ -5161,9 +5176,12 @@ export const postServiceInvoiceCancelInvoiceAndBankStatement = |
5161 | 5176 | /* #__PURE__ */ (() => { |
5162 | 5177 | const method = 'post'; |
5163 | 5178 | const url = '/service/invoice/cancelInvoiceAndBankStatement'; |
5164 | - function request(): Promise<PostServiceInvoiceCancelInvoiceAndBankStatementResponseSuccess> { | |
5179 | + function request( | |
5180 | + option: PostServiceInvoiceCancelInvoiceAndBankStatementOption, | |
5181 | + ): Promise<PostServiceInvoiceCancelInvoiceAndBankStatementResponseSuccess> { | |
5165 | 5182 | return requester(request.url, { |
5166 | 5183 | method: request.method, |
5184 | + ...option, | |
5167 | 5185 | }) as unknown as Promise<PostServiceInvoiceCancelInvoiceAndBankStatementResponseSuccess>; |
5168 | 5186 | } |
5169 | 5187 | ... | ... |