<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
    String basePath = request.getContextPath();
%>
<div class="table-responsive">
    <table class="table table-striped table-bordered table-hover " id="tablesOrder">
        <thead>
        <tr>
            <th>序号</th>
            <th>订单号</th>
            <th>使用方</th>
            <th>订单金额</th>
            <th>已付款金额</th>
            <th>下单日期</th>
            <th>订单类型</th>
            <th>状态</th>
            <th class="hidden-print">操 作</th>
        </tr>
        </thead>
        <tbody>
        <c:choose>
            <c:when test="${list!=null}">
                <c:forEach items="${list}" var="item" >
                    <tr>
                        <td>序号</td>
                        <td>${item.orderNumber}</td>
                        <td>
                            <a href='javascript:void(0);' onclick='fnShowDetailOrder(this)'>${item.userName}</a>
                            <input type="hidden" name="id" value="${item.id}"/>
                        </td>
                        <td>${item.orderAmount}</td>
                        <td>${item.orderState=="已付款"? item.orderAmount:"0.00"}</td>
                        <td><fmt:formatDate value="${item.orderTime}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                        <td>${item.orderType}</td>
                        <td>${item.orderState}</td>
                        <td>
                            <c:if test="${item.orderState=='已付款'}"><a href="javascript:void(0);"  onclick="fnShowModel(this)">详情</a></c:if>
                            <c:if test="${item.orderState !='已付款'}">-------</c:if>
                       </td>
                        <input  type="hidden" id="paymentTimeId" value="<fmt:formatDate value='${item.paymentTime}' pattern='yyyy-MM-dd'></fmt:formatDate>"/>
                    </tr>
                </c:forEach>
            </c:when>
            <c:otherwise>
                <tr>
                    <td colspan="4">无数据</td>
                </tr>
            </c:otherwise>
        </c:choose>
        </tbody>
    </table>
</div>
<div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header" >
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">支付详情</h4>
            </div>
            <div class="modal-body">
                <div class="modal-content4  "></div>
            </div>
            <%--<div class="modal-content4"></div>--%>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">确定</button>
            </div>
        </div>
    </div>
</div>
<jsp:include page="../../../common/admin/pager.jsp">
    <jsp:param name="pageNo" value="${pager.pageNo}"/>
    <jsp:param name="pageSize" value="${pager.pageSize}"/>
    <jsp:param name="total" value="${pager.total}"/>
</jsp:include>
<script type="text/javascript">

    
    function fnShowModel(tr) {
        $('#myModal').modal('show');
        var tables="<table id='fixedPriceTable' class='table table-bordered' align='center'>"+
            "<thead>"+
            "<tr>"+
            "<td>使用方(付款方)</td>"+
            "<td>金额</td>"+
            "<td>下单日期</td>"+
            "<td>类型</td><td>订单号</td>"+
            "</tr></thead><tbody><tr>"+
            "<td>"+$(tr).parent().parent().children('td:eq(2)').text()+"</td>"+
            "<td>"+$(tr).parent().parent().children('td:eq(3)').text()+"</td>"+
            /*"<td>"+$(tr).parent().parent().children('td:eq(7)').text()+"</td>"+*/
            "<td>"+$(tr).parent().parent().children('td:eq(5)').text()+"</td>"+
            "<td>"+$(tr).parent().parent().children('td:eq(6)').text()+"</td>"+
            "<td>"+$(tr).parent().parent().children('td:eq(1)').text()+"</td>"+
            "</tr></tbody></table>";
        $('.modal-content4').html(tables);
    }

    function fnShowDetailOrder(tr){
        var id = $(tr).parent().children("input[type='hidden'][name='id']").val();
        $.popBsPartial({ url: "<%=basePath%>/admin/order_mgr/detail.htm/" + id,size:WySharpSize.Large });
    }
</script>