| xqd
@@ -49,9 +49,9 @@
|
|
|
<!-- 选择地区 -->
|
|
|
<view class="search-detail" v-if="!isSelectArea">
|
|
|
<view class="search-detail-area">
|
|
|
- <view class="areaTitle" v-for="(item,index) in areaList" :key="index" @click="checked(index)">
|
|
|
- <view :class="{'active-area':isActive === index}">
|
|
|
- {{item.title}}
|
|
|
+ <view class="areaTitle" v-for="(item,index) in search.content.area" :key="item.id" @click="checked(item.id,'area')">
|
|
|
+ <view :class="{'active-area':search.area === item.id}">
|
|
|
+ {{item.name}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
| xqd
@@ -67,9 +67,9 @@
|
|
|
<!-- 选择品牌-->
|
|
|
<view class="search-detail" v-if="!isSelectBrand">
|
|
|
<view class="search-detail-area">
|
|
|
- <view class="areaTitle" v-for="(item,index) in brandList" :key="index" @click="checked(index)">
|
|
|
- <view :class="{'active-area':isActive === index}">
|
|
|
- {{item.title}}
|
|
|
+ <view class="areaTitle" v-for="(item,index) in search.content.brand" :key="item.id" @click="checked(item.id,'brand')">
|
|
|
+ <view :class="{'active-area':search.brand === item.id}">
|
|
|
+ {{item.name}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
| xqd
@@ -93,8 +93,13 @@
|
|
|
mode=""></image>
|
|
|
</view>
|
|
|
<view class="partner-main" v-if="isPartner">
|
|
|
- <uni-data-checkbox multiple v-model="value" :localdata="partner" @change="change">
|
|
|
- </uni-data-checkbox>
|
|
|
+ <uni-data-checkbox multiple
|
|
|
+ v-model="value"
|
|
|
+ :localdata="search.content.coop"
|
|
|
+ emptyText="无"
|
|
|
+ :map="{text: 'name',value: 'name'}"
|
|
|
+ @change="change"
|
|
|
+ />
|
|
|
</view>
|
|
|
|
|
|
<view class="partner-top" style="border-top: none;" @click="selectJoin">
|
| xqd
@@ -105,8 +110,13 @@
|
|
|
mode=""></image>
|
|
|
</view>
|
|
|
<view class="partner-main" v-if="isJoin">
|
|
|
- <uni-data-checkbox multiple v-model="value" :localdata="partner" @change="change">
|
|
|
- </uni-data-checkbox>
|
|
|
+ <uni-data-checkbox multiple
|
|
|
+ v-model="value"
|
|
|
+ :localdata="search.content.league"
|
|
|
+ emptyText="无"
|
|
|
+ :map="{text: 'name',value: 'name'}"
|
|
|
+ @change="change"
|
|
|
+ />
|
|
|
</view>
|
|
|
|
|
|
<view class="search-detail-btn">
|
| xqd
@@ -233,6 +243,7 @@
|
|
|
return {
|
|
|
scrolls:{scrollX: 0},
|
|
|
hotelList:[],
|
|
|
+ hotelListBase:[],
|
|
|
//门店在地图上的标记 以下字段必填
|
|
|
markers: [],
|
|
|
//经纬度
|
| xqd
@@ -290,27 +301,20 @@
|
|
|
title: 'JavaScript'
|
|
|
}],
|
|
|
//地区
|
|
|
- areaList: [{
|
|
|
- title: '重庆'
|
|
|
- }, {
|
|
|
- title: '成都'
|
|
|
- }, {
|
|
|
- title: '绵阳'
|
|
|
- }, {
|
|
|
- title: '广汉'
|
|
|
- }, {
|
|
|
- title: '内江'
|
|
|
- }, {
|
|
|
- title: '宜宾'
|
|
|
- }, {
|
|
|
- title: '大理'
|
|
|
- }, {
|
|
|
- title: '自贡'
|
|
|
- }, {
|
|
|
- title: '贵州'
|
|
|
- }, {
|
|
|
- title: '泸州'
|
|
|
- }],
|
|
|
+ search:{
|
|
|
+ area: "",
|
|
|
+ brand: "",
|
|
|
+ coop: [],
|
|
|
+ league: [],
|
|
|
+ isActiveIds:[3,26],
|
|
|
+ content: {
|
|
|
+ area: [],
|
|
|
+ brand: [],
|
|
|
+ coop: [],
|
|
|
+ league: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ areaList: [],
|
|
|
//激活指定table菜单
|
|
|
isActive: 0,
|
|
|
//展开搜索
|
| xqd
@@ -330,13 +334,19 @@
|
|
|
onLoad() {
|
|
|
//获取经纬度
|
|
|
this.updated()
|
|
|
-
|
|
|
- this.$api.hotel.getHotelCategory().then(res=>{
|
|
|
- console.log(res)
|
|
|
- })
|
|
|
+ this.getHotelCategory()
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ //获取筛选数据
|
|
|
+ getHotelCategory(){
|
|
|
+ this.$api.hotel.getHotelCategory().then(res=>{
|
|
|
+ if(res.code !== 0) return;
|
|
|
+ this.search.content.area = res.data[0]?.sub;
|
|
|
+ this.search.content.brand = res.data[1]?.sub;
|
|
|
+ this.search.content.coop = res.data[2]?.sub;
|
|
|
+ })
|
|
|
+ },
|
|
|
goLocation(){
|
|
|
let _this = this
|
|
|
uni.getLocation({
|
| xqd
@@ -345,8 +355,8 @@
|
|
|
_this.latitude = res.latitude
|
|
|
_this.longitude = res.longitude
|
|
|
_this.$refs.map.goLocation(res.latitude,res.longitude)
|
|
|
- //获取酒店列表
|
|
|
- _this.getList()
|
|
|
+ // //获取酒店列表
|
|
|
+ // _this.getList()
|
|
|
},
|
|
|
fail: function(res) {
|
|
|
console.log(res)
|
| xqd
@@ -411,6 +421,13 @@
|
|
|
this.$api.hotel.getHotelList({
|
|
|
page: 1
|
|
|
}).then(res => {
|
|
|
+ // this.hotelListBase = res.data.data
|
|
|
+ // this.hotelList = []
|
|
|
+ // this.hotelListBase.forEach(item=>{
|
|
|
+ // if(this.search.isActiveIds.find(item.category_id)){
|
|
|
+ // this.hotelList.push(item)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
this.hotelList = res.data.data
|
|
|
this.markers = this.hotelList.map(item=>{
|
|
|
const distance =this.calcDistanceFromHotel({x0:this.latitude, y0:this.longitude}, {x1:item.latitude,y1:item.longitude}).toFixed(1);
|
| xqd
@@ -476,21 +493,29 @@
|
|
|
console.log('e:', e);
|
|
|
},
|
|
|
//菜单index切换
|
|
|
- checked(index) {
|
|
|
- this.isActive = index
|
|
|
+ checked(id,categoreName) {
|
|
|
+ const tempSet = new Set(this.search.isActiveIds);
|
|
|
+ tempSet.add(id);
|
|
|
+ this.search[categoreName] = id;
|
|
|
+ this.search.isActiveIds = Object.assign(Array.from(tempSet));
|
|
|
},
|
|
|
//展开地区选择
|
|
|
openArea() {
|
|
|
- console.log(111);
|
|
|
this.isSelectArea = !this.isSelectArea
|
|
|
+ this.isSelectBrand = true
|
|
|
+ this.isSelectSift = true
|
|
|
},
|
|
|
//展开品牌选择
|
|
|
openBrand() {
|
|
|
this.isSelectBrand = !this.isSelectBrand
|
|
|
+ this.isSelectArea = true
|
|
|
+ this.isSelectSift = true
|
|
|
},
|
|
|
//展开筛选选择
|
|
|
openSift() {
|
|
|
this.isSelectSift = !this.isSelectSift
|
|
|
+ this.isSelectBrand = true
|
|
|
+ this.isSelectArea = true
|
|
|
},
|
|
|
//下面酒店位移
|
|
|
moveToMarkId(markId){
|