fix: 报价、审核、采购台账、供应商往来、销售台账、客户往来小数点保留6位小数
已添加1个文件
已修改9个文件
317 ■■■■■ 文件已修改
src/utils/numberFormat.js 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/summarizeTable.js 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/paymentLedger/index.vue 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/detail.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/index.vue 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementReport/index.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/receiptPaymentLedger/index.vue 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesQuotation/index.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/numberFormat.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
/** é‡‘额类字段默认最大小数位数 */
export const AMOUNT_DECIMAL_SCALE = 6
/**
 * æ ¼å¼åŒ–数字:最多保留 scale ä½å°æ•°ï¼Œå¹¶åŽ»é™¤æœ«å°¾å¤šä½™çš„ 0
 */
export function formatDecimal(value, scale = AMOUNT_DECIMAL_SCALE, fallback = '0') {
  if (value === null || value === undefined || value === '') {
    return fallback
  }
  const num = Number(value)
  if (Number.isNaN(num)) {
    return fallback
  }
  return parseFloat(num.toFixed(scale)).toString()
}
/** å¸¦è´§å¸ç¬¦å·çš„金额展示 */
export function formatCurrency(value, scale = AMOUNT_DECIMAL_SCALE) {
  return `Â¥${formatDecimal(value, scale)}`
}
/** el-table-column formatter */
export function tableAmountFormatter(row, column, cellValue) {
  return formatDecimal(cellValue)
}
/** è®¡ç®—后保留指定位小数 */
export function roundAmount(value, scale = AMOUNT_DECIMAL_SCALE) {
  if (value === null || value === undefined || value === '') {
    return 0
  }
  const num = Number(value)
  if (Number.isNaN(num)) {
    return 0
  }
  return parseFloat(num.toFixed(scale))
}
/** æž„建 summarizeTable é‡‘额列格式配置 */
export function buildAmountSummaryFormat(fields, extraFormat = {}) {
  const format = { ...extraFormat }
  fields.forEach(field => {
    format[field] = { decimalPlaces: AMOUNT_DECIMAL_SCALE }
  })
  return format
}
src/utils/summarizeTable.js
@@ -1,3 +1,5 @@
import { formatDecimal, AMOUNT_DECIMAL_SCALE } from './numberFormat'
/**
 * é€šç”¨çš„表格合计方法
 * @param {Object} param - åŒ…含表格列配置和数据源的对象
@@ -26,28 +28,35 @@
          // å¦‚果指定了不需要保留小数,则直接转换为整数
          sums[index] = Math.round(sum).toString();
        } else {
          // é»˜è®¤ä¿ç•™ä¸¤ä½å°æ•°
          sums[index] = parseFloat(sum).toFixed(
          sums[index] = formatDecimal(
            sum,
            specialFormat[prop]?.decimalPlaces ?? 2
          );
        }
      } else {
        sums[index] = "";
        sums[index] = '';
      }
    } else {
      sums[index] = "";
      sums[index] = '';
    }
  });
  return sums;
};
// ä¸å«ç¨Žæ€»ä»·è®¡ç®—
const calculateTaxExclusiveTotalPrice = (taxInclusiveTotalPrice, taxRate) => {
  const taxRateDecimal = taxRate / 100;
  return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(2);
  return formatDecimal(
    Number(taxInclusiveTotalPrice) / (1 + taxRateDecimal),
    AMOUNT_DECIMAL_SCALE
  );
};
// å«ç¨Žæ€»ä»·è®¡ç®—
const calculateTaxIncludeTotalPrice = (taxInclusiveUnitPrice, quantity) => {
  return (taxInclusiveUnitPrice * quantity).toFixed(2);
  return formatDecimal(
    Number(taxInclusiveUnitPrice) * Number(quantity),
    AMOUNT_DECIMAL_SCALE
  );
};
// å¯¼å‡ºå‡½æ•°ä¾›å…¶ä»–文件使用
export {
src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
@@ -75,7 +75,7 @@
                <el-descriptions-item label="报价总额"
                                      :span="2">
                  <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
                    Â¥{{ Number(currentQuotation.totalAmount ?? 0).toFixed(2) }}
                    {{ formatCurrency(currentQuotation.totalAmount) }}
                  </span>
                </el-descriptions-item>
              </el-descriptions>
@@ -92,7 +92,7 @@
                                   label="单位" />
                  <el-table-column prop="unitPrice"
                                   label="单价">
                    <template #default="scope">Â¥{{ Number(scope.row.unitPrice ?? 0).toFixed(2) }}</template>
                    <template #default="scope">{{ formatCurrency(scope.row.unitPrice) }}</template>
                  </el-table-column>
                </el-table>
              </div>
@@ -135,7 +135,7 @@
                <el-descriptions-item label="合同金额"
                                      :span="2">
                  <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
                    Â¥{{ Number(currentPurchase.contractAmount ?? 0).toFixed(2) }}
                    {{ formatCurrency(currentPurchase.contractAmount) }}
                  </span>
                </el-descriptions-item>
              </el-descriptions>
@@ -154,11 +154,11 @@
                                   label="数量" />
                  <el-table-column prop="taxInclusiveUnitPrice"
                                   label="含税单价">
                    <template #default="scope">Â¥{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(2) }}</template>
                    <template #default="scope">{{ formatCurrency(scope.row.taxInclusiveUnitPrice) }}</template>
                  </el-table-column>
                  <el-table-column prop="taxInclusiveTotalPrice"
                                   label="含税总价">
                    <template #default="scope">Â¥{{ Number(scope.row.taxInclusiveTotalPrice ?? 0).toFixed(2) }}</template>
                    <template #default="scope">{{ formatCurrency(scope.row.taxInclusiveTotalPrice) }}</template>
                  </el-table-column>
                </el-table>
              </div>
@@ -332,6 +332,7 @@
  import { getPurchaseByCode } from "@/api/procurementManagement/procurementLedger.js";
  import { getDeliveryDetailByShippingNo } from "@/api/salesManagement/deliveryLedger.js";
  import ImagePreview from "@/components/AttachmentPreview/image/index.vue";
  import { formatCurrency } from "@/utils/numberFormat";
  const emit = defineEmits(["close"]);
  const { proxy } = getCurrentInstance();
src/views/procurementManagement/paymentLedger/index.vue
@@ -79,7 +79,7 @@
                    @pagination="sonPaginationSearch">
            <template #payableAmountSlot="{ row }">
              <el-text type="danger">
                {{ parseFloat(row.unshippedAmount).toFixed(2) }}
                {{ formatDecimal(row.unshippedAmount) }}
              </el-text>
            </template>
          </PIMTable>
@@ -90,13 +90,14 @@
</template>
<script setup>
  import { ref, toRefs } from "vue";
  import { ref, toRefs, reactive, getCurrentInstance } from "vue";
  import { Search } from "@element-plus/icons-vue";
  import {
    paymentLedgerList,
    paymentRecordList,
  } from "@/api/procurementManagement/paymentLedger.js";
  import Pagination from "../../../components/PIMTable/Pagination.vue";
  import { tableAmountFormatter, formatDecimal, buildAmountSummaryFormat } from "@/utils/numberFormat";
  const tableData = ref([]);
  const tableLoading = ref(false);
@@ -140,17 +141,13 @@
      label: "合同金额(元)",
      prop: "contractAmount",
      width: 200,
      formatData: params => {
        return params ? parseFloat(params).toFixed(2) : 0;
      },
      formatData: params => formatDecimal(params),
    },
    {
      label: "已入库金额(元)",
      prop: "shippedAmount",
      width: 200,
      formatData: params => {
        return params ? parseFloat(params).toFixed(2) : 0;
      },
      formatData: params => formatDecimal(params),
    },
    {
      label: "未入库金额(元)",
@@ -171,10 +168,13 @@
    return proxy.summarizeTable(
      param,
      ["contractAmounts", "shippedAmount", "unshippedAmount"],
      {
        ticketsNum: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
        futureTickets: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
      }
      buildAmountSummaryFormat(
        ["contractAmounts", "shippedAmount", "unshippedAmount"],
        {
          ticketsNum: { noDecimal: true },
          futureTickets: { noDecimal: true },
        }
      )
    );
  };
  // å­è¡¨åˆè®¡æ–¹æ³•
@@ -182,10 +182,13 @@
    let summarizeTable = proxy.summarizeTable(
      param,
      ["contractAmount", "shippedAmount", "unshippedAmount"],
      {
        ticketsNum: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
        futureTickets: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
      }
      buildAmountSummaryFormat(
        ["contractAmount", "shippedAmount", "unshippedAmount"],
        {
          ticketsNum: { noDecimal: true },
          futureTickets: { noDecimal: true },
        }
      )
    );
    return summarizeTable;
  };
@@ -257,13 +260,7 @@
    sonPage.size = pagination.limit;
    getPaymenRecordtList(currentSupplierId.value);
  };
  const formattedNumber = (row, column, cellValue) => {
    if (column.property !== "supplierName") {
      return parseFloat(cellValue).toFixed(2);
    } else {
      return cellValue;
    }
  };
  const formattedNumber = tableAmountFormatter;
  getList();
</script>
src/views/procurementManagement/procurementLedger/detail.vue
@@ -127,6 +127,7 @@
import FormDialog from "@/components/Dialog/FormDialog.vue"
import filePreview from '@/components/filePreview/index.vue'
import { getPurchaseById } from "@/api/procurementManagement/procurementLedger"
import { tableAmountFormatter } from '@/utils/numberFormat'
const visible = ref(false)
// æ˜¯å¦æ˜¾ç¤ºé”€å”®åˆåŒå·ç»‘定
@@ -157,12 +158,7 @@
  fileList.value = []
}
const formattedNumber = (row, column, cellValue) => {
  if (cellValue != null && !isNaN(cellValue)) {
    return Number(cellValue).toFixed(2)
  }
  return cellValue
}
const formattedNumber = tableAmountFormatter
const sumTaxInclusiveUnitPrice = computed(() => {
  return productData.value.reduce((sum, item) => {
src/views/procurementManagement/procurementLedger/index.vue
@@ -310,7 +310,7 @@
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税单价(元):" prop="taxInclusiveUnitPrice">
              <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="2" :step="0.1" :min="0" clearable
              <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="6" :step="0.000001" :min="0" clearable
                style="width: 100%" @change="mathNum" />
            </el-form-item>
          </el-col>
@@ -324,13 +324,13 @@
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税总价(元):" prop="taxInclusiveTotalPrice">
              <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="2" :step="0.1" :min="0"
              <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="6" :step="0.000001" :min="0"
                clearable style="width: 100%" @change="reverseMathNum('taxInclusiveTotalPrice')" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="不含税总价(元):" prop="taxExclusiveTotalPrice">
              <el-input-number v-model="productForm.taxExclusiveTotalPrice" :precision="2" :step="0.1" :min="0"
              <el-input-number v-model="productForm.taxExclusiveTotalPrice" :precision="6" :step="0.000001" :min="0"
                clearable style="width: 100%" @change="reverseMathNum('taxExclusiveTotalPrice')" />
            </el-form-item>
          </el-col>
@@ -445,6 +445,7 @@
import { modelList, productTreeList } from "@/api/basicData/product.js";
import dayjs from "dayjs";
import FileUpload from "@/components/AttachmentUpload/file/index.vue";
import { tableAmountFormatter, formatDecimal, buildAmountSummaryFormat } from '@/utils/numberFormat';
const userStore = useUserStore();
@@ -771,9 +772,7 @@
  handleQuery();
};
const formattedNumber = (row, column, cellValue) => {
  return parseFloat(cellValue).toFixed(2);
};
const formattedNumber = tableAmountFormatter;
// æŸ¥è¯¢åˆ—表
/** æœç´¢æŒ‰é’®æ“ä½œ */
const handleQuery = () => {
@@ -891,10 +890,19 @@
      "futureTickets",
      "futureTicketsAmount",
    ],
    {
      ticketsNum: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
      futureTickets: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
    }
    buildAmountSummaryFormat(
      [
        "taxInclusiveUnitPrice",
        "taxInclusiveTotalPrice",
        "taxExclusiveTotalPrice",
        "ticketsAmount",
        "futureTicketsAmount",
      ],
      {
        ticketsNum: { noDecimal: true },
        futureTickets: { noDecimal: true },
      }
    )
  );
};
const paginationChange = obj => {
@@ -957,15 +965,27 @@
};
// ä¸»è¡¨åˆè®¡æ–¹æ³•
const summarizeMainTable = param => {
  return proxy.summarizeTable(param, ["contractAmount"]);
  return proxy.summarizeTable(
    param,
    ["contractAmount"],
    buildAmountSummaryFormat(["contractAmount"])
  );
};
// å­è¡¨åˆè®¡æ–¹æ³•
const summarizeProTable = param => {
  return proxy.summarizeTable(param, [
    "taxInclusiveUnitPrice",
    "taxInclusiveTotalPrice",
    "taxExclusiveTotalPrice",
  ]);
  return proxy.summarizeTable(
    param,
    [
      "taxInclusiveUnitPrice",
      "taxInclusiveTotalPrice",
      "taxExclusiveTotalPrice",
    ],
    buildAmountSummaryFormat([
      "taxInclusiveUnitPrice",
      "taxInclusiveTotalPrice",
      "taxExclusiveTotalPrice",
    ])
  );
};
// æ‰“开弹框
const openForm = async (type, row) => {
@@ -1474,10 +1494,10 @@
  if (field === "taxInclusiveTotalPrice") {
    // å·²çŸ¥å«ç¨Žæ€»ä»·å’Œæ•°é‡ï¼Œåç®—含税单价
    if (productForm.value.quantity) {
      productForm.value.taxInclusiveUnitPrice = (
      productForm.value.taxInclusiveUnitPrice = formatDecimal(
        Number(productForm.value.taxInclusiveTotalPrice) /
        Number(productForm.value.quantity)
      ).toFixed(2);
      );
      // ç¡®ä¿ç»“果不为负数
      if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
        productForm.value.taxInclusiveUnitPrice = "0";
@@ -1495,30 +1515,30 @@
      }
    }
    // åç®—不含税总价
    productForm.value.taxExclusiveTotalPrice = (
    productForm.value.taxExclusiveTotalPrice = formatDecimal(
      Number(productForm.value.taxInclusiveTotalPrice) /
      (1 + taxRate / 100)
    ).toFixed(2);
    );
    // ç¡®ä¿ç»“果不为负数
    if (Number(productForm.value.taxExclusiveTotalPrice) < 0) {
      productForm.value.taxExclusiveTotalPrice = "0";
    }
  } else if (field === "taxExclusiveTotalPrice") {
    // åç®—含税总价
    productForm.value.taxInclusiveTotalPrice = (
    productForm.value.taxInclusiveTotalPrice = formatDecimal(
      Number(productForm.value.taxExclusiveTotalPrice) *
      (1 + taxRate / 100)
    ).toFixed(2);
    );
    // ç¡®ä¿ç»“果不为负数
    if (Number(productForm.value.taxInclusiveTotalPrice) < 0) {
      productForm.value.taxInclusiveTotalPrice = "0";
    }
    // å·²çŸ¥æ•°é‡ï¼Œåç®—含税单价
    if (productForm.value.quantity) {
      productForm.value.taxInclusiveUnitPrice = (
      productForm.value.taxInclusiveUnitPrice = formatDecimal(
        Number(productForm.value.taxInclusiveTotalPrice) /
        Number(productForm.value.quantity)
      ).toFixed(2);
      );
      // ç¡®ä¿ç»“果不为负数
      if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
        productForm.value.taxInclusiveUnitPrice = "0";
src/views/procurementManagement/procurementReport/index.vue
@@ -83,6 +83,7 @@
import PIMTable from '@/components/PIMTable/PIMTable.vue'
import { procurementBusinessSummaryListPage } from '@/api/procurementManagement/procurementReport'
import { productTreeList } from '@/api/basicData/product'
import { formatDecimal, formatCurrency } from '@/utils/numberFormat'
const { proxy } = getCurrentInstance()
@@ -135,14 +136,14 @@
    prop: 'returnAmount',
    width: 120,
    formatData: (val) => {
      return val ? `Â¥${parseFloat(val).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : 'Â¥0.00'
      return val ? formatCurrency(val) : 'Â¥0'
    }
  },
  {
    label: '退款储量',
    prop: 'purchaseAmount',
    formatData: (val) => {
      return val ? `Â¥${parseFloat(val).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : 'Â¥0.00'
      return val ? formatCurrency(val) : 'Â¥0'
    }
  },
  {
@@ -155,7 +156,7 @@
    prop: 'averagePrice',
    width: 120,
    formatData: (val) => {
      return val ? `Â¥${parseFloat(val).toFixed(2)}` : 'Â¥0.00'
      return val ? formatCurrency(val) : 'Â¥0'
    }
  },
  {
src/views/salesManagement/receiptPaymentLedger/index.vue
@@ -126,6 +126,7 @@
    customewTransactionsDetails,
  } from "@/api/salesManagement/indicatorStats.js";
  import Pagination from "../../../components/PIMTable/Pagination.vue";
  import { tableAmountFormatter, buildAmountSummaryFormat } from "@/utils/numberFormat";
  const { proxy } = getCurrentInstance();
  const tableData = ref([]);
  const receiptRecord = ref([]);
@@ -173,18 +174,19 @@
      }
    });
  };
  const formattedNumber = (row, column, cellValue) => {
    return cellValue ? parseFloat(cellValue).toFixed(2) : "0.00";
  };
  const formattedNumber = tableAmountFormatter;
  // ä¸»è¡¨åˆè®¡æ–¹æ³•
  const summarizeMainTable = param => {
    return proxy.summarizeTable(
      param,
      ["contractAmounts", "shippedAmount", "unshippedAmount"],
      {
        ticketsNum: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
        futureTickets: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
      }
      buildAmountSummaryFormat(
        ["contractAmounts", "shippedAmount", "unshippedAmount"],
        {
          ticketsNum: { noDecimal: true },
          futureTickets: { noDecimal: true },
        }
      )
    );
  };
  // å­è¡¨åˆè®¡æ–¹æ³•
@@ -192,10 +194,13 @@
    var summarizeTable = proxy.summarizeTable(
      param,
      ["contractAmount", "shippedAmount", "unshippedAmount"],
      {
        ticketsNum: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
        futureTickets: { noDecimal: true }, // ä¸ä¿ç•™å°æ•°
      }
      buildAmountSummaryFormat(
        ["contractAmount", "shippedAmount", "unshippedAmount"],
        {
          ticketsNum: { noDecimal: true },
          futureTickets: { noDecimal: true },
        }
      )
    );
    return summarizeTable;
  };
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) {
src/views/salesManagement/salesQuotation/index.vue
@@ -65,7 +65,7 @@
        </el-table-column>
        <el-table-column prop="totalAmount" label="报价金额" width="120">
          <template #default="scope">
            Â¥{{ scope.row.totalAmount.toFixed(2) }}
            Â¥{{ formatDecimal(scope.row.totalAmount) }}
          </template>
        </el-table-column>
        <el-table-column label="操作" width="200" fixed="right" align="center">
@@ -215,7 +215,7 @@
            <el-table-column prop="unitPrice" label="单价">
              <template #default="scope">
                <el-form-item :prop="`products.${scope.$index}.unitPrice`" class="product-table-form-item">
                  <el-input-number v-model="scope.row.unitPrice" :min="0" :precision="2" style="width: 100%" />
                  <el-input-number v-model="scope.row.unitPrice" :min="0" :precision="6" :step="0.000001" style="width: 100%" />
                </el-form-item>
              </template>
            </el-table-column>
@@ -267,7 +267,7 @@
<!--          <el-tag :type="getStatusType(currentQuotation.status)">{{ currentQuotation.status }}</el-tag>-->
<!--        </el-descriptions-item>-->
        <el-descriptions-item label="报价总额" :span="2">
          <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">Â¥{{ currentQuotation.totalAmount?.toFixed(2) }}</span>
          <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">Â¥{{ formatDecimal(currentQuotation.totalAmount) }}</span>
        </el-descriptions-item>
      </el-descriptions>
@@ -279,7 +279,7 @@
          <el-table-column prop="unit" label="单位" />
          <el-table-column prop="unitPrice" label="单价">
            <template #default="scope">
              Â¥{{ scope.row.unitPrice.toFixed(2) }}
              Â¥{{ formatDecimal(scope.row.unitPrice) }}
            </template>
          </el-table-column>
        </el-table>
@@ -303,6 +303,7 @@
import {modelList, productTreeList} from "@/api/basicData/product.js";
import {listCustomer} from "@/api/basicData/customer.js";
import { userListNoPage } from "@/api/system/user.js";
import { formatDecimal, roundAmount } from '@/utils/numberFormat';
// å“åº”式数据
const loading = ref(false)
@@ -686,11 +687,11 @@
        return
      }
      // è®¡ç®—所有产品的单价总和
      form.totalAmount = form.products.reduce((sum, product) => {
      // è®¡ç®—所有产品的单价总和,保留六位小数
      form.totalAmount = roundAmount(form.products.reduce((sum, product) => {
        const price = Number(product.unitPrice) || 0
        return sum + price
      }, 0)
      }, 0))
      form.customer = customerOption.value.find(item => item.id === form.customerId)?.customerName || ''
      if (isEdit.value) {