二手车交易,测试优化

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
<div class="headerWrap">
<img class="bg" src="@/assets/secondHandCar/bg.png" />
<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>
<div style="opacity: 0;" class="back"></div>
</div>
@ -99,10 +99,12 @@ export default {
pageNum:1,
pageSize:10,
total:'',
indexActiveTab:'',
}
},
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.getList()
},

View File

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

View File

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