gaoluyang
2025-12-09 b02cd77eb78d973c1eb11ebf03d7d5d71b02aa65
src/views/salesManagement/invoiceRegistration/index.vue
@@ -36,15 +36,18 @@
        <el-form-item>
          <el-button type="primary" @click="handleQuery"> 搜索 </el-button>
          <el-button @click="resetForm"> 重置 </el-button>
          <el-button @click="handleExport" style="margin-right: 10px">导出</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="table_list">
      <div class="flex justify-between">
        <div></div>
        <div>
        <el-button type="primary" @click="openForm" style="margin-bottom: 8px">
          新增登记
        </el-button>
        </div>
      </div>
      <el-table
        :data="tableData"
@@ -319,7 +322,6 @@
          <el-table-column label="本次开票数" prop="currentInvoiceNum" width="180">
            <template #default="scope">
              <el-input-number :step="0.1" :min="0" style="width: 100%"
                                              :precision="2"
                v-model="scope.row.currentInvoiceNum"
                @change="invoiceNumBlur(scope.row)"
              ></el-input-number>
@@ -332,7 +334,6 @@
          >
            <template #default="scope">
              <el-input-number :step="0.01" :min="0" style="width: 100%"
                                              :precision="2"
                v-model="scope.row.currentInvoiceAmount"
                @change="invoiceAmountBlur(scope.row)"
              ></el-input-number>
@@ -360,7 +361,6 @@
                disabled
                v-model="scope.row.noInvoiceAmount"
                :formatter="formattedInputNumber"
                :precision="2"
                :step="0.01"
              ></el-input>
            </template>
@@ -463,17 +463,17 @@
const formattedNumber = (row, column, cellValue) => {
  if (cellValue == 0) {
    return parseFloat(cellValue).toFixed(2);
    return parseFloat(cellValue).toFixed(5);
  }
  if (cellValue) {
    return parseFloat(cellValue).toFixed(2);
    return parseFloat(cellValue).toFixed(5);
  } else {
    return cellValue;
  }
};
const formattedInputNumber = (value) => {
  return value ? parseFloat(value).toFixed(2) : 0;
  return value ? parseFloat(value).toFixed(5) : 0;
};
// 查询列表
@@ -599,11 +599,27 @@
    });
};
// 导出销售台账
const handleExport = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      proxy.download("/sales/ledger/exportOne", { ...searchForm, ...page }, "开票登记.xlsx");
    })
    .catch(() => {
      proxy.$modal.msg("已取消");
    });
};
//本次开票失焦操作
const invoiceNumBlur = (row) => {
  if (!row.currentInvoiceNum) {
    row.currentInvoiceNum = 0;
  }
   row.currentInvoiceNum =  row.currentInvoiceNum.toFixed(5);
  if (row.currentInvoiceNum > row.tempNoInvoiceNum) {
    proxy.$modal.msgWarning("本次开票数不得大于未开票数");
    row.currentInvoiceNum = 0;
@@ -611,21 +627,22 @@
  // 计算本次开票金额
  row.currentInvoiceAmount = (
    row.currentInvoiceNum * row.taxInclusiveUnitPrice
  ).toFixed(2);
  ).toFixed(5);
  // 计算未开票数
  row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed(
    2
    5
  );
  // 计算未开票金额
  row.noInvoiceAmount = (
    row.tempnoInvoiceAmount - row.currentInvoiceAmount
  ).toFixed(2);
  ).toFixed(5);
};
// 本次开票金额失焦操作
const invoiceAmountBlur = (row) => {
  if (!row.currentInvoiceAmount) {
    row.currentInvoiceAmount = 0;
  }
   row.currentInvoiceAmount =  row.currentInvoiceAmount.toFixed(5);
  // 计算是否超过开票总金额
  if (row.currentInvoiceAmount > row.tempnoInvoiceAmount) {
    proxy.$modal.msgWarning("本次开票金额不得大于未开票金额");
@@ -634,17 +651,17 @@
  // 计算本次开票数
  row.currentInvoiceNum = (
    row.currentInvoiceAmount / row.taxInclusiveUnitPrice
  ).toFixed(2);
  ).toFixed(5);
  console.log("row.currentInvoiceNum ", row.currentInvoiceNum);
  console.log(" row.originalNoInvoiceNum  ", row.originalNoInvoiceNum);
  // 计算未开票数
  row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed(
    2
    5
  );
  // 计算未开票金额
  row.noInvoiceAmount = (
    row.tempnoInvoiceAmount - row.currentInvoiceAmount
  ).toFixed(2);
  ).toFixed(5);
};
onMounted(() => {