@extends('vip.layouts')
@section('seo_title')
    投注金额设置
@endsection
@section('content')
    <style>
        .layui-laydate-range {
            width: auto;
        }
    </style>

    @push('dataTableJS')
        var active = {
        reload: function(){
        //执行重载
        table.reload('{{ $dataId }}', {
        page: {
        curr: 1 //重新从第 1 页开始
        }
        ,where: {
        name:$('#name').val(),
        }
        });
        }
        };
        $('.lay-btn-diy').on('click', function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
        });

        //重置表单
        $('.reset').on('click',function(){
        $('input').val('');
        $('#name').val('');
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
        });

        //刷新表单
        $('.set').on('click',function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
        });


        var menu = [];
        $.ajax({
        type: 'get',
        url: '/admin/info/getgame',
        data: {},
        dataType: 'json',
        async: false,
        success: function (json) {
        menu = json;
        }
        });

        layui.tree({
        elem: '#tree' //传入元素选择器
        , click: function (item) { //点击节点回调
        //layer.msg('当前节名称：' + item.id);

        // 加载中...
        var loadIndex = layer.load(2, {shade: true});

        $('.addTo').attr('game',item.game_name);
        //这里以搜索为例
        tableIns.reload({
        where: { //设定异步数据接口的额外参数，任意设
            game:item.game_name
        }
        ,page: {
        curr: 1 //重新从第 1 页开始
        }
        });

        // 关闭加载
        layer.close(loadIndex);


        }
        , nodes: menu.data
        });

        $(document).on('click','.addTo',function(){
            var gameName=$(this).attr('game');
            openWin('/admin/info/add?game='+gameName)
        })

    @endpush

    <!---注单管理-->
    <div class="layui-row">
        <div class="layui-col-xs12">

            <form class="layui-form rewrite" action="" eventType=eventForm>
                <div class="layui-form-item">
                    <div class="layui-elem-quote layui-quote-nm">
                        <p>单注最小金额:用户单次投注金额不能小于最小金额，如果小于则不能投注。如果不想限制用户最小金额，请设置为0。</p>

                        <p>单注最大金额:用户单次投注金额不能大于最大金额，如果大于则不能投注。如果不想限制用户最大金额，请设置为99999。</p>

                        <p>用户投注金额大于反水最小金额，将获得反水。例如：用户投注六合彩600，最小反水金额为500，反水比例0.01，用户会得到反水6=600*0.01。</p>

                        <p>特别提醒：彩票反水比例设置0.01，反水1%。</p>
                    </div>

                <div class="layui-inline">
                    <a href="/admin/gameBet/add?grade={{$grade}}" class="layui-btn layui-btn-sm">添加</a>
                </div>
                    <div class="layui-inline">
                            <label class="layui-form-label">{{ trans('gamemenu.grade_name') }}</label>
                            <div class="layui-input-inline">
                                <select name="grade" id="form_grade" autocomplete="off" eventType="event-query">
                                 @foreach($gradeArray as $k=>$v):
                                    <option value="{{$k}}" @if($grade==$k) selected @endif>{{$v}}</option>
                                 @endforeach
                                </select>
                            </div>
                        <div class="layui-inline">
                            <a class="layui-btn layui-btn-sm lay-btn-diy" data-type="reload" eventType="event-query-submit"
                               style="opacity: 1; pointer-events: auto;">提交</a>
                            <a class="layui-btn   layui-btn-sm  layui-btn-normal reset" data-type="reload"
                               style="opacity: 1; pointer-events: auto;">重置</a>
                            <a class="layui-btn layui-btn-sm layui-btn-green set" data-type="reload" style="opacity: 1; pointer-events: auto;">
                                <i class="layui-icon">ဂ</i>
                            </a>
                        </div>
                    </div>
                </div>
            </form>
            <!--------处理工具------->

            <script type="text/html" id="tools">
                <a class="layui-btn layui-btn-primary layui-btn-xs edit" lay-event="detail" pid="id" uri="/admin/gameBet/edit/?id=" href="/admin/gameBet/edit/?id=@{{ d.id }}&grade=@{{ d.grade }}"> 修改 </a>
            </script>
            @include('vip.datatable')
        </div>
    </div>
<style>
.layui-body{overflow-y: scroll;}
body{overflow-y: scroll;}
</style>


@endsection
