<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>项目管理-待审核</title>
    <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">
    <style>
        .layui-form-select dl{
            /* max-height:200px;*/
            width: 80%;
        }
        html{ background: #FFF}

        .layui-input-block {
            margin-left: 132px;
        }

        .layui-form-label {
            width: 132px;
        }
        .title1 {
            border-left: 4px solid #1b6073;
            padding-left: 20px;
            font-size: 14px;
            margin: 10px auto;
            font-weight: 600;
            height: 34px;
            line-height: 34px;
            background-color: #f4f6f9;
            color: #666666;
        }
        .clearfix{*zoom:1;}
        .clearfix:before,.clearfix:after{display:table; line-height:0; content:"";}
        .clearfix:after{clear:both;}

        .operate-footer{
            z-index: 1;
        }

    </style>
</head>
<body>
<div class="aaa">
    <div class="layui-form " id="detailSet">
        <div class="layui-card-body  pt-20 h-350" action="" >
            <%-- <form class="clearfix" id="form3">
                 <h1 class="title1">租赁方案信息</h1>

                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>租金计算方式：</label>
                         <div class="layui-input-block">
                             <select name="rentCalcMethod" lay-verify="required">
                                 <option value="00" selected>自定义租金计划</option>
                             </select>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>租赁方案：</label>
                         <div class="layui-input-block">
                             <select name="leaseScheme" lay-verify="required">
                                 <option value="2022081900002-1-1" selected>2022081900002-1-1</option>
                             </select>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>融资额：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="financingAmount"  lay-verify="required"  class="layui-input" value="${retailPayInfo.financingAmount}" onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''">
                             <span class="pos-a h-32 lh-32 layui-span-unit">元</span>
                         </div>
                     </div>
                 </div>
                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>剩余留购款：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="nominalPrice"  lay-verify="required"  class="layui-input" value="${retailPayInfo.nominalPrice}" onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''">
                             <span class="pos-a h-32 lh-32 layui-span-unit">元</span>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>还款频率：</label>
                         <div class="layui-input-block">
                             <select name="repayFrequency" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="12" <c:if test="${retailPayInfo.repayFrequency eq '12'}" > selected</c:if>>按月</option>
                                 <option value="4" <c:if test="${retailPayInfo.repayFrequency eq '4'}" > selected</c:if>>按季度</option>
                                 <option value="2" <c:if test="${retailPayInfo.repayFrequency eq '2'}" > selected</c:if>>按半年</option>
                                 <option value="1" <c:if test="${retailPayInfo.repayFrequency eq '1'}" > selected</c:if>>按年</option>
                             </select>

                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>期数：</label>
                         <div class="layui-input-block">
                             <select name="leaseTimes" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="12" <c:if test="${retailPayInfo.leaseTimes eq 12}" > selected</c:if>>12</option>
                                 <option value="24" <c:if test="${retailPayInfo.leaseTimes eq 24}" > selected</c:if>>24</option>
                                 <option value="36" <c:if test="${retailPayInfo.leaseTimes eq 36}" > selected</c:if>>36</option>
                             </select>
                         </div>
                     </div>
                 </div>
                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>最后一期是否合并：</label>
                         <div class="layui-input-block">
                             <select name="isMergeFinalTerm" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="Y" <c:if test="${retailPayInfo.isMergeFinalTerm eq 'Y'}" > selected</c:if>>是</option>
                                 <option value="N" <c:if test="${retailPayInfo.isMergeFinalTerm eq 'N'}" > selected</c:if>>否</option>
                             </select>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>首付款收取方：</label>
                         <div class="layui-input-block">
                             <select name="downPaymentType" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="0" <c:if test="${retailPayInfo.downPaymentType eq 0}" > selected</c:if>>浙银收取</option>
                                 <option value="1" <c:if test="${retailPayInfo.downPaymentType eq 1}" > selected</c:if>>厂商收取</option>
                                 <option value="2" <c:if test="${retailPayInfo.downPaymentType eq 2}" > selected</c:if>>无首付款</option>
                             </select>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>租赁年利率：</label>
                         <div class="layui-input-block">
                             <input type="text"   lay-verify="required" readonly   class="layui-input layui-bg-gray" value="7.4%">
                             <input type="hidden"  name="intRate" readonly   class="layui-input" value="0.074">
                         </div>
                     </div>
                 </div>
                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>内含利率：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="intRateReply"  lay-verify="required" class="layui-input" value="<fmt:formatNumber type="number" value="${retailPayInfo.intRateReply * 100}" maxFractionDigits="2"/>" onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''">
                             <span class="pos-a h-32 lh-32 layui-span-unit">%</span>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>租赁期限（月）：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="leaseTerm"  lay-verify="required"  class="layui-input" value="${retailPayInfo.leaseTerm}" onkeyup="this.value=this.value.replace(/\D/g,'')">
                         </div>
                     </div>

                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>退休金还款方式：</label>
                         <div class="layui-input-block">
                             <select name="depositReturnType" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="10" <c:if test="${retailPayInfo.depositReturnType eq '10'}" > selected</c:if>>抵扣</option>
                                 <option value="20" <c:if test="${retailPayInfo.depositReturnType eq '20'}" > selected</c:if>>退换</option>
                             </select>
                         </div>
                     </div>
                 </div>
                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>宽限期类型：</label>
                         <div class="layui-input-block">
                             <select name="graceType" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="10" <c:if test="${retailPayInfo.graceType eq '10'}" > selected</c:if>>无宽限</option>
                                 <option value="20" <c:if test="${retailPayInfo.graceType eq '20'}" > selected</c:if>>前一期</option>
                                 <option value="30" <c:if test="${retailPayInfo.graceType eq '30'}" > selected</c:if>>前二期</option>
                                 <option value="40" <c:if test="${retailPayInfo.graceType eq '40'}" > selected</c:if>>前三期</option>
                                 <option value="50" <c:if test="${retailPayInfo.graceType eq '50'}" > selected</c:if>>宽限期自定义</option>
                                 <option value="60" <c:if test="${retailPayInfo.graceType eq '60'}" > selected</c:if>>前四期</option>
                             </select>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label">宽限期月份：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="graceMonth"  autocomplete="off"  class="layui-input" value="${retailPayInfo.graceMonth}">
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>是否返利：</label>
                         <div class="layui-input-block">
                             <select name="isReturnInterest" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="Y" <c:if test="${retailPayInfo.isReturnInterest eq 'Y'}" > selected</c:if>>是</option>
                                 <option value="N" <c:if test="${retailPayInfo.isReturnInterest eq 'N'}" > selected</c:if>>否</option>

                             </select>
                         </div>
                     </div>
                 </div>

                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>是否贴息：</label>
                         <div class="layui-input-block">
                             <select name="isSubsidyInterest" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="Y" <c:if test="${retailPayInfo.isSubsidyInterest eq 'Y'}" > selected</c:if>>是</option>
                                 <option value="N" <c:if test="${retailPayInfo.isSubsidyInterest eq 'N'}" > selected</c:if>>否</option>
                             </select>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>申请放款日：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="reqLoanDate"  id="reqLoanDate" lay-verify="required"  class="layui-input" value="${retailPayInfo.reqLoanDate}">
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>是否支持代扣：</label>
                         <div class="layui-input-block">
                             <select name="isWithholding" lay-verify="required">
                                 <option value="">请选择</option>
                                 <option value="Y" <c:if test="${retailPayInfo.isWithholding eq 'Y'}" > selected</c:if>>是</option>
                                 <option value="N" <c:if test="${retailPayInfo.isWithholding eq 'N'}" > selected</c:if>>否</option>
                             </select>
                         </div>
                     </div>

                 </div>
             </form>--%>

             <form class="clearfix" id="form4">
                 <%--<h1 class="title1">设备清单</h1>--%>
                 <blockquote class="layui-elem-quote">设备清单</blockquote>
                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>租赁物数量：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="quantity"  lay-verify="required"  class="layui-input"
                                    value="${equipInfoNormal.quantity}"  onkeyup="!/^(\d+\.?)?\d{0,4}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''">
                             <span class="pos-a h-32 lh-32 layui-span-unit">kwh</span>
                         </div>
                     </div>


                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>备注/组件块数：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="description" lay-verify="required"  class="layui-input" value="${equipInfoNormal.description}" onkeyup="this.value=this.value.replace(/\D/g,'')">
                             <span class="pos-a h-32 lh-32 layui-span-unit">块</span>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>资产识别号：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="equipNum"  lay-verify="required"  class="layui-input" value="${equipInfoNormal.equipNum}">
                         </div>
                     </div>
                 </div>
                 <div class="layui-col-xs12 mb-5 pr-30">

                     <div class="layui-inline layui-col-xs4 jingyingzulin">
                         <label class="layui-form-label"><i class="red">*</i>租赁物原值：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="originalAssetValue"   class="layui-input" value="${equipInfoNormal.originalAssetValue}" onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''">
                             <span class="pos-a h-32 lh-32 layui-span-unit">元</span>
                         </div>
                     </div>
                         <div class="layui-inline layui-col-xs4 jingyingzulin">
                             <label class="layui-form-label"><i class="red">*</i>不含税原值：</label>
                             <div class="layui-input-block">
                                 <input type="text"  name="netOriginalAssetValue"    class="layui-input" value="${equipInfoNormal.netOriginalAssetValue}" onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''">
                                 <span class="pos-a h-32 lh-32 layui-span-unit">元</span>
                             </div>
                         </div>

                     <div class="layui-inline layui-col-xs4 jingyingzulin">
                         <label class="layui-form-label"><i class="red">*</i>初始确认物净值：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="netAssetValue"   class="layui-input" value="${equipInfoNormal.netAssetValue}" onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''">
                             <span class="pos-a h-32 lh-32 layui-span-unit">元</span>
                         </div>
                     </div>

                 </div>


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

                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>确认折旧：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="accumulatedDepreciation"  class="layui-input" value="${equipInfoNormal.accumulatedDepreciation}" onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''">
                             <span class="pos-a h-32 lh-32 layui-span-unit">元</span>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>确定的租赁物价值：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="confirmValue" id="confirmValue" readonly disabled    class="layui-input layui-bg-gray"
                                    value="${equipInfoNormal.confirmValue}" onkeyup="this.value=this.value.replace(/\D/g,'')">
                             <span class="pos-a h-32 lh-32 layui-span-unit">元</span>
                         </div>
                     </div>

                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>确认净值日期：</label>
                         <div class="layui-input-block">
                             <input   name="confirmNetValueDate" id="confirmNetValueDate"  class="layui-input" placeholder="年-月-日" value="${equipInfoNormal.confirmNetValueDate}">
                         </div>
                     </div>
                 </div>

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

                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>建造完工日期：</label>
                         <div class="layui-input-block" >
                             <input   name="purchasedate" id="purchasedate" lay-verify="required"  class="layui-input" placeholder="年-月-日" value="${equipInfoNormal.purchasedate}">
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>入账日期：</label>
                         <div class="layui-input-block" >
                             <input   name="entryDate"  id="entryDate" lay-verify="required"  class="layui-input" placeholder="年-月-日" value="${equipInfoNormal.entryDate}">
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>发电户号：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="generatorNo"  lay-verify="required"  class="layui-input" value="${equipInfoNormal.generatorNo}">
                         </div>
                     </div>
                 </div>

                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>通信模块S/N编码：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="communicationCode"  lay-verify="required"  class="layui-input" value="${equipInfoNormal.communicationCode}">
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label"><i class="red">*</i>发票号：</label>
                         <div class="layui-input-block">
                             <input type="text"  name="invoiceNum"  lay-verify="required"  class="layui-input" value="${equipInfoNormal.invoiceNum}">
                         </div>
                     </div>
                 </div>

                 <div class="layui-col-xs12 mb-5 pr-30">
                     <div class="layui-inline layui-col-xs3">
                         <label class="layui-form-label"><i class="red">*</i>租赁物保险单：</label>
                         <div class="layui-input-block" style="display:flex;">
                             <div id="imgsDiv1">
                                 <c:if test="${not empty equipInfoNormal.policyImg}">
                                     <div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this,'uploaderone1')"></span>
                                         <img src="${commonStaticImgPath}${equipInfoNormal.policyImg}" height="700" width="1200"/>
                                         <input type="hidden" class="roof_photo_one" name="policyImg" value="${equipInfoNormal.policyImg}"/>
                                     </div>
                                 </c:if>
                             </div>
                             <div class="upload-container <c:if test="${not empty equipInfoNormal.policyImg}">hide</c:if>  mr-20" id="uploaderone1">
                                 <img src="" alt="img placeholder" id="imgsAdd1">
                             </div>
                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs4">
                         <label class="layui-form-label" style="width: 148px"><i class="red">*</i>全额增值税专用发票：</label>
                         <div class="layui-input-block" style="display:flex; width: 148px">
                             <div id="imgsDiv2">
                                 <c:if test="${not empty equipInfoNormal.invoiceImg}">
                                     <div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this,'uploaderone2')"></span>
                                         <img src="${commonStaticImgPath}${equipInfoNormal.invoiceImg}" height="700" width="1200"/>
                                         <input type="hidden" class="roof_photo_one" name="invoiceImg" value="${equipInfoNormal.invoiceImg}"/>
                                     </div>
                                 </c:if>
                             </div>
                             <div class="upload-container <c:if test="${not empty equipInfoNormal.invoiceImg}">hide</c:if>" id="uploaderone2">
                                 <img src="" alt="img placeholder" id="imgsAdd2">
                             </div>

                         </div>
                     </div>
                     <div class="layui-inline layui-col-xs5">
                         <label class="layui-form-label"><i class="red">*</i>购售电合同：</label>
                         <div class="layui-input-block">
                            <%-- <div id="imgsDiv3">
                                 <c:if test="${not empty equipInfoNormal.contractImg}">
                                     <div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this,'uploaderone3')"></span>
                                         <img src="${commonStaticImgPath}${equipInfoNormal.contractImg}" height="700" width="1200"/>
                                         <input type="hidden" class="roof_photo_one" name="contractImg" value="${equipInfoNormal.contractImg}"/>
                                     </div>
                                 </c:if>
                             </div>
                             <div class="upload-container <c:if test="${not empty equipInfoNormal.contractImg}">hide</c:if>  mr-20" id="uploaderone3">
                                 <img src="" alt="img placeholder" id="imgsAdd3">
                             </div>--%>
                                <button type="button" class="layui-btn" id="uploaderone3" style="height: 30px;">
                                    <i class="layui-icon"></i>选择文件
                                </button>
                             <a style="display: block ;color:#D9B589;cursor:pointer;" id="contractImgPath" target="_blank"
                                         href="${commonStaticImgPath}${equipInfoNormal.contractImg}" >
                                 <c:if test="${not empty equipInfoNormal.contractImg}">
                                     ${fn:substring(equipInfoNormal.contractImg,equipInfoNormal.contractImg.lastIndexOf("/")+1,-1)}
                                 </c:if>

                             </a>
                                <input type="hidden" id="contractImg" name="contractImg" value="${equipInfoNormal.contractImg}"/>
                         </div>
                     </div>

                 </div>

             </form>
        </div>
        <div style="height: 70px;"></div>
        <div class="layui-form-item operate-footer" style="text-align: center;">
            <input type="button" lay-filter="temp" id="temp" class="layui-btn" value="暂存">
            <input type="button" lay-submit lay-filter="confirm" id="confirm" class="layui-btn " value="提交">
            <input type="button"   value="取消" class="layui-btn layui-btn-primary " lay onclick="closeDiv();" >
        </div>
    </div>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script>
    var entryId='${entryId}';

    var idCordReq = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
    //初始数据
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['form', 'table', 'upload', 'jquery','laydate','upload'], function () {
        $ = layui.$
            ,form = layui.form
            ,laydate = layui.laydate;
        var  upload = layui.upload;

        if('${basic.leaseType}'=='2'){
            $(".jingyingzulin").hide();
        }

        /*getConfirmValue();*/

        upload.render({
            elem: '#uploaderone1' //绑定元素
            , url: '${ctx}/common/uploadFile2' //上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path,"uploaderone1","imgsDiv1","policyImg");
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploaderone2' //绑定元素
            , url: '${ctx}/common/uploadFile2' //上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path,"uploaderone2","imgsDiv2","invoiceImg");
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploaderone3' //绑定元素
            , url: '${ctx}/common/uploadFile2' //上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            ,accept:'file'
            , done: function (res) {
                //上传完毕回调
              /*  addImg(res.path,"uploaderone3","imgsDiv3","contractImg");*/
                $("#contractImgPath").text(res.filename);
                $("#contractImg").val(res.path);
                $("#contractImgPath").attr("href","${commonStaticImgPath}"+res.path);
            }
            , error: function () {
                //请求异常回调
            }
        });

        function addImg(data,id,imgsDiv,classimg){
            $("#"+id).hide();
            var html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this,\''+id+'\')"></span>';
            html += '<img src="${commonStaticImgPath}'+data+'" height="700" width="1200"/>';
            html += '<input type="hidden" class="'+classimg+'" name="'+classimg+'" value="'+data+'"/> </div>';
            $("#"+imgsDiv).append(html);
            /* //图片查看效果
             viewer.update();*/
        }


       /* laydate.render({
            elem: '#reqLoanDate'
            ,trigger: 'click'
            ,format:"yyyy-MM-dd"
            ,value: new Date()
        });*/

          laydate.render({
              elem: '#confirmNetValueDate'
              ,trigger: 'click'
              ,format:"yyyy-MM-dd"
          });

         laydate.render({
             elem: '#purchasedate'
             ,trigger: 'click'
             ,format:"yyyy-MM-dd"
         });
          laydate.render({
              elem: '#entryDate'
              ,trigger: 'click'
              ,format:"yyyy-MM-dd"
          });

        form.verify({
            loginName:function(value,item){
                if(!$.trim(value)){
                    return "登录账号不能为空,请输入登录账号！";
                }
                if($.trim(value).length<4){
                    return "登录账号不得小于4位,请重新输入！";
                }
                if($.trim(value).length>12){
                    return "登录账号不得大于12位,请重新输入！";
                }
            },

            telephone:function(value,item){
                if(!$.trim(value)){
                    return "手机号码不能为空,请输入手机号码后保存！";
                }
                if(!myreg.test($.trim(value))){
                    return "请输入正确的手机号码后保存！";
                }
            },

            idCord:function(value,item){
                if(!isBlank(value) &&　! idCordReq.test($.trim(value))){
                    return "身份证号码格式不正确";
                }
            }

        });

        var saveFlag=false;
        form.on('submit(confirm)', function(data){
            if(saveFlag){
                return false;
            }
            saveFlag=true;
            /*  var date3={};
              $($("#form3").serializeArray()).each(function(){
                  date3[this.name] = this.value;
              });*/

              var date4={};
              $($("#form4").serializeArray()).each(function(){
                  date4[this.name] = this.value;
              });

            var date={
                entryId:entryId,
                resultType:1,
                /* retailPayInfo:date3,*/
                 equipInfoNormal:date4,
            }
            console.log(date);
            $.ajax({
                url:'${ctx}/customerEntryExtra/supplyIncomingApplication',
                method:'post',
                contentType : "application/json;charsetset=UTF-8",
                data:JSON.stringify(date),
                success:function(res){
                    console.log(res);
                    if(res.code=="200"){
                        updateFileEntry(entryId);
                        parent.layer.msg("保存成功",{time:1000});
                        closeDiv();
                        parent.table.reload('test');
                    }else{
                        layer.msg(res.errMsg,{time:1000},function(){
                            saveFlag=false;
                        });
                    }
                },
                complete:function (data) {

                }
            }) ;
        });

        var saveFlag1=false;
        $("#temp").click(function(){
            if(saveFlag1){
                return false;
            }

           /*  var date3={};
             $($("#form3").serializeArray()).each(function(){
                 date3[this.name] = this.value;
             });
*/
             var date4={};
             $($("#form4").serializeArray()).each(function(){
                 date4[this.name] = this.value;
             });

            var date={
                entryId:entryId,
                resultType:0,
                /* retailPayInfo:date3,*/
                 equipInfoNormal:date4,
            }
            console.log(date);
            saveFlag1=true;
            $.ajax({
                url:'${ctx}/customerEntryExtra/supplyIncomingApplication',
                method:'post',
                contentType : "application/json;charsetset=UTF-8",
                data:JSON.stringify(date),
                success:function(res){
                    console.log(res);
                    if(res.code=="200"){
                        parent.layer.msg("保存成功",{time:1000});
                        closeDiv();
                        parent.table.reload('test');
                    }else{
                        layer.msg(res.errMsg,{time:1000},function(){
                            saveFlag1=false;
                        });
                    }
                },
                complete:function (data) {

                }
            }) ;
        })

    })

    function updateFileEntry(id) {
        $.ajax({
            type: 'post',
            url: '${ctx}/customerEntry/uploadTwoAttachment',
            data: {
                id: id,
                type:'2'
            },
            success: function(data){
                console.log(data)
            }
        });
    }

    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;
    }

    function delImg(that,id){
        $("#"+id).show();
        $(that).parent().remove();
    }


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

