<template>
	<view class="allpage">
		<view class="listtop pfixed">
			<tab-searchone @getSearch='getSearch' :name="name"></tab-searchone>
			<time-year @bindDateChange="bindDateChange" ></time-year>
		</view>
		<view class="zhanline"></view>
		<view class="alllist">
			
			<!-- l列表 -->
			<project-list :datalist="list" :wtdt='wtdt' @getDetail='goDetail'></project-list>
			
		</view>
		<!-- 弹窗 -->
		<view class="bgbox" @click="getClose" v-if="titflag"></view>
		<!-- 弹窗 -->
		<view class="fixedbox" v-if="titflag">
			<image :src="closeimg" class="choseimg" @click="getClose"></image>
			<view class="top">温馨提示</view>
			<view class="boxs">
				<view class="c34 f16 fw">引荐单位可在此模块查看/操作项目信息及项目进展情况。</view>
			</view>
			<view class="fixedbtn" @click="getClose">我知道了</view>
		</view>
		<footers v-if="isfootflag" :footlist="footlist" :footerindex="footerindex" :color_checked="color_checked" :color_nochecked="color_nochecked" :isHomeIndex="true"></footers>
	</view>
</template>

<script>
	import projectList from "@/components/projectlist/list.vue"
	import tabSearchone from "@/components/toptab/searchone.vue"
	import timeYear from "@/components/timedata/timeyear.vue"
	import { getsbbzblistYz} from '@/api/work/clue.js'
	import footers from '@/components/footer/footer.vue'
	export default{
		data(){
			return{
				pageSize: 10,
				pageNum: 1,
				reachflag:true,
				itemslist:[],
				wtdt:'',
				tabidx:0,
				date:'',
				list:[],
				year:'',
				beginTime:'',
				endTime:'',
				name:'',
				census:'',
				deptId:this.$store.state.user.deptId,
				closeimg:require('@/static/images/close.png'),
				titflag:true,
				footlist:[
					{module:'home',title:'首页',icon_checked:require('@/static/images/tabbar/home_.png'),icon_nochecked:require('@/static/images/tabbar/home.png')},
					{module:'center',title:'引荐项目',icon_checked:require('@/static/images/tabbar/cen_.png'),icon_nochecked:require('@/static/images/tabbar/cen.png')},
					{module:'mine',title:'我的',icon_checked:require('@/static/images/tabbar/mine_.png'),icon_nochecked:require('@/static/images/tabbar/mine.png')},
					],
				 footerindex:'center',
				 showfooter: 0,
				 isfootflag:true,
				 color_checked :'343434',
				 color_nochecked :'666666',
			}
		},
		components:{
			projectList,tabSearchone,timeYear,footers
		},
		onUnload(){
			uni.$off('refreshdatalist')
		},
		onLoad(e) {
			if(e.xmmc){
				this.name=e.xmmc;
			}
			let date = new Date();
			let y = date.getFullYear();
			this.beginTime=y+'0101';
			this.endTime=y+'1231';
			this.getDataFn();
			uni.$on('refreshdatalist',(e) => {
				this.reachflag=true;
				this.pageNum=1;
				this.list=[];
				this.getDataFn();
			})
		},
		onReachBottom() {
			if (this.reachflag) {
				this.pageNum++
				this.getDataFn()
			}
		},
		methods:{
			getClose(){
				this.titflag=false
			},
			getDataFn(){
				var params={
					pageSize:this.pageSize,
					pageNum: this.pageNum,
					xmxsmc:this.name,
					deptId:this.$store.state.user.deptId
				}
				params['params[beginTime]']=this.beginTime
				params['params[endTime]']=this.endTime
				getsbbzblistYz(params).then(res=>{
					if(res.code==200){
						if (res.rows.length < this.pageSize) {
							this.reachflag = false
							this.wtdt = '到底了~';
						} else {
							var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -	1)
							if (num < res.total) {
								this.reachflag = true
								this.wtdt = '上拉加载更多'
							} else {
								this.reachflag = false
								this.wtdt = '到底了~';
							}
						}
						if (this.pageNum == 1) {
							this.list = res.rows;
						} else {
							this.list = this.list.concat(res.rows)
						}
					}else{
						this.$toast(res.msg)
					}
				})
			},
			getSearch(e){
				this.name=e;
				this.reachflag=true;
				this.pageNum=1;
				this.list=[];
				this.getDataFn();
			},
			bindDateChange(e){
				this.year=e;
				this.beginTime=e+'0101';
				this.endTime=e+'1231';
				this.reachflag=true;
				this.pageNum=1;
				this.list=[];
				this.getDataFn()
			},
			goDetail(e){
				this.$tab.navigateTo('/pages/work/yinpages/cluedetails?id='+e.id)
				 // this.$tab.navigateTo('/pages/work/cluedetails?id='+e+"&tabidx="+this.tabidx)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.allpage{min-height: 100vh;background: #ffffff;padding:190rpx 0 0rpx;box-sizing: border-box;}
.listtopa{border: 6rpx solid #FD5001;border-radius: 36rpx;height:72rpx;box-sizing: border-box;padding:0 140rpx 0 32rpx ;position: relative;
 input{}
 image{width: 30rpx;height: 30rpx;margin-right: 24rpx;}
 .btn{background: #FA5F03;border-radius: 36rpx;width: 140rpx;position: absolute;right: -2rpx;top: -2rpx;bottom:-2rpx;}
 }
 .listtopb{
	 .tit{flex: 1;height: 130rpx;display: flex;flex-direction: column;justify-content: center;position: relative;
	 view{text-align: center;}
	 .tits{color: #666666;}
	 .txt{color: #aaaaaa;}
	 &.act{
		 &::after{content: '';width: 100rpx;height: 6rpx;background:#FE5706 ;position: absolute;left: 50%;margin-left: -50rpx;bottom: 0;}
		.tits{color: #343434;}
		.txt{color: #FE5706;} 
	 }
	 }
 }
 .alllist{padding-top:10rpx ;}
  // 操作按钮
  .cluebtn{
  	display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 32rpx;color: #ffff;height: 100rpx;position: fixed;left: 0;right: 0;bottom: 0;z-index: 3;
  	&.btn1{background-color: #1FB9F7;flex: 1;}
  	&.btn2{background-color:#FF6400;flex: 1;}
  }
.fixedbox{
	height: 480rpx;box-sizing: border-box;
	.boxs{padding: 90rpx 0 70rpx;}
	.fixedbtn{width:100%;height: 80rpx;background: #FF6400;
	border-radius: 10rpx;display: flex;align-items: center;justify-content: center;font-size: 32rpx;font-weight: bold;color: #FFFFFF;
		&.btn1{background-color: #20ACCF;margin-bottom: 36rpx;}
	}
}
  

</style>