<!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>
</div>
</div>
<div aria-labelledby="exampleModalLabel" class="modal fade" id="id_send_msg_model" role="dialog" tabindex="-1" >
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button aria-label="Close" class="close" data-dismiss="modal" type="button"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="exampleModalLabel">发送短信</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="input-group">
                            <span class="input-group-addon">接收号码：</span>
                            <input id="id_send_msg_phone" placeholder="请填写接收号码..." class="form-control" type="text" onkeyup="this.value=this.value.replace(/\D/g,'')" maxlength="11">
                        </div>
                    </div>
                </div>
                </br>
                <div class="row">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <label>短信内容：</label>
                            <textarea class="form-control" rows="3" id="id_send_msg_text" placeholder="请填写短信内容......">哈哈哈哈
                            </textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal" type="button">关闭</button>
                <button class="btn btn-primary" type="button" onclick="sendMsg()">发送消息</button>
            </div>
        </div>
    </div>
</div>
<#include "/include/footer.html">
<#include "/include/table/table-event.html">
<#include "/include/table/table-model.html">
<script>

    /**
     * 处理营销骑手发送短信
     **/
    function handle(){
        let clm=getTableSelectOne();
        $.confirm({
            title: '更改数据',
            content: '您即将执行更改操作，是否继续？',
            type: 'blue',
            typeAnimated: true,
            buttons: {
                tryAgain: {
                    text: '继续',
                    btnClass: 'btn-blue',
                    action: function(){
                        sendAjax("${ctx}/invitejoin/send/out","get",{joinId:clm.joinId});
                    }
                },
                close: {
                    text: '放弃'
                }
            }
        });
    }
    /**
     * 发送短信预览
     */
    function sendMsgView() {
        let clm=getTableSelectOne();
        $("#id_send_msg_text").val("您好，已收到您的合作申请，但无法拨通您的电话！如有意向，请回电至商务客服电话：16604712000");
        $("#id_send_msg_phone").val(clm.joinPhone);
        $("#id_send_msg_model").modal("show");
    }
    /**
     * 发送短信
     */
    function sendMsg(){
        let phone=$("#id_send_msg_phone").val();
        let text=$("#id_send_msg_text").val();
        if (phone.length<11){
            lightyear.notify("手机号码不正确，请重新输入！", 'danger');return;
        }
        if (text.length<1){
            lightyear.notify("请输入短信内容！", 'danger');return;
        }
        document.getElementById("js_load").style.display = "inline";
        runAjax("${ctx}/invitejoin/get/send/msg","GET",
            {
                "phone":phone,
                "text":text
            },
            function (res){
                document.getElementById("js_load").style.display = "none";
                lightyear.notify("发送成功", 'info');
                $("#id_send_msg_model").modal("hide");
                let clm=getTableSelectOne();
                sendAjax("${ctx}/invitejoin/send/out","get",{joinId:clm.joinId});
            });
    }


    /**
     * 删除加盟数据
     */
    function delJoin(){
        let clm=getTableSelectOne();
        $.confirm({
            title: '删除数据',
            content: '您即将执行删除操作，是否继续？',
            type: 'blue',
            typeAnimated: true,
            buttons: {
                tryAgain: {
                    text: '继续',
                    btnClass: 'btn-blue',
                    action: function(){
                        sendAjax("${ctx}/invitejoin/del/join","get",{joinId:clm.joinId});
                    }
                },
                close: {
                    text: '放弃'
                }
            }
        });
    }

</script>
</body>
</html>