@extends('vip.layouts')
@section('seo_title')
{{ trans('menu.access') }}
@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="usermoneyRecord">
	  <a href="/admin/fund/index?account_name=@{{d.account_name}}&star_time=&end_time=">@{{ d.account_name}}</a>
	</script>
	<script type="text/html" id="orderid_time">
	  @{{ d.trade_id}}<br>@{{ d.money_time}}
	</script>

	<script type="text/html" id="systemuser_ordertype">
	   @{{#if(d.sysetem_user=='system_auto'){ }}
        系统自动
      @{{#}else{ }}
        @{{ d.sysetem_user}}
      @{{#}}}<br>
	  @{{#if(d.trade_type==1){ }}
		{{ trans('status.money_details.trade_type')[1]}}
	  @{{#} }}
	  @{{#if(d.trade_type==2){ }}
		{{ trans('status.money_details.trade_type')[2]}}
	  @{{#} }}
	  @{{#if(d.trade_type==3){ }}
		{{ trans('status.money_details.trade_type')[3]}}
	  @{{#} }}
	  @{{#if(d.trade_type==4){ }}
		{{ trans('status.money_details.trade_type')[4]}}
	  @{{#} }}
	  @{{#if(d.trade_type==5){ }}
        @{{#if(d.status==1){ }}
		    <font color="green">{{ trans('status.money_details.take_status')[1]}}</font>
          @{{#}else{ }}
            <font color="green">{{ trans('status.money_details.take_status')[2]}}</font>
          @{{#} }}
	  @{{#} }}
	  @{{#if(d.trade_type==6){ }}
		{{ trans('status.money_details.trade_type')[6]}}
	  @{{#} }}
	  @{{#if(d.trade_type==7){ }}
		{{ trans('status.money_details.trade_type')[7]}}
	  @{{#} }}
	  @{{#if(d.trade_type==8){ }}
		{{ trans('status.money_details.trade_type')[8]}}
	  @{{#} }}
	  @{{#if(d.trade_type==9){ }}
		{{ trans('status.money_details.trade_type')[9]}}
	  @{{#} }}
	  @{{#if(d.trade_type==10){ }}
		{{ trans('status.money_details.trade_type')[10]}}
	  @{{#} }}
	  @{{#if(d.trade_type==11){ }}
		{{ trans('status.money_details.trade_type')[11]}}
	  @{{#} }}
	  @{{#if(d.trade_type==12){ }}
		{{ trans('status.money_details.trade_type')[12]}}
	  @{{#} }}
	  @{{#if(d.trade_type==13){ }}
		{{ trans('status.money_details.trade_type')[13]}}
	  @{{#} }}
      @{{#if(d.trade_type==16){ }}
        {{ trans('status.money_details.trade_type')[16]}}
      @{{#} }}
      @{{#if(d.trade_type==19){ }}
        {{ trans('status.money_details.trade_type')[19]}}
      @{{#} }}
      @{{#if(d.trade_type==22){ }}
        @{{#if(d.money_type==2){ }}
          <font>代理代充（代充）</font>
          @{{#}else{ }}
          <font color="green">代理代充（充值）</font>
          @{{#} }}
      @{{#} }}
	  @{{#if(d.trade_type==14){ }}
		{{--{{ trans('status.money_details.trade_type')[14]}}--}}
          @{{#if(d.status==1){ }}
          <font>汇款（成功）</font>
          @{{#}else{ }}
          <font color="green">汇款（失败）</font>
          @{{#} }}
	  @{{#} }}
	  @{{#if(d.trade_type==15){ }}
		{{ trans('status.money_details.trade_type')[15]}}
	  @{{#} }}
    </script>
    <script type="text/html" id="ordertype">
      @{{ d.trade_desc}}
      @{{#if(d.remark!=null){ }}
      ；交易方式：@{{ d.remark}}
      @{{#} }}<br>
	  @{{#if(d.reason!=null){ }}
		<span style = "color:red;">@{{ d.reason}}</span>
	  @{{#} }}

    </script>

    <script type="text/javascript" id="money_aftercash">
        @{{  Math.floor(100*d.money_cash)/100 }}
        <div style="color:red;">@{{ d.money}}</div>
        <div style="color:green;">
         @{{#if(d.money_type==1){ }}
            @{{ Math.floor((parseFloat(d.money_cash)-parseFloat(d.money))*100)/100 }}
         @{{#}else{ }}
            @{{ Math.floor((parseFloat(d.money_cash)+parseFloat(d.money))*100)/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" eventType=event-query  value="{{ $account_name }}"}}">
					</div>
					<div class="layui-input-inline checkbox">
						<input type="checkbox" name="sureblur" id="form_sureblur" lay-skin="switch" lay-text="精确|模糊" checked eventType=event-query>
					</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="form_order_id"  lay-verify="" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $order_id }}"}}">
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.trade_type') }}</label>
					<div class="layui-input-inline" style="width: 200px">
						<select name="trade_type"  id="form_trade_type"  lay-verify="" autocomplete="off" class="layui-input" eventType=event-query>
							<option value="">请选择订单类型</option>
							@foreach(trans('status.money_details.part') as $k=>$v):
								@if($trade_type==$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('money.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="">请选择订单状态</option>
                            <option value="">全部</option>
                            @foreach(trans('status.money_details.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('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" eventType=event-query  value="{{ $money_small }}"}}">
                    </div>
					<div class="layui-form-mid">-</div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="money_big" id="form_money_big" placeholder="￥0" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $money_big }}"}}">
                    </div>
                </div>
				<div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.star_time') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="star_time"  id="form_star_time" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query  value="{{ $star_time }}"}}">
					</div>
                </div>
                <div class="layui-inline">
					<label class="layui-form-label">{{ trans('money.end_time') }}</label>
					<div class="layui-input-inline">
						<input type="text" name="end_time"  id="form_end_time" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query  value="{{ $end_time }}"}}">
					</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;"><i class="layui-icon">ဂ</i></a>
               </div>

            </div>

        </form>
    </div>
    </div>
	<script>
	/*layui.use('laydate', function(){
	  var laydate = layui.laydate;

	  //自定义格式
	  laydate.render({
		elem: '#star_time'
		,format: 'yyyy-MM-dd HH:mm:ss'

		,btns:['now']
		,done: function(value, date, endDate){ //回调函数
			$('#star_time').val(value+' 00:00:00');
        }
	  });
	  laydate.render({
		elem: '#end_time'
		,format: 'yyyy-MM-dd  HH:mm:ss'
		,btns:['now']
		,mark:{
			'0-0-0':'当天'
		}
		,done: function(value, date, endDate){ //回调函数
			$('#end_time').val(value+' 23:59:59');
        }
	  });
	});*/
	</script>
@push('dataTableJS')
/*var active = {
    reload: function(){
      //执行重载
      table.reload('{{ $dataId }}', {
        page: {
          curr: 1 //重新从第 1 页开始
        }
        ,where: {
            account_name:$("#form_account_name").val(),
            order_id:$('#form_order_id').val(),
            trade_type:$('#form_trade_type').val(),
            star_time:$('#form_star_time').val(),
            end_time:$('#form_end_time').val(),
            money_small:$('#form_money_small').val(),
            money_big:$('#form_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('');
	  $('#form_trade_type').val('');
	  $('#form_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/fund/allTotal',
        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.totalMoney+'</span> ,'; -->
        str+='<b><p>总入款：<span class="green">'+data.all_save_money+'</span>(在线('+data.onlineRecharge+')+后台('+data.backstageRecharge+')+汇款('+data.remit+')+充值赠送('+data.rechargePrize+')+活动('+data.active_add_money+')+反水('+data.back_water+')+回水('+data.return_water+')+红包打赏('+data.reward_addmoney+')+佣金提成('+data.commission_addmoney+')+代理代充充值('+data.nagentin+')),</p></b>';
        str+='<b><p>总出款：<span class="red">'+data.all_take_money+'</span>(在线('+data.take_money+')+后台('+data.cut_money+')+活动('+data.active_cut_money+')+红包打赏('+data.reward_reducemoney+')+代理代充('+data.nagentout+') </p></b>';
        str+='<b><p>实际入款总额：<span class="blue">'+data.intoTotalMoney+'(已扣除用于活动,充值赠送，反水及回水)</span>,'
        str+='在线充值：<span class="green">'+data.onlineRecharge+'</span>,';
        str+='银行汇款：<span class="red">'+data.remit+'</span> ,';
        str+='后台充值：<span>'+data.backstageRecharge+'</span> , ';
        str+='代理代充充值：<span class="red">'+data.nagentin+'</span> , </p></b>';
        str+='<b><p>实际出款总额：<span class="blue">'+data.cut_total_money+'(已扣除用于活动,充值赠送,反水及回水)</span>,';
        str+='用户提款：<span class="red">'+data.take_money+'</span>,';
        str+='管理员扣款：<span class="yellow">'+data.cut_money+'</span>,';
        str+='代理代充：<span class="red">'+data.nagentout+'</span>,</p></b>';
        str+='<b><p>活动入款金额：<span class="blue">'+data.active_add_money+'</span> ,';
        str+='充值赠送：<span class="blue">'+data.rechargePrize+'</span> ,';
        str+='反水：<span class="green">'+data.back_water+'</span> ,';
        str+='回水：<span class="green">'+data.return_water+'</span> ,';
        str+='红包打赏：<span class="green">'+data.reward_addmoney+'</span> ,';

        str+='活动扣款金额：<span class="blue">'+data.active_cut_money+'</span> ,</p></b>';
        str+='<b><p>出入款盈利金额：';
        if(data.profit>0){
            str+='<span class="red">'+data.profit+'(已扣除用于活动和充值赠送，反水及回水)</span></p></b>';
        }else{
            str+='<span class="green">'+data.profit+'(已扣除用于活动和充值赠送，反水及回水)</span></p></b>';
        }
        $('#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
