@extends('vip.layouts')
@section('seo_title')
    棒球赛事
@endsection
@section('content')
    <script type="text/html" id="newtime">
      @{{#if(d.match_id!=null){ }}
        <span>@{{ d.match_id}}</span>
      @{{#} }}<br>
      @{{#if(d.saisname!=null){ }}
        <span>@{{ d.saisname}}</span>
      @{{#} }}
    </script>

    <script type="text/html" id="totime">
      @{{#if(d.start_time!=null){ }}
        <span>@{{ d.start_time}}</span>
      @{{#} }}
    </script>

    <script type="text/html" id="match_score">
        <!--
            <input type="text" style="width:30px;heigth:20px" id="u_home_score@{{d.match_id}}" name="u_home_score" value="@{{d.u_home_score}}"> 
            <input type="text" style="width:30px;heigth:20px" id="u_guest_score@{{d.match_id}}" name="u_guest_score" value="@{{d.u_guest_score}}"> / -->
            <input type="text" style="width:30px;heigth:20px" id="home_score@{{d.match_id}}" name="home_score" value="@{{d.manual_result.all.home}}" readonly="readonly">
            <input type="text" style="width:30px;heigth:20px" id="guest_score@{{d.match_id}}" name="guest_score" value="@{{d.manual_result.all.guest}}" readonly="readonly">
            <input type="hidden" style="width:30px;heigth:20px" id="match_status@{{d.match_id}}" name="guest_score" value="@{{d.status}}">
        <!--
            <button class="layui-icon" onclick="teamscore(@{{d.match_id}})"><h6>提交</h6></button> -->
    </script>

    <script type="text/html" id="dsnum">
        <span><a href="/admin/SoccerNoteList/notelist?type=bq&match_id=@{{d.match_id}}&game_code=bq"> @{{ d.numsim}}</a></span>
    </script>

    <script type="text/html" id="csnum">
        <span><a href="/admin/SoccerStringNoteList/notelist?match_id=@{{d.match_id}}&game_code=bq"> @{{ d.numstr}}</a></span>
    </script>

    <script type="text/html" id="statusmatch">
    @{{#if(d.status==0){ }}
        <span>未开始</span>
      @{{#} }}
      @{{#if(d.status==1){ }}
        <span>进行中</span>
      @{{#} }}
      @{{#if(d.status==2){ }}
        <span>已结束</span>
      @{{#} }}
      @{{#if(d.status==3){ }}
        <span>已结算</span>
      @{{#} }}
      @{{#if(d.status==4){ }}
        <span>已作废</span>
      @{{#} }}
      @{{#if(d.status==5){ }}
        <span>待结算</span>
      @{{#} }}
      @{{#if(d.status==6){ }}
        <span>已取消</span>
      @{{#} }}
    </script>

    <script type="text/html" id="operation">
        <a href="javascript:;" onclick="addResult(@{{d.match_id}})" class="layui-btn layui-btn-sm">赛事结果</a>
        @{{#if(d.status==0 || d.status==1 || d.status==2 || d.status==3){ }}
            @{{#if(d.status==0 || d.status==1 || d.status==2){ }}
                {{--<a href="javascript:;" onclick="settlement(@{{d.match_id}},'bq')" class="layui-btn layui-btn-sm">结算</a>--}}
        <a href="javascript:;" onclick="settleopen(@{{d.match_id}},'bq')" class="layui-btn layui-btn-sm">结算</a>
            @{{#} }}
            @{{#if(d.status==3){ }}
                {{--<a href="javascript:;" onclick="settlement(@{{d.match_id}},'bq')" class="layui-btn layui-btn-sm">再结算</a>--}}
        <a href="javascript:;" onclick="settleopen(@{{d.match_id}},'bq')" class="layui-btn layui-btn-sm">再结算</a>
            @{{#} }}
        @{{#} }}
        <!--
        @{{#if(d.status!=4 && d.status!=3){ }}
        <a href="javascript:;" onclick="revoke(@{{d.match_id}})" class="layui-btn layui-btn-sm layui-btn-danger">作废</a>
        @{{#} }}
        @{{#if(d.status==4){ }}
        <a href="javascript:;" onclick="revoke(@{{d.match_id}})" class="layui-btn layui-btn-sm layui-btn-danger">已作废</a>
        @{{#} }}
        -->
        <a href="javascript:;" onclick="resultLog(@{{d.match_id}})" class="layui-btn layui-btn-sm">比分记录</a>
    </script>

    <script type="text/html" id="status">
        @if(checkRriv('/admin/sportsbk/index'))<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="">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('sportsbk.sousuo') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="home_team" id="home_team" eventType="event-query"  value="{{ $home_team }}" lay-verify="required" autocomplete="off" class="layui-input" placeholder="赛事id/主队名">
                        </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('sportsbk.status') }}</label>
                        <div class="layui-input-inline" style="width: 200px">
                            <select name="status"  id="form_status"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
                                <option value="-1">{{ trans('sportsbk.select_status') }}</option>
                                @foreach(trans('status.match_operation.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('sportsbk.if_order') }}</label>
                        <div class="layui-input-inline" style="width: 200px">
                            <select name="if_order"  id="if_order"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
                                @foreach(trans('status.if_order.status') as $k=>$v):
                                @if($if_order==$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('sportsfoot.star_time') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="star_time" value="{{ $star_time }}" id="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('sportsfoot.end_time') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="end_time"  value="{{$end_time}}" id="end_time" placeholder=" - " word-break: break-all; lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query>
                        </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>
                        <a class="layui-btn layui-btn-sm layui-btn-green" data-type="reload" onclick="refreshall('bq')" style="opacity: 1; pointer-events: auto;">刷新赛事</a>
                        <!--@if(checkRriv('/admin/sportsbk/addoutcome'))<a href="/admin/sportsbk/addoutcome" class="layui-btn layui-btn-sm ">添加</a>@endif -->
                        @if(checkRriv('/admin/sportsbq/deleteoutcome'))<a href="javascript:delWin('/admin/sportsbq/deleteoutcome?id=');" class="layui-btn layui-btn-sm  layui-btn-danger">删除</a>@endif
                        {{--@if(checkRriv('/admin/sportsbq/Settlementlq'))<a href="javascript:allbalance('/admin/sportsbq/Settlementlq?allhalf=1&id=');" class="layui-btn layui-btn-sm set">结算全场</a>@endif--}}
                        {{--@if(checkRriv('/admin/sportsbq/Settlementlq'))<a href="javascript:allbalance('/admin/sportsbq/Settlementlq?allhalf=2&id=');" class="layui-btn layui-btn-sm">结算上半场</a>@endif--}}
                        {{--@if(checkRriv('/admin/sportsbq/Settlementlq'))<a href="javascript:allbalance('/admin/sportsbq/Settlementlq?allhalf=2&id=');" class="layui-btn layui-btn-sm set">重新结算上半场</a>@endif--}}
                    </div>
                </div>
            </form>
        </div>
    </div>

    <style>

        .layui-btn{
            margin: 3px 10px 3px 0px;
        }

        .layui-btn+.layui-btn {
            margin-left: 0px;
        }
        .log_title{

        }

        .log_head_div{
            font-size: 17px;
            margin-bottom: 5px;
        }
        .log_content_div td{
            padding: 5px;
            border: 1px solid #888888;
        }

        hr{
            margin: 14px 0;
        }
    </style>
	<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');
            	}
            })
        })

        //layer弹窗开始
        let conttxt = '';
        let layerOpen = '';
        function addResult(match_id){
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/Sportsbq/Matchresult',
                data: {match_id:match_id},
                success: function(data) {
                    conttxt ='<div id="scores" style="margin-left:80px;margin-top:20px;font-size:18px;line-height:150%;"><input type="hidden" id="match_id" name="match_id" value="'+match_id+'" /><div style="display: flex;"><li>第一局比分(主/客)：</li><input style="width:50px;" type="text" id="homea" name="homea" value="'+data.bqresult[1]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guesta" name="guesta" value="'+data.bqresult[1]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第二局比分(主/客)：</li><input style="width:50px;" type="text" id="homeb" name="homeb" value="'+data.bqresult[2]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestb" name="guestb" value="'+data.bqresult[2]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第三局比分(主/客)：</li><input style="width:50px;" type="text" id="homec" name="homec" value="'+data.bqresult[3]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestc" name="guestc" value="'+data.bqresult[3]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第四局比分(主/客)：</li><input style="width:50px;" type="text" id="homed" name="homed" value="'+data.bqresult[4]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestd" name="guestd" value="'+data.bqresult[4]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第五局比分(主/客)：</li><input style="width:50px;" type="text" id="homee" name="homee" value="'+data.bqresult[5]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="gueste" name="gueste" value="'+data.bqresult[5]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第六局比分(主/客)：</li><input style="width:50px;" type="text" id="homef" name="homef" value="'+data.bqresult[6]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestf" name="guestf" value="'+data.bqresult[6]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第七局比分(主/客)：</li><input style="width:50px;" type="text" id="homeg" name="homeg" value="'+data.bqresult[7]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestg" name="guestg" value="'+data.bqresult[7]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第八局比分(主/客)：</li><input style="width:50px;" type="text" id="homeh" name="homeh" value="'+data.bqresult[8]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guesth" name="guesth" value="'+data.bqresult[8]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第九局比分(主/客)：</li><input style="width:50px;" type="text" id="homei" name="homei" value="'+data.bqresult[9]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guesti" name="guesti" value="'+data.bqresult[9]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第十局比分(主/客)：</li><input style="width:50px;" type="text" id="homej" name="homej" value="'+data.bqresult['other']['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestj" name="guestj" value="'+data.bqresult['other']['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>前五局比分(主/客)：</li><input style="width:50px;" type="text" id="homek" name="homek" value="'+data.bqresult['five']['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestk" name="guestk" value="'+data.bqresult['five']['guest']+'" autocomplete="off"></div><div style="display: flex;"><li style="margin-left:1.1rem;">全场比分(主/客)：</li><input style="width:50px;" type="text" id="homel" name="homel" value="'+data.bqresult['all']['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestl" name="guestl" value="'+data.bqresult['all']['guest']+'" autocomplete="off"></div>';
                    
                    conttxt += '<br><div style="margin-left:230px;"><button class="layui-btn layui-btn-sm set" id="buttonClick" onclick="buttonClick()"><h3>确定</h3></button>&nbsp;<button onclick="czClick()" class="layui-btn layui-btn-sm layui-btn-danger" id="reset"><h3>取消</h3></button></div></div>';
                
                    layerOpen = layer.open({
                      type: 1 //Page层类型
                      ,area: ['500px', '460px']
                      ,title: '<h2>赛事结果修改<h2>'
                      ,shade: 0.6 //遮罩透明度
                      ,maxmin: true //允许全屏最小化
                      ,anim: 1 //0-6的动画形式，-1不开启
                      ,content:conttxt
                    });
//                    if(data.newapp.status == 0 || data.newapp.status == 1 || data.newapp.status == 6){
//                        $('#scores input').val('');
//                    }
                }
            }) 
        }
        function czClick() {
            layer.close(layerOpen)
        }
        //layer弹窗结束
        
        function buttonClick(){
//             $("#buttonClick").attr('disabled', true);

            var match_id = $("#match_id").val();
            var homea = $("#homea").val();
            var guesta = $("#guesta").val();
            var homeb = $("#homeb").val();
            var guestb = $("#guestb").val();
            var homec = $("#homec").val();
            var guestc = $("#guestc").val();
            var homed = $("#homed").val();
            var guestd = $("#guestd").val();
            var homee = $("#homee").val();
            var gueste = $("#gueste").val();
            var homef = $("#homef").val();
            var guestf = $("#guestf").val();
            var homeg = $("#homeg").val();
            var guestg = $("#guestg").val();
            var homeh = $("#homeh").val();
            var guesth = $("#guesth").val();
            var homei = $("#homei").val();
            var guesti = $("#guesti").val();
            var homej = $("#homej").val();
            var guestj = $("#guestj").val();
            var homek = $("#homek").val();
            var guestk = $("#guestk").val();
            var homel = $("#homel").val();
            var guestl = $("#guestl").val();

            if(homea == -1 && guesta != -1 || homea != -1 && guesta == -1 || homea<-1 || guesta<-1){
                layer.alert('请输入正确的第一局比分');
                return false;
            }
            if(homeb == -1 && guestb != -1 || homeb != -1 && guestb == -1 || homeb<-1 || guestb<-1){
                layer.alert('请输入正确的第二局比分');
                return false;
            }
            if(homec == -1 && guestc != -1 || homec != -1 && guestc == -1 || homec<-1 || guestc<-1){
                layer.alert('请输入正确的第三局比分');
                return false;
            }
            if(homed == -1 && guestd != -1 || homed != -1 && guestd == -1 || homed<-1 || guestd<-1){
                layer.alert('请输入正确的第四局比分');
                return false;
            }
            if(homee == -1 && gueste != -1 || homee != -1 && gueste == -1 || homee<-1 || gueste<-1){
                layer.alert('请输入正确的第五局比分');
                return false;
            }
            if(homef == -1 && guestf != -1 || homef != -1 && guestf == -1 || homef<-1 || guestf<-1){
                layer.alert('请输入正确的第六局比分');
                return false;
            }
            if(homeg == -1 && guestg != -1 || homeg != -1 && guestg == -1 || homeg<-1 || guestg<-1){
                layer.alert('请输入正确的第七局比分');
                return false;
            }
            if(homeh == -1 && guesth != -1 || homeh != -1 && guesth == -1 || homeh<-1 || guesth<-1){
                layer.alert('请输入正确的第八局比分');
                return false;
            }
            if(homei == -1 && guesti != -1 || homei != -1 && guesti == -1 || homei<-1 || guesti<-1){
                layer.alert('请输入正确的第九局比分');
                return false;
            }
            if(homej == -1 && guestj != -1 || homej != -1 && guestj == -1 || homej<-1 || guestj<-1){
                layer.alert('请输入正确的第十局比分');
                return false;
            }
            if(homek == -1 && guestk != -1 || homek != -1 && guestk == -1 || homek<-1 || guestk<-1){
                layer.alert('请输入正确的前五局比分');
                return false;
            }
            if(homel == -1 && guestl != -1 || homel != -1 && guestl == -1 || homel<-1 || guestl<-1){
                layer.alert('请输入正确的全场比分');
                return false;
            }


            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/Sportsbq/addend',
                data: {match_id:match_id,homea:homea,guesta:guesta,homeb:homeb,guestb:guestb,homec:homec,guestc:guestc,homed:homed,guestd:guestd,homee:homee,gueste:gueste,homef:homef,guestf:guestf,homeg:homeg,guestg:guestg,homeh:homeh,guesth:guesth,homei:homei,guesti:guesti,homej:homej,guestj:guestj,homek:homek,guestk:guestk,homel:homel,guestl:guestl},
                success: function(data) {
                    layer.msg(data.msg);
                    location. reload()//刷新当前页面
                                
                }
            })
        }

        //刷新赛事数据
        function refreshall(game_code){ 
            var game_code = game_code;
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/setSports',
                data: {game_code:game_code},
                success: function(data) {
                    var data = JSON.stringify(data);
                    if(data){
                        if(data.msg){
                            layer.msg(data.msg);
                        }
                        location. reload()//刷新当前页面
                    }
                }
            })
        }

        //撤销
        function revoke(match_id){
            var match_id = match_id;
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/Sportsbq/revoke',
                data: {match_id:match_id},
                success: function(data) {
                    if(data.status==1){
                        layer.msg(data.msg);
                        location. reload()//刷新当前页面
                    }
                }
            })
        }

        //结算 
        function settlement(match_id,type){
            var match_id = match_id;
            var type = type;
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/Sportsbq/Settlement',
                data: {match_id:match_id,type:type},
                success: function(data) {
                    if(data.status==1){
                        layer.msg(data.msg);
                        location. reload()//刷新当前页面
                    }else if(data.status==2){
                        layer.msg(data.msg);
                        reloadDataTable();return;
                    }else if(data.status==4){
                        layer.msg(data.msg);
                        reloadDataTable();return;
                    }else{
                        layer.msg(data.msg);
                        reloadDataTable();return;
                    }
                }
            })
        }

        //修改赛事比分  only:唯一 num:inputval match_id:match_id
        function teamscore(match_id){
            var match_id = match_id;
            var u_home_score = document.getElementById("u_home_score"+match_id).value;
            var u_guest_score = document.getElementById("u_guest_score"+match_id).value;
            var home_score = document.getElementById("home_score"+match_id).value;
            var guest_score = document.getElementById("guest_score"+match_id).value;
            var match_status = document.getElementById("match_status"+match_id).value;

            // var reg = /^[0-99]\d*$/;

            // if(reg.test(num)==false){ 
            //     layer.msg('不能为空值');
            //     reloadDataTable();return;
            // }

            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/Sportsbq/updatascore',
                data: {match_id:match_id,u_home_score:u_home_score,u_guest_score:u_guest_score,home_score:home_score,guest_score:guest_score,match_status:match_status},
                success: function(data) {
                    /*
                    if(data.status==1){
                        layer.msg(data.msg);
                        location. reload()//刷新当前页面
                    }
                    */
                    layer.msg(data.msg);
                    location. reload()//刷新当前页面
                }
            })
        }

        //layer弹窗开始
        let resultLogOpen = '';
        function resultLog(match_id){
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/Sportsbq/resultLog',
                data: {match_id:match_id},
                success: function(data) {
                    let length = data.list.length;
                    if(length <= 0){
                        layer.alert('该赛事还没有比分记录');
                        return false;
                    }

                    let html = '';
                    let info = '';
                    for(let i=0; i<length; i++){
                        info = data['list'][i];
                        if(info.type == 1){ //结果

                            html +='<div style="margin-left: 20px;margin-right: 20px;"><div class="log_head_div"><span class="log_title">修改人</span>：'+info['loginname']+'&nbsp;&nbsp;&nbsp;<span class="log_title">添加时间：</span>'+info['create_at']+'&nbsp;&nbsp;&nbsp;<span class="log_title">添加类型</span>：赛事结果</div>'
                                    +'<div class="log_content_div"><table><tr>' +
                                '<td>第一局比分(主/客)</td>' +
                                '<td>第二局比分(主/客)</td>' +
                                '<td>第三局比分(主/客)</td>' +
                                '<td>第四局比分(主/客)</td>' +
                                '<td>第五局比分(主/客)</td>' +
                                '<td>第六局比分(主/客)</td>' +
                                '<td>第七局比分(主/客)</td>' +
                                '<td>第八局比分(主/客)</td>' +
                                '<td>第九局比分(主/客)</td>' +
                                '<td>第十局比分(主/客)</td>' +
                                '<td>前五局比分(主/客)</td>' +
                                '<td>全场比分(主/客)</td>' +
                                '</tr><tr>' +
                                '<td>'+info['match_score_t'][1]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][1]['guest']+'</td>' +
                                '<td>'+info['match_score_t'][2]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][2]['guest']+'</td>' +
                                '<td>'+info['match_score_t'][3]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][3]['guest']+'</td>' +
                                '<td>'+info['match_score_t'][4]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][4]['guest']+'</td>' +
                                '<td>'+info['match_score_t'][5]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][5]['guest']+'</td>' +
                                '<td>'+info['match_score_t'][6]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][6]['guest']+'</td>' +
                                '<td>'+info['match_score_t'][7]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][7]['guest']+'</td>' +
                                '<td>'+info['match_score_t'][8]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][8]['guest']+'</td>' +
                                '<td>'+info['match_score_t'][9]['home']+'&nbsp;/&nbsp;'+info['match_score_t'][9]['guest']+'</td>' +
                                '<td>'+info['match_score_t']['other']['home']+'&nbsp;/&nbsp;'+info['match_score_t']['other']['guest']+'</td>' +
                                '<td>'+info['match_score_t']['five']['home']+'&nbsp;/&nbsp;'+info['match_score_t']['five']['guest']+'</td>' +
                                '<td>'+info['match_score_t']['all']['home']+'&nbsp;/&nbsp;'+info['match_score_t']['all']['guest']+'</td>' +
                                '</tr></table></div></div><hr>';
                        }else{ //比分
                            html +='<div style="margin-left: 20px"><div class="log_head_div"><span class="log_title">修改人</span>：'+info['loginname']+'&nbsp;&nbsp;&nbsp;<span class="log_title">添加时间：</span>'+info['create_at']+'&nbsp;&nbsp;&nbsp;<span class="log_title">添加类型</span>：赛事比分</div>'
                                    +'<div>上半场比分(主/客)：'+info['u_home_score']+'&nbsp;/&nbsp;'+info['u_guest_score']+'</div>'
                                    +'<div>整场比分(主/客)：'+info['home_score']+'&nbsp;/&nbsp;'+info['guest_score']+'</div></div><hr>';
                        }
                    }

                    html += '<br><div style="margin:0px auto 10px;width: 112px;"><button class="layui-btn layui-btn-sm set" id="buttonClick" onclick="rlClick()"><h3>确定</h3></button>&nbsp;<!--<button onclick="rlClick()" class="layui-btn layui-btn-sm layui-btn-danger" id="reset"><h3>取消</h3></button>--></div></div>';

                    resultLogOpen = layer.open({
                        type: 1 //Page层类型
                        ,area: ['920px', '550px']
                        ,title: '<h2>比分记录<h2>'
                        ,shade: 0.6 //遮罩透明度
                        ,maxmin: true //允许全屏最小化
                        ,anim: 1 //0-6的动画形式，-1不开启
                        ,content:html
                    });
                }
            })
        }

        function rlClick() {
            layer.close(resultLogOpen)
        }


        //layer弹窗开始(结算)
        let settleOpen = '';
        function settleopen(match_id,type){
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/Sportsbq/getprocess',
                data: {type:type},
                success: function(data) {
                    //console.log(type);
                    let length = data.length;

                    let html = '<div style="margin-left:100px;margin-top:20px;font-size:18px;line-height:150%;width:60%;"><div><input class="checkall" type="checkbox" onclick="oncheck()">全选</div><input id="match_id" type="hidden" value="'+match_id+'"><input id="game_type" type="hidden" value="'+type+'">';
                    let info = '';
                    html += '<div style="height: 100px;"><ul>';
                    for(let i=0; i<length; i++){

                        html +='<li style="float: left;margin-left: 20px;"><input class="checkone" onclick="onecheck()" type="checkbox" value="'+data[i]['process']+'">'+data[i]['name']+'</li>';

                    }

                    html += '</div></ul><br><div><button class="layui-btn layui-btn-sm set" id="buttonClick" onclick="settleClick()"><h3>确定</h3></button>&nbsp;<button onclick="seClick()" class="layui-btn layui-btn-sm layui-btn-danger" id="reset"><h3>取消</h3></button></div></div>';

                    settleOpen = layer.open({
                        type: 1 //Page层类型
                        ,area: ['500px', '40%']
                        ,title: '<h2>结算<h2>'
                        ,shade: 0.6 //遮罩透明度
                        ,maxmin: true //允许全屏最小化
                        ,anim: 1 //0-6的动画形式，-1不开启
                        ,content:html
                    });
                }
            })
        }

        function seClick() {
            layer.close(settleOpen)
        }

        function settleClick(){
            obj = document.getElementsByClassName("checkone");
            var match_id = $("#match_id").val();
            var type = $("#game_type").val();
            process = [];
            for(k in obj){
                if(obj[k].checked)
                    process.push(obj[k].value);
            }
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/Sportsbq/Settlement1',
                data: {process:process,match_id:match_id,type:type},
                success: function(data) {
                    //console.log(data);
                    if(data.status == 1 || data.status == 4){
                        layer.msg(data.msg);
                        location. reload()//刷新当前页面
                    }else{
                        layer.msg(data.msg);
                    }
                }
            })
        }

        //结算弹框全选/取消
        function oncheck() {
            //console.log(1);
            if($('.checkall').is(':checked')==true){
                $('.checkone').prop('checked',true);
            }else{
                $('.checkone').prop('checked',false);
            }
        }

        function onecheck(){
//            console.log(1);
            var checkedinput = $("input[class='checkone']:checked").length;
            var input = $("input[class='checkone']").length;
            if(checkedinput == input){
                $('.checkall').prop('checked',true);
            }else{
                $('.checkall').prop('checked',false);
            }
        }

	</script>
@push('dataTableJS')
/*var active = {
    reload: function(){
      //执行重载
      table.reload('{{ $dataId }}', {
        page: {
          curr: 1 //重新从第 1 页开始
        }
        ,where: {
            account:$("#form_account").val(),
            register_ip:$('#form_register_ip').val(),
            last_ip:$('#form_last_ip').val(),
            register_url:$('#form_register_url').val(),
            last_url:$('#form_last_url').val(),
            regist_startime:$('#form_regist_startime').val(),
            regist_endtime:$('#form_regist_endtime').val(),
            statuss:$('#form_statuss').val(),
            cash_small:$('#form_cash_small').val(),
            cash_big:$('#form_cash_big').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_statuss').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) : '';
    });

@endpush

    @include('vip.datatable')
@endsection

