| | |
| | | <el-input-number |
| | | v-model="form.amount" |
| | | :min="0" |
| | | :precision="2" |
| | | :precision="4" |
| | | style="width: 100%;" |
| | | :disabled="isView" |
| | | placeholder="根据入库单含税金额自动换算,可修改" |
| | |
| | | <el-input-number |
| | | v-model="form.taxAmount" |
| | | :min="0" |
| | | :precision="2" |
| | | :precision="4" |
| | | :controls="false" |
| | | style="width: 100%;" |
| | | disabled |
| | |
| | | <el-input-number |
| | | v-model="form.totalAmount" |
| | | :min="0" |
| | | :precision="2" |
| | | :precision="4" |
| | | :controls="false" |
| | | style="width: 100%;" |
| | | disabled |
| | |
| | | |
| | | const formatMoney = (value) => { |
| | | if (value === undefined || value === null) return "0.00"; |
| | | return Number(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ","); |
| | | return Number(value).toFixed(4).replace(/\B(?=(\d{3})+(?!\d))/g, ","); |
| | | }; |
| | | |
| | | const normalizeStatus = (status) => { |
| | |
| | | |
| | | /** 不含税金额变更:税额、价税合计正向计算 */ |
| | | const calculateTaxFromExclusive = () => { |
| | | form.taxAmount = Number((form.amount * form.taxRate / 100).toFixed(2)); |
| | | form.totalAmount = Number((form.amount + form.taxAmount).toFixed(2)); |
| | | form.taxAmount = Number((form.amount * form.taxRate / 100).toFixed(4)); |
| | | form.totalAmount = Number((form.amount + form.taxAmount).toFixed(4)); |
| | | }; |
| | | |
| | | /** 价税合计变更:按税率反算不含税金额、税额 */ |
| | |
| | | return; |
| | | } |
| | | const rate = Number(form.taxRate) / 100; |
| | | form.totalAmount = Number(total.toFixed(2)); |
| | | form.amount = Number((form.totalAmount / (1 + rate)).toFixed(2)); |
| | | form.taxAmount = Number((form.totalAmount - form.amount).toFixed(2)); |
| | | form.totalAmount = Number(total.toFixed(4)); |
| | | form.amount = Number((form.totalAmount / (1 + rate)).toFixed(4)); |
| | | form.taxAmount = Number((form.totalAmount - form.amount).toFixed(4)); |
| | | }; |
| | | |
| | | const handleTaxRateChange = () => { |
| | |
| | | .reduce((acc, row) => acc + getInboundRowTaxInclusiveAmount(row), 0); |
| | | } |
| | | |
| | | calculateTaxFromInclusive(taxInclusiveSum > 0 ? Number(taxInclusiveSum.toFixed(2)) : 0); |
| | | calculateTaxFromInclusive(taxInclusiveSum > 0 ? Number(taxInclusiveSum.toFixed(4)) : 0); |
| | | }; |
| | | |
| | | const inboundBatchDisplayText = computed(() => { |
| | |
| | | const taxRate = toFormNumber(row.taxRate) || 13; |
| | | |
| | | if (totalAmount > 0 && amount === 0 && taxAmount === 0) { |
| | | amount = Number((totalAmount / (1 + taxRate / 100)).toFixed(2)); |
| | | taxAmount = Number((totalAmount - amount).toFixed(2)); |
| | | amount = Number((totalAmount / (1 + taxRate / 100)).toFixed(4)); |
| | | taxAmount = Number((totalAmount - amount).toFixed(4)); |
| | | } else if (totalAmount > 0 && amount > 0 && taxAmount === 0) { |
| | | taxAmount = Number((totalAmount - amount).toFixed(2)); |
| | | taxAmount = Number((totalAmount - amount).toFixed(4)); |
| | | } else if (amount > 0 && taxAmount === 0 && totalAmount === 0) { |
| | | taxAmount = Number((amount * taxRate / 100).toFixed(2)); |
| | | totalAmount = Number((amount + taxAmount).toFixed(2)); |
| | | taxAmount = Number((amount * taxRate / 100).toFixed(4)); |
| | | totalAmount = Number((amount + taxAmount).toFixed(4)); |
| | | } else if (amount > 0 && taxAmount > 0 && totalAmount === 0) { |
| | | totalAmount = Number((amount + taxAmount).toFixed(2)); |
| | | totalAmount = Number((amount + taxAmount).toFixed(4)); |
| | | } |
| | | |
| | | return { amount, taxAmount, totalAmount }; |