<%@ 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/receive/listReceive" method="post" style="text-align: center;margin-bottom: 10px;">

        <input name="salesOrderId" id="salesOrderId" value="${salesOrderId }" placeholder="订单编号" style="width: 150px" class="input-text" type="text">
        <input name="salesAddressTel" id="salesAddressTel" value="${salesAddressTel }" placeholder="手机号码" style="width: 150px" class="input-text" type="text">
        <input name="salesPostNum" id="receivePostNum" value="${salesPostNum }" placeholder="物流编号" style="width: 150px" class="input-text" type="text">

        <span class="select-box" style="width: 150px">
            <select id="receiveStatus" name="receiveStatus" class="select">
                <option value="" >订单状态</option>
                <option value="1" ${salesStatus==1?'selected':''}>待付款</option>
                <option value="2" ${salesStatus==2?'selected':''}>已付款(待发货)</option>
                <option value="3" ${salesStatus==3?'selected':''}>已发货</option>
            </select>
        </span>

        <button name="" id="submitBtn" 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="13">定制牙刷订单管理列表</th>
            </tr>
            <tr class="text-c">
                <th width="150">订单号</th>
                <th width="150">订单状态</th>
                <th width="150">姓名</th>
                <th width="150">电话</th>
                <th width="150">用户备注</th>
                <th width="150">物流公司</th>
                <th width="150">物流单号</th>
                <th width="80">牙刷图片</th>
                <th width="100">类型</th>
                <th width="180">状态</th>
                <th width="180">创建时间</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.salesOrderId }</td>

                   <td>
                        <c:choose>
                            <c:when test="${infolist.orderInfo.salesStatus ==0 }">取消订单</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==1 }">待支付</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==2 }">已支付、待发货</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==3 }">退款申请中</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==4 }">已退款</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==5 }">已发货</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==6 }">申请退货中</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==7 }">退货中</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==8 }">订单退货，订单关闭</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==9 }">换货中</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==10 }">换货完成</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==11 }">申请换货中</c:when>
                            <c:when test="${infolist.orderInfo.salesStatus ==12 }">订单完成</c:when>
                        </c:choose>
                    </td>

                   <td>${infolist.orderInfo.salesAddressName }</td>
                   <td>${infolist.orderInfo.salesAddressTel}</td>
                   <td>${infolist.orderInfo.salesUserRemark}</td>
                   <td>
                        <c:choose>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'sto' }">申通快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'yto' }">圆通快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == '02' }">上门送货</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'sf' }">顺丰快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'ems' }">邮政EMS</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'zto' }">中通快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'zjs' }">宅急送</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'yunda' }">韵达快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'cces' }">cces快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'pick' }">上门提货</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'htky' }">汇通快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'ttkdex' }">天天快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'stars' }">星晨急便</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == 'jd' }">京东快递</c:when>
                            <c:when test="${infolist.orderInfo.salesPostFirm == '01' }">其他</c:when>
                        </c:choose>
                    </td>
                    <td width="150"><a href="#" onclick="openLogistics('物流信息','/tooth/view/view_logistics.html?billCode=${infolist.orderInfo.salesPostNum}&billName=${order.salesPostFirm  }',375,500);">${order.salesPostNum }</a></td>

                    <td><img width="100" height="100" src="${pageContext.request.contextPath }/${infolist.customizedImg }" /></td>

                    <td>
                        <c:choose>
                            <c:when test="${infolist.customizedType == 1 }">微信</c:when>
                            <c:when test="${infolist.customizedType == 2 }">天猫</c:when>
                        </c:choose>
                    </td>
                    <td>
                        <c:choose>
                            <c:when test="${infolist.customizedStatus == 1 }">正常</c:when>
                            <c:when test="${infolist.customizedStatus == 2 }">未上传订单</c:when>
                        </c:choose>
                    </td>

                    <td><fmt:formatDate value="${infolist.customizedCreateTime}" pattern="yyyy-MM-dd"/></td>

                    <td>
                    <%-- <c:if test="${infolist.receiveStatus == 2 }">
                           <a href="javascript:void(0)" lang="发货" title="发货" alt="发货" onclick="ship(${infolist.receiveId })">
                                <i class="Hui-iconfont">&#xe627;</i>
                            </a>
                        </c:if>
                        <c:if test="${infolist.receiveStatus == 1 || infolist.receiveStatus == 3 }">
                          -
                        </c:if>--%>
                    </td>
                 </c:forEach>
             </c:if>
                <c:if test="${empty page.dataList}">
                    <tr align="center"><td colspan="13" 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>


<div class="layui-layer layui-anim layui-layer-iframe" id="layui-layer4" times="4" showtime="0" contype="string" style="display:none;z-index: 2; width: 400px; height: 260px; position: absolute; top: 100px; left: 379px;">
    <form action="#" method="post" class="form form-horizontal" id="form-admin-add">
        <input type="hidden" id="shopReceiveId" name="shopReceiveId" value="">
        <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" 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="col-9 col-offset-3">
            <input class="btn btn-danger" onclick="return shipPost(this)" 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>

<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();
     }); */
    /**
     * 发货
     * @param receiveId
     */
    function  ship(receiveId){
        $("#layui-layer4").show();
        $("#shopReceiveId").val(receiveId);
    }

    /**
     * 发货
     * @param receiveId
     */
    function  shipPost(node){
        var url = "${pageContext.request.contextPath }" + '/admin/receive/ship';
        var receiveId = $('#shopReceiveId').val();
        var receivePostNum = $('#order-post-num-id').val();
        var receivePostFirm = $('#postFirm').val();
        if (receivePostNum == null || receivePostNum == '') {
            layer.msg("请填写物流编号！",{icon: 5,time:2000});
            return false;
        }
        if (receivePostFirm == null || receivePostFirm == '') {
            layer.msg("请选择物流公司！",{icon: 5,time:2000});
            return false;
        }
        $.ajax({
            type: "POST",
            url: url,
            traditional : true,
            data: {
                receiveId : receiveId,
                receivePostFirm : receivePostFirm,
                receivePostNum : receivePostNum
            },
            dataType: "json",
            success: function(data){
                if(data.status){
                    exitWindowsDiv(node);
                    layer.msg("发货成功！",{icon: 5,time:2000});
                    return false;
                }else{
                    layer.msg("发货失败，请重试！",{icon: 5,time:2000});
                    return false;
                }
            }
        });
    }

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