<%@ 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" style="display: none">
        <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"  selected="selected">已还清</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-outMoney-edit" class="modal fade" tabindex="-1"
     data-backdrop="static">
    <div class="modal-dialog" style="min-width: 600px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header 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-gendan-body">
                <form id="editOrderForm" class="form-horizontal">
                    <input type="hidden" name="orderId" id="lsd_orderId" />
                    <div class="form-group" id="mod-gendan-div">
                        <label class="col-sm-4 control-label">输入结清时间:</label>
                        <div class="col-sm-4 text-left">
                            <input type="text" class="form-control" id="outDate" class="form-control " placeholder="选择结清时间" />
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button id="modal-outMoney-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>

<!-- 详细弹出框（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="order-deatil-modal-label">订单详细信息</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;color: orange;">借款信息</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-productName"></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-loanAmount"></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-loanPeriod"></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-loanPurpose"></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-repaymentMethod"></label>
                    </div>

                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;color: orange;">律师基本信息</div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-realPrice-div">
                        <label class="col-sm-3 control-label">姓名:</label> <label
                            class="control-label" id="view-realName"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-phone-div">
                        <label class="col-sm-3 control-label">注册手机号:</label>
                        <label class="control-label" id="view-phone"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-colleageName-div">
                        <label class="col-sm-3 control-label">毕业院校:</label> <label
                            class="control-label" id="view-colleageName"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-education-div">
                        <label class="col-sm-3 control-label">最高学历:</label>
                        <label class="control-label" id="view-education"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-incomeRange-div">
                        <label class="col-sm-3 control-label">年收入:</label>
                        <label class="control-label" id="view-incomeRange"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-email-div">
                        <label class="col-sm-3 control-label">电子邮箱:</label>
                        <label class="control-label" id="view-email"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-dwCheckInfo-div">
                        <label class="col-sm-3 control-label">居所通讯地址:</label>
                        <label class="control-label" id="view-address"></label>
                    </div>

                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;color: orange;">银行卡信息</div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-bank-regist-name-div">
                        <label class="col-sm-3 control-label">开户名:</label> <label
                            class="control-label" id="view-bank-regist-name"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-idCard-div">
                        <label class="col-sm-3 control-label">身份证号:</label> <label
                            class="control-label" id="view-idCard"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-bankName-div">
                        <label class="col-sm-3 control-label">开户行:</label> <label
                            class="control-label" id="view-bankName"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-bankNum-div">
                        <label class="col-sm-3 control-label">账号:</label>
                        <label class="control-label" id="view-bankNum"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-bankMobile-div">
                        <label class="col-sm-3 control-label">银行预留手机号:</label>
                        <label class="control-label" id="view-bankMobile"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-verification-div">
                        <label class="col-sm-3 control-label">校验结果:</label>
                        <label class="control-label" id="view-verification"></label>
                    </div>

                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;color: orange;">律所信息</div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-lawOffice-div">
                        <label class="col-sm-3 control-label">律所名称:</label>
                        <label class="control-label" id="view-lawOffice"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-lawAddress-div">
                        <label class="col-sm-3 control-label">律所通讯地址:</label>
                        <label class="control-label" id="view-lawAddress"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-lawPhone-div">
                        <label class="col-sm-3 control-label">律所电话:</label>
                        <label class="control-label" id="view-lawPhone"></label>
                    </div>

                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;color: orange;">身份证及职业证</div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-attach-type-110-div">
                        <label class="col-sm-3 control-label">身份证正反面照片:</label>
                        <div id="div-attach-type-110" class="checkbox-inline"></div>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-sfzAddress-div">
                        <label class="col-sm-3 control-label">身份证地址:</label>
                        <label class="control-label" id="view-sfzAddress"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-attach-type-100-div">
                        <label class="col-sm-3 control-label">执业证首页及最近一次年审照片:</label>
                        <div id="div-attach-type-100" class="checkbox-inline"></div>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-certDate-div">
                        <label class="col-sm-3 control-label">执业证有效期至:</label>
                        <label class="control-label" id="view-certDate"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-certNum-div">
                        <label class="col-sm-3 control-label">执业证号:</label>
                        <label class="control-label" id="view-certNum"></label>
                    </div>

                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;color: orange;">婚姻信息</div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-maritalStatus-div">
                        <label class="col-sm-3 control-label">婚姻状况:</label>
                        <label class="control-label" id="view-maritalStatus"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-familyMemName-div">
                        <label class="col-sm-3 control-label">直系亲属姓名:</label>
                        <label class="control-label" id="view-familyMemName"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-familyMemRel-div">
                        <label class="col-sm-3 control-label">亲属之间关系:</label>
                        <label class="control-label" id="view-familyMemRel"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-familyMemPhone-div">
                        <label class="col-sm-3 control-label">直系亲属电话:</label>
                        <label class="control-label" id="view-familyMemPhone"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-familyMemAdr-div">
                        <label class="col-sm-3 control-label">直系亲属地址:</label>
                        <label class="control-label" id="view-familyMemAdr"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-mateName-div">
                        <label class="col-sm-3 control-label">配偶姓名:</label>
                        <label class="control-label" id="view-mateName"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-matePhone-div">
                        <label class="col-sm-3 control-label">配偶电话:</label>
                        <label class="control-label" id="view-matePhone"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-attach-type-118-div">
                        <label class="col-sm-3 control-label">配偶身份证:</label>
                        <div id="div-attach-type-118" class="checkbox-inline"></div>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-attach-type-119-div">
                        <label class="col-sm-3 control-label">结婚证:</label>
                        <div id="div-attach-type-119" class="checkbox-inline"></div>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-attach-type-117-div">
                        <label class="col-sm-3 control-label">离婚证或离婚协议:</label>
                        <div id="div-attach-type-117" class="checkbox-inline"></div>
                    </div>

                    <div class="col-sm-12 text-left " style="margin-bottom: 15px;color: orange;">征信报告信息</div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-attach-type-112-div">
                        <label class="col-sm-3 control-label">征信报告照片:</label>
                        <div id="div-attach-type-112" class="checkbox-inline"></div>
                    </div>
                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;">其它信息</div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-attach-type-114-div">
                        <label class="col-sm-3 control-label">社保或公积金半年交纳截图:</label>
                        <div id="div-attach-type-114" class="checkbox-inline"></div>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-attach-type-116-div">
                        <label class="col-sm-3 control-label">房产证或车辆登记证照片:</label>
                        <div id="div-attach-type-116" class="checkbox-inline"></div>
                    </div>

                    <div class="col-sm-12 text-left" style="margin-bottom: 15px;color: orange;">时间</div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-createDate-div">
                        <label class="col-sm-3 control-label">提交时间:</label>
                        <label class="control-label" id="view-createDate"></label>
                    </div>
                    <div class="form-group col-sm-12 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 col-sm-12 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 col-sm-12 text-left" id="mod-audit-loanDate-div">
                        <label class="col-sm-3 control-label">放款时间:</label>
                        <label class="control-label" id="view-loanDate"></label>
                    </div>
                    <div class="form-group col-sm-12 text-left" id="mod-audit-finishDate-div">
                        <label class="col-sm-3 control-label">结清时间:</label>
                        <label class="control-label" id="view-finishDate"></label>
                    </div>

                    <div>
                        <div class="col-sm-12 text-left" style="margin-bottom: 15px;color: orange;">案例信息</div>
                    </div>
                    <table class="table" id="caseTable">
                        <thead>
                        <tr class="success">
                            <td width="25%">序号</td>
                            <td width="25%">案例类型</td>
                            <td width="25%">案例数</td>
                            <td width="25%">操作类型</td>
                        </tr>
                        </thead>
                        <tbody id="lawyerCaseList">
                        </tbody>
                    </table>
                </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-lawyer-case-detail" class="modal fade" tabindex="-2" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 400px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="modal-body" id="lawyer-case-detail-div">
                    <div>
                        <div class="col-sm-12 text-left" style="margin-bottom: 15px;color: orangered;">案例分类详情页</div>
                    </div>
                    <table class="table" id="lawyer-case-detail-table">
                        <thead>
                        <tr class="success">
                            <td width="10%">序号</td>
                            <td width="20%">类型</td>
                            <td width="60%">标题</td>
                            <td width="10%">操作</td>
                        </tr>
                        </thead>
                        <tbody id="lawyer-case-detail-tbody"/>
                    </table>
                </div>
            </div>
        </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="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="picUpload();">上传</button>
                                <button type="reset" class="btn btn-sm">清除</button>
                            </div>
                        </form>
                    </div><!-- /.col -->
                </div><!-- /.row -->

            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<%@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 lawyerCaseSnapshotBeanList = null;
    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=8",
        "${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",
                postData: {
                    'orderState': $("#orderState").val()
                },
                height: "auto",
                mtype: 'POST',
                align: "center",
                colNames: ["申请时间", "借款编号", "律师姓名", "手机号", "借款产品", "借款金额", "初审额度","放款金额", "借款期限", "月利率", "还款方式","结清时间", "备注", "查看"],
                colModel: [{
                    name: 'createDate',
                    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: '手机号',
                    width: 100,
                    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: 'realPrice',
                    index: 'realPrice',
                    label: '初审额度',
                    align: "right",
                    width: 60,
                    editable: false,
                },{
                    name: 'xdPrice',
                    index: 'xdPrice',
                    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: 'finishDate',
                    index: 'finishDate',
                    label: '结清时间',
                    width: 80,
                    align: "center",
                    editable: false,
                    formatter: formatCreateDate
                }, {
                    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
                }],
                //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);
                },
            });

            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 formatProdId(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>";
                var template = "";
                template += "<a href='home#page/detailTrial?orderId=" + cell.orderId + "'><button data-toggle='modal' class='btn btn-minier'><i class='ace-icon fa fa-hdd-o '></i>查看详情</button></a>";

                return template;
            }

            function optionFormatter(cellvalue, options, cell) {
                var template = '';
                template += "<button data-toggle='modal' class='btn btn-minier' onclick='outMoneyDetail(\""+cell.orderId+"\")'><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"
            });
        });
    });

    //结束加载

    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 formatDate(d) {
        var result = "";
        if (d > 9) {
            result = d.toString();
        } else {
            result = '0' + d.toString();
        }
        return result;
    }

    function format_date(cellvalue) {
        var result = "";
        if (cellvalue != null && 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;
    }

    $("#modal-outMoney-submit").click(function () {
        var orderId = $("#lsd_orderId").val();
        var outDate = $("#outDate").val();

        $.ajax({
            dataType : "json",
            url : "${contextPath}/sys/lsdOrder/saveSettleMoneyInfo",
            type : "post",
            data : {
                'orderId' : orderId,
                'outDate' : outDate
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                if (ret.success) {
                    alert('保存成功');
                    myGrid.trigger("reloadGrid");
                    $("#modal-outMoney-edit").modal("toggle");
                } else {
                    alert(ret.message);
                }
            }
        });
    });

    function outMoneyDetail(orderId) {
        initDatetimepicker('outDate');
        $("#lsd_orderId").val(orderId);
        $("#modal-outMoney-edit").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 disp_confirm(orderId) {
        var r = confirm("确定取消订单？")
        if (r==true) {
            cancelOrder(orderId);
        }
    }

    function cancelOrder(orderId) {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/sys/lsdOrder/cancelOrder",
            type : "post",
            data : {
                'orderId' : orderId
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                if (ret.success) {
                    alert('取消成功');
                    myGrid.trigger("reloadGrid");
                } else {
                    alert(ret.message);
                }
            }
        });
    }

    function showCaseDetail(index) {
        if (lawyerCaseSnapshotBeanList) {
            var bean = lawyerCaseSnapshotBeanList[index]

            var index = 0;
            var sub_html = "";
            for (var i=0;i<bean.lawyercaseWebSiteBeans.length;i++){
                var v = bean.lawyercaseWebSiteBeans[i];
                index += 1;
                sub_html += "                    <tr>\n" +
                    "                                <td>" + index + "</td>\n" +
                    "                                <td>" + bean.caseTypeDesc + "</td>\n" +
                    "                                <td>" + v.title + "</td>\n" +
                    "                                <td><a href='" + v.url + "' target='_blank'>查看</a></td>\n" +
                    "                            </tr>"
            }
            ;
            $("#lawyer-case-detail-tbody").html(sub_html);
            $("#modal-view-lawyer-case-detail").modal("toggle");
        }
    }

    function showdetail(orderId) {
        $.post("${contextPath}/sys/lsdOrderReport/firstTrialDetail", {
                'orderId': orderId
            }, function (ret) {
                console.info(ret)
                if (ret.success) {
                    $('#mod-view-orderId-detail').text(orderId);
                    // 借款信息
                    $('#view-productName').text(ret.loanInfoBean.productName);
                    $('#view-loanAmount').text(ret.loanInfoBean.loanAmount);
                    $('#view-loanPeriod').text(ret.loanInfoBean.loanPeriod);
                    $('#view-loanPurpose').text(ret.loanInfoBean.loanPurpose);
                    $('#view-repaymentMethod').text(ret.loanInfoBean.repaymentMethod);
                    // 律师基本信息
                    $('#view-realName').text(ret.lawyerBasicInfoBean.realName);
                    $('#view-phone').text(ret.lawyerBasicInfoBean.phone);
                    $('#view-colleageName').text(ret.lawyerBasicInfoBean.colleageName);
                    $('#view-education').text(ret.lawyerBasicInfoBean.education);
                    $('#view-incomeRange').text(ret.lawyerBasicInfoBean.incomeRange);
                    $('#view-email').text(ret.lawyerBasicInfoBean.email);
                    $('#view-address').text(ret.lawyerBasicInfoBean.address);
                    // 银行卡信息
                    $('#view-bank-regist-name').text(ret.lawyerBasicInfoBean.realName);
                    $('#view-idCard').text(ret.lawyerBasicInfoBean.idCard);
                    $('#view-bankName').text(ret.lawyerBasicInfoBean.bankName);
                    $('#view-bankNum').text(ret.lawyerBasicInfoBean.bankNum);
                    $('#view-bankMobile').text(ret.lawyerBasicInfoBean.bankMobile);
                    $('#view-verification').text('四元素校验成功，结果由阿里云计算提供！');
                    // 律所信息
                    $('#view-lawOffice').text(ret.lawyerBasicInfoBean.lawOffice);
                    $('#view-lawAddress').text(ret.lawyerBasicInfoBean.lawAddress);
                    $('#view-lawPhone').text(ret.lawyerBasicInfoBean.lawPhone);
                    // 身份证及执业证
                    $('#view-sfzAddress').text(ret.lawyerBasicInfoBean.sfzAddress);
                    $('#view-certDate').text(ret.lawyerBasicInfoBean.certDate);
                    $('#view-certNum').text(ret.lawyerBasicInfoBean.certNum);
                    // 婚姻信息
                    $('#view-maritalStatus').text(ret.lawyerBasicInfoBean.maritalStatus);
                    $('#view-familyMemName').text(ret.lawyerBasicInfoBean.familyMemName);
                    $('#view-familyMemRel').text(ret.lawyerBasicInfoBean.familyMemRel);
                    $('#view-familyMemPhone').text(ret.lawyerBasicInfoBean.familyMemPhone);
                    $('#view-familyMemAdr').text(ret.lawyerBasicInfoBean.familyMemAdr);
                    $('#view-mateName').text(ret.lawyerBasicInfoBean.mateName);
                    $('#view-matePhone').text(ret.lawyerBasicInfoBean.matePhone);
                    viewDeal(ret.lawyerBasicInfoBean.maritalStatus);

                    // 时间
                    $('#view-createDate').text(format_date(ret.lawyerBasicInfoBean.createDate));
                    $('#view-dwCheckDate').text(format_date(ret.lawyerBasicInfoBean.dwCheckDate));
                    $('#view-xdCheckDate').text(format_date(ret.lawyerBasicInfoBean.xdCheckDate));
                    lawyerCaseSnapshotBeanList = ret.lawyerCaseSnapshotBeanList;
                    // 案例信息填充
                    var index = 0;
                    var sub_html = "";
                    for (var i in ret.lawyerCaseSnapshotBeanList) {
                        var v = ret.lawyerCaseSnapshotBeanList[i];
                        index += 1;
                        sub_html += "                    <tr>\n" +
                            "                                <td>" + index + "</td>\n" +
                            "                                <td>" + v.caseTypeDesc + "</td>\n" +
                            "                                <td>" + v.caseNum + "</td>\n" +
                            "                                <td>" + "<input id='openCaseBtn' class='movingup' type='button' value='查看' onclick='showCaseDetail(" + i + ");'>" + " </td>\n" +
                            "                            </tr>"
                    }
                    $('#lawyerCaseList').html(sub_html);
                    var url = '${oss_bucket_b_url}';
                    var thum = '${oss_bucket_b_url_img}';
                    var size = '${oss_bucket_b_url_img_size}';
                    var v = null;
                    var sep = "/";
                    var attachTypeArray = ['100', '110', '112', '114', '116', '117', '118', '119',];
                    for (var attachType in attachTypeArray) {
                        $("#div-attach-type-" + attachTypeArray[attachType]).html("");
                    }
                    for (var i in ret.attachBeanList) {
                        v = ret.attachBeanList[i];
                        var absolutePath = url + v.path;
                        if (v.path.indexOf("/") != 0 || v.path.indexOf("\\") != 0) {
                            absolutePath = url + sep + v.path;
                        }
                        var sec = ""
                        sec += '<div style="text-align:center;display:inline-block;vertical-align:top;" id="picDiv' + v.id + '">';
                        sec += '<a href="' + absolutePath + '" target="_blank">';
                        sec += '<img class="lazy" src="${contextPath}/static/img/loading.gif" data-original="' + absolutePath + '" height="100" width="100" id="' + v.id + '"/>';
                        sec += '</a>';
                        sec += '</div>&nbsp;';
                        $("#div-attach-type-" + v.attachType).html($("#div-attach-type-" + v.attachType).html() + sec);
                    }
                    setTimeout(function () {
                        $("img.lazy").lazyload({
                            threshold: 200
                        });
                    }, 200);
                    $("#modal-view-order").modal("toggle");
                }
                else {
                    alert(ret.message);
                }
            }
        )
        ;
    }

    function viewDeal(maritalStatus) {
        $("#mod-audit-familyMemName-div").hide();
        $("#mod-audit-familyMemRel-div").hide();
        $("#mod-audit-familyMemPhone-div").hide();
        $("#mod-audit-familyMemAdr-div").hide();
        $("#mod-audit-mateName-div").hide();
        $("#mod-audit-matePhone-div").hide();
        $("#mod-audit-attach-type-118-div").hide();
        $("#mod-audit-attach-type-119-div").hide();
        $("#mod-audit-attach-type-117-div").hide();
        switch (maritalStatus) {
            case "未婚":
                $("#mod-audit-familyMemName-div").show();
                $("#mod-audit-familyMemRel-div").show();
                $("#mod-audit-familyMemPhone-div").show();
                $("#mod-audit-familyMemAdr-div").show();
                break;
            case "已婚":
                $("#mod-audit-mateName-div").show();
                $("#mod-audit-matePhone-div").show();
                $("#mod-audit-attach-type-118-div").show();
                $("#mod-audit-attach-type-119-div").show();
            case "离异":
                $("#mod-audit-familyMemName-div").show();
                $("#mod-audit-familyMemRel-div").show();
                $("#mod-audit-familyMemPhone-div").show();
                $("#mod-audit-familyMemAdr-div").show();
                $("#mod-audit-attach-type-117-div").show();
                break;
            case "丧偶":
                $("#mod-audit-familyMemName-div").show();
                $("#mod-audit-familyMemRel-div").show();
                $("#mod-audit-familyMemPhone-div").show();
                $("#mod-audit-familyMemAdr-div").show();
                break;
            default:
                break;
        }
    }

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

</script>
