公司演示版e鹿悦游
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.
 
 
 
 
 
CjyTravel/subPageA/feiyi/feiyilist/feiyilist.vue

493 lines
14 KiB

<template>
<view class="v-pages v-pages-bg">
<view class="v-pages-search">
<view class="search_box row flex-align-center">
<view class="col">
<input @input="write" type="text" class="input" @confirm="confirm" confirm-type="search"
placeholder-style="color:#999" placeholder="搜索非遗" />
</view>
<view class="btn_img" @click="search()">
<image src="/subPageB/static/img/icon-search.png" class="img"></image>
</view>
</view>
<view class="dy_fx amt_30">
<view class="search-tip-bar">
<view @tap="changePanel" :class="[searchItemClass, selectedParam.hiddenSortPanel ? 'active' : '']"
data-type="hiddenSortPanel">智能排序</view>
<view @tap="changePanel"
:class="[searchItemClass, selectedParam.hiddenAttributePanel ? 'active' : '']"
data-type="hiddenAttributePanel">分类筛选</view>
</view>
</view>
</view>
<scroll-view @scrolltolower="onReachScroll" class="scroll-view" :scroll-top="topNum" scrollY="true">
<view>
<waterfall :list="list"></waterfall>
<view class="scroll-empty" v-if="list.length==0">
<image class="empty-icon" src="https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/no-data.png" mode="widthFix">
</image>
<view class="empty-tip">~ 暂无相关数据 ~</view>
</view>
</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>
<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]==''?'filter-bd-item-active':'']"
data-id="" :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>
</template>
<script>
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
import uniNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue';
import uniSection from '@/components/uni-section/uni-section.vue';
import uniStatusBar from '@/components/uni-status-bar/uni-status-bar.vue';
import waterfall from '../../components/xi-waterfall/xi-waterfall.vue';
export default {
components: {
uniIcons,
uniNavBar,
uniSection,
uniStatusBar,
waterfall
},
data() {
return {
//
page: 1,
start: 0,
end: 0,
list: [], // 列表
loading: true,
// 轮播图
indicatorDots: true,
autoplay: true,
interval: 5000,
duration: 500,
tabHeight: 350,
searchItemClass: 'search-tip-item',
pageClass: {
sortItemClass: 'sort-item',
filterHdItemClass: 'filter-hd-item',
filterBdItem: 'filter-bd-item'
},
pageClass2: {
sortItemClass: 'sort-item2'
},
priceSymbol: '',
destinationBak: 'all',
destination: 'all',
filter: {
sort: [],
attribute: []
},
regionList: [],
parentLevelItem: 'attribute_feiyiTypeKey',
defaultFilter: {
attribute_feiyiTypeKey: 0,
attribute_feiyiLevelKey: 0
},
latitude: 0,
longitude: 0,
selectedFIlterBak: {
attribute_feiyiTypeKey: 0,
attribute_feiyiLevelKey: 0
},
selectedFIlter: {
attribute_feiyiTypeKey: 0,
attribute_feiyiLevelKey: 0
},
selectedParam: {
sortId: 2,
bm: '',
hiddenSortPanel: !0,
hiddenAttributePanel: !0,
hiddenRegionPanel: !0
},
param: {
page: 1,
noData: !1,
loading: !1,
finished: !1
},
foodlist: [],
shangjiaList: [],
topNum: 0,
rootPaht: this.$config.ROOTPATH,
selectcondition: {
bm: '',
sortId: 2,
type: ''
},
regionname: '区域',
width: 280,
isData: true,
pageSize: 10,
searchTitle: '',
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.initData();
this.get_attribute();
var region = option.region;
if (region != null && region != '') {
this.selectcondition.bm = region;
this.get_data();
} else {
this.getData();
}
this.getRedisRegion() /* this.requestLocation(), this.get_data()*/ ;
that.$util.saveOperatorLog(that, 'FUN', '非遗');
},
onShow() {
this.destinationBak != this.destination && (this.initData(), this.get_data());
},
methods: {
write: function(e) {
this.searchTitle = e.detail.value;
},
search: function() {
this.initData();
this.get_data();
},
back: function(e) {
uni.navigateBack({
delta: 1
});
},
confirm: function(e) {
this.searchTitle = e.detail.value;
this.initData();
this.get_data();
},
getData: function() {
var that = this;
var data = {
"key": this.$param.userkey + "_feiyi_list"
}
that.$Request.post(that.$config.getRedisData, data).then(res => {
console.log(res);
if (res.status == 200) {
var data = res.data.feiyiList;
for (var i = 0; i < data.length; i++) {
data[i].logo = that.$config.ROOTPATH + data[i].logo
}
if (data.length < this.pageSize) {
this.isData = false;
}
that.list = that.list.concat(data);
uni.hideLoading();
console.log('that.list', that.list)
} else {
that.get_data();
}
})
},
initData: function() {
uni.showLoading({
title: '加载中',
mask: true
});
var param = {};
param.page = 1;
param.noData = false;
param.finished = false;
this.isData = true;
this.param = param;
this.foodList = [];
this.shangjiaList = [];
this.destinationBak = this.destination;
this.list = [];
},
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_feiyiTypeKey: 0,
attribute_feiyiLevelKey: 0
}
},
confirmClick: function() {
this.initData();
//设置选中的筛选项
var selectedParam = this.selectedParam;
(selectedParam.hiddenAttributePanel = true), (this.selectedFIlterBak = this.selectedFIlter);
this.parentLevelItem = 'attribute_feiyiTypeKey';
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;
this.selectcondition.type = a.id;
},
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;
}
this.regionList = res.data;
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;
}
}
});
},
get_attribute: function() {
var that = this;
var url = this.$config.getCondition;
var data = {
type: 'feiyi',
userkey: this.$param.userkey,
condition: this.$param.fylxType,
condition2: this.$param.fyLevel
};
this.$Request.post(url, data).then(res => {
var flag = that.$util.isSuccess(res);
if (!flag) {
return;
}
this.filter = res.data;
});
},
onReachScroll: function(t) {
if (this.isData) {
this.param.page++;
this.get_data();
}
},
get_data: function() {
uni.showLoading({
title: '加载中',
mask: true
});
var that = this;
var url = this.$config.getMessageInfoFormFilter_two;
var sub_column1 = this.selectedFIlterBak['attribute_feiyiTypeKey'];
var sub_column2 = this.selectedFIlterBak['attribute_feiyiLevelKey'];
if (sub_column1 != undefined && sub_column1 != null && sub_column1 != '') {
sub_column1 = "sub_column1&" + sub_column1 + "&select";
}
if (sub_column2 != undefined && sub_column2 != null && sub_column2 != '') {
sub_column2 = "sub_column2&" + sub_column2 + "&select";
}
var data = {
type: this.$param.fyType,
userkey: this.$param.userkey,
pageno: this.param.page,
pageSize: this.pageSize,
region: this.selectcondition.bm,
sort: this.selectcondition.sortId,
title: this.searchTitle,
lng: this.$param.clng,
lat: this.$param.clat,
sub_column1: sub_column1,
sub_column2: sub_column2
};
this.$Request.post(url, data).then(res => {
var data = res.data;
for (var i = 0; i < data.length; i++) {
data[i].logo = that.$config.ROOTPATH + data[i].logo
}
if (data.length < this.pageSize) {
this.isData = false;
}
that.list = that.list.concat(data);
uni.hideLoading();
});
},
}
};
</script>
<style>
.filter-page {
position: absolute;
top: 180rpx !important;
right: 0;
bottom: 0;
left: 0;
z-index: 10;
background: #fff;
}
.pb_15 {
padding-bottom: 15rpx;
}
.sort-page {
top: 180rpx;
}
</style>