From ffb433f3468756aa7c7198e0c99a2e1348466a38 Mon Sep 17 00:00:00 2001 From: fengchenchen Date: Thu, 2 Nov 2023 16:45:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91WASIC=E5=8F=98=E6=9B=B4?= =?UTF-8?q?3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MessagePage/modules/wasicStaticData.js | 2 +- src/views/signUp/SignUpPage.vue | 62 +++++++++++++------ 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/views/MessagePage/modules/wasicStaticData.js b/src/views/MessagePage/modules/wasicStaticData.js index 45c9ff7..658d484 100644 --- a/src/views/MessagePage/modules/wasicStaticData.js +++ b/src/views/MessagePage/modules/wasicStaticData.js @@ -37,7 +37,7 @@ const WasicTopicData = [ 'value': '99', 'text': '114/22焦点论坛(08:00-12:00,全体大会)', 'title': '114/22焦点论坛(08:00-12:00,全体大会)', - 'disabled': true + // 'disabled': true } ], radioChildren: [ diff --git a/src/views/signUp/SignUpPage.vue b/src/views/signUp/SignUpPage.vue index 30e14d2..288bbb8 100644 --- a/src/views/signUp/SignUpPage.vue +++ b/src/views/signUp/SignUpPage.vue @@ -394,7 +394,8 @@ export default { }, choiceTopic: { rules: [ - {required: true, message: '请选择会议名称'}, + // {required: true, message: '请选择会议名称'}, + {required: true, validator: this.checkChoiceTopic}, ], validateTrigger: ['change'] }, @@ -534,7 +535,8 @@ export default { // }) // 给Form赋值 this.form.setFieldsValue({ - choiceTopic: [LinkTopicsEnums.default.index + ''] + // choiceTopic: [LinkTopicsEnums.default.index + ''] + choiceTopic: [] }) } }) @@ -671,6 +673,7 @@ export default { return } this.form.validateFields((err, values) => { + console.log("---------err, values--------", err, values) if (!err) { // 判断邀请码是否错误 需要判断会议类型 以及 是否有邀请码 if (this.codeErrorBool && this.currentMeetingInfo.meetingType === '3' && this.inviteCodeBool) { @@ -696,7 +699,7 @@ export default { // 国际研讨会处理 会议名称的问题 // 国际研讨会 且为WASIC 会议 if (this.currentMeetingInfo.meetingType === '3' && this.currentMeetingInfo.isWasic) { - let choiceTopicArr = submitData.choiceTopic + let choiceTopicArr = submitData.choiceTopic || [] //11月27日 单选会议的处理 if (submitData.radioKey) { choiceTopicArr.push(submitData.radioKey) @@ -705,6 +708,13 @@ export default { if (submitData.radioKeyTwo) { choiceTopicArr.push(submitData.radioKeyTwo) } + // 只选择一个免费参观的不能报名成功 + let judgeFlag = choiceTopicArr.filter(tt => tt !== LinkTopicsEnums.freeTwo.index + '') + if(judgeFlag.length === 0) { + this.$message.error('请选择会议名称') + that.confirmLoading = false + return + } submitData.choiceTopic = choiceTopicArr.join(',') } // 直接写一个回调函数,然后做后续的调用 @@ -766,11 +776,7 @@ export default { this.meetingCostSum = this.currentMeetingInfo.meetingCosts // TODO 如果当前是WASIC会议 则需要通过会议名称判断会议的费用 if (this.isWasic) { - if (this.choiceTopicArr.length > 2) { - this.meetingCostSum = this.currentMeetingInfo.meetingCostsThreeTopic - } else { - this.meetingCostSum = this.currentMeetingInfo.meetingCostsTwoTopic - } + this.calcMeetingCostSum() } } // 当前会议不是国际研讨会议 身份选择嘉宾和 内部企业的会议费用为0 @@ -869,32 +875,30 @@ export default { changeChoiceTopic(choiceTopic) { console.log(choiceTopic) // 保存选择的付费主题 用于进行费用的计算 - let arr = choiceTopic.filter(item => item && item !== (LinkTopicsEnums.free.index + '') && item !== (LinkTopicsEnums.freeTwo.index + '')) + // let arr = choiceTopic.filter(item => item && item !== (LinkTopicsEnums.freeTwo.index + '')) // this.choiceTopicArr = choiceTopic.filter(item => item && item !== (LinkTopicsEnums.free.index + '')) + this.calcMeetingCostSum() + console.log(this.choiceTopicArr) + }, + calcMeetingCostSum() { // 對单选的数据进行判断 this.$nextTick(() => { let radioKey = this.form.getFieldValue('radioKey') - if (radioKey) { - arr.push(radioKey) - } let radioKeyTwo = this.form.getFieldValue('radioKeyTwo') - if (radioKeyTwo) { - arr.push(radioKeyTwo) - } - if (arr.length > 2) { + if(radioKey && radioKeyTwo) { this.meetingCostSum = this.currentMeetingInfo.meetingCostsThreeTopic } else { this.meetingCostSum = this.currentMeetingInfo.meetingCostsTwoTopic } - this.choiceTopicArr = [...arr] }) - console.log(this.choiceTopicArr) - }, changeRadioTopic(e, key) { console.log(e, key) let choiceTopic = this.form.getFieldValue('choiceTopic') this.changeChoiceTopic(choiceTopic) + this.$nextTick(() => { + this.form.validateFields(['choiceTopic']) + }) }, /* * 是否有邀请码 @@ -1042,6 +1046,26 @@ export default { } else { callback('请输入邀请码') } + }, + // 验证选择会议名称的情况 + checkChoiceTopic(rules, value, callback) { + console.log(value) + let arr = [] + if (value && value.length > 0) { + arr = [...value] + } + let radioKey = this.form.getFieldValue('radioKey') + let radioKeyTwo = this.form.getFieldValue('radioKeyTwo') + if(radioKey || radioKeyTwo) { + callback() + } else { + arr = arr.filter(tt => tt !== LinkTopicsEnums.freeTwo.index + '') + if(arr.length === 0) { + callback('请至少选择一个非参观类会议') + } else { + callback() + } + } } } }