| | |
| | | <el-table-column prop="unit" label="单位" /> |
| | | <el-table-column prop="quantity" label="数量" /> |
| | | <el-table-column prop="taxInclusiveUnitPrice" label="含税单价"> |
| | | <template #default="scope">¥{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(2) }}</template> |
| | | <template #default="scope">¥{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(4) }}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="taxInclusiveTotalPrice" label="含税总价"> |
| | | <template #default="scope">¥{{ Number(scope.row.taxInclusiveTotalPrice ?? 0).toFixed(2) }}</template> |
| | |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | | ], { taxInclusiveUnitPrice: { decimalPlaces: 4 } }); |
| | | }; |
| | | // 打开弹框 |
| | | const openForm = (type, row) => { |
| | |
| | | if (field === 'taxInclusiveTotalPrice') { |
| | | // 已知含税总价和数量,反算含税单价 |
| | | if (productForm.value.quantity) { |
| | | productForm.value.taxInclusiveUnitPrice = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2); |
| | | productForm.value.taxInclusiveUnitPrice = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(4); |
| | | } |
| | | // 已知含税总价和含税单价,反算数量 |
| | | else if (productForm.value.taxInclusiveUnitPrice) { |
| | | productForm.value.quantity = |
| | | productForm.value.quantity = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2); |
| | | } |
| | | // 反算不含税总价 |
| | |
| | | (Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)).toFixed(2); |
| | | // 已知数量,反算含税单价 |
| | | if (productForm.value.quantity) { |
| | | productForm.value.taxInclusiveUnitPrice = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2); |
| | | productForm.value.taxInclusiveUnitPrice = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(4); |
| | | } |
| | | // 已知含税单价,反算数量 |
| | | else if (productForm.value.taxInclusiveUnitPrice) { |
| | | productForm.value.quantity = |
| | | productForm.value.quantity = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2); |
| | | } |
| | | } |
| | |
| | | const formatCurrency = (val) => { |
| | | if (val === null || val === undefined || val === '') return '-' |
| | | const num = Number(val) |
| | | return Number.isFinite(num) ? num.toFixed(2) : '-' |
| | | return Number.isFinite(num) ? num.toFixed(4) : '-' |
| | | } |
| | | |
| | | const { post_sale_waiting_list, degree_of_urgency } = proxy.useDict( |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="含税单价" prop="taxIncludingPriceUnit"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | <el-input-number :step="0.0001" :min="0" style="width: 100%" |
| | | v-model="form.taxIncludingPriceUnit" |
| | | placeholder="请输入含税单价" |
| | | :precision="4" |
| | | maxlength="10" |
| | | @change="mathNum" |
| | | /> |
| | |
| | | prop: "taxInclusiveUnitPrice", |
| | | width:200, |
| | | formatData: (val) => { |
| | | return val ? parseFloat(val).toFixed(2) : "-"; |
| | | return val ? parseFloat(val).toFixed(4) : "-"; |
| | | }, |
| | | }, |
| | | { |
| | |
| | | prop: "taxInclusiveUnitPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return val ? parseFloat(val).toFixed(2) : 0; |
| | | return val ? parseFloat(val).toFixed(4) : 0; |
| | | }, |
| | | }, |
| | | { |
| | |
| | | ]; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (cellValue == 0) { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | return parseFloat(cellValue).toFixed(column.property === "taxInclusiveUnitPrice" ? 4 : 2); |
| | | } |
| | | if (cellValue) { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | return parseFloat(cellValue).toFixed(column.property === "taxInclusiveUnitPrice" ? 4 : 2); |
| | | } else { |
| | | return cellValue; |
| | | } |
| | |
| | | <el-form-item label="含税单价(元):" |
| | | prop="taxInclusiveUnitPrice"> |
| | | <el-input-number v-model="productForm.taxInclusiveUnitPrice" |
| | | :precision="2" |
| | | :step="0.1" |
| | | :precision="4" |
| | | :step="0.0001" |
| | | :min="0" |
| | | clearable |
| | | style="width: 100%" |
| | |
| | | }; |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | const val = Number(cellValue ?? 0); |
| | | if (!Number.isFinite(val)) return "0.00"; |
| | | return column.property === "taxInclusiveUnitPrice" ? val.toFixed(4) : val.toFixed(2); |
| | | }; |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | | ], { taxInclusiveUnitPrice: { decimalPlaces: 4 } }); |
| | | }; |
| | | // 打开弹框 |
| | | const openForm = async (type, row) => { |
| | |
| | | productForm.value.taxInclusiveUnitPrice = ( |
| | | Number(productForm.value.taxInclusiveTotalPrice) / |
| | | Number(productForm.value.quantity) |
| | | ).toFixed(2); |
| | | ).toFixed(4); |
| | | // 确保结果不为负数 |
| | | if (Number(productForm.value.taxInclusiveUnitPrice) < 0) { |
| | | productForm.value.taxInclusiveUnitPrice = "0"; |
| | |
| | | productForm.value.taxInclusiveUnitPrice = ( |
| | | Number(productForm.value.taxInclusiveTotalPrice) / |
| | | Number(productForm.value.quantity) |
| | | ).toFixed(2); |
| | | ).toFixed(4); |
| | | // 确保结果不为负数 |
| | | if (Number(productForm.value.taxInclusiveUnitPrice) < 0) { |
| | | productForm.value.taxInclusiveUnitPrice = "0"; |
| | |
| | | }); |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | const val = Number(cellValue ?? 0); |
| | | if (!Number.isFinite(val)) return "0.00"; |
| | | return column.property === "taxInclusiveUnitPrice" ? val.toFixed(4) : val.toFixed(2); |
| | | }; |
| | | |
| | | const formatAmount = (value) => { |
| | |
| | | }) |
| | | const total = ref(0) |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | const val = Number(cellValue ?? 0); |
| | | if (!Number.isFinite(val)) return "0.00"; |
| | | return column.property === "taxInclusiveUnitPrice" ? val.toFixed(4) : val.toFixed(2); |
| | | }; |
| | | |
| | | const paginationChange = (obj) => { |
| | |
| | | <el-table-column label="库存预警数量" prop="warnNum" width="120" /> |
| | | <el-table-column label="税率(%)" prop="taxRate" width="90" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" width="130"> |
| | | <template #default="scope">{{ formatAmount(scope.row.taxInclusiveUnitPrice) }}</template> |
| | | <template #default="scope">{{ scope.row.taxInclusiveUnitPrice != null ? Number(scope.row.taxInclusiveUnitPrice).toFixed(4) : '--' }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" width="130"> |
| | | <template #default="scope">{{ formatAmount(scope.row.taxInclusiveTotalPrice) }}</template> |
| | |
| | | <el-form-item label="含税单价(元):" prop="taxInclusiveUnitPrice"> |
| | | <el-input-number |
| | | v-model="productForm.taxInclusiveUnitPrice" |
| | | :step="0.01" |
| | | :step="0.0001" |
| | | :min="0" |
| | | :precision="2" |
| | | :precision="4" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | |
| | | |
| | | function formattedNumber(row, column, cellValue) { |
| | | const val = Number(cellValue ?? 0) |
| | | return Number.isFinite(val) ? val.toFixed(2) : '0.00' |
| | | if (!Number.isFinite(val)) return '0.00' |
| | | return column.property === 'taxInclusiveUnitPrice' ? val.toFixed(4) : val.toFixed(2) |
| | | } |
| | | |
| | | function summarizeProductTable(param) { |
| | |
| | | const quantity = parseFloat(productForm.value.quantity) |
| | | if (!totalPrice || !quantity || quantity <= 0) return |
| | | isCalculating.value = true |
| | | productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2) |
| | | productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(4) |
| | | if (productForm.value.taxRate) { |
| | | productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(totalPrice, productForm.value.taxRate) |
| | | } |
| | |
| | | const taxRateDecimal = taxRate / 100 |
| | | const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal) |
| | | productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2) |
| | | productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2) |
| | | productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(4) |
| | | isCalculating.value = false |
| | | } |
| | | |
| | |
| | | label="数量" /> |
| | | <el-table-column prop="taxInclusiveUnitPrice" |
| | | label="含税单价"> |
| | | <template #default="scope">¥{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(2) }}</template> |
| | | <template #default="scope">¥{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(4) }}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="taxInclusiveTotalPrice" |
| | | label="含税总价"> |
| | |
| | | }; |
| | | // 子表合计方法 |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable(param, [ |
| | | "taxInclusiveUnitPrice", |
| | | return proxy.summarizeTable(param, [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "invoiceNum", |
| | |
| | | <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; |
| | | }; |