| | |
| | | <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" |
| | |
| | | <el-input-number v-model="formState.totalDiscountAmount" |
| | | controls-position="right" |
| | | :step="0.01" |
| | | :precision="2" |
| | | :precision="6" |
| | | style="width: 100%;" |
| | | @change="handleChangeTotalDiscountAmount" |
| | | placeholder="请输入整单折扣额"/> |
| | |
| | | <el-input v-model="formState.totalDiscountRate" |
| | | controls-position="right" |
| | | :step="0.01" |
| | | :precision="2" |
| | | :precision="6" |
| | | style="width: 100%;" |
| | | @change="totalDiscount" |
| | | placeholder="请输入整单折扣率"> |
| | |
| | | <el-input-number v-model="formState.totalAmount" |
| | | controls-position="right" |
| | | :step="0.01" |
| | | :precision="2" |
| | | :precision="6" |
| | | style="width: 100%;" |
| | | placeholder="请输入成交金额"/> |
| | | </el-form-item> |
| | |
| | | }); |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | return parseFloat(cellValue).toFixed(6); |
| | | }; |
| | | |
| | | const formatAmount = (value) => { |
| | |
| | | if (Number.isNaN(num)) { |
| | | return '--' |
| | | } |
| | | return num.toFixed(2) |
| | | return num.toFixed(6) |
| | | } |
| | | |
| | | const toNumber = (val) => { |
| | |
| | | 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) => { |
| | |
| | | } |
| | | const baseAmount = getBaseAmount() |
| | | // 折扣额 = 产品退货总价合计 * 折扣率 |
| | | formState.value.totalDiscountAmount = Number((baseAmount * (discountRate / 100)).toFixed(2)) |
| | | formState.value.totalDiscountAmount = Number((baseAmount * (discountRate / 100)).toFixed(6)) |
| | | syncTotalAmount() |
| | | } |
| | | |
| | |
| | | "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 }, |
| | | } |
| | | ); |
| | | }; |
| | |
| | | |
| | | 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() |
| | | } |
| | | |
| | |
| | | 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)) |
| | | } |
| | | |
| | | // 获取供应商选项 |