修复了extraInfo,待实现提交返回逻辑
parent
6f089a08d8
commit
e005d48d56
|
@ -95,8 +95,7 @@ export class InvoiceCommit {
|
||||||
invoiceCheckCode:string
|
invoiceCheckCode:string
|
||||||
invoiceRegionCode: Nullable<string>
|
invoiceRegionCode: Nullable<string>
|
||||||
invoiceSellerTaxCode:Nullable<string>
|
invoiceSellerTaxCode:Nullable<string>
|
||||||
|
invoiceExtraInfo:Nullable<string>|[]
|
||||||
invoiceExtraInfo: []
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.invoiceFileName = ""
|
this.invoiceFileName = ""
|
||||||
this.invoiceNo = ""
|
this.invoiceNo = ""
|
||||||
|
@ -108,7 +107,7 @@ export class InvoiceCommit {
|
||||||
this.invoiceCheckCode = "000000"
|
this.invoiceCheckCode = "000000"
|
||||||
this.invoiceRegionCode = null
|
this.invoiceRegionCode = null
|
||||||
this.invoiceSellerTaxCode = null
|
this.invoiceSellerTaxCode = null
|
||||||
this.invoiceExtraInfo = []
|
this.invoiceExtraInfo = null
|
||||||
}
|
}
|
||||||
setValue(props: FormData) {
|
setValue(props: FormData) {
|
||||||
console.log("1111"+props.toString())
|
console.log("1111"+props.toString())
|
||||||
|
|
|
@ -90,7 +90,7 @@ class InvoiceUploadView extends React.Component<any, any>{
|
||||||
let data= new FormData();
|
let data= new FormData();
|
||||||
data.append('invoiceFile',tempFile)
|
data.append('invoiceFile',tempFile)
|
||||||
axiosInstance({
|
axiosInstance({
|
||||||
url: '/invoice/identify',//123131',//FIXME
|
url: 'common/invoice/identify',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: data
|
data: data
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
|
@ -103,7 +103,10 @@ class InvoiceUploadView extends React.Component<any, any>{
|
||||||
result.invoiceCheckCode = response.data.invoiceCheckCode
|
result.invoiceCheckCode = response.data.invoiceCheckCode
|
||||||
result.invoiceKind = response.data.invoiceKind
|
result.invoiceKind = response.data.invoiceKind
|
||||||
result.invoiceFileName = response.data.invoiceFileName
|
result.invoiceFileName = response.data.invoiceFileName
|
||||||
result.invoiceExtraInfo = response.data.invoiceExtraInfo.toString()
|
result.invoiceExtraInfo = ""
|
||||||
|
for(let i=0;i<response.data.invoiceExtraInfo.length;i++){
|
||||||
|
result.invoiceExtraInfo+=(response.data.invoiceExtraInfo[i].name+": "+response.data.invoiceExtraInfo[i].value+"\n")
|
||||||
|
}
|
||||||
this.setState({invoiceCommit:result})
|
this.setState({invoiceCommit:result})
|
||||||
this.formRef.current!.setFieldsValue(result);
|
this.formRef.current!.setFieldsValue(result);
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
@ -128,6 +131,27 @@ class InvoiceUploadView extends React.Component<any, any>{
|
||||||
this.setOpen(false);
|
this.setOpen(false);
|
||||||
};
|
};
|
||||||
submit=()=>{
|
submit=()=>{
|
||||||
|
let result=this.formRef.current!.getFieldsValue()
|
||||||
|
result.invoiceDate=result.invoiceDate.format("YYYY-MM-DD")
|
||||||
|
let extraInfo=[]
|
||||||
|
let line = result.invoiceExtraInfo.split('\n')
|
||||||
|
for(let i=0;i<line.length;i++){
|
||||||
|
let tmp = line[i].split(": ")
|
||||||
|
if(tmp.length===2){
|
||||||
|
extraInfo.push({name:tmp[0],value:tmp[1]})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.invoiceExtraInfo=extraInfo
|
||||||
|
axiosInstance({
|
||||||
|
url: 'common/invoice/submit',
|
||||||
|
method: 'POST',
|
||||||
|
data: result
|
||||||
|
}).then(response => {
|
||||||
|
//TODO
|
||||||
|
console.log(response.data)
|
||||||
|
}).catch(function (error) {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
|
@ -200,12 +224,12 @@ class InvoiceUploadView extends React.Component<any, any>{
|
||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
{/*<Form.Item*/}
|
||||||
name={`invoiceAmountWithoutTax`}
|
{/* name={`invoiceAmountWithoutTax`}*/}
|
||||||
label={`非税金额`}
|
{/* label={`非税金额`}*/}
|
||||||
>
|
{/*>*/}
|
||||||
<Input/>
|
{/* <Input/>*/}
|
||||||
</Form.Item>
|
{/*</Form.Item>*/}
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={`invoiceDate`}
|
name={`invoiceDate`}
|
||||||
label={`开票日期`}
|
label={`开票日期`}
|
||||||
|
|
Loading…
Reference in New Issue