二手车交易,全部接口对接

This commit is contained in:
2025-03-12 09:32:57 +08:00
parent 76c6d6ef5b
commit 5371e43b53
9 changed files with 380 additions and 188 deletions

View File

@ -31,7 +31,7 @@
<span>{{ detailInfo.createTime?.substring(0,10) }}</span><span>{{ detailInfo.areaName }}</span><span>发布</span>
</div>
<div class="price">
<span>{{ detailInfo.maxPrice / 10000 }}</span>
<span>{{ formatNumber(detailInfo.maxPrice) }}</span>
<span></span>
</div>
</div>
@ -92,7 +92,7 @@
<script>
import {myMixins} from "@/utils/myMixins"
import {carInfoDetail} from "@/api/secondHandCar";
import {carInfoDetail,saveRecord} from "@/api/secondHandCar";
export default {
name: "forSale",
mixins:[myMixins],
@ -104,11 +104,17 @@ export default {
queryType:'',
detailInfo:'',
imgSrcList:[],
duration:'',
startTime: null, // 记录进入时间
recordType:1,
}
},
async mounted() {
this.id=this.$route.query.id
this.queryType=this.$route.query.queryType
// 页面加载时记录进入时间
this.startTime = new Date();
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');
if( this.id){
let res = await carInfoDetail({
id:this.id,
@ -116,22 +122,30 @@ export default {
})
this.detailInfo=res?.data
this.imgSrcList=res.data.otherPhoto?.split(',') || []
console.log("=",res,this.imgSrcList)
/*this.form={...res.data}
this.form.licenseType=res.data.licenseType?.code
this.form.boardType=res.data.boardType?.code
this.form.emissionStandard=res.data.emissionStandard?.code
this.auditRemark=res.data?.auditRemark
this.areaName=res.data?.areaName*/
}
},
beforeUnmount() {
this.getDuration()
},
methods:{
onChange(index) {
this.current = index;
getDuration(){
// 页面卸载时记录离开时间并计算浏览时长
const endTime = new Date();
const duration = (endTime - this.startTime) / 1000; // 计算时长(秒)
// console.log('页面卸载时间:', endTime);
console.log('浏览时长:', duration, '秒');
this.saveRecord(duration);
},
async saveRecord(duration){
await saveRecord({type:this.recordType,carInfoId:this.id,duration})
},
handle(){
this.recordType=2
this.getDuration()
window.location.href = `tel:${this.detailInfo.contactNumber}`;
},
onChange(index) {
this.current = index;
},
}
}