123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <template>
- <view>
- <view class="shaixuan flex justify-center">
- <view class="shaixuan-box flex justify-between">
- <view class="shaixuan-box-item" style="width:90%;">
- <!-- <scroll-view scroll-x="true" style="width: 100%;white-space:nowrap;">
- <text class="" style="margin-right: 20rpx;" v-for="(item,index) in fuliList" :key="index">
- <text v-if="item.se==true">{{item.value}}</text>
- </text>
- </scroll-view> -->
- </view>
- <image @click="show = true" style="width: 35rpx;height: 35rpx;" src="../../static/images/select.png" mode=""></image>
- </view>
- </view>
- <view style="margin-top: 20upx;">
- <homeuserList @click="clickItems" :types="true" :list="lists"></homeuserList>
- </view>
- <empty v-if="lists.length==0" content="暂无数据"></empty>
- <!-- 侧边福利筛选弹窗 -->
- <u-popup v-model="show" mode="right" width="60%">
- <view class="fuli flex justify-center flex-wrap">
- <view class="fuli-box flex justify-between flex-wrap">
- <view class="fuli-box-item" @click="selectFuli(item,index)" :class="{activeFuli:item.se==true}" v-for="(item,index) in fuliList" :key="index">
- {{item.value}}
- </view>
- <view class="fuli-box-item" style="height: 0 !important;padding:0rpx !important;">
- </view>
- </view>
- <view class="fuli-box flex justify-between" style="margin-top: 100rpx;">
- <view class="btn1 flex justify-center align-center" @click="close()">
- 重置
- </view>
- <view class="btn2 flex justify-center align-center" @click="submit()">
- 确认
- </view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import homeuserList from '../../components/home-list/homeuserList.vue'
- import empty from '@/components/empty.vue'
- export default {
- components: {
- homeuserList,
- empty
- },
- data() {
- return {
- show:false,
- lists: [],
- page: 1,
- limit: 10,
- fuliList:[],
- current:-1,
- selectList:[],
- }
- },
- onLoad() {
- this.getuserList(2)
- //项目福利
- this.getFuLi();
- },
- onReachBottom() {
- if (this.lists.length == this.count) {
- uni.showToast({
- title: '已经到底了',
- icon: 'none'
- })
- } else {
- this.page = this.page + 1;
- this.getuserList(2)
- }
- },
- onPullDownRefresh: function() {
- this.page = 1;
- this.getuserList(2)
- },
- methods: {
- //重置筛选条件
- close(){
- this.fuliList.map(item=>{
- item.se = false
- })
- this.selectList = []
- this.show = false
- this.page = 1;
- this.getuserList(2)
- },
- //确认筛选
- submit(){
- this.selectList = []
- console.log(this.fuliList)
- this.fuliList.map(item=>{
- if(item.se == true){
- this.selectList.push(item.value)
- }
- })
- this.show = false
- //调用接口进行筛选
- this.page = 1;
- this.getuserList(2)
- //更新视图
- this.$forceUpdate()
- },
- //选择福利
- selectFuli(item,index){
- if(item.se==false){
- let num = 0
- this.fuliList.map(item=>{
- if(item.se==true){
- num +=1
- }
- })
- if(num==3){
- uni.showToast({
- title:'最多只能选择三个条件',
- icon:'none'
- })
- }else{
- item.se = !item.se
- }
- }else{
- item.se = !item.se
- }
-
-
- },
- //福利列表
- getFuLi(){
- this.$Request.get('/app/dict/list', {
- type: '项目福利'
- }).then(res => {
- if (res.code == 0) {
- let arr = res.data
- arr.map(item=>{
- item.se = false
- })
- this.fuliList = [...this.fuliList, ...arr]
- }
- })
- },
- //详情
- clickItems(item, index) {
- uni.navigateTo({
- url: '/pages/index/game/order?postPushId=' + item.item.postPushId
- })
- },
- //获取数据
- getuserList(stauts) {
- let userId = uni.getStorageSync('userId')
- let data = {
- page: this.page,
- limit: this.limit,
- status: stauts,
- classify: 2,
- projectAward:this.selectList.join(','),//项目福利
- }
- this.$Request.get("/app/postPush/selectPostPushList", data).then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- this.count = res.data.total
- if (this.page == 1) {
- this.lists = res.data.records
- for (var i = 0; i < this.lists.length; i++) {
- this.lists[i].projectType = this.lists[i].projectType.split(',')
- }
- } else {
- this.lists = [...this.lists, ...res.data.records]
- for (var i = 0; i < this.lists.length; i++) {
- this.lists[i].projectType = this.lists[i].projectType.split(',')
- }
- }
- }
- uni.stopPullDownRefresh();
- })
- },
- },
- }
- </script>
- <style lang="less">
- page {
- background: #F2F2F7;
- }
- .activeFuli{
- background-color: #82a9fe !important;
- color: #ffffff;
- }
- .fuli{
- width: 100%;
- height: auto;
- .fuli-box{
- width: 90%;
- height: 100%;
- .btn1{
- width: 46%;
- height: 70rpx;
- border-radius: 10rpx;
- background-color: #cdcdcd;
- }
- .btn2{
- width: 46%;
- height: 70rpx;
- border-radius: 10rpx;
- background-color: #82a9fe;
- color: #ffffff;
- }
- .fuli-box-item{
- width: 46%;
- // height: 60rpx;
- padding: 20rpx;
- background-color: #cdcdcd;
- margin-top: 20rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 10rpx;
- // color: #ffffff;
- }
- }
- }
- .shaixuan {
- width: 100%;
- margin-top: 20rpx;
- .shaixuan-box {
- width: 686rpx;
- height: auto;
- // background-color: red;
- }
- }
- .headTop {
- background: #ffffff;
- position: fixed;
- /* #ifndef H5 */
- top: 0upx;
- /* #endif */
- /* #ifdef H5 */
- top: 80upx;
- /* #endif */
- left: 0;
- right: 0;
- z-index: 999;
- }
- .navs {
- background: #ffffff !important;
- }
- .listbox {
- background: #FFFFFF;
- border-radius: 24upx;
- margin: 20upx 30upx;
- padding: 30upx;
- }
- .argrtn {
- background: #F6F6F6;
- color: #666666;
- font-size: 24upx;
- border-radius: 8upx;
- padding: 5upx 20upx;
- margin-right: 20upx;
- }
- </style>
|