src/views/salesManagement/salesLedger/index.vue
@@ -568,7 +568,7 @@
                         width="160"
                         align="right">
          <template #default="scope">
            {{ Number(scope.row.totalAmount ?? 0).toFixed(2) }}
            {{ formatDecimal(scope.row.totalAmount) }}
          </template>
        </el-table-column>
        <el-table-column fixed="right"
@@ -666,11 +666,11 @@
          <el-col :span="12">
            <el-form-item label="含税单价(元):"
                          prop="taxInclusiveUnitPrice">
              <el-input-number :step="0.01"
              <el-input-number :step="0.000001"
                               :min="0"
                               v-model="productForm.taxInclusiveUnitPrice"
                               style="width: 100%"
                               :precision="2"
                               :precision="6"
                               placeholder="请输入"
                               clearable
                               @change="calculateFromUnitPrice" />
@@ -1057,6 +1057,11 @@
  import useFormData from "@/hooks/useFormData.js";
  import dayjs from "dayjs";
  import FileUpload from "@/components/AttachmentUpload/file/index.vue";
  import {
    tableAmountFormatter,
    formatDecimal,
    buildAmountSummaryFormat,
  } from "@/utils/numberFormat";
  import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
  import { getCurrentDate } from "@/utils/index.js";
  import { listCustomer } from "@/api/basicData/customer.js";
@@ -1401,12 +1406,7 @@
      return productOptions.value;
    });
  };
  const formattedNumber = (row, column, cellValue) => {
    if (cellValue === undefined || cellValue === null || cellValue === "") {
      return "0.00";
    }
    return parseFloat(cellValue).toFixed(2);
  };
  const formattedNumber = tableAmountFormatter;
  const findLedgerRecordByRow = row => {
    if (!row) return null;
    if (
@@ -1569,11 +1569,15 @@
  };
  // 主表合计方法
  const summarizeMainTable = param => {
    return proxy.summarizeTable(param, [
      "contractAmount",
      "taxInclusiveTotalPrice",
      "taxExclusiveTotalPrice",
    ]);
    return proxy.summarizeTable(
      param,
      ["contractAmount", "taxInclusiveTotalPrice", "taxExclusiveTotalPrice"],
      buildAmountSummaryFormat([
        "contractAmount",
        "taxInclusiveTotalPrice",
        "taxExclusiveTotalPrice",
      ])
    );
  };
  // 子表合计方法
  const summarizeChildrenTable = (param, parentRow) => {
@@ -1595,11 +1599,19 @@
        return "";
      });
    }
    return proxy.summarizeTable(param, [
      "taxInclusiveUnitPrice",
      "taxInclusiveTotalPrice",
      "taxExclusiveTotalPrice",
    ]);
    return proxy.summarizeTable(
      param,
      [
        "taxInclusiveUnitPrice",
        "taxInclusiveTotalPrice",
        "taxExclusiveTotalPrice",
      ],
      buildAmountSummaryFormat([
        "taxInclusiveUnitPrice",
        "taxInclusiveTotalPrice",
        "taxExclusiveTotalPrice",
      ])
    );
  };
  // 打开弹框
  const openForm = async (type, row) => {
@@ -1727,7 +1739,7 @@
      const quantity = Number(p.quantity ?? 0) || 0;
      const unitPrice = Number(p.unitPrice ?? 0) || 0;
      const taxRate = "13"; // 默认 13%,便于直接提交(如需可在产品中自行修改)
      const taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
      const taxInclusiveTotalPrice = formatDecimal(unitPrice * quantity);
      const taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(
        taxInclusiveTotalPrice,
        taxRate
@@ -1739,7 +1751,7 @@
        unit: p.unit || "",
        quantity: quantity,
        taxRate: taxRate,
        taxInclusiveUnitPrice: unitPrice.toFixed(2),
        taxInclusiveUnitPrice: formatDecimal(unitPrice),
        taxInclusiveTotalPrice: taxInclusiveTotalPrice,
        taxExclusiveTotalPrice: taxExclusiveTotalPrice,
        invoiceType: "增普票",
@@ -2413,7 +2425,7 @@
    const total = products.reduce((sum, product) => {
      return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
    }, 0);
    return total.toFixed(2);
    return formatDecimal(total);
  };
  // 用于打印的计算函数
@@ -2430,7 +2442,7 @@
    const total = products.reduce((sum, product) => {
      return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
    }, 0);
    return total.toFixed(2);
    return formatDecimal(total);
  };
  const mathNum = () => {
@@ -2471,7 +2483,7 @@
    isCalculating.value = true;
    // 计算含税单价 = 含税总价 / 数量
    productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
    productForm.value.taxInclusiveUnitPrice = formatDecimal(totalPrice / quantity);
    // 如果有税率,计算不含税总价
    if (productForm.value.taxRate) {
@@ -2508,12 +2520,12 @@
    // 先计算含税总价 = 不含税总价 / (1 - 税率/100)
    const taxRateDecimal = taxRate / 100;
    const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
    productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
    productForm.value.taxInclusiveTotalPrice = formatDecimal(inclusiveTotalPrice);
    // 计算含税单价 = 含税总价 / 数量
    productForm.value.taxInclusiveUnitPrice = (
    productForm.value.taxInclusiveUnitPrice = formatDecimal(
      inclusiveTotalPrice / quantity
    ).toFixed(2);
    );
    isCalculating.value = false;
  };
@@ -2536,7 +2548,7 @@
    isCalculating.value = true;
    // 计算含税总价
    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
    productForm.value.taxInclusiveTotalPrice = formatDecimal(unitPrice * quantity);
    // 如果有税率,计算不含税总价
    if (productForm.value.taxRate) {
@@ -2568,7 +2580,7 @@
    isCalculating.value = true;
    // 计算含税总价
    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
    productForm.value.taxInclusiveTotalPrice = formatDecimal(unitPrice * quantity);
    // 如果有税率,计算不含税总价
    if (productForm.value.taxRate) {