@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
                <i class="mdi mdi-wrench"></i>
              </span>
                    {{ __('auto.购买记录') }}
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">{{ __('auto.用户查询') }}</a></li>
                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.购买记录') }}</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">{{ __('auto.购买记录') }}</h4>
                            <form class="well form-inline margin-top-20" method="get" action='/admin/user/purchase/{{$user_id}}'>
                                {{ __('auto.商品名称：') }}
                                <input class="form-control" type="text" name="order_title" style="width: 10%; " value="{{$order_title}}" placeholder="{{ __('auto.请输入商品名称') }}">
                                <spen style="padding-left: 10px" >{{ __('auto.订单号：') }}</spen>
                                <input class="form-control" type="text" name="order_sn" style="width: 10%; " value="" placeholder="{{ __('auto.请输入订单号') }}">
                                <spen style="padding-left: 10px" >{{ __('auto.选择时间：') }}</spen>
                                <input type="date"  step="01" name="start_time" class="form-control" value="{{$start_time}}" />&nbsp;&nbsp;
                                <input type="date"  step="01" name="end_time" class="form-control" value="{{$end_time}}" />&nbsp;&nbsp;
                                <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
                                <a href="/admin/user/purchase/{{$user_id}}" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>&nbsp;&nbsp;
                                <!-- <a href="/admin/user/list/{{$user_id}}" class="btn btn-sm btn-gradient-info btn-icon-text">返回</a> -->
                            </form>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>{{ __('auto.充值时间') }}</th>
                                    <!-- <th>玩家游戏ID</th> -->
                                    <th>{{ __('auto.订单号') }}</th>
                                    <th>{{ __('auto.外部订单号') }}</th>
                                    <th>{{ __('auto.支付单号') }}</th>
                                    <th>{{ __('auto.商品名称') }}</th>
                                    <th>{{ __('auto.付款金额') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                <input style="width:20%;float:left;" class="form-control" type="text" value="{{$nick_name}}" disabled="disabled">
                                <input style="width:10%;float:left;" class="form-control" type="text" value="{{$game_id}}" disabled="disabled">
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td style="width: 13%">{{ $v->finished_at }}</td>
                                        <!-- <td style="width: 8%">{{ $v->GameID}}</td> -->
                                        <td style="width: 10%">{{ $v->order_sn}}</td>
                                        <td style="width: 10%">{{ $v->payment_sn}}</td>
                                        <td style="width: 12%">{{ $v->trade_sn}}</td>
                                        <td style="width: 10%">{{ $v->order_title}}</td>
                                        <td style="width: 10%">{{ $v->amount}}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                                {{ __('auto.总共') }} <b>{{ $list->appends(['order_title'=>$order_title,'order_sn'=>$order_sn,'start_time'=>$start_time,'end_time'=>$end_time])->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                                {!! $list->links() !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function publish(id){
            myConfirm("{{ __('auto.是否继续') }}?",function(){
                var myselect=document.getElementById("state"+id);
                var index=myselect.selectedIndex;
                var data = {state:myselect.options[index].value}
                myRequest("/admin/shop/update/"+id,"post",data,function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }

        $('.menu-switch').click(function(){
            id = $(this).attr('id');
            state = $(this).attr('state');
            if(state == "on"){
                $('.pid-'+id).hide();
                $(this).attr("state","off")
                $(this).removeClass('mdi-menu-down').addClass('mdi-menu-right');
            }else{
                $('.pid-'+id).show();
                $(this).attr("state","on")
                $(this).removeClass('mdi-menu-right').addClass('mdi-menu-down');
            }
        })
    </script>
@endsection
