yuan
2026-08-29 35bca0a78746b8b97497f89c9e1e52e643dc4d5e
src/views/procurementManagement/purchaseReturnOrder/New.vue
@@ -275,6 +275,7 @@
                  <el-input-number v-model="scope.row.returnQuantity"
                            controls-position="right"
                            :step="1"
                            :precision="6"
                            :min="0"
                            :max="getReturnQtyMax(scope.row)"
                            :disabled="getReturnQtyMax(scope.row) <= 0"
@@ -340,7 +341,7 @@
          <el-input-number v-model="formState.totalDiscountAmount"
                           controls-position="right"
                           :step="0.01"
                           :precision="2"
                           :precision="6"
                           style="width: 100%;"
                           @change="handleChangeTotalDiscountAmount"
                           placeholder="请输入整单折扣额"/>
@@ -353,7 +354,7 @@
          <el-input v-model="formState.totalDiscountRate"
                           controls-position="right"
                           :step="0.01"
                           :precision="2"
                           :precision="6"
                           style="width: 100%;"
                           @change="totalDiscount"
                           placeholder="请输入整单折扣率">
@@ -377,7 +378,7 @@
          <el-input-number v-model="formState.totalAmount"
                           controls-position="right"
                           :step="0.01"
                           :precision="2"
                           :precision="6"
                           style="width: 100%;"
                           placeholder="请输入成交金额"/>
        </el-form-item>
@@ -511,7 +512,7 @@
});
const formattedNumber = (row, column, cellValue) => {
  return parseFloat(cellValue).toFixed(2);
  return parseFloat(cellValue).toFixed(6);
};
const formatAmount = (value) => {
@@ -522,7 +523,7 @@
  if (Number.isNaN(num)) {
    return '--'
  }
  return num.toFixed(2)
  return num.toFixed(6)
}
const toNumber = (val) => {
@@ -535,14 +536,15 @@
  const total = Number(row?.stockInNum ?? row?.totalQuantity ?? row?.quantity ?? 0)
  const un = Number(row?.unQuantity ?? 0)
  if (!Number.isFinite(total) || !Number.isFinite(un)) return 0
  return Math.max(total - un, 0)
  // 保留6位小数,避免浮点减法产生精度误差
  return Math.max(parseFloat((total - un).toFixed(6)), 0)
}
const getReturnTotal = (row) => {
  const qty = toNumber(row?.returnQuantity)
  const unitPrice = toNumber(row?.taxInclusiveUnitPrice)
  const total = qty * unitPrice
  return Number(total.toFixed(2))
  return Number(total.toFixed(6))
}
const syncReturnTotal = (row) => {
@@ -568,7 +570,7 @@
  }
  const baseAmount = getBaseAmount()
  // 折扣额 = 产品退货总价合计 * 折扣率
  formState.value.totalDiscountAmount = Number((baseAmount * (discountRate / 100)).toFixed(2))
  formState.value.totalDiscountAmount = Number((baseAmount * (discountRate / 100)).toFixed(6))
  syncTotalAmount()
}
@@ -596,9 +598,12 @@
        "taxExclusiveTotalPrice",
      ],
      {
        stockInNum: { noDecimal: true }, // 不保留小数
        returnQuantity: { noDecimal: true }, // 不保留小数
        unQuantity: { noDecimal: true }, // 不保留小数
        stockInNum: { decimalPlaces: 6 },
        returnQuantity: { decimalPlaces: 6 },
        unQuantity: { decimalPlaces: 6 },
        taxInclusiveUnitPrice: { decimalPlaces: 6 },
        taxInclusiveTotalPrice: { decimalPlaces: 6 },
        taxExclusiveTotalPrice: { decimalPlaces: 6 },
      }
  );
};
@@ -620,11 +625,11 @@
  if (normalizedAmount > baseAmount) {
    proxy.$modal.msgError("整单折扣额不能大于产品退货总价合计")
    formState.value.totalDiscountAmount = Number(baseAmount.toFixed(2))
    formState.value.totalDiscountAmount = Number(baseAmount.toFixed(6))
  }
  const discountRate = (toNumber(formState.value.totalDiscountAmount) / baseAmount) * 100
  formState.value.totalDiscountRate = Number(discountRate.toFixed(2))
  formState.value.totalDiscountRate = Number(discountRate.toFixed(6))
  syncTotalAmount()
}
@@ -639,7 +644,7 @@
  const baseAmount = getBaseAmount()
  const discount = toNumber(formState.value.totalDiscountAmount)
  // 成交金额 = 产品退货总价合计 - 折扣额
  formState.value.totalAmount = Number((baseAmount - discount).toFixed(2))
  formState.value.totalAmount = Number((baseAmount - discount).toFixed(6))
}
// 获取供应商选项