<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <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" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.css" media="all">
    <style>
        .layui-form-select dl{
            max-height:200px;
            width: 80%;
        }
        .w-130{width: 130px}
        .ml120 .layui-input-block{margin-left: 130px}
        .ml-130{margin-left:  130px}
        .border-grey{border: 1px solid #DDD; border-radius: 10px;}
        .table-input{width: 30px; border: none; text-align: center; height: 30px; line-height: 30px}
        .layui-elem-field legend{font-size: 16px}
        .img-80{display: flex; justify-content: center;}
        .img-80 .bj-img{margin-right: 0}
    </style>
</head>
<body>
<div class="layui-form">
    <div class="layui-card mt-10" id="LAY_app">

        <div class="layui-tab layui-tab-brief over pt-20 pb-40 h-350" lay-filter="docDemoTabBrief" id="detailSet">

            <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
<%--            <blockquote class="layui-elem-quote">项目信息</blockquote>--%>
            <div class="layui-row ml120 mt-20">
                <div class="layui-col-xs9">
                    <div class="layui-col-xs12 mb-15 pr-30">
                        <label class="layui-form-label w-130"><i class="red">*</i>供应商名称：</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" disabled autocomplete="off"  class="layui-input" readonly value="${apply.name}">
                        </div>
                    </div>
                    <%--<div class="layui-col-xs12 mb-10 pr-30">
                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>法定代表人：</label>
                            <div class="layui-input-block ">
                                <input type="text" name="contacts" disabled autocomplete="off" placeholder="请输入法定代表人" class="layui-input" value="${apply.contacts}">
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>联系电话：</label>
                            <div class="layui-input-block w-200" >
                                <input type="text" name="mobile"  disabled  autocomplete="off" placeholder="请填写业务联系人" class="layui-input" value="${apply.mobile}">
                            </div>
                        </div>
                    </div>--%>
                    <div class="layui-col-xs12 mb-10 pr-30">
                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>企业负责人：</label>
                            <div class="layui-input-block ">
                                <input type="text" name="actualContacts" disabled autocomplete="off" placeholder="请输入企业负责人" class="layui-input" value="${apply.actualContacts}">
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>联系电话：</label>
                            <div class="layui-input-block w-200" >
                                <input type="text" name="telephone" disabled class="layui-input" value="${apply.telephone}">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs12 mb-10 pr-30">
                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>身份证号：</label>
                            <div class="layui-input-block w-200" >
                                <input type="text" name="actualIdCode" lay-verify="idcode" autocomplete="off" placeholder="请填写身份证号" class="layui-input" value="${apply.actualIdCode}">
                            </div>
                        </div>

                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>统一信用代码：</label>
                            <div class="layui-input-block w-200" >
                                <input type="text" name="taxNumber" disabled placeholder="请填写统一信用代码" class="layui-input" value="${apply.taxNumber}">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs12 mb-10 pr-30">
                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>开户银行：</label>
                            <div class="layui-input-block ">
                                <input type="text" name="bankName" disabled class="layui-input" value="${apply.bankName}">
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>银行账号：</label>
                            <div class="layui-input-block w-200" >
                                <input type="text" name="bankCode" disabled class="layui-input" value="${apply.bankCode}">
                            </div>
                        </div>
                    </div>

                    <div class="layui-col-xs12 mb-10 pr-30">

                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>关联品牌：</label>
                            <div class="layui-input-block w-200">
                                <select name="materialBrandId" id="materialBrandId" lay-verify="required" >
                                    <option value="">请选择</option>
                                    <c:forEach items="${brands}" var="brand">
                                        <option value="${brand.columns.id}" <c:if test="${apply.materialBrandId eq brand.columns.id}"> selected</c:if> >${brand.columns.name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>

                        <div class="layui-inline layui-col-xs6">
                            <label class="layui-form-label w-130"><i class="red">*</i>关联物料类型：</label>
                            <div class="layui-input-block w-200" >
                                <div id="materialTypeId"></div>
                            </div>
                        </div>

                    </div>


                    <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:if test="${not empty apply.licenseImg}">
                                    <c:forEach var="item" items="${fn:split(apply.licenseImg, ',')}">
                                        <div class="bj-img imgSpan">
                                            <img src="${commonStaticImgPath}${item}" height="700" width="1200"/>
                                            <input type="hidden" class="imgPicker" value="${item}"/> </div>
                                    </c:forEach>
                                </c:if>
                            </div>
                        </div>
                    </div>


                </div>
                <div class="layui-col-xs3">
                    <div class="layui-input-block" style="margin-left: 50px">
                        <div id="imgsDiv" class="img-80">
                            <div class="bj-img imgSpan">
                               <img src="${commonStaticImgPath}${apply.certificationImg}" height="700" width="1200"/>
                               <input type="hidden" class="imgPicker" value="${apply.certificationImg}"/> </div>
                        </div>

                         <div style="width: 100%; text-align: center; color: #144856"><i class="mark">*</i>营业执照</div>
                    </div>
                    <%--<div class="layui-input-block" style="margin-left: 50px">
                        <div id="IdFrontimgsDiv" class="img-80">
                            <div class="bj-img imgSpan">
                                <c:if test="${not empty apply.idFrontImg}">
                                    <img src="${commonStaticImgPath}${apply.idFrontImg}" height="700" width="1200"/>
                                    <input type="hidden" class="imgPicker" value="${apply.idFrontImg}"/>
                                </c:if>
                            </div>
                        </div>

                        <div style="width: 100%; text-align: center; color: #144856">法定代表人身份证正反面<p>复印件(加盖公章)</p></div>
                    </div>--%>
                    <div class="layui-input-block" style="margin-left: 50px">
                        <div id="idOppositeImgDiv" class="img-80">
                            <div class="bj-img imgSpan">
                                <c:if test="${not empty apply.idOppositeImg}">
                                    <img src="${commonStaticImgPath}${apply.idOppositeImg}" height="700" width="1200"/>
                                    <input type="hidden" class="imgPicker" value="${apply.idOppositeImg}"/>
                                </c:if>
                            </div>
                        </div>
                        <div style="width: 100%; text-align: center; color: #144856">企业负责人身份证正反面<p>复印件(加盖公章)</p></div>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 mb-10 pr-30">
                <label class="layui-form-label w-130"><i class="red">*</i>供应商地址：</label>
                <div class="layui-input-block ml-130">
                    <div class="layui-col-xs4 pr-20">
                        <select class="province" id="province" name="province" disabled>
                            <option value="${apply.province}">${apply.province}</option>

                        </select>
                    </div>
                    <div class="layui-col-xs4 pr-20">
                        <select class="city" name="city" id="city" disabled>
                            <option value="${apply.city}">${apply.city}</option>

                        </select>
                    </div>
                    <div class="layui-col-xs4">
                        <select class="area" name="area" id="area" disabled>
                                <option value="${apply.area}" >${apply.area}</option>

                        </select>
                    </div>
                    <div class="layui-col-xs12 mt-20">
                        <input type="text" id="address" name="address" lay-verify="address" class="layui-input layui-col-lg2"
                               value="${apply.address}" disabled>
                    </div>

                </div>
            </div>

            <div class="layui-col-xs12 mb-15 pr-30">
                <label class="layui-form-label w-130">备注：</label>
                <div class="layui-input-block ml-130">
                    <input type="text" name="remarks" autocomplete="off" placeholder="" class="layui-input" value="${apply.remarks}" disabled>
                </div>
            </div>

            </div>

            </div>
        </div>
            <div  class="openDivBottom">
                <div class="layui-col-xs4">
                    提交人：${apply.creator}
                </div>
                <div class="layui-col-xs4">
                    所属部门：${apply.departmentName}
                </div>
                <div class="layui-col-xs4">
                    申请时间：<fmt:formatDate value="${apply.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </div>
            </div>
            <div style="height: 20px"></div>


            <input type="hidden" name="id" id="id" value="${apply.id}">
            <input type="hidden" name="certificationImg" id="certificationImg" value="${apply.certificationImg}">
            <input type="hidden" name="licenseImg" id="licenseImg" value="${apply.licenseImg}">
            <input type="hidden" name="idFrontImg" id="idFrontImg" value="${apply.idFrontImg}">
            <input type="hidden" name="idOppositeImg" id="idOppositeImg" value="${apply.idOppositeImg}">
            <input type="hidden" id="status" value="${apply.status}">
        <div class="layui-col-xs12 mb-20 pr-30 mt-20">
        </div>

        <div class="layui-form-item operate-footer" style="text-align: center;">

            <input type="button"   value="取消" class="layui-btn layui-btn-primary " onclick="closeDiv();" >
        </div>
    </div>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/data.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.js"></script>
<script src="${ctxPlugin}/lib/xm-select.js"></script>
<script type="text/javascript">
    //图片查看效果
    var viewer = new Viewer(document.getElementById('LAY_app'));
    //初始数据
    var $form;
    var form;
    var upload;
    var $;
    var imgs='';
    var myreg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
    var reg = /^(\d{2})(\d{4})(\d{4})(\d{2})(\d{2})\d{2}(\d)(\d|X)$/;
    var shuzi = /^\d+(\.\d+)?$/;
    layui.use(['form', 'table', 'upload', 'jquery','element'], function () {
        $ = layui.jquery;
        form = layui.form;
        upload = layui.upload;
        $form = $('form');
        var table = layui.table;


        table.init('parse-table-demo',{
            height: 75
        })



        materialTypeIdSelect = xmSelect.render({
            el: '#materialTypeId',
            name: 'materialTypeId',
            filterable: true,
            size: 'mini',
            model: {
                label: {
                    type: 'block',
                    block: {
                        //最大显示数量, 0:不限制
                        showCount: 2,
                        //是否显示删除图标
                        showIcon: true,
                    }
                }
            },
            toolbar: {
                show: true
            },
            height: '300px',
            data: [
                <c:forEach items="${materielTypeList}" var="trader" varStatus="vs">
                <c:if test="${vs.count > 1}">, </c:if>
                {name: '${trader.columns.name}', value: '${trader.columns.id}'}
                </c:forEach>
            ]
            , on: function (data) {
                var array = data.arr;
                var materialTypeId = [];
                for (var i = 0; i < array.length; i ++) {
                    materialTypeId.push(array[i].value);
                }
                $('input[name=materialTypeId]').val(materialTypeId.join(','));
            }
            <c:if test="${from ne 'audit'}">
            , disabled: true
            </c:if>
        });
        materialTypeIdSelect.setValue('${apply.materialTypeId}'.split(","));

    })





    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>
