二手车交易,公里转化数值转化
This commit is contained in:
@ -68,7 +68,7 @@
|
||||
</div>
|
||||
<div class="suGang"></div>
|
||||
<div class="itemInfo">
|
||||
<span>{{ detailInfo.mileage}}公里</span>
|
||||
<span>{{ formatToWan(detailInfo.mileage)}}公里</span>
|
||||
<span>行驶公里</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -84,7 +84,7 @@
|
||||
<div class="descCommon desc">{{detailInfo.desc}}</div>
|
||||
</div>
|
||||
<div class="btnWrap" >
|
||||
<div class="btn commonBtn" @click="noMultipleClicks(handle)">我想要</div>
|
||||
<div v-if="isList" class="btn commonBtn" @click="noMultipleClicks(handle)">我想要</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -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();
|
||||
|
@ -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();
|
||||
},
|
||||
|
@ -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) )
|
||||
},
|
||||
|
@ -45,7 +45,7 @@
|
||||
</div>
|
||||
<div class="descCommon desc">{{detailInfo.desc}}</div>
|
||||
</div>
|
||||
<div class="btn" @click="noMultipleClicks(handle)">我有车源</div>
|
||||
<div v-if="isList" class="btn" @click="noMultipleClicks(handle)">我有车源</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -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,
|
||||
|
Reference in New Issue
Block a user