<%@ 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/ui.jqgrid.css" />
<style>
    .title-t{
        width:1290px;
        height:44px;
        background:rgba(188,224,255,1);
    }
    .title-p{
        width:500px;
        height:20px;
        font-size:14px;
        font-weight:bold;
        color:rgba(102,102,102,1);
        line-height:40px;
        position: absolute;
        left: 40px;
    }
    #id{
        width:500px;
        height:18px;
        font-size:13px;
        font-weight:500;
        color:rgba(102,102,102,1);
        line-height:18px;
        position: relative;
        left: 20px;
        top: 15px;
    }
    #orderType{
        width:150px;
        height:18px;
        font-size:13px;
        font-weight:500;
        color:rgba(240,85,85,1);
        line-height:18px;
        position: relative;
        left: 20px;
        top: 30px;
    }
    .div-1{
        border: 1px #E1E1E1 solid;
    }
    .name{
        width:52px;
        height:18px;
        font-size:13px;
        font-weight:500;
        color:rgba(102,102,102,1);
        line-height:18px;
        position: relative;
        left: 20px;
        top: 45px;
    }
    #adsLawsuit-name{
        position: relative;
        left: 108px;
        top: 25px;
    }
    .orderSource{
        width:52px;
        height:18px;
        font-size:13px;
        font-weight:500;
        color:rgba(102,102,102,1);
        line-height:18px;
        position: relative;
        left: 343px;
        top: -6px;
    }
    #adsLawsuit-orderSource{
        position: relative;
        left: 100px;
        top: -20px;
        width: 85px;
        height: 30px;
        border-radius: 5px;

    }
    .phone{
        position: relative;
        left: 20px;
        top: 10px;
    }
    #adsLawsuit-phone{
        position: relative;
        left: 45px;
        /*top: 10px;*/
    }
    .caseType{
        width:52px;
        height:18px;
        font-size:13px;
        font-weight:500;
        color:rgba(102,102,102,1);
        line-height:18px;
        position: relative;
        left: 343px;
        top: -15px;
    }
    #adsLawsuit-caseType{
        position: relative;
        left: 100px;
        top: -20px;
        width: 85px;
        height: 30px;
        border-radius: 5px;
    }
    .proAndCity{
        position: relative;
        left: 20px;
        top: 5px;
    }
    #adsLawsuit-pro{
        position: relative;
        left: 18px;
        width:80px;
        height:30px;
        border-radius:5px;
    }
    #adsLawsuit-city{
        position: relative;
        left: 20px;
        width:80px;
        height:30px;
        border-radius:5px;
    }
    .property{
        position: relative;
        left: 343px;
        top: -25px;

    }
    #adsLawsuit-property{
        width: 85px;
        height: 30px;
        border-radius: 5px;
        position: relative;
        left: 20px;
    }
    .ygProAndCity{
        position: relative;
        left: 20px;
        top: -10px;
    }
    #adsLawsuit-ygPro{
        position: relative;
        left: 18px;
        width:80px;
        height:30px;
        border-radius:5px;
    }
    #adsLawsuit-ygCity{
        position: relative;
        left: 20px;
        width:80px;
        height:30px;
        border-radius:5px;
    }
    .targetAmount{
        position: relative;
        left: 20px;
        top: -10px;
    }
    #adsLawsuit-targetAmount{
        width:120px;
        height:30px;
        position: relative;
        left: 45px;
    }
    /*  .bgProAndCity{
          position: relative;
          left: 20px;
          top: -25px;
      }*/
    #adsLawsuit-bgPro{
        position: relative;
        left: 18px;
        width:80px;
        height:30px;
        border-radius:5px;
    }
    #adsLawsuit-bgCity{
        position: relative;
        left: 20px;
        width:80px;
        height:30px;
        border-radius:5px;
    }
    .agentType{
        position: relative;
        left: 343px;
        top: -40px;
    }
    #adsLawsuit-agentType{
        width: 110px;
        height: 30px;
        border-radius: 5px;
        position: relative;
        left: 45px;
    }
    .lawTime{
        position: relative;
        left: 20px;
        top: -35px;
    }
    .fee{
        position: absolute;
        left: 40px;
        top: 310px;
    }
    .ffee{
        position: relative;
        left: 100px;
        top: -25px;
    }
    #adsLawsuit-frontCost{
        width: 65px;
        height: 30px;
        position: relative;
        left: 10px;
    }
    #adsLawsuit-targetAmountPc{
        width: 65px;
        height: 30px;
        position: relative;
        left: 10px;
    }
    .txt{
        position: relative;
        left: 20px;
        top: 10px;
    }
    #adsLawsuit-txt{
        position: relative;
        left: 20px;
        top: 20px;
        background:rgba(248,248,248,1);
        border:1px solid rgba(225,225,225,1);
    }
    .pic{
        position: relative;
        left: 20px;
        top: 20px;
    }
    .ads-btn{
        width: 500px;
        height: 30px;
        margin: 50px 20px;
        position: relative;
        top: 30px;
    }
    /* #adsLawsuit-lawTime{
         position: relative;
         left: 50px;
         top: -20px;
     }*/
    .ddd{
        position: relative;
        left: 20px;
    }
    .div-2{
        border: 1px #E1E1E1 solid;
    }
    .div-3{
        position: relative;
        top: 50px;
        border: 1px #E1E1E1 solid;
        margin: 20px 0;
    }
    #adsLawsuit-pic{
        position: relative;
        left: 20px;
        top: 40px;
    }
    .xy-btn{
        width:200px;
        height:40px;
    }
    .aaa{
        position: relative;
        left: 20px;
        top: 20px;
    }
    #xy-btnn{
        position: relative;
        top: 20px;
        margin: 20px 0;
    }
    #ja-btn{
        position: relative;
        top: 20px;
        margin: 20px 0;
    }
    .xy-tltle{
        position: relative;
        top: 20px;
    }
    #xy-pic{
        margin: 20px 0;
    }
    #ja-pic{
        margin: 20px 0;
    }
    .ja-str{
        margin: 20px 0;
    }
    .ja-aa{
        position: relative;
        left: 20px;
    }
    .gdUser{
        position: relative;
        left: 20px;
        top: 30px;
    }
    .update-remark{
        position: relative;
        left: 20px;
        top: 50px;
        margin: 30px 0;
    }
    .follow{
        position: relative;
        left: 20px;
        top: 60px;
        margin: 30px 0;
    }
    #updateRemark{
        color:rgba(136,136,136,1);
        /*width: 350px;*/
    }
    #follow{
        color:rgba(136,136,136,1);
    }
    .cz-btn{
        position: relative;
        left: 20px;
        top: 50px;
        margin: 20px 0;
    }
</style>
<html>
<title><span id="title"></span></title>

<div class="div-1">
    <div class="title-t">
        <div  class="title-p">基本信息</div>
    </div>
    <div id="id">订单号：</div>
    <div id="orderType">案件状态</div>
    <div>
        <div class="name">用户名</div>
        <input type="text" id="adsLawsuit-name"/>
        <div class="orderSource">
            案件来源
            <select id="adsLawsuit-orderSource">
                <option value="-1">请选择</option>
                <option value="1">法律咨询</option>
                <option value="0">免费打官司</option>
            </select>
        </div>
        <div class="phone">
            手机号
            <input type="text" id="adsLawsuit-phone"/>
        </div>
        <div class="caseType">
            案件类型
            <select id="adsLawsuit-caseType">
                <option value="0">请选择</option>
            </select>
        </div>

        <div class="proAndCity">
            起诉地级市
            <select id="adsLawsuit-pro" onchange="getCity(1,0)">
            </select>
            <select id="adsLawsuit-city">
            </select>
        </div>
        <div class="property">
            是否涉及财产
            <select id="adsLawsuit-property" onchange="updateTargent()">
                <option  value="-1">请选择</option>
                <option value="1">是</option>
                <option value="0">否</option>
            </select>
        </div>

        <%--<div class="ygProAndCity">
            原告地级市
            <select id="adsLawsuit-ygPro" onchange="getCity(2,0)">
            </select>
            <select id="adsLawsuit-ygCity">
            </select>
        </div>--%>
        <div class="targetAmount">
            标的额
            <input type="text" id="adsLawsuit-targetAmount" />
        </div>
        <%--<div class="bgProAndCity">
            被告地级市
            <select id="adsLawsuit-bgPro" onchange="getCity(3,0)">
            </select>
            <select id="adsLawsuit-bgCity">
            </select>
        </div>--%>
        <div class="agentType">
            代理方式
            <select id="adsLawsuit-agentType" onchange="updateAgent()">
                <option value="-1">请选择</option>
                <option value="0">固定收费</option>
                <option value="1">全风险代理</option>
                <option value="2">半风险代理</option>
            </select>
        </div>
        <%--<div class="lawTime">
            面谈时间
            <div  id="adsLawsuit-lawTime">
                <div class="form-group" style="margin-left: 30px;" id="modal-time-lawTime">
                </div>
                <div class="form-group" style="margin-left: 30px;">
                    <input type="text" class="input-sm" placeholder="点击选择" id="ads-lawTime"/>
                    <button class="btn btn-sm " onclick="addTime()" >
                        确认添加
                    </button>
                </div>
            </div>
        </div>--%>
        <div class="fee">
            律师费
            <div class="ffee" id="ffeee">

            </div>
        </div>

        <div class="txt">
            案件描述
        </div>
        <textarea id="adsLawsuit-txt"  rows="6" cols="100"></textarea>

        <div class="pic">
            图片资料
        </div>
        <div id="adsLawsuit-pic"></div>
        <div class="ads-btn bbttnn">
            <button id="ads-button" onclick="editOrder()"  class="btn btn-sm btn-primary xy-btn">保存</button>
        </div>
    </div>
</div>
<br>
<br>
<div class="div-2">
    <div class="title-t">
        <div  class="title-p">投标律师</div>
    </div>
    <br>
    <br>
    <div class="row ddd">
        <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 -->
    <br>
    <br>
</div>

<div class="div-3">
    <div class="title-t">
        <div  class="title-p">委托协议<span id="xy-progressStr" style="color: red ;font-size: 13px;"></span></div>
    </div>
    <div class="aaa">
        <div class="title-l">
            <span id="xy-createDate">提交时间</span>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <span id="xy-lawyer">提交律师</span>
            <input hidden = hidden id="xy-biddId">
        </div>
        <div class="xy-tltle">
            委托协议
            <div id="xy-pic"></div>
        </div>

        <div id="xy-btnn" class="bbttnn">

        </div>

    </div>
    <br>
    <br>
</div>

<div class="div-3">
    <div class="title-t">
        <div  class="title-p">案件结果<span id="ja-progressStr" style="color: red;font-size: 13px;"></span></div>
    </div>
    <div class="aaa">
        <div class="title-l">
            <span id="ja-createDate">提交时间</span>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <span id="ja-lawyer">提交律师</span>
            <input hidden = hidden id="ja-biddId">
        </div>
        <div class="xy-tltle">
            判决书
            <div id="ja-pic"></div>
        </div>
        <div class="ja-str">
            <p>代理方式&nbsp;&nbsp;&nbsp;&nbsp;<span id="ja-agentType" class="ja-aa"></span></p>
            <p>结案结果&nbsp;&nbsp;&nbsp;&nbsp;<span id="ja-isVictory" class="ja-aa"></span></p>
            <p>执行回款&nbsp;&nbsp;&nbsp;&nbsp;<input class="ja-aa" type="text" id="ja-moneyBack" value="0"/></p>
            <p>后期律师费<input class="ja-aa" type="text" id="ja-afterCost" value="0"/></p>
        </div>
        <div id="ja-btn" class="bbttnn">

        </div>
    </div>
    <br>
    <br>
</div>

<div class="div-3">
    <div class="title-t">
        <div  class="title-p">服务费支付<span id="fwf-progressStr" style="color: red;font-size: 13px;"></span></div>
    </div>
    <div class="fwf aaa">
        <p id="fwf-agentType">代理方式：</p>
        <p id="fwf-frontCost">前期律师费：</p>
        <p id="fwf-frontFreePc">平台前期平台佣金：</p>
        <p id="fwf-afterCost">后期律师费：</p>
        <p id="fwf-afterFreePc">平台后期平台佣金：</p>
    </div>
    <br>
    <br>
</div>
<div class="div-3">
    <div class="title-t">
        <div  class="title-p">跟单人员操作</div>
    </div>
    <div class="gdUser">
        <p id="userSer"></p>
        <p id="lawyerSer"></p>
    </div>
    <div class="cz-btn bbttnn" id="btnnn">
        <button class="btn btn-sm btn-info xy-btn" onclick='pulishOrder()' >发布案件</button>
        <button class="btn btn-sm btn-grey xy-btn" onclick='setDeferred()' >延期联系</button>
        <button class="btn btn-sm btn-grey xy-btn" onclick='quitOrder()' >案件取消</button>
        <button class="btn btn-sm btn-grey xy-btn" onclick='showFollow()' >跟进记录</button>
    </div>
    <div class="update-remark">
        <span style="font-size: 18px">操作记录</span>
        <div id="updateRemark">

        </div>
    </div>

    <div class="follow">
        <span style="font-size: 18px">跟进记录</span>
        <div id="follow">

        </div>
    </div>
    <br>
    <br>
</div>

<div id="modal-remark-body" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog">
        <form id="checkForm">
            <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" style="overflow-y: scroll;">
                    <div id="mod-edit-tip" class="red clearfix"></div>
                    <input type="hidden" id="modal-biddId" value="">
                    <div class="form-group" style="margin-left: 30px;">
                        <select id="updateBiddType">
                            <option value="1">洽谈中</option>
                            <option value="2">放弃合作</option>
                            <option value="3">待上传委托协议</option>
                        </select>
                    </div>
                </div>
                <div class="modal-footer no-margin-top">
                    <div class="text-center">
                        <button id="mod-check-success" type="button" class="btn btn-sm btn-primary"
                                onclick="updateBiddOrder();">
                            确定
                        </button>
                        <button class="btn btn-sm" data-dismiss="modal">
                            取消
                        </button>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </form>
    </div><!-- /.modal-dialog -->
</div>

<div id="modal-setDeferred-body" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog">
        <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" style="overflow-y: scroll;">
                <div id="mod-setDeferred-tip" class="red clearfix"></div>
                <div class="form-group" style="margin-left: 30px;">
                    <input type="text" class="input-sm" placeholder="点击选择" id="ads-setDeferred"/>
                </div>
                <div class="form-group" style="margin-left: 30px;">
                    <select id="deferred">
                        <option value="致电2-3次用户未接通">致电2-3次用户未接通</option>
                        <option value="考虑中">考虑中</option>
                    </select>
                </div>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button id="mod-setDeferred-success" type="button" class="btn btn-sm btn-primary"
                            onclick="setDefDate();">
                        确定延期
                    </button>
                    <button class="btn btn-sm" data-dismiss="modal">
                        取消
                    </button>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>

<div id="modal-quit-body" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog">
        <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" style="overflow-y: scroll;">
                <div id="mod-quit-tip" class="red clearfix"></div>
                <input type="hidden" id="quit-biddId" value="">
                <div class="form-group" style="margin-left: 30px;">
                    <select id="quit">
                        <option value="案件不符合起诉条件">案件不符合起诉条件</option>
                        <option value="无法联系上当事人">无法联系上当事人</option>
                        <option value="当事人无起诉意愿">当事人无起诉意愿</option>
                        <option value="当事人不同意收费">当事人不同意收费</option>
                        <option value="律师操作失误">律师操作失误</option>
                        <option value="其他">其他</option>
                    </select>
                </div>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button id="mod-quit-success" type="button" class="btn btn-sm btn-primary"
                            onclick="toSetQuit();">
                        确定
                    </button>
                    <button class="btn btn-sm" data-dismiss="modal">
                        取消
                    </button>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>

<div id="modal-followShow-body" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog">
        <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" style="overflow-y: scroll;">
                <div id="mod-followShow-tip" class="red clearfix"></div>
                <input type="hidden" id="followShow-biddId" value="">
                <div class="form-group" style="margin-left: 30px;">
                    <textarea cols="45" rows="2" id="content" placeholder="请输入跟进记录"></textarea>
                </div>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button id="mod-followShow-success" type="button" class="btn btn-sm btn-primary"
                            onclick="saveFollow();">
                        确定
                    </button>
                    <button class="btn btn-sm" data-dismiss="modal">
                        取消
                    </button>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>


<%--修改中标律师--%>
<div id="modal-updateBidd-body" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog">
        <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" style="overflow-y: scroll;">
                <input type="hidden" id="updateBiddId">
                <div id="mod-lawyer-tip" class="red clearfix"></div>
                <div class="form-group" style="margin-left: 30px;">
                    请选择：<select id="lawyer">
                    </select>
                </div>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button id="mod-updateBidd-success" type="button" class="btn btn-sm btn-primary"
                            onclick="updateBidd();">
                        确定
                    </button>
                    <button class="btn btn-sm" data-dismiss="modal">
                        取消
                    </button>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>


<div id="modal-shenHeNoPass-body" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog">
        <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" style="overflow-y: scroll;">
                <div id="mod-shenHeNoPass-tip" class="red clearfix"></div>
                <input type="hidden" id="shenHeNoPass-biddId" value="">
                <div class="form-group" style="margin-left: 30px;">
                    <select id="shenHeNoPass">
                        <option value="上传样式错误">上传样式错误</option>
                    </select>
                </div>
            </div>
            <div class="modal-footer no-margin-top">
                <div class="text-center">
                    <button id="mod-shenHeNoPass-success" type="button" class="btn btn-sm btn-primary"
                            onclick="toSetshenHeNoPass();">
                        确定
                    </button>
                    <button class="btn btn-sm" data-dismiss="modal">
                        取消
                    </button>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>

</html>


<script type="text/javascript">
    console.log(window.location.href);//打开页面的时候传的地址
    var str = window.location.href;
    let list =  str.split('?');//用刚刚传递地址里面的“？”把传过来的东西劈开
    var a = decodeURI(list[1]);//订单号
    var b = decodeURI(list[2]);//案件状态
    var c = decodeURI(list[3]);//用户
    var d = decodeURI(list[4]);//手机
    $("#id").html("订单单号："+a);
    $("#title").html(c+" "+ d);

    function start() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getShowType",
            type : "post",
            data : {
                'lawsuitId' : a,
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                $("#orderType").html("案件状态："+ret.state);
                getProvince();
                /*getProvince(2);
                getProvince(3);*/
                getCaseType();
                setTimeout(function () {
                    showedit(a);
                }, 300);
                showPic();
                getgdUser();
                getUpdateRemark();
                getfollow();
                if (ret.state === "待审核协议" ){
                    getEntrust();
                    getEntrustLawyer();
                    $("#xy-progressStr").html("（"+ret.progressStr+"）");
                    $("#xy-btnn").html("<button class='btn  btn-info xy-btn' onclick='shenHePass(1);'>通过审核</button>" +
                        "            <button class='btn  btn-info2 xy-btn' id='xy-shfalse'  onclick='shenHeNoPass(1)'>审核失败</button>");
                }else if ( ret.state === "协议审核失败"  ){
                    getEntrust();
                    getEntrustLawyer();
                    $("#xy-progressStr").html("（"+ret.progressStr+"）");
                    $("#xy-btnn").html("<span style='color: #ee2e3a'>协议审核失败，等待再次上传委托协议！</span>");
                }else if ( ret.state === "待支付前期服务费" || ret.state === "待支付后期服务费" ||ret.state === "待上传判决书" ){
                    getEntrust();
                    getEntrustLawyer();
                    getbiddOrder();
                    $("#ja-progressStr").html("（"+ret.progressStr+"）");
                    $("#fwf-progressStr").html("（"+ret.progressStr+"）");
                }else if (ret.state === "待审核判决书" ){
                    getEntrustLawyer();
                    getEntrust();
                    getJudgment();
                    getJudgmentLawyer();
                    getbiddOrder();
                    $("#ja-progressStr").html("（"+ret.progressStr+"）");
                    $("#ja-btn").html("<button class='btn  btn-info xy-btn' onclick='shenHePass(2);'>通过审核</button>" +
                        "            <button class='btn  btn-info2 xy-btn' id='ja-shfalse'  onclick='shenHeNoPass(2);'>审核失败</button>");
                }else if (ret.state === "判决书审核失败" ){
                    getEntrustLawyer();
                    getEntrust();
                    getJudgment();
                    getJudgmentLawyer();
                    getbiddOrder();
                    $("#ja-btn").html("<span style='color: #ee2e3a'>判决书审核失败，等待再次上传判决书！</span>");
                }else if ( ret.state === "待支付服务费" ){
                    getEntrustLawyer();
                    getEntrust();
                    getJudgment();
                    getJudgmentLawyer();
                    getbiddOrder();
                    $("#fwf-progressStr").html("（"+ret.progressStr+"）");
                }else if (ret.state === "已结案"){
                    getEntrustLawyer();
                    getEntrust();
                    getJudgment();
                    getJudgmentLawyer();
                    getbiddOrder();
                    $(".bbttnn").html("");
                    $("#btnnn").html("<span style='color: #00b3ee'>该案件已结案，不可进行操作！</span>");
                }
            }
        });
    }

    start();

    function getfollow(){
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getFollow",
            type : "post",
            async: false,
            data : {
                'lawsuitId' : a
            },
            complete : function(ret) {
                console.log(ret);
                var ret = eval("(" + ret.responseText + ")");
                if(ret.length > 0){
                    var html = "";
                    for(var i = 0;i<ret.length;i++){
                        html += ret[i].createDate+' '+ret[i].content+'<br/>';
                        $("#follow").html(html);
                    }
                    console.log(ret);
                }else{
                    $("#follow").html("暂无");
                }
            }
        });
    }

    function getUpdateRemark() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getUpdateRemark",
            type : "post",
            async: false,
            data : {
                'lawsuitId' : a,
            },
            complete : function(ret) {
                console.log(ret);
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret.updateRemark);
                $("#updateRemark").html(ret.updateRemark);
            }
        });
    }


    var myGrid = null;
    var scripts = [ null,  "${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/assets/js/jqGrid/i18n/grid.locale-cn.js", null ];

    $('.page-content-area').ace_ajax('loadScripts', scripts, function() {
        var grid_selector = "#grid-table";
        var pager_selector = "#grid-pager";

        jQuery(function ($) {
            /* $('#ads-lawTime').datepicker({
                 language: 'zh-CN',
                 pickTime: false,
                 todayBtn: true,
                 autoclose: true,
                 minView: '2',
                 forceParse: false,
                 format: "yyyy-mm-dd"
             });*/
            $('#ads-setDeferred').datepicker({
                language: 'zh-CN',
                pickTime: false,
                todayBtn: true,
                autoclose: true,
                minView: '2',
                forceParse: false,
                format: "yyyy-mm-dd"
            });
            myGrid=	jQuery(grid_selector).jqGrid({
                subGrid : false,
                url : "${contextPath}/ads/vip/getBidd?adsLawsuitId="+a,
                datatype : "json",
                mtype:'POST',//设置http方式为post以解决乱码问题
                colNames : ['biddId','prog','投标时间','律师姓名', '律师地区','律师号码','首次反馈时间',
                    '到期时间','反馈结果','状态','操作'],
                colModel : [{
                    name : 'biddId',
                    index : 'biddId',
                    width : 120,
                    search : false,
                    editable : false,
                    hidden: true,
                    //sorttype : 'date'
                },{
                    name : 'prog',
                    index : 'prog',
                    width : 120,
                    search : false,
                    editable : false,
                    hidden: true,
                    //sorttype : 'date'
                },{
                    name : 'creatrDate',
                    index : 'creatrDate',
                    width : 130,
                    search : false,
                    editable : false,
                    //sorttype : 'date'
                },{
                    name : 'lawyerName',
                    index : 'lawyerName',
                    width : 90,
                    search : false,
                    editable : false,
                    //sorttype : 'date'
                },{
                    name : 'proAndCity',
                    index : 'proAndCity',
                    width : 100,
                    search : false,
                    editable : false,
                    //sorttype : 'date'
                },{
                    name : 'lawyerPhone',
                    index : 'lawyerPhone',
                    width : 90,
                    search : false,
                    editable : false,
                    //sorttype : 'date'
                },{
                    name : 'firstProgress',
                    index : 'firstProgress',
                    width : 110,
                    search : false,
                    editable : false,
                    //sorttype : 'date'
                },{
                    name : 'overdue',
                    index : 'overdue',
                    width : 110,
                    search : false,
                    editable : false,
                    //sorttype : 'date'
                },{
                    name : 'progress',
                    index : 'progress',
                    width : 110,
                    search : false,
                    editable : false,
                    //sorttype : 'date'
                }, {
                    name : 'stateValue',
                    index : 'stateValue',
                    width : 110,
                    search : false,
                    editable : false,
                    //sorttype : 'date'
                },{
                    name : 'type',
                    index : 'type',
                    width : 190,
                    editable : false,
                    search : false,
                    sortable : false,
                    fixed:true,
                    formatter : optionFormatter
                }],
                sortname : "createDate",
                sortorder : "desc",
                viewrecords : true,
                rowNum : 10,
                rowList : [ 10, 20, 30 ],
                pager : pager_selector,
                altRows : true,
                height:"auto",//自动根据每页条数弹性调整表格高度
                loadComplete : function() {
                    var table = this;
                    setTimeout(function(){
                        /*styleCheckbox(table);
                        updateActionIcons(table);*/
                        updatePagerIcons(table);
                        enableTooltips(table);
                    }, 0);
                }
            });

            function optionFormatter(cellvalue, options, cell) {
                var template = "";
                if (cell.prog === "2"){
                    template += "&nbsp;<button  onclick='updateOrderType(\""+cell.biddId+"\")' class='btn btn-minier btn-yellow'>修改状态</button>";
                    template += "|&nbsp;<button  onclick='updateLawBidd(\""+cell.biddId+"\")' class='btn btn-minier btn-yellow'>修改中标律师</button>";
                }else if(cell.prog === "1"){
                    template += "&nbsp;<button  onclick='updateLawBidd(\""+cell.biddId+"\")' class='btn btn-minier btn-yellow'>修改中标律师</button>";
                }


                return template;
            }




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

    });

    function getProvince() {
        var sec = document.getElementById('adsLawsuit-pro');
        // var sss = document.getElementById('adsLawsuit-ygPro');
        // var ccc = document.getElementById('adsLawsuit-bgPro');
        sec.innerHTML = "<option value=''>请选择</option>";
        // sss.innerHTML = "<option value=''>请选择</option>";
        // ccc.innerHTML = "<option value=''>请选择</option>";
        $.getJSON("${contextPath}/ads/vip/getProvince",function(result){
            $.each(result, function(i, v){
                sec.innerHTML += "<option value='" + v[0] + "'>" + v[1] + "</option>";
                /*if (type === 1){
                    sec.innerHTML += "<option value='" + v[0] + "'>" + v[1] + "</option>";
                }else if (type === 2){
                    sss.innerHTML += "<option value='" + v[0] + "'>" + v[1] + "</option>";
                }else{
                    console.log("被告省");
                    ccc.innerHTML += "<option value='" + v[0] + "'>" + v[1] + "</option>";
                }*/
            });
        });
    }

    function getCity(type,city) {
        var proId = null;
        if (type === 1){
            proId = $("#adsLawsuit-pro").val();
            var sec = document.getElementById('adsLawsuit-city');
            sec.innerHTML = "<option selected value=''>请选择</option>";
        }else if(type === 2){
            proId = $("#adsLawsuit-ygPro").val();
            var sss = document.getElementById('adsLawsuit-ygCity');
            sss.innerHTML = "<option selected value=''>请选择</option>";
        }else if(type === 3){
            proId = $("#adsLawsuit-bgPro").val();
            var ccc = document.getElementById('adsLawsuit-bgCity');
            ccc.innerHTML = "<option selected value=''>请选择</option>";
        }
        $.getJSON("${contextPath}/ads/vip/getCity?proId="+proId,function(result){
            $.each(result, function(i, v){
                if (type === 1){
                    if (city !== 0 && city === v[0]+""){
                        sec.innerHTML += "<option selected value='" + v[0] + "'>" + v[1] + "</option>";
                    }else{
                        sec.innerHTML += "<option value='" + v[0] + "'>" + v[1] + "</option>";
                    }
                }/*else if (type === 2){
                    if (city !== 0 && city === v[0]+""){
                        sss.innerHTML += "<option selected value='" + v[0] + "'>" + v[1] + "</option>";
                    }else{
                        sss.innerHTML += "<option value='" + v[0] + "'>" + v[1] + "</option>";
                    }
                }else{
                    if (city !== 0 && city === v[0]+""){
                        ccc.innerHTML += "<option selected value='" + v[0] + "'>" + v[1] + "</option>";
                    }else{
                        ccc.innerHTML += "<option value='" + v[0] + "'>" + v[1] + "</option>";
                    }
                }*/
            });
        });
    }
    function getCaseType() {
        var sec = document.getElementById('adsLawsuit-caseType');
        sec.innerHTML = "<option selected value=''>请选择</option>";
        $.getJSON("${contextPath}/ads/vip/getCaseType",function(result){
            $.each(result, function(i, v){
                sec.innerHTML += "<option value='" + v.code + "'>" + v.name + "</option>";
            });
        });
    }

    /*function addTime() {
        var lawsuitId = a;
        var lawTime = $("#ads-lawTime").val();
        $.ajax({
            dataType : "json",
            url : "}/ads/vip/addTime",
            type : "post",
            data : {
                'lawsuitId' : lawsuitId,
                'lawTime' : lawTime,
            },
            complete : function(ret) {
                showLawTime(lawsuitId , "2");
                $("#ads-lawTime").val("");
            }
        });
    }*/
    /*function showLawTime(id) {
        $("#modal-time-lawTime").html("");
        $("#lawTime").val("");
        $("#modal-time-lawsuitId").val(id);
        var sec = document.getElementById('modal-time-lawTime');
        $.getJSON("$}/ads/vip/getTime?id="+id,function(result){
            $.each(result, function(i, v){
                sec.innerHTML += "<p>"+v.time+"&nbsp;&nbsp;&nbsp;&nbsp;<button class='btn-danger' onclick='deleteTime(\""+v.id+"\")'>删除</button></p>";
            });
        });
    }*/
    /*showLawTime(a);*/
    /*function deleteTime(id) {
        var lawsuitId = a;
        $.ajax({
            dataType : "json",
            url : "$}/ads/vip/deleteTime",
            type : "post",
            data : {
                'id' : id
            },
            complete : function(ret) {
                showLawTime(lawsuitId , "2");
            }
        });
    }*/

    //显示基本信息
    function showedit(id) {
        $("#adsLawsuit-name").val("");
        $("#adsLawsuit-phone").val("");
        $("#adsLawsuit-caseType").val("");
        $("#adsLawsuit-targetAmount").val("");
        $("#adsLawsuit-txt").val("");
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getadslawById",
            type : "post",
            data : {
                'id' : id
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                $("#adsLawsuit-orderType").val(ret.orderType);
                $("#adsLawsuit-orderSource").val(ret.orderSource);
                $("#adsLawsuit-name").val(ret.name);
                $("#adsLawsuit-phone").val(ret.phone);
                if (ret.isNew === 2){
                    $("#adsLawsuit-pro").val(ret.qsProvinceId);
                    setTimeout(function () {
                        getCity(1,ret.qsCityId);
                    }, 50);
                }else{
                    $("#adsLawsuit-pro").val(ret.provinceId);
                    setTimeout(function () {
                        getCity(1,ret.cityId);
                    }, 50);
                }
                $("#adsLawsuit-caseType").val(ret.caseType);
                $("#adsLawsuit-targetAmount").val(ret.targetAmount);
                if (ret.property !== null) {
                    $("#adsLawsuit-property").val(ret.property);
                }else{
                    $("#adsLawsuit-property").val("-1");
                }
                if (ret.agentType !== null) {
                    $("#adsLawsuit-agentType").val(ret.agentType);
                }else{
                    $("#adsLawsuit-agentType").val("-1");
                }
                updateTargent();
                updateAgent();
                if (ret.frontCost === null){
                    $("#adsLawsuit-frontCost").val("0");
                }else{
                    $("#adsLawsuit-frontCost").val(ret.frontCost);
                }
                if (ret.cost === null){
                    $("#adsLawsuit-cost").val("0");
                }else{
                    $("#adsLawsuit-cost").val(ret.cost);
                }
                if (ret.targetAmountPc === null){
                    $("#adsLawsuit-targetAmountPc").val("0");
                }else{
                    $("#adsLawsuit-targetAmountPc").val(ret.targetAmountPc);
                }
                $("#adsLawsuit-txt").val(ret.txt);
                $("#remark").html("");
            }
        });

    }
    function editOrder() {
        var id = a;
        var name = $("#adsLawsuit-name").val();
        var phone = $("#adsLawsuit-phone").val();
        var qsProvince = $("#adsLawsuit-pro").val();
        // var province = $("#adsLawsuit-ygPro").val();
        // var bgProvince = $("#adsLawsuit-bgPro").val();
        var qsCity = $("#adsLawsuit-city").val();
        // var city = $("#adsLawsuit-ygCity").val();
        // var bgCity = $("#adsLawsuit-bgCity").val();
        var caseType = $("#adsLawsuit-caseType").val();
        var orderSource = $("#adsLawsuit-orderSource").val();
        var targetAmount = $("#adsLawsuit-targetAmount").val();
        var property = $("#adsLawsuit-property").val();
        var txt = $("#adsLawsuit-txt").val();
        var agentType = $("#adsLawsuit-agentType").val();
        var frontCost = $("#adsLawsuit-frontCost").val();
        var cost = $("#adsLawsuit-cost").val();
        var targetAmountPc = $("#adsLawsuit-targetAmountPc").val();
        if (orderType !== "不打官司"){
            if (agentType < 0){
                alert("请选择代理方式！");
                return
            }if (name === ''){
                alert("请输入姓名！");
                return
            }if (property === '-1' || property === ''){
                alert("请选择是否涉及财产！");
                return
            }if (phone === ''){
                alert("请输入电话！");
                return
            }if (caseType === '0'){
                alert("请选择案件类型！");
                return
            }if (targetAmount === ''){
                alert("请输入标的额！");
                return
            }if (txt === ''){
                alert("请输入案件信息！");
                return
            }if (qsProvince === ''){
                alert("请选择省市地区！");
                return
            }if (qsCity === ''){
                alert("请选择省市地区！");
                return
            }if (agentType === 0){
                if (cost === ''){
                    alert("请输入律师费！");
                    return
                }
            }else if (agentType === 2){
                if (frontCost === ''){
                    alert("请输入律师费！");
                    return
                }if (targetAmountPc === ''){
                    alert("请输入执行回款百分比！");
                    return
                }
            }else{
                if (targetAmountPc === ''){
                    alert("请输入执行回款百分比！");
                    return
                }
            }
        }
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/editLawsuitOrder",
            type : "post",
            data : {
                'id' : id,
                'name' : name,
                'phone' : phone,
                // 'province' : province,
                'qsProvince' : qsProvince,
                // 'bgProvince' : bgProvince,
                // 'city' : city,
                'qsCity' : qsCity,
                // 'bgCity' : bgCity,
                'caseType' : caseType,
                'targetAmount' : targetAmount,
                'property' : property,
                'txt' : txt,
                'orderSource' : orderSource,
                'agentType' : agentType,
                'frontCost' : frontCost,
                'cost' : cost,
                'targetAmountPc' : targetAmountPc,
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                if (ret.succ === "true"){
                    alert(ret.message);
                    location.reload();
                }else{
                    alert(ret.message);
                }
            }
        });
    }

    function updateTargent() {
        var a = $("#adsLawsuit-property").val();
        if (a === "1"){
            $("#adsLawsuit-targetAmount").attr('disabled',false);
        }else if (a === "0"){
            $("#adsLawsuit-targetAmount").attr('disabled',true);
        }
    }
    function updateAgent() {
        var a = $("#adsLawsuit-agentType").val();
        if (a === "2"){
            $("#ffeee").html("前期<input type='text' id='adsLawsuit-frontCost' value='0'/>&nbsp;&nbsp;&nbsp;&nbsp;元" +
                "                &nbsp;&nbsp;&nbsp;，后期胜诉执行回款<input type='text' id='adsLawsuit-targetAmountPc' value='0'>&nbsp;&nbsp;&nbsp;%")
        }else if (a === "0"){
            $("#ffeee").html("<input type='text' id='adsLawsuit-cost' value='0'/>元")
        }else{
            $("#ffeee").html("执行回款<input type='text' id='adsLawsuit-targetAmountPc' value='0'/>&nbsp;&nbsp;&nbsp;%")
        }
    }
    //显示当事人提交的图片信息
    function showPic() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getPic",
            type : "post",
            data : {
                'id' : a
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                var all = "";
                for (var i = 0 ; i < ret.length;i++){
                    all += "<a style='padding: 8px;' href='"+ret[i].url+"' target='newPic'>" +
                        "<img src='"+ret[i].url+"' width='70px' height='70px'/>" +
                        "<a/>"
                }
                $("#adsLawsuit-pic").html(all);
            }
        });
    }

    //显示律师提交的委托协议图片
    function getEntrust() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getEntrust",
            type : "post",
            data : {
                'lawsuitId' : a
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                $("#xy-createDate").html("提交时间："+formatDate(ret[0].createDate));
                var all = "";
                for (var i = 0 ; i < ret.length;i++){
                    all += "<a style='padding: 8px;' href='"+ret[i].url+"' target='newPic'>" +
                        "<img src='"+ret[i].url+"' width='70px' height='70px'/>" +
                        "<a/>"
                }
                $("#xy-pic").html(all);
            }
        });
    }

    //时间
    function formatDate(now) {
        var dateaaa = new Date(now);
        var year=dateaaa.getFullYear();  //取得4位数的年份
        var month=dateaaa.getMonth()+1;  //取得日期中的月份，其中0表示1月，11表示12月
        var date=dateaaa.getDate();      //返回日期月份中的天数（1到31）
        var hour=dateaaa.getHours();     //返回日期中的小时数（0到23）
        var minute=dateaaa.getMinutes(); //返回日期中的分钟数（0到59）
        var second=dateaaa.getSeconds(); //返回日期中的秒数（0到59）
        return year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
    }


    //显示律师提交委托协议的信息
    function getEntrustLawyer() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getEntrustLawyer",
            type : "post",
            data : {
                'lawsuitId' : a
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                // $("#xy-progressStr").html("（"+ret.progressStr+"）");
                $("#xy-biddId").val(ret.adsBiddId);
                console.log(ret.adsBiddId);
                $("#xy-lawyer").html("提交律师："+ret.lawyerName);
            }
        });
    }

    //显示判决书图片
    function getJudgment() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getJudgment",
            type : "post",
            data : {
                'lawsuitId' : a
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                $("#ja-createDate").html("提交时间："+formatDate(ret[0].createDate));
                var all = "";
                for (var i = 0 ; i < ret.length;i++){
                    all += "<a style='padding: 8px;' href='"+ret[i].url+"' target='newPic'>" +
                        "<img src='"+ret[i].url+"' width='70px' height='70px'/>" +
                        "<a/>"
                }
                $("#ja-pic").html(all);
            }
        });
    }

    //先死判决书提交信息
    function getJudgmentLawyer() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getJudgmentLawyer",
            type : "post",
            data : {
                'lawsuitId' : a
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                // $("#ja-progressStr").html("（"+ret.progressStr+"）");
                $("#xy-progressStr").html("");
                $("#ja-agentType").html(ret.agentType);
                $("#ja-isVictory").html(ret.isVictory);
                $("#ja-moneyBack").val(ret.moneyBack);
                $("#ja-afterCost").val(ret.afterCost);
                $("#ja-biddId").val(ret.adsBiddId);
                $("#ja-lawyer").html("提交律师："+ret.lawyerName);
            }
        });
    }
    //显示支付佣金信息
    function getbiddOrder() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getbiddOrder",
            type : "post",
            data : {
                'lawsuitId' : a
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                // $("#fwf-progressStr").html("（"+ret.progressStr+"）");
                $("#fwf-agentType").append(" "+ret.agentType);
                $("#fwf-frontCost").append(" "+ret.frontCost);
                $("#fwf-frontFreePc").append(" "+ret.frontFree);
                $("#fwf-afterCost").append(" "+ret.afterCost);
                $("#fwf-afterFreePc").append(" "+ret.afterFree);
            }
        });
    }
    //显示跟单人员信息
    function getgdUser() {
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/getgdUser",
            type : "post",
            data : {
                'lawsuitId' : a
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                $("#lawyerSer").html("律师跟单人员："+ret.lawyerSer);
                $("#userSer").html("当事人跟单人员："+ret.userSer);
            }
        });
    }

    //发布案件
    function pulishOrder() {
        var name = $("#adsLawsuit-name").val();
        var phone = $("#adsLawsuit-phone").val();
        var qsProvince = $("#adsLawsuit-pro").val();
        var province = $("#adsLawsuit-ygPro").val();
        var bgProvince = $("#adsLawsuit-bgPro").val();
        var qsCity = $("#adsLawsuit-city").val();
        var city = $("#adsLawsuit-ygCity").val();
        var bgCity = $("#adsLawsuit-bgCity").val();
        var caseType = $("#adsLawsuit-caseType").val();
        var orderSource = $("#adsLawsuit-orderSource").val();
        var targetAmount = $("#adsLawsuit-targetAmount").val();
        var property = $("#adsLawsuit-property").val();
        var txt = $("#adsLawsuit-txt").val();
        var agentType = $("#adsLawsuit-agentType").val();
        var frontCost = $("#adsLawsuit-frontCost").val();
        var cost = $("#adsLawsuit-cost").val();
        var targetAmountPc = $("#adsLawsuit-targetAmountPc").val();
        //字段判空
        if (orderType !== "不打官司"){
            if (agentType < 0){
                alert("请选择代理方式！");
                return
            }if (name === ''){
                alert("请输入姓名！");
                return
            }if (phone === ''){
                alert("请输入电话！");
                return
            }if (caseType === '0'){
                alert("请选择案件类型！");
                return
            }
            if (property === "1"){
                if (targetAmount === ''){
                    alert("请输入标的额！");
                    return
                }
            }else{
                targetAmount = '0';
            }
            if (txt === ''){
                alert("请输入案件信息！");
                return
            }if (qsProvince === ''){
                alert("请选择省市地区！");
                return
            }if (qsCity === ''){
                alert("请选择省市地区！");
                return
            }if (agentType === 0){
                if (cost === ''){
                    alert("请输入律师费！");
                    return
                }
            }else if (agentType === 2){
                if (frontCost === ''){
                    alert("请输入律师费！");
                    return
                }if (targetAmountPc === ''){
                    alert("请输入执行回款百分比！");
                    return
                }
            }else{
                if (targetAmountPc === ''){
                    alert("请输入执行回款百分比！");
                    return
                }
            }
        }
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/publishOrder",
            type : "post",
            data : {
                'id' : a,
                'name' : name,
                'phone' : phone,
                'province' : province,
                'qsProvince' : qsProvince,
                'bgProvince' : bgProvince,
                'city' : city,
                'qsCity' : qsCity,
                'bgCity' : bgCity,
                'caseType' : caseType,
                'targetAmount' : targetAmount,
                'property' : property,
                'txt' : txt,
                'orderSource' : orderSource,
                'agentType' : agentType,
                'frontCost' : frontCost,
                'cost' : cost,
                'targetAmountPc' : targetAmountPc
            },
            complete : function(ret) {
                console.log(ret);
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                if (ret.succ === "true"){
                    alert(ret.message);
                    location.reload();
                }else{
                    alert(ret.message);
                }
            }
        });
    }

    function showFollow(){
        $("#modal-followShow-body").modal("toggle");
    }

    //取消显示弹框
    function quitOrder() {
        $("#modal-quit-body").modal("toggle");
    }

    //添加案件
    function saveFollow(){
        var content = $("#content").val();
        if(!content){
            alert("请输入跟进内容");
            return;
        }
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/saveFollow",
            type : "post",
            data : {
                'content' : content,
                'lawsuitId' : a
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                if(ret.success){
                    alert("操作成功");
                    location.reload();
                }else{
                    alert(ret.message);
                }
                location.reload();
            }
        });
    }

    //取消案件
    function toSetQuit() {
        var id = a;
        var quitRemark = $("#quit").val();
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/quitOrder",
            type : "post",
            data : {
                'id' : id,
                'quitRemark' : quitRemark,
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                alert(ret.message);
                location.reload();
            }
        });
    }

    //蛇和通过 type = 1 委托协议 2 判决书
    function shenHePass(type) {
        var adsBiddId = $("#xy-biddId").val();
        var moneyBack = "";
        var afterCost = "";
        if (type === 2){
            adsBiddId = $("#ja-biddId").val();
            moneyBack = $("#ja-moneyBack").val();
            afterCost = $("#ja-afterCost").val();
        }
        console.log(adsBiddId);
        var agentType = $("#adsLawsuit-agentType").val();
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/lawsuit/shenHePass",
            type : "post",
            data : {
                'adsBiddId' : adsBiddId,
                'adsLawsuitId' : a,
                'type' : type,
                'agentType' : agentType,
                'moneyBack' : moneyBack,
                'afterCost' : afterCost,
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                alert(ret.message);
                location.reload();
            }
        });
    }

    //审核不通过显示弹框 type = 1 委托协议 2 判决书
    var shenheType;
    function shenHeNoPass(type) {
        shenheType = type;
        $("#modal-shenHeNoPass-body").modal("toggle");
    }

    //审核不通过 type = 1 委托协议 2 判决书
    function toSetshenHeNoPass() {
        var type = shenheType;
        var adsBiddId = $("#xy-biddId").val();
        var shenHeNoPassReson = $("#shenHeNoPass").val();
        if (type === 2){
            adsBiddId = $("#ja-biddId").val();
        }
        var agentType = $("#adsLawsuit-agentType").val();

        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/lawsuit/shenHeNoPass",
            type : "post",
            data : {
                'adsBiddId' : adsBiddId,
                'adsLawsuitId' : a,
                'type' : type,
                'agentType' : agentType,
                'shenHeNoPassReson' : shenHeNoPassReson,
            },
            complete : function(ret) {
                console.log(ret);
                console.log(agentType);
                var ret = eval("(" + ret.responseText + ")");
                /*if (type === 1){
                    $("#xy-shfalse").html("审核失败，待重新提审");
                    document.getElementById("xy-shfalse").css="btn  btn-grey xy-btn";
                    document.getElementById("xy-shfalse").disabled=ture;
                }else if (type === 2){
                    $("#ja-shfalse").html("审核失败，待重新提审");
                    document.getElementById("ja-shfalse").css="btn  btn-grey xy-btn";
                    document.getElementById("ja-shfalse").disabled=ture;
                }*/
                console.log(ret);
                alert(ret.message);
                location.reload();
            }
        });
    }


    //修改中标律师
    function updateBidd(){
        var lawyerId = $("#lawyer").val();
        if(!lawyerId){
            alert("请选择律师");
            return;
        }
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/lawsuit/updateAdsLawyerBiddLawyer",
            type : "post",
            async: false,
            data : {
                'lawsuitId' : a,
                'lawyerId' : lawyerId
            },
            complete: function (ret) {
                var ret = eval("(" + ret.responseText + ")");
                if(ret.success){
                    alert("修改成功");
                    location.reload();
                }else{
                    alert(ret.message);
                }
            }
        });


    }

    //修改中标律师页面显示
    function updateLawBidd(biddId){
        $("#modal-updateBidd-body").modal("toggle");
        $("#updateBiddId").val(biddId);
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/lawsuit/getLawyerByBiddId",
            type : "post",
            async: false,
            data : {
                'biddId' : biddId,
            },
            complete: function (ret) {
                console.log(ret);
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                if(ret && ret.length > 0){
                    var html ="";
                    for(var i = 0 ;i < ret.length; i ++) {
                        html += '<option value="'+ret[i].id+'">'+ret[i].realName+'</option>';
                    }
                    $("#lawyer").html(html);
                }
            }
        });
    }

    //修改投标装状态
    function updateOrderType(id) {
        $("#modal-remark-body").modal("toggle");
        $("#modal-biddId").val(id);
    }

    //服务费修改保存
    function updateBiddOrder() {
        var biddId = $("#modal-biddId").val();
        var biddType = $("#updateBiddType").val();
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/updateBiddOrder",
            type : "post",
            data : {
                'biddId' : biddId,
                'biddType' : biddType,
                'lawsuitId' : a,
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                alert(ret.message);
                location.reload();
            }
        });
    }

    //设置延期他弹框显示
    function setDeferred() {
        $("#modal-setDeferred-body").modal("toggle");
    }
    //设置延期
    function setDefDate() {
        var setDeferred = $("#ads-setDeferred").val();
        var deferred = $("#deferred").val();
        $.ajax({
            dataType : "json",
            url : "${contextPath}/ads/vip/setDefDate",
            type : "post",
            data : {
                'lawsuitId' : a,
                'setDeferred' : setDeferred,
                'deferred' : deferred,
            },
            complete : function(ret) {
                var ret = eval("(" + ret.responseText + ")");
                console.log(ret);
                alert(ret.message);
                location.reload();
            }
        });
    }

</script>
