【bug】校验会员缴费与证书缴费至少填写一种
This commit is contained in:
@@ -791,7 +791,7 @@ export default {
|
||||
const memberAmount = this.form.getFieldValue('memberPaymentAmount') ? Number(this.form.getFieldValue('memberPaymentAmount')) : 0
|
||||
const certificateAmount = this.form.getFieldValue('certificatePaymentAmount') ? Number(this.form.getFieldValue('certificatePaymentAmount')) : 0
|
||||
this.certificatePaymentAmountFormValue = certificateAmount
|
||||
this.form.validateFields(['memberPaymentAmount', 'certificatePaymentAmount'], (err, value) => {
|
||||
this.form.validateFields(['memberPaymentAmount', 'certificatePaymentAmount'], (err) => {
|
||||
if (!err) {
|
||||
const otherPaymentAmount = this.allAmount - (memberAmount + certificateAmount)
|
||||
this.form.setFieldsValue({ otherPaymentAmount })
|
||||
@@ -808,6 +808,21 @@ export default {
|
||||
const otherPaymentAmount = this.form.getFieldValue('otherPaymentAmount') ? Number(this.form.getFieldValue('otherPaymentAmount')) : 0
|
||||
return Number(this.allAmount) === (memberAmount + certificateAmount + otherPaymentAmount)
|
||||
},
|
||||
/**
|
||||
* 校验 会员缴费与 证书缴费 必须填写一个 并且不能为0
|
||||
* @return {boolean} true 说明都没有填写 说明填写了
|
||||
* */
|
||||
validatePayment() {
|
||||
const memberAmount = this.form.getFieldValue('memberPaymentAmount') ? Number(this.form.getFieldValue('memberPaymentAmount')) : 0
|
||||
const certificateAmount = this.form.getFieldValue('certificatePaymentAmount') ? Number(this.form.getFieldValue('certificatePaymentAmount')) : 0
|
||||
|
||||
if((memberAmount == false && !memberAmount) && (certificateAmount == false && !certificateAmount)) {
|
||||
return true
|
||||
}else {
|
||||
return false
|
||||
}
|
||||
|
||||
},
|
||||
changeAllAmount(e) {
|
||||
this.allAmount = e.target.value
|
||||
this.calculateAllAmount()
|
||||
@@ -920,8 +935,13 @@ export default {
|
||||
// 触发表单验证
|
||||
that.form.validateFields(async(err, values) => {
|
||||
if (!err) {
|
||||
// 选择了电汇 或者现金 校验凭证金额与合计金额一致
|
||||
if (this.paymentMethodFormValue !== '2' && !this.validateAllMoney()) {
|
||||
// 校验会员缴费与证书缴费 至少填写一种
|
||||
if(this.validatePayment()){
|
||||
this.$message.warning('请至少填写会员缴费金额与证书缴费金额中的一种')
|
||||
return
|
||||
}
|
||||
// 校验合计金额 与凭证金额是否一致
|
||||
if (!this.validateAllMoney()) {
|
||||
this.$message.warning('合计金额与凭证金额不一致')
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user