diff --git a/src/views/secondHandCar/forSale.vue b/src/views/secondHandCar/forSale.vue index 268f1be7..9def4c11 100644 --- a/src/views/secondHandCar/forSale.vue +++ b/src/views/secondHandCar/forSale.vue @@ -68,7 +68,7 @@
- {{ detailInfo.mileage}}公里 + {{ formatToWan(detailInfo.mileage)}}公里 行驶公里
@@ -84,7 +84,7 @@
{{detailInfo.desc}}
-
我想要
+
我想要
@@ -108,15 +108,17 @@ export default { duration:'', startTime: null, // 记录进入时间 recordType:1, + isList:false,//是否是首页列表跳转过来的 } }, async mounted() { - console.log(" localStorage.setItem('indexActiveTab', this.activeTab);", localStorage.getItem('indexActiveTab')) + // console.log(" localStorage.setItem('indexActiveTab', this.activeTab);", localStorage.getItem('indexActiveTab')) // 页面加载时记录进入时间 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'); + this.isList=this.$route.query.isList if( this.id){ let res = await carInfoDetail({ id:this.id, @@ -130,6 +132,16 @@ export default { this.getDuration() }, methods:{ + formatToWan(num) { + let result = (num / 10000).toString(); + if (result.includes('.')) { + let decimalPart = result.split('.')[1]; + if (decimalPart.length > 2) { + result = parseFloat(result).toFixed(2); + } + } + return result + '万'; + }, getDuration(){ // 页面卸载时记录离开时间并计算浏览时长 const endTime = new Date(); diff --git a/src/views/secondHandCar/indexList.vue b/src/views/secondHandCar/indexList.vue index 103a8b54..84168431 100644 --- a/src/views/secondHandCar/indexList.vue +++ b/src/views/secondHandCar/indexList.vue @@ -210,9 +210,9 @@ export default { }, viewCarSource(item){ if(this.activeTab===0){//车源查看 - this.$router.push({ name: "forSale", query: {type:1 , id:item.id,queryType:1 }}) + this.$router.push({ name: "forSale", query: {type:1 , id:item.id,queryType:1,isList:true }}) }else{//求购查看 - this.$router.push({ name: "wantBuySale", query: { type:1 ,id:item.id ,queryType:2}}) + this.$router.push({ name: "wantBuySale", query: { type:1 ,id:item.id ,queryType:2,isList:true}}) } this.setSearchVal(); }, diff --git a/src/views/secondHandCar/mineRelease.vue b/src/views/secondHandCar/mineRelease.vue index 6989553a..56f4f5fa 100644 --- a/src/views/secondHandCar/mineRelease.vue +++ b/src/views/secondHandCar/mineRelease.vue @@ -106,7 +106,7 @@ export default { itemHandle(item){//审核 this.$router.push({ name: item.type==1 ? "forSale" : 'wantBuySale', - query: { id:item.id,queryType:3}, + query: { id:item.id,queryType:3,isList:false}, }) sessionStorage.setItem('mineActiveTab',String(this.activeTab) ) }, diff --git a/src/views/secondHandCar/wantBuySale.vue b/src/views/secondHandCar/wantBuySale.vue index 93eea6be..28cc3939 100644 --- a/src/views/secondHandCar/wantBuySale.vue +++ b/src/views/secondHandCar/wantBuySale.vue @@ -45,7 +45,7 @@
{{detailInfo.desc}}
-
我有车源
+
我有车源
@@ -65,6 +65,7 @@ export default { duration:'', startTime: null, // 记录进入时间 recordType:1, + isList:false, } }, async mounted() { @@ -73,6 +74,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 if( this.id) { let res = await carInfoDetail({ id: this.id,