<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Jzdsh
  Date: 2019/4/2
  Time: 15:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户抽奖显示</title>
</head>
<script src="https://cdn.bootcss.com/jquery/3.3.1/core.js"></script>
<link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/static/admin/manage/h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/static/admin/manage/h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/static/admin/manage/Hui-iconfont/1.0.7/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/admin/manage/icheck/icheck.css"/>
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/static/admin/manage/h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/static/admin/manage/h-ui.admin/css/style.css"/>
<link href="/static/admin/css/page.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/manage/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/manage/js/layer.js"></script>

<body>
<nav class="breadcrumb">
    <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" 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="page-container">
    <form action="query.html" method="post" id="search">
        <div class="text-c">
			<span class="select-box inline">
				<select name="pid" class="select">
					<option value="" selected="selected">全部分类</option>
                    <c:forEach items="${prizeAll}" var="prizeAll">
                        <option value="${prizeAll.pid}">${prizeAll.pname}</option>
                    </c:forEach>
				</select>
			</span>
            <button onClick="$('#search').submit()" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i>
                搜索
            </button>
        </div>
    </form>
    <div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
		</span>
        <span class="r">共有数据：<strong id="count">${userconut}</strong> 条</span>
    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort">
            <thead>
            <tr class="text-c">
                <th width="40"><input id="sltall" type="checkbox"></th>
                <th width="80">ID</th>
                <th>用户邮箱</th>
                <th>用户手机号</th>
                <th>奖品名称</th>
                <th width="200">抽奖时间</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${userAllBysturt}" var="userAllBysturt">
                <tr class="text-c" id="${userAllBysturt.uid}">
                    <td><input name="allid" type="checkbox" value="${userAllBysturt.uid}"></td>
                    <td style="display:table-cell; vertical-align:middle">${userAllBysturt.uid}</td>
                    <td class="text-l" style="display:table-cell; vertical-align:middle">${userAllBysturt.uemil}</td>
                    <td class="text-l" style="display:table-cell; vertical-align:middle">${userAllBysturt.uphone}</td>
                    <td class="text-l" style="display:table-cell; vertical-align:middle">${userAllBysturt.uremark}</td>
                    <td style="display:table-cell; vertical-align:middle">${userAllBysturt.uDate}</td>
                    <td style="display:table-cell; vertical-align:middle">
                        <a style="text-decoration:none" class="ml-5" onClick="user_del(this,${userAllBysturt.uid})"
                           href="javascript:;"
                           title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <%--<div id="PageNum">--%>
    <%--<section>--%>
    <%--<div class="bd points-goods-list">--%>
    <%--<ul class="pages">--%>
    <%--<li>显示条数：</li>--%>
    <%--<li><select name="rows" class="select" id="select">--%>
    <%--<option value="10" selected="selected">10</option>--%>
    <%--<option value="20">20</option>--%>
    <%--<option value="50">50</option>--%>
    <%--<option value="100">100</option>--%>
    <%--</select></li>--%>
    <%--<li><a href="winlogs.html?type=&page=1&rows=10">首页</a></li>--%>
    <%--<li class="prev"><a href="winlogs.html?type=&page=0&rows=10">上一页</a></li>--%>
    <%--<li><a href="winlogs.html?type=&page=1&rows=10" class="active">1</a></li>--%>
    <%--<li><a href="winlogs.html?type=&page=2&rows=10">2</a></li>--%>
    <%--<li class="next"><a href="winlogs.html?type=&page=2&rows=10">下一页</a></li>--%>
    <%--<li><a href="winlogs.html?type=&page=85&rows=10">末页</a></li>--%>
    <%--</ul>--%>
    <%--</div>--%>
    <%--</section>--%>
    <%--</div>--%>
</div>
<script type="text/javascript">
    /*用户-删除*/
    function user_del(obj, id) {
        if (confirm('确认要删除吗？')) {
            $.post("delwin.html", {id: id}, function (data) {
            }, "json");
            var cont = $("#count").html();
            $("#count").html(cont - 1);
            $("#" + id).remove();
        }
    }

    $("#select").change(function () {
        var rows = $("#select").val();
        window.location.href = "winlogs.html?type=&page=1&rows=" + rows;
    });

    //全选与反选
    $("#sltall").click(function () {
        if ($(this).prop("checked")) {
            $("[name='allid']").prop("checked", true);//全选
        } else {
            $("[name='allid']").prop("checked", false);//取消全选
        }
    });

    //批量删除
    function datadel() {
        //jquery获取复选框值
        var chk_value = [];//定义一个数组
        $('input[name="allid"]:checked').each(function () {
            chk_value.push($(this).val());
        });
        if (chk_value == '') {
            layer.msg("请选择你要删除的信息！", {icon: 2, time: 1000});
        } else {
            if (confirm('确认要删除吗？')) {
                $.post("delUsers.html", {uid: chk_value.join(",")}, function (data) {
                    $("#count").html(data)
                }, "json");
                var str = chk_value.join(",");
                var arr = str.split(",");
                for (var i = 0; i < arr.length; i++) {
                    $("#" + arr[i]).remove()
                }
            }
        }
    }
</script>
</body>
</html>
