Commit 6b0d7fb3278c3145b0a69c5ca1d4a37a3f701902

Authored by zhongnanhuang
1 parent 0352ab1b

feat: update 发票核销

src/pages/Invoice/components/BankChooseModal.tsx
@@ -7,7 +7,6 @@ import { @@ -7,7 +7,6 @@ import {
7 } from '@/services'; 7 } from '@/services';
8 import { enumValueToLabel, formatDateTime } from '@/utils'; 8 import { enumValueToLabel, formatDateTime } from '@/utils';
9 import { formatDate } from '@/utils/time'; 9 import { formatDate } from '@/utils/time';
10 -import { PlusOutlined } from '@ant-design/icons';  
11 import { 10 import {
12 ActionType, 11 ActionType,
13 ProCard, 12 ProCard,
@@ -92,7 +91,9 @@ export default ({ invoiceId, setVisible, onClose }) => { @@ -92,7 +91,9 @@ export default ({ invoiceId, setVisible, onClose }) => {
92 /> 91 />
93 ); 92 );
94 93
95 - case 'status': 94 + case 'status': {
  95 + //这里状态不显示在筛选条件中,只能筛异常的流水
  96 + newItem.hideInSearch = true;
96 return ( 97 return (
97 <EllipsisDiv 98 <EllipsisDiv
98 text={enumValueToLabel( 99 text={enumValueToLabel(
@@ -101,7 +102,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; { @@ -101,7 +102,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
101 )} 102 )}
102 /> 103 />
103 ); 104 );
104 - 105 + }
105 case 'payee': 106 case 'payee':
106 return ( 107 return (
107 <EllipsisDiv 108 <EllipsisDiv
@@ -176,9 +177,6 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; { @@ -176,9 +177,6 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
176 }, 177 },
177 }} 178 }}
178 dataSource={bankData} 179 dataSource={bankData}
179 - onDataSourceChange={() => {  
180 - console.log('change');  
181 - }}  
182 columnsState={{ 180 columnsState={{
183 persistenceKey: 'pro-table-singe-demos', 181 persistenceKey: 'pro-table-singe-demos',
184 persistenceType: 'localStorage', 182 persistenceType: 'localStorage',
@@ -189,7 +187,6 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; { @@ -189,7 +187,6 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
189 console.log('value: ', value); 187 console.log('value: ', value);
190 }, 188 },
191 }} 189 }}
192 - rowKey="id"  
193 search={{ 190 search={{
194 labelWidth: 'auto', 191 labelWidth: 'auto',
195 span: 8, 192 span: 8,
@@ -198,25 +195,22 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; { @@ -198,25 +195,22 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
198 setting: { 195 setting: {
199 listsHeight: 400, 196 listsHeight: 400,
200 }, 197 },
  198 + reload: () => {
  199 + loadBankData({ current: 1 });
  200 + },
201 }} 201 }}
202 form={{}} 202 form={{}}
203 onSubmit={() => { 203 onSubmit={() => {
204 loadBankData({ current: 1 }); 204 loadBankData({ current: 1 });
205 }} 205 }}
206 - onReset={() => {}} 206 + onReset={() => {
  207 + formRef.current?.resetFields();
  208 + loadBankData({ current: 1 });
  209 + }}
207 dateFormatter="string" 210 dateFormatter="string"
208 headerTitle="银行流水" 211 headerTitle="银行流水"
209 scroll={{ x: 1400, y: 360 }} 212 scroll={{ x: 1400, y: 360 }}
210 - toolBarRender={() => [  
211 - <Button  
212 - key="button"  
213 - icon={<PlusOutlined />}  
214 - onClick={() => {}}  
215 - type="primary"  
216 - >  
217 - 添加  
218 - </Button>,  
219 - ]} 213 + toolBarRender={() => []}
220 /> 214 />
221 ); 215 );
222 }; 216 };
@@ -265,6 +259,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; { @@ -265,6 +259,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
265 }; 259 };
266 260
267 useEffect(() => { 261 useEffect(() => {
  262 + message.info('1');
268 loadBankData({ current: page, pageSize: pageSize }); 263 loadBankData({ current: page, pageSize: pageSize });
269 }, []); 264 }, []);
270 265
@@ -273,7 +268,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; { @@ -273,7 +268,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
273 <Modal 268 <Modal
274 open 269 open
275 width="80%" 270 width="80%"
276 - title="发票详情" 271 + title="添加银行流水"
277 className="bank-statement-choose" 272 className="bank-statement-choose"
278 onOk={async () => { 273 onOk={async () => {
279 setBtnLoading(true); 274 setBtnLoading(true);
src/pages/Invoice/components/InvoiceVerificationModal.tsx
@@ -37,7 +37,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; { @@ -37,7 +37,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
37 }); 37 });
38 if (res && res.data) { 38 if (res && res.data) {
39 setInvoiceInfo(res.data.queryInvoiceResponseDto); 39 setInvoiceInfo(res.data.queryInvoiceResponseDto);
40 - setRelationOrderIds(res.data.mainOrderId); 40 + setRelationOrderIds(res.data.mainOrderIds);
41 setRelationBankStatements(res.data.bankStatementResponseDtos); 41 setRelationBankStatements(res.data.bankStatementResponseDtos);
42 } 42 }
43 }; 43 };
src/pages/Invoice/constant.tsx
  1 +import { enumToProTableEnumValue } from '@/utils';
  2 +import { PAYEE_OPTIONS } from '../Order/constant';
  3 +
1 export type InvoiceItem = { 4 export type InvoiceItem = {
2 id: number; //id 5 id: number; //id
3 invoiceStatus: string; //发票类型:专票/普票 6 invoiceStatus: string; //发票类型:专票/普票
@@ -13,6 +16,12 @@ export type InvoiceItem = { @@ -13,6 +16,12 @@ export type InvoiceItem = {
13 notes: string; //备注 16 notes: string; //备注
14 }; 17 };
15 18
  19 +export const INVOICE_STATUS = {
  20 + UNVERIFIED: '未核销',
  21 + VERIFIED: '已核销',
  22 + ABNORMAL: '异常',
  23 +};
  24 +
16 export const INVOICE_COLUMNS = [ 25 export const INVOICE_COLUMNS = [
17 { 26 {
18 dataIndex: 'invoiceId', 27 dataIndex: 'invoiceId',
@@ -33,12 +42,20 @@ export const INVOICE_COLUMNS = [ @@ -33,12 +42,20 @@ export const INVOICE_COLUMNS = [
33 title: '发票类型', 42 title: '发票类型',
34 valueType: 'select', 43 valueType: 'select',
35 width: 100, 44 width: 100,
  45 + valueEnum: enumToProTableEnumValue({
  46 + SPECIALLY_INVOICED: '专票',
  47 + COMMON_INVOICED: '普票',
  48 + }),
36 }, 49 },
37 { 50 {
38 title: '状态', 51 title: '状态',
39 dataIndex: 'status', 52 dataIndex: 'status',
40 valueType: 'text', 53 valueType: 'text',
41 width: 100, 54 width: 100,
  55 + valueEnum: enumToProTableEnumValue({
  56 + UNVERIFIED: '未核销',
  57 + VERIFIED: '已核销',
  58 + }),
42 }, 59 },
43 { 60 {
44 title: '购买方', 61 title: '购买方',
@@ -51,6 +68,7 @@ export const INVOICE_COLUMNS = [ @@ -51,6 +68,7 @@ export const INVOICE_COLUMNS = [
51 dataIndex: 'payee', 68 dataIndex: 'payee',
52 valueType: 'text', 69 valueType: 'text',
53 width: 180, 70 width: 180,
  71 + valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
54 }, 72 },
55 { 73 {
56 title: '联系人', 74 title: '联系人',
@@ -73,14 +91,34 @@ export const INVOICE_COLUMNS = [ @@ -73,14 +91,34 @@ export const INVOICE_COLUMNS = [
73 { 91 {
74 title: '开票日期', 92 title: '开票日期',
75 dataIndex: 'invoicingTime', 93 dataIndex: 'invoicingTime',
76 - valueType: 'date', 94 + valueType: 'dateRange',
77 width: 150, 95 width: 150,
  96 + search: {
  97 + transform: (value) => {
  98 + if (value) {
  99 + return {
  100 + invoicingBeginTime: value[0],
  101 + invoicingEndTime: value[1],
  102 + };
  103 + }
  104 + },
  105 + },
78 }, 106 },
79 { 107 {
80 title: '收款时间', 108 title: '收款时间',
81 dataIndex: 'collectionTime', 109 dataIndex: 'collectionTime',
82 - valueType: 'dateTime', 110 + valueType: 'dateRange',
83 width: 200, 111 width: 200,
  112 + search: {
  113 + transform: (value) => {
  114 + if (value) {
  115 + return {
  116 + collectionBeginTime: value[0],
  117 + collectionEndTime: value[1],
  118 + };
  119 + }
  120 + },
  121 + },
84 }, 122 },
85 { 123 {
86 title: '备注', 124 title: '备注',
@@ -90,12 +128,6 @@ export const INVOICE_COLUMNS = [ @@ -90,12 +128,6 @@ export const INVOICE_COLUMNS = [
90 }, 128 },
91 ]; 129 ];
92 130
93 -export const INVOICE_STATUS = {  
94 - UNVERIFIED: '未核销',  
95 - VERIFIED: '已核销',  
96 - ABNORMAL: '异常',  
97 -};  
98 -  
99 export const BANK_STATEMENT_COLUMNS = [ 131 export const BANK_STATEMENT_COLUMNS = [
100 { 132 {
101 dataIndex: 'id', 133 dataIndex: 'id',
@@ -109,9 +141,13 @@ export const BANK_STATEMENT_COLUMNS = [ @@ -109,9 +141,13 @@ export const BANK_STATEMENT_COLUMNS = [
109 { 141 {
110 dataIndex: 'status', 142 dataIndex: 'status',
111 title: '状态', 143 title: '状态',
112 - valueType: 'text', 144 + valueType: 'select',
113 width: 100, 145 width: 100,
114 editable: false, 146 editable: false,
  147 + valueEnum: enumToProTableEnumValue({
  148 + ABNORMAL: '异常',
  149 + VERIFIED: '已核销',
  150 + }),
115 }, 151 },
116 { 152 {
117 dataIndex: 'serialNumber', 153 dataIndex: 'serialNumber',
src/pages/Invoice/index.tsx
@@ -70,7 +70,7 @@ const InvoicePage = () =&gt; { @@ -70,7 +70,7 @@ const InvoicePage = () =&gt; {
70 newItem.render = (text, record) => { 70 newItem.render = (text, record) => {
71 let textValue = record[dataIndex]; 71 let textValue = record[dataIndex];
72 72
73 - if (dataType === 'date') { 73 + if (dataType === 'dateRange' || dataType === 'date') {
74 textValue = formatDate(textValue); 74 textValue = formatDate(textValue);
75 } 75 }
76 76
@@ -309,18 +309,7 @@ const InvoicePage = () =&gt; { @@ -309,18 +309,7 @@ const InvoicePage = () =&gt; {
309 listsHeight: 400, 309 listsHeight: 400,
310 }, 310 },
311 }} 311 }}
312 - form={{  
313 - // 由于配置了 transform,提交的参与与定义的不同这里需要转化一下  
314 - syncToUrl: (values, type) => {  
315 - if (type === 'get') {  
316 - return {  
317 - ...values,  
318 - created_at: [values.startTime, values.endTime],  
319 - };  
320 - }  
321 - return values;  
322 - },  
323 - }} 312 + form={{}}
324 dateFormatter="string" 313 dateFormatter="string"
325 headerTitle="发票列表" 314 headerTitle="发票列表"
326 scroll={{ x: 1400, y: 360 }} 315 scroll={{ x: 1400, y: 360 }}
src/pages/Order/components/FinancialMergeDrawer.tsx
1 // import { PlusOutlined } from '@ant-design/icons'; 1 // import { PlusOutlined } from '@ant-design/icons';
2 import { RESPONSE_CODE } from '@/constants/enum'; 2 import { RESPONSE_CODE } from '@/constants/enum';
3 import { postServiceOrderMergeInvoicing } from '@/services'; 3 import { postServiceOrderMergeInvoicing } from '@/services';
  4 +import { enumToSelect } from '@/utils';
4 import { 5 import {
5 DrawerForm, 6 DrawerForm,
6 ProFormDatePicker, 7 ProFormDatePicker,
  8 + ProFormDigit,
7 ProFormSelect, 9 ProFormSelect,
8 ProFormText, 10 ProFormText,
9 ProFormTextArea, 11 ProFormTextArea,
10 } from '@ant-design/pro-components'; 12 } from '@ant-design/pro-components';
11 import { Form, message } from 'antd'; 13 import { Form, message } from 'antd';
  14 +import { PAYEE_OPTIONS } from '../constant';
12 15
13 export default ({ dataList, setVisible, onClose }) => { 16 export default ({ dataList, setVisible, onClose }) => {
14 let mainOrderIds = dataList?.map((item) => { 17 let mainOrderIds = dataList?.map((item) => {
@@ -104,7 +107,30 @@ export default ({ dataList, setVisible, onClose }) =&gt; { @@ -104,7 +107,30 @@ export default ({ dataList, setVisible, onClose }) =&gt; {
104 name="collectMoneyTime" 107 name="collectMoneyTime"
105 label="收款时间" 108 label="收款时间"
106 /> 109 />
  110 + <ProFormText
  111 + width="lg"
  112 + key="invoiceNumber"
  113 + name="invoiceNumber"
  114 + label="发票号码"
  115 + rules={[{ required: true, message: '发票号码必填' }]}
  116 + />
  117 + <ProFormSelect
  118 + key="payee"
  119 + placeholder="选择收款单位"
  120 + name="payee"
  121 + width="lg"
  122 + label="收款单位"
  123 + options={enumToSelect(PAYEE_OPTIONS)}
  124 + rules={[{ required: true, message: '收款单位必填' }]}
  125 + />
107 126
  127 + <ProFormDigit
  128 + key="money"
  129 + name="money"
  130 + width="lg"
  131 + label="金额"
  132 + rules={[{ required: true, message: '金额必填' }]}
  133 + />
108 <ProFormSelect 134 <ProFormSelect
109 placeholder="是否完全开票" 135 placeholder="是否完全开票"
110 name="afterInvoicingStatus" 136 name="afterInvoicingStatus"