|
@@ -1954,19 +1954,29 @@
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- const receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
|
|
|
|
|
- console.log('receiptPaymentListSum~~~', receiptPaymentListSum, commitData.contract.discountTotalPrice)
|
|
|
|
|
- if(+receiptPaymentListSum != +commitData.contract.discountTotalPrice){
|
|
|
|
|
- this.$message.error('计划收款金额合计与优惠后金额不一致');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
|
|
const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
|
|
|
if(+ratioSum != 100){
|
|
if(+ratioSum != 100){
|
|
|
this.$message.error('比例合计必须为100%');
|
|
this.$message.error('比例合计必须为100%');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
|
|
|
|
|
+ const payAmount = +commitData.payAmount;
|
|
|
|
|
+
|
|
|
|
|
+ if(+ratioSum == 100) {
|
|
|
|
|
+ const difference = payAmount - receiptPaymentListSum;
|
|
|
|
|
+ if (Math.abs(difference) > 0 && commitData.receiptPaymentList.length > 0) {
|
|
|
|
|
+ const lastIndex = commitData.receiptPaymentList.length - 1;
|
|
|
|
|
+ commitData.receiptPaymentList[lastIndex].price = (+commitData.receiptPaymentList[lastIndex].price + difference).toFixed(2);
|
|
|
|
|
+ receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(Math.abs(+receiptPaymentListSum - payAmount) > 0){
|
|
|
|
|
+ this.$message.error('计划收款金额合计与优惠后金额不一致');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// commitData.productList.forEach((item) => {
|
|
// commitData.productList.forEach((item) => {
|
|
|
// if (!item.productCode) {
|
|
// if (!item.productCode) {
|
|
|
// isTemporary.push(item.productName);
|
|
// isTemporary.push(item.productName);
|