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