From 4dbf2dc8c77b80491644b7be2aa9af17454e7f79 Mon Sep 17 00:00:00 2001 From: zhouxueli <2841188632@qq.com> Date: Fri, 14 Mar 2025 15:07:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E6=89=8B=E8=BD=A6=E4=BA=A4=E6=98=93?= =?UTF-8?q?=EF=BC=8C=E5=AE=A1=E6=A0=B8=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/secondHandCar/carSource.vue | 55 ++++++++++++++++++--------- src/views/secondHandCar/wantBuy.vue | 45 +++++++++++++++------- 2 files changed, 67 insertions(+), 33 deletions(-) diff --git a/src/views/secondHandCar/carSource.vue b/src/views/secondHandCar/carSource.vue index 601ab833..681015ba 100644 --- a/src/views/secondHandCar/carSource.vue +++ b/src/views/secondHandCar/carSource.vue @@ -345,13 +345,38 @@ export default { this.$toast('请填写不通过原因') return } + if (!this.form.vehicleLicensePhoto) { + this.$toast('行驶证不能为空') + return + } + if (!this.form.vehicleAnglePhoto) { + this.$toast('车辆45度不能为空') + return + } + let flag=this.validateHandle() + if(flag){ + this.$toast(flag) + return + } + if (this.form.vehicleType=='拖车' && !this.form.boardType) { + this.$toast('落板方式不能为空') + return + }else if(this.form.vehicleType !=='拖车'){ + this.form.boardType='' + } + let rule=this.validationRules.find(item=>!item.value) + if(rule){ + this.$toast(rule.name) + return + } try { await auditCarInfo({ id: this.id, auditResult: type ? 1 : 0 , auditReason: this.auditReason, + ...this.form, + otherPhoto:this.otherImgSrc?.join(',') }) - // await this.submitHandle() setTimeout(()=>{ this.closeParentDialog() },1000) @@ -361,7 +386,7 @@ export default { }, // 发布车源 async submitHandle(){ - if (!this.radio && this.type==1) { + if (!this.radio) { this.$toast('请勾选我已阅读并同意') return } @@ -395,23 +420,15 @@ export default { otherPhoto:this.otherImgSrc?.join(',') }) if(res.code == 200 && !res.msg){ - sessionStorage.setItem('formInfo','') - sessionStorage.setItem('areaName','') - sessionStorage.setItem('vehicleLicensePhotoList','') - sessionStorage.setItem('vehicleAnglePhotoList','') - sessionStorage.setItem('otherImgSrcList','') - sessionStorage.setItem('otherImgSrc','') - if(this.type==1){ - this.$toast('发布成功') - if(this.isWebFunc()){ - setTimeout(()=>{ - this.closeParentDialog() - },1000) - }else{ - setTimeout(()=>{ - this.$router.push({ name: "mineRelease",query:{activeTab : 1}}) - },1000) - } + this.$toast('发布成功') + if(this.isWebFunc()){ + setTimeout(()=>{ + this.closeParentDialog() + },1000) + }else{ + setTimeout(()=>{ + this.$router.push({ name: "mineRelease",query:{activeTab : 1}}) + },1000) } }else{ this.$toast(res.msg) diff --git a/src/views/secondHandCar/wantBuy.vue b/src/views/secondHandCar/wantBuy.vue index c71ffabe..e0edb449 100644 --- a/src/views/secondHandCar/wantBuy.vue +++ b/src/views/secondHandCar/wantBuy.vue @@ -209,24 +209,43 @@ export default { this.$toast('请填写不通过原因') return } + let flag=this.validateHandle() + if(flag){ + this.$toast(flag) + return + } + if (this.form.vehicleType=='拖车' && !this.form.boardType) { + this.$toast('落板方式不能为空') + return + }else if(this.form.vehicleType !=='拖车'){ + this.form.boardType='' + } + let rule=this.validationRules.find(item=>!item.value) + if(rule){ + this.$toast(rule.name) + return + } try { await auditCarInfo({ id: this.id, auditResult: type ? 1 : 0 , auditReason: this.auditReason, + ...this.form, }) - // await this.submitHandle() setTimeout(()=>{ this.closeParentDialog() },1000) - } finally { + } catch (e){ + console.log(e) + } + finally { console.log(type) } }, // 发布求购 async submitHandle(){ - if (!this.radio && this.type==1) { + if (!this.radio) { this.$toast('请勾选我已阅读并同意') return } @@ -251,17 +270,15 @@ export default { ...this.form, }) if(res.code == 200 && !res.msg){ - if(this.type==1){ - this.$toast('发布成功') - if(this.isWebFunc()){ - setTimeout(()=>{ - this.closeParentDialog() - },1000) - }else{ - setTimeout(()=>{ - this.$router.push({ name: "mineRelease",query:{activeTab : 1}}) - },1000) - } + this.$toast('发布成功') + if(this.isWebFunc()){ + setTimeout(()=>{ + this.closeParentDialog() + },1000) + }else{ + setTimeout(()=>{ + this.$router.push({ name: "mineRelease",query:{activeTab : 1}}) + },1000) } }else{ this.$toast(res.msg)