|
|
@@ -13,7 +13,7 @@
|
|
|
>
|
|
|
<div style="margin: 10px 0; font-size: 14px; color: #606266;">
|
|
|
<span>应收金额:{{ selectedReceivableAmount }} 元</span>
|
|
|
- <span style="margin-left: 20px;">已收金额:{{ receivedAmount }} 元</span>
|
|
|
+ <span style="margin-left: 20px;">本次收款金额:{{ receivedAmount }} 元</span>
|
|
|
<span style="margin-left: 20px;">未收金额:{{ unreceivedAmount }} 元</span>
|
|
|
</div>
|
|
|
<el-form ref="form" :model="form" class="table-form" label-width="100px">
|
|
|
@@ -36,7 +36,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="已收金额">
|
|
|
+ <el-form-item label="本次收款金额">
|
|
|
<el-input
|
|
|
:value="receivedAmount"
|
|
|
placeholder="0"
|
|
|
@@ -233,7 +233,7 @@ export default {
|
|
|
minWidth: 120,
|
|
|
headerSlot: 'headerRequired',
|
|
|
prop: 'statementAmount',
|
|
|
- label: '本次已收金额',
|
|
|
+ label: '本次收款金额',
|
|
|
align: 'center',
|
|
|
slot: 'statementAmount'
|
|
|
},
|
|
|
@@ -495,9 +495,26 @@ export default {
|
|
|
if (tips.length) {
|
|
|
this.$message.warning('勾选的应收明细存在未填写项:' + tips.join('、'));
|
|
|
reject(false);
|
|
|
- } else {
|
|
|
- resolve(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 本次录入收款金额之和 不能超过 历史未收金额
|
|
|
+ // 字段语义:statementAmount=本次录入;unreceiveTotalPrice=接口下发的历史未收汇总
|
|
|
+ const totalStatementAmount = this.selection.reduce(
|
|
|
+ (pre, item) => pre + (+item.statementAmount || 0),
|
|
|
+ 0
|
|
|
+ );
|
|
|
+ const unreceive = +this.unreceivedAmount || 0;
|
|
|
+ // 用「分」做整数比较,避开浮点精度(例:0.1+0.2 之类)
|
|
|
+ const totalCents = Math.round(totalStatementAmount * 100);
|
|
|
+ const unreceiveCents = Math.round(unreceive * 100);
|
|
|
+ if (totalCents > unreceiveCents) {
|
|
|
+ this.$message.warning(
|
|
|
+ `本次录入收款金额之和(${totalStatementAmount.toFixed(2)} 元)不能大于未收金额(${unreceive} 元)`
|
|
|
+ );
|
|
|
+ reject(false);
|
|
|
+ return;
|
|
|
}
|
|
|
+ resolve(true);
|
|
|
});
|
|
|
},
|
|
|
|