From 44082fd492b8c8a613b203be1c45771abe246d1b Mon Sep 17 00:00:00 2001 From: XuYong <583339461@qq.com> Date: Tue, 29 Jul 2025 14:01:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=A5=A8=E6=81=A9=E6=9B=BF=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/subpages/trade/invoice.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/subpages/trade/invoice.js b/src/subpages/trade/invoice.js index 799137206..e50b4b215 100644 --- a/src/subpages/trade/invoice.js +++ b/src/subpages/trade/invoice.js @@ -15,6 +15,7 @@ const initialState = { invoice_type_code: '02', // 01:数电票(增值税专用发票) 02:数电票(普通发票) invoice_type: 'individual', // individual:个人 enterprise:企业 company_title: '', // 抬头名称 + individual_title: '', // 个人抬头 company_tax_number: '', // 公司税号 company_address: '', // 公司地址 company_telephone: '', // 公司电话 @@ -63,10 +64,11 @@ function Invoice(props) { const params = Taro.getStorageSync('invoice_params') console.log('params:', params) if (params && Object.keys(params).length > 0) { - const invoiceParams = { + let invoiceParams = { invoice_type_code: params?.invoice_type_code || '02', invoice_type: params?.invoice_type || 'individual', - company_title: params?.company_title || '', + company_title: params?.invoice_type == 'enterprise' ? params?.company_title : '', + individual_title: params?.invoice_type != 'enterprise' ? params?.company_title : '', company_tax_number: params?.company_tax_number || '', company_address: params?.company_address || '', company_telephone: params?.company_telephone || '', @@ -74,6 +76,7 @@ function Invoice(props) { bank_account: params?.bank_account || '', email: params?.email || '' } + setState((draft) => { draft.info = invoiceParams }) @@ -106,12 +109,13 @@ function Invoice(props) { let nInfo = { invoice_type: type == 0 ? 'enterprise' : 'individual', invoice_type_code: info.invoice_type_code, - company_title: title, email: info?.email } if (type == 0) { nInfo = { ...nInfo, + company_title: title, + individual_title: info?.individual_title, company_tax_number: taxNumber, company_address: companyAddress, company_telephone: telephone, @@ -121,6 +125,8 @@ function Invoice(props) { } else { nInfo = { ...nInfo, + company_title: info?.company_title, + individual_title: title, invoice_type_code: '02' } } @@ -146,7 +152,8 @@ function Invoice(props) { let params = { invoice_type_code: info?.invoice_type_code, invoice_type: info?.invoice_type, - company_title: info?.company_title, + company_title: + info?.invoice_type == 'enterprise' ? info?.company_title : info.individual_title, email: info?.email } if (params.invoice_type === 'enterprise') { @@ -197,7 +204,7 @@ function Invoice(props) { const isFull = () => { if (info?.invoice_type === 'individual') { - return info?.company_title && info?.email + return info?.individual_title && info?.email } else if (info?.invoice_type === 'enterprise') { return info?.company_title && info?.company_tax_number && info?.email } @@ -321,11 +328,11 @@ function Invoice(props) { {info?.invoice_type === 'individual' && ( handleChange('company_title', e)} + onChange={(e) => handleChange('individual_title', e)} /> )}