|
|
@@ -60,7 +60,7 @@
|
|
|
|
|
|
<view class="body">
|
|
|
<!-- 优选民宿区域 -->
|
|
|
- <view class="body_top" v-if="hotelList.length">
|
|
|
+ <view class="body_top" v-if="hotelList_you.length">
|
|
|
<view class="circle"></view>
|
|
|
<view class="circle color"></view>
|
|
|
<view class="top_title">优选民宿 .</view>
|
|
|
@@ -72,7 +72,7 @@
|
|
|
</view>
|
|
|
<view class="body_list">
|
|
|
<!-- 每一个民宿区域 -->
|
|
|
- <view class="list_item" v-for="item in hotelList.slice(0, 4)" :key="item.id" @click="goPageDetail(item)">
|
|
|
+ <view class="list_item" v-for="(item, index) in hotelList_you" :key="index" @click="goPageDetail(item)">
|
|
|
<image class="item-img" :src="item.coverImg" mode="scaleToFill"></image>
|
|
|
<view class="descrition">
|
|
|
<text class="title">{{ item.hotel_name }}</text>
|
|
|
@@ -286,8 +286,10 @@ export default {
|
|
|
placeIndex: 0,
|
|
|
// 选择乡镇弹窗数据
|
|
|
popList: [],
|
|
|
- // 民宿列表数组
|
|
|
+ // 精选民宿列表数组
|
|
|
hotelList: [],
|
|
|
+ // 优选民宿列表数组
|
|
|
+ hotelList_you: [],
|
|
|
// 当前乡镇
|
|
|
town: '',
|
|
|
// 民宿级别
|
|
|
@@ -339,7 +341,7 @@ export default {
|
|
|
onReachBottom() {
|
|
|
if (this.hotelList.length < this.total) {
|
|
|
this.page++
|
|
|
- this.getHotelList()
|
|
|
+ this.getHotelList_jing()
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '没有更多数据了',
|
|
|
@@ -410,8 +412,8 @@ export default {
|
|
|
data: {
|
|
|
curPage: 1,
|
|
|
pageSize: 4,
|
|
|
- hot: 1,
|
|
|
- state:1
|
|
|
+ hot: 1,
|
|
|
+ state: 1
|
|
|
}
|
|
|
})
|
|
|
// console.log(res)
|
|
|
@@ -478,7 +480,8 @@ export default {
|
|
|
this.myLat = res.latitude
|
|
|
this.myLng = res.longitude
|
|
|
this.showdDistance = true
|
|
|
- this.getHotelList()
|
|
|
+ this.getHotelList_you()
|
|
|
+ this.getHotelList_jing()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -497,7 +500,8 @@ export default {
|
|
|
})
|
|
|
} else {
|
|
|
this.showdDistance = false
|
|
|
- this.getHotelList()
|
|
|
+ this.getHotelList_you()
|
|
|
+ this.getHotelList_jing()
|
|
|
uni.showToast({
|
|
|
title: '获取定位权限失败',
|
|
|
icon: 'none'
|
|
|
@@ -514,7 +518,8 @@ export default {
|
|
|
this.myLat = res.latitude
|
|
|
this.myLng = res.longitude
|
|
|
this.showdDistance = true
|
|
|
- this.getHotelList()
|
|
|
+ this.getHotelList_you()
|
|
|
+ this.getHotelList_jing()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
@@ -547,16 +552,39 @@ export default {
|
|
|
}, 1500)
|
|
|
}
|
|
|
},
|
|
|
- // 获取民宿列表
|
|
|
- async getHotelList() {
|
|
|
+ // 获取民宿列表 优选
|
|
|
+ async getHotelList_you() {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/mhotel/ahppreferredPage.action',
|
|
|
+ data: {
|
|
|
+ page: 1,
|
|
|
+ rows: 4,
|
|
|
+ type: 3,
|
|
|
+ userId: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').id : ''
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // console.log(res)
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.hotelList_you = res.data.pageList
|
|
|
+
|
|
|
+ // 如果定位成功则获取和民宿之间的距离
|
|
|
+ if (this.showdDistance && this.hotelList_you.length) {
|
|
|
+ this.hotelList_you.forEach((ele) => {
|
|
|
+ let lat = ele.hpositionWens.split(',')[0]
|
|
|
+ let lng = ele.hpositionWens.split(',')[1]
|
|
|
+ ele.distance = this.calculateDistance(lat, lng)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取民宿列表 精选
|
|
|
+ async getHotelList_jing() {
|
|
|
const res = await this.$myRequest({
|
|
|
- url: '/mhotel/ahphomePage.action',
|
|
|
+ url: '/mhotel/ahpselectedPage.action',
|
|
|
data: {
|
|
|
- // queryValue: this.keywords,
|
|
|
page: this.page,
|
|
|
rows: this.rows,
|
|
|
type: 3,
|
|
|
- // hotel_township: this.placeList[this.placeIndex].id || '',
|
|
|
userId: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').id : ''
|
|
|
}
|
|
|
})
|
|
|
@@ -573,7 +601,6 @@ export default {
|
|
|
ele.distance = this.calculateDistance(lat, lng)
|
|
|
})
|
|
|
}
|
|
|
- this.$refs.popup_sale.open()
|
|
|
}
|
|
|
},
|
|
|
handleOpen() {
|