Merge branch 'master' into feature/20261019-bfi-all-web
# Conflicts: # src/views/payment/invoice-application.vue # src/views/payment/invoice-receipt.vue # src/views/payment/payment-application.vue # src/views/settlement/formal-settlement.vue # src/views/settlement/pre-settlement.vue
This commit is contained in:
@@ -251,10 +251,10 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="不含税单价" min-width="130">
|
||||
<el-table-column label="合计金额" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.unitPriceNoTax"
|
||||
v-model="row.totalAmount"
|
||||
:disabled="readonly"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
@@ -263,9 +263,6 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="不含税金额" min-width="130" align="right">
|
||||
<template #default="{ row }">{{ formatMoney(row.amountNoTax) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="税率" min-width="110">
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
@@ -282,11 +279,14 @@
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="税额" min-width="120">
|
||||
<template #default="{ row }">{{ formatMoney(row.taxAmount) }}</template>
|
||||
<el-table-column label="不含税单价" min-width="140" align="right">
|
||||
<template #default="{ row }">{{ formatUnitPrice(row.unitPriceNoTax) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合计" min-width="130" align="right">
|
||||
<template #default="{ row }">{{ formatMoney(row.totalAmount) }}</template>
|
||||
<el-table-column label="不含税金额" min-width="130" align="right">
|
||||
<template #default="{ row }">{{ formatMoney(row.amountNoTax) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="税额" min-width="120" align="right">
|
||||
<template #default="{ row }">{{ formatMoney(row.taxAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="170">
|
||||
<template #default="{ row }">
|
||||
@@ -1101,15 +1101,30 @@ export default {
|
||||
addLine(sheet) {
|
||||
sheet.lines.push(emptyLine());
|
||||
},
|
||||
/**
|
||||
* 填写合计金额 + 税率后反算:
|
||||
* 合计金额 = 数量 × 不含税单价 × (1 + 税率)
|
||||
* 不含税单价 = 合计金额 / 数量 / (1 + 税率),保留 6 位小数
|
||||
* 不含税金额 = 数量 × 不含税单价,保留 2 位小数
|
||||
*/
|
||||
recalculateLine(row) {
|
||||
const quantity = Number(row.quantity || 0);
|
||||
const unitPrice = Number(row.unitPriceNoTax || 0);
|
||||
const amountNoTax = Number((quantity * unitPrice).toFixed(2));
|
||||
const totalAmount = Number(Number(row.totalAmount || 0).toFixed(2));
|
||||
const rate = Number(row.taxRate || 0) / 100;
|
||||
row.totalAmount = totalAmount;
|
||||
row.amountWithTax = totalAmount;
|
||||
if (quantity <= 0 || totalAmount <= 0) {
|
||||
row.unitPriceNoTax = 0;
|
||||
row.amountNoTax = 0;
|
||||
row.taxAmount = 0;
|
||||
return;
|
||||
}
|
||||
const factor = 1 + rate;
|
||||
const unitPriceNoTax = Number((totalAmount / quantity / factor).toFixed(6));
|
||||
const amountNoTax = Number((quantity * unitPriceNoTax).toFixed(2));
|
||||
row.unitPriceNoTax = unitPriceNoTax;
|
||||
row.amountNoTax = amountNoTax;
|
||||
row.taxAmount = rate ? Number((amountNoTax * rate).toFixed(2)) : 0;
|
||||
row.totalAmount = Number((amountNoTax + row.taxAmount).toFixed(2));
|
||||
row.amountWithTax = row.totalAmount;
|
||||
row.taxAmount = Number((totalAmount - amountNoTax).toFixed(2));
|
||||
},
|
||||
validateBusiness() {
|
||||
if (!this.selectedDetailIds.length) throw new Error('请至少选择一条开票明细');
|
||||
@@ -1122,12 +1137,14 @@ export default {
|
||||
for (const line of sheet.lines) {
|
||||
if (!line.goodsCategory || !line.goodsName) throw new Error('请完整填写商品和服务信息');
|
||||
if (
|
||||
[line.quantity, line.unitPriceNoTax, line.amountNoTax, line.taxRate].some(
|
||||
[line.quantity, line.totalAmount, line.unitPriceNoTax, line.amountNoTax, line.taxRate].some(
|
||||
Number.isNaN
|
||||
)
|
||||
) {
|
||||
throw new Error('开票商品行金额格式不正确');
|
||||
}
|
||||
if (Number(line.quantity || 0) <= 0) throw new Error('开票商品行数量必须大于0');
|
||||
if (Number(line.totalAmount || 0) <= 0) throw new Error('开票商品行合计金额必须大于0');
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1227,6 +1244,9 @@ export default {
|
||||
formatMoney(value) {
|
||||
return Number(value || 0).toFixed(2);
|
||||
},
|
||||
formatUnitPrice(value) {
|
||||
return Number(value || 0).toFixed(6);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user