<%@ 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,user-scalable=no" />
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<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/css/style.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" />
<title>订单管理</title>
</head>
<body>
	<!-- 发货 begin -->
	<div class="layui-layer layui-anim layui-layer-iframe" id="layui-layer4" times="4" showtime="0" contype="string" style="display:none;z-index: 19891018; width: 400px; height: 260px; position: absolute; top: 100px; left: 379px;">
		<form action="" method="post" class="form form-horizontal" id="form-admin-add">
		<div class="layui-layer-title" id="sendOrderDivTitle" style="cursor: move;" move="ok">确认发货</div>
		<br>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red"></span>&nbsp;&nbsp;物流编号：</label>
			<div class="formControls col-5">
				<input type="text" id="order-post-num-id" class="input-text" value="" placeholder="请输入物流编号" name="postNum" datatype="*2-16" nullmsg="用户名不能为空">
			</div>
			<div class="col-4"> </div>
		</div>
		<br>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red"></span>&nbsp;&nbsp;物流公司：</label>
			<div class="formControls col-5"> <span class="select-box" style="width:150px;">
				<select class="select" name="postFirm" size="1">
					<option value="">请选择物流公司</option>
					<option value="sto">申通快递</option>
					<option value="yto">圆通快递</option>
					<option value="sf">顺丰快递</option>
					<option value="ems">邮政EMS</option>
					<option value="zto">中通快递</option>
					<option value="zjs">宅急送</option>
					<option value="yunda">韵达快递</option>
					<option value="cces">cces快递</option>
					<option value="pick">上门提货</option>
					<option value="htky">汇通快递</option>
					<option value="ttkdex">天天快递</option>
					<option value="stars">星晨急便</option>
					<option value="jd">京东快递</option>
					<option value="01">其他</option>
					<option value="02">上门送货</option>
				</select>
				</span> </div>
		</div>
		<br>
		<div class="col-9 col-offset-3">
	        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
	      </div>
	    </form>
		<span class="layui-layer-setwin">
			<a class="layui-layer-ico layui-layer-close layui-layer-close1" onclick="exitWindowsDiv(this)" href="javascript:;"></a>
		</span>
	</div>
	<!-- 发货 end -->
	
	<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 .pd-20>
		<div class="text-c"  style="padding-top:15px !important;">
		<form action="${pageContext.request.contextPath }/admin/rent_order/list" method="post" id="myForm">
			<input type="hidden" name="orderStatus" value="${orderStatusStr }" />
			订单编号：
			<input type="text" name="text" id="text" value="${text }" placeholder="订单编号" style="width: 150px" class="input-text">
			收货人姓名:
			<input type="text" name="probationSendName" id="probationSendName" value="${probationSendName }" placeholder="收货人姓名" style="width: 150px" class="input-text">
			收货人电话:
			<input type="text" name="probationSendTel" id="probationSendTel" value="${probationSendTel }" placeholder="收货人电话" style="width: 150px" class="input-text">
			收货人地址:
			<input type="text" name="sendAddress" id="sendAddress" value="${sendAddress }" placeholder="收货人地址" style="width: 150px" class="input-text">
			<%-- 日期范围： 
			<input type="text" readonly="readonly" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')||\'2020-10-01\'}'})" id="beginDate" value="${beginDate }" name="beginDate" class="input-text Wdate" style="width: 120px;">
			- <input type="text" readonly="readonly" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'2020-10-01'})" id="endDate" value="${endDate }" name="endDate" class="input-text Wdate" style="width: 120px;"> --%>
			<button name="" id="submitBtn" class="btn btn-success" type="submit">
				<i class="Hui-iconfont">&#xe665;</i> 搜索
			</button>
		</form>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20" style="margin-top:9px;">
			<div id="tab_demo" class="HuiTab">
			  <div class="tabBar cl">
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=allOrder'" class="allOrder">所有订单</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=returnOrderEtc'" class="returnOrderEtc">申请退货中</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=inOrder'" class="inOrder">申请换货中</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=paySuccess'" class="paySuccess">已支付、待发货</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=returnOrder'" class="returnOrder">退款申请中</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=returnOrderEtcAdmin'" class="returnOrderEtcAdmin">退货中</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=theOrderSuccess'" class="theOrderSuccess">换货中</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=sendOrder'" class="sendOrder">已发货</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=returnOrderThe'" class="returnOrderThe">订单退货，订单关闭</span>
			  	<%-- <span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=inFinish'" class="inFinish">已完成</span> --%>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=quitOrder'" class="quitOrder">取消订单</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=etcOrder'" class="etcOrder">待支付</span>
			  	<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=returnOrderSuccess'" class="returnOrderSuccess">已退款</span>
				<span onclick="location.href='${pageContext.request.contextPath }${statusUrl }&orderStatus=theOrderSuccessAdmin'" class="theOrderSuccessAdmin">已换货</span>
			  </div>
			</div>
		</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="10">单号</th>
						<th width="100">昵称</th>
						<th width="100">收货人</th>
						<th width="100">手机号码</th>
						<th width="100">快递单号</th>
						<th width="50">订单总额</th>
						<th width="50">支付金额</th>
						<th width="50">租赁类型</th>
						<th width="150">订单状态</th>
						<th width="100">创建时间</th>
						<th width="100">发货时间</th>
						<th width="150">操作</th>
					</tr>
				</thead>
				<!-- href="${pageContext.request.contextPath }/order/getShopOrderByOrderId?orderId="+${order.salesOrderid } -->
				<tbody>
					<c:if test="${ !(empty orderList)}">
						<c:forEach items="${orderList}" var="order">
							<tr>
								<td width="10">${order.rentOrderId }</td>
								<td width="100" class="nick-name-td">${order.rentUserNickName }</td>
								<td width="100">${order.rentAddressName }</td>
								<td width="100">${order.rentAddressTel }</td>
								<td width="150"><a href="http://m.kuaidi100.com/index_all.html?type=${order.rentPostFirm }&postid=${order.rentPostNum }&callbackurl='http://w.iamberry.com/tooth/admin/order/selectShopOrder?orderStatus=${rentStatus}'">${order.rentPostNum }</a></td>
								<td><fmt:formatNumber type="number" value="${order.rentAmount/100}" pattern="0.00" maxFractionDigits="2"/></td>
								<td><fmt:formatNumber type="number" value="${order.rentPayMoney/100}" pattern="0.00" maxFractionDigits="2"/></td>
								<td width="100">${order.typeName }</td>
								<td width="150">
									<c:choose>
										<c:when test="${order.rentStatus ==0 }">
											取消订单
										</c:when>
										<c:when test="${order.rentStatus ==1 }">
											待支付
										</c:when>
										<c:when test="${order.rentStatus ==2 }">
											已支付、待发货
										</c:when>
										<c:when test="${order.rentStatus ==3 }">
											退款申请中
										</c:when>
										<c:when test="${order.rentStatus ==4 }">
											已退款
										</c:when>
										<c:when test="${order.rentStatus ==5 }">
											已发货
										</c:when>
										<c:when test="${order.rentStatus ==6 }">
											申请退货中
										</c:when>
										<c:when test="${order.rentStatus ==7 }">
											退货中
										</c:when>
										<c:when test="${order.rentStatus ==8 }">
											订单退货，订单关闭
										</c:when>
										<c:when test="${order.rentStatus ==9 }">
											换货中
										</c:when>
										<c:when test="${order.rentStatus ==10 }">
											换货完成
										</c:when>
										<c:when test="${order.rentStatus ==11 }">
											申请换货中
										</c:when>
									</c:choose>
								</td>
								<td width="150"><fmt:formatDate value="${order.rentCreateDate }" pattern="MM-dd HH:mm" /></td>
								<td width="150"><fmt:formatDate value="${order.rentSendDate }" pattern="MM-dd HH:mm" /></td>
								
								<!-- 遍历操作 -->
							<td class="td-manage">
								<div class="dropDown dropDown_hover">
								  <a class="dropDown_A" href="#">操作</a>
								  <div class="dropDown-menu box-shadow" style="left:-22px;">
								    <ul>
								    	<c:if test="${!empty order.operations }">
								      	<c:forEach items="${order.operations }" var="oper">
								      		<li><a href="${pageContext.request.contextPath }${oper.url}" lang="${order.rentOrderId }" 
								      					title="${oper.name}" alt="${oper.name}" onclick="return orderAction(this)">
								      				<i class="Hui-iconfont">${oper.img}</i><font>${oper.name}</font>
								      			</a>
								      		</li>
								      	</c:forEach>
								      </c:if>
								    </ul>
								  </div>
								</div>
							</td>
							</tr>
						</c:forEach>
					</c:if>
				</tbody>
				</table>
				</div>
				<div align="right">
					<%@include file="/common/other/paper/pager.jsp"%>
				</div>
				</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/Validform/5.3.2/Validform.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/icheck/jquery.icheck.min.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">
				$(function() {
					var $td = $(".nick-name-td");
					if ($td.length > 0) {
						for (var i = 0; i < $td.length; i++) {
							var t = decodeURI($($td[i]).text());
							$($td[i]).text(t);
						}
					}
				});
				// 选中对应的订单头信息
				$(".${orderStatusStr}").attr("class", "current");
				// 订单操作
				function orderAction(_this) {
					var $a = $(_this);
					var orderStatusStr = $a.children("font").text();
					if (orderStatusStr == "发货" || orderStatusStr == "录入物流信息并发货") {
						$("#layui-layer4").show();
						$("#sendOrderDivTitle").html("为'" + $a.attr("lang") + "'发货:");
						$("#form-admin-add").attr("action", $a.attr("href"));
						return false;
					} else if (orderStatusStr == "备注") {
						orderid = $a.attr("lang");
						$("#layui-remark").show();
						$("#form-admin-remark").attr("action", $a.attr("href"));
						// 回显现有的备注
						$("#remarkInfoInput").val($("#" + $a.attr("lang") + "AdminRemark").attr("title"));
						$(".optionclass").attr("selected", "");
						$("#optionclass" + $("#" + $a.attr("lang") + "AdminRemarkColor").attr("lang")).attr("selected", true);
						return false;
					} else if (orderStatusStr == "同步订单状态") {
                        var url = $a.attr("href");
                        $.ajax({
                            type:'POST',
                            url: url,
                            dataType: 'json',
                            success:function(data) {
                                location.reload();
                            }
                        });
                        return false;
                    }
					return true;
				}

                // 关闭窗口
                function exitWindowsDiv(_this) {
                    $(_this).parent().parent().hide();
                }
				</script>
</body>
</html>