| xqd
@@ -103,7 +103,7 @@
|
|
|
</view>
|
|
|
<view class="address">
|
|
|
<view style="height:1300rpx;">
|
|
|
- <hch-position ref="map" :markers="hotelList" :geo="geo" @moveToMarkId="moveToMarkId"/>
|
|
|
+ <hch-position ref="map" :geo="geo" @moveToMarkId="moveToMarkId" @rendered="mapRendered"/>
|
|
|
</view>
|
|
|
<view class="address-nav" style="overflow-x: visible; height:318rpx;">
|
|
|
<!-- 遮挡地图修正
|
| xqd
@@ -121,7 +121,7 @@
|
|
|
</view>
|
|
|
<!-- @scroll="bottomScroll" -->
|
|
|
<view style="width: calc(100% + 32rpx);margin-left: -16rpx;z-index:10">
|
|
|
- <scroll-hotel ref="scrollHotel" :hotelList="hotelList" @updateIndex="updateMapIndex"/>
|
|
|
+ <scroll-hotel ref="scrollHotel" :hotelList="hotelList" @updateIndex="updateMapIndex" @goBook="goBook"/>
|
|
|
</view>
|
|
|
|
|
|
<view class="address-nav-button" @click="goLocation">
|
| xqd
@@ -251,6 +251,7 @@
|
|
|
activeIndex:0
|
|
|
},
|
|
|
beginConfig:{
|
|
|
+ isBegin: true,
|
|
|
hotel_id: 0
|
|
|
}
|
|
|
}
|
| xqd
@@ -265,18 +266,11 @@
|
|
|
this.search.currentSelected = category_ids.split(",")
|
|
|
this.search.selected = Object.assign(this.search.currentSelected)
|
|
|
}
|
|
|
+ console.log(hotel_id,category_ids)
|
|
|
//获取经纬度
|
|
|
this.getHotelCategory()
|
|
|
- uni.getSystemInfo({
|
|
|
- success:(res)=>{
|
|
|
- this.screenWidth = res.screenWidth
|
|
|
- }
|
|
|
- })
|
|
|
},
|
|
|
methods: {
|
|
|
- touchMove(e){
|
|
|
- console.log(e)
|
|
|
- },
|
|
|
syncSearchInput(e){
|
|
|
this.search.text = e
|
|
|
},
|
| xqd
@@ -330,14 +324,13 @@
|
|
|
})
|
|
|
},
|
|
|
goLocation(){
|
|
|
- let _this = this
|
|
|
uni.getLocation({
|
|
|
type: "gcj02", //返回可以用于wx.openLocation的经纬度
|
|
|
success: (res) => {
|
|
|
- this.geo = Object.assign({
|
|
|
+ this.geo = {
|
|
|
latitude: res.latitude + Math.random()/100000,
|
|
|
longitude: res.longitude
|
|
|
- })
|
|
|
+ }
|
|
|
},
|
|
|
fail: function(res) {
|
|
|
console.log(res)
|
| xqd
@@ -346,13 +339,14 @@
|
|
|
},
|
|
|
//在地图渲染更新完成时触发的方法
|
|
|
updated() {
|
|
|
- let _this = this
|
|
|
uni.getLocation({
|
|
|
type: "gcj02", //返回可以用于wx.openLocation的经纬度
|
|
|
- success: function(res) {
|
|
|
- _this.latitude = res.latitude
|
|
|
- _this.longitude = res.longitude
|
|
|
- _this.getList(true)
|
|
|
+ success: (res) => {
|
|
|
+ this.geo = {
|
|
|
+ latitude: res.latitude + Math.random()/100000,
|
|
|
+ longitude: res.longitude
|
|
|
+ }
|
|
|
+ this.getList(true)
|
|
|
//获取酒店列表
|
|
|
},
|
|
|
fail: function(res) {
|
| xqd
@@ -368,30 +362,15 @@
|
|
|
const tempHotelList = res.data.data.map(item=>{
|
|
|
item.logo = this.$utils.toHttps(item.logo);
|
|
|
return {
|
|
|
- ...item,
|
|
|
+ ...item,
|
|
|
marker:{
|
|
|
id:item.id,
|
|
|
latitude: item.latitude,
|
|
|
longitude: item.longitude,
|
|
|
- width:'34rpx',
|
|
|
- height:'40rpx',
|
|
|
- iconPath:'../../static/icon/late02.png' ,
|
|
|
- active: {
|
|
|
- width: '90rpx',
|
|
|
- height: '100rpx',
|
|
|
- iconPath: item.logo,
|
|
|
- },
|
|
|
- noActive:{
|
|
|
- width:'34rpx',
|
|
|
- height:'40rpx',
|
|
|
- iconPath:'../../static/icon/late02.png' ,
|
|
|
- },
|
|
|
- callout1: {
|
|
|
- content:item.name,
|
|
|
- borderRadius: 10,
|
|
|
- padding: 10,
|
|
|
- display: "ALWAYS",
|
|
|
- },
|
|
|
+ iconPath: '../../static/icon/late02.png',
|
|
|
+ activeIconPath: item.logo,
|
|
|
+ width: '34rpx',
|
|
|
+ height: '40rpx',
|
|
|
}
|
|
|
}
|
|
|
})
|
| xqd
@@ -400,8 +379,21 @@
|
|
|
return item;
|
|
|
})
|
|
|
this.hotelList.push(...tempHotelList)
|
|
|
+ this.$refs.map.updateContent(tempHotelList, false);
|
|
|
if(res.data.data.length >= 15){
|
|
|
this.requestHotelPage(tempobj);
|
|
|
+ }else if(this.beginConfig.hotel_id&&this.beginConfig.isBegin){
|
|
|
+ let targetIndex = 0;
|
|
|
+
|
|
|
+ for(const k in this.hotelList){
|
|
|
+ if(this.hotelList[k].id == this.beginConfig.hotel_id){
|
|
|
+ targetIndex = k;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.$refs.map.markertap(targetIndex, true, true);
|
|
|
+ }, 1000)
|
|
|
}
|
|
|
})
|
|
|
},
|
| xqd
@@ -412,9 +404,9 @@
|
|
|
tempobj[`category_ids[${index}]`] = item
|
|
|
})
|
|
|
}
|
|
|
- if(this.latitude&&this.longitude){
|
|
|
- tempobj['latitude'] = this.latitude;
|
|
|
- tempobj['longitude'] = this.longitude;
|
|
|
+ if(this.geo.latitude&&this.geo.longitude){
|
|
|
+ tempobj['latitude'] = this.geo.latitude;
|
|
|
+ tempobj['longitude'] = this.geo.longitude;
|
|
|
}
|
|
|
if(this.search.text){
|
|
|
tempobj['name'] = this.search.text;
|
| xqd
@@ -437,33 +429,37 @@
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- if(res.data.data.length <= 0) return;
|
|
|
this.hotelList.map((item,index)=>{
|
|
|
item.distanceToMe=this.$utils.calcDistance(this.latitude,this.longitude,item.latitude,item.longitude).toFixed(1);
|
|
|
return item;
|
|
|
- })
|
|
|
- // this.hotelList.sort((prev,next)=>{
|
|
|
- // return prev.distanceToMe-next.distanceToMe;
|
|
|
- // })
|
|
|
- if(islocal){
|
|
|
- this.$refs.map.goLocation(this.latitude,this.longitude)
|
|
|
- }
|
|
|
- setTimeout(()=>{
|
|
|
- if(!this.beginConfig.hotel_id){
|
|
|
- this.$refs.map.markertap(0,true,this.search.isSearch)
|
|
|
- this.beginConfig.hotel_id = 0
|
|
|
- this.search.isSearch = false
|
|
|
- }else{
|
|
|
- this.localToMark(this.beginConfig.hotel_id,index);
|
|
|
- // this.$refs.map.markertap({markerId: this.beginConfig.hotel_id})
|
|
|
- this.beginConfig.hotel_id = 0
|
|
|
- }
|
|
|
- }, 300)
|
|
|
+ })
|
|
|
+ this.$refs.map.updateContent(this.hotelList, true);
|
|
|
if(res.data.data.length >= 15){
|
|
|
this.requestHotelPage(tempobj)
|
|
|
+ }else if(this.beginConfig.hotel_id&&this.beginConfig.isBegin){
|
|
|
+ let targetIndex = 0;
|
|
|
+
|
|
|
+ for(const k in this.hotelList){
|
|
|
+ if(this.hotelList[k].id == this.beginConfig.hotel_id){
|
|
|
+ targetIndex = k;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.$refs.map.markertap(targetIndex, true, true);
|
|
|
+ }, 500)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ mapRendered(){
|
|
|
+ if((this.beginConfig.isBegin && !this.beginConfig.hotel_id)||this.search.isSearch){
|
|
|
+ this.beginConfig.isBegin = false
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.$refs.map.markertap(0,true,this.search.isSearch)
|
|
|
+ this.search.isSearch = false
|
|
|
+ },500)
|
|
|
+ }
|
|
|
+ },
|
|
|
//去预定页面
|
|
|
goBook(index) {
|
|
|
if(!this.$store.getters.userInfo){
|
| xqd
@@ -583,7 +579,7 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|