<template>
	<view class="listbox">
		<view class="fixedt">
			<!-- 选择器 -->
			<view class="flexc checkbox">
				<picker mode="date" fields="year"  @change='bindDateChangea'>
					<view class="chekt">
						<view>{{sbsj|| "申报年份"}}</view>
						<image :src="upimg"></image>
					</view>
				</picker>
				<view class="reset" @click="getResetFn">
					<image :src="resetimg"></image>
				</view>
				<view class="topc flexc">
					<image :src="secimg"></image>
					<input  placeholder="请输入客户名称" confirm-type="search" v-model="usename" @confirm="getConfirm"/>
				</view>
			</view>
		</view>
		<!-- 列表 -->
		<view class="plr18">
			<bus-list :datalist="list" :wtdt="wtdt" :type="type" @getDetail="getDetail"></bus-list>
		</view>
		<view class="scanbox flexcc">预览总表</view>
	</view>
</template>

<script>
	import config from '@/config'
	const baseUrl = config.baseUrl
	import busList from "@/work/components/business/list.vue"
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	export default{
		components:{busList},
		data(){
			return{
				secimg:require("@/static/images/home/hsearch.png"),
				upimg:require('@/work/static/images/sup.png'),
				resetimg:require('@/work/static/images/reset.png'),
				scanimg:require('@/work/static/images/scan.png'),
				list:[{tit:'123'},{tit:'123'}],
				pageSize: 10,
				pageNum: 1,
				reachflag: true,
				wtdt:'',
				// limit:''
				type:'qylist',
			}
		},
		// 上拉触底加载更多触发事件
		onReachBottom() {
			// if (this.reachflag) {
			// 	this.pageNum++
			// 	this.getDataFn()
			// }
		},
		methods:{
			checkPermi, checkRole,
			getDetail(){
				// 打开文件
				// this.$tab.navigateTo("/work/pages/file/details")
			},
			getTabFn(val){
				this.tabval=val
			},
			bindDateChangea(e){
				var val=e.detail.value;
				this.sbsj=val;
				this.getrefreshData()
			},
			bindDateChangeb(e){
				var val=e.detail.value;
				this.shzt=this.shlist[val].label;
				this.shztid=this.shlist[val].value;
				this.getrefreshData()
			},
			getResetFn(){
				// 重置
				this.getrefreshData()
			},
			getrefreshData(){
				// this.pageNum=1;
				// this.list=[];
				// this.reachflag=true;
				// this.getDataFn()
			},
			getDataFn(){
				var params={
					pageSize:this.pageSize,
					pageNum: this.pageNum,
				}
				getCaseListFn(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)
					}
				}) 
			},
		},
		
	}
</script>

<style lang="scss" scoped>
.fixedt{position: fixed;left: 0;right: 0;top: 0;z-index: 2;}
// .fixedt /deep/ uni-picker{flex: 1;}

.checkbox{padding:16rpx 32rpx;background-color: #efefef;
	.chekt{display: flex;align-items: center;margin-right: 12rpx;height:88rpx;
		view{text-align: center;
			font-weight: bold;font-size: 26rpx;color: #374B61;width: 136rpx;word-break: break-all;text-overflow: ellipsis;overflow: hidden;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;white-space: normal;}
		image{width: 16rpx;height: 12rpx;flex: 0 0 auto;margin-left: 4rpx;}
	}
}
.reset{width:56rpx; height: 88rpx;display: flex;align-items: center;justify-content: center;
	image{width: 26rpx;height: 30rpx;}
}
.topc{border-radius: 34rpx;height:68rpx;box-sizing: border-box;padding:0 28rpx;position: relative;flex:1;background-color:rgba(90, 135, 186, 0.2);width: 260rpx;
	flex:1;margin-left: 20rpx;
	input{font-weight: 500;font-size: 26rpx;color: #222327;flex: 1;}
	image{width: 30rpx;height: 30rpx;margin-right: 16rpx;flex: 0 0 auto;}
}
.listbox{padding-top: 120rpx;padding-bottom: 100rpx;}
.scanbox{position: fixed;left: 0;right: 0;bottom: 0;height: 100rpx;
background: #00A9F0;font-weight: bold;font-size: 30rpx;color: #FFFFFF;
	image{width: 26rpx;height: 26rpx;margin-right: 24rpx;}
}
</style>