You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
376 lines
10 KiB
376 lines
10 KiB
2 years ago
|
<template>
|
||
|
<view class="container">
|
||
|
<view class="search-container">
|
||
|
<view class="search-tip-bar">
|
||
|
<view @tap="changeRegionPanel" :class="[searchItemClass,selectedParam.hiddenRegionPanel?'active':'']" data-type="hiddenRegionPanel">区域</view>
|
||
|
|
||
|
<view @tap="changePanel" :class="[searchItemClass,selectedParam.hiddenSortPanel?'active':'']" data-type="hiddenSortPanel">智能排序</view>
|
||
|
</view>
|
||
|
</view>
|
||
1 year ago
|
|
||
2 years ago
|
|
||
|
<scroll-view @scroll="onReachScroll" @bindscrolltolower="lower" class="scroll-view" :scroll-top="topNum" scrollY="true">
|
||
|
<view class="list-container">
|
||
|
<view class="mode_com">
|
||
1 year ago
|
<navigator class="list-item" hover-class="none" :url="'/subPageB/famousVillage/famousVillagetail/famousVillagetail?guid='+itemName.guid" v-for="(itemName,index) in listDatas"
|
||
2 years ago
|
:key="index">
|
||
|
<image class="item-pic" :src="itemName.logo"></image>
|
||
|
<view class="item-info">
|
||
|
<view class="title">{{itemName.title}}</view>
|
||
|
<view class="attr">
|
||
1 year ago
|
<view class="tip"><image src="/static/animg/daolan/map_toilet_0b.png" class="pic_zan"></image>{{itemName.address}}</view>
|
||
2 years ago
|
</view>
|
||
|
<view class="data">
|
||
|
<view class="myd">距您约{{itemName.distance}}</view>
|
||
|
<view class="price">
|
||
|
<block v-if="itemName.price>0">
|
||
|
<text class="num">¥{{itemName.price}}</text>起
|
||
|
</block>
|
||
|
</view>
|
||
|
</view>
|
||
|
<!-- <view class="data">
|
||
|
<view class="myd1">电话:{{itemName.hphone}}</view>
|
||
|
</view> -->
|
||
|
</view>
|
||
|
</navigator>
|
||
|
</view>
|
||
|
</view>
|
||
|
|
||
|
<view class="data-loading" v-if="param.loading">
|
||
1 year ago
|
<image class="icon" src="/subPageB/static/img/loading-icon.png"></image>加载中…
|
||
2 years ago
|
</view>
|
||
|
<view class="data-is-bottom" v-if="param.finished">{{this.$param.pageMsg}}</view>
|
||
|
<view class="no-data-info" v-if="param.noData">{{this.$param.dataMsg}}</view>
|
||
|
|
||
|
</scroll-view>
|
||
|
|
||
|
|
||
|
<view class="sort-page" :hidden="selectedParam.hiddenSortPanel">
|
||
|
<view class="sort-group">
|
||
|
<view @tap="selected" :class="[pageClass.sortItemClass,selectedParam.sortId==item.id?'sort-item-active':'']"
|
||
|
data-panel="hiddenSortPanel" data-type="sortId" :data-id="item.id" v-for="(item,index) in filter.sort" :key="index">
|
||
|
{{item.name}}
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
1 year ago
|
|
||
2 years ago
|
<view class="sort-page" :hidden="selectedParam.hiddenRegionPanel">
|
||
|
<view class="sort-group">
|
||
|
<view @tap="regionSelected" :class="[pageClass.sortItemClass,selectedParam.bm==item.bm?'sort-item-active':'']"
|
||
|
data-panel="hiddenRegionPanel" data-type="bm" :data-id="item.bm" v-for="(item,index) in filter.regionList" :key="index">
|
||
|
{{item.mc}}
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
|
||
|
|
||
|
|
||
|
</view>
|
||
|
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
var that;
|
||
|
export default {
|
||
|
data() {
|
||
|
that = this;
|
||
|
return {
|
||
|
searchItemClass: "search-tip-item",
|
||
|
pageClass: {
|
||
|
sortItemClass: "sort-item",
|
||
|
filterHdItemClass: "filter-hd-item",
|
||
|
filterBdItem: "filter-bd-item"
|
||
|
},
|
||
|
priceSymbol: "",
|
||
|
destinationBak: "all",
|
||
|
destination: "all",
|
||
|
filter: [],
|
||
|
parentLevelItem: "attribute_htype",
|
||
|
defaultFilter: {},
|
||
|
latitude: 0,
|
||
|
longitude: 0,
|
||
|
selectedFIlterBak: {
|
||
|
price: 0
|
||
|
},
|
||
|
selectedFIlter: {
|
||
|
attribute_htype: 0
|
||
|
},
|
||
|
selectedParam: {
|
||
|
sortId: 1,
|
||
|
bm: "",
|
||
|
hiddenSortPanel: !0,
|
||
|
hiddenAttributePanel: !0,
|
||
|
hiddenRegionPanel: !0,
|
||
|
},
|
||
|
param: {
|
||
|
page: 1,
|
||
|
noData: !1,
|
||
|
loading: !1,
|
||
|
finished: !1
|
||
|
},
|
||
|
listDatas: [],
|
||
|
topNum: 0,
|
||
|
rootPaht: this.$config.ROOTPATH,
|
||
|
regions:"",
|
||
|
initRegion:"",
|
||
|
netType:true
|
||
|
}
|
||
|
},
|
||
|
onLoad(option) {
|
||
|
var that = this;
|
||
|
this.$util.getNetworkType(
|
||
|
function(res){
|
||
|
if(res.networkType === 'none'){
|
||
|
uni.showToast({
|
||
|
title:that.$param.netMsg,
|
||
|
icon:"none",
|
||
|
duration:2000
|
||
|
})
|
||
|
that.netType = false;
|
||
|
}
|
||
|
},function(){
|
||
|
uni.showToast({
|
||
|
title:that.$param.netMsg,
|
||
|
icon:"none",
|
||
|
duration:2000
|
||
|
})
|
||
|
that.netType = false;
|
||
|
}
|
||
|
)
|
||
|
if(!that.netType){
|
||
|
return;
|
||
|
}
|
||
|
this.$util.hideLoadingByTime();
|
||
|
uni.showLoading({
|
||
|
title:"加载中",
|
||
|
mask:true
|
||
|
})
|
||
|
this.$util.bindGpsObj(that);
|
||
|
var region = option.region;
|
||
|
this.initRegion = region;
|
||
|
// this.get_attribute(), this.initData(), /* this.requestLocation(region), */this.get_data(region);
|
||
|
this.requestLocation(region)
|
||
|
},
|
||
|
onShow() {
|
||
|
this.destinationBak != this.destination && (this.initData(), this.get_data());
|
||
|
},
|
||
|
methods: {
|
||
|
callGpsSuccess: function(lat, lng){
|
||
|
that.$param.clat = lat;
|
||
|
that.$param.clng = lng;
|
||
|
that.latitude = lat;
|
||
|
that.longitude = lng;
|
||
|
that.get_attribute(), that.initData(),that.get_data(this.initRegion);
|
||
|
uni.hideLoading();
|
||
|
that.$util.unbindGpsObj();
|
||
|
},
|
||
|
callGpsFail: function(){
|
||
|
that.latitude = this.$param.lat;
|
||
|
that.longitude = this.$param.lng;
|
||
|
that.get_attribute(), that.initData(),that.get_data(this.initRegion);
|
||
|
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(region);
|
||
|
}else{
|
||
|
that.get_attribute(), that.initData(),that.get_data(region);
|
||
|
}
|
||
|
uni.hideLoading();
|
||
|
},
|
||
|
function() {
|
||
|
console.log('location error---');
|
||
|
}
|
||
|
);
|
||
|
},
|
||
|
initData: function() {
|
||
|
var param = {};
|
||
|
param.page = 1;
|
||
|
param.noData = false;
|
||
|
param.finished = false;
|
||
|
|
||
|
this.param = param;
|
||
|
this.listDatas = [];
|
||
|
this.destinationBak = this.destination;
|
||
|
},
|
||
|
selected: function(event) {
|
||
|
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(this.regions);
|
||
|
},
|
||
|
regionSelected: function(event) {
|
||
|
this.initData();
|
||
|
var dataset = event.currentTarget.dataset;
|
||
|
var param = this.selectedParam;
|
||
1 year ago
|
|
||
2 years ago
|
param[dataset.type] = dataset.id;
|
||
|
param.hiddenRegionPanel = !0;
|
||
1 year ago
|
|
||
2 years ago
|
//console.log(dataset.id);
|
||
|
this.selectedParam = param;
|
||
|
this.regions=this.selectedParam.bm;
|
||
|
this.get_data(this.selectedParam.bm);
|
||
|
},
|
||
|
changePanel: function(event) {
|
||
|
var dataSet = event.currentTarget.dataset,
|
||
|
selectedParam = this.selectedParam;
|
||
|
"hiddenSortPanel" == dataSet.type ? selectedParam.hiddenAttributePanel = !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
|
||
1 year ago
|
}
|
||
2 years ago
|
selectedParam[dataSet.type] = !selectedParam[dataSet.type],
|
||
|
this.selectedParam = selectedParam;
|
||
|
},
|
||
1 year ago
|
|
||
2 years ago
|
resetFilter: function() {
|
||
|
this.selectedFIlter = this.defaultFilter;
|
||
|
},
|
||
|
confirmClick: function() {
|
||
|
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 url = this.$config.quyuList;
|
||
|
var data = {
|
||
|
type: "famousvillage",
|
||
1 year ago
|
|
||
2 years ago
|
};
|
||
|
this.$Request.post(url, data).then(res => {
|
||
|
var e = {
|
||
|
price: 0
|
||
|
}
|
||
|
var all = {
|
||
|
bm:"",
|
||
|
mc:"全部"
|
||
|
}
|
||
1 year ago
|
|
||
2 years ago
|
this.filter = res.data;
|
||
|
//this.selectedFIlter = e;
|
||
|
this.defaultFilter = e;
|
||
|
this.filter.regionList.unshift(all)
|
||
1 year ago
|
|
||
2 years ago
|
});
|
||
|
},
|
||
|
onReachScroll: function(t) {
|
||
|
//console.log(t);
|
||
|
t.detail.scrollTop > 100 ? this.floorstatus=true: this.floorstatus=false;
|
||
|
var a = this.param;
|
||
1 year ago
|
|
||
2 years ago
|
a.noData || a.finished || a.loading || this.get_data();
|
||
|
},
|
||
|
get_data: function(selectRegion) {
|
||
|
|
||
|
this.param.loading = true;
|
||
|
|
||
|
var type = this.selectedFIlterBak['attribute_htype'];
|
||
|
var level = this.selectedFIlterBak['attribute_hlevel'];
|
||
|
var region = "";
|
||
|
if(selectRegion == undefined || selectRegion == ""){
|
||
|
region = this.$config.ARER_CODE;
|
||
|
}else{
|
||
|
region = selectRegion;
|
||
|
}
|
||
|
var requestData = {
|
||
|
pagesize: 10,
|
||
|
region: region,
|
||
|
pageno: this.param.page,
|
||
|
sort: this.selectedParam.sortId,
|
||
|
type: '2909',
|
||
|
lng:this.$param.clng,
|
||
1 year ago
|
lat:this.$param.clat
|
||
2 years ago
|
};
|
||
|
//console.log(this.$config.getHotelList);
|
||
|
this.$Request.post(this.$config.messagelist,requestData).then(res => {
|
||
|
var listDatas = this.listDatas,
|
||
|
dataListLen = res.data.length;
|
||
|
if (dataListLen == requestData.pagesize ? this.param.page += 1 : this.param.page = 1 && 0 == dataListLen ? this.param.noData =
|
||
|
true : this.param.finished = true,
|
||
1 year ago
|
|
||
2 years ago
|
this.param.loading = false, dataListLen > 0) {
|
||
|
|
||
|
for (var i = 0; i < dataListLen; i++) {
|
||
|
var item = {
|
||
|
guid: res.data[i].guid,
|
||
|
logo: this.rootPaht + res.data[i].logo,
|
||
|
title: res.data[i].title,
|
||
|
address: res.data[i].address,
|
||
|
distance:this.$util.formatDistance(res.data[i].distance)
|
||
|
};
|
||
|
this.listDatas.push(item);
|
||
|
}
|
||
1 year ago
|
|
||
2 years ago
|
//console.log(this.param.finished);
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
/* requestLocation:function(){
|
||
|
this.longitude = 31.22;
|
||
|
uni.getLocation({
|
||
|
type: 'wgs84',
|
||
|
success: function (res) {
|
||
|
this.longitude = res.longitude;
|
||
|
this.latitude = res.latitude;
|
||
1 year ago
|
|
||
2 years ago
|
console.log('当前位置的经度:' + res.longitude);
|
||
|
console.log('当前位置的纬度:' + res.latitude);
|
||
|
}
|
||
|
});
|
||
|
} */
|
||
1 year ago
|
|
||
2 years ago
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
1 year ago
|
@import url("/static/css/common.css");
|
||
1 year ago
|
@import url("/subPageB/famousVillage/famousVillagelist/famousVillagelist.css");
|
||
2 years ago
|
</style>
|