@extends('vip.layouts')
@section('seo_title')
    {{ trans('menu.recharge') }}
@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;
        }
    </style>
	<script type="text/html" id="userrecharge">
	  <a href="/admin/recharge/index?account_name=@{{d.account_name}}&apply_startime=&apply_endtime=">@{{ d.account_name}}</a>
	</script>
	<script type="text/html" id="orderid_time">
	  @{{ d.order_id}}<br>@{{ d.apply_time}}
	</script>
	<script type="text/html" id="act_type">
		@{{#if(d.sysetem_user!=null){ }}
			@{{ d.sysetem_user}}
		@{{#} }}
	   <br>@{{ d.recharge_type}}
	</script>

    <script type="text/html" id="taked">
		@{{#if(d.status==1){ }}
			<p style="color:green;">{{trans('status.money_recharge.status')[1]}}</p>
		@{{#}else{ }}
			@{{#if(d.status==0){ }}
				<p style="color:red;">{{trans('status.money_recharge.status')[0]}}</p>
			@{{#}else{ }}
				@{{#if(d.status==2){ }}
					<p style="color:#00868B;">{{trans('status.money_recharge.status')[2]}}</p>
				@{{#}else{ }}

				@{{#} }}
			@{{#} }}
		@{{#} }}
		@{{#if(d.complete_time!=null){ }}
			@{{ d.complete_time}}
		@{{#} }}

	</script>
	
    <script type="text/html" id="money_aftercash">
    	@{{ d.money_cash }}
		<div style="color:red;">@{{d.money}}</div>
		<div style="color:green;">
			@{{ Math.floor(100*(parseFloat(d.money_cash)-parseFloat(d.money)))/100 }}
		</div>
    </script>
<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-inline">
					<label class="layui-form-label">{{ trans('money.account_name') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="account_name" id="form_account_name" lay-verify="required" autocomplete="off" class="layui-input" value="{{Request::get('account_name')?Request::get('account_name'):$account_name}}" eventType=event-query>
					</div>
					<div class="layui-input-inline checkbox">
						<input type="checkbox" name="sureblur" id="sureblur" lay-skin="switch" lay-text="精确|模糊" checked>
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.order_id') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="order_id"  id="order_id"  lay-verify="" autocomplete="off" class="layui-input" value="{{$order_id}}" eventType=event-query>
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.recharge_type') }}</label>
					<div class="layui-input-inline" style="width: 200px">
						<select name="recharge_type"  id="form_recharge_type"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
							<option value="">{{ trans('money.select_rechargetype') }}</option>
							@foreach(trans('status.money_recharge.recharge_type') as $k=>$v):
								<option @if($v==$recharge_type) selected @endif value={{$v}}>{{$v}}</option>
							@endforeach
						</select>
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.status') }}</label>
                    @php

                    @endphp
					<div class="layui-input-inline" style="width: 125px">
						<select name="status"  id="form_status"  lay-verify="" autocomplete="off" class="layui-input" eventType=event-query>

							@foreach(trans('status.money_recharge.recharge_status') as $k=>$v):
								@if($status==$k)
									<option value={{$k}} selected>{{$v}}</option>
								@else
									<option value={{$k}}>{{$v}}</option>
								@endif
							@endforeach
						</select>
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.money_area') }}</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="money_small" id="form_money_small" placeholder="￥0" autocomplete="off" class="layui-input"
                               value="{{$money_small}}" eventType=event-query>
                    </div>
					<div class="layui-form-mid">-</div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="money_big" id="money_big" placeholder="￥0" autocomplete="off" class="layui-input"
                        value="{{$money_big}}" eventType=event-query>
                    </div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.apply_startime') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="apply_startime"  id="form_apply_startime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item"
                        value="{{$apply_startime?$apply_startime:trans('status.default_time.atime')}}" eventType=event-query>
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.apply_endtime') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="apply_endtime"  id="form_apply_endtime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item"
                        value="{{$apply_endtime?$apply_endtime:trans('status.default_time.etime')}}" eventType=event-query>
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.haddle_startime') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="haddle_startime"  id="form_haddle_startime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item" value="{{$haddle_startime}}" eventType=event-query>
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.haddle_endtime') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="haddle_endtime"  id="haddle_endtime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item" value="{{$haddle_endtime}}" eventType=event-query>
					</div>

                </div>

                <div class="layui-inline">
                <a class="layui-btn layui-btn-sm lay-btn-diy"   data-type="reload" style="opacity: 1; pointer-events: auto;" eventType=event-query-submit>提交</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;" eventType=event-query-submit><i class="layui-icon">ဂ</i></a>
               </div>-->

            </div>
         </div>
		</form>
    </div>
    </div>
@push('dataTableJS')
/*var active = {
    reload: function(){
      //执行重载
      table.reload('{{ $dataId }}', {
        page: {
          curr: 1 //重新从第 1 页开始
        }
        ,where: {
            account_name:$("#account_name").val(),
            order_id:$('#order_id').val(),
            recharge_type:$('#recharge_type').val(),
            status:$('#status').val(),
            apply_startime:$('#apply_startime').val(),
            apply_endtime:$('#apply_endtime').val(),
            haddle_startime:$('#haddle_startime').val(),
            haddle_endtime:$('#haddle_endtime').val(),
            money_small:$('#money_small').val(),
            money_big:$('#money_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('');
	  $('#status').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/money/rechargeMoneyCount',
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>总金额：<span class="blue">'+data.all_money+'</span> , 在线充值：<span class="green">'+data.online_success+'</span> , 后台充值：<span class="red">'+data.admin_success+'</span> , 充值赠送：<span class="yellow">'+data.service_money+'</span>,'
str+=' 活动金额：<span class="blue">'+data.admin_fail+'</span> , 处理成功：<span class="red">'+data.handing+'</span></p>'
$('#statistics').html(str);

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


}
@endpush

@include('vip.datatable')
@endsection
