<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.css" media="all">
    <style>html {
        background-color: #fff;
        padding-bottom: 50px;
    }

    td, th {
        text-align: center !important;
    }</style>
</head>

<body>
<div class="layui-form">
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li class="layui-this">表单信息</li>
            <c:if test="${1 == user.userType || 4 == user.userType}">
                <li>过程信息</li>
            </c:if>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-card">
                    <div class="layui-elem-quote" style="display: flex;justify-content: space-between;">
                        <p>订单信息</p>
                        <p>退货时间：${order.columns.create_time}</p>
                    </div>
                    <div class="layui-tab-content">
                        <div class="layui-row">
                            <div class="layui-col-xs4">
                                <label class="layui-form-label ">退货订单：</label>
                                <div class="layui-input-block ">
                                    <input type="text" readonly class="layui-input layui-bg-gray"
                                           value="${order.columns.number}">
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <label class="layui-form-label ">发货单位：</label>
                                <div class="layui-input-block ">
                                    <input type="text" readonly class="layui-input layui-bg-gray"
                                           value="${order.columns.deliver_name}">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-xs4">
                                <label class="layui-form-label ">发货仓库：</label>
                                <div class="layui-input-block ">
                                    <input type="text" readonly
                                           class="layui-input layui-bg-gray" value="${order.columns.warehouse_name}">
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <label class="layui-form-label ">接货人：</label>
                                <div class="layui-input-block ">
                                    <input type="text" readonly
                                           class="layui-input layui-bg-gray" value="${order.columns.person_in_charge}">
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <label class="layui-form-label ">联系电话：</label>
                                <div class="layui-input-block ">
                                    <input type="text" readonly class="layui-input layui-bg-gray"
                                           value="${order.columns.person_mobile}">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-xs12">
                                <label class="layui-form-label">仓库地址：</label>
                                <div class="layui-input-block ">
                                    <input readonly class="layui-input layui-bg-gray"
                                           value="${order.columns.warehouse_address}"/>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-xs4">
                                <label class="layui-form-label">发货方式：</label>
                                <div class="layui-input-block ">
                                    <input readonly class="layui-input layui-bg-gray"
                                           value="${order.columns.return_method_name}"/>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-xs4">
                                <label class="layui-form-label ">司机：</label>
                                <div class="layui-input-block ">
                                    <input type="text" readonly
                                           class="layui-input layui-bg-gray" value="${order.columns.return_driver}">
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <label class="layui-form-label ">联系方式：</label>
                                <div class="layui-input-block ">
                                    <input type="text" readonly
                                           class="layui-input layui-bg-gray" value="${order.columns.return_mobile}">
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <label class="layui-form-label ">车牌号：</label>
                                <div class="layui-input-block ">
                                    <input type="text" readonly class="layui-input layui-bg-gray"
                                           value="${order.columns.return_car_num}">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-xs12">
                                <label class="layui-form-label">退货备注：</label>
                                <div class="layui-input-block ">
                                    <textarea readonly
                                              class="layui-textarea layui-bg-gray">${order.columns.return_remark}</textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-elem-quote" style="display: flex;justify-content: space-between;">
                        <p>物料清单</p>
                    </div>
                    <div class="layui-tab-content">
                        <div class="layui-row">
                            <table class="layui-table">
                                <thead>
                                    <th>序号</th>
                                    <th>物料代码</th>
                                    <th>物料名称</th>
                                    <th>物料类型</th>
                                    <th>物料品牌</th>
                                    <th>物料规格</th>
                                    <%--<th>订单数量</th>--%>
                                    <th>签收数量</th>
                                    <th>退货数量</th>
                                </thead>
                                <tbody id="materialTbody">
                                <c:forEach items="${details}" var="detail" varStatus="vs">
                                    <tr data-id="${detail.columns.id}">
                                        <td>${vs.count}</td>
                                        <td>${detail.columns.material_code}</td>
                                        <td>${detail.columns.material_name}</td>
                                        <td>${detail.columns.material_type}</td>
                                        <td>${detail.columns.material_brand}</td>
                                        <td>${detail.columns.material_spec}</td>
                                        <%--<td>${detail.columns.order_num}</td>--%>
                                        <td>${detail.columns.deliver_num}</td>
                                        <td>${detail.columns.return_num}</td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <c:if test="${not empty voucherImgList}">
                        <div class="layui-col-xs12 mb-15 pr-30">
                            <label class="layui-form-label w-130">凭证：</label>
                            <div class="layui-input-block ml-130">
                                <div id="licenseImgDiv">
                                    <c:forEach var="item" items="${voucherImgList}">
                                        <div class="bj-img imgSpan">
                                            <img src="${commonStaticImgPath}${item}" height="700" width="1200"/>
                                            <input type="hidden" class="imgPicker" value="${item}"/> </div>
                                    </c:forEach>
                                </div>
                            </div>
                        </div>
                    </c:if>
                </div>
            </div>
            <div class="layui-tab-item">
                <c:forEach items="${msgList}" var="msg" varStatus="vs">
                    <div class="mb-10">
                        <fmt:formatDate value="${msg.operateTime}" pattern="yyyy-MM-dd HH:mm"/>
                            ${msg.content}
                    </div>
                </c:forEach>
            </div>
        </div>
    </div>
    <div class="operate-footer">
        <button type="button" class="layui-btn layui-btn-primary " onclick="closeDiv();">关闭</button>
    </div>
</div>
<div id="lookImg" class="hide pos-r">
    <div style="position:relative;width:90%;height:450px;">
        <div class="w-500 h-450 lookImg">
            <img src="" width="80%" id="image">
        </div>
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
    //初始数据
    var $form;
    var form;
    var $;
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['form', 'layedit', 'laydate', 'jquery', 'layer', 'element', 'upload'], function () {
        $ = layui.jquery;
        form = layui.form;
        $form = $('form');

        $(".imgSpan img").click(function(){
            var img = $(this).attr("src");
            console.log(img);
            $("#lookImg img").attr('src',img);
            layer.open({
                type:1,
                title:'查看图片',
                area:['500px','450px'],
                content:$("#lookImg")
            })
        })
    })

    function closeDiv() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
    }

</script>
</body>
</html>
