@extends('vip.layouts')
@section('seo_title')
    {{ trans('menu.money_list') }}
@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;
        }
        .bottom-txt{
            padding: 0.5em;
            line-height: 2em;
        }
    </style>
	<script type="text/html" id="usermoneyRecord">
	  <a href="/admin/MoneyList/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="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/html" id="systemuser_ordertype">
	  @{{#if(d.sysetem_user=='system_auto'){ }}
        系统自动
      @{{#}else{ }}
        @{{ d.sysetem_user}}
      @{{#}}}<br>
	  @{{#if(d.trade_type==1){ }}
		<font color="orange">{{ trans('status.money_details.trade_desc.bet')}}</font>
	  @{{#} }}
	  @{{#if(d.trade_type==2){ }}
      <font color="orange">{{ trans('status.money_details.trade_desc.twoBet')}}</font>
	  @{{#} }}
	  @{{#if(d.trade_type==3){ }}
		{{ trans('status.money_details.trade_desc.cancel')}}
	  @{{#} }}
	  @{{#if(d.trade_type==4){ }}
		<font color="red">{{ trans('status.money_details.trade_desc.prize')}}</font>
	  @{{#} }}
	  @{{#if(d.trade_type==5){ }}
          @{{#if(d.status==1){ }}
             <font color="green">{{ trans('status.money_details.trade_desc.take_end')}}</font>
          @{{#} }}
          @{{#if(d.status==2){ }}
            <font color="green">{{ trans('status.money_details.trade_desc.take_fail')}}</font>
          @{{#} }}
	  @{{#} }}
	  @{{#if(d.trade_type==6){ }}
		{{ trans('status.money_details.trade_desc.online_add')}}
	  @{{#} }}
	  @{{#if(d.trade_type==7){ }}
		{{ trans('status.money_details.trade_desc.back')}}
	  @{{#} }}
	  @{{#if(d.trade_type==8){ }}
		<font color="#0000FF!important">{{ trans('status.money_details.trade_desc.return')}}</font>
	  @{{#} }}
	  @{{#if(d.trade_type==9){ }}
        @{{#if(d.isdel==1){ }}
            <font color="orange">管理员撤单</font>
        @{{#} }}
        @{{#if(d.isdel==2){ }}
		   <font color="orange">{{ trans('status.money_details.trade_desc.cut_money')}}</font>
        @{{#} }}
	  @{{#} }}
	  @{{#if(d.trade_type==10){ }}
		{{ trans('status.money_details.trade_desc.cmim_take')}}
	  @{{#} }}
	  @{{#if(d.trade_type==11){ }}
		<font color="#191970">{{ trans('status.money_details.trade_desc.add_money')}}</font>
	  @{{#} }}
	  @{{#if(d.trade_type==12){ }}
        @{{#if(d.money_type==1){ }}
		<font color="green">{{ trans('status.money_details.trade_desc.action_add')}}</font>
          @{{#} }}
          @{{#if(d.money_type==2){ }}
        <font color="gray">{{ trans('status.money_details.trade_desc.action_cut')}}</font>
          @{{#} }}
	  @{{#} }}
	  @{{#if(d.trade_type==13){ }}
		<font color="red" >{{ trans('status.money_details.trade_desc.remit_prize')}}</font>
	  @{{#} }}
	  @{{#if(d.trade_type==14){ }}
		<font color="#191970">{{ trans('status.money_details.trade_desc.remit')}}</font><br>
	  @{{#} }}
	  @{{#if(d.trade_type==15){ }}
		{{ trans('status.money_details.trade_desc.take_apply')}}
	  @{{#} }}
      @{{#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==1){ }}
        <font color="green">{{ trans('status.money_details.trade_desc.nagentin')}}</font>
          @{{#} }}
          @{{#if(d.money_type==2){ }}
        <font color="gray">{{ trans('status.money_details.trade_desc.nagentout')}}</font>
          @{{#} }}
      @{{#} }}
	</script>

    <script type="text/html" id="money_aftercash">
        @{{ Math.round(d.money_cash*100)/100 }}
        <div style="color:red;">@{{ d.money}}</div>

        <div style="color:green;">
         @{{#if(d.money_type==1){ }}
            @{{ Math.round((parseFloat(d.money_cash)-parseFloat(d.money))*100)/100 }}
         @{{#}else{ }}
            @{{ Math.round((parseFloat(d.money_cash)+parseFloat(d.money))*100)/100 }}
          @{{#} }}
        </div>
    </script>

    <script type="text/html" id="game">
        <a href="/admin/MoneyList/view?order_id=@{{d.trade_id}}" class="layui-btn layui-btn-sm" style="margin-bottom:5px;margin-left:0px;">查看</a
    </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.trade_type') 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>
@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/MoneyList/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+='<div class="bottom-txt"><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>';
    str+='<p>总出款：<span class="red">'+data.all_take_money+'</span>(在线('+data.take_money+')+后台('+data.cut_money+')+活动('+data.active_cut_money+')+红包打赏('+data.reward_reducemoney+')+代理代充('+data.nagentout+')';
    str+='<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>';
    str+='<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>';
    str+='<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>';
    str+='<p>出入款盈利金额：';
    if(data.profit>0){
        str+='<span class="red">'+data.profit+'(已扣除用于活动和充值赠送，反水及回水)</span></p></div>';
    }else{
        str+='<span class="green">'+data.profit+'(已扣除用于活动和充值赠送，反水及回水)</span></p></div>';
    }
        $('#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
