<%@ 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" %>
<!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,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <LINK rel="Bookmark" href="/favicon.ico">
    <LINK rel="Shortcut Icon" href="/favicon.ico" />
    <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/skin/default/skin.css" rel="stylesheet" type="text/css" id="skin" />
    <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="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>待入账积分记录列表</title>
</head>
<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 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">
    <form action="${pageContext.request.contextPath }/admin/userIntegral/listStayIntegral" method="post" style="margin-bottom: 20px;text-align: center;">

        <span class="select-box" style="width: 150px;height: 31px;">
            <select id="integralRemarks" name="integralRemarks" class="select" >
                <option value="" >待入积分类型</option>
                <option value="首次注册会员赠送" ${integralRemarks=='首次注册会员赠送'?'selected':''}>首次注册会员赠送</option>
                <option value="微信商城下单赠送" ${integralRemarks=='微信商城下单赠送'?'selected':''}>微信商城下单赠送</option>
                <option value="扫描产品唯一码赠送" ${integralRemarks=='扫描产品唯一码赠送'?'selected':''}>扫描产品唯一码赠送</option>
            </select>
        </span>

         <span class="select-box" style="width: 150px;height: 31px;">
            <select id="stayStatus" name="stayStatus" class="select" >
                <option value="" >待入积分状态</option>
                <option value="1" ${stayStatus=='1'?'selected':''}>待入账</option>
                <option value="2" ${stayStatus=='2'?'selected':''}>已入账</option>
                <option value="3" ${stayStatus=='3'?'selected':''}>订单取消/退货,撤回</option>
                <option value="4" ${stayStatus=='4'?'selected':''}>取消</option>
            </select>
        </span>

        <input name="userName" id="userName" value="${userName }" placeholder="会员姓名搜索" style="width: 150px" class="input-text" type="text">

        <input name="userNickName" id="userNickName" value="${userNickName }" placeholder="微信昵称搜索" style="width: 150px" class="input-text" type="text">

        <input  id="beginDate" value="<fmt:formatDate value="${stayRecordedTime}" pattern="yyyy-MM-dd"/>" name="stayRecordedTime" class="input-text Wdate" placeholder="请选择入账日期" style="width: 150px;" type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'2020-10-01'})" readonly>
        <input name="changeIntegralMin" id="changeIntegralMin" value="${changeIntegralMin }" placeholder="变动积分数量" style="width: 150px" class="input-text" type="text" onkeyup="value=value.replace(/[^\d]/g,'')">-
        <input name="changeIntegralMax" id="changeIntegralMax" value="${changeIntegralMax }" placeholder="变动积分数量" style="width: 150px" class="input-text" type="text" onkeyup="value=value.replace(/[^\d]/g,'')">

        <button name="" id="submitBtn" onclick="return dataCheck();" class="btn btn-success" type="submit">
            <i class="Hui-iconfont"></i> 搜索
        </button>
    </form>
    <form id="goodsform" >
        <table class="table table-border table-bordered table-bg">
            <thead>
            <tr>
                <th scope="col" colspan="11">待入账积分列表</th>
            </tr>
            <tr class="text-c">
                <th width="150">变动积分</th>
                <th width="150">会员姓名</th>
                <th width="150">微信昵称</th>
                <th width="90">积分来源</th>
                <th width="150">到账日期</th>
                <th width="130">状态</th>
                <th width="100">会员累计积分</th>
                <th width="100">待入账总积分</th>
                <th width="100">会员可用积分</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:if test="${! (empty page.dataList) }">
            <c:forEach items="${page.dataList }" var="infolist">
            <tr class="text-c">
                <td>+${infolist.stayNumber}</td>
                <td>${infolist.userName }</td>
                <td>${infolist.userNickName }</td>
                <td>${infolist.integralRemarks }</td>
                <td><fmt:formatDate value="${infolist.stayRecordedTime }" pattern="yyyy-MM-dd"/></td>
                <td>
                    <c:choose>
                        <c:when test="${infolist.stayStatus == 1 }">
                            待入账
                        </c:when>
                        <c:when test="${infolist.stayStatus == 2 }">
                            已入账
                        </c:when>
                        <c:when test="${infolist.stayStatus == 3 }">
                            订单取消/退货,撤回
                        </c:when>
                        <c:when test="${infolist.stayStatus == 4 }">
                            取消
                        </c:when>
                        <c:otherwise>
                            无
                        </c:otherwise>
                    </c:choose>
                </td>
                <td>${infolist.userIntegral}</td>
                <td>${infolist.userStayIntegral}</td>
                <td>${infolist.userSurplusIntegral}</td>
                <td>
                    <c:if test="${infolist.stayStatus == 1 }">
                        <a id="updateId${infolist.stayId}" onclick="updateStatus(${infolist.stayId},4);">取消入账</a>
                    </c:if>
                </td>
                </c:forEach>
                </c:if>
                <c:if test="${empty page.dataList}">
                    <tr align="center"><td colspan="11" style="text-align: center;">未查询到该类数据!</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>
<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/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/admin/js/tips.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    /* $(document).ready(function(){
     $('#beginDate').datepicker();//时间控件
     $('#endDate').datepicker();
     }); */
    function  dataCheck(){
        //会员姓名数据验证
        if($("#userName").val()!= ""){
            if(!commonLengthJdg('userName',1,30,null,true)){
                layer.msg("会员姓名长度为1-30位",{icon: 5,time:3000});
                return false;
            }
        }
        //微信昵称数据验证
        if($("#userNickName").val()!= ""){
            if(!commonLengthJdg('userNickName',1,30,null,true)){
                layer.msg("会员昵称长度为1-30位",{icon: 5,time:3000});
                return false;
            }
        }

    }
    function updateStatus(id,status){
        layer.confirm('确认要修改状态吗？',function(index){
            $.ajax({
                url: '${pageContext.request.contextPath }/admin/userIntegral/updatestayIntegralStatus',
                type: "POST",
                dataType: "json",
                data: {stayId : id,stayStatus : status},
                error:function(){
                    layer.msg(data.status,{icon: 5,time:2000});
                },
                success:  function(data){
                    if(data.status){
                        layer.msg("取消成功",{icon: 1,time:2000});
                        $("#updateId"+id).hide();


                    }else{
                        layer.msg("取消失败",{icon: 2,time:2000});
                    }
                }
            });
        })
    }
</script>
</body>
</html>