| | |
| | | </el-table-column> |
| | | <el-table-column label="数量" |
| | | prop="quantity" /> |
| | | <el-table-column label="每件数量" |
| | | prop="singleQuantity" /> |
| | | <el-table-column label="待发货数量" |
| | | prop="noQuantity" /> |
| | | <el-table-column label="税率(%)" |
| | |
| | | prop="unit" /> |
| | | <el-table-column label="数量" |
| | | prop="quantity" /> |
| | | <el-table-column label="每件数量" |
| | | prop="singleQuantity" /> |
| | | <el-table-column label="税率(%)" |
| | | prop="taxRate" /> |
| | | <el-table-column label="含税单价(元)" |
| | |
| | | clearable |
| | | :precision="2" |
| | | @change="calculateFromQuantity" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="每件数量:" |
| | | prop="singleQuantity"> |
| | | <el-input-number :step="1" |
| | | :min="1" |
| | | v-model="productForm.singleQuantity" |
| | | placeholder="请输入" |
| | | clearable |
| | | :precision="0" |
| | | @change="calculateFromSingleQuantity" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | specificationModel: "", |
| | | unit: "", |
| | | quantity: "", |
| | | singleQuantity: 1, |
| | | taxInclusiveUnitPrice: "", |
| | | taxRate: "", |
| | | taxInclusiveTotalPrice: "", |
| | |
| | | |
| | | const totalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice); |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | | const singleQuantity = parseInt(productForm.value.singleQuantity) || 1; |
| | | |
| | | if (!totalPrice || !quantity || quantity <= 0) { |
| | | return; |
| | |
| | | |
| | | isCalculating.value = true; |
| | | |
| | | // 计算含税单价 = 含税总价 / 数量 |
| | | productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2); |
| | | // 计算含税单价 = 含税总价 / (数量 * 每件数量) |
| | | productForm.value.taxInclusiveUnitPrice = (totalPrice / (quantity * singleQuantity)).toFixed(2); |
| | | |
| | | // 如果有税率,计算不含税总价 |
| | | if (productForm.value.taxRate) { |
| | |
| | | ); |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | | const taxRate = parseFloat(productForm.value.taxRate); |
| | | const singleQuantity = parseInt(productForm.value.singleQuantity) || 1; |
| | | |
| | | if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) { |
| | | return; |
| | |
| | | const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal); |
| | | productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2); |
| | | |
| | | // 计算含税单价 = 含税总价 / 数量 |
| | | // 计算含税单价 = 含税总价 / (数量 * 每件数量) |
| | | productForm.value.taxInclusiveUnitPrice = ( |
| | | inclusiveTotalPrice / quantity |
| | | inclusiveTotalPrice / (quantity * singleQuantity) |
| | | ).toFixed(2); |
| | | |
| | | isCalculating.value = false; |
| | |
| | | |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | | const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice); |
| | | const singleQuantity = parseInt(productForm.value.singleQuantity) || 1; |
| | | |
| | | if (!quantity || quantity <= 0 || !unitPrice) { |
| | | return; |
| | |
| | | |
| | | isCalculating.value = true; |
| | | |
| | | // 计算含税总价 |
| | | productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2); |
| | | // 计算含税总价 = 单价 * 数量 * 每件数量 |
| | | productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity * singleQuantity).toFixed(2); |
| | | |
| | | // 如果有税率,计算不含税总价 |
| | | if (productForm.value.taxRate) { |
| | |
| | | |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | | const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice); |
| | | const singleQuantity = parseInt(productForm.value.singleQuantity) || 1; |
| | | |
| | | if (!quantity || quantity <= 0 || !unitPrice) { |
| | | return; |
| | |
| | | |
| | | isCalculating.value = true; |
| | | |
| | | // 计算含税总价 |
| | | productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2); |
| | | // 计算含税总价 = 单价 * 数量 * 每件数量 |
| | | productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity * singleQuantity).toFixed(2); |
| | | |
| | | // 如果有税率,计算不含税总价 |
| | | if (productForm.value.taxRate) { |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | productForm.value.taxInclusiveTotalPrice, |
| | | productForm.value.taxRate |
| | | ); |
| | | } |
| | | |
| | | isCalculating.value = false; |
| | | }; |
| | | |
| | | // 根据每件数量变化计算总价 |
| | | const calculateFromSingleQuantity = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | if (isCalculating.value) return; |
| | | |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | | const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice); |
| | | const singleQuantity = parseInt(productForm.value.singleQuantity) || 1; |
| | | |
| | | if (!quantity || quantity <= 0 || !unitPrice) { |
| | | return; |
| | | } |
| | | |
| | | isCalculating.value = true; |
| | | |
| | | // 计算含税总价 = 单价 * 数量 * 每件数量 |
| | | productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity * singleQuantity).toFixed(2); |
| | | |
| | | // 如果有税率,计算不含税总价 |
| | | if (productForm.value.taxRate) { |