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.
546 lines
15 KiB
546 lines
15 KiB
<template>
|
|
<view>
|
|
<mescroll-uni :down="downOption" @down="downCallback" @up="upCallback">
|
|
<view>
|
|
<view class="an_box_mes wc_sbox pb_15">
|
|
<view class="dy_fx an_sch">
|
|
<view class="fx_1">
|
|
<input v-model="searchValue" @confirm="search" type="text" class="an_sch_ipt" confirm-type="search" placeholder-style="color:#999" placeholder="输入研学基地名称" />
|
|
</view>
|
|
<view class="an_sch_img" @click="search"><image src="../../../static/animg/icon-search.png" class="ac_size_1"></image></view>
|
|
</view>
|
|
<!-- <view class="search-container box_1 amt_30">
|
|
<view class="search-tip-bar">
|
|
<view @tap="changeRegionPanel" :class="[searchItemClass, selectedParam.hiddenRegionPanel ? 'active' : '']" data-type="hiddenRegionPanel">
|
|
{{ regionname }}
|
|
</view>
|
|
|
|
<view @tap="changePanel" :class="[searchItemClass, selectedParam.hiddenSortPanel ? 'active' : '']" data-type="hiddenSortPanel">智能排序</view>
|
|
</view>
|
|
</view> -->
|
|
</view>
|
|
<view>
|
|
<!-- <scroll-view @scroll="onReachScroll" @bindscrolltolower="lower" class="scroll-view" :scroll-top="topNum" scrollY="true" style="top:200rpx"> -->
|
|
<view class="list-container" style="background: none;">
|
|
<view class="aml_30 amr_30">
|
|
<navigator
|
|
class="amt_30"
|
|
hover-class="none"
|
|
:url="item.subtitle"
|
|
v-for="(item, index) in listDatas"
|
|
:key="index"
|
|
>
|
|
<view class="ls_inf_box lunb_img">
|
|
<image class="swp_2_img" mode="aspectFill" :src="rootPaht+item.logo"></image>
|
|
<!-- <view class="item-city" v-if="item.etype">
|
|
<text>{{item.etype}}</text>
|
|
</view> -->
|
|
<view class="an_v_inf">
|
|
<view class="lst_tit word_1" v-if="item.title">{{ item.title }}</view>
|
|
<view class="lsinf word_2">{{ item.address }}</view>
|
|
</view>
|
|
</view>
|
|
</navigator>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- <view class="data-loading" v-if="param.loading">
|
|
<image class="icon" src="../../../static/images/loading-icon.png"></image>
|
|
加载中…
|
|
</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>
|
|
|
|
<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>
|
|
|
|
<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-name="item.title"
|
|
data-type="bm"
|
|
:data-id="item.bm"
|
|
v-for="(item, index) in regionList"
|
|
:key="index"
|
|
>
|
|
{{ item.title }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="filter-page" :hidden="selectedParam.hiddenAttributePanel">
|
|
<view class="filter-box">
|
|
<scroll-view scrollY class="filter-hd">
|
|
<view
|
|
@tap="parentLevel"
|
|
:class="[pageClass.filterHdItemClass, parentLevelItem == 'attribute_' + items.type ? 'filter-hd-item-active' : '']"
|
|
:data-parentLevelItem="'attribute_' + items.type"
|
|
v-for="(items, index) in filter.attribute"
|
|
:key="index"
|
|
>
|
|
{{ items.name }}
|
|
</view>
|
|
</scroll-view>
|
|
<scroll-view scrollY class="filter-bd">
|
|
|
|
<view class="filter-group" v-if="parentLevelItem=='attribute_'+items.type" v-for="(items,index) in filter.attribute"
|
|
:key="items.dicnum">
|
|
<view @tap="childLevel" :class="[pageClass.filterBdItem,selectedFIlter['attribute_'+items.type]==0?'filter-bd-item-active':'']"
|
|
data-id="0" :data-type="'attribute_'+items.type">全部</view>
|
|
<view @tap="childLevel" :class="[pageClass.filterBdItem,selectedFIlter['attribute_'+items.type]==item.dicnum?'filter-bd-item-active':'']"
|
|
:data-id="item.dicnum" :data-type="'attribute_'+items.type" v-for="(item,childIndex) in items.child" :key="childIndex">{{item.dicname}}</view>
|
|
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
<view class="control-bar-block">
|
|
<view @tap="resetFilter" class="control-back-btn">恢复默认</view>
|
|
<view @tap="confirmClick" class="control-confirm-btn">确定</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</mescroll-uni>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import MescrollUni from '@/components/mescroll-diy/mescroll-xinlang.vue';
|
|
export default {
|
|
components: {
|
|
MescrollUni
|
|
},
|
|
data() {
|
|
return {
|
|
searchItemClass: 'search-tip-item',
|
|
pageClass: {
|
|
sortItemClass: 'sort-item',
|
|
filterHdItemClass: 'filter-hd-item',
|
|
filterBdItem: 'filter-bd-item'
|
|
},
|
|
priceSymbol: '',
|
|
destinationBak: 'all',
|
|
destination: 'all',
|
|
filter: [],
|
|
regionList: [],
|
|
parentLevelItem: 'attribute_hoventKey',
|
|
defaultFilter: {
|
|
attribute_hoventKey:0
|
|
},
|
|
latitude: 0,
|
|
longitude: 0,
|
|
selectedFIlterBak: {
|
|
attribute_hoventKey:0
|
|
},
|
|
selectedFIlter: {
|
|
attribute_hoventKey:0
|
|
},
|
|
selectedParam: {
|
|
sortId: 3,
|
|
bm: '',
|
|
hiddenSortPanel: !0,
|
|
hiddenAttributePanel: !0,
|
|
hiddenRegionPanel: !0
|
|
},
|
|
top: 0,
|
|
param: {
|
|
page: 1,
|
|
noData: !1,
|
|
loading: !1,
|
|
finished: !1
|
|
},
|
|
listDatas: [],
|
|
topNum: 0,
|
|
rootPaht: this.$config.ROOTPATH,
|
|
selectcondition: {
|
|
bm: '',
|
|
sortId: 2,
|
|
type: ''
|
|
},
|
|
regionname: '区域',
|
|
searchValue:"",
|
|
netType:true,
|
|
mescroll:"",
|
|
redisType:true,
|
|
downOption: {
|
|
auto: true //是否在初始化完毕之后自动执行下拉回调callback; 默认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.selectedFIlter['attribute_' + this.$param.hoteventTypeKey] = 0;
|
|
this.parentLevelItem = 'attribute_' + this.$param.hoteventTypeKey; */
|
|
/* this.initData();
|
|
var region = option.region;
|
|
if (region != null && region != '') {
|
|
this.selectcondition.bm = region;
|
|
this.get_data();
|
|
} else {
|
|
this.getRedisData();
|
|
}
|
|
this.getRedisRegion();*/
|
|
this.get_attribute();
|
|
that.$util.saveOperatorLog(that, 'FUN', '乡村游');
|
|
},
|
|
onShow() {
|
|
this.destinationBak != this.destination && (this.initData(), this.get_data());
|
|
},
|
|
methods: {
|
|
/*下拉刷新的回调 */
|
|
downCallback(mescroll) {
|
|
//如果页面有计算比例的需要重新初始化否则会累加计算,动态数据使用push的需要重新初始化
|
|
//-------start--------
|
|
//--------end--------
|
|
this.initData();
|
|
this.searchValue = '';
|
|
this.mescroll = mescroll;
|
|
if(this.redisType){
|
|
this.getRedisData(mescroll);
|
|
}else{
|
|
this.get_data(mescroll);
|
|
}
|
|
|
|
// #ifdef H5
|
|
this.top = uni.upx2px(100 + 88) + 'px'; // H5的高度需加上 88的标题栏
|
|
// #endif
|
|
|
|
// #ifndef H5
|
|
this.top = uni.upx2px(100) + 'px'; // 非H5不必加
|
|
// #endif
|
|
setTimeout(() => {
|
|
mescroll.endSuccess();
|
|
this.top = 0;
|
|
}, 2500);
|
|
},
|
|
upCallback(mescroll) {
|
|
var that = this;
|
|
this.mescroll = mescroll;
|
|
that.get_data(mescroll);
|
|
},
|
|
initData: function() {
|
|
uni.showLoading({
|
|
title: '加载中',
|
|
mask: true
|
|
});
|
|
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.selectcondition.sortId = dataset.id;
|
|
this.get_data();
|
|
},
|
|
regionSelected: function(event) {
|
|
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.selectcondition.bm = this.selectedParam.bm;
|
|
this.regionname = dataset.name;
|
|
this.get_data();
|
|
},
|
|
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_hoventKey:0
|
|
}
|
|
},
|
|
confirmClick: function() {
|
|
this.initData();
|
|
//设置选中的筛选项
|
|
var selectedParam = this.selectedParam;
|
|
(selectedParam.hiddenAttributePanel = true), (this.selectedFIlterBak = this.selectedFIlter);
|
|
this.parentLevelItem = 'attribute_hoventKey'
|
|
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 = {};
|
|
this.selectedFIlter = e;
|
|
this.selectcondition.type = a.id;
|
|
},
|
|
search: function() {
|
|
this.initData();
|
|
this.get_data();
|
|
},
|
|
getRedisRegion: function() {
|
|
var data = {
|
|
key: this.$param.userkey + '_mdd_list'
|
|
};
|
|
this.$Request.post(this.$config.getRedisData, data).then(res => {
|
|
if (res.status == 200) {
|
|
this.regionList = res.data.mddList;
|
|
var all = {
|
|
bm: '',
|
|
title: '全部'
|
|
};
|
|
this.regionList.unshift(all);
|
|
|
|
for (var i = 0; i < this.regionList.length; i++) {
|
|
if (this.regionList[i].bm == this.selectcondition.bm) {
|
|
this.regionname = this.regionList[i].title;
|
|
}
|
|
}
|
|
} else {
|
|
this.getRegion();
|
|
}
|
|
});
|
|
},
|
|
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;
|
|
}
|
|
that.regionList = res.data;
|
|
for (var i = 0; i < that.regionList.length; i++) {
|
|
if (that.regionList[i].bm == that.selectcondition.bm) {
|
|
that.regionname = that.regionList[i].title;
|
|
}
|
|
}
|
|
});
|
|
},
|
|
get_attribute: function() {
|
|
var that = this;
|
|
var url = this.$config.getCondition;
|
|
var data = {
|
|
type: 'famousvillage',
|
|
userkey: this.$param.userkey
|
|
};
|
|
|
|
this.$Request.post(url, data).then(res => {
|
|
var flag = that.$util.isSuccess(res);
|
|
if (!flag) {
|
|
return;
|
|
}
|
|
this.filter = res.data;
|
|
});
|
|
},
|
|
/* 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();
|
|
}, */
|
|
getRedisData: function(mescroll) {
|
|
var that = this;
|
|
var data = {
|
|
key: this.$param.userkey + '_yanxue_list'
|
|
};
|
|
|
|
that.$Request.post(that.$config.getRedisData, data).then(res => {
|
|
if(res.status == 200){
|
|
var listDatas = that.listDatas,
|
|
dataListLen = res.data.yanxueList.length,
|
|
data = res.data.yanxueList;
|
|
|
|
setTimeout(
|
|
function(){
|
|
if(dataListLen>0){
|
|
that.param.page += 1;
|
|
that.listDatas = data;
|
|
} else {
|
|
that.listDatas = [];
|
|
}
|
|
if(mescroll != undefined && mescroll != null){
|
|
//console.log('条数' + dataListLen);
|
|
mescroll.endSuccess(dataListLen);
|
|
}
|
|
uni.hideLoading();
|
|
},
|
|
1500,
|
|
data,
|
|
dataListLen,
|
|
mescroll,
|
|
that
|
|
);
|
|
}else{
|
|
that.get_data(mescroll);
|
|
}
|
|
that.redisType = false
|
|
});
|
|
},
|
|
get_data: function(mescroll) {
|
|
/* var type = this.selectedFIlterBak['attribute_hoventKey'];
|
|
if(type != 0){
|
|
var sub_column1 = "sub_column1&"+type+"&select"
|
|
} */
|
|
var that = this;
|
|
var url = this.$config.getMessageInfoFormFilter_two;
|
|
var data = {
|
|
type: this.$param.YXJD,
|
|
userkey: this.$param.userkey,
|
|
pageno: this.param.page,
|
|
pageSize: 10,
|
|
/* region: this.selectcondition.bm, */
|
|
sort: this.selectcondition.sortId,
|
|
/* lng: this.$param.clng,
|
|
lat: this.$param.clat,*/
|
|
title:this.searchValue,
|
|
//sub_column1:sub_column1
|
|
};
|
|
//console.log(data);
|
|
this.$Request.post(url, data).then(res => {
|
|
if (res.status == 200) {
|
|
var list = res.data;
|
|
var dataListLen = res.data.length;
|
|
var that = this;
|
|
setTimeout(
|
|
function() {
|
|
if (dataListLen > 0) {
|
|
if (that.param.page == 1) {
|
|
that.param.page += 1;
|
|
that.listDatas = list;
|
|
} else {
|
|
that.param.page += 1;
|
|
for (var i = 0; i < list.length; i++) {
|
|
var item = {
|
|
guid: list[i].guid,
|
|
logo: list[i].logo,
|
|
title: list[i].title,
|
|
address: list[i].address,
|
|
subtitle: list[i].subtitle
|
|
/* eaddress: list[i].address,
|
|
ephone: list[i][this.$param.hoteventPhoneKey],
|
|
etype: list[i][this.$param.hoteventTypeKey].dicname,
|
|
distance: this.$util.formatDistance(list[i].distance) */
|
|
};
|
|
that.listDatas.push(item);
|
|
}
|
|
}
|
|
} else {
|
|
that.listDatas = [];
|
|
}
|
|
if (mescroll != undefined && mescroll != null) {
|
|
//console.log('条数' + dataListLen);
|
|
mescroll.endSuccess(dataListLen);
|
|
}
|
|
uni.hideLoading();
|
|
},
|
|
1500,
|
|
list,
|
|
dataListLen,
|
|
mescroll,
|
|
that
|
|
);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
/* @import url("../../../static/css/common.css");*/
|
|
@import url('../../hotevent/hoteventlist/hoteventlist.css');
|
|
.list-item {
|
|
padding: 0;
|
|
}
|
|
.sort-page{ top:290rpx; position: fixed;}
|
|
.filter-page {
|
|
top: 200rpx;
|
|
}
|
|
|
|
</style>
|
|
|