var pageii = null;
var grid = null;
/*, {
name : "头像",
renderData : function( rowindex ,data, rowdata, colkeyn) {
	if(rowdata.head==null ||rowdata.head==''){
		return "<img src='"+rootPath+"/images/head.png'>";
	}else{
		return "<img style='max-width:120px;height:60px;' src='"+rootPath+"/upload/"+rowdata.head+"'>";
	}
}
}*/
$(function() {
	grid = lyGrid({
		id : 'paging',
		l_column : [ {
			colkey : "signId",
			width : "100px",
			hide : true
		}, {
			colkey : "uname",
			name : "姓名"
		}
		, {
			colkey : "phone",
			name : "手机号"
		}, {
			colkey : "signTime",
			name : "报名时间",
		}, {
			colkey : "status",
			name : "预约状态",
			renderData : function( rowindex ,data, rowdata, colkeyn) {
				if(rowdata.status=='0'){
					return "等待审核";
				}else if(rowdata.status=='1'){
					return "审核通过";
				}else if(rowdata.status=='2'){
					return "活动结束";
				}else{
					return "审核失败";
				}
			}
		}],
		jsonUrl : rootPath + '/eventsign/search.shtml',
		checkbox : true,
		serNumber : false,
		checkValue:'signId'
	});

	$("#search").click("click", function() {// 绑定查询按扭
		var searchParams = $("#searchForm").serializeJson();// 初始化传参数
		grid.setOptions({
			data : searchParams
		});
	});

	$("#passBtn").click(function() { // 审核通过
		var cbox = grid.getSelectedCheckbox();
		if (cbox == "") {
			layer.msg("至少选择一项");
			return;
		}
		layer.confirm('有【'+cbox.length+'】条记录【通过审核】  确认操作？ ', function(index) {
			var _URL = rootPath + '/eventsign/failed.shtml';
			var resp = CommnUtil.ajax(_URL, {
				ids : cbox.join(",")
			}, "json");
			layer.msg(resp.code,{icon: 5});
			if (resp.code == "01") {
				layer.msg(resp.msg,{icon: 1});
				grid.loadData();
			} else {
				layer.msg('操作失败',{icon: 5});
			}
		});
	});

	$("#failBtn").click(function() { // 审核失败
		var cbox = grid.getSelectedCheckbox();
		if (cbox == "") {
			layer.msg("至少选择一项");
			return;
		}
		layer.confirm('有【'+cbox.length+'】条记录【审核失败】  确认操作？', function(index) {
			var _URL = rootPath + '/eventsign/passed.shtml';
			var resp = CommnUtil.ajax(_URL, {
				ids : cbox.join(",")
			}, "json");
			layer.msg(resp.code,{icon: 5});
			if (resp.code == "01") {
				layer.msg(resp.msg,{icon: 1});
				grid.loadData();
			} else {
				layer.msg('操作失败',{icon: 5});
			}
		});
	});

});

