| xqd
@@ -261,7 +261,8 @@
|
|
|
beginConfig:{
|
|
|
isBegin: true,
|
|
|
hotel_id: 0
|
|
|
- }
|
|
|
+ },
|
|
|
+ randomNum: 0
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
| xqd
@@ -274,7 +275,6 @@
|
|
|
this.search.currentSelected = category_ids.split(",")
|
|
|
this.search.selected = Object.assign(this.search.currentSelected)
|
|
|
}
|
|
|
- console.log(hotel_id,category_ids)
|
|
|
//获取经纬度
|
|
|
this.getHotelCategory()
|
|
|
|
| xqd
@@ -346,9 +346,10 @@
|
|
|
goLocation(){
|
|
|
uni.getLocation({
|
|
|
type: "gcj02", //返回可以用于wx.openLocation的经纬度
|
|
|
- success: (res) => {
|
|
|
+ success: (res) => {
|
|
|
+ this.randomNum = Math.floor(Math.random() * 100) / 1000000;
|
|
|
this.geo = {
|
|
|
- latitude: res.latitude + Math.random()/10000000,
|
|
|
+ latitude: res.latitude + this.randomNum,
|
|
|
longitude: res.longitude
|
|
|
}
|
|
|
},
|
| xqd
@@ -361,11 +362,12 @@
|
|
|
updated() {
|
|
|
uni.getLocation({
|
|
|
type: "gcj02", //返回可以用于wx.openLocation的经纬度
|
|
|
- success: (res) => {
|
|
|
+ success: (res) => {
|
|
|
+ this.randomNum = Math.floor(Math.random() * 100) / 1000000;
|
|
|
this.geo = {
|
|
|
- latitude: res.latitude + Math.random()/10000000,
|
|
|
+ latitude: res.latitude + this.randomNum,
|
|
|
longitude: res.longitude
|
|
|
- }
|
|
|
+ }
|
|
|
this.getList(true)
|
|
|
//获取酒店列表
|
|
|
},
|
| xqd
@@ -395,7 +397,7 @@
|
|
|
}
|
|
|
})
|
|
|
tempHotelList.map(item=>{
|
|
|
- item.distanceToMe=this.$utils.calcDistance(this.latitude,this.longitude,item.latitude,item.longitude).toFixed(1);
|
|
|
+ item.distanceToMe=this.$utils.calcDistance(this.geo.latitude,this.geo.longitude,item.latitude,item.longitude).toFixed(1);
|
|
|
return item;
|
|
|
})
|
|
|
this.hotelList.push(...tempHotelList)
|
| xqd
@@ -425,7 +427,7 @@
|
|
|
})
|
|
|
}
|
|
|
if(this.geo.latitude&&this.geo.longitude){
|
|
|
- tempobj['latitude'] = this.geo.latitude;
|
|
|
+ tempobj['latitude'] = this.geo.latitude - this.randomNum;
|
|
|
tempobj['longitude'] = this.geo.longitude;
|
|
|
}
|
|
|
if(this.search.text){
|