<!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">
                                    <button id="batch_finish" class="btn btn-success m-r-5"
                                            onclick="getEdit('table')"><i class="mdi mdi-check"></i>通过审核
                                    </button>
                                    <button id="batch_returnBack" class="btn btn-warning m-r-5"
                                            onclick="returnBack()"><i class="mdi mdi-check"></i>驳回申请
                                    </button>
                                    <button  class="btn btn-success m-r-5"
                                            onclick="getWithdrawal('table')"><i class="mdi mdi-check"></i>全职订单设置提现
                                    </button>
                                    <#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">
<!--选择驳回申请模态框-->
<div>
    <div class="modal fade" id="id_courier_returnBack_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 type="text" id="id_courier_returnBack_model_courier"  class="form-control" value="" disabled="disabled">
                        <!--<select id="id_order_model_select" class="selectpicker show-tick form-control" data-live-search="true">
                            <option value="0" selected="selected">请选择</option>
                        </select>-->
                    </div>
                    <div class="form-group">
                        <label class="control-label">驳回描述：</label>
                        <textarea type="text" id="id_courier_returnBack_model_desc"  class="form-control"></textarea>
                        <!--<select id="id_order_model_select" class="selectpicker show-tick form-control" data-live-search="true">
                            <option value="0" selected="selected">请选择</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="returnBackSubmit()">确认提交</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!--以下为业务流程处理-->
<script>
    /**
     * 修改多个配送员的状态
     * @param table
     */
    function getEdit(table) {
        //点击确认
        let clm=getTableSelectOne()
        $.confirm({
            title: '确认提醒',
            content: '骑手类型切换审核，请确认该派送员订单是否已结算成功，是否继续？',
            type: 'blue',
            typeAnimated: true,
            buttons: {
                tryAgain: {
                    text: '继续',
                    btnClass: 'btn-blue',
                    action: function(){
                        sendAjax("${ctx!}/courier/type/getAdopt","get",{examineId:clm.examineId});
                    }
                },
                close: {
                    text: '放弃'
                }
            }
        });
    }


    /**
     * 全职派送员切换类型时先设置提现
     * @param table
     */
    function getWithdrawal(table) {
        //点击确认
        let clm=getTableSelectOne()
        $.confirm({
            title: '确认提醒',
            content: '骑手类型切换审核，请确认该派送员订单是否已结算成功，是否继续？',
            type: 'blue',
            typeAnimated: true,
            buttons: {
                tryAgain: {
                    text: '继续',
                    btnClass: 'btn-blue',
                    action: function(){
                        sendAjax("${ctx!}/courier/type/setwithdrawal","get",{examineId:clm.examineId});
                    }
                },
                close: {
                    text: '放弃'
                }
            }
        });
    }

    /**
     * 弹出驳回申请模态框
     */
    function returnBack() {
        let column=getTableSelectOne();
        $("#id_courier_returnBack_model_courier").val(column.courierName+"("+column.courierPhone+")");
        $("#id_courier_returnBack_model").modal("show");
    }

    /**
     * 驳回审核提交
     */
    function returnBackSubmit() {
        let column=getTableSelectOne();
        console.log(column);
        let data={
            examineId:column.examineId,
            desc:$("#id_courier_returnBack_model_desc").val()
        }
        runAjax("${ctx}/courier/type/getReject","post",data,function (data) {
            $("#id_courier_returnBack_model").modal("hide");
            lightyear.notify('操作成功!', 'success');
            search();
        })
    }
</script>
</body>
</html>