<%@ 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="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<link rel="stylesheet" href="${contextPath}/static/assets/css/jquery-ui.css" />
<link rel="stylesheet" href="${contextPath}/static/assets/css/datepicker.css" />
<link rel="stylesheet" href="${contextPath}/static/assets/css/ui.jqgrid.css" />
<link rel="stylesheet"  href="${contextPath}/static/js/datatimepicker/bootstrap-datetimepicker.min.css" />
<style>
.style-one{
   border: 0; 
   height: 1px; 
   background: #333; 
   background-image: linear-gradient(to right, #ccc, #333, #ccc);
}
</style>

<div class="well well-sm">
	<input type="text" class="input-sm" placeholder="搜索关键字" id="keyword" />
	<input type="text" class="input-sm date-picker" placeholder="选择开始时间" id="startDate" />
	<input type="text" class="input-sm date-picker" placeholder="选择结束时间" id="endDate" />
	<select id="orderState">
		<option value="">全部</option>
		<option value="0">提交</option>
		<option value="1">取消</option>
		<option value="10">多问审批不通过</option>
		<option value="15">多问审批通过</option>
		<option value="20">小贷审批不通过</option>
		<option value="25">小贷审批通过</option>
        <option value="30">已放款</option>
        <option value="45">已还清</option>
	</select>
	<button type="button" class="btn btn-purple btn-sm" id="searchd">
		<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
		    筛选

	</button>
</div>

<div class="row">
	<div class="col-xs-12">
		<table id="grid-table"></table>
		<div id="grid-pager"></div>
		<script type="text/javascript">
			var $path_base = "${contextPath}/static";//in Ace demo this will be used for editurl parameter
		</script>
		<!-- PAGE CONTENT ENDS -->
	</div>
	<!-- /.col -->
</div>
<!-- /.row -->

<div id="modal-dwCheck-order" class="modal fade" tabindex="-1"
	data-backdrop="static">
	<div class="modal-dialog" style="min-width: 400px;">
		<div class="modal-content">
			<div class="modal-header no-padding">
				<div class="table-header text-center">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">
						<span class="white">&times;</span>
					</button>
					审批
				</div>
			</div>
			<div class="modal-body" id="modal-dwCheck-order-body">
				<form id="showEditOrderForm" class="form-horizontal">
					<div class="col-sm-12 text-left" style="margin-bottom: 15px;">申请借款信息</div>
                    <div class="form-group text-left" id="mod-dwCheck-orderId-div">
                        <label class="col-sm-3 control-label">订单编号:</label> <label
                            class="control-label" id="dwCheck-orderId"></label>
                    </div>
					<div class="form-group text-left" id="mod-dwCheck-prodId-div">
						<label class="col-sm-3 control-label">借款产品:</label> <label
							class="control-label" id="dwCheck-prodId"></label>
					</div>
					<div class="form-group text-left" id="mod-dwCheck-applyPrice-div">
						<label class="col-sm-3 control-label">申请金额:</label> <label
							class="control-label" id="dwCheck-applyPrice"></label>
					</div>
					<div class="form-group text-left" id="mod-dwCheck-term-div">
						<label class="col-sm-3 control-label">借款期限:</label> <label
							class="control-label" id="dwCheck-term"></label>
					</div>
					<div class="form-group text-left" id="mod-dwCheck-monthFee-div">
						<label class="col-sm-3 control-label">月手续费:</label> <label
							class="control-label" id="dwCheck-monthFee"></label>
					</div>
					<div class="form-group text-left" id="mod-dwCheck-orderUse-div">
						<label class="col-sm-3 control-label">借款用途:</label> <label
							class="control-label" id="dwCheck-orderUse"></label>
					</div>
                    <hr class="style-one">
                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;">多问审批信息</div>
                    <div class="form-group text-left" id="mod-dwCheck-realPrice-div">
                        <label class="col-sm-3 control-label">审批金额:</label>
                        <label class="control-label" id="dwCheck-realPrice"></label>
                    </div>
                    <div class="form-group text-left" id="mod-dwCheck-dwOperId-div">
                        <label class="col-sm-3 control-label">审批操作人:</label>
                        <label class="control-label" id="dwCheck-dwOperId"></label>
                    </div>
                    <div class="form-group text-left" id="mod-dwCheck-dwCheckDate-div">
                        <label class="col-sm-3 control-label">审批时间:</label> <label
                            class="control-label" id="dwCheck-dwCheckDate"></label>
                    </div>
                    <div class="form-group text-left" id="mod-dwCheck-dwCheckInfo-div">
                        <label class="col-sm-3 control-label">审批不通过原因:</label>
                        <label class="control-label" id="dwCheck-dwCheckInfo"></label>
                    </div>
				</form>
			</div>
			<div class="modal-footer no-margin-top">
				<div class="text-center">
					<button id="btn-dwCheck-pass" type="button"
						class="btn btn-sm btn-primary">
						<i class="ace-icon fa fa-floppy-o bigger-160"></i> 提交审批通过的信息
					</button>
					<button id="btn-dwCheck-nopass" type="button"
						class="btn btn-sm btn-primary">
						<i class="ace-icon fa fa-floppy-o bigger-160"></i> 提交审批不通过的信息
					</button>
					<button class="btn btn-sm" data-dismiss="modal">
						<i class="ace-icon fa fa-share bigger-160"></i> 取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- 审批通过弹出框 -->
<div id="modal-dwCheck-pass" class="modal fade" tabindex="-1"
	data-backdrop="static">
	<div class="modal-dialog" style="min-width: 400px;">
		<div class="modal-content">
         <div class="modal-header no-padding">
            <div class="table-header text-center">
               <button type="button" class="close" data-dismiss="modal"
                  aria-hidden="true">
                  <span class="white">&times;</span>
               </button>审批通过信息
            </div>
         </div>			
			<div class="modal-body" id="modal-dwCheck-pass-body">
				<form id="auditOrderForm" class="form-horizontal">
					<input type="hidden" name="orderId" id="mod-dwCheck-pass-orderId" />
					<div class="form-group" id="mod-dwCheck-price-div">
						<label class="col-sm-2 control-label">审批金额:</label>
		            <div class="col-sm-6 text-left">
		               <input type="number" id="pass-realPrice" class="col-sm-10 form-control" max="50" min="5" step="1"
		               onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
		                  placeholder="请输入审批金额（单位万元）"/>
		            </div>	
		            <div class="col-sm-2 text-left">
		               <label class="control-label">万元</label>
		            </div>
					</div>
               <div class="form-group" id="mod-dwCheck-ajxs-div">
                  <label class="col-sm-2 control-label">案件数:</label>
                  <div class="col-sm-10 text-left">
                     <input type="number" id="pass-caseNum" class="form-control"/>
                  </div>
               </div>
               <div class="form-group" id="mod-dwCheck-edxs-div">
                  <label class="col-sm-2 control-label">额度系数:</label>
                  <div class="col-sm-10 text-left">
                     <input type="text" id="pass-arith" class="form-control"/>
                  </div>
               </div>               					
					<div class="form-group text-left">
						<label class="col-sm-4 control-label">律师身份信息查询结果:</label>
						   <select id="pass-cardInfo">
						      <option value="正常">正常</option>
						      <option value="不正常">不正常</option>
						   </select>
					</div>
					<div  class="form-group text-left">
					   <div class="col-sm-12 text-left">
                     <div id="div131-pass" class="checkbox-inline"></div>
                     <button class="btn btn-primary btn-white checkbox-inline"
                        type="button" onclick="uploadPic1(131,'div131-pass')">选择图片</button>
                  </div>
					</div>
					<div class="form-group" style="margin-left: 30px;">
						<div class="text-left">涉讼信息查询结果:</div>
					</div>
					<div class="form-group" style="margin-left: 30px;">
						<textarea id="pass-legalInfo" rows="4" cols="60"
							placeholder="请输入涉讼信息查询结果"></textarea>
					</div>
					<div class="form-group text-left">
						<label class="col-sm-4 control-label">失信信息查询结果:</label>
                  <select id="pass-loseInfo">
                     <option value="无失信">无失信</option>
                     <option value="有失信">有失信</option>
                  </select>
               </div>
               <div class="form-group text-left">
						<div class="col-sm-8 text-left">
							<div id="div134-pass" class="checkbox-inline"></div>
							<button class="btn btn-primary btn-white checkbox-inline"
								type="button" onclick="uploadPic1(134,'div134-pass')">选择图片</button>
						</div>
					</div>
				</form>
			</div>
			<div class="modal-footer no-margin-top">
				<div class="text-center">
					<button id="modal-dwCheck-order-pass" type="button"
						class="btn btn-sm btn-primary">
						<i class="ace-icon fa fa-floppy-o bigger-160"></i> 审批通过
					</button>
					<button class="btn btn-sm" data-dismiss="modal">
						<i class="ace-icon fa fa-share bigger-160"></i> 取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- 审批不通过弹出框 -->
<div id="modal-dwCheck-nopass" class="modal fade" tabindex="-1"
	data-backdrop="static">
	<div class="modal-dialog" style="min-width: 400px;">
		<div class="modal-content">
			<div class="modal-header no-padding">
				<div class="table-header text-center">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">
						<span class="white">&times;</span>
					</button>
					审批不通过
				</div>
			</div>
			<div class="modal-body" id="modal-audit-nopass-body">
				<form id="dwCheckOrderForm" class="form-horizontal">
					<input type="hidden" name="orderId" id="mod-dwCheck-nopass-orderId" />
					<div class="form-group" style="margin-left: 30px;">
						<div class="text-left">请输入审批不通过原因:</div>
					</div>
					<div class="form-group" style="margin-left: 30px;">
						<textarea id="dwCheck-nopass-info" rows="4" cols="60"
							placeholder="请输入审批不通过原因"></textarea>
					</div>
				</form>
			</div>
			<div class="modal-footer no-margin-top">
				<div class="text-center">
					<button id="modal-dwCheck-order-nopass" type="button"
						class="btn btn-sm btn-primary">
						<i class="ace-icon fa fa-floppy-o bigger-160"></i> 保存
					</button>
					<button class="btn btn-sm" data-dismiss="modal">
						<i class="ace-icon fa fa-share bigger-160"></i> 取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- 放款弹出框 -->
<div id="modal-order-loan" class="modal fade" tabindex="-1"
     data-backdrop="static">
    <div class="modal-dialog" style="min-width: 400px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header text-center">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    已还清
                </div>
            </div>
            <div class="modal-body" id="modal-order-loan-body">
                <form id="orderLoanForm" class="form-horizontal">
                    <input type="hidden" name="orderId" id="mod-loan-orderId" />
                    <div class="form-group">
                        <label class="col-sm-3 control-label">放款时间:</label>
                        <div class="col-sm-4 text-left">
                            <input type="text" class="form-control" id="mod-loan-date" class="form-control " placeholder="选择订单完成时间" />
                        </div>
                    </div>
                    <div class="form-group" style="margin-left: 30px;">
                        <div class="text-left">订单备注:</div>
                    </div>
                    <div class="form-group" style="margin-left: 30px;">
						<textarea id="mod-loan-remark" rows="4" cols="60"
                                  placeholder="请输入订单备注"></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button id="btn-order-loan" type="button"
                            class="btn btn-sm btn-primary">
                        <i class="ace-icon fa fa-floppy-o bigger-160"></i> 保存
                    </button>
                    <button class="btn btn-sm" data-dismiss="modal">
                        <i class="ace-icon fa fa-share bigger-160"></i> 取消
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 贷款还清弹出框 -->
<div id="modal-order-finish" class="modal fade" tabindex="-1"
     data-backdrop="static">
    <div class="modal-dialog" style="min-width: 400px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header text-center">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    已还清
                </div>
            </div>
            <div class="modal-body" id="modal-order-finish-body">
                <form id="orderFinishForm" class="form-horizontal">
                    <input type="hidden" name="orderId" id="mod-finish-orderId" />
                    <div class="form-group">
                        <label class="col-sm-3 control-label">完成时间:</label>
                        <div class="col-sm-4 text-left">
                            <input type="text" class="form-control" id="mod-finish-date" class="form-control " placeholder="选择订单完成时间" />
                        </div>
                    </div>
                    <div class="form-group" style="margin-left: 30px;">
                        <div class="text-left">订单备注:</div>
                    </div>
                    <div class="form-group" style="margin-left: 30px;">
						<textarea id="mod-finish-remark" rows="4" cols="60"
                                  placeholder="请输入订单备注"></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button id="btn-order-finish" type="button"
                            class="btn btn-sm btn-primary">
                        <i class="ace-icon fa fa-floppy-o bigger-160"></i> 保存
                    </button>
                    <button class="btn btn-sm" data-dismiss="modal">
                        <i class="ace-icon fa fa-share bigger-160"></i> 取消
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 申请的律师个人信息详情 -->
<div id="modal-view-lawyer" class="modal fade" tabindex="-1"
     data-backdrop="static">
    <div class="modal-dialog" style="min-width: 400px;">
        <div class="modal-content">
            <div class="modal-header bg-primary">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">×</button>
                <h4 class="modal-title text-center" id="myModalLabel">申请贷款律师个人信息</h4>
            </div>
            <div class="modal-body" id="modal-view-lawyer-body">
                <form id="viewOrderLawyerForm" class="form-horizontal">
                    <input type="hidden" name="orderId" id="mod-view-orderId" />
                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;">基本信息</div>
                    <div class="form-group text-left" id="mod-lawyer-realName-div">
                        <label class="col-sm-3 control-label">借款产品:</label> <label
                            class="control-label" id="lawyer-realName"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-idCard-div">
                        <label class="col-sm-3 control-label">身份证:</label> <label
                            class="control-label" id="lawyer-idCard"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-SfzAddress-div">
                        <label class="col-sm-3 control-label">身份证地址:</label> <label
                            class="control-label" id="lawyer-SfzAddress"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-Address-div">
                        <label class="col-sm-3 control-label">现住址:</label> <label
                            class="control-label" id="lawyer-Address"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-Email-div">
                        <label class="col-sm-3 control-label">邮箱:</label> <label
                            class="control-label" id="lawyer-Email"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-Phone-div">
                        <label class="col-sm-3 control-label">律师手机号码:</label> <label
                            class="control-label" id="lawyer-Phone"></label>
                    </div>
                    <hr class="style-one">
                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;">银行卡信息</div>
                    <div class="form-group text-left" id="mod-lawyer-BankNum-div">
                        <label class="col-sm-3 control-label">银行卡号:</label> <label
                            class="control-label" id="lawyer-BankNum"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-BankName-div">
                        <label class="col-sm-3 control-label">开户行:</label> <label
                            class="control-label" id="lawyer-BankName"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-BankMobile-div">
                        <label class="col-sm-3 control-label">预留手机号:</label> <label
                            class="control-label" id="lawyer-BankMobile"></label>
                    </div>
                    <hr class="style-one">
                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;">学历及工作信息</div>
                    <div class="form-group text-left" id="mod-lawyer-CertNum-div">
                        <label class="col-sm-3 control-label">执业证号:</label> <label
                            class="control-label" id="lawyer-CertNum"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-CertDate-div">
                        <label class="col-sm-3 control-label">律师证有效期:</label> <label
                            class="control-label" id="lawyer-CertDate"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-LawOffice-div">
                        <label class="col-sm-3 control-label">律所名称:</label> <label
                            class="control-label" id="lawyer-LawOffice"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-LawPhone-div">
                        <label class="col-sm-3 control-label">律所电话:</label> <label
                            class="control-label" id="lawyer-LawPhone"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-LawField-div">
                        <label class="col-sm-3 control-label">执业范围:</label> <label
                            class="control-label" id="lawyer-LawField"></label>
                    </div>
                    <div class="form-group text-left" id="mod-audit-LawAddress-div">
                        <label class="col-sm-3 control-label">律所通讯地址:</label> <label
                            class="control-label" id="lawyer-LawAddress"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-IncomeRange-div">
                        <label class="col-sm-3 control-label">年收入:</label> <label
                            class="control-label" id="lawyer-IncomeRange"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-ColleageName-div">
                        <label class="col-sm-3 control-label">毕业学校:</label> <label
                            class="control-label" id="lawyer-ColleageName"></label>
                    </div>
                    <div class="form-group text-left" id="mod-lawyer-Education-div">
                        <label class="col-sm-3 control-label">最高学历:</label> <label
                            class="control-label" id="lawyer-Education"></label>
                    </div>
                </form>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button class="btn btn-sm" data-dismiss="modal">
                        <i class="ace-icon fa fa-share bigger-160"></i> 关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 详细弹出框（Modal） -->
<div id="modal-view-order" class="modal fade" tabindex="-1"
	data-backdrop="static">
	<div class="modal-dialog" style="min-width: 400px;">
		<div class="modal-content">
			<div class="modal-header bg-primary">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">×</button>
				<h4 class="modal-title text-center" id="myViewModalLabel">订单详细信息</h4>
			</div>
			<div class="modal-body" id="modal-view-order-body">
				<form id="viewOrderForm" class="form-horizontal">
					<input type="hidden" name="orderId" id="mod-view-orderId-detail" />
					<div class="col-sm-12 text-left" style="margin-bottom: 15px;">申请借款信息</div>
					<div class="form-group text-left" id="mod-audit-prodId-div">
						<label class="col-sm-3 control-label">借款产品:</label> <label
							class="control-label" id="view-prodId"></label>
					</div>
					<div class="form-group text-left" id="mod-audit-applyPrice-div">
						<label class="col-sm-3 control-label">借款金额:</label> <label
							class="control-label" id="view-applyPrice"></label>
					</div>
					<div class="form-group text-left" id="mod-audit-term-div">
						<label class="col-sm-3 control-label">借款期限:</label> <label
							class="control-label" id="view-term"></label>
					</div>
					<div class="form-group text-left" id="mod-audit-monthFee-div">
						<label class="col-sm-3 control-label">月手续费:</label> <label
							class="control-label" id="view-monthFee"></label>
					</div>
					<div class="form-group text-left" id="mod-audit-orderUse-div">
						<label class="col-sm-3 control-label">借款用途:</label> <label
							class="control-label" id="view-orderUse"></label>
					</div>
					<hr class="style-one">
					<div class="col-sm-12 text-left" style="margin-bottom: 15px;">多问审批信息</div>
					<div class="form-group text-left" id="mod-audit-realPrice-div">
						<label class="col-sm-3 control-label">审批金额:</label> <label
							class="control-label" id="view-realPrice"></label>
					</div>
					<div class="form-group text-left" id="mod-audit-dwOperId-div">
						<label class="col-sm-3 control-label">审批操作人:</label>
                        <label class="control-label" id="view-dwOperId"></label>
					</div>
					<div class="form-group text-left" id="mod-audit-dwCheckDate-div">
						<label class="col-sm-3 control-label">审批时间:</label> <label
							class="control-label" id="view-dwCheckDate"></label>
					</div>
                    <div class="form-group text-left" id="mod-audit-dwCheckInfo-div">
                        <label class="col-sm-3 control-label">审批不通过原因:</label>
                        <label class="control-label" id="view-dwCheckInfo"></label>
                    </div>
                    <hr class="style-one">
                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;">银行（小贷）审批信息</div>
                    <div class="form-group text-left" id="mod-audit-xdPrixce-div">
                        <label class="col-sm-3 control-label">审批金额:</label> <label
                            class="control-label" id="view-xdPrixce"></label>
                    </div>
                    <div class="form-group text-left" id="mod-audit-xdOperId-div">
                        <label class="col-sm-3 control-label">审批操作人:</label> <label
                            class="control-label" id="view-xdOperId"></label>
                    </div>
                    <div class="form-group text-left" id="mod-audit-xdCheckDate-div">
                        <label class="col-sm-3 control-label">审批时间:</label> <label
                            class="control-label" id="view-xdCheckDate"></label>
                    </div>
                    <div class="form-group text-left" id="mod-audit-xdCheckInfo-div">
                        <label class="col-sm-3 control-label">审批不通过原因:</label>
                        <label class="control-label" id="view-xdCheckInfo"></label>
                    </div>
				</form>
			</div>
			<div class="modal-footer no-margin-top">
				<div class="text-center">
					<button class="btn btn-sm" data-dismiss="modal">
						<i class="ace-icon fa fa-share bigger-160"></i> 关闭
					</button>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- 还款记录（Modal） -->
<div id="modal-order-plan" class="modal fade" tabindex="-1" data-backdrop="static">
  <div class="modal-dialog" style="min-width: 400px;width:680px;">
    <div class="modal-content">
       <div class="modal-header bg-primary">
           <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
           <h4 class="modal-title text-center" id="myModalLabel">还款记录</h4>
       </div>
     <div class="modal-body" id="modal-repay-order-body">
     <input type="hidden" name="orderId" id="mod-plan-orderId"/>
        <table id="planTable"></table>
     </div>
     <div class="modal-footer no-margin-top">
      <div class="text-center">
        <button class="btn btn-sm" data-dismiss="modal">
         <i class="ace-icon fa fa-share bigger-160"></i> 关闭
        </button>
      </div>
     </div>
   </div>
  </div>
</div>
<!-- 律师信用信息（Modal） -->
<div id="modal-lawyer-info" class="modal fade" tabindex="-1" data-backdrop="static">
  <div class="modal-dialog" style="min-width: 400px;width:680px;">
    <div class="modal-content">
       <div class="modal-header bg-primary">
           <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
           <h4 class="modal-title text-center" id="myModalLabel">律师信用信息</h4>
       </div>
     <div class="modal-body" id="modal-lawyer-info-body">
     <input type="hidden" name="orderId" id="mod-lawyer-info-orderId"/>
        <table id="lawyerInfoTable"></table>
     </div>
     <div class="modal-footer no-margin-top">
      <div class="text-center">
        <button class="btn btn-sm" data-dismiss="modal">
         <i class="ace-icon fa fa-share bigger-160"></i> 关闭
        </button>
      </div>
     </div>
   </div>
  </div>
</div>
<!-- 修改订单弹出框 -->
<div id="modal-edit-order" class="modal fade" tabindex="-1" data-backdrop="static">
   <div class="modal-dialog" style="min-width: 400px;">
      <div class="modal-content">
         <div class="modal-header bg-primary">
            <button type="button" class="close" data-dismiss="modal" class="white" aria-hidden="true">
            <span class="white">&times;</span>
            </button>
            <h4 class="modal-title text-center" id="myEditModalLabel">修改订单</h4>
         </div>
         <div class="modal-body" id="modal-edit-order-body">
            <form id="editOrderForm" class="form-horizontal">
               <input type="hidden" name="orderId" id="mod-edit-orderId" />
               <div class="form-group text-left">
                  <label class="col-sm-3 control-label">律师身份查询结果:</label>
                     <select id="edit-cardInfo">
                        <option value="正常">正常</option>
                        <option value="不正常">不正常</option>
                     </select>
               </div>
               <div class="form-group text-left">
                  <div class="col-sm-7 text-left">
                     <!--  <div id="div131" class="checkbox-inline"></div> -->
                     <div id="div131-edit" class="checkbox-inline"></div>
                     <button id="uploadLaw131" class="btn btn-primary btn-white checkbox-inline" type="button" 
                        onclick="uploadEditPic(131,'div131-edit')">选择图片</button>                 	 
                  </div>
               </div>
               <div class="form-group" style="margin-left: 30px;">
                  <div class="text-left">填写涉讼信息查询结果:</div>
               </div>
               <div class="form-group" style="margin-left: 30px;">
                  <textarea id="mod-legalInfo" rows="4" cols="60"
                     placeholder="请输入涉讼信息查询结果"></textarea>
               </div>
               <div class="form-group text-left">
                  <label class="col-sm-3 control-label">失信信息查询结果:</label>
                     <select id="edit-loseInfo">
                        <option value="正常">正常</option>
                        <option value="不正常">不正常</option>
                     </select>
               </div> 
               <div class="form-group text-left">                 
                  <div class="col-sm-8 text-left">
                     <div id="div134-edit" class="checkbox-inline"></div>
                     <button class="btn btn-primary btn-white checkbox-inline" type="button" 
                        onclick="uploadEditPic(134,'div134-edit')">选择图片</button>            
                  </div>
               </div>
               <div class="form-group" id="mod-edit-remark-div">
                  <label class="col-sm-2 control-label">追加备注:</label>
                  <div class="col-sm-10 text-left">
                     <input type="text" id="mod-edit-addRemark" class="form-control" />
                  </div>
               </div>               
            </form>
         </div>
         <div class="modal-footer no-margin-top">
            <div class="text-center">
               <button id="modal-edit-order-submit" type="button"
                  class="btn btn-sm btn-primary">
                  <i class="ace-icon fa fa-floppy-o bigger-160"></i> 保存
               </button>
               <button class="btn btn-sm" data-dismiss="modal">
                  <i class="ace-icon fa fa-share bigger-160"></i> 取消
               </button>
            </div>
         </div>
      </div>
   </div>
</div>
<!-- 图片上传 -->
<div id="mod-pic" class="modal fade" tabindex="-1">
   <div class="modal-dialog" style="max-width: 500px;">
      <div class="modal-content">
         <div class="modal-header no-padding">
            <div class="table-header">
               <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                  <span class="white">&times;</span>
               </button>
                                       图片上传
            </div>
         </div>
         <div class="modal-body">
            <div class="row">
               <div class="col-xs-12">
                  <!-- PAGE CONTENT BEGINS  -->
                  <form id="picform" >
                     <input id="picFileId" type="file" name="file" multiple />
                     <input type="hidden" name="attachType" id="mod-pic-attachType"/>
                     <input type="hidden" name="divId" id="mod-pic-divId"/>
                     <input type="hidden" name="orderId" id="mod-pic-orderId"/>
                     <div class="hr hr-12 dotted"></div>
                     <div class="text-center">
                     <button type="button" class="btn btn-sm btn-primary" onclick="updatePic();">上传</button>
                     <button type="reset" class="btn btn-sm">清除</button>
                     </div>
                  </form>
               </div><!-- /.col -->
            </div><!-- /.row -->
            
         </div>
      </div><!-- /.modal-content -->
   </div><!-- /.modal-dialog -->
</div>
<script type="text/javascript">
    function updatePic() {
        var orderId = $("#mod-pic-orderId").val();
        picUpload(orderId);
    }
</script>
<%@include file="/WEB-INF/page/back/auth.jsp"%>
<!-- page specific plugin scripts -->
<script type="text/javascript">
var contextPath = '${contextPath}';
var myGrid = null;
var planTable = null;
var plan_selector = "#planTable";
var lawyerInfoTable = null;
var lawyerInfo_selector = "#lawyerInfoTable";

var contextPath = '${contextPath}';
var bucket = '${oss_bucket_b}';
var logoUrl = '${oss_bucket_b_url}';
var logoThum = '${oss_bucket_b_url_img}';
var url_b = '${duowenapp_b}';
var scripts = [
      "${contextPath}/static/assets/js/date-time/bootstrap-datepicker.js",
      "${contextPath}/static/assets/js/date-time/locales/bootstrap-datepicker.zh-CN.js",
      "${contextPath}/static/assets/js/jqGrid/jquery.jqGrid.js",
      "${contextPath}/static/js/contract/promise-6.1.0.js", 
      "http://gosspublic.alicdn.com/aliyun-oss-sdk-4.3.0.min.js",
      "${contextPath}/static/js/contract/ace.fileinput.js", 
      "${contextPath}/static/js/contract/uuid.js",
      "${contextPath}/static/js/contract/picupload.js", 
      "${contextPath}/static/js/plc/lsd_updpic.js?v=10",
      "${contextPath}/static/assets/js/jqGrid/i18n/grid.locale-cn.js",
        "${contextPath}/static/js/datatimepicker/bootstrap-datetimepicker.zh-CN.js",
        "${contextPath}/static/js/datatimepicker/bootstrap-datetimepicker.min.js",
        "${contextPath}/static/js/datatimepicker/bootstrap-datetimepicker.min.css",
      "${contextPath}/static/assets/js/lazyload/jquery.lazyload.js", null ]
      
      
$("#mod-pic").on("hidden.bs.modal",function(){  
	  $(document.body).addClass("modal-open");  
	});

$('.page-content-area').ace_ajax('loadScripts',scripts,function() {
     jQuery(function($) {
    	   var grid_selector = "#grid-table";
    	   var pager_selector = "#grid-pager";
                  // resize to fit page size
         $(window).on( 'resize.jqGrid', function() { 
        	    $(grid_selector).jqGrid('setGridWidth',  $(".page-content").width());});
              var parent_column = $(grid_selector).closest(
                  '[class*="col-"]');
                  $(document).on(
                    'settings.ace.jqGrid',
                    function(ev, event_name, collapsed) {
                       if (event_name === 'sidebar_collapsed'|| event_name === 'main_container_fixed') {
                          // setTimeout is for webkit only to give time for DOM changes and then redraw!!!
                          setTimeout(function() {$(grid_selector).jqGrid('setGridWidth',parent_column.width());}, 0);
                       }
                  });



          $("#searchd").click(function() {
              var keyword = $("#keyword").val();
              var param = {
            	  'keyword' : keyword,
                 'startDate' : $("#startDate").val(),
                 'endDate' : $("#endDate").val(),
                 'orderState' : $("#orderState").val()
              }
              myGrid.setGridParam({
            	   postData : param,
            	   url : '${contextPath}/sys/lsdOrder/getOrder'}).trigger('reloadGrid');
           });
           myGrid = jQuery(grid_selector).jqGrid({
              subGrid : false,
              url : "${contextPath}/sys/lsdOrder/getOrder",
              datatype : "json",
              height : "auto",
              mtype : 'POST',
              align : "center",
              colNames : ["申请时间", "借款编号", "律师", "APP注册电话", "城市", "借款产品", "审批额度", "借款期限", "月手续费", "还款方式", "订单状态","备注", "查看", "操作"],
              colModel : [ {
                 name : 'createDate',//1449829970000
                 index : 'createDate',
                 label : '申请时间',
                 width : 120,
                 search : false,
                 editable : false,
                 formatter : formatCreateDate
              }, {
                 name : 'orderId',
                 index : 'orderId',
                 label : '借款编号',
                 width : 120,
                 search : false,
                 align : "center",
                 editable : false,
              }, {
                 name : 'realName',
                 index : 'realName',
                 label : '律师',
                 width : 60,
                 align : "center",
                 editable : false
              }, {
                 name : 'phone',
                 index : 'phone',
                 label : 'APP注册电话',
                 width : 100,
                 align : "center",
                 editable : false,
              }, {
                 name : 'cityName',
                 index : 'cityName',
                 label : '城市',
                 width : 60,
                 align : "center",
                 editable : false,
              }, {
                 name : 'prodName',
                 index : 'prodName',
                 label : '借款产品',
                 align : "center",
                 width : 80,
                 editable : false,
              }, {
                 name : 'applyPrice',
                 index : 'applyPrice',
                 label : '审批额度',
                 align : "right",
                 width : 60,
                 editable : false,
              }, {
                 name : 'term',
                 index : 'term',
                 label : '借款期限',
                 width : 80,
                 align : "center",
                 editable : false,
              }, {
                 name : 'monthFee',
                 index : 'monthFee',
                 label : '月手续费',
                 width : 60,
                 align : "center",
                 editable : false,
                 formatter : formatMonthFee,
              }, {
                 name : 'repayType',
                 index : 'repayType',
                 label : '还款方式',
                 width : 80,
                 align : "center",
                 editable : false,
                 formatter : formatRepayType,
              }, {
                 name : 'orderState',
                 index : 'orderState',
                 label : '订单状态',
                 align : "center",
                 width : 100,
                 editable : false,
                 formatter : formatOrderState,
              },/*  {
                 name : 'repayFeeSum',
                 index : 'repayFeeSum',
                 label : '已还利息',
                 align : "center",
                 width : 80,
                 editable : false
              },{
                 name : 'prepayment',
                 index : 'prepayment',
                 label : '提前还款',
                 width : 80,
                 align : "center",
                 editable : false,
                 formatter : formatPrepayment,
              }, */{
                 name : 'remark',
                 index : 'remark',
                 label : '备注',
                 align : "left",
                 width : 40,
                 editable : false,
              },{
                  name : 'view',
                  index : '',
                  label : '查看',
                  width : 160,
                  editable : false,
                  search : false,
                  sortable : false,
                  fixed : true,
                  formatter : viewFormatter
              },{
                 name : 'id',
                 index : '',
                 label : '操作',
                 width : 160,
                 editable : false,
                 search : false,
                 sortable : false,
                 fixed : true,
                 formatter : optionFormatter
              }],
              //scroll : 1, // set the scroll property to 1 to enable paging with scrollbar - virtual loading of records
              sortname : "createDate",
              sortorder : "desc",
              viewrecords : true,
              rowNum : 10,
              rowList : [ 10, 30, 60 ],
              pager : pager_selector,
              altRows : true,      
              loadComplete : function() {
                  var table = this;
                  setTimeout(function(){
                     styleCheckbox(table);
                     updateActionIcons(table);
                     updatePagerIcons(table);
                     enableTooltips(table);
                  }, 0);
               },              
           });
           
           lawyerInfoTable = jQuery(lawyerInfo_selector).jqGrid({
               subGrid : false,
               url : "${contextPath}/sys/lsdOrder/getLawyerInfo",//
               datatype : "local",
               height : "auto",
               autowidth : true,
               colNames : ["订单编号","律师身份信息查询结果", "涉讼信息查询结果", "失信信息查询结果","修改日期", "修改操作员"],
               colModel : [{
                   name : "orderId",
                   index : "orderId",
                   label : "订单编号",
                   width : 100,
                   align : "center",
                   search : false,
                   hidden : true,
               },{
                  name : "cardInfoPath",
                  index : "cardInfoPath",
                  label : "律师身份信息查询结果",
                  align : "center",
                  width : 130,
                  search : false,
                  formatter : formatCardAttach,
            },{
                  name : "legalInfo",
                  index : "legalInfo",
                  label : "涉讼信息查询结果",
                  align : "right",
                  width : 150,
                  sortable: false,
                  search : false
            },{
                  name : "loseInfoPath",
                  index : "loseInfoPath",
                  label : "失信信息查询结果",
                  align : "center",
                  width : 130,
                  search : false,
                  formatter : formatLoseAttach,
            },{
                name : "checkDate",
                index : "checkDate",
                label : "修改日期",
                width : 140,
                align : "center",
                search : false,
                formatter : formatCreateDate,
              },{
                  name : "operId",
                  index : "operId",
                  label : "修改操作员",
                  align : "center",
                  width : 90,
                  search : false
            }],
               sortname : "seq",
               sortorder : "asc",
               viewrecords : false,
               rowNum : 36,
               rowList : [ 10, 20, 30 ],
               altRows : true,
               //toppager : true,
               multiselect : false,
               //multikey : "ctrlKey",
               multiboxonly : true,
               rownumbers:false,  
               rownumWidth:30,
               loadComplete : function() {
                   var table = this;
                   setTimeout(function(){
                      styleCheckbox(table);
                      updateActionIcons(table);
                      updatePagerIcons(table);
                      enableTooltips(table);
                   }, 0);
                },                
        }).trigger("reloadGrid"); //重新载入                 
        
           planTable = jQuery(plan_selector).jqGrid({
               subGrid : false,
               url : "${contextPath}/order/getRepayPlan",//
               datatype : "local",
               height : "auto",
               autowidth : true,
               colNames : ["订单编号","期数", "应还日期", "应还利息", "应还本金", "合计", "期末余额", "还款状态"],
               colModel : [{
                   name : "orderId",
                   index : "orderId",
                   label : "订单编号",
                   width : 100,
                   align : "center",
                   search : false,
                   hidden : true,
               },{
                name : "seq",
                index : "seq",
                label : "期数",
                width : 65,
                align : "center",
                search : false
                },{
                  name : "repayDate",
                  index : "repayDate",
                  label : "应还日期",
                  width : 100,
                  align : "center",
                  search : false,
                  formatter : formatCreateDate,
                },{
                  name : "repayFee",
                  index : "repayFee",
                  label : "应还利息",
                  align : "center",
                  width : 90,
                  search : false
            },{
                  name : "repayMoney",
                  index : "repayMoney",
                  label : "应还本金",
                  align : "right",
                  width : 90,
                  sortable: false,
                  search : false
            },{
                  name : "repaySum",
                  index : "repaySum",
                  label : "合计",
                  align : "center",
                  width : 90,
                  search : false
            },{
                  name : "balance",
                  index : "balance",
                  label : "期末余额",
                  align : "center",
                  width : 90,
                  search : false
            },{
                name : "state",
                index : "state",
                label : "还款状态",
                align : "center",
                width : 90,
                search : false,
                formatter : formatState,
                cellattr: addCellAttr,
            }],
               sortname : "seq",
               sortorder : "asc",
               viewrecords : false,
               rowNum : 36,
               rowList : [ 10, 20, 30 ],
               altRows : true,
               //toppager : true,
               multiselect : false,
               //multikey : "ctrlKey",
               multiboxonly : true,
               rownumbers:false,  
               rownumWidth:30,
               gridComplete: completeMethod,
               footerrow:true,                  
        }).trigger("reloadGrid"); //重新载入          
        
        function formatState(cellvalue, options, rowObject){
     	      if(cellvalue == 2){
     	         return "已还款"
     	      }else if(cellvalue == 5){
     	         return "已提前还款"
     	      }else{
     	         return "未还款";
     	      }
     	   }
        /*统计功能 */  
        function completeMethod(){  
            var sum_repayFee = $("#planTable").getCol('repayFee',false,'sum');  
            var sum_repayMoney =$("#planTable").getCol('repayMoney',false,'sum'); 
            var sum_repaySum = $("#planTable").getCol('repaySum',false,'sum'); 
            $("#planTable").footerData('set', { "seq": '合计', repayFee: sum_repayFee, repayMoney: sum_repayMoney, repaySum: sum_repaySum });
            //gridTable1.trigger('reloadGrid');
            //$("#modal-order-plan").modal("toggle");
        }
        function addCellAttr(rowId, val, rawObject, cm, rdata) {
            if(rawObject.state == "1" ){
                return "style='color:blue'";
            }else if(rawObject.state == "2"){
                return "style='color:green'";
            } else {
                return "";
            }
        }        
           $(window).triggerHandler('resize.jqGrid');// trigger window resize to make the grid get the correct size
           // enable search/filter toolbar
           // jQuery(grid_selector).jqGrid('filterToolbar',{defaultSearch:true,stringResult:true})
           // jQuery(grid_selector).filterToolbar({});
           // switch element when editing inline
           function aceSwitch(cellvalue, options, cell) {
              setTimeout(function() {
                 $(cell).find('input[type=checkbox]').addClass('ace ace-switch ace-switch-5').after('<span class="lbl"></span>');
              }, 0);
           }
           // navButtons
           jQuery(grid_selector).jqGrid('navGrid', pager_selector, { // navbar options
              edit : false,
              editicon : 'ace-icon fa fa-pencil blue',
              add : false,
              addicon : 'ace-icon fa fa-plus-circle purple',
              del : false,
              delicon : 'ace-icon fa fa-trash-o red',
              search : false,
              searchicon : 'ace-icon fa fa-search orange',
              refresh : true,
              refreshicon : 'ace-icon fa fa-refresh blue',
              view : false,
              viewicon : 'ace-icon fa fa-search-plus grey'
           }, {
              // edit record form
              // closeAfterEdit: true,
              // width: 700,
              recreateForm : true,
              beforeShowForm : function(e) {
                 var form = $(e[0]);
                 form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
                 style_edit_form(form);
              },
              errorTextFormat: function (response) {
                 var result = eval('('+response.responseText+')');
                  return result.message;
              }
           }, {
              // new record form
              // width: 700,
              closeAfterAdd : true,
              recreateForm : true,
              viewPagerButtons : false,
              beforeShowForm : function(e) {
                 var form = $(e[0]);
                 form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
                 style_edit_form(form);
              },
              errorTextFormat: function (response) {
                 var result = eval('('+response.responseText+')');
                  return result.message;
              }
           }, {
              // delete record form
              recreateForm : true,
              beforeShowForm : function(e) {
                 var form = $(e[0]);
                 if (form.data('styled'))
                    return false;
                 form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
                 style_delete_form(form);
                 form.data('styled', true);
              },
              onClick : function(e) {
                 // alert(1);
              }
           }, {
              // search form
              recreateForm : true,
              afterShowSearch : function(e) {
                 var form = $(e[0]);
                 form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />')
                 style_search_form(form);
              },
              afterRedraw : function() {
                 style_search_filters($(this));
              },
              multipleSearch : true 
              /**
               * multipleGroup:true, showQuery: true
               */
           }, {
              // view record form
              recreateForm : true,
              beforeShowForm : function(e) {
                 var form = $(e[0]);
                 form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />')
              }
           })
           
           
           function style_edit_form(form) {
              // form.find('input[name=statusCn]').addClass('ace ace-switch ace-switch-5').after('<span class="lbl"></span>');
              // don't wrap inside a label element, the checkbox value won't be submitted (POST'ed)
              // .addClass('ace ace-switch ace-switch-5').wrap('<label class="inline" />').after('<span class="lbl"></span>');

              // update buttons classes
              var buttons = form.next().find('.EditButton .fm-button');
              buttons.addClass('btn btn-sm').find('[class*="-icon"]').hide();// ui-icon, s-icon
              buttons.eq(0).addClass('btn-primary').prepend('<i class="ace-icon fa fa-check"></i>');
              buttons.eq(1).prepend('<i class="ace-icon fa fa-times"></i>')

              buttons = form.next().find('.navButton a');
              buttons.find('.ui-icon').hide();
              buttons.eq(0).append('<i class="ace-icon fa fa-chevron-left"></i>');
              buttons.eq(1).append('<i class="ace-icon fa fa-chevron-right"></i>');
           }

           function style_delete_form(form) {
              var buttons = form.next().find('.EditButton .fm-button');
              buttons.addClass('btn btn-sm btn-white btn-round').find('[class*="-icon"]').hide();// ui-icon, s-icon
              buttons.eq(0).addClass('btn-danger').prepend('<i class="ace-icon fa fa-trash-o"></i>');
              buttons.eq(1).addClass('btn-default').prepend('<i class="ace-icon fa fa-times"></i>')
           }

           function style_search_filters(form) {
              form.find('.delete-rule').val('X');
              form.find('.add-rule').addClass('btn btn-xs btn-primary');
              form.find('.add-group').addClass('btn btn-xs btn-success');
              form.find('.delete-group').addClass('btn btn-xs btn-danger');
           }
           function style_search_form(form) {
              var dialog = form.closest('.ui-jqdialog');
              var buttons = dialog.find('.EditTable')
              buttons.find('.EditButton a[id*="_reset"]').addClass('btn btn-sm btn-info').find('.ui-icon').attr('class', 'ace-icon fa fa-retweet');
              buttons.find('.EditButton a[id*="_query"]').addClass('btn btn-sm btn-inverse').find('.ui-icon').attr('class', 'ace-icon fa fa-comment-o');
              buttons.find('.EditButton a[id*="_search"]').addClass('btn btn-sm btn-purple').find('.ui-icon').attr('class', 'ace-icon fa fa-search');
           }

           function beforeDeleteCallback(e) {
              var form = $(e[0]);
              if (form.data('styled'))
                 return false;
              form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
              style_delete_form(form);
              form.data('styled', true);
           }

           function beforeEditCallback(e) {
              var form = $(e[0]);
              form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
              style_edit_form(form);
           }

           // it causes some flicker when reloading or navigating grid
           // it may be possible to have some custom formatter to do this as the grid is being created to prevent this
           // or go back to default browser checkbox styles for the grid
           function styleCheckbox(table) {
              /**
               * $(table).find('input:checkbox').addClass('ace') .wrap('<label />') .after('<span class="lbl align-top" />') $('.ui-jqgrid-labels th[id*="_cb"]:first-child')
               * .find('input.cbox[type=checkbox]').addClass('ace') .wrap('<label />').after('<span class="lbl align-top" />');
               */
           }

           // unlike navButtons icons, action icons in rows seem to be hard-coded
           // you can change them like this in here if you want
           function updateActionIcons(table) {
              /**
               * var replacement = { 'ui-ace-icon fa fa-pencil' : 'ace-icon fa fa-pencil blue', 'ui-ace-icon fa fa-trash-o' : 'ace-icon fa fa-trash-o red', 'ui-icon-disk' : 'ace-icon fa fa-check green', 'ui-icon-cancel' :
               * 'ace-icon fa fa-times red' }; $(table).find('.ui-pg-div span.ui-icon').each(function(){ var icon = $(this); var $class = $.trim(icon.attr('class').replace('ui-icon', '')); if($class in replacement)
               * icon.attr('class', 'ui-icon '+replacement[$class]); })
               */
           }

           // replace icons with FontAwesome icons like above
           function updatePagerIcons(table) {
              var replacement = {
                 'ui-icon-seek-first' : 'ace-icon fa fa-angle-double-left bigger-140',
                 'ui-icon-seek-prev' : 'ace-icon fa fa-angle-left bigger-140',
                 'ui-icon-seek-next' : 'ace-icon fa fa-angle-right bigger-140',
                 'ui-icon-seek-end' : 'ace-icon fa fa-angle-double-right bigger-140'
              };
              $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function() {
                 var icon = $(this);
                 var $class = $.trim(icon.attr('class').replace('ui-icon', ''));

                 if ($class in replacement)
                    icon.attr('class', 'ui-icon ' + replacement[$class]);
              })
           }

           function enableTooltips(table) {
              $('.navtable .ui-pg-button').tooltip({
                 container : 'body'
              });
              $(table).find('.ui-pg-div').tooltip({
                 container : 'body'
              });
           }

           $(document).one('ajaxloadstart.page', function(e) {
              $(grid_selector).jqGrid('GridUnload');
              $('.ui-jqdialog').remove();
           });
         function formatMonthFee(cellvalue, options,rowObject) {
        	  return (cellvalue*100).toFixed(2)+"%"
         }
         
         function formatCheckRes(cellvalue, options,rowObject) {
        	 //// 校验结果，0:未匹配，1匹配，2不匹配
        	   if(cellvalue == '1') {
        		   return "校验成功"
        	   }else if(cellvalue == '2'){
        		   return "校验不成功"
        	   }else{
        		   return "未校验"
        	   }
         }
         function formatRepayType(cellvalue, options,rowObject) {
            if (cellvalue == '0001')
               return "先息后本";
            if (cellvalue == '0002')
               return "等额本息";
            return "";
         }
         function formatOrderState(cellvalue, options, rowObject) {
            if (cellvalue == 0)
               return "审批中";
            if (cellvalue == 1)
               return "已取消";
            if (cellvalue == 10)
               return "多问审批不通过";
            if (cellvalue == 15)
               return "多问审批通过";
            if (cellvalue == 20)
               return "小贷审批不通过";
             if (cellvalue == 25)
                 return "小贷审批通过";
            if (cellvalue == 30)
               return "已放款";
            if (cellvalue == 35)
               return "放款中";
            if (cellvalue == 40)
               return "未结清";
            if (cellvalue == 45)
               return "已结清";
            return cellvalue;
         }
         function formatOrderUse(orderUser) {
        	   var retOrderUser = '';
        	   switch (orderUser) {
        	   case '0':
        	      retOrderUser = '业务拓展';
        	      break;
        	   case '1':
        	      retOrderUser = '投资理财';
        	      break;
        	   case '2':
        	      retOrderUser = '合伙开所';
        	      break;
        	   case '3':
        	      return retOrderUser = ' 教育培训';
        	      break;
        	   case '4':
        	      retOrderUser = ' 家居装修';
        	      break;
        	   case '5':
        	      retOrderUser = '购车';
        	      break;
        	   case '6':
        	      retOrderUser = '其它';
        	      break;
        	   default:
        	      retOrderUser = '';
        	   }
        	   return retOrderUser;
        	}         
         function formatPrepayment(cellvalue, options,
               rowObject) {
            if (cellvalue == 1)
               return "已申请";
            return "";
         }
         function formatCreateDate(cellvalue, options,
               rowObject) {
            var result = "";
            if (cellvalue != null) {
               var d = new Date(cellvalue);
               result = d.getFullYear() + '-'
                     + formatDate(d.getMonth() + 1)
                     + "-" + formatDate(d.getDate())
                     + ' ' + formatDate(d.getHours())
                     + ":" + formatDate(d.getMinutes())
                     + ":" + formatDate(d.getSeconds());
            }
            return result;
         }

         function formatDate(d) {
            var result = "";
            if (d > 9) {
               result = d.toString();
            } else {
               result = '0' + d.toString();
            }
            return result;
         }
         
         function formatLoseAttach(cellvalue, options, rowObject){
               var attachUrl = rowObject.loseInfo+",<a href='" + logoUrl +"/"+ cellvalue + "' style='color:blue;align:left;' target='_blank'>查看</a>";
               return attachUrl;
         }
         function formatCardAttach(cellvalue, options, rowObject){
             var attachUrl = rowObject.cardInfo+",<a href='" + logoUrl +"/"+ cellvalue + "' style='color:blue;align:left;' target='_blank'>查看</a>";
             return attachUrl;
         }
         function viewFormatter(cellvalue, options, cell) {
            var template = "<button data-toggle='modal' onclick='showdetail(\""+ cell.orderId
                  + "\")' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>订单详情</button>";
             template += "<button data-toggle='modal' onclick='showLawyerdetail(\""+ cell.orderId
                 + "\")' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>律师详情</button>";
             template += "<button data-toggle='modal' onclick='showAttachs(\""+ cell.orderId
                 + "\")' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>附件详情</button>";
            template += "<br><button data-toggle='modal' onclick='showLawyerInfo(\""+ cell.orderId
            + "\")' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>查看律师信用信息</button>";
            return template;
         }

         function optionFormatter(cellvalue, options, cell) {
             var template = "";
             if (cell.orderState != 1 && cell.orderState != 10) {
                 template += "<button data-toggle='modal' onclick='showEditOrder(\""+ cell.orderId
                 + "\")' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>补充涉讼信息</button>";
             }

             if (cell.orderState == 0) {
                 template += "<button data-toggle='modal' onclick='showDwCheck(\"" + cell.orderId
                     + "\")' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>审批</button>";
             }
             if (cell.orderState == 25) {
                 template += "<button data-toggle='modal' onclick='showOrderLoan(\"" + cell.orderId
                     + "\")' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>放款</button>";
             }
             if (cell.orderState == 30) {
                 template += "<button data-toggle='modal' onclick='showOrderFinish(\"" + cell.orderId
                     + "\")' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>还清</button>";
             }
             return template;
         }
         $('.date-picker').datepicker({
            language : 'zh-CN',
            pickTime : false,
            todayBtn : true,
            autoclose : true,
            minView : '2',
            forceParse : false,
            format : "yyyy-mm-dd"
         });
    });
 });
//结束加载

//按钮点击事件
$('#modal-edit-order-submit').click(function(event) {
   editOrder();
});

$('#modal-dwCheck-order-pass').click(function(event) {
	var orderId = $("#mod-dwCheck-pass-orderId").text();
	var cardAttachId = $("#in-div131-pass").val();
	var loseAttachId = $("#in-div134-pass").val();
	aduitPass(orderId,cardAttachId,loseAttachId);
});

$('#modal-dwCheck-order-nopass').click(function(event) {
	 var orderId = $("#mod-dwCheck-nopass-orderId").text();
	 aduitNopass(orderId);
});

//显示审批通过弹出层
$("#btn-dwCheck-pass").click(function() {
	var orderId = $("#dwCheck-orderId").text();
	$("#mod-dwCheck-pass-orderId").text(orderId);
   $("#modal-dwCheck-pass").modal("toggle");
});

//显示审批不通过弹出层
$("#btn-dwCheck-nopass").click(function() {
    var orderId = $("#dwCheck-orderId").text();
    $("#mod-dwCheck-nopass-orderId").text(orderId);
    $("#dwCheck-nopass-info").text('');
    $("#modal-dwCheck-nopass").modal("toggle");
});

//已还清保存
$("#btn-order-finish").click(function() {
    var orderId = $("#mod-finish-orderId").text();
    var finishDate = $("#mod-finish-date").val();
    var remark = $("#mod-finish-remark").val();
    $.post("${contextPath}/sys/lsdOrder/finishOrder", {
        'orderId' : orderId,
        'finishDate' : finishDate,
        'remark' : remark,
    }, function(ret) {
        if (ret.success) {
            $("#modal-order-finish").modal("toggle");
            myGrid.trigger("reloadGrid");
            alert("保存成功！");
        } else {
            alert(ret.message);
        }
    });
});

//已放款保存
$("#btn-order-loan").click(function() {
    var orderId = $("#mod-loan-orderId").text();
    var finishDate = $("#mod-loan-date").val();
    var remark = $("#mod-loan-remark").val();
    $.post("${contextPath}/sys/lsdOrder/loanOrder", {
        'orderId' : orderId,
        'finishDate' : finishDate,
        'remark' : remark,
    }, function(ret) {
        if (ret.success) {
            $("#modal-order-loan").modal("toggle");
            myGrid.trigger("reloadGrid");
            alert("保存成功！");
        } else {
            alert(ret.message);
        }
    });
});

function showRepayPlan(orderId){
    planTable.setGridParam({postData:{'orderId':orderId},url:'${contextPath}/sys/lsdOrder/getRepayPlan',datatype:'json',page:1}).trigger('reloadGrid');  
    planTable.closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });  
    $("#modal-order-plan").modal("toggle");
  }

function showLawyerInfo(orderId){
	 lawyerInfoTable.setGridParam({postData:{'orderId':orderId},url:'${contextPath}/sys/lsdOrder/getLawyerInfo',
		 datatype:'json',page:1}).trigger('reloadGrid');  
	// lawyerInfoTable.closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });  
    $("#modal-lawyer-info").modal("toggle");
  }

function editOrder(){
	var orderId = $("#mod-edit-orderId").text();
	var cardAttachId = $("#in-div131-edit").val();
	var loseAttachId = $("#in-div134-edit").val();
	var loseInfo = $("#edit-loseInfo").val();
	var cardInfo = $("#edit-cardInfo").val();
   $.post("${contextPath}/sys/lsdOrder/updateOrder", {
	      'orderId' : orderId,
	      'legalInfo' : $('#mod-legalInfo').val(),
	      'addRemark' : $('#mod-edit-addRemark').val(),
	      'cardInfo' : cardInfo,
	      'loseInfo' : loseInfo,
	      'cardAttachId' : cardAttachId,
	      'loseAttachId' : loseAttachId,
	   }, function(ret) {
	      if (ret.success) {
	         $("#modal-edit-order").modal("toggle");
	         myGrid.trigger("reloadGrid");
	         alert("保存成功！");
	      } else {
	         alert(ret.message);
	      }
	 });
}

function showAttachs(orderId){
    $.post("${contextPath}/sys/lsdOrder/getOrderInfo", {
        'orderId' : orderId
    }, function(ret) {
        if (ret.success) {
            $('#mod-view-orderId-detail').text(orderId);
            //处理附件
              var html100 = '';//律师证
              var html110 = '';//身份证正反面
              var html120 = '';//放款凭证

              var sec = '';
              for ( var m in ret.attas) {
                 var oa = ret.attas[m];
                 if (oa.attachType == 120) {
                    html120 += getImgHtml(oa.path, oa.pathSL);
                 } else if (oa.attachType == 100) {
                 	html100 += getImgHtml(oa.path, oa.pathSL);
                 } else if (oa.attachType == 110) {
                 	html110 += getImgHtml(oa.path, oa.pathSL);
                 } else if (oa.attachType == 121) {
                     //htmlLawyer120 += getImgHtml(oa.path, oa.pathSL);
                     sec += '<div style="text-align:center;display:inline-block;vertical-align:top;">';
                     sec += '<a href="' + oa.path + '">';
                     sec += '<div>下载</div>';
                     sec += '</a><br/>';
                     sec += '</div>&nbsp;';
                 }
              }

              $("#div121").html(sec);
              $('#mo-view-sfz').html(html110);
              $('#mo-view-zyzs').html(html100);
              $('#mo-view-fkpz').html(html120);
            //借款合同
              if(ret.signUrl != null){
                  var htmlLawyer123 = "<a href='" + ret.signUrl + "' style='color:blue;align:left;' target='_blank'>借款协议</a>";
                  $('#mo-view-jkht').html(htmlLawyer123);
              }
            $("#modal-view-order").modal("toggle");
        } else {
            alert("出错了："+ret.message);
        }
    });
}

function showLawyerdetail(orderId){
    $.post("${contextPath}/sys/lsdOrder/getOrderLawyerInfo", {
        'orderId' : orderId
    }, function(ret) {
        if (ret.success) {
            $('#mod-view-orderId').text(orderId);
            $('#lawyer-realName').text(ret.realName);
            $('#lawyer-idCard').text(ret.idCard);
            $('#lawyer-SfzAddress').text(ret.sfzAddress);
            $('#lawyer-Address').text(ret.address);
            $('#lawyer-Email').text(ret.email);
            $('#lawyer-Phone').text(ret.phone);
            $('#lawyer-BankNum').text(ret.bankNum);
            $('#lawyer-BankName').text(ret.bankName);
            $('#lawyer-BankMobile').text(ret.bankMobile);
            $('#lawyer-CertNum').text(ret.certNum);
            $('#lawyer-CertDate').text(ret.certDate);
            $('#lawyer-LawOffice').text(ret.lawOffice);
            $('#lawyer-LawPhone').text(ret.lawPhone);
            $('#lawyer-LawField').text(ret.lawField);
            $('#lawyer-LawAddress').text(ret.lawAddress);
            $('#lawyer-IncomeRange').text(ret.incomeRange);
            $('#lawyer-ColleageName').text(ret.colleageName);
            $('#lawyer-Education').text(ret.education);
            $("#modal-view-lawyer").modal("toggle");
        } else {
            alert(ret.message);
        }
    });
}
function showdetail(orderId) {
   $.post("${contextPath}/sys/lsdOrder/getOrderInfo", {
      'orderId' : orderId
   }, function(ret) {
      if (ret.success) {
          $('#mod-view-orderId-detail').text(orderId);
          $('#view-prodId').text(ret.prodId);
          $('#view-applyPrice').text(ret.applyPrice);
          $('#view-term').text(ret.term);
          $('#view-monthFee').text((ret.monthFee*100).toFixed(2)+'%');
          $('#view-orderUse').text(ret.orderUse);
          $('#view-realPrice').text(ret.realPrice);
          $('#view-dwOperId').text(ret.dwOperId);
          $('#view-dwCheckDate').text(ret.dwCheckDate);
          $('#view-dwCheckInfo').text(ret.dwCheckInfo);
          $('#view-xdPrixce').text(ret.xdPrice);
          $('#view-xdOperId').text(ret.xdOperId);
          $('#view-xdCheckDate').text(ret.xdCheckDate);
          $('#view-xdCheckInfo').text(ret.xdCheckInfo);
         //处理附件
       //   var html100 = '';//律师证
       //   var html110 = '';//身份证正反面
       //   var html120 = '';//放款凭证
       //
       //   var sec = '';
       //   for ( var m in ret.attas) {
       //      var oa = ret.attas[m];
       //      if (oa.attachType == 120) {
       //         html120 += getImgHtml(oa.path, oa.pathSL);
       //      } else if (oa.attachType == 100) {
       //      	html100 += getImgHtml(oa.path, oa.pathSL);
       //      } else if (oa.attachType == 110) {
       //      	html110 += getImgHtml(oa.path, oa.pathSL);
       //      } else if (oa.attachType == 121) {
       //          //htmlLawyer120 += getImgHtml(oa.path, oa.pathSL);
       //          sec += '<div style="text-align:center;display:inline-block;vertical-align:top;">';
       //          sec += '<a href="' + oa.path + '">';
       //          sec += '<div>下载</div>';
       //          sec += '</a><br/>';
       //          sec += '</div>&nbsp;';
       //      }
       //   }
       //
       //   $("#div121").html(sec);
       //   $('#mo-view-sfz').html(html110);
       //   $('#mo-view-zyzs').html(html100);
       //   $('#mo-view-fkpz').html(html120);
       // //借款合同
       //   if(ret.signUrl != null){
       //       var htmlLawyer123 = "<a href='" + ret.signUrl + "' style='color:blue;align:left;' target='_blank'>借款协议</a>";
       //       $('#mo-view-jkht').html(htmlLawyer123);
       //   }
         $("#modal-view-order").modal("toggle");
      } else {
         alert("出错了："+ret.message);
      }
   });
}

function saveToDB(orderId,key,fileName,fileType,divId){
    var attachType = $("#mod-pic-attachType").val();
    var parameters = {"orderId":orderId,"attachType":attachType.substring(0,3),"path":key,"fileName":fileName,"fileType":fileType};
    $.post('${contextPath}/sys/lsdOrder/uploadPic',parameters,function(result){
       if(result.success){
          uploadSuccess(orderId,key,fileName,fileType,result.attathId,divId);
       }else{
    	   alert(result.message);
       }
          
    });
    
  }
  
 function getFileType(fileName){
     var ldot = fileName.lastIndexOf('.')
     if(ldot>=0)
        return fileName.substring(ldot + 1);
     else
        return "";
   }
function getImgHtml(path, pathSL){
    var html = '';
    html +='<a href="' + path + '" target="_blank">';
    html += '<img class="lazy" src="' + pathSL + '" height="100" width="100">';
    html +='</a>&nbsp;';
    return html;
 }
function showEditOrder(orderId) {
	$("#mod-edit-orderId").text(orderId);
   $("#modal-edit-order").modal("toggle");
}

function showOrderLoan(orderId) {
    $("#mod-loan-orderId").text(orderId);
    initDatetimepicker('mod-loan-date');
    $("#modal-order-loan").modal("toggle");
}

function showOrderFinish(orderId) {
    $("#mod-finish-orderId").text(orderId);
    initDatetimepicker('mod-finish-date');
    $("#modal-order-finish").modal("toggle");
}

function initDatetimepicker(id){
    $('#' + id).datetimepicker({
        language: 'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1
    });
}

function showDwCheck(orderId) {
   $.post("${contextPath}/sys/lsdOrder/getOrderInfo", {
      'orderId' : orderId
   }, function(ret) {
      if (ret.success) {
    	  $('#dwCheck-orderId').text(orderId);
          $('#dwCheck-prodId').text(ret.prodId);
          $('#dwCheck-applyPrice').text(ret.applyPrice);
          $('#dwCheck-term').text(ret.term);
          $('#dwCheck-monthFee').text((ret.monthFee*100).toFixed(2)+'%');
          $('#dwCheck-orderUse').text(ret.orderUse);
          $('#dwCheck-realPrice').text(ret.realPrice);
          $('#dwCheck-dwOperId').text(ret.dwOperId);
          $('#dwCheck-dwCheckDate').text(ret.dwCheckDate);
          $('#dwCheck-dwCheckInfo').text(ret.dwCheckInfo);
         // $('#realName').text(ret.order.realName);
         // $('#cardNo').text(ret.order.cardNo);
         // $('#bankAccount').text(ret.order.bankAccount);
         // $('#bankName').text(ret.order.bankName);
         // $('#contackAddress').text(ret.order.contackAddress);
         // $('#bankMobile').text(ret.order.bankMobile);
         // $('#certNum').text(ret.order.certNum);
         // $('#lawyerExp').text(ret.order.lawyerExp+'年');
         // $('#firm').text(ret.order.firm);
         // $('#prodId').text(ret.order.prodId == '0001' ? '先息后本' : '分期还款');
         // $('#applyPrice').text(ret.order.applyPrice+'元');
         // $('#term').text(ret.order.term);
         // $('#monthFee').text((ret.order.monthFee*100).toFixed(2)+'%');
         // $('#city').text(ret.order.city);
         // $('#orderUse').text(ret.order.orderUse);
         // $('#dwCheckInfo').text(ret.order.dwCheckInfo);
         // $('#cardNo').text(ret.order.cardNo);
         // //处理附件
         // var html100 = '';//律师证
         // var html110 = '';//身份证正反面
         // for ( var m in ret.attas) {
         //    var oa = ret.attas[m];
         //    if (oa.attachType == 100) {
         //       html100 += getImgHtml(oa.path, oa.pathSL);
         //    } else if (oa.attachType == 110) {
         //       html110 += getImgHtml(oa.path, oa.pathSL);
         //    }
         // }
         // $('#mo-audit-sfz').html(html110);
         // $('#mo-audit-zyzs').html(html100);
         $("#modal-dwCheck-order").modal("toggle");

      } else {
         alert(ret.message);
      }
   });
}

function preOrder(orderId) {
   if (confirm('请确认是否申请提前还款？确认后无法再修改！')) {
      $.ajax({
         dataType : "json",
         url : "${contextPath}/sys/lsdOrder/preOrder",
         type : "post",
         data : {
            orderId : orderId,
         },
         complete : function(ret) {
            if (ret.success) {
               myGrid.trigger("reloadGrid");
            } else {
               alert(ret.message);
            }
         }
      });
   }
}
function aduitPass(orderId,cardAttachId,loseAttachId) {
   var legalInfo = $("#pass-legalInfo").val();
   var realPrice = $("#pass-realPrice").val();
   var lawyerNo = $("#pass-lawyerNo").val();
   var arith = $("#pass-arith").val();
   var caseNum = $("#pass-caseNum").val();
   var cardInfo = $("#pass-cardInfo").val();
   var loseInfo = $("#pass-loseInfo").val();
   
   if(legalInfo == null){
	   alert('请填写涉讼信息查询结果！');
	   return;
   }
   if(realPrice == null || realPrice == ""){
       alert("审批金额不能为空!")
       return false;
    }else if( realPrice < 5){
       alert("审批金额不能小于5万!")
       return false;
    }else if( realPrice > 50){
       alert("审批金额不能大于50万!")
       return false;
    }
   // if(lawyerNo == null){
	//       alert('请填写执业证号');
	//       return;
	//    }
   $.ajax({
      dataType : "json",
      url : "${contextPath}/sys/lsdOrder/aduitPass",
      type : "post",
      data : {
         orderId : orderId,
         realPrice : realPrice,
         lawyerNo : lawyerNo,
         legalInfo : legalInfo,
         arith : arith,
         caseNum : caseNum,
         cardInfo : cardInfo,
         loseInfo : loseInfo,
         cardAttachId : cardAttachId,
         loseAttachId : loseAttachId,
      },
      complete : function(ret) {
         if (ret.success) {
        	 $("#modal-dwCheck-pass").modal("toggle");
        	 $("#modal-dwCheck-order").modal("toggle");
        	   alert("审批通过成功！");
            myGrid.trigger("reloadGrid");
         } else {
            alert(ret.message);
         }
      }
   });
}
function aduitNopass(orderId) {
   var dwCheckInfo = $("#dwCheck-nopass-info").val();
   if (dwCheckInfo == null || dwCheckInfo == "") {
      alert("请输入审批不通过原因!");
      return false;
   }
   $.ajax({
      dataType : "json",
      url : "${contextPath}/sys/lsdOrder/aduitNopass",
      type : "post",
      data : {
         orderId : orderId,
         dwCheckInfo : dwCheckInfo,
      },
      complete : function(ret) {
         if (ret.success) {
        	   alert("操作成功!");
               $("#modal-dwCheck-nopass").modal("toggle");
        	   $("#modal-dwCheck-order").modal("toggle");
            myGrid.trigger("reloadGrid");
         } else {
            alert(ret.message);
         }
      }
   });
}
</script>
