Commit 27b7cbf1c5709ddfcab61f575ec8b0886905dcda

Authored by 曾国涛
1 parent dabb9fcf

refactor(Invoice): 优化发票相关功能

- 在 Invoice constant.tsx 中添加主订单 ID 字段
- 在 Order/Order/components/InvoicingDrawerForm.tsx 中:
  - 优化金额计算,使用 FloatMul 替代直接乘法
  - 添加单位输入框
src/pages/Invoice/constant.tsx
... ... @@ -45,6 +45,13 @@ export const INVOICE_COLUMNS = [
45 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 55 dataIndex: 'invoiceStatus',
49 56 title: '发票类型',
50 57 valueType: 'select',
... ...
src/pages/Order/Order/components/InvoicingDrawerForm.tsx
... ... @@ -10,7 +10,13 @@ import {
10 10 postServiceInvoiceQueryCompanyInfo,
11 11 postServiceInvoiceWaitReissueInvoices,
12 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 20 import { convertCurrency } from '@/utils/numberUtil';
15 21 import {
16 22 DrawerForm,
... ... @@ -99,7 +105,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => {
99 105 if (invoiceDetails && invoiceDetails[index]) {
100 106 const quantity = invoiceDetails[index].quantity || 0;
101 107 const price = invoiceDetails[index].price || 0;
102   - const totalPrice = quantity * price;
  108 + const totalPrice = FloatMul(quantity, price);
103 109 const newInvoiceDetails = [...invoiceDetails];
104 110 newInvoiceDetails[index] = { ...newInvoiceDetails[index], totalPrice };
105 111 form.setFieldsValue({ invoiceDetails: newInvoiceDetails });
... ... @@ -534,6 +540,12 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => {
534 540 ]}
535 541 placeholder="请输入名称"
536 542 />
  543 + <ProFormText
  544 + key={'unit' + listMeta.index}
  545 + name="unit"
  546 + label="单位"
  547 + placeholder="请输入名称"
  548 + />
537 549 <ProFormDigit
538 550 key={'quantity' + listMeta.index}
539 551 label="数量"
... ...