@extends('vip.layouts')
@section('content')
    <style>
        body{overflow-y: scroll;}
        .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>
	@push('dataTableJS')
		var active = {
			reload: function(){
				//执行重载
				table.reload('{{ $dataId }}', {
					page: {
						curr: 1 //重新从第 1 页开始
					}
					,where: {
						name:$('#name').val(),
					}
				});
			}
		};

		tableIns.config.done=function(){
			var taketime = $('td .take_time').text();
			console.log(taketime);
			if(taketime!=''){
				$('.recharge_table .laytable-cell-1-apply_time').each(function(){
					var rechargetime = $(this).text();
					console.log(rechargetime);
					if(rechargetime>=taketime){
						console.log(1);
						$(this).parent().prevAll("td:eq(3)").css('color','green');
					}
				});
			}
		}

	@endpush

	<script type="text/html" id="select_time">
		<a href="/admin/Hitcode/index?account_identity=@{{d.account_identity}}&hitcode_time=@{{d.apply_time}}" 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">手动选择入款时间，根据选择的时间，计算打码量</label>
                    </div><br>
					<div class="layui-collapse" lay-filter="test">
					 <div class="layui-colla-item">
						<h2 class="layui-colla-title">最近一笔成功提款详情</h2>
						<div class="layui-colla-content layui-show">
						@if(isset($data['status'])&&$data['status']<0)
							<div class="layui-inline">
								<label class="layui-form-label">{{$data['msg']}}</label>
							</div>
						@else
							<div class="layui-form layui-border-box layui-table-view" lay-filter="LAY-table-1" style="height: 130px;">
								<div class="layui-table-box">
									<div class="layui-table-header">
										<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-even="">
											<thead>
												<tr>
													<th data-field="order_id" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-order_id">
															<span>订单号</span>
															<span class="layui-table-sort layui-inline">
																<i class="layui-edge layui-table-sort-asc"></i>
																<i class="layui-edge layui-table-sort-desc"></i>
															</span>
														</div>
													</th>
													<th data-field="recharge_type" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-recharge_type">
															<span>类型</span>
															<span class="layui-table-sort layui-inline">
																<i class="layui-edge layui-table-sort-asc"></i>
																<i class="layui-edge layui-table-sort-desc"></i>
															</span>
														</div>
													</th>
													<th data-field="money" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-money">
															<span>交易金额</span>
															<span class="layui-table-sort layui-inline">
																<i class="layui-edge layui-table-sort-asc"></i>
																<i class="layui-edge layui-table-sort-desc"></i>
															</span>
														</div>
													</th>
													<th data-field="reason" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-reason">
															<span>备注</span>
															<span class="layui-table-sort layui-inline">
																<i class="layui-edge layui-table-sort-asc"></i>
																<i class="layui-edge layui-table-sort-desc"></i>
															</span>
														</div>
													</th>
													<th data-field="apply_time" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-apply_time">
															<span>提交时间</span>
															<span class="layui-table-sort layui-inline">
																<i class="layui-edge layui-table-sort-asc"></i>
																<i class="layui-edge layui-table-sort-desc"></i>
															</span>
														</div>
													</th>
												</tr>
											</thead>
										</table>
									</div>
									
									<div class="layui-table-body layui-table-main" style="height: 236px;">
										<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-even="">
											<tbody>
												<tr data-index="0" class="">
													<td data-field="order_id" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-order_id">{{$data['order_id']}}</div>
													</td>
													<td data-field="recharge_type" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-recharge_type">用户提款</div>
													</td>
													<td data-field="money" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-money">{{$data['money']}}</div>
													</td>
													<td data-field="reason" data-minwidth="120">
														<div class="layui-table-cell laytable-cell-1-reason">{{$data['reason']}}</div>
													</td>
													<td data-field="apply_time" data-minwidth="200">
														<div class="layui-table-cell take_time">{{$data['apply_time']}}</div>
													</td>
												</tr>
											</tbody>
										</table>
									</div>
								</div>
								
								<style>.laytable-cell-1-order_id{ width: 313px; }.laytable-cell-1-recharge_type{ width: 313px; }.laytable-cell-1-money{ width: 313px; }.laytable-cell-1-reason{ width: 313px; }.laytable-cell-1-apply_time{ width: 313px; }.laytable-cell-1-action_user{ width: 313px; }</style>
							</div>
						@endif
					</div>
				  </div>
				  </div>
				  
				  <div class="layui-collapse" lay-filter="test">
					 <div class="layui-colla-item">
						<h2 class="layui-colla-title">入款情况</h2>
						<div class="layui-colla-content layui-show recharge_table">
						@include('vip.datatable')
					</div>
				  </div>
				  </div>
                </div>
            </form>
        </div>
    </div>
	<script>
		layui.use(['element', 'layer'], function(){
		  var element = layui.element;
		  var layer = layui.layer;
		  
		  //监听折叠
		  element.on('collapse(test)', function(data){
			//layer.msg('展开状态：'+ data.show);
		  });
		});
		function selectTime(orderid){
			layer.confirm('确定设置该时间为初始时间吗', function(index){
				$.ajax({
					url: '/admin/Hitcode/selectStartime?order_id='+orderid,
					dataType: 'json',
					type: 'get',
					success:function(data){
						layer.msg(data.msg);
						if($data.status==1){
							//joinTab(data.data['account_name']+'打码量','/admin/Hitcode/index?account_identity='+data.data['account_identity']);
							window.location.href='/admin/Hitcode/index?account_identity='+data.data['account_identity'];
						}
						
					}
				});
				
			 });
		}


	</script>

@endsection
