Commit 0352ab1b3f27232d0fbc4c75836d5cd29cf1584b
1 parent
31c83c5a
feat: update 发票核销
Showing
6 changed files
with
94 additions
and
55 deletions
src/pages/Invoice/components/BankChooseModal.tsx
1 | 1 | import EllipsisDiv from '@/components/Div/EllipsisDiv'; |
2 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | 3 | import { INVOCING_STATUS, PAYEE_OPTIONS } from '@/pages/Order/constant'; |
3 | 4 | import { |
4 | 5 | postServiceBankStatementQueryBankStatement, |
... | ... | @@ -46,7 +47,7 @@ export default ({ invoiceId, setVisible, onClose }) => { |
46 | 47 | let searchParams = formRef?.current?.getFieldFormatValue(); |
47 | 48 | console.log(searchParams); |
48 | 49 | const res = await postServiceBankStatementQueryBankStatement({ |
49 | - data: { ...searchParams, ...params }, | |
50 | + data: { ...searchParams, ...params, status: 'ABNORMAL' }, | |
50 | 51 | }); |
51 | 52 | if (res) { |
52 | 53 | setBankData(res?.data?.data || []); |
... | ... | @@ -264,7 +265,6 @@ export default ({ invoiceId, setVisible, onClose }) => { |
264 | 265 | }; |
265 | 266 | |
266 | 267 | useEffect(() => { |
267 | - formRef.current?.setFieldValue('status', 'ABNORMAL'); | |
268 | 268 | loadBankData({ current: page, pageSize: pageSize }); |
269 | 269 | }, []); |
270 | 270 | |
... | ... | @@ -274,6 +274,7 @@ export default ({ invoiceId, setVisible, onClose }) => { |
274 | 274 | open |
275 | 275 | width="80%" |
276 | 276 | title="发票详情" |
277 | + className="bank-statement-choose" | |
277 | 278 | onOk={async () => { |
278 | 279 | setBtnLoading(true); |
279 | 280 | let bankStatementIds = selectedStatement?.map((item) => { |
... | ... | @@ -286,7 +287,7 @@ export default ({ invoiceId, setVisible, onClose }) => { |
286 | 287 | }, |
287 | 288 | }); |
288 | 289 | |
289 | - if (res) { | |
290 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
290 | 291 | message.info(res.message); |
291 | 292 | onClose(); |
292 | 293 | } | ... | ... |
src/pages/Invoice/components/InvoiceVerificationModal.tsx
1 | 1 | import ButtonConfirm from '@/components/ButtomConfirm'; |
2 | 2 | import EllipsisDiv from '@/components/Div/EllipsisDiv'; |
3 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
3 | 4 | import { INVOCING_STATUS, PAYEE_OPTIONS } from '@/pages/Order/constant'; |
4 | 5 | import { |
5 | 6 | postServiceInvoiceCancelInvoiceAndBankStatement, |
... | ... | @@ -42,7 +43,7 @@ export default ({ invoiceId, setVisible, onClose }) => { |
42 | 43 | }; |
43 | 44 | |
44 | 45 | const showRelationOrders = () => { |
45 | - return relationOrderIds.map((item) => { | |
46 | + return relationOrderIds?.map((item) => { | |
46 | 47 | return ( |
47 | 48 | <> |
48 | 49 | <Button |
... | ... | @@ -63,67 +64,68 @@ export default ({ invoiceId, setVisible, onClose }) => { |
63 | 64 | { |
64 | 65 | key: '1', |
65 | 66 | label: '发票号码', |
66 | - children: invoiceInfo.invoiceNumber, | |
67 | - span: 3, | |
67 | + children: invoiceInfo?.invoiceNumber, | |
68 | + span: 6, | |
68 | 69 | }, |
69 | 70 | { |
70 | 71 | key: '2', |
71 | 72 | label: '发票类型', |
72 | - children: enumValueToLabel(invoiceInfo.invoiceStatus, INVOCING_STATUS), | |
73 | + children: enumValueToLabel(invoiceInfo?.invoiceStatus, INVOCING_STATUS), | |
73 | 74 | span: 6, |
74 | 75 | }, |
75 | 76 | { |
76 | 77 | key: '3', |
77 | 78 | label: '状态', |
78 | - children: enumValueToLabel(invoiceInfo.status, INVOICE_STATUS), | |
79 | - span: 6, | |
79 | + children: enumValueToLabel(invoiceInfo?.status, INVOICE_STATUS), | |
80 | + span: 4, | |
80 | 81 | }, |
81 | 82 | { |
82 | 83 | key: '4', |
83 | 84 | label: '购买方', |
84 | - children: invoiceInfo.purchaser, | |
85 | - span: 9, | |
85 | + children: invoiceInfo?.purchaser, | |
86 | + span: 8, | |
86 | 87 | }, |
87 | 88 | { |
88 | 89 | key: '5', |
89 | 90 | label: '收款单位', |
90 | - children: enumValueToLabel(invoiceInfo.payee, PAYEE_OPTIONS), | |
91 | - span: 9, | |
91 | + children: enumValueToLabel(invoiceInfo?.payee, PAYEE_OPTIONS), | |
92 | + span: 12, | |
92 | 93 | }, |
93 | 94 | { |
94 | 95 | key: '6', |
95 | 96 | label: '联系人', |
96 | - children: invoiceInfo.contacts, | |
97 | - span: 6, | |
97 | + children: invoiceInfo?.contacts, | |
98 | + span: 4, | |
98 | 99 | }, |
99 | 100 | { |
100 | 101 | key: '7', |
101 | 102 | label: '销售', |
102 | - children: invoiceInfo.sale, | |
103 | - span: 6, | |
104 | - }, | |
105 | - { | |
106 | - key: '8', | |
107 | - label: '金额', | |
108 | - children: invoiceInfo.money, | |
109 | - span: 6, | |
103 | + children: invoiceInfo?.sale, | |
104 | + span: 8, | |
110 | 105 | }, |
106 | + | |
111 | 107 | { |
112 | 108 | key: '9', |
113 | 109 | label: '开票日期', |
114 | - children: formatDate(invoiceInfo.invoicingTime), | |
115 | - span: 9, | |
110 | + children: formatDate(invoiceInfo?.invoicingTime), | |
111 | + span: 12, | |
116 | 112 | }, |
117 | 113 | { |
118 | 114 | key: '10', |
119 | 115 | label: '收款时间', |
120 | - children: formatDate(invoiceInfo.collectionTime), | |
121 | - span: 15, | |
116 | + children: formatDate(invoiceInfo?.collectionTime), | |
117 | + span: 4, | |
118 | + }, | |
119 | + { | |
120 | + key: '8', | |
121 | + label: '金额', | |
122 | + children: invoiceInfo?.money, | |
123 | + span: 10, | |
122 | 124 | }, |
123 | 125 | { |
124 | 126 | key: '11', |
125 | 127 | label: '备注', |
126 | - children: invoiceInfo.notes, | |
128 | + children: invoiceInfo?.notes, | |
127 | 129 | span: 24, |
128 | 130 | }, |
129 | 131 | ]; |
... | ... | @@ -209,26 +211,34 @@ export default ({ invoiceId, setVisible, onClose }) => { |
209 | 211 | key: 'option', |
210 | 212 | fixed: 'right', |
211 | 213 | width: 70, |
212 | - render: (text, record) => [ | |
213 | - <ButtonConfirm | |
214 | - key="delete" | |
215 | - className="p-0" | |
216 | - title={'确认删除此项吗?'} | |
217 | - text="删除" | |
218 | - onConfirm={async () => { | |
219 | - let res = await postServiceInvoiceCancelInvoiceAndBankStatement({ | |
220 | - data: { | |
221 | - invoiceId: invoiceId, | |
222 | - cancelId: [record.id], | |
223 | - }, | |
224 | - }); | |
225 | - if (res) { | |
226 | - message.success(res.message); | |
227 | - loadInvoiceData(); | |
228 | - } | |
229 | - }} | |
230 | - />, | |
231 | - ], | |
214 | + render: (text, record) => { | |
215 | + let optBtns = []; | |
216 | + if (invoiceInfo?.status === 'VERIFIED') { | |
217 | + return []; | |
218 | + } | |
219 | + | |
220 | + optBtns.push( | |
221 | + <ButtonConfirm | |
222 | + key="delete" | |
223 | + className="p-0" | |
224 | + title={'确认删除此项吗?'} | |
225 | + text="删除" | |
226 | + onConfirm={async () => { | |
227 | + let res = await postServiceInvoiceCancelInvoiceAndBankStatement({ | |
228 | + data: { | |
229 | + invoiceId: invoiceId, | |
230 | + cancelId: [record.id], | |
231 | + }, | |
232 | + }); | |
233 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
234 | + message.success(res.message); | |
235 | + loadInvoiceData(); | |
236 | + } | |
237 | + }} | |
238 | + />, | |
239 | + ); | |
240 | + return optBtns; | |
241 | + }, | |
232 | 242 | }); |
233 | 243 | |
234 | 244 | return columns; |
... | ... | @@ -289,7 +299,7 @@ export default ({ invoiceId, setVisible, onClose }) => { |
289 | 299 | onClick={() => { |
290 | 300 | setBankChooseModalVisible(true); |
291 | 301 | }} |
292 | - hidden={invoiceInfo.status === 'VERIFIED'} | |
302 | + hidden={invoiceInfo?.status === 'VERIFIED'} | |
293 | 303 | type="primary" |
294 | 304 | > |
295 | 305 | 添加 |
... | ... | @@ -308,6 +318,7 @@ export default ({ invoiceId, setVisible, onClose }) => { |
308 | 318 | <ModalForm<{ |
309 | 319 | id: string; |
310 | 320 | }> |
321 | + className="invoice-detail" | |
311 | 322 | open |
312 | 323 | width="80%" |
313 | 324 | title="发票详情" | ... | ... |
src/pages/Invoice/constant.tsx
... | ... | @@ -15,6 +15,14 @@ export type InvoiceItem = { |
15 | 15 | |
16 | 16 | export const INVOICE_COLUMNS = [ |
17 | 17 | { |
18 | + dataIndex: 'invoiceId', | |
19 | + title: 'id', | |
20 | + valueType: 'text', | |
21 | + hideInTable: true, | |
22 | + hideInSearch: true, | |
23 | + width: 100, | |
24 | + }, | |
25 | + { | |
18 | 26 | dataIndex: 'invoiceNumber', |
19 | 27 | title: '发票号码', |
20 | 28 | valueType: 'text', |
... | ... | @@ -95,6 +103,7 @@ export const BANK_STATEMENT_COLUMNS = [ |
95 | 103 | valueType: 'text', |
96 | 104 | width: 100, |
97 | 105 | hideInTable: true, |
106 | + hideInSearch: true, | |
98 | 107 | editable: false, |
99 | 108 | }, |
100 | 109 | { | ... | ... |
src/pages/Invoice/index.less
... | ... | @@ -4,3 +4,17 @@ |
4 | 4 | 'WenQuanYi Micro Hei', sans-serif; |
5 | 5 | font-size: 14px; |
6 | 6 | } |
7 | + | |
8 | +.invoice-detail td { | |
9 | + font-family: 'San Francisco', 'Helvetica Neue', Helvetica, Arial, | |
10 | + 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC', | |
11 | + 'WenQuanYi Micro Hei', sans-serif; | |
12 | + font-size: 14px; | |
13 | +} | |
14 | + | |
15 | +.bank-statement-choose td { | |
16 | + font-family: 'San Francisco', 'Helvetica Neue', Helvetica, Arial, | |
17 | + 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC', | |
18 | + 'WenQuanYi Micro Hei', sans-serif; | |
19 | + font-size: 14px; | |
20 | +} | ... | ... |
src/pages/Invoice/index.tsx
1 | 1 | import ButtonConfirm from '@/components/ButtomConfirm'; |
2 | 2 | import EllipsisDiv from '@/components/Div/EllipsisDiv'; |
3 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
3 | 4 | import { |
4 | 5 | BANK_STATEMENT_COLUMNS, |
5 | 6 | INVOICE_COLUMNS, |
... | ... | @@ -131,7 +132,7 @@ const InvoicePage = () => { |
131 | 132 | key="editable" |
132 | 133 | onClick={() => { |
133 | 134 | setInvoiceVerificationVisible(true); |
134 | - setInvoiceId(record.id); | |
135 | + setInvoiceId(record.invoiceId); | |
135 | 136 | }} |
136 | 137 | > |
137 | 138 | 核销 |
... | ... | @@ -142,7 +143,7 @@ const InvoicePage = () => { |
142 | 143 | type="link" |
143 | 144 | onClick={() => { |
144 | 145 | setInvoiceVerificationVisible(true); |
145 | - setInvoiceId(record.id); | |
146 | + setInvoiceId(record.invoiceId); | |
146 | 147 | }} |
147 | 148 | > |
148 | 149 | 查看 |
... | ... | @@ -154,7 +155,7 @@ const InvoicePage = () => { |
154 | 155 | text="删除" |
155 | 156 | onConfirm={async () => { |
156 | 157 | let res = await postServiceInvoiceDeleteInvoice({ |
157 | - data: { invoiceId: record.id }, | |
158 | + data: { invoiceId: record.invoiceId }, | |
158 | 159 | }); |
159 | 160 | if (res) { |
160 | 161 | message.success(res.message); |
... | ... | @@ -252,7 +253,7 @@ const InvoicePage = () => { |
252 | 253 | let res = await postServiceBankStatementDeleteBankStatement({ |
253 | 254 | data: { id: record.id }, |
254 | 255 | }); |
255 | - if (res) { | |
256 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
256 | 257 | message.success(res.message); |
257 | 258 | reloadBankStatementTable(); |
258 | 259 | } | ... | ... |
src/pages/Order/index.tsx
... | ... | @@ -2242,7 +2242,10 @@ const OrderPage = () => { |
2242 | 2242 | mainOrderSelectedMap.forEach((value) => { |
2243 | 2243 | mainOrders.push(value); |
2244 | 2244 | for (let subOrder of value.subOrderInformationLists) { |
2245 | - if (subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING') { | |
2245 | + if ( | |
2246 | + subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING' && | |
2247 | + subOrder.afterInvoicingStatus !== 'PARTIAL_INVOICING' | |
2248 | + ) { | |
2246 | 2249 | errorIds.push(value.id); |
2247 | 2250 | return; |
2248 | 2251 | } |
... | ... | @@ -2252,7 +2255,7 @@ const OrderPage = () => { |
2252 | 2255 | message.error( |
2253 | 2256 | '订单号为:' + |
2254 | 2257 | errorIds.join(',') + |
2255 | - '的订单存在不是[申请开票]状态的子订单,请检查!', | |
2258 | + '的订单存在不是[申请开票]或者[部分开票]状态的子订单,请检查!', | |
2256 | 2259 | ); |
2257 | 2260 | return; |
2258 | 2261 | } | ... | ... |