|
|
|
@ -3,7 +3,7 @@ |
|
|
|
|
<view class="v-pages-search bg"> |
|
|
|
|
<view class="search_box row flex-align-center"> |
|
|
|
|
<view class="col"> |
|
|
|
|
<input @input="write" type="text" class="input" @confirm="confirm" confirm-type="search" |
|
|
|
|
<input @input="write" type="text" class="input" confirm-type="search" |
|
|
|
|
color="#A0A7B2" placeholder-style="color:#999" placeholder="请输入民宿名称搜索" /> |
|
|
|
|
</view> |
|
|
|
|
<view class="btn_img" @click="search()"> |
|
|
|
@ -59,7 +59,7 @@ |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
that = this; |
|
|
|
|
return { |
|
|
|
|
return { |
|
|
|
|
searchItemClass: 'search-tip-item', |
|
|
|
|
pageClass: { |
|
|
|
|
sortItemClass: 'sort-item', |
|
|
|
@ -163,248 +163,19 @@ |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
write: function(e) { |
|
|
|
|
this.searchTitle = e.detail.value; |
|
|
|
|
}, |
|
|
|
|
search: function() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true |
|
|
|
|
}); |
|
|
|
|
this.initData(); |
|
|
|
|
this.get_data(); |
|
|
|
|
}, |
|
|
|
|
// |
|
|
|
|
back() { |
|
|
|
|
uni.navigateBack({ |
|
|
|
|
delta: 1 |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
showMenu() { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '菜单' |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
clickLeft() { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '左侧按钮' |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
showCity() { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '选择城市' |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
scan() { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '扫码' |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
confirm(e) { |
|
|
|
|
this.searchTitle = e.detail.value; |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true |
|
|
|
|
}); |
|
|
|
|
search: function() { |
|
|
|
|
this.initData(); |
|
|
|
|
this.get_data(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
|
|
callGpsSuccess: function(lat, lng) { |
|
|
|
|
that.$param.clat = lat; |
|
|
|
|
that.$param.clng = lng; |
|
|
|
|
that.latitude = lat; |
|
|
|
|
that.longitude = lng; |
|
|
|
|
that.get_data(); |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
that.$util.unbindGpsObj(); |
|
|
|
|
}, |
|
|
|
|
callGpsFail: function() { |
|
|
|
|
that.latitude = this.$param.lat; |
|
|
|
|
that.longitude = this.$param.lng; |
|
|
|
|
that.get_data(); |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
this.$util.unbindGpsObj(); |
|
|
|
|
}, |
|
|
|
|
requestLocation: function(region) { |
|
|
|
|
console.log('---requestLocation---'); |
|
|
|
|
this.$util.getLocation( |
|
|
|
|
function(res) { |
|
|
|
|
if (that.$wechat.isWechat()) { |
|
|
|
|
that.$param.clat = res.latitude; |
|
|
|
|
that.$param.clng = res.longitude; |
|
|
|
|
that.getData(); |
|
|
|
|
that.get_attribute(), that.initData(), that.get_data(); |
|
|
|
|
} else { |
|
|
|
|
that.get_attribute(), that.initData(), that.get_data(); |
|
|
|
|
} |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
}, |
|
|
|
|
function() { |
|
|
|
|
console.log('location error---'); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
initData: function() { |
|
|
|
|
this.data = false; |
|
|
|
|
this.listDatas = []; |
|
|
|
|
this.destinationBak = this.destination; |
|
|
|
|
}, |
|
|
|
|
selected: function(event) { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true |
|
|
|
|
}); |
|
|
|
|
this.initData(); |
|
|
|
|
var dataset = event.currentTarget.dataset; |
|
|
|
|
var param = this.selectedParam; |
|
|
|
|
|
|
|
|
|
param[dataset.type] = dataset.id; |
|
|
|
|
param.hiddenSortPanel = !0; |
|
|
|
|
//console.log(dataset.id); |
|
|
|
|
this.selectedParam = param; |
|
|
|
|
this.get_data(); |
|
|
|
|
}, |
|
|
|
|
regionSelected: function(event) { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true |
|
|
|
|
}); |
|
|
|
|
this.initData(); |
|
|
|
|
var dataset = event.currentTarget.dataset; |
|
|
|
|
var param = this.selectedParam; |
|
|
|
|
param[dataset.type] = dataset.id; |
|
|
|
|
param.hiddenRegionPanel = !0; |
|
|
|
|
// console.log(dataset.id); |
|
|
|
|
this.selectedParam = param; |
|
|
|
|
this.regionname = dataset.name; |
|
|
|
|
this.get_data(); |
|
|
|
|
}, |
|
|
|
|
getRedisRegion: function() { |
|
|
|
|
var that = this; |
|
|
|
|
var data = { |
|
|
|
|
key: that.$param.userkey + '_mdd_list' |
|
|
|
|
}; |
|
|
|
|
that.$Request.post(that.$config.getRedisData, data).then(res => { |
|
|
|
|
if (res.status == 200) { |
|
|
|
|
that.regionList = res.data.mddList; |
|
|
|
|
var all = { |
|
|
|
|
bm: '', |
|
|
|
|
title: '全部' |
|
|
|
|
}; |
|
|
|
|
that.regionList.unshift(all); |
|
|
|
|
for (var i = 0; i < that.regionList.length; i++) { |
|
|
|
|
if (that.regionList[i].bm == that.selectedParam.bm) { |
|
|
|
|
that.regionname = that.regionList[i].title; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
that.getRegion(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
changePanel: function(event) { |
|
|
|
|
var dataSet = event.currentTarget.dataset, |
|
|
|
|
selectedParam = this.selectedParam; |
|
|
|
|
'hiddenSortPanel' == dataSet.type ? (selectedParam.hiddenAttributePanel = !0, selectedParam |
|
|
|
|
.hiddenRegionPanel = !0) : (selectedParam.hiddenSortPanel = !0), |
|
|
|
|
(selectedParam[dataSet.type] = !selectedParam[dataSet.type]), |
|
|
|
|
(this.selectedParam = selectedParam); |
|
|
|
|
}, |
|
|
|
|
changeRegionPanel: function(event) { |
|
|
|
|
var dataSet = event.currentTarget.dataset, |
|
|
|
|
selectedParam = this.selectedParam; |
|
|
|
|
if ('hiddenRegionPanel' == dataSet.type) { |
|
|
|
|
selectedParam.hiddenAttributePanel = !0; |
|
|
|
|
selectedParam.hiddenSortPanel = !0; |
|
|
|
|
} else { |
|
|
|
|
selectedParam.hiddenRegionPanel = !0; |
|
|
|
|
} |
|
|
|
|
(selectedParam[dataSet.type] = !selectedParam[dataSet.type]), (this.selectedParam = selectedParam); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
resetFilter: function() { |
|
|
|
|
this.selectedFIlter = { |
|
|
|
|
attribute_htype: 0 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
confirmClick: function() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true |
|
|
|
|
}); |
|
|
|
|
this.initData(); |
|
|
|
|
//设置选中的筛选项 |
|
|
|
|
var selectedParam = this.selectedParam; |
|
|
|
|
(selectedParam.hiddenAttributePanel = true), (this.selectedFIlterBak = this.selectedFIlter); |
|
|
|
|
this.parentLevelItem = 'attribute_htype'; |
|
|
|
|
this.selectedParam = selectedParam; |
|
|
|
|
this.get_data(); |
|
|
|
|
}, |
|
|
|
|
parentLevel: function(t) { |
|
|
|
|
var currentTarget = t.currentTarget.dataset; |
|
|
|
|
//console.log("aaaaaaaaaaaaaaaaa"+a.parentlevelitem); |
|
|
|
|
this.parentLevelItem = currentTarget.parentlevelitem; |
|
|
|
|
}, |
|
|
|
|
childLevel: function(t) { |
|
|
|
|
var a = t.currentTarget.dataset, |
|
|
|
|
e = this.selectedFIlter; |
|
|
|
|
this.selectedFIlterBak = e; |
|
|
|
|
e[a.type] = a.id; |
|
|
|
|
this.selectedFIlter = e; |
|
|
|
|
}, |
|
|
|
|
get_attribute: function() { |
|
|
|
|
var that = this; |
|
|
|
|
var url = this.$config.getCondition; |
|
|
|
|
var data = { |
|
|
|
|
type: 'hotel', |
|
|
|
|
userkey: this.$param.userkey, |
|
|
|
|
condition: this.$param.hotelType |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
this.$Request.post(url, data).then(res => { |
|
|
|
|
var flag = that.$util.isSuccess(res); |
|
|
|
|
if (!flag) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.filter = res.data; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
getRegion: function() { |
|
|
|
|
var that = this; |
|
|
|
|
var url = this.$config.getMessageInfoFormFilter; |
|
|
|
|
var data = { |
|
|
|
|
type: this.$param.mddType, |
|
|
|
|
userkey: this.$param.userkey, |
|
|
|
|
pageSize: 100, |
|
|
|
|
sort: '2' |
|
|
|
|
}; |
|
|
|
|
this.$Request.post(url, data).then(res => { |
|
|
|
|
var flag = that.$util.isSuccess(res); |
|
|
|
|
if (!flag) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.regionList = res.data; |
|
|
|
|
for (var i = 0; i < this.regionList.length; i++) { |
|
|
|
|
if (this.regionList[i].bm == this.selectedParam.bm) { |
|
|
|
|
this.regionname = this.regionList[i].title; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.regionList.unshift({ |
|
|
|
|
title: '全部', |
|
|
|
|
bm: '' |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// onReachScroll: function(t) { |
|
|
|
|
// //console.log(t); |
|
|
|
|
// t.detail.scrollTop > 100 ? this.floorstatus=true: this.floorstatus=false; |
|
|
|
|
// var a = this.param; |
|
|
|
|
// a.noData || a.finished || a.loading || this.get_data(this.selectedParam.bm); |
|
|
|
|
// }, |
|
|
|
|
}, |
|
|
|
|
/*下拉刷新的回调 */ |
|
|
|
|
downCallback(mescroll) { |
|
|
|
|
console.log("下拉刷新的") |
|
|
|
@ -466,14 +237,7 @@ |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onPullDownRefresh() { |
|
|
|
|
console.log('onPullDownRefresh'); |
|
|
|
|
setTimeout(function() { |
|
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
|
console.log('stopPullDownRefresh'); |
|
|
|
|
}, 1000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|