@extends('vip.layouts')
@section('seo_title')
    {{ trans('menu.take_money') }}
@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;
        }

        .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="usertake">
	   <a href="/admin/Take/index?account_name=@{{d.account_name}}">@{{ d.account_name}}</a><br>

	</script>
    <script type="text/html" id="pass">
        @{{#if(d.status=='待审核'){ }}
        @if(checkRriv('/admin/take/edit'))<a href="/admin/take/edit?order_id=@{{d.order_id}}">{{trans('common.pass')}}</a>@endif
        @{{#}else{ }}
        <a href="/admin/take/edit?order_id=@{{d.order_id}}">{{ trans('common.view') }}</a>
        @{{#} }}
		<a href="/admin/MoneyList/index?account_name=@{{d.account_name}}&star_time=&end_time=", class="layui-btn layui-btn-sm layui-btn-normal" style="margin-bottom:5px;margin-left:0px;">资金流水</a>
		<a href="/admin/Hitcode/index?account_identity=@{{d.account_identity}}" class="layui-btn layui-btn-sm layui-btn-warm" style="margin-bottom:5px;margin-left:0px;">打码量</a>
    </script>
    <script type="text/html" id="takes">
                @{{#if(d.status=="通过"){ }}
                <p style="color:red;">@{{d.status}}</p>
                @{{#}else{ }}
                @{{#if(d.status=="未通过"){ }}
                 <p style="color:green;">@{{d.status}}</p>
                @{{#}else{ }}
                 <p style="color:#00868B;">@{{d.status}}</p>
                @{{#} }}
                @{{#} }}
				@{{#if(d.pass_time==null){ }}

				@{{#}else{ }}
					@{{d.pass_time}}
				@{{#} }}
            </script>


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

    <script type="text/html" id="infoNo">
          @{{d.bank_info}}<br>
          @{{ d.bank_no}}
    </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="精确|模糊" @if(!isset($sureblurs) || $sureblurs=='on') checked @endif  class="layui-input" eventType=event-query>
                            <input type="hidden" name="sureblurs" id="form_sureblurs" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $sureblurs }}">
                        </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.bank_user') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="bank_user" id="form_bank_user" lay-verify="" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $bank_user }}">
                        </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="">{{trans('money.select_status')}}</option>-->
								@foreach(trans('status.money_take.status') as $k=>$v):
									@if($status==$k))
										<option value="{{$k}}" selected="selected">{{$v}}</option>
									@else
										<option value="{{$k}}">{{$v}}</option>
									@endif
								@endforeach
								@if($status==4))
									<option value="4" selected="selected">全部提现</option>
								@else
									<option value="4">全部提现</option>
								@endif
							</select>
						</div>
					</div>

                    <div class="layui-inline" style="width: 360px">
                            <label class="layui-form-label">{{ trans('user.grade') }}</label>
                            <div class="layui-input-inline"  style="width: 200px">
                                <select name="grade" id="form_grade" lay-verify="" autocomplete="off" class="layui-input" eventType=event-query>
                                    <option value="-1" selected>请选择会员等级</option>
                                    @foreach(trans('status.account_detailed.grade') as $k=>$v):
                                        @if($grade==$k)
                                            <option value="{{$k}}">{{$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.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" eventType=event-query  value="{{ $apply_startime }}">
                        </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" eventType=event-query  value="{{ $apply_endtime }}">
                        </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">
                        <a class="layui-btn layui-btn-sm lay-btn-diy" data-type="reload" style="opacity: 1; pointer-events: auto;" eventType='event-query-submit' 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>

            </form>
        </div>
    </div>
    <script type="text/javascript">
        
            $('body').on('click','#form_sureblur~.layui-form-switch',function(){
                var sus = $('#form_sureblur').next().text();
                if(sus=='精确'){
                    $('#form_sureblurs').val('on');
                }else{
                    $('#form_sureblurs').val('off');
                }
            })
    </script>
    @push('dataTableJS')
        /*var active = {
			reload: function(){
				//执行重载
				console.log($('#form_status').val());
				table.reload('{{ $dataId }}', {
					page: {
						curr: 1 //重新从第 1 页开始
					}
					,where: {
						account_name:$("#form_account_name").val(),
						order_id:$('#form_order_id').val(),
						bank_user:$('#form_bank_user').val(),
						money_small:$('#form_money_small').val(),
						money_big:$('#form_money_big').val(),
						status:$('#form_status').val(),
						apply_startime:$('#form_apply_startime').val(),
						apply_endtime:$('#form_apply_endtime').val(),
						haddle_startime:$('#form_haddle_startime').val(),
						haddle_endtime:$('#form_haddle_endtime').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_status').val('3');
			$('.layui-form-select 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>');
        }
        $.ajax({
        type: 'get',
        url: '/admin/money/takeMoneyCount',
        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 class="bottom-txt">总金额：<span class="blue">'+data.all_money+'</span> , 成功：<span class="green">'+data.success_money+'</span> , 手续费：<span class="red">'+data.service_money+'</span> , 处理中：<span class="yellow">'+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
