|
@@ -1035,7 +1035,8 @@
|
|
|
payAmount: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
payAmount: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
salesmanId: [{ required: this.isDeptAndPerson == 1 ? true : false, message: '请选择业务员', trigger: 'change' }],
|
|
salesmanId: [{ required: this.isDeptAndPerson == 1 ? true : false, message: '请选择业务员', trigger: 'change' }],
|
|
|
salesDeptId: [{ required: this.isDeptAndPerson == 1 ? true : false, message: '请选择销售部门', trigger: 'change' }],
|
|
salesDeptId: [{ required: this.isDeptAndPerson == 1 ? true : false, message: '请选择销售部门', trigger: 'change' }],
|
|
|
- settlementDate: [{ required: true, message: '请选择结算日期', trigger: 'change' }]
|
|
|
|
|
|
|
+ settlementDate: [{ required: true, message: '请选择结算日期', trigger: 'change' }],
|
|
|
|
|
+ receiptDate: [{ required: true, message: '请选择收款日期', trigger: 'change' }]
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -1965,34 +1966,40 @@
|
|
|
|
|
|
|
|
if(commitData.needProduce != 2 && commitData.needProduce != 4) {
|
|
if(commitData.needProduce != 2 && commitData.needProduce != 4) {
|
|
|
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){
|
|
|
|
|
- this.$message.error('比例合计必须为100%');
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(+ratioSum > 100){
|
|
|
|
|
+ this.$message.error('比例合计不能超过100%');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // if(+ratioSum != 100){
|
|
|
|
|
+ // this.$message.error('比例合计必须为100%');
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
// 使用万分之一进行计算,避免浮点数精度问题(对应4位小数)
|
|
// 使用万分之一进行计算,避免浮点数精度问题(对应4位小数)
|
|
|
- let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
|
|
|
|
|
- const payAmount = +commitData.payAmount;
|
|
|
|
|
|
|
+ // let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
|
|
|
|
|
+ // const payAmount = +commitData.payAmount;
|
|
|
|
|
|
|
|
- if(+ratioSum == 100) {
|
|
|
|
|
- // 使用万分之一进行计算,避免浮点数精度问题
|
|
|
|
|
- const difference = Math.round((payAmount - receiptPaymentListSum) * 10000) / 10000;
|
|
|
|
|
- console.log('difference~~~', difference);
|
|
|
|
|
- if (Math.abs(difference) >= 0.0001 && commitData.receiptPaymentList.length > 0) {
|
|
|
|
|
- const lastIndex = commitData.receiptPaymentList.length - 1;
|
|
|
|
|
- // 使用万分之一进行计算,避免浮点数精度问题
|
|
|
|
|
- const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 10000) / 10000;
|
|
|
|
|
- commitData.receiptPaymentList[lastIndex].price = formatPrice(newPrice);
|
|
|
|
|
- receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- console.log('receiptPaymentListSum~~~', +receiptPaymentListSum, payAmount);
|
|
|
|
|
-
|
|
|
|
|
- if(Math.abs(+receiptPaymentListSum - payAmount) > 0.0001){
|
|
|
|
|
- this.$message.error('计划收款金额合计与优惠后金额不一致');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if(+ratioSum == 100) {
|
|
|
|
|
+ // // 使用万分之一进行计算,避免浮点数精度问题
|
|
|
|
|
+ // const difference = Math.round((payAmount - receiptPaymentListSum) * 10000) / 10000;
|
|
|
|
|
+ // console.log('difference~~~', difference);
|
|
|
|
|
+ // if (Math.abs(difference) >= 0.0001 && commitData.receiptPaymentList.length > 0) {
|
|
|
|
|
+ // const lastIndex = commitData.receiptPaymentList.length - 1;
|
|
|
|
|
+ // // 使用万分之一进行计算,避免浮点数精度问题
|
|
|
|
|
+ // const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 10000) / 10000;
|
|
|
|
|
+ // commitData.receiptPaymentList[lastIndex].price = formatPrice(newPrice);
|
|
|
|
|
+ // receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // console.log('receiptPaymentListSum~~~', +receiptPaymentListSum, payAmount);
|
|
|
|
|
+
|
|
|
|
|
+ // if(Math.abs(+receiptPaymentListSum - payAmount) > 0.0001){
|
|
|
|
|
+ // this.$message.error('计划收款金额合计与优惠后金额不一致');
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (isTemporary.length > 0) {
|
|
if (isTemporary.length > 0) {
|