@extends('vip.layouts')
@section('seo_title')
    {{ trans('menu.record') }}
@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="userReturn">
	  <a href="/admin/return/index?account_name=@{{d.account_name}}&haddle_startime=&haddle_endtime=">@{{ d.account_name}}</a>
	</script>

    <script type="text/html" id="moneyReturn">
        @{{#if(d.total_money>0){ }}
        <p style="color:red;">@{{d.total_money}}</p>
        @{{#}else{ }}
         <p style="color:green;">@{{d.total_money}}</p>
        @{{#} }}
    </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.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" eventType=event-query  value="{{ $haddle_startime }}">
					</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="form_haddle_endtime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query  value="{{ $haddle_endtime }}">
					</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>
                <div class="layui-inline">
                    <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.lossmoney_area') }}</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="lossmoney_small" id="form_lossmoney_small" placeholder="￥0" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $lossmoney_small }}">
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="lossmoney_big" id="form_lossmoney_big" placeholder="￥0" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $lossmoney_big }}">
                    </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(),
            haddle_startime:$('#form_haddle_startime').val(),
            haddle_endtime:$('#form_haddle_endtime').val(),
            money_small:$('#form_money_small').val(),
            money_big:$('#form_money_big').val(),
            lossmoney_small:$('#form_lossmoney_small').val(),
            lossmoney_big:$('#form_lossmoney_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('');
	  //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>');
}

var datau=res.data;
var total_bet_money=0,win_money=0;
for(var i=0;i<datau.length;i++){
total_bet_money+=parseFloat(datau[i].return_money);
win_money+=parseFloat(datau[i].total_money);
}
str+='<div class="bottom-txt"><p>当页回水金额：<span class="blue">'+Math.floor(total_bet_money*100)/100+'</span>,当页亏损金额：<span class="green">'+Math.floor(win_money*100)/100+'</span></p>';
   
$.ajax({
type: 'get',
url: '/admin/money/returnMoneyCount',
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.all_lossmoney+'</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
