<template>
	<view class="index">
		<view class="sous_sear">
			<!-- <view class="sous_box" @click="getSearch">
				<image :src="searimg" class="sous_img"></image>
				<input  placeholder="请输入身份证号或姓名进行查询" class="sous_input" disabled/>
			</view> -->
			<!-- 区域选择 -->
			<view class="address">
				<view class="addtita">选择乡镇/村:</view>
				<view class="addressa">
					<view class="adds" @click="showPicker">
						<view class="addsa" :style="searchresult?'':'color:#999;'">{{searchresult||'选择区域'}}</view>
						<image :src="upimg" class="addsimg"></image>
					</view>
				</view>
				<!-- <view class="addclear" @click="Seach">搜索</view> -->
				<view class="addclear" @click="getClearFn">重置</view>
			</view>
		</view>
		<p style="height: 28upx; background-color: #f2f2f2;flex: 0 0 auto;"></p>
		<!-- <view class="tab">
			<view class="exele">

				<view class="box"> -->
					<table @change="change">
						<tr class="tr_one">
							<!-- <th style="width: 130upx; text-align: center;">编号</th> -->
							<th style="width: 120upx; text-align: center;">乡镇</th>
							<th style="width: 130upx; text-align: center;">系统人口数</th>
							<th style="width: 250upx; text-align: center;">完成核酸检测数据</th>
							<th style="width: 170upx; text-align: center;">完成百分比</th>
							<!-- <th style="width: 100upx;">联系方式</th> -->
							<!-- <th style="width: 50upx; text-align: center;">操作</th> -->
							<!-- <th style="width: 60upx;">查看</th> -->
						</tr>
						<!-- <scroll-view scroll-y class="scroll-view" upper-threshold="40" lower-threshold="40" @scrolltolower="bot_btn"> -->
						<view class="tabbox">
							<tr v-for="(item,index) in list" :key="index" :class=" [index%2  ==0 ? 'two_tr two_trtwo':'two_tr']">
								<td style="width: 120upx; text-align: center;" >{{ item.name == null ? '暂无信息' :  item.name}}</td>
								<td style="width: 130upx; text-align: center;" >{{ item.hjzrs == null ? '暂无信息' :  item.hjzrs}}</td>
								<td style="width: 250upx; text-align: center;">{{item.hjymjz == null? '暂无信息' : item.hjymjz }}</td>
								<td style="width: 170upx; text-align: center;" >{{ item.hjbfb == null? '暂无信息' :  item.hjbfb}}</td>
								<!-- <td style="width: 50upx; color: #32B16C;" @click.stop="goDetail(item)">查看</td> -->
							</tr>
							<div class="shax" v-if="list.length>0">
								到底了~
							</div>
							<!-- {{wtdt}} -->
							<div class="zanwu " v-else><span>暂无数据</span></div>
						<!-- </scroll-view> -->
						</view>
						
					</table>
<!-- 				</view>

			</view>
		</view> -->
		<!-- 弹窗 -->
		<!-- 搜索弹窗 -->
		<view class='bgbox' v-if="searchflag"></view>
		<view class="sfixed" v-if="searchflag">
			<view class="sfixed_tit">筛选查询</view>
			<image :src="closeimg" class="sfixed_clo" @click="getSearClose"></image>
			<view class="sfixed_box">
			
				<view class="sfixed_line"></view>
				<view class="sfixed_flex">
					<view class="sfixed_a">筛选条件</view>
					<view class="sfixed_ar" @click="getClearFn">重置</view>
				</view>
				
				<view class="address">
					<view class="addtita" v-if="navidx==0">居住地址</view>
					<view class="addtita" v-else>户籍地址</view>
					<view class="addressa" @click="showPicker">
						<view class="addsa" :style="searchresult?'':'color:#AAAAAA;'">{{searchresult||'选择区域'}}</view>
						<image :src="rimg" class="addsimg"></image>
						<!-- <view class="adds" >
							
						</view> -->
					</view>
				</view>
			</view>
			<view class="sfixed_btn" @click="Seach">查询</view>
		</view>
		
		
		<view class="bgbox" v-if="houseflag||delfalg"></view>
		<selectMorePicker 
					ref="picker" 
					:title="auiPicker.title"
					:layer="auiPicker.layer"
					:titflag='auiPicker.titflag'
					:data="auiPicker.data"
					@callback="pickerCallback"
				></selectMorePicker>
	</view>
</template>

<script>
	import selectPicker from '@/_components/picker/selectPicker.vue'
	import selectMorePicker from '@/_components/picker/selectMorePicker.vue'
	export default {
		components:{selectPicker,selectMorePicker},
		data() {
			return {
				background: {
					backgroundColor: '#009FE8'
				},
				navidx:1,
				navbg:require("@/static/image/titbg.png"),
				searimg:require("@/static/image/search.png"),
				closeimg:require("@/static/image/del.png"),
				searchflag:false,
				rimg:require('@/static/image/icon_mine_listenter.png'),
				upimg:require("@/static/image/up.png"),
				delimg: require("@/static/image/del.png"),
				activeTab: 0, //tab切换
				//列表数据
				list: [],
				roles:false,
				show: false,
				tabsta: [],
				currentTab: 0, //tab切换
				params: { //上拉刷新
				},
				haveMore: true,
				wtdt: '上拉加载更多',
				listShow: true, //判断是否有数据 true 有
				
				searchresult:'',//搜索区域显示
				sureselet:false,
				houseflag:false,
				
				auiPicker: {
					title: '选择区域',
					layer: null,
					titflag:true,
					data: []
				},

			};
		},
		onShow() {
			let type = uni.getStorageSync('token')
			if (!type) {
				uni.redirectTo({
					url: '/pages/login/login'
				})
			}else{
				let roles=uni.getStorageSync('roles')||false
				this.roles=roles
			}
			// var iutem = new Date().getFullYear() + 1
			// this.maxDate  = new Date(iutem,12,1).getTime()
			// this.minDate= new Date(2017, 10, 1).getTime()
		},
		onLoad(option) {
			 this.list = []
			 this.lists(this.params)
			 // 修改 获取列表的
			 this.getRegionListFirst()
		},
		beforeDestroy() {
			uni.$off("refreshData")
		},
		created() {

		},
		methods: {
			getSearch(){
				this.searchflag=true
				// if(this.deletelist.length){
				// 	this.searchflag=true
				// }else{
				// 	this.getDelectList()
				// 	this.searchflag=true
				// }
				
			},
			getSearClose(){
				this.searchflag=false
			},
			
			
			getClose(){
				this.houseflag=false;
				this.delfalg=false;
			},
			getRegionListFirst(){
				this.$http.post('boman-system/chinaArea/treeSelect',{pid: '340800000000'},true).then(res=>{
					// 拿到潜山市的数据
					this.auiPicker.data=res.data	
				})
			},
			//显示picker多级联动弹窗
			showPicker(e){
				const _this = this;
				_this.$refs.picker.open().then(function(){
					console.log('picker打开');
				});
			},
			//picker多级联动回调
			pickerCallback(e){
				const _this = this;
				let result = '';
				console.log(e,8)
				e.data.forEach(function(item, index){
					if(index==0){
						result += item.name;
					}else{
						result +='/'+ item.name;
					}
				});
				_this.searchresult=result;
				var length=e.data.length;
				this.params.code=e.data[length-1].areaid
				this.params.lenth=length;
				// console.log(this.params.queryType,33)
				// if(this.params.queryType=='hj'){
				// 	switch (length) {
				// 		case 0:
				// 			break;
				// 		case 1:
				// 			params.provinceId = e.data[0].areaid;
				// 			break;
				// 		case 2:
				// 			params.cityId = e.data[1].areaid;
				// 			break;
				// 		case 3:
				// 			params.regionId = e.data[2].areaid;
				// 			break;
				// 		case 4:
				// 			params.villageTownsId = e.data[3].areaid;
				// 			break;
				// 		case 5:
				// 			params.villageId = e.data[4].areaid;
				// 			break;
				// 		default:
				// 			break;
				// 	}
				// }else{
				// 	switch (length) {
				// 		case 0:
				// 			break;
				// 		case 1:
				// 			params.provinceIdXjd = e.data[0].areaid;
				// 			break;
				// 		case 2:
				// 			params.cityIdXjd = e.data[1].areaid;
				// 			break;
				// 		case 3:
				// 			params.regionIdXjd = e.data[2].areaid;
				// 			break;
				// 		case 4:
				// 			params.villageTownsIdXjd = e.data[3].areaid;
				// 			break;
				// 		case 5:
				// 			params.villageIdXjd = e.data[4].areaid;
				// 			break;
				// 		default:
				// 			break;
				// 	}
				// }
				
				//搜索
				this.list = []
				this.lists(this.params);
			},
			getClearFn(){
				this.searchresult='';
				this.params={};
				this.lists(this.params)
			},
			goDetail(e) {
					// 记录选择的
					this.houseflag=true;
					this.statid=e.id;
			},
			//查询列表
			lists(params) {
				this.$http.get("boman-web-core/core/czrk/vaccineStatistics", params).then(res => {
					//停止下拉加载
					uni.hideNavigationBarLoading()
					uni.stopPullDownRefresh()
					if (res.code == 200) {
						this.list = res.data.townDatas
					} else {
						uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
				
					}
				
				
				})
			},
			//刷新
			bot_btn() {
				if (this.haveMore) {
					this.params.pageNum++
					this.lists(this.params)
				}
			},
			//搜索
			Seach() {
				this.list = [];
				this.lists(this.params)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.bgbox{position: fixed;left: 0;right: 0;top: 0;bottom: 0;z-index: 3;
    background: rgba(0,0,0,0.5);}
	.housebox{position: fixed;left: 0;right: 0;bottom: 0;z-index: 1000;background: #FFFFFF;border-radius: 30rpx 30rpx 0 0;
	.house_tit{width: 100%;height: 100rpx;position: relative;z-index: 999;background: #F2F2F2;border-radius: 30rpx 30rpx 0 0;display: flex;align-items: center;margin-bottom: 10rpx;
		.house_titl{font-size: 30rpx;color: #333333;flex: 0 0 auto;height: 100rpx;width: 120rpx;text-align: center;line-height:100rpx;}
		.house_titr{flex: 0 0 auto;font-size: 30rpx;color: #197DE0;height:100rpx;width:120rpx;text-align: center;line-height: 100rpx;}
		.house_titc{line-height: 40rpx;font-size: 34rpx;color: #333;padding: 30rpx;box-sizing: border-box;flex: 1;text-align: center;}
	
	}
	.houselist{width: 100%;text-align: center;font-size: 30rpx;color: #333333;line-height: 88rpx;
		&.act{color: #197DE0;}
		&:last-child{padding-bottom: 20rpx;}
	}
	}
	
	
	.nav_box{display: flex;align-items: center;justify-content: center;flex: 1;
		.nav_boxa{position: relative;width: 214rpx;height: 86rpx;
			.nav_boxb{width: 100%;height: 100%;display: none;}
			.nav_boxa1{font-size: 34rpx;font-weight: bold;color: #0678AC;text-align: center;padding-top: 14rpx;box-sizing: border-box;position: absolute;left: 0;top: 0;right: 0;bottom: 0;}
			&.act{color: #FFFFFF;
				.nav_boxb{display: block;}
				.nav_boxa1{color: #FFFFFF;}
			}
		}
	}
	.address{
		display: flex;align-items: center;
		.addtita{flex: 0 0 auto;font-size: 28rpx;font-weight: bold;
color: #343434;}
		.addressa{
			display: flex;align-items: center;
			flex: 1;
			display: flex;align-items: center;justify-content: flex-end;
			overflow: hidden;
			.addsa{font-size: 26rpx;color: #333333;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;flex: 1;text-align: left;}
			.addsimg{width: 16rpx;height: 24rpx;margin-left: 10rpx;flex: 0 0 auto;}
			.adds{
				flex:1;
				display: flex;align-items: center;justify-content: flex-start;padding:10rpx 20rpx;box-sizing: border-box;}
		}
		
		.addclear{color: #EA2929;font-size: 26rpx;flex: 0 0 auto;height: 60rpx;line-height: 60rpx;width: 128rpx;text-align:center}
	}
	
	
	.coie{
		width: 100%;
		box-sizing: border-box;
		padding:  0 33upx;
		.coie_nav{
			border-top: 1upx solid #E5E5E5;
			display: flex;
			flex-wrap: wrap;
			padding-bottom: 28upx;
			p{
				width: 33.33%;
				text-align: center;
				display: flex;
				flex-direction: column;
				margin-top: 53upx;
				span{
					font-size: 28upx;
				}
				i{
					font-size: 28upx;
					color: #333;
					margin-top: 28upx;
				}
			}
		}
	}
	.ieju{
		height: 17upx;
		width: 100%;
		background-color: #eee;
		margin-bottom: 33upx;
	}
	//暂无数据
	.zanwu {
		text-align: center;
		padding-top: 20upx;

		span {
			font-size: 24upx;
		}
	}

	.scroll-view {
		max-height: calc(100vh - 401upx);
	}

	.shax {
		// height: 83upx;
		font-size: 25upx;
		color: #666;
		text-align: center;
		min-height:80rpx;
		line-height: 80rpx;
	}

	.index {
		// padding-top: 33upx;
		height: 100vh;
		display: flex;
		flex-direction: column;
		.sous {
			padding: 24upx 33upx 0;
			// display: flex;
            
			.input {
				height: 80upx;
				border: 1upx solid #E5E5E5;
				flex: 1;
				margin-right: 28upx;
				padding-left: 10upx;
				box-sizing: border-box;
			}

			button {
				// width: 125upx;
				height: 80upx;
				background-color: #1678FF;
				text-size: 28upx;
				color: #fff;
				text-align: center;
				line-height: 80upx;
			}
		}

		//tab
		.tab {
			flex: 1;
			.tabs {
				display: flex;
				padding: 0 20upx;
				box-sizing: border-box;
				height: 111upx;
				justify-content: space-between;
				box-shadow: 0px 7px 7px 0px rgba(229, 229, 229, 0.5);

				.one_tab {
					color: #1678FF !important;
					// width: 140upx;
					// text-align: center;

					// .twotabs {
					// 	font-size: 31upx;
					// 	color: #666666;
					// 	;
					// 	font-weight: 500;
					// }

					// .twosrtabs {
					// 	color: #1678FF;
					// }

					// .twotabstwo {
					// 	font-size: 24upx;
					// 	color: #AAAAAA;
					// }
				}

				.one_tabqie {
					border-bottom: 8upx solid #1678FF;

				}
			}
		}

		//表格
		// .exele {
		// 	.box {
			table{
				flex: 1;
				display: flex;
				flex-direction: column;
				overflow: hidden;
				.tr_one {
					flex: 0 0 auto;
					display: flex;
					padding: 0 20upx;
					box-sizing: border-box;
					justify-content: space-between;

					th {
						// flex: 1;

						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #333333;
						line-height: 14upx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						line-height: 83upx;
						height: 83upx;
					}
				}

				.two_tr {
					display: flex;
					padding: 0 20upx;
					box-sizing: border-box;
					justify-content: space-between;

					td {
						// flex: 1;

						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #333333;
						line-height: 83upx;
						height: 83upx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;

					}

					.tdse {
						color: #E60012 !important;
					}
					.apply_span_xl{
						color: #32B16C !important;
					}
					.apply_span_xltwo{
						color: #ffa200 !important;
					}
					.apply_span_xlfive{
						color: #4c4b4b !important;
					}
					.apply_span_xlthreo{
						color: #f00404 !important;
					}
					.apply_span_xlforu{
						color: #aaaaaa !important;
					}
					.coiu {
						color: #EC1717;
					}
				}

				.two_trtwo {
					background-color: #F6F9FC;
				}
				.tabbox{
					flex: 1;
					overflow-y: auto;
				}
			}
		// 	}

		// }
	}

	.banj {
		height: 86upx;
		width: 100%;
		// text-align: center;
		line-height: 86upx;
		// background-color: #F6F9FC;
		color: #AAAAAA;
		margin-top: 20upx;
		display: flex;
		justify-content: space-around;
	}
	.apply_box{
		.apply_item_input{
			padding: 0 33upx;
			// border-top: 1upx solid #F4F4F4;
			display: flex;
			height: 68upx;
			align-items: center;
			.apply_span_x{
				font-size: 28upx;
				color: #363535;
				span{
					color: #F22346;
				}
			}
			.input_r{
				font-size: 28upx;
				height: 100%;
				flex: 1;
				text-align: right;
			}
			.input_rtwo{
				line-height:68upx;
			}
			.input_rtwoss{
				color: #1678FF;
			}
			.input_rtwosss{
				color: #FF0000;
			}
		}
		.apply_title_jt{
			height: 130upx;
			border-top: 1upx solid #F4F4F4;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 32upx;
			span{
				font-size: 36upx;
				color: #333;
				font-weight: bold;
			}
			.apply_title_btn{
				width: 160upx;
				height: 60upx;
				font-size: 24upx;
				color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;
				background: #FF568C;
				border-radius: 8upx;
				.img{
					width: 30upx;
					height: 30upx;
					margin-right: 10upx;
				}
			}
		}
		.apply_title_jts{
			border:none;
		}
		.apply_title_jt_item{
			border-bottom: 9upx solid #F4F4F4;
			.apply_item_input_qx{
				color: #FF5185;
				height: 100%;
				display: flex;
				justify-content: center;
				align-items: center;
				height: 112upx;
				font-size: 30upx;
			}
		}
		.apply_item_sfz{
			padding: 42upx 20upx;
			border-bottom: 9upx solid #F4F4F4;
			.apply_item_sfz_title{
				font-weight: bold;
				font-size: 34upx;
				margin-bottom: 40upx;
				margin-left: 2upx;
			}
			.apply_item_phones{
				display: flex;
				justify-content: space-between;
				.apply_item_phone{
					width: 340upx;
					height: 218upx;
					.img{
						width: 100%;
						height: 100%;
						border-radius: 20upx;
					}
				}
			}
		}
		.apply_item_zdxx{
			padding: 0 26upx;
			font-size: 34upx;
			font-weight: bold;
			color: #333;
			height: 112upx;
			line-height: 112upx;
			border: 1upx solid #F4F4F4;
		}
		.qt_div{
			height: 112upx;
			border-top: 1upx solid #F4F4F4;
			padding: 0 32upx;
			border-bottom: 9upx solid #F9F9F9;
			.input_l{
				height: 100%;
				font-size: 30upx;
			}
		}
	}
	.tabld{
		display: flex;
		// height: 90upx;
		box-shadow: 0px 7px 5px 0px rgba(218, 218, 218, 0.35);
		view {
			font-size:26upx ;
			font-family: PingFang SC;
			font-weight: 500;
			color: #191919;
			text-align: center;
			flex: 1;
			// line-height: 70upx;
			display: flex;
			flex-direction: column;
			padding: 18rpx 0 20rpx;
		}
		.one_tabhu{
			color: #009FE8;
			position: relative;
		::after{width: 28rpx;height: 6rpx;background: #009FE8;position: absolute;left: 50%;margin-left: -14rpx;bottom: 0;content: "";}
		}
	}
	.nbhe{
		display: flex;
		margin-bottom: 44upx;
		p{
			font-size: 25upx;
			flex: 1;
			padding: 0 77upx;
			display: flex;
			align-items: center;
		}
		p:nth-child(2){
			justify-content: flex-end;
		}
		img{
			width: 31upx;
			height: 29upx;
			margin-right: 11upx;
		}
	}
	.xinse{
		position: fixed;
		width: 100%;
		bottom: 0;
		left: 0;
		font-size: 33upx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		height: 90upx;
		background-color: #00B034;
		text-align: center;
		line-height: 90upx;
	}
	.sous_sear{
		flex: 0 0 auto;
		padding: 24rpx 34rpx;background: #FFFFFF;
		.sous_box{width: 100%;height:90rpx;background: #F2F2F2;border-radius: 6rpx;display: flex;align-items: center;padding: 0 34rpx;box-sizing: border-box;
			.sous_img{width: 32rpx;height: 34rpx;margin-right: 18rpx;flex: 0 0 auto;}
			.sous_input{font-size: 30rpx;color: #AAAAAA;flex: 1;}
		}
	}
	// 搜索条件width: 562rpx;
	.sfixed{min-height: 840rpx;background: #FFFFFF;border-radius: 14rpx;padding: 40rpx 34rpx;box-sizing: border-box;position: fixed;left: 60rpx;right: 60rpx;top: 50%;transform: translateY(-50%);
	z-index: 1100;max-height: calc(100vh - 280rpx);overflow-y: auto;
		.sfixed_tit{font-size: 28rpx;font-weight: bold;color: #343434;line-height: 44rpx;text-align: center;}
		.sfixed_clo{width: 34rpx;height: 34rpx;position: absolute;right: 34rpx;top: 44rpx;}
		.sfixed_box{
			padding-top: 20rpx;
			.sfixed_inp{width: 100%;height: 76rpx;background:#F2F2F2;padding: 0 34rpx;box-sizing: border-box;font-size: 28rpx;color: #333333;margin-top: 30rpx;}
			.sfixed_line{width: 62rpx;height: 6rpx;background: #009FE8;margin: 38rpx auto 32rpx;}
			.sfixed_flex{display: flex;align-items: center;justify-content: space-between;
				.sfixed_a{font-size: 26rpx;font-weight: bold;color: #666666;}
				.sfixed_ar{font-size: 26rpx;font-weight: bold;color: #DF0024;}
			}
		}
		.sfixed_btn{width: 100%;height: 76rpx;background: #00B034;border: 0px solid #00B034;border-radius: 6rpx;font-size: 28rpx;font-weight: bold;
color: #FFFFFF;text-align: center;line-height: 76rpx;margin-top: 62rpx;}
		
	}
	.delbox {
		width: 580rpx;
		background: #FFFFFF;
		border-radius: 14px;
		position: fixed;
		top: 50%;
		left: 80rpx;
		right: 80rpx;
		padding: 48rpx 34rpx 72rpx;
		box-sizing: border-box;
		z-index: 5;
		margin-top: -210rpx;
	
		.deltit {
			font-size: 28rpx;
			font-weight: bold;
			color: #343434;
			text-align: center;
			line-height: 40rpx;
		}
	
		.del_img {
			width: 34rpx;
			height: 34rpx;
			position: absolute;
			right: 34rpx;
			top: 44rpx;
		}
	
		.del_btn {
			width: 100%;
			height: 76rpx;
			background: #00B034;
			border-radius: 6rpx;
			font-size: 28rpx;
			font-weight: bold;
			color: #FFFFFF;
			text-align: center;
			line-height: 76rpx;
		}
	
		.del_list {
			display: flex;
			padding: 60rpx 0 40rpx;
			flex-wrap: wrap;
	
			.del_lista {
				width: 116rpx;
				height: 64rpx;
				background: #CACACA;
				border-radius: 32rpx;
				font-size: 26rpx;
				font-weight: 500;
				color: #FFFFFF;
				text-align: center;
				line-height: 64rpx;
				margin: 0 10rpx 20rpx 0;
	
				&.act {
					background-color: #019FE8;
				}
			}
		}
	}
</style>

