@extends('vip.layouts')
@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;
        }
    </style>
    <script type="text/html" id="res">
        <div id="res_@{{ d.order_no }}">@{{ d.exec_result }}</div>
    </script>
    <script type="text/html" id="tt">
        @{{#if(d.transfer_type == 1 && d.game_type == 'oggame'){ }}
            转入到OG游戏厅
        @{{#}else if(d.transfer_type == 2 && d.game_type == 'oggame'){ }}
            从OG游戏厅转出
        @{{#}else if(d.transfer_type == 1 && d.game_type == 'kygame'){ }}
            转入到开元棋牌
        @{{#}else if(d.transfer_type == 2 && d.game_type == 'kygame'){ }}
            从开元棋牌转出
        @{{#}else if(d.transfer_type == 1 && d.game_type == 'aggame'){ }}
            转入到AG游戏厅
        @{{#}else if(d.transfer_type == 2 && d.game_type == 'aggame'){ }}
            从AG游戏厅转出
        @{{#}else if(d.transfer_type == 1 && d.game_type == 'lcqpgame'){ }}
            转入到龙城棋牌
        @{{#}else if(d.transfer_type == 2 && d.game_type == 'lcqpgame'){ }}
            从龙城棋牌转出
        @{{#}else if(d.transfer_type == 1 && d.game_type == 'lygame'){ }}
            转入到乐游棋牌
        @{{#}else if(d.transfer_type == 2 && d.game_type == 'lygame'){ }}
            从乐游棋牌转出
        @{{#}else if(d.transfer_type == 2 && d.game_type == 'Hjgame'){ }}
            皇家视讯转出
        @{{#}else if(d.transfer_type == 1 && d.game_type == 'Hjgame'){ }}
            转入到皇家视讯
        @{{#}else if(d.transfer_type == 2 && d.game_type == 'fygame'){ }}
            泛亚电竞转出
        @{{#}else if(d.transfer_type == 1 && d.game_type == 'fygame'){ }}
            转入到泛亚电竞
        @{{#}else if(d.transfer_type == 1 && d.game_type == 'mggame'){ }}
            转入到MG电子
        @{{#}else if(d.transfer_type == 2 && d.game_type == 'mggame'){ }}
            MG电子转出
        @{{#} }}
    </script>

    <script type="text/html" id="game_type">
        @{{d.zngame}}
    </script>
    <script type="text/html" id="opt">
        @{{#if(d.type == 3){ }}
        <div id="@{{ d.order_no }}">
            <a  class="layui-btn   layui-btn-sm  layui-btn-normol" id="t" onclick="subtype('@{{d.game_type}}','@{{ d.local_user }}','@{{ d.casino_user }}', '@{{ d.transfer_money }}', '@{{ d.transfer_type }}', '@{{ d.order_no }}', 1,'@{{d.zngame}}')" data-type="reload" style="opacity: 1; pointer-events: auto;">通过</a>
            <a  class="layui-btn   layui-btn-sm  layui-btn-danger" id="w" onclick="subtype('@{{d.game_type}}','@{{ d.local_user }}','@{{ d.casino_user }}', '@{{ d.transfer_money }}', '@{{ d.transfer_type }}', '@{{ d.order_no }}', 2,'@{{d.zngame}}')" data-type="reload" style="opacity: 1; pointer-events: auto;">不通过</a>
        </div>
        @{{#}else if(d.type == 2){ }}
        转账失败
        @{{#}else if(d.type == 4){ }}
        审核未通过
        @{{#}else{ }}
            转账成功
        @{{#} }}
    </script>
    <!---注单管理-->
    <div class="layui-row">
        <div class="layui-col-sm12 layui-col-md12 text" >
            <form class="layui-form rewrite" eventType=eventForm>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">订单号：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="order_no" id="order_no" lay-verify="" autocomplete="off" eventType=event-query
                                   class="layui-input" value="{{ $order_no }}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">真人用户名：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="casino_user" id="casino_user" lay-verify="" autocomplete="off" eventType=event-query
                                   class="layui-input" value="{{ $casino_user }}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">本站用户名：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="local_user" id="local_user" lay-verify="" autocomplete="off" eventType=event-query
                                   class="layui-input" value="{{ $local_user }}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">提交时间：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="start_time" id="sub_time" placeholder=" - " lay-verify=""
                                   autocomplete="off" class="layui-input test-item" eventType=event-query
                                   value="{{ $start_time }}">
                        </div>
                    </div>~
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input type="text" name="end_time" id="sub_time" placeholder=" - " lay-verify=""
                                   autocomplete="off" class="layui-input test-item" eventType=event-query
                                   value="{{ $end_time }}">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">游戏类型</label>
                        <div class="layui-input-inline">
                            <select name="game_type" id="game_type"  autocomplete="off" eventType="event-query">
                                <option value="">请选择</option>
                                @foreach($gamelist as $k=>$v):
                                @if($game_type==$v['game_type']))
                                <option value="{{$v['game_type']}}" selected="selected">{{$v['game_zh']}}</option>
                                @else
                                <option value="{{$v['game_type']}}" eventType=event-query>{{$v['game_zh']}}</option>
                                @endif
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">转账类型</label>
                        <div class="layui-input-inline">
                            <select name="transfer_type" id="transfer_type"  autocomplete="off" eventType="event-query">
                                <option value="">请选择</option>
                                <option value="1" @if(isset($transfer_type) && $transfer_type=='1') selected="true" @endif>转入</option>
                                <option value="2" @if(isset($transfer_type) && $transfer_type=='2') selected="true" @endif>转出</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">转账状态</label>
                        <div class="layui-input-inline">
                            <select name="type" id="type"  autocomplete="off" eventType="event-query">
                                <option value="0" @if(isset($type) && $type=='0') selected="true" @endif>请选择</option>
                                <option value="1" @if(isset($type) && $type=='1') selected="true" @endif>成功</option>
                                <option value="4" @if(isset($type) && $type=='4') selected="true" @endif>失败</option>
                                <option value="3" @if(isset($type) && $type=='3') selected="true" @endif>待审核</option>
                            </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>
                        <a class="layui-btn layui-btn-sm layui-btn-green set" data-type="reload"
                           style="opacity: 1; pointer-events: auto;" href="javascript:window.location.reload()">
                            <i class="layui-icon">ဂ</i>
                            <!-- <a  class="layui-btn layui-btn-sm" data-type="reload" style="opacity: 1; pointer-events: auto;" onclick="exportWord()">导出</a> -->
                        </a>
                    </div>
                </div>
            </form>
        </div>
    </div>
    @push('dataTableJS')
    @endpush
    @include('vip.datatable')
        <script>
            function subtype(game_type,local_user,username, transfer_money, transfer_type, order_no, stype,zngame)
            {
                layer.prompt({title: '审核理由填写', formType: 2}, function(text, index){

                    layer.close(index);


                    if(text == '' || text == null)
                    {
                        //layer.msg('请填写审核理由');
                        alert('请填写审核理由');
                    }
                    else
                    {
                        let surl = '/Admin/TransferVerify/transferCredit';
                        $.ajax({
                            url: surl,
                            dataType: 'json',
                            data: {game_type:game_type,localuser:local_user,username:username,credit:transfer_money,type:transfer_type,billno:order_no,stype:stype,remarks:text,zngame:zngame},
                            type: 'post',
                            success:function(data){
                                layer.msg(data.msg);

                                if(data.status == 1)
                                {
                                    $('#'+order_no).html('');
                                    $('#'+order_no).text(data.msg);
                                    $('#res_'+order_no).text(data.exec_result);
                                }
                            }
                        });
                    }
                });
            }
        </script>
@endsection
