Commit 27b7cbf1c5709ddfcab61f575ec8b0886905dcda
1 parent
dabb9fcf
refactor(Invoice): 优化发票相关功能
- 在 Invoice constant.tsx 中添加主订单 ID 字段 - 在 Order/Order/components/InvoicingDrawerForm.tsx 中: - 优化金额计算,使用 FloatMul 替代直接乘法 - 添加单位输入框
Showing
2 changed files
with
21 additions
and
2 deletions
src/pages/Invoice/constant.tsx
@@ -45,6 +45,13 @@ export const INVOICE_COLUMNS = [ | @@ -45,6 +45,13 @@ export const INVOICE_COLUMNS = [ | ||
45 | width: 100, | 45 | width: 100, |
46 | }, | 46 | }, |
47 | { | 47 | { |
48 | + dataIndex: 'mainOrderId', | ||
49 | + title: '主订单id', | ||
50 | + valueType: 'text', | ||
51 | + width: 160, | ||
52 | + hideInTable: true, | ||
53 | + }, | ||
54 | + { | ||
48 | dataIndex: 'invoiceStatus', | 55 | dataIndex: 'invoiceStatus', |
49 | title: '发票类型', | 56 | title: '发票类型', |
50 | valueType: 'select', | 57 | valueType: 'select', |
src/pages/Order/Order/components/InvoicingDrawerForm.tsx
@@ -10,7 +10,13 @@ import { | @@ -10,7 +10,13 @@ import { | ||
10 | postServiceInvoiceQueryCompanyInfo, | 10 | postServiceInvoiceQueryCompanyInfo, |
11 | postServiceInvoiceWaitReissueInvoices, | 11 | postServiceInvoiceWaitReissueInvoices, |
12 | } from '@/services'; | 12 | } from '@/services'; |
13 | -import { FloatAdd, FloatSub, enum2ReverseSelect, enumToSelect } from '@/utils'; | 13 | +import { |
14 | + FloatAdd, | ||
15 | + FloatMul, | ||
16 | + FloatSub, | ||
17 | + enum2ReverseSelect, | ||
18 | + enumToSelect, | ||
19 | +} from '@/utils'; | ||
14 | import { convertCurrency } from '@/utils/numberUtil'; | 20 | import { convertCurrency } from '@/utils/numberUtil'; |
15 | import { | 21 | import { |
16 | DrawerForm, | 22 | DrawerForm, |
@@ -99,7 +105,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { | @@ -99,7 +105,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { | ||
99 | if (invoiceDetails && invoiceDetails[index]) { | 105 | if (invoiceDetails && invoiceDetails[index]) { |
100 | const quantity = invoiceDetails[index].quantity || 0; | 106 | const quantity = invoiceDetails[index].quantity || 0; |
101 | const price = invoiceDetails[index].price || 0; | 107 | const price = invoiceDetails[index].price || 0; |
102 | - const totalPrice = quantity * price; | 108 | + const totalPrice = FloatMul(quantity, price); |
103 | const newInvoiceDetails = [...invoiceDetails]; | 109 | const newInvoiceDetails = [...invoiceDetails]; |
104 | newInvoiceDetails[index] = { ...newInvoiceDetails[index], totalPrice }; | 110 | newInvoiceDetails[index] = { ...newInvoiceDetails[index], totalPrice }; |
105 | form.setFieldsValue({ invoiceDetails: newInvoiceDetails }); | 111 | form.setFieldsValue({ invoiceDetails: newInvoiceDetails }); |
@@ -534,6 +540,12 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { | @@ -534,6 +540,12 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { | ||
534 | ]} | 540 | ]} |
535 | placeholder="请输入名称" | 541 | placeholder="请输入名称" |
536 | /> | 542 | /> |
543 | + <ProFormText | ||
544 | + key={'unit' + listMeta.index} | ||
545 | + name="unit" | ||
546 | + label="单位" | ||
547 | + placeholder="请输入名称" | ||
548 | + /> | ||
537 | <ProFormDigit | 549 | <ProFormDigit |
538 | key={'quantity' + listMeta.index} | 550 | key={'quantity' + listMeta.index} |
539 | label="数量" | 551 | label="数量" |