<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8" %>
<%@ include file="header.jsp" %>
<script type="text/javascript" src="<%=webpath%>/js/business/orderCheck.js"></script>
<script type="text/javascript" src="<%=webpath%>/js/DatePicker/WdatePicker.js"></script>
<style>
    .table input, .table button, .table select, .table textarea {
        font-family: inherit;
        font-size: inherit;
        line-height: inherit;
        margin-bottom: 15px;
        height: 32px;
        width: 80%;
        border-radius: 2px;

        text-indent: 0.5em;
    }

    .table input, .table textarea {
        border: 1px dashed #BABABA;
    }

    .table select, .table input.Wdate {
        border: 1px dashed #B7DBD1;
        background-color: #E3F1ED;
    }

    .infoTable td {
        height: 32px;
        line-height: 32px;
    }

    textarea {
        resize: none;
    }

    .Wdate {
        padding-left: 0;
    }
</style>
<script type="text/javascript">
    function query() {
        var queryParams = {};
        var code = $("#code").val();
        var orderCode = $("#orderCode").val();
        var checkState = $("#checkState").val();
        var queryDate1 = $("#queryDate1").val();
        var queryDate2 = $("#queryDate2").val();
        var rescueCompanyName = $("#rescueCompanyName").val();

//        if ((license == null || license == '') && (frame_code == null || frame_code == '') && (userPhone == null || userPhone == '') &&
//                (finishTime == null || finishTime == '') && (createTime == null || createTime == '') && (companyName == null || companyName == '')) {
//            alert("查询条件不能为空");
//            return;
//        }
//
//        // 比较时间
//        if ((!(finishTime == null || finishTime == '') && !(createTime == null || createTime == '')) && !toCompairTime(createTime, finishTime)) {
//            alert('开始时间大于离开时间，请检查');
//            return;
//        }
        queryParams['code'] = code;
        queryParams['orderCode'] = orderCode;
        queryParams['checkState'] = checkState;
        queryParams['queryDate1'] = queryDate1;
        queryParams['queryDate2'] = queryDate2;
        queryParams['rescueCompanyName'] = rescueCompanyName;
        queryOrderCheckList("<%=path%>/orderCheck/query.do", queryParams);

    }
    function clearVal() {
        $("#frame_code").val("");
        $("#license").val("");
        $("#userPhone").val("");
    }

    function clearValState1() {
        $("#code").val("");
        $("#orderCode").val("");
        $("#queryDate1").val("");
        $("#queryDate2").val("");
        $("#rescueCompanyName").val("");
        $("#checkState").val("");
    }

    function save() {
        $.getJSON("<%=path%>/orderCheck/save.do", {
            totalFee: $('#i-totalFee1').html(),
            uid: $('#uid').val()
        }, function (data) {
            if(data.flag == '1'){
                $('#checkInfoEdit_windowContent').hide();
                query();
            }else{
                alert(data.msg);
            }

        });
    }

    function accept(){
        $.getJSON("<%=path%>/orderCheck/accept.do",{
            orderId: $('#i-orderID').val(),
            checkId: $('#i-checkID').val(),
        },function(data){
            $('#checkInfoEdit_windowContent').hide();
            query();
        });
    }

    $(function () {
        var queryParams = {};
        queryOrderCheckList("<%=path%>/orderCheck/query.do", queryParams);
        $('#i-isSuccessServer').change(function () {
            var isSuccessServer = $('#i-isSuccessServer').val();
            if (isSuccessServer == 1) {
                $('#i-totalFee1').html('800');
            }else if (isSuccessServer == 2) {
                $('#i-totalFee1').html('300');
            } else {
                $('#i-totalFee1').html('600');
            }
        });

        $('#i-mileage1').bind('input', function(){
            var mile = $('#i-mileage1').val();
            if(mile>15) {
                mile = mile-15;
            }else{
                mile = 0;
            }
            $('#i-totalFee1').html(150+mile*6);
        })
    });

</script>
<input type="hidden" id="paths" value="<%=path%>"/>
<div id="main">
    <input type="hidden" id="i-otherFee" value="0">
    <input type="hidden" id="i-checkID">
    <input type="hidden" id="i-orderID">
    <input type="hidden" id="i-checkStateValue">
    <div class="search">
        <table class="searchTable">
            <tbody>
            <tr>

                <!-- <td><b><font><font>VIN码</font></font></b></td> -->
                <td style="position:relative;">
                    <span class="inputTitle"> 案件编号: </span>
                    <span id="input34Wrap">
                    <input id="orderCode" name="endSubmitDate"
                           type="text" value=""
                           class="mc-ipt-text"
                           style=""/><span class="mc-ipt"
                                           style="width:90%;"><span
                            id="input33Tip" class="mc-ipt-tip-query"
                            style="font-size: 11px; line-height: 40px; height: 40px;"></span></span></span></td>

                <td style="position:relative;">
                    <span class="inputTitle"> VIN:</span>
                    <span id="input34Wrap">
                    <input id="code" name="endSubmitDate"
                           type="text" value=""
                           class="mc-ipt-text"
                           style=""/><span class="mc-ipt"
                                           style="width:90%;"><span
                            id="input33Tip" class="mc-ipt-tip-query"
                            style="font-size: 11px; line-height: 40px; height: 40px;"></span></span></span></td>

                <!-- <td><b><font><font>客户手机号</font></font></b></td> -->
                <td style="position:relative;">
                    <span class="inputTitle"> 状态: </span>
                    <span id="input34Wrap">
                    <select id="checkState"
                            style="width: 63%;height:30px;border-radius: 5px;
                           border: 1px solid #D2D2D2;
                           text-indent: 1em;color: #AFAFAF;"
                            class="finalChoice" tabindex="-1"
                            aria-hidden="true"
                            name="checkState">
                            <option value="">-未选择-</option>
                            <option value="2">等待填写</option>
                            <option value="3">等待审核</option>
                        </select><span class="mc-ipt"
                                       style="width:90%;"><span
                            id="input33Tip" class="mc-ipt-tip-query"
                            style="font-size: 11px; line-height: 40px; height: 40px;"></span></span></span></td>

                <td>
                    <button class="t-button searchBtn" id="CaseInfoList2btnCtClear" type="button"
                            onclick="clearValState1();"><img class="searchIcon" src="../images/clear.png">清空
                    </button>
                    <button class="t-button searchBtn" style="margin-right:10px;" id="CaseInfoList2btnCtSearch"
                            type="button" onclick="query();"><img class="searchIcon" src="../images/search.png">搜索
                    </button>

                    <!--
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <button class="t-button" id="CaseInfoList2btnCtSearch" type="button" onclick="query();">
                            <font><font>
                                &nbsp;&nbsp;搜 索&nbsp;&nbsp;</font></font></button> -->
                </td>

            </tr>
            <tr>

                <td>
                    <span class="inputTitle"> 开始日期: </span>
                    <input type="text" id="queryDate1" class="Wdate" readonly="readonly"
                           onfocus="WdatePicker({errDealMode:2,readOnly:true,startDate:'%y-%M-%d %H:%m:%s',dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'queryDate1\')||\'%y-%M-%d\'}'})"
                           style="cursor:pointer;"/>
                </td>

                <td>
                    <span class="inputTitle"> 结束日期: </span>
                    <input type="text" id="queryDate2" class="Wdate" readonly="readonly"
                           onfocus="WdatePicker({errDealMode:2,readOnly:true,startDate:'%y-%M-%d %H:%m:%s',dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d',minDate:'#F{$dp.$D(\'queryDate2\')}'})"
                           style="cursor:pointer;"/>
                </td>

                <!-- <td><b><font><font>经销商名称</font></font></b></td> -->
            </tr>
            </tbody>
        </table>
    </div>
    <table id="datatable"></table>
    <div class="order_undo" id="checkInfoEdit_windowContent" style="display: none;">
        <div class="dialog_default" style="width: 1000px">
            <div class="dialog_title">
                服务费用结算
            </div>
            <div class="dialog_con">
                <div id="moduleCtId">
                    <div class="ng-scope">
                        <input type="hidden" id="uid">
                        <div ng-switch="v">
                            <div class="ng-scope" style="padding-top:30px;">
                                <span class="ng-binding" style="color: red" id="caseInfoEdit20MsgCtBackMsg"></span>
                                <table class="infoTable">
                                    <tr>
                                        <td class="ng-binding" style="position:relative;">案件号码: <span id="input21Wrap">
                                <span class="mc-ipt" id="i-orderCode"></span></span>
                                        </td>
                                        <td class="ng-binding" style="position:relative;">经销商: <span
                                                id="companyNameWrap">
                                <span class="mc-tips"></span><span
                                                class="mc-ipt" id="i-companyName"></span></span></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="ng-binding" style="position:relative;">VIN码: <span
                                                id="frameCodeWrap">
                                <span class="mc-ipt" id="i-frameCode"></span></span>
                                        </td>
                                        <td class="ng-binding" style="position:relative;">救援类型: <span
                                                id="i-serviceNameWrap">
                                <span class="mc-tips"></span><span
                                                class="mc-ipt" id="i-serviceName"></span><span
                                                class="mc-ipt-msg"></span></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="ng-binding" style="position:relative;">案件状态: <span
                                                id="i-orderStateWrap">
                                <span class="mc-tips"></span><span
                                                class="mc-ipt" id="i-orderState"></span><span
                                                class="mc-ipt-msg"></span></span>
                                        </td>
                                        <td class="ng-binding" style="position:relative;">结算状态: <span
                                                id="i-checkStateWrap">
                                <span class="mc-tips"></span><span
                                                class="mc-ipt" id="i-checkState"></span></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="ng-binding" colspan="2" style="position:relative;">案件事发地: <span id="i-addressWrap">
                                <span class="mc-tips"></span><span
                                                class="mc-ipt" id="i-address"></span></span>
                                        </td>
                                    </tr>
                                    <tr class="i-destAddressTR">
                                        <td class="ng-binding" colspan="2"  style="position:relative;">拖车目的地: <span
                                                id="i-destAddressWrap">
                                <span class="mc-tips"></span><span
                                                class="mc-ipt" id="i-destAddress"></span><span
                                                class="mc-ipt-msg"></span></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <hr/>
                                        </td>
                                    </tr>

                                </table>
                                <table class="table" width="50%">
                                    <tr>
                                        <th class="ng-binding" style="position:relative;">救援服务费:
                                        </th>
                                        <td>
                                            <span id="i-totalFee"
                                                  class="mc-ipt-msg" style="font-size: 18px"></span>
                                        </td>
                                    </tr>
                                    <tr id="i-isSuccessServerTD">
                                        <th>现场服务作业完成:</th>
                                        <td class="ng-binding" style="position:relative;"><select
                                                id="i-isSuccessServer" name="isSuccessServer"
                                                style="width:80%;height:38px;"
                                                class="finalChoice" tabindex="-1"
                                                aria-hidden="true">
                                            <option value="">请选择</option>
                                            <option value="0" selected>---现场服务不成功---</option>
                                            <option value="1">---现场服务成功---</option>
                                            <option value="2">---未到现场---</option>
                                        </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th class="ng-binding" style="position:relative;">经销商核对金额:
                                        </th>
                                        <td>
                                            <span id="i-totalFee1"
                                                  class="mc-ipt-msg"
                                                  style="font-size: 18px"></span>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="confirm_cancel clearfix">
                    <a onclick="save();" id="caseInfoEdit20SelCtshow_OK" class="btn2">提&nbsp;&nbsp;交</a>
                    <a onclick="$('#checkInfoEdit_windowContent').hide();" id="checkInfoEdit20SelCtshow_Cancel"
                       class="btn1 cancel">取&nbsp;&nbsp;消</a>
                </div>
            </div>
        </div>
    </div>
</div>

</div>
<%@ include file="footer.jsp" %>