<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/manager.css" rel="stylesheet" >
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<style>
.page-list .trunk-search{
  padding-top: 20px;
}
.view-detail {
    width: 70px;
    height: 35px;
    display: block;
    background: #409eff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.normal_table td .status-0 {
  color: #e6a23c;
}
.normal_table td .status-1 {
  color: #67c23a;
}
.normal_table td .status-2 {
  color: #f56c6c;
}
.normal_table tr td {
  padding: 10px 5px;
}
</style>
</block>

<block name="body">
      <div class="page-list normal_list apply-app_apply-list">

      <div class="trunk-title">
        <div class="location">
          <div class="location-container">当前位置:<span>测试资源></span><span>测试资源申请记录</span></div>
        </div>
        <img src="__IMG__/20180207/icon_normal_shenqing.png">
        <span class="title_main">测试资源申请记录</span>
        <span class="details">说明:测试资源申请记录</span>
      </div>


       <div class="trunk-content article">
          <div class="trunk-search clearfix">
            <div  id="form1">
       
              <div class="form-group normal_space fr">
                <input type="submit" class="submit" id='submit' value="查询" url="{:U('batches')}" style="cursor:pointer;">
              </div>
              <div class="form-group normal_space fr">
                  <select name="provide_status" class="reselect select_gallery">
                      <option status-id="" value="">请选择发放状态</option>
                      <?php foreach($provideStatusList as $key => $name):?>
                      <option status-id="<?=key?>" value="<?=$key?>" <?php if(strval($key) === I('provide_status')):?>selected="selected"<?php endif;?>>
                        <?=$name?>
                      </option>
                      <?php endforeach;?>
                  </select>
              </div>
              <div class="form-group normal_space fr" style="margin-left: 9px;">
                <label class="form-title select-title" style="margin-right: 9px;">至</label>
                <div class="select-time">
                  <input type="text" id="edate" class="txt" name="create_time_end" placeholder="结束时间" value="{:I('create_time_end')}"  autocomplete="off">
                </div>
              </div>
              <div class="form-group normal_space fr">
                <label class="form-title select-title">申请时间:</label>
                <div class="select-time">
                  <input type="text" id="sdate" class="txt" name="create_time_start" placeholder="开始时间" value="{:I('create_time_start')}"   autocomplete="off">
                </div>
              </div>
              
               <div class="form-group normal_space fr">
                  <input type="text" name="account" class="txt normal_txt" id="uid" style="width:110px;" placeholder="请输入玩家账号" value="{:I('account')}" onKeyDown="webchat_chkkeysend(event);">
              </div>

              <div class="form-group normal_space fr">
              <span id="server_js">
                    <select id="server_id" name="server_id" class="reselect select_gallery"  style="width:101px">
                      <option server-id="0" value="">请选择区服</option>
                      <?php foreach($servers as $server):?>
                      <option server-id="<?=$server['server_id']?>" value="<?=$server['id']?>" <?php if($server['id'] == I('server_id')):?>selected="selected"<?php endif;?>>
                          <?=$server['server_name']?>
                      </option>
                      <?php endforeach;?>
                    </select>
              </span>
              </div>

                 <div class="form-group normal_space fr">
                    <select id="game_id" name="game_id" class="reselect select_gallery" >
                        <option game-id="0" value="">请选择游戏</option>
                        <?php foreach($games as $game):?>
                        <option game-id="<?=$game['id']?>" value="<?=$game['id']?>" <?php if($game['id'] == I('game_id')):?>selected="selected"<?php endif;?>>
                            <?=$game['game_name']?>
                        </option>
                        <?php endforeach;?>
                    </select>
              </div>
            </div>
          </div>
      </div>
     
      <div class="page-list apply-app_apply-list query-recharge-list">
      <div class="trunk-content article">
          <div class="tabcon trunk-list">
            <table class="table normal_table zwm_tab" >
                <tr class="odd zwm_tr">
                  <th width="125px">批次号</th>
                  <th>申请时间</th>
                  <th>游戏名称</th>
                  <th>区服名称</th>
                  <th>角色名称</th>
                  <th>测试账号</th>
                  <th>手机号</th>
                  <th>所属推广员</th>
                  <!-- <th>发放总金额</th> -->
                  <th>申请金额</th>
                  <th>发放金额</th>
                  <th>审核状态</th>
                  <th>审核时间</th>
                  <th>发放状态</th>
                  <th>发放时间</th>
                  <!-- <th>资源内容</th> -->
                  <th>操作</th>
                </tr>
                <empty name="records">
                <tr><td colspan="16" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
                <else />
                <volist name="records" id="record" mod="2">
                <tr data-id="{$record.id}" class="<eq name='mod' value='1'>odd</eq>">
                    <td style="word-wrap:break-word;">{$record.batch_no}</td>
                    <td>
                      <?=substr($record['create_time'], 0, 10)?>
                      <br>
                      <?=substr($record['create_time'], 10)?>
                    </td>
                    <td>{$record.game_name}</td>
                    <td>{$record.server_name}</td>
                    <td>{$record.role_name}</td>
                    <td>{$record.user_account}</td>
                    <td>{$record.user_phone}</td>
                    <td>{$record.promote_account}</td>
                    <!-- <td>{$record.history_provide_amount}</td> -->
                    <td>{$record.apply_amount}</td>
                    <td>{$record.provide_amount}</td>
                    <td>
                      <span class="status-{$record.verify_status}">{$record.verify_status_text}</span>
                    </td>
                    <td>
                      <?=substr($record['verify_time'], 0, 10)?>
                      <br>
                      <?=substr($record['verify_time'], 10)?>
                    </td>
                    <td>
                      <span class="status-{$record.provide_status}">{$record.provide_status_text}</span>
                    </td>
                    <td>
                        <?=substr($record['provide_time'], 0, 10)?>
                        <br>
                        <?=substr($record['provide_time'], 10)?>
                    </td>
                    <!-- <td>{$record.content}</td> -->
                    <td><button class="view-detail">操作</button></td>
                </tr>
                </volist>
                </empty>
            </table>
           
            <div class="pagenation clearfix">
                {$pagination}
            </div>
          </div>
      </div>
      </div>
    </div>
</block>
<block name="script">
<link rel="stylesheet" type="text/css" href="__CSS__/p_jquery.datetimepicker.css">
<script type="text/javascript" src="__JS__/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>

<script type="text/javascript">

$().ready(function(){
  setValue('row','{:I("get.row",10)}');
   $("#pagehtml a").on("click",function(event){
    event.preventDefault();//使a自带的方法失效,即无法调整到href中的URL(http://www.baidu.com)
    var geturl = $(this).attr('href');
    $('#data_form').attr('action',geturl);
    $('#data_form').submit();
   });
   
   $('#sdate').datetimepicker({
    lang:'ch',
    format:'Y-m-d',
    formatDate:'Y-m-d',
    timepicker:false
  });

  $(".select_gallery").select2();
  $('#edate').datetimepicker({
    lang:'ch',
    format:'Y-m-d',
    formatDate:'Y-m-d',
    timepicker:false
  });

  $('.view-detail').on({
    click:function () {
      var url = "{:U('TestingResource/orders', '', '')}"
      var id = $(this).parents('tr').eq(0).attr('data-id')
      url += '/id/' + id
      layer.open({
        title: '查看申请订单',
        type: 2,
        content: [url , 'no'],
        area: ['1200px', '400px'],
        zIndex: 250,
        scrollbar: false,
      })
    }
  })
});
</script>
<script type="text/javascript">

$("#submit").click(function(){

    var sdate =$('#sdate').val();
    var edate =$('#edate').val();

    if(Date.parse(sdate) > Date.parse(edate)){
      layer.msg('开始时间必须小于等于结束时间');
      return false;
    }



    var url = $(this).attr('url');

        var query  = $('#form1').find('input').serialize();

        query  += "&"+$('#form1').find('select').serialize();

        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');

        query = query.replace(/^&/g,'');

        if( url.indexOf('?')>0 ){

            url += '&' + query;

        }else{

            url += '?' + query;

        }

    window.location.href = url;

  });



  $("#game_id").change(function(){
    $.ajax({
      url: "{:U('getServers')}",
      type: "post",
      data: {game_id:$("#game_id option:selected").attr('game-id')},
      dataType: 'json',
      success: function(result) {
        if (result.status == 1) {
          var servers = result.data.servers
          var str = "<option value=''>请选择区服</option>"
          for (var i in servers){
            str += "<option value='"+servers[i].id+"'>"+servers[i].server_name+"</option>"
          }
          $("#server_id").empty()
          $("#server_id").append(str)
          $("#server_id").select2()
        }
      }
    })
  })

function webchat_chkkeysend(event)
{
   if (event.keyCode==13) {

    $('#submit').click();
  }
}


</script>  
</block>