二手车交易,测试优化

This commit is contained in:
2025-03-13 19:47:15 +08:00
parent 2e6f855cf8
commit 1d491e501f
6 changed files with 93 additions and 38 deletions

View File

@ -43,7 +43,7 @@
<van-radio name="随车吊" :class="{'checked':form.vehicleType=='随车吊','vehicleRadio':true}">随车吊</van-radio> <van-radio name="随车吊" :class="{'checked':form.vehicleType=='随车吊','vehicleRadio':true}">随车吊</van-radio>
</van-radio-group> </van-radio-group>
</div> </div>
<div class="item"> <div class="item" v-if="form.vehicleType=='拖车'">
<span> <span class="star">*</span>落板方式 </span> <span> <span class="star">*</span>落板方式 </span>
<van-radio-group v-model="form.boardType" direction="horizontal" class="radioWrap"> <van-radio-group v-model="form.boardType" direction="horizontal" class="radioWrap">
<van-radio name="1" :class="{'checked':form.boardType==1}">全落地</van-radio> <van-radio name="1" :class="{'checked':form.boardType==1}">全落地</van-radio>
@ -74,6 +74,7 @@
<div class="item"> <div class="item">
<span> <span class="star">*</span>行驶里程 </span> <span> <span class="star">*</span>行驶里程 </span>
<van-field <van-field
type="number"
class="radioWrap" class="radioWrap"
v-model="form.mileage" v-model="form.mileage"
input-align="right" input-align="right"
@ -86,6 +87,7 @@
<div class="item"> <div class="item">
<span> <span class="star">*</span>联系号码 </span> <span> <span class="star">*</span>联系号码 </span>
<van-field <van-field
type="number"
class="radioWrap" class="radioWrap"
v-model="form.contactNumber" v-model="form.contactNumber"
input-align="right" input-align="right"
@ -95,6 +97,7 @@
<div class="item"> <div class="item">
<span> <span class="star">*</span>售价</span> <span> <span class="star">*</span>售价</span>
<van-field <van-field
type="number"
style="border: none" style="border: none"
class="radioWrap" class="radioWrap"
v-model="form.maxPrice" v-model="form.maxPrice"
@ -174,18 +177,18 @@ export default {
}, },
radio: 0, radio: 0,
type:'',//1为发布&修改 2为审核 type:'',//1为发布&修改 2为审核
id:'',
queryType:'',
areaList: areaList, areaList: areaList,
areaShow:false, areaShow:false,
areaName:'',
noClick:true, noClick:true,
otherImgSrc:[],
id:'',
auditRemark:'', auditRemark:'',
auditReason:'', auditReason:'',
queryType:'', areaName:'',
vehicleLicensePhotoList:[], vehicleLicensePhotoList:[],
vehicleAnglePhotoList:[], vehicleAnglePhotoList:[],
otherImgSrcList:[], otherImgSrcList:[],
otherImgSrc:[],
status:'', status:'',
} }
}, },
@ -211,6 +214,12 @@ export default {
this.vehicleLicensePhotoList=[{url:res.data?.vehicleLicensePhoto}] this.vehicleLicensePhotoList=[{url:res.data?.vehicleLicensePhoto}]
this.vehicleAnglePhotoList=[{url:res.data?.vehicleAnglePhoto}] this.vehicleAnglePhotoList=[{url:res.data?.vehicleAnglePhoto}]
} }
this.form=JSON.parse(sessionStorage.getItem('formInfo'))
this.areaName=sessionStorage.getItem('areaName')
this.vehicleLicensePhotoList=JSON.parse(sessionStorage.getItem('vehicleLicensePhotoList'))
this.vehicleAnglePhotoList=JSON.parse(sessionStorage.getItem('vehicleAnglePhotoList'))
this.otherImgSrcList=JSON.parse(sessionStorage.getItem('otherImgSrcList'))
this.otherImgSrc=JSON.parse(sessionStorage.getItem('otherImgSrc'))
}, },
methods:{ methods:{
viewPrivacy(){ viewPrivacy(){
@ -226,6 +235,13 @@ export default {
url = 'https://crm1.sino-assist.com' url = 'https://crm1.sino-assist.com'
// url = 'http://localhost:8080' // url = 'http://localhost:8080'
} }
sessionStorage.setItem('formInfo',JSON.stringify(this.form))
sessionStorage.setItem('areaName',this.areaName)
sessionStorage.setItem('vehicleLicensePhotoList',JSON.stringify(this.vehicleLicensePhotoList))
sessionStorage.setItem('vehicleAnglePhotoList',JSON.stringify(this.vehicleAnglePhotoList))
sessionStorage.setItem('otherImgSrcList',JSON.stringify(this.otherImgSrcList))
sessionStorage.setItem('otherImgSrc',JSON.stringify(this.otherImgSrc))
let urls=url + '/h5/supplier/dispatch/res/privacy.html' let urls=url + '/h5/supplier/dispatch/res/privacy.html'
this.$router.push({ name: "privacyComponent", query: {url:urls}}) this.$router.push({ name: "privacyComponent", query: {url:urls}})
}, },
@ -296,7 +312,7 @@ export default {
}) })
setTimeout(()=>{ setTimeout(()=>{
this.closeParentDialog() this.closeParentDialog()
},2000) },1000)
} finally { } finally {
console.log(type) console.log(type)
} }
@ -320,6 +336,12 @@ export default {
this.$toast(flag) this.$toast(flag)
return return
} }
if (this.form.vehicleType=='拖车' && !this.form.boardType) {
this.$toast('落板方式不能为空')
return
}else{
this.form.boardType=''
}
let rule=this.validationRules.find(item=>!item.value) let rule=this.validationRules.find(item=>!item.value)
if(rule){ if(rule){
this.$toast(rule.name) this.$toast(rule.name)
@ -331,12 +353,21 @@ export default {
otherPhoto:this.otherImgSrc?.join(',') otherPhoto:this.otherImgSrc?.join(',')
}) })
if(res.code == 200 && !res.msg){ if(res.code == 200 && !res.msg){
sessionStorage.setItem('formInfo','')
sessionStorage.setItem('areaName','')
sessionStorage.setItem('vehicleLicensePhotoList','')
sessionStorage.setItem('vehicleAnglePhotoList','')
sessionStorage.setItem('otherImgSrcList','')
sessionStorage.setItem('otherImgSrc','')
this.$toast('发布完成')
if(this.isWebFunc()){ if(this.isWebFunc()){
setTimeout(()=>{ setTimeout(()=>{
this.closeParentDialog() this.closeParentDialog()
},2000) },1000)
}else{ }else{
this.h5GoBack() setTimeout(()=>{
this.$router.push({ name: "mineRelease",query:{activeTab : 1}})
},1000)
} }
}else{ }else{
this.$toast(res.msg) this.$toast(res.msg)
@ -367,7 +398,6 @@ export default {
validationRules() { validationRules() {
return [ return [
{ value: this.form.vehicleType, name: '车辆类型不能为空' }, { value: this.form.vehicleType, name: '车辆类型不能为空' },
{ value: this.form.boardType, name: '落板方式不能为空' },
{ value: this.form.emissionStandard, name: '排放标准不能为空' }, { value: this.form.emissionStandard, name: '排放标准不能为空' },
{ value: this.form.areaCode, name: '所在城市不能为空' }, { value: this.form.areaCode, name: '所在城市不能为空' },
{ value: this.form.mileage, name: '行驶里程不能为空' }, { value: this.form.mileage, name: '行驶里程不能为空' },
@ -549,6 +579,7 @@ export default {
font-weight: bold; font-weight: bold;
border-radius: 5px; border-radius: 5px;
color: #FFFFFF; color: #FFFFFF;
cursor: pointer;
} }
.btn{ .btn{
width: 296px; width: 296px;

View File

@ -16,11 +16,8 @@
<van-swipe-item v-for="(item,i) in imgSrcList" :key="i"> <van-swipe-item v-for="(item,i) in imgSrcList" :key="i">
<img v-if="item" class="swipeImg" :src="item" /> <img v-if="item" class="swipeImg" :src="item" />
</van-swipe-item> </van-swipe-item>
<van-swipe-item>
<img class="swipeImg" src="@/assets/secondHandCar/45angle.png" />
</van-swipe-item>
<template #indicator> <template #indicator>
<div class="custom-indicator">{{ current + 1 }}/{{(imgSrcList.length + 1)}}</div> <div class="custom-indicator">{{ current + 1 }}/{{imgSrcList.length}}</div>
</template> </template>
</van-swipe> </van-swipe>
<div class="infoWrap"> <div class="infoWrap">
@ -99,6 +96,7 @@
<script> <script>
import {myMixins} from "@/utils/myMixins" import {myMixins} from "@/utils/myMixins"
import {carInfoDetail,saveRecord} from "@/api/secondHandCar"; import {carInfoDetail,saveRecord} from "@/api/secondHandCar";
import { Dialog } from 'vant';
export default { export default {
name: "forSale", name: "forSale",
mixins:[myMixins], mixins:[myMixins],
@ -123,17 +121,21 @@ export default {
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
this.id=this.$route.query.id || urlParams.get('id'); this.id=this.$route.query.id || urlParams.get('id');
this.queryType=this.$route.query.queryType || urlParams.get('queryType'); this.queryType=this.$route.query.queryType || urlParams.get('queryType');
this.isList=this.$route.query.isList this.isList=this.$route.query.isList || urlParams.get('isList');
if( this.id){ if( this.id){
let res = await carInfoDetail({ let res = await carInfoDetail({
id:this.id, id:this.id,
queryType:this.queryType , queryType:this.queryType ,
}) })
this.detailInfo=res?.data this.detailInfo=res?.data
this.imgSrcList=res.data.otherPhoto?.split(',') || [] if(res.data.otherPhoto){
this.imgSrcList=res.data.otherPhoto.split(',') || []
}
this.imgSrcList.push(res?.data?.vehicleAnglePhoto)
console.log("this.imgSrcList",this.imgSrcList)
} }
}, },
beforeUnmount() { destroyed() {
this.getDuration() this.getDuration()
}, },
methods:{ methods:{
@ -159,12 +161,17 @@ export default {
await saveRecord({type:this.recordType,carInfoId:this.id,duration}) await saveRecord({type:this.recordType,carInfoId:this.id,duration})
}, },
handle(){ handle(){
this.recordType=2 Dialog.alert({
this.getDuration() message:this.detailInfo.contactNumber ,
window.location.href = `tel:${this.detailInfo.contactNumber}`; confirmButtonText:'拨打电话',
showCancelButton:true,
}).then(() => {
this.recordType=2
this.getDuration()
window.location.href = `tel:${this.detailInfo.contactNumber}`;
})
}, },
onChange(index) { onChange(index) {
console.log("index",index)
this.current = index; this.current = index;
}, },
} }

View File

@ -243,7 +243,7 @@ export default {
this.boardType = Number(sessionStorage.getItem('boardType')) || ''; this.boardType = Number(sessionStorage.getItem('boardType')) || '';
}, },
goMine(){//我的发布 goMine(){//我的发布
this.$router.push({ name: "mineRelease",}) this.$router.push({ name: "mineRelease",query:{activeTab : 1}})
}, },
viewCarSource(item){ viewCarSource(item){
if(this.activeTab===0){//车源查看 if(this.activeTab===0){//车源查看

View File

@ -3,7 +3,7 @@
<div class="headerWrap"> <div class="headerWrap">
<img class="bg" src="@/assets/secondHandCar/bg.png" /> <img class="bg" src="@/assets/secondHandCar/bg.png" />
<div class="nav"> <div class="nav">
<img class="back" @click="h5GoBack" src="@/assets/secondHandCar/back.png" /> <img class="back" @click="goPage('indexList',indexActiveTab)" src="@/assets/secondHandCar/back.png" />
<span>我的发布</span> <span>我的发布</span>
<div style="opacity: 0;" class="back"></div> <div style="opacity: 0;" class="back"></div>
</div> </div>
@ -99,10 +99,12 @@ export default {
pageNum:1, pageNum:1,
pageSize:10, pageSize:10,
total:'', total:'',
indexActiveTab:'',
} }
}, },
async mounted() { async mounted() {
this.activeTab = Number(sessionStorage.getItem('mineActiveTab')) || 1; this.activeTab =this.$route.query.activeTab || Number(sessionStorage.getItem('mineActiveTab')) || 1;
this.indexActiveTab=Number(sessionStorage.getItem('indexActiveTab')) || 0
await this.getCount() await this.getCount()
await this.getList() await this.getList()
}, },

View File

@ -34,7 +34,7 @@
> </van-field> > </van-field>
</div> </div>
</div> </div>
<div class="item"> <div class="item" v-if="form.vehicleType=='拖车'">
<span> <span class="star">*</span>落板方式 </span> <span> <span class="star">*</span>落板方式 </span>
<van-radio-group v-model="form.boardType" direction="horizontal" class="radioWrap"> <van-radio-group v-model="form.boardType" direction="horizontal" class="radioWrap">
<van-radio name="1" :class="{'checked':form.boardType==1}">全落地</van-radio> <van-radio name="1" :class="{'checked':form.boardType==1}">全落地</van-radio>
@ -43,7 +43,7 @@
<van-radio name="9" :class="{'checked':form.boardType==9}">不限</van-radio> <van-radio name="9" :class="{'checked':form.boardType==9}">不限</van-radio>
</van-radio-group> </van-radio-group>
</div> </div>
<div class="item"> <div class="item" >
<span> <span class="star">*</span>排放标准 </span> <span> <span class="star">*</span>排放标准 </span>
<van-radio-group v-model="form.emissionStandard" direction="horizontal" class="radioWrap"> <van-radio-group v-model="form.emissionStandard" direction="horizontal" class="radioWrap">
<van-radio name="4" :class="{'checked':form.emissionStandard==4}">国4</van-radio> <van-radio name="4" :class="{'checked':form.emissionStandard==4}">国4</van-radio>
@ -55,6 +55,7 @@
<div class="item"> <div class="item">
<span> <span class="star">*</span>联系号码 </span> <span> <span class="star">*</span>联系号码 </span>
<van-field <van-field
type="number"
class="radioWrap" class="radioWrap"
v-model="form.contactNumber" v-model="form.contactNumber"
input-align="right" input-align="right"
@ -64,12 +65,12 @@
<div class="item priceItem"> <div class="item priceItem">
<span> <span class="star">*</span>价格区间 </span> <span> <span class="star">*</span>价格区间 </span>
<div style="display: flex;align-items: center" class="price"> <div style="display: flex;align-items: center" class="price">
<el-input v-model="form.minPrice" > <el-input v-model.number="form.minPrice" >
<template slot="suffix" > <template slot="suffix" >
</template> </template>
</el-input> </el-input>
<span style="font-size: 14px;color: rgba(44, 61, 84, 0.59);margin: 0 6px">-</span> <span style="font-size: 14px;color: rgba(44, 61, 84, 0.59);margin: 0 6px">-</span>
<el-input v-model="form.maxPrice" > <el-input v-model.number="form.maxPrice" >
<template slot="suffix" > <template slot="suffix" >
</template> </template>
</el-input> </el-input>
@ -194,7 +195,7 @@ export default {
}) })
setTimeout(()=>{ setTimeout(()=>{
this.closeParentDialog() this.closeParentDialog()
},2000) },1000)
} finally { } finally {
console.log(type) console.log(type)
} }
@ -210,6 +211,12 @@ export default {
this.$toast(flag) this.$toast(flag)
return return
} }
if (this.form.vehicleType=='拖车' && !this.form.boardType) {
this.$toast('落板方式不能为空')
return
}else {
this.form.boardType=''
}
let rule=this.validationRules.find(item=>!item.value) let rule=this.validationRules.find(item=>!item.value)
if(rule){ if(rule){
this.$toast(rule.name) this.$toast(rule.name)
@ -220,12 +227,15 @@ export default {
...this.form, ...this.form,
}) })
if(res.code == 200 && !res.msg){ if(res.code == 200 && !res.msg){
this.$toast('发布完成')
if(this.isWebFunc()){ if(this.isWebFunc()){
setTimeout(()=>{ setTimeout(()=>{
this.closeParentDialog() this.closeParentDialog()
},2000) },1000)
}else{ }else{
this.h5GoBack() setTimeout(()=>{
this.$router.push({ name: "mineRelease",query:{activeTab : 1}})
},1000)
} }
}else{ }else{
this.$toast(res.msg) this.$toast(res.msg)
@ -253,7 +263,6 @@ export default {
validationRules() { validationRules() {
return [ return [
{ value: this.form.vehicleType, name: '车辆类型不能为空' }, { value: this.form.vehicleType, name: '车辆类型不能为空' },
{ value: this.form.boardType, name: '落板方式不能为空' },
{ value: this.form.emissionStandard, name: '排放标准不能为空' }, { value: this.form.emissionStandard, name: '排放标准不能为空' },
{ value: this.form.contactNumber, name: '联系方式不能为空' }, { value: this.form.contactNumber, name: '联系方式不能为空' },
{ value: this.form.minPrice, name: '售价不能为空' }, { value: this.form.minPrice, name: '售价不能为空' },
@ -437,6 +446,7 @@ export default {
font-weight: bold; font-weight: bold;
border-radius: 5px; border-radius: 5px;
color: #FFFFFF; color: #FFFFFF;
cursor: pointer;
} }
.btn{ .btn{
width: 296px; width: 296px;

View File

@ -53,6 +53,7 @@
<script> <script>
import {myMixins} from "@/utils/myMixins" import {myMixins} from "@/utils/myMixins"
import {carInfoDetail, saveRecord} from "@/api/secondHandCar"; import {carInfoDetail, saveRecord} from "@/api/secondHandCar";
import {Dialog} from "vant";
export default { export default {
name: "wantBuySale", name: "wantBuySale",
mixins:[myMixins], mixins:[myMixins],
@ -74,7 +75,7 @@ export default {
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
this.id=this.$route.query.id || urlParams.get('id'); this.id=this.$route.query.id || urlParams.get('id');
this.queryType=this.$route.query.queryType || urlParams.get('queryType'); this.queryType=this.$route.query.queryType || urlParams.get('queryType');
this.isList=this.$route.query.isList this.isList=this.$route.query.isList || urlParams.get('isList');
if( this.id) { if( this.id) {
let res = await carInfoDetail({ let res = await carInfoDetail({
id: this.id, id: this.id,
@ -83,15 +84,13 @@ export default {
this.detailInfo = res?.data this.detailInfo = res?.data
} }
}, },
beforeUnmount() { destroyed() {
this.getDuration() this.getDuration()
}, },
methods:{ methods:{
getDuration(){ getDuration(){
// 页面卸载时记录离开时间并计算浏览时长
const endTime = new Date(); const endTime = new Date();
const duration = (endTime - this.startTime) / 1000; // 计算时长(秒) const duration = (endTime - this.startTime) / 1000; // 计算时长(秒)
// console.log('页面卸载时间:', endTime);
console.log('浏览时长:', duration, '秒'); console.log('浏览时长:', duration, '秒');
this.saveRecord(duration); this.saveRecord(duration);
}, },
@ -99,9 +98,15 @@ export default {
await saveRecord({type:this.recordType,carInfoId:this.id,duration}) await saveRecord({type:this.recordType,carInfoId:this.id,duration})
}, },
handle(){ handle(){
this.recordType=2 Dialog.alert({
this.getDuration() message:this.detailInfo.contactNumber ,
window.location.href = `tel:${this.detailInfo.contactNumber}`; confirmButtonText:'拨打电话',
showCancelButton:true,
}).then(() => {
this.recordType=2
this.getDuration()
window.location.href = `tel:${this.detailInfo.contactNumber}`;
})
}, },
} }
} }