<%@ 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" />
<style>
	.tabBar{border-bottom:1px solid #ccc;margin: 10px 0;display: table;}
	.tabBar span{background-color: #fff;color: #999;display: table-cell;height: 40px;line-height: 40px;}
	.tabBar span.current{background-color: #fff;color:#333;position: relative;}
	.tabBar span.current:after{content: '';position: absolute;left: 50%;height: 2px;width: 50px;margin-left: -25px;bottom: 0;background-color: #333;}
</style>
<title>订单管理</title>
</head>
<body>

<!-- 发货 -->
	<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"> <span class="select-box" style="width:150px;">
				<select class="select" name="postFirm" size="1" id="postFirm">
					<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="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="col-9 col-offset-3">
	        <input class="btn btn-danger" onclick="return submitSendOrder()" 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>

	<!-- 同步订单状态 -->
	<div class="layui-layer layui-anim layui-layer-iframe" id="layui-SynOrder" 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-SynOrder">
			<div class="layui-layer-title" id="synOrder" style="cursor: move;" move="ok">同步订单状态</div>
			<br>
			<div class="row cl">
				<label class="form-label col-3"><span class="c-red">*</span>&nbsp;订单编号：</label>
				<div class="formControls col-5">
					<input type="hidden" id="url">
					<input type="text" id="efastOrderId" class="input-text" value="" placeholder="请输入百胜订单号" name="postNum" datatype="*2-20" nullmsg="订单编号不能为空">
				</div>
				<div class="col-4"> </div>
			</div>
			<div class="row cl">
				<div class="formControls col-8">&nbsp;&nbsp;&nbsp;<span class="c-red" id="msge"></span></div>
			</div>
			<br>
			<div class="col-9 col-offset-3">
				<input class="btn btn-danger" onclick="return submitSynOrder()" type="button" 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>

<!-- 审核备注 -->
	<div class="layui-layer layui-anim layui-layer-iframe" id="layui-audit" times="4" showtime="0" contype="string" style="display:none;width: 400px; height: 260px; position: absolute; top: 100px; left: 379px;">
		<form action="" method="post" class="form form-horizontal" id="form-admin-audit">
			<div class="layui-layer-title" id="audit" style="cursor: move;" move="ok">审核备注</div>
			<br>
			<div class="row cl">
				<label class="form-label col-3"><span class="c-red">*</span>&nbsp;审核备注：</label>
				<div class="formControls col-5">
					<input type="text" id="salesAuditRemark" name="salesAuditRemark" class="input-text" value="" placeholder="请输入审核备注" nullmsg="审核备注不能为空">
				</div>
				<div class="col-4"> </div>
			</div>
			<br>
			<div class="col-9 col-offset-3">
				<input class="btn btn-danger" onclick="return audit_order()" 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>

	<!-- 后台备注 -->
	<div class="layui-layer layui-anim layui-layer-iframe" id="layui-remark" times="4" showtime="0" contype="string" style="display:none;z-index: 19891018; width: 600px; height: 400px; position: absolute; top: 100px; left: 379px;">
		<form action="" method="post" class="form form-horizontal" id="form-admin-remark">
		<div class="layui-layer-title" id="sendOrderNote" 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"> <span class="select-box" style="width:150px;">
					<select class="select" id="adminRemarkColor" size="1">
						<option value="1" class="optionclass" id="optionclass1">红色</option>
						<option value="2" class="optionclass" id="optionclass2">黄色</option>
						<option value="3" class="optionclass" id="optionclass3">绿色</option>
					</select>
					</span>
				</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">
					 <textarea name="postNum" id="remarkInfoInput" cols="" rows="" class="textarea" style="width: 380px;height: 150px;"
							   placeholder="订单备注，最多支持100字符" onKeyUp="$.Huitextarealength(this,100)" ></textarea>
				</div>
				<div class="col-4"> </div>
			</div>
			<br>

			<div class="col-9 col-offset-3">
	        	<input class="btn btn-danger" type="button" onclick="remrakSumbit()" 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>


	<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-danger 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">
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<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>

			  </div>
			</div>
		</div>
		<br/>
		<div class="text-l">
			<form action="${pageContext.request.contextPath }/admin/order/selectShopOrderByOrderId" method="post" id="myForm">
				<input type="hidden" name="orderStatus" value="${orderStatusStr }" />
				<input type="text" name="text" id="text" value="${selectInput }" placeholder="订单编号" style="width: 150px" class="input-text">
				<input type="text" name="salesAddressTel" id="salesAddressTel" value="${salesAddressTel }" placeholder="电话号码" style="width: 150px" class="input-text">
				<input type="text" name="salesAddressName" id="salesAddressName" value="${salesAddressName }" placeholder="收货人" style="width: 150px" class="input-text">
				<input type="text" name="salesAddressInfo" id="salesAddressInfo" value="${salesAddressInfo }" placeholder="地址" style="width: 150px" class="input-text">
				日期范围：
				<input type="text" readonly="readonly" placeholder="开始日期" 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" placeholder="结束日期" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'2020-10-01'})" id="endDate" value="${endDate }" name="endDate" class="input-text Wdate" style="width: 120px;">
				 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<button name="" id="submitBtn" class="btn btn-danger" type="submit">
					<i class="Hui-iconfont">&#xe665;</i> 搜索
				</button>
				<button style="" name="" class="btn btn-danger" type="button" onclick="downloadExcel()">下载订单</button>
				<button style="display: none" name="" id="" class="btn btn-danger" type="button" onclick="downloadExcel2()">下载订单2</button>
			</form>
		</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="50">订单金额</th>
						<th width="50">支付金额</th>
						<th width="150">订单状态</th>
						<th width="150">时间</th>
						<th width="150">我们的备注</th>
						<th width="50">备注图标</th>
						<th width="150">用户备注</th>
						<th width="150">物流单号</th>
						<%--<th width="100">所属门店</th>
						<th width="100">所属VIP会员</th>--%>
						<th width="150">渠道</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.salesOrderid }</td>
								<td width="100">${order.salesAddressName }</td>
								<td width="100">${order.userNickname }</td>
								<td width="100">${order.salesAddressTel }</td>
								<td><fmt:formatNumber type="number" value="${order.salesAmount/100}" pattern="0.00" maxFractionDigits="2"/></td>
								<td><fmt:formatNumber type="number" value="${order.salesYetAmount/100}" pattern="0.00" maxFractionDigits="2"/></td>
								<td width="150">
									<c:choose>
										<c:when test="${order.salesStatus ==0 }">
											取消订单
										</c:when>
										<c:when test="${order.salesStatus ==1 }">
											待支付
										</c:when>
										<c:when test="${order.salesStatus ==2 }">
											已支付、待发货
										</c:when>
										<c:when test="${order.salesStatus ==3 }">
											退款申请中
										</c:when>
										<c:when test="${order.salesStatus ==4 }">
											已退款<c:if test="${order.salesIsRfund ==2 }"><br>(财务已退款)</c:if>
										</c:when>
										<c:when test="${order.salesStatus ==5 }">
											已发货
										</c:when>
										<c:when test="${order.salesStatus ==6 }">
											申请退货中
										</c:when>
										<c:when test="${order.salesStatus ==7 }">
											退货中
										</c:when>
										<c:when test="${order.salesStatus ==8 }">
											订单退货，订单关闭
										</c:when>
										<c:when test="${order.salesStatus ==9 }">
											换货中
										</c:when>
										<c:when test="${order.salesStatus ==10 }">
											换货完成
										</c:when>
										<c:when test="${order.salesStatus ==11 }">
											申请换货中
										</c:when>
										<c:when test="${order.salesStatus ==12 }">
											订单完成
										</c:when>
									</c:choose>
								</td>
								<td width="150"><fmt:formatDate value="${order.salesCreateDate }" pattern="MM-dd HH:mm" /></td>
								<c:if test="${fn:length(order.salesAdminRemark)>'5'}">
	                   				<td title="${order.salesAdminRemark }" id="${order.salesOrderid }AdminRemark" style="text-align: center;">${fn:substring(order.salesAdminRemark,0,5)}...</td>
				            	</c:if>  
				          		<c:if test="${fn:length(order.salesAdminRemark)<='5'}">
				             		<td title="${order.salesAdminRemark }" id="${order.salesOrderid }AdminRemark" style="text-align: center;">${order.salesAdminRemark}</td>
				          		</c:if>
								<td width="50">
									<c:choose>
										<c:when test="${order.salesColorType==1 }">
											<div style="width:100%;height:20px;background-color: red;" id="${order.salesOrderid }AdminRemarkColor" lang="1"></div>
										</c:when>
										<c:when test="${order.salesColorType==2 }">
											<div style="width:100%;height:20px;background-color: yellow;" id="${order.salesOrderid }AdminRemarkColor" lang="2"></div>
										</c:when>
										<c:when test="${order.salesColorType==3 }">
											<div style="width:100%;height:20px;background-color: green;" id="${order.salesOrderid }AdminRemarkColor" lang="3"></div>
										</c:when>
										<c:otherwise>
											<div style="width:100%;height:20px;background-color: white;" id="${order.salesOrderid }AdminRemarkColor" lang="3"></div>
										</c:otherwise>
									</c:choose>
								</td>
								<td width="150">${order.salesUserRemark }</td>
								<%--<td width="150"><a href="http://m.kuaidi100.com/index_all.html?type=${order.salesPostFirm }&postid=${order.salesPostNum }&callbackurl=http://w.iamberry.com/tooth/admin/order/selectShopOrder?orderStatus=${orderStatusStr}">${order.salesPostNum }</a></td>--%>
								<td width="150"><a href="#" onclick="openLogistics('物流信息','/tooth/view/view_logistics.html?billCode=${order.salesPostNum}&billName=${order.salesPostFirm  }',375,500);">${order.salesPostNum }</a></td>

								<%--<td width="100">${order.storesName }</td>
								<td width="100">${order.vipName }</td>
								<td class="text-c" width="100">${order.userResource }</td>--%>

								<td width="100">
									<c:if test="${ empty order.salesChannelType or order.salesChannelType == 0 }">微信商城</c:if>
									<c:if test="${ order.salesChannelType == 1 or order.salesChannelType == 2 }">${order.salesChannelName }</c:if>
								</td>

								<!-- 遍历操作 -->
							<td class="td-manage text-c">
								<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.salesOrderid }" 
								      					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>
		<br/>
				<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/layer/1.9.3/layer.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/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">
				// 选中对应的订单头信息
				$(".${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 == "同步订单状态") {
						$("#url").val("");
						$("#efastOrderId").val();
						$("#msge").html();

						$("#layui-SynOrder").show();
						var url = $a.attr("href");
						$("#url").val(url);
						return false;
                    } else if (orderStatusStr == "驳回退款" || orderStatusStr == "确认退款"
						|| orderStatusStr == "同意退货，等待收货" || orderStatusStr == "驳回退货"
						|| orderStatusStr == "同意换货" || orderStatusStr == "驳回换货") {
                        orderid = $a.attr("lang");
                        $("#layui-audit").show();
                        $("#form-admin-audit").attr("action", $a.attr("href"));
                        return false;
                    } else if (orderStatusStr == "标记财务已退款") {
                        var url = $a.attr("href");
                        //禁止<a>跳转
                        stopDefault($a.attr("href"));
                        $.ajax({
                            type: "GET",
                            url: url,
                            traditional: true,
                            dataType: "json",
                            success: function (data) {
								if (data.status) {
                                    layer.msg("标记成功！",{icon: 1,time:2000});
                                    //使用  setTimeout（）方法设定定时2000毫秒
                                    setTimeout(function(){
										window.location.reload();
                                    },2000);
                                } else {
                                    layer.msg(data.message,{icon: 5,time:2000});
								}
                            }
                        });
                    }
					return true;
				}

				//禁止链接跳转
                function stopDefault( e ) {
                    if ( e && e.preventDefault )
                        e.preventDefault();
                    else
                        window.event.returnValue = false;

                    return false;
                }

                function submitSendOrder() {
                    var postNumId = $('#order-post-num-id').val();
                    var postFirm = $('#postFirm').val();
                    if (postNumId == null || postNumId == '') {
                        layer.msg("请填写物流编号！",{icon: 5,time:2000});
                        return false;
                    }
                    if (postFirm == null || postFirm == '') {
                        layer.msg("请选择物流公司！",{icon: 5,time:2000});
                        return false;
                    }
                }
				
				// 提交备注
				function remrakSumbit() {
					var remarkInfoInput = $("#remarkInfoInput").val();
					if (remarkInfoInput.length >= 0 && remarkInfoInput.length <= 100) {
						var adminRemarkColor = $("#adminRemarkColor").val();
						var remarkInfoInput = $('#remarkInfoInput').val();
						var url = $("#form-admin-remark").attr("action");
						var args = {"datetime" : new Date().getTime(), "remark" : remarkInfoInput, "remarkColor" : adminRemarkColor};
						$.ajax({
							   type: "POST",
							   url: url,
							   traditional : true,
							   data: args,
							   dataType: "json",
							   success: function(data){
                                   var json = eval('(' + data + ')');
                                   if (json.status == true) {
										$("#layui-remark").hide();
										layer.msg(json.info,{icon:1,time:2000});
										$("#" + orderid + "AdminRemark").attr("title", remarkInfoInput);
										if (remarkInfoInput.length >= 3) {
											remarkInfoInput = remarkInfoInput.substr(0, 3) + "...";
										}
										$("#" + orderid + "AdminRemark").text(remarkInfoInput);
										var color = "";
										if (adminRemarkColor == "1") {
											color = "red";
										} else if (adminRemarkColor == "2") {
											color = "yellow";
										} else if (adminRemarkColor == "3") {
											color = "green";
										}
										
										$("#" + orderid + "AdminRemarkColor").css("background-color", color);
										$('#' + orderid + 'AdminRemark').html(remarkInfoInput);
									} else {
                                       alert(json.info);
										//layer.msg(json.info,{icon:5,time:2000});
									}
							   }
						});
					}
					
				}
				
				// 关闭窗口
				function exitWindowsDiv(_this) {
					$(_this).parent().parent().hide();
				}
				function showInfo(obj){
					window.location=" <%=request.getContextPath()%>/order/getShopOrderByOrderId?orderId="+obj;
				}
				
				// 搜索事件
					/* $("#submitBtn").click(function() {
						var orderId = $("#text").val();
						if (orderId == null && orderId == "") {
							layer.msg("输入信息不能为空哦!",{icon:5,time:2000});
							return false;
						}
					 $.ajax({
				         "type" : "post",
				         "url" : "/tooth/admin/order/getShopOrderByOrderId/"+orderId,
				         "dataType" : "json",
				         "data" :{
				        	 "type":"2"
				         },
				         "success" : function(resp) {
				        	 //alert(resp);
				        	 var htmloption="<option value=0 >无模板</option>";
				        	 for(var i=0,l=resp.length;i<l;i++){
				        		 htmloption=htmloption+"<option value='"+resp[i].templateId+"' selected>"+resp[i].templateName+"</option>";
				        	 }
				        	 $("#templateId").html(htmloption);
				        	 flage2=true;
				         },
				         "error":function(data){
				  			  alert(data.message);
				  			  alert("操作失败，请联系管理员！");
				  		  }
					    });
					}) */


                function openLogistics(title, url, w, h) {
                    layer_show(title,url,w,h);
					/*layer.open({
					 type: 1,
					 skin: 'layui-layer-rim', //加上边框
					 area: ['375px', '500px'], //宽高
					 content: url
					 });*/
					/* layer.open({
					 type: 2,
					 title: '物流信息',
					 fix: false, //不固定
					 shadeClose: true,
					 shade: 0.8,
					 area: ['375px', '500px'], //宽高
					 content: url
					 });*/

                }
                $(document).on('click', '.layui-layer-close', function() {
                    layer.closeAll();
                });

                /**
				 * 审核订单
				 */
                function audit_order() {
                    var salesAuditRemark = $('#salesAuditRemark').val();
                    if (salesAuditRemark == null || salesAuditRemark == '') {
                        layer.msg("请完善审核备注！",{
                            icon: 5,
                            zIndex: 999,
							time:2000
                        });
                        //通过这种方式弹出的层，每当它被选择，就会置顶。
                        /*layer.open({
                            type: 2,
                            shade: false,
                            area: '500px',
                            maxmin: true,
                            content: '请完善审核备注',
                            zIndex: 999, //重点1
                            success: function(layero){
                                layer.setTop(layero); //重点2
                            }
                        });*/
                        return false;
                    }
                    return true;
                }

				/**
				 * 同步订单状态
				 */
				function submitSynOrder(){
					var url = $("#url").val();
					var efastOrderId = $("#efastOrderId").val();
					if(efastOrderId == null || efastOrderId == ""){
						$("#msge").html("请输入百胜订单号！");
						return false;
					}
					$.ajax({
						type:'POST',
						url: url,
						data:{
							efastOrderId : efastOrderId
						},
						dataType: 'json',
						success:function(res) {
							debugger;
							if(res.resultCode == 200){
								$("#msge").html("同步成功");
								location.reload();
							}else{
								$("#msge").html(res.message);
							}
							return false;
						}
					});
				}

				function downloadExcel(){
                    var beginDate = $("#beginDate").val();
                    var endDate = $("#endDate").val();
                    if(beginDate == "" && endDate == ""){
                        var dd = new Date();
                        beginDate = dd.getFullYear() + "-" + ( dd.getMonth()+1) + "-" + 01;

                        dd.setMonth(dd.getMonth()+1);//获取下月月份
                        endDate = dd.getFullYear() + "-" + ( dd.getMonth()+1) + "-" + 01;
					}
                    window.location=" <%=request.getContextPath()%>/admin/order/download_order?beginDate="+ beginDate +"&endDate=" + endDate;
				}

                function downloadExcel2(){
				    var beginDate = $("#beginDate").val();
				    var endDate = $("#endDate").val();
                    window.location=" <%=request.getContextPath()%>/admin/order/download_order2?beginDate=2018-09-01&endDate=2018-10-31";
                }
				</script>
</body>
</html>