<div class="modal-header"> 
    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
    <h4 class="modal-title">批量设置返佣规则</h4>
</div>
<form id="commission_form" class="form-horizontal">
    <input type="hidden" name="ibMemberId" value="<?= $member['id'] ?>">
    <div class="modal-body">


        <div class="tabs-container">
            此操作将批量为代理<span style="color:red"><?= $member['name'] ?>(<?= $member['logins'] ?>)</span> 设置下属客户的返佣规则或差佣规则，请谨慎操作，记得选择设置类型
            <div class="tab-content">

                <div class="panel-body">

                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <tr>
                                <th>
                                    设置类型
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <select name="setType" id="setType" class="form-control">
                                        <option value="">--请选择--</option>
                                        <option value="direct">直属返佣</option>
                                        <option value="indirect">差佣</option>
                                    </select>
                                    <div id="subordinateIbDiv" style="display:none">
                                        <input name="subordinateIbLogins" type="number" class="form-control" placeholder="差佣关联的下级代理帐号" value="">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    FOREX
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <input name="CommissionForm[forex]" type="number" class="form-control" placeholder="FOREX每手佣金" value="">
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    METAL
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <input name="CommissionForm[metal]" type="number" class="form-control" placeholder="METAL每手佣金" value="">
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    CFD
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <input name="CommissionForm[cfd]" type="number" class="form-control" placeholder="CFD每手佣金" value="">
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    黄金（优先级比METAL高）
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <input name="CommissionForm[gold]" type="number" class="form-control" placeholder="黄金每手佣金" value="">
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    白银（优先级比METAL高）
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <input name="CommissionForm[silver]" type="number" class="form-control" placeholder="白银每手佣金" value="">
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    外佣
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <input name="CommissionForm[wy]" type="number" class="form-control" placeholder="外佣" value="">
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    股指
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <input name="CommissionForm[stock]" type="number" class="form-control" placeholder="股指" value="">
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    BTC
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <input name="CommissionForm[btc]" type="number" class="form-control" placeholder="BTC" value="">
                                </td>
                            </tr>
                        </table>
                    </div>

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



    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
        <button id="commission_submit" type="button" class="btn btn-primary">提交</button>
    </div>
</form>

<script type="text/javascript">


$("#commission_submit").on("click",function(){
    $(this).attr('disabled', 'disabled');
    var that = this;
    $.ajax({
        type: "POST",
        url: "/admin/ib/commission-volume-set-ajax",
        data: $('#commission_form').serialize(),
        dataType: "json",
        beforeSend: function() {},
        success: function(data) {
            if(data.code == 1){
                $("#modal").modal("hide");
                location.reload();
            }else{
                toastr.error(data.message, "提示");
            }
        },
        complete: function(XMLHttpRequest, textStatus) {
            $(that).removeAttr('disabled');
        },
        error: function() {}
    });
});

$("#setType").on("change",function(){
    if($("#setType").val()=='indirect'){
        $("#subordinateIbDiv").attr("style", "display:block");
    }else{
        $("#subordinateIbDiv").attr("style", "display:none");
    }
});

</script>