<%@ 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" id="LAY_app">
    <div class="layui-card">
        <div class="layui-col-xs12 mt-10 mb-10 pr-30">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">订单信息</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-form-item">
                            <div class="layui-col-xs4">
                                <div class="layui-form-item">
                                    <label class="layui-form-label w-130">入库状态：</label>
                                    <div class="layui-input-block ">
                                        <input type="text" disabled name="status" readonly autocomplete="off"
                                               placeholder=""
                                               class="layui-input layui-bg-gray"
                                               value="<c:if test="${order.columns.status eq '2'}">待入库</c:if><c:if test="${order.columns.status eq '5'}">待审核</c:if><c:if test="${order.columns.status eq '6'}">审核驳回</c:if><c:if test="${order.columns.status eq '7'}">已完成</c:if>">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <div class="layui-form-item">
                                    <label class="layui-form-label w-130">下单时间：</label>
                                    <div class="layui-input-block ">
                                        <input type="text" disabled name="placeTime" readonly autocomplete="off"
                                               placeholder=""
                                               class="layui-input layui-bg-gray"
                                               value='<fmt:formatDate value="${order.columns.place_time}" pattern="yyyy-MM-dd HH:mm"/>'>
                                    </div>
                                </div>
                            </div>
                            <c:if test="${not empty order.columns.remarks}">
                                <div class="layui-inline layui-col-xs12">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label w-130">订单备注：</label>
                                        <div class="layui-input-block ">
                                    <textarea readonly
                                              class="layui-textarea layui-bg-gray">${order.columns.remarks}</textarea>
                                        </div>
                                    </div>
                                </div>
                            </c:if>
                            <div>
                                <div class="layui-col-xs8">
                                    <div class="layui-col-xs6">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label w-130">发货单位：</label>
                                            <div class="layui-input-block ">
                                                <input type="text" disabled name="deliverName" readonly
                                                       autocomplete="off"
                                                       placeholder=""
                                                       class="layui-input layui-bg-gray"
                                                       value="${order.columns.deliver_name}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-col-xs6">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label w-130">发货方式：</label>
                                            <div class="layui-input-block ">
                                                <input type="text" disabled name="deliverMethodName" readonly
                                                       autocomplete="off"
                                                       placeholder=""
                                                       class="layui-input layui-bg-gray"
                                                       value="${order.columns.deliver_method_name}">
                                            </div>
                                        </div>
                                    </div>

                                    <c:if test="${not empty order.columns.express_no}">
                                        <div class="layui-col-xs6">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label w-130">物流单号：</label>
                                                <div class="layui-input-block ">
                                                    <input type="text" disabled name="expressNo" readonly
                                                           autocomplete="off"
                                                           placeholder=""
                                                           class="layui-input layui-bg-gray"
                                                           value="${order.columns.express_no}">
                                                </div>
                                            </div>
                                        </div>
                                    </c:if>
                                    <c:if test="${empty order.columns.express_no}">
                                        <div class="layui-col-xs6">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label w-130">司机：</label>
                                                <div class="layui-input-block ">
                                                    <input type="text" disabled name="deliverDriver" readonly
                                                           autocomplete="off"
                                                           placeholder=""
                                                           class="layui-input layui-bg-gray"
                                                           value="${order.columns.deliver_driver}">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="llayui-col-xs6">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label w-130">联系方式：</label>
                                                <div class="layui-input-block ">
                                                    <input type="text" disabled name="deliverMobile" readonly
                                                           autocomplete="off"
                                                           placeholder=""
                                                           class="layui-input layui-bg-gray"
                                                           value="${order.columns.deliver_mobile}">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-col-xs6">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label w-130">车牌号：</label>
                                                <div class="layui-input-block ">
                                                    <input type="text" disabled name="deliverCarNum" readonly
                                                           autocomplete="off"
                                                           placeholder=""
                                                           class="layui-input layui-bg-gray"
                                                           value="${order.columns.deliver_car_num}">
                                                </div>
                                            </div>
                                        </div>
                                    </c:if>
                                    <div class="layui-col-xs6">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label w-130">发货时间：</label>
                                            <div class="layui-input-block ">
                                                <input type="text" disabled name="deliverCarNum" readonly
                                                       autocomplete="off"
                                                       placeholder=""
                                                       class="layui-input layui-bg-gray"
                                                       value='<fmt:formatDate value="${order.columns.deliver_time}" pattern="yyyy-MM-dd HH:mm"/>'>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-col-xs12">
                                        <div class="layui-form-item mb-5">
                                            <label class="layui-form-label w-130">发货备注：</label>
                                            <div class="layui-input-block ">
                                            <textarea readonly
                                                      class="layui-textarea layui-bg-gray">${order.columns.deliver_remark}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-xs4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label w-130">接货单：</label>
                                        <div class="layui-input-block">
                                            <div class="layer-photos-demo">
                                                <img src="${commonStaticImgPath}${order.columns.deliver_invoice}"
                                                     alt="img placeholder" style="width: 80px; height: 80px;">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <c:if test="${order.columns ne '2'}">
                                <div>
                                    <div class="layui-col-xs8">
                                        <div class="layui-col-xs6">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label w-130">入库时间：</label>
                                                <div class="layui-input-block ">
                                                    <input type="text" name="receiveTime" readonly autocomplete="off"
                                                           placeholder=""
                                                           class="layui-input layui-bg-gray"
                                                           value='<fmt:formatDate value="${order.columns.receive_time}" pattern="yyyy-MM-dd HH:mm"/>'>
                                                </div>
                                            </div>
                                        </div>
                                        <c:if test="${order.columns.status eq '6' || order.columns.status eq '7'}">
                                            <div class="layui-col-xs6">
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label w-130">审核时间：</label>
                                                    <div class="layui-input-block ">
                                                        <input type="text" name="auditTime" readonly autocomplete="off"
                                                               placeholder=""
                                                               class="layui-input layui-bg-gray"
                                                               value='<fmt:formatDate value="${order.columns.audit_time}" pattern="yyyy-MM-dd HH:mm"/>'>
                                                    </div>
                                                </div>
                                            </div>
                                        </c:if>
                                        <c:if test="${not empty order.columns.receive_remark}">
                                            <div class="layui-col-xs12">
                                                <div class="layui-form-item mb-5">
                                                    <label class="layui-form-label w-130">入库说明：</label>
                                                    <div class="layui-input-block ">
                                                <textarea readonly
                                                          class="layui-textarea layui-bg-gray">${order.columns.receive_remark}</textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </c:if>
                                        <c:if test="${order.columns.status eq '6' || order.columns.status eq '7'}">
                                            <div class="layui-col-xs12">
                                                <div class="layui-form-item mb-5">
                                                    <label class="layui-form-label w-130">审核备注：</label>
                                                    <div class="layui-input-block ">
                                                    <textarea readonly
                                                              class="layui-textarea layui-bg-gray">${order.columns.audit_remark}</textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </c:if>
                                    </div>
                                    <c:if test="${not empty order.columns.receive_invoice}">
                                        <div class="layui-col-xs4">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label w-130">接货单：</label>
                                                <div class="layui-input-block">
                                                    <div class="layer-photos-demo">
                                                        <img src="${commonStaticImgPath}${order.columns.receive_invoice}"
                                                             alt="img placeholder" style="width: 80px; height: 80px;">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </c:if>
                                </div>
                            </c:if>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 mb-10 pr-30">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">物料清单</li>
                    <li>过程记录</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <table class="layui-table">
                            <thead>
                            <th>序号</th>
                            <th>物料代码</th>
                            <th>物料类型</th>
                            <th>物料组</th>
                            <th>单位</th>
                            <th>物料描述</th>
                            <th>下单数量</th>
                            <th>实发数量</th>
                            <c:if test="${order.columns.status ne '2'}">
                                <th>入库数量</th>
                            </c:if>
                            </thead>
                            <tbody id="materialTbody">
                            <c:forEach items="${details}" var="applyDetail" varStatus="vs">
                                <tr data-id="${applyDetail.columns.id}"
                                    data-materialId="${applyDetail.columns.material_id}"
                                    data-applyAmount="${applyDetail.columns.apply_amount}">
                                    <td>${vs.count}</td>
                                    <td>${applyDetail.columns.code}</td>
                                    <td>${applyDetail.columns.materialTypeName}</td>
                                    <td>${applyDetail.columns.materialGroupName}</td>
                                    <td>${applyDetail.columns.unit_name}</td>
                                    <td>${applyDetail.columns.remarks}</td>
                                    <td>${applyDetail.columns.apply_amount}</td>
                                    <td>${applyDetail.columns.out_amount}</td>
                                    <c:if test="${order.columns.status ne '2'}">
                                        <td>${applyDetail.columns.out_amount}</td>
                                    </c:if>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </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>
    </div>
    <div class="operate-footer">
        <button type="button" class="layui-btn layui-btn-primary " onclick="closeDiv();">取消</button>
    </div>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.js"></script>
<script type="text/javascript">
    //图片查看效果
    var viewer = new Viewer(document.getElementById('LAY_app'));
    //初始数据
    var $form;
    var form;
    var $;
    var imgs = '';
    var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
    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;
        var element = layui.element;
        $form = $('form');

      /*  layer.photos({
            photos: '.layer-photos-demo'
            , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
        });*/
    })

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

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }


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