<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/html5.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/PIE_IE678.js"></script>
<![endif]-->
<%--<link href="${pageContext.request.contextPath }/common/css/bootstrap.min-3.3.css" rel="stylesheet" type="text/css" />--%>
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/style.css" rel="stylesheet" type="text/css" />

	<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->

<title>下线用户信息列表</title>
</head>
<body>
<nav class="breadcrumb" style="height:45px;padding-top:5px;padding-bottom:5px"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 分销管理 <span class="c-gray en">&gt;</span>分销商管理 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>


<div class="pd-20 text-c">
	<form action="${pageContext.request.contextPath }/admin/drp/getPersonalInfo" method="post">
		<input type="hidden" id="pageNo" value=1 />

		<input type="hidden" id="id" name="id" value=${id} />

		<input name="userNickname" id="userNickname" value="${userNickname}"  placeholder="昵称" style="width:150px" class="input-text" type="text">

        <%--<div>
            关注状态：<span class="select-box inline">
		    <select class="select" id="" name="status" style="width:150px;">
		    	<option value="0">请选择</option>
		      	<option value="0" <c:if test="${status == 0 }">selected="selected"</c:if>>已取消关注</option>
		      	<option value="1" <c:if test="${status == 1 }">selected="selected"</c:if>>未关注</option>
				<option value="2" <c:if test="${status == 2 }">selected="selected"</c:if>>已关注</option>
		    </select>
	    </span>
--%>
		<button name="" id="submitBtn" onclick="return dataCheck();" class="btn btn-success radius" type="submit">
			<i class="Hui-iconfont"></i> 搜索
		</button>
	</form>
	<form id="goodsform" >
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l">
				总下线用户数：${totalCount }&nbsp;&nbsp;&nbsp;&nbsp;
				已购机器人数：${alreadyNumber}&nbsp;&nbsp;&nbsp;&nbsp;
				已购机器台数：${unitsNumber}&nbsp;&nbsp;&nbsp;&nbsp;
				机器消费总金额：<fmt:formatNumber type="number" value="${totalAmount/100 }" pattern="0.00" maxFractionDigits="2"/>
		    </span>
		</div>
		<table class="table table-border table-bordered table-bg" id="example">
			<thead>
			<tr>
				<th scope="col" colspan="6">普通用户列表</th>
			</tr>
			<tr class="text-c">
				<th width="100">用户头像</th>
				<th width="100">昵称</th>
				<th width="100">关注状态</th>
				<th width="100">关注时间</th>
				<th width="100" >消费金额</th>
				<th width="100" >购买机器台数</th>
			</tr>
			</thead>
			<tbody>
			<c:if test="${! (empty list) }">
			<c:forEach items="${list }" var="member">
			<tr class="text-c">

				<td>
					<c:if test="${!empty member.userHead }">
						<img alt="用户头像" src="${member.userHead }" style="width:50px;height: 50px">
					</c:if>
					<c:if test="${empty member.userHead }">
						<img alt="默认头像" src="http://s.iamberry.com/images/logo_tooth.jpg" style="width:50px;height: 50px">
					</c:if>
				</td>
				<%--<td>${placeInfo.name }</td>--%>
				<td>${member.userNickname }</td>
				<td>
					<c:if test="${member.userStatus == 0}">已取消关注</c:if>
					<c:if test="${member.userStatus == 1}">未关注</c:if>
					<c:if test="${member.userStatus == 2}">已关注</c:if>
				</td>
				<td>
					<%--关注时间--%>
					<fmt:formatDate value="${member.userSubDate }" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<%--消费金额--%>
					<fmt:formatNumber type="number" value="${member.totalConsume/100 }" pattern="0.00" maxFractionDigits="2"/>
				</td>
				<td>
					<%--已购买机器台数--%>
					${member.quantityPurchased }
				</td>
				</c:forEach>
				</c:if>
				<c:if test="${(empty list)}">
					<tr class="text-c">
						<td colspan="9">
							未查询到商户信息记录!
						</td>
					</tr>
				</c:if>
			</tbody>
		</table>
		<div align="right" class="mt-10 mb-10 mr-10">
			<%@include file="/common/other/paper/pager.jsp"%>
		</div>
	</form>
</div>


<div class="pd-20">


</div>
<div align="right" style="margin-right:20px;margin-top:-40px">
	<ul class="pagination" id="pagination2"></ul>
</div>

<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/datatables/1.10.0/dataTableUtil.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
<%--<script type="text/javascript" src="${pageContext.request.contextPath }/common/js/page/jqPaginator.js"></script>--%>
<script type="text/javascript">
var gobaltable;

function searchInfo(){
	$("#pageNo").val(1);
	gobaltable.ajax.reload();
}

function inUserInfo(value) {

	 $.ajax({
  		  url: "/tooth/admin/member/selectUserIdByOpenId",
          dataType:"json",
  		  type:"post",
  		  data:{
			  "openId":value
		  },
  		  success: function(data){
  			window.location.href='${pageContext.request.contextPath }/admin/member/showMenberInfo/' + data.data;
  		  },
  		  error:function(data){
  			  alert(data.message);
  			  alert("操作失败，请查看网络是否正常！");
  		  }
  		});
}

function offlineSubscriber(openid){
	$.ajax({
		url: "/tooth/admin/member/selectUserIdByOpenId",
		dataType:"json",
		type:"post",
		data:{
			"openId":value
		},
		success: function(data){
			window.location.href='${pageContext.request.contextPath }/admin/member/showMenberInfo/' + data.data;
		},
		error:function(data){
			alert(data.message);
			alert("操作失败，请查看网络是否正常！");
		}
	});
}

/***
 * 搜索
 */
function  dataCheck(){
    return true;
}

//添加一个商户
function openWindow(){
	layer.open({
		  type: 2,
		  area: ['700px', '530px'],
		  fix: false, //不固定
		  maxmin: true,
		  content: '/tooth/admin/drp/addPlaceInfo'
		});
}

function openWindowBattle(){
	layer.open({
		  type: 2,
		  area: ['1200px', '630px'],
		  fix: false, //不固定
		  maxmin: true,
		  content: '/tooth/admin/drp/addPlaceInfoBattle'
		});
}


function openWindow2(){
	layer.open({
		  type: 2,
		  area: ['700px', '530px'],
		  fix: false, //不固定
		  maxmin: true,
		  content: '/tooth/admin/drp/orderPlaceInfo'
		});
}

//删除记录
$("table").on("click","[name='deleteSingle']",function(){
    var d = $(this).parent().parent().find(".id").val();
    layer.confirm('确认删除该商户吗？',function(index) {
        $.ajax({
            url: "/tooth/admin/drp/deletePlaceInfo?id=" + d,
            dataType: "json",
            type: "get",
            success: function (data) {
                //alert(data);
                layer.msg("删除成功！",{icon: 1,time:2000});
                tableRefresh();
                //gobaltable.ajax.reload();
            },
            error: function (data) {
                layer.msg("删除失败！",{icon: 5,time:2000});
                //alert("操作失败，可能关联依赖出现问题！");
            }
        });

        // gobaltable.ajax.reload();
    });

});

//弹出修改页面
$("table").on("click","[name='updateInfo']",function(){
	layer.open({
		  type: 2,
		  area: ['700px', '530px'],
		  fix: false, 
		  maxmin: true,
		  content: '/tooth/admin/drp/EditPlaceInfo?id='+$(this).parent().parent().find(".id").val()
		});
});
//弹出绑定页面
$("table").on("click","[name='bindingInfo']",function(){
	layer.open({
		  type: 2,
		  area: ['750px', '530px'],
		  fix: false, 
		  maxmin: true,
		  content: '/tooth/admin/drp/bindingPlaceInfo?initCode='+$(this).parent().parent().find(".initCode").val()
		});
});


$("table").on("click","[name='downLoad']",function(){
	var url = $(this).parent().parent().find(".qrcodeUrl").val();
	var id = $(this).parent().parent().find(".id").val();
	var form=$("<form>");//定义一个form表单
	form.attr("style","display:none");
	form.attr("target","");
	form.attr("method","post");
	form.attr("action","/tooth/admin/drp/downLoad?url="+url+"&openId="+id);
	var input1=$("<input>");
	input1.attr("type","hidden");
	input1.attr("name","exportData");
	input1.attr("value",(new Date()).getMilliseconds());
	$("body").append(form);//将表单放置在web中
	form.append(input1);
	form.submit();//表单提交
});


function ajaxSend(url,data){
	$.ajax({
		  url: url,
		  data: data,
		  asyn:false,
		  success: function(data){
			  var obj=eval("("+data+")");
			  //alert(obj.message);
			  gobaltable.ajax.reload();
		  },
		  error:function(data){
			  alert("操作失败，可能关联依赖出现问题！");
		  }
		});
}

function uploadExcel() {
	document.form1.action='${pageContext.request.contextPath }/admin/drp/upLoadExcel';
	document.form1.submit();
}

function downLoadList() {
	//document.form1.action='${pageContext.request.contextPath }/admin/drp/downLoadList';
	$("#loadDeal").removeClass("hidden");
	 $.ajax({
  		  url: "/tooth/admin/drp/battle2w",
          dataType:"json",
  		  type:"get",
  		  data:{
  			  "name":$("#name").val(),
  			  "supperName":$("#supperName").val(),
  			  "openid":$("#openind").val()
  		  },
  		  success: function(data){
  			  //alert(data.message);
  			//alert(data.fileName);
  			  if(data.status=="true"){
  				window.location.href='${pageContext.request.contextPath }/admin/drp/downLoadList?zipName='+data.fileName+".zip";
  			  }
  			$("#loadDeal").addClass("hidden");
  		  },
  		  error:function(data){
  			 alert(data.message);
  		  }
  		});
	 
}

/**
 * 用于刷新页面
 */
function tableRefresh(){
    location.reload();
}

</script> 
</body>
</html>