| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="含税单价(元):" prop="taxInclusiveUnitPrice"> |
| | | <el-input-number :step="0.001" :min="0" v-model="productForm.taxInclusiveUnitPrice" style="width: 100%" |
| | | :precision="3" |
| | | <el-input-number :step="0.0001" :min="0" v-model="productForm.taxInclusiveUnitPrice" style="width: 100%" |
| | | :precision="4" |
| | | placeholder="请输入" clearable @change="calculateFromUnitPrice" /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | }); |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(3); |
| | | return parseFloat(cellValue).toFixed(4); |
| | | }; |
| | | /** 销售台账单价/总价统一保留 3 位小数(与全局 calculateTax* 的 2 位区分) */ |
| | | /** 销售台账单价/总价统一保留 4 位小数(与全局 calculateTax* 的 2 位区分) */ |
| | | const calculateSalesTaxIncludeTotalPrice = (taxInclusiveUnitPrice, quantity) => { |
| | | return (Number(taxInclusiveUnitPrice) * Number(quantity)).toFixed(3); |
| | | return (Number(taxInclusiveUnitPrice) * Number(quantity)).toFixed(4); |
| | | }; |
| | | const calculateSalesTaxExclusiveTotalPrice = (taxInclusiveTotalPrice, taxRate) => { |
| | | const taxRateDecimal = Number(taxRate) / 100; |
| | |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | | ], { taxInclusiveUnitPrice: { decimalPlaces: 4 }, taxInclusiveTotalPrice: { decimalPlaces: 4 }, taxExclusiveTotalPrice: { decimalPlaces: 4 } }); |
| | | }; |
| | | // 打开弹框 |
| | | const openForm = async (type, row) => { |
| | |
| | | unit: p.unit || "", |
| | | quantity: quantity, |
| | | taxRate: taxRate, |
| | | taxInclusiveUnitPrice: unitPrice.toFixed(3), |
| | | taxInclusiveUnitPrice: unitPrice.toFixed(4), |
| | | taxInclusiveTotalPrice: taxInclusiveTotalPrice, |
| | | taxExclusiveTotalPrice: taxExclusiveTotalPrice, |
| | | invoiceType: "增普票", |
| | |
| | | isCalculating.value = true; |
| | | |
| | | // 计算含税单价 = 含税总价 / 数量 |
| | | productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(3); |
| | | productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(4); |
| | | |
| | | // 如果有税率,计算不含税总价 |
| | | if (productForm.value.taxRate) { |
| | |
| | | productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(3); |
| | | |
| | | // 计算含税单价 = 含税总价 / 数量 |
| | | productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(3); |
| | | productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(4); |
| | | |
| | | isCalculating.value = false; |
| | | }; |