mui.plusReady(function() {
	window.addEventListener('reload', function(e) { //执行刷新
		location.reload();
	});
	//获取亲人认证列表
	var page = 1;
	var pageSize = 10;
	var isjiazai = 1;
	getRecommend(page, pageSize);

	function getRecommend(page, pageSize) {
		var recommenddata = {
			page: page ? page : 1,
			pageSize: pageSize ? pageSize : 10
		}
		if (isjiazai == 0) {
			return;
		} else {
			isjiazai = 0;
		}
		JZL.ajax(qlgUrl('app/auth/getAuthFamilyPersonalSelect'), recommenddata, function(data) { //服务器返回响应，根据响应结果，分析是否登录成功；  
			//console.log(data);
			if (data.status == 1) {
				var html = '';
				var data = data.data;
				if ('' == data.Rows) {
					$('.mui-scroll').append(
						'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多数据</p>');
					isjiazai = 0;
					return;
				}
				$.each(data.Rows, function() {
					html += '<div class="block clearfix"><p class="pname">' + this.familyName +
						'(' + this.familyRelations +
						')</p><div class="caozuo"><span class="bj"  data-id="' + this.id +
						'"><img src="../img/bianji.png"></span><span class="del"  data-id="' + this.id +
						'"><img src="../img/delete.png"></span></div></div>';
					// //console.log(this.id);


				})
				if (page == 1) {
					$('.con').html(html);
				} else {
					$('.con').append(html);
				}
			} else {

			}
			isjiazai = 1;
		})
	}

	document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
		if (scroll.y == scroll.maxScrollY) {
			if (isjiazai == 1) {
				page++;
				getRecommend(page, pageSize);
			}
		}
	})
	var qrrzid;
	// 编辑
	mui('.con').on('tap', '.bj', function() {

		qrrzid = $(this).attr('data-id');
		//console.log(qrrzid);
		JZL.openWindow('addqrrz.html', qrrzid);
	})
	// 删除
	$('.con').on('tap', '.del', function() {
		qrrzid = $(this).attr('data-id');
		if (confirm('确认删除？')) {
			var lxy_div =
				'<div class="mui-backdrop lxy_home_zz" style="display: block;background-color: rgba(0,0,0,.7);" id="home_zhezhao">	<div class="lxy_zz clearfix"><h3>请输入操作密码</h3><div style="background:linear-gradient(to right,#48D1CC,#FFD700,#D2691E);height:2px; margin:10px auto"></div><input class="payword" type="password" placeholder="请输入操作密码"><div class="lxy_zz_btn"><button class="cancle" type="button">取消</button><button class="sure"  type="button">确定</button></div></div></div>';
			$('body').append(lxy_div);
			$('.lxy_zz').on('tap', function(e) {
				e.preventDefault();
				e.stopPropagation()
			})
			mui('.lxy_zz_btn').on('tap', '.cancle', function() {
				$('#home_zhezhao').remove();
				return;
			})

			mui('.lxy_zz_btn').on('tap', '.sure', function() {
				var payPwd = $('.payword').val();
				if (payPwd == '') {
					mui.alert("请输入密码")
				}
				JZL.ajax(qlgUrl('app/auth/delAuthFamily'), {
					id: qrrzid,
					payPwd: payPwd
				}, function(data) { //服务器返回响应，根据响应结果，分析是否登录成功；  
					// var data = toJson(data, 1);

					if (data.status == 1) {
						$('#home_zhezhao').remove();
						location.reload()
					}
				})

			})
		}
	})
	$('.add1').on('tap', function() {
		JZL.openWindow('addqrrz.html', 'addqrrz.html');

	})




})
