<!DOCTYPE html>
<html lang="zh">
<#include "/include/header.html">
<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <#include "/include/left.html">
        <!--End 左侧导航-->
        <!--头部信息-->
        <#include "/include/topbar.html">
        <!--End 头部信息-->
        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="panel" style="margin-bottom: auto">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        组合条件筛选
                                    </h3>
                                </div>
                                <!--组合条件组件-->
                                <#include "/include/table/table-query.html">
                            </div>
                            <div class="card-toolbar clearfix" style="padding: 0px 24px 0px 24px">
                                <div class="toolbar-btn-action" id="toolBar">
                                    <#include "/include/table/table-batch.html">
                                </div>
                            </div>
                            <!--快速搜索框-->
                            <div class="card-body" style="padding: 10px 15px">
                                <div class="pull-right" id="id_search_column"
                                     style="position: absolute;right: 295px;margin-top: 10px;">
                                    <input type="hidden" name="search_field" id="search-field" value="">
                                    <button class="btn btn-default dropdown-toggle" id="search-btn"
                                            data-toggle="dropdown" type="button" aria-haspopup="true"
                                            aria-expanded="false">
                                        全部 <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" style="min-width: auto">
                                        <li><a tabindex="-1" href="javascript:void(0)" data-field="">全部</a></li>
                                        <#list pageTemplate.tableSearch as search>
                                            <li><a tabindex="-1" href="javascript:void(0)" data-field="${search.key!}">${search.name}</a></li>
                                        </#list>
                                    </ul>
                                </div>
                                <!--Bootstarp Table插入-->
                                <#include "/include/table/table-data.html">

                            </div>
                        </div>

                    </div>

                </div>
            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>
<#include "/include/footer.html">
<#include "/include/table/table-event.html">
<#include "/include/table/table-model.html">
<#include "./share/quickOrderModel.html">
<!--以下为业务流程处理-->
<div id="id_third_info_model" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="myLargeModalLabel">第三方信息</h4>
            </div>
            <div class="modal-body" id="id_third_info_model_body">
                您的内容...
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <!--<button type="button" class="btn btn-primary">点击保存</button>-->
            </div>
        </div>
    </div>
</div>
<div>
    <div class="modal fade" id="id_order_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="exampleModalLabel">重新推送</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="control-label">当前订单：</label>
                        <input id="id_order_model_order" class="form-control" disabled>
                    </div>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="control-label">推送第三方：</label>
                        <select id="id_order_model_select_status" class="form-control">
                            <option value="全部" selected="selected">全部</option>
                            <option value="SS">闪送</option>
                            <option value="SF">顺丰</option>
                            <option value="UU">优优</option>
                            <option value="HLL">货拉拉</option>
                            <option value="KD">快递100</option>
                        </select>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="RePush()">确认提交</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!--平台的完成率-->
<div>
    <div class="modal fade" id="id_order_rate_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="id_courier_winthraw_model_title">完成率</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="control-label">加盟商：</label>
                        <input id="id_order_fran" type="text" class="form-control" placeholder="例如：xxx同城急送"  value="">
                    </div>
                    <div class="form-group">
                        <label class="control-label">选择时间：</label>
                        <select id="id_order_select_time" class="form-control">
                            <option value="当日" selected="selected">当日</option>
                          <!--  <option value="当周">当周</option>
                            <option value="当月">当月</option>
                            <option value="当季">当季</option>
                            <option value="半年">半年</option>
                            <option value="整年">整年</option>
                            <option value="全部">全部</option>-->
                        </select>
                    </div>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <div class="input-group">
                            <ul class="nav nav-tabs nav-justified">
                                <li class="active">
                                    <button type="button" class="btn btn-warning" onclick="CompleteRate()">计算</button>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon">全部订单：</span>
                            <input type="text" id="id_order_all" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon">完成订单：</span>
                            <input type="text" id="id_order_wancheng" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon">完成率(%)：</span>
                            <input type="text" id="id_order_complete_type" class="form-control" readonly="readonly">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <!--<button type="button" class="btn btn-warning" onclick="changePrice()">更改比例</button>
                    <button type="button" class="btn btn-primary" onclick="returnBackSubmit()">确认提交</button>-->
                </div>
            </div>
        </div>
    </div>
</div>
<!--加盟商的完成率-->
<div>
    <div class="modal fade" id="id_order_rate_fran" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="id_courier_fran_model_title">完成率</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="control-label">选择时间：</label>
                        <select id="id_fran_select_time" class="form-control">
                            <option value="当日" selected="selected">当日</option>
                           <!-- <option value="当周">当周</option>
                            <option value="当月">当月</option>
                            <option value="当季">当季</option>
                            <option value="半年">半年</option>
                            <option value="整年">整年</option>
                            <option value="全部">全部</option>-->
                        </select>
                    </div>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <div class="input-group">
                            <ul class="nav nav-tabs nav-justified">
                                <li class="active">
                                    <button type="button" class="btn btn-warning" onclick="franCompleteRate()">计算</button>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon">全部订单：</span>
                            <input type="text" id="id_order_fran_all" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon">完成订单：</span>
                            <input type="text" id="id_order_fran_wancheng" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon">完成率(%)：</span>
                            <input type="text" id="id_order_fran_complete_type" class="form-control" readonly="readonly">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <!--<button type="button" class="btn btn-warning" onclick="changePrice()">更改比例</button>
                    <button type="button" class="btn btn-primary" onclick="returnBackSubmit()">确认提交</button>-->
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function showOrderRecord() {
        let clm=getTableSelectOne();
        runAjax("${ctx}/order/get/third/record","GET",{orderId:clm.orderId},function (res) {
            let txt="";
            res.body.forEach(function (item, index){
                txt+="<span style='color: #007aff'>"+item.changeTime+"</span>："+item.changeStatus+"<br>";
            });
            $("#id_third_info_model_body").html(txt);
            $("#id_third_info_model").modal("show");
        });
    }
    /**
     * 获取第三方配送信息
     */
    function showThirdDetail() {
        let clm=getTableSelectOne();
        runAjax("${ctx}/order/get/third/info","GET",{orderId:clm.orderId},function (res) {
           let detail=res.body;
           let txt="三方订单号："+detail.thirdNum+"("+detail.statusDesc+")，<br>"+detail.courierName+"："+detail.courierPhone+"。<br>"+detail.estimateTime;
           $("#id_third_info_model_body").html(txt);
            $("#id_third_info_model").modal("show");
        });
    }

    /**
     * 获取是第三方推送结果
     */
    function showThirdResult() {
        let clm=getTableSelectOne();
        runAjax("${ctx}/order/get/third/result","GET",{orderNum:clm.orderNum},function (res) {
            let detail=res.body;
            $("#id_third_info_model_body").html(detail);
            $("#id_third_info_model").modal("show");
        });
    }

    /**
     * 推送订单
     */
    function RePushShow() {
        let clm=getTableSelectOne();
        $("#id_order_model_order").val("订单编号："+clm.orderNum);
        $("#id_order_model").modal("show");
    }

    /**
     * 完成率
     */
    function CompleteRate() {
        let data={
            franName:$("#id_order_fran").val(),
            timeType:$("#id_order_select_time").val()
        }
        runAjax("${ctx}/order/get/order/complete/rate","get",data,function (res) {
            console.log("###########",res.body)
            let detail=res.body;
            $("#id_order_all").val(detail.allCunt);
            $("#id_order_wancheng").val(detail.completeCunt);
            $("#id_order_complete_type").val(detail.rate);
            $("#id_order_rate_model").modal("show");
            document.getElementById("js_load").style.display = "none";
        })
    }

    /**
     * 完成率
     */
    function franCompleteRate() {
        let data={
            timeType:$("#id_fran_select_time").val()
        }
        runAjax("${ctx}/order/get/order/fran/complete/rate","get",data,function (res) {
            console.log("###########",res.body)
            let detail=res.body;
            $("#id_order_fran_all").val(detail.allCunt);
            $("#id_order_fran_wancheng").val(detail.completeCunt);
            $("#id_order_fran_complete_type").val(detail.rate);
            $("#id_order_rate_fran").modal("show");
            document.getElementById("js_load").style.display = "none";
        })
    }

    /**
     * 推送提交
     */
    function RePush() {
        let clm=getTableSelectOne();
        let data={
            orderId:clm.orderId,
            type:$("#id_order_model_select_status").val()
        }
        runAjax("${ctx!}/order/repush","GET",data,function (res) {
            lightyear.notify('推送成功!', 'success');
            $("#id_order_model").modal("hide");
        });
    }
</script>
</body>
</html>