@extends('vip.layouts')
@section('seo_title')
    足球串关注单管理
@endsection
@section('content')
    <style>
        .layui-laydate-range {
            width: auto;
        }

        .layui-form-switch em {
            width: auto;
        }
        .layui-form-switch {
            width: 44px;
            line-height: 23px;
        }
        .layui-form-item .checkbox {
            width: auto;
        }

        .red{
            color: red;
        }
        .blue{
            color: #1E9FFF;
        }
        .green{
            color: green;
        }
        .yellow{
            color: #ffca10;
        }

        .red{
            color: red;
        }
        .blue{
            color: #1E9FFF;
        }
        .green{
            color: green;
        }
        .yellow{
            color: #ffca10;
        }
        .bottom-txt{
            padding: 0.5em;
            line-height: 2em;
        }
        table{
            text-align: center;
        }
        th div{
            text-align: center;
        }
        tbody span{
            color: #FF5722;
        }
        .resettlement{
            background-color: #FF5722;
        }
        .settlement{
            background-color: #FF5722;
        }
        .invalid{
            background-color: #FF5722;
        }
    </style>

    <script type="text/html" id="status">
        @if(checkRriv('/admin/SportsSoccer/score'))<input type="checkbox" name="status" value="@{{d.id}}" lay-skin="switch" lay-text="进行中|已结束" lay-filter="openStatus" @{{ d.status == '1' ? 'checked' : '' }}>@endif
    </script>

    <div class="layui-row">
        <div class="layui-col-xs12">
            <form class="layui-form rewrite" eventType="eventForm"  action="" method="get">
                <div class="layui-form-item">

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('sportsnotelist.account') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="account" id="account" eventType="event-query"  value="{{ $account }}" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-input-inline checkbox">
                            <input type="checkbox" name="sureblur" id="form_sureblur" lay-skin="switch" lay-text="精确|模糊" @if(!isset($sureblurs) || $sureblurs=='on') checked @endif  class="layui-input" eventType=event-query>
                            <input type="hidden" name="sureblurs" id="form_sureblurs" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $sureblurs }}">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('sportsnotelist.date') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="star_time" value="{{ $star_time }}" id="form_star_time" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query>
                        </div>
                    </div>~
                    <div class="layui-inline">
                        {{--<label class="layui-form-label">{{ trans('sportsnotelist.end_time') }}</label>--}}
                        <div class="layui-input-inline">
                            <input type="text" name="end_time" value="{{ $end_time }}" id="end_time" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query>
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('sportsnotelist.order_id') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="order_id" id="order_id" eventType="event-query"  value="{{ $order_id }}" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('sportsnotelist.ifsettlement') }}</label>
                        <div class="layui-input-inline" style="width: 100px">
                            <select name="status"  id="form_status"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
                                <option value="-1"></option>
                                @foreach(trans('status.ifsettlement.status') as $k=>$v):
                                @if($status==$k))
                                <option value="{{$k}}" selected="selected">{{$v}}</option>
                                @else
                                    <option value="{{$k}}">{{$v}}</option>
                                @endif
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('sportsnotelist.order_status') }}</label>
                        <div class="layui-input-inline" style="width: 100px">
                            <select name="order_status"  id="form_order_status"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
                                <option value="-1"></option>
                                @foreach(trans('status.order_status.status') as $k=>$v):
                                @if($order_status==$k))
                                <option value="{{$k}}" selected="selected">{{$v}}</option>
                                @else
                                    <option value="{{$k}}">{{$v}}</option>
                                @endif
                                @endforeach
                            </select>
                        </div>
                    </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>
                        {{--@if(checkRriv('/admin/SoccerstringNoteList/batchsettlement'))<a href="javascript:batchsettlement('/admin/SoccerstringNoteList/batchsettlement');" class="layui-btn layui-btn-sm  layui-btn-danger">批量结算</a>@endif--}}
                        <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>
                        {{--@if(checkRriv('/admin/SoccerstringNoteList/add'))<a href="/admin/SoccerstringNoteList/add" class="layui-btn layui-btn-sm ">添加</a>@endif--}}
                        @if(checkRriv('/admin/SoccerstringNoteList/delete'))<a href="javascript:delWin('/admin/SoccerstringNoteList/delete?id=');" class="layui-btn layui-btn-sm  layui-btn-danger">删除</a>@endif
                    </div>

                    <!-- &nbsp;&nbsp;&nbsp;&nbsp;<div class="layui-inline"><a href="javascript:openWin('/admin/user/infoAdd','{{ trans('menu.menu_add') }}','700px','500px')" class="layui-btn layui-btn-sm  ">添加</a></div>
                    <div class="layui-inline"><a href="/admin/menu/add" class="layui-btn layui-btn-sm  layui-btn-danger">删除</a></div> -->

                </div>
            </form>
        </div>
    </div>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script>
        $(function () {
            $('body').on('click', 'a[eventtype="event-delete"]', function () {
                var span = $(this).prev();
                var id = span.attr('data-id');
                // openWin('/admin/system/AddMenu','{{ trans("menu.menu_edit")}}','600px','500px',id);
            })
            $('body').on('click','#form_sureblur~.layui-form-switch',function(){
                var sus = $('#form_sureblur').next().text();
                if(sus=='精确'){
                    $('#form_sureblurs').val('on');
                }else{
                    $('#form_sureblurs').val('off');
                }
            })
        })
    </script>
    @push('dataTableJS')
    /*var active = {
    reload: function(){
    //执行重载
    console.log($('#form_status').val());
    table.reload('{{ $dataId }}', {
    page: {
    curr: 1 //重新从第 1 页开始
    }
    ,where: {
    account_name:$("#form_account_name").val(),
    order_id:$('#form_order_id').val(),
    bank_user:$('#form_bank_user').val(),
    money_small:$('#form_money_small').val(),
    money_big:$('#form_money_big').val(),
    status:$('#form_status').val(),
    apply_startime:$('#form_apply_startime').val(),
    apply_endtime:$('#form_apply_endtime').val(),
    haddle_startime:$('#form_haddle_startime').val(),
    haddle_endtime:$('#form_haddle_endtime').val(),
    sureblur:$('.layui-form-switch').text(),
    }
    });
    }
    };*/
    //$('.lay-btn-diy').on('click', function(){
    //	var type = $(this).data('type');
    //	active[type] ? active[type].call(this) : '';
    //});

    //重置表单
    $('.reset').on('click',function(){
    $('input').val('');
    $('#form_status').val('3');
    $('.layui-form-select input').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) : '';
    });


    function dataTableLoadFinished(res,curr,count){
    var str='';
    if(document.getElementById("statistics")){

    }else{
    $('.layui-table-page').after('<div id="statistics"></div>');
    }
    $.ajax({
    type: 'get',
    url: '/admin/SoccerStringNoteList/moneycount',
    data: {where:res.extras},
    dataType: 'json',
    //async: false,
    success: function (data) {
    var data=data.data;
    for(var i in data){
    data[i]=parseFloat(data[i]);
    }
    str+='<p class="bottom-txt">总投注金额：<span class="blue">'+data.all_money+'</span> , 总可赢金额：<span class="red">'+data.all_prize_money+'</span> , 已赢金额：<span class="green">'+data.alraedy_prize_money+'</span></p>'
    $('#statistics').html(str);
    var height1=$('.layui-table-view').height();
    var height2=$('#statistics').height();

    $('.layui-table-view').css({height:(height1+height2)});
    }
    });


    }

    @endpush

    <script type="text/javascript">
        //批量结算
        function batchsettlement(url) {
            layer.confirm('是否确认批量结算？', {
                btn: ['确认', '取消'] //按钮
            }, function() {
                $.getJSON(url, function(data, textStatus) {
                    if (data.status == '1') {
                        reloadDataTable();
                        layer.msg('批量结算成功');
                    } else {
                        layer.msg(data.msg);
                    }
                });
            }, function() {

            });

        }
        //串关注单结算
        function settlement(url,ids) {
            layer.confirm('是否确认结算？', {
                btn: ['确认', '取消'] //按钮
            }, function() {
                $.getJSON(url, function(data, textStatus) {
                    //console.log(data);
                    if (data.status == '1') {
                        reloadDataTable();
                        layer.msg('结算成功');
                    } else {
                        layer.msg(data.msg);
                    }
                });
            }, function() {

            });

        }
        //重新结算
        function resettlement(url) {
            layer.confirm('是否确认重新结算？', {
                btn: ['确认', '取消'] //按钮
            }, function() {
                $.getJSON(url, function(data, textStatus) {
                    console.log(data);
                    if (data.status == '1') {
                        reloadDataTable();
                        layer.msg('重新结算成功');
                    } else {
                        layer.msg(data.msg);
                    }
                });
            }, function() {

            });

        }

        //串关注单作废
        function invalid(url,ids) {
            layer.confirm('是否确认作废？', {
                btn: ['确认', '取消'] //按钮
            }, function() {
                $.getJSON(url, function(data, textStatus) {
                    //console.log(data);
                    if (data == '1') {
                        reloadDataTable();
                        layer.msg('作废成功');
                    } else {
                        layer.msg(data.msg);
                    }
                });
            }, function() {

            });

        }
    </script>

    @include('vip.datatable')
@endsection
