<div style="width:90%;margin:30px auto;">
  <div class="panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title">交易记录导出&nbsp;<a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/train/index/ht_order_list');?>">订单列表>></a> </h3>
      </div>
      <div class="panel-body">
       <form style="width: 80%;" action="" method="post">
        <input type="text" name="from_date" class="date" value="<?php echo empty($from_date)?"":$from_date;?>">至
        <input type="text" name="to_date" class="date" value="<?php echo empty($to_date)?"":$to_date;?>">
        审核状态：<input type="checkbox" <?php echo empty($examine)?"":"checked";?> name="examine" />&nbsp;&nbsp;&nbsp;
        <button type="submit" id="sub" class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-download-alt"></span> Download</button>  
       </form>
       <p style="margin: 0 0 10px; width: 200px; float: left; line-height: 30px;">
  <!--       <table class="table table-hover" >
               <thead>
                 <tr><th>时间</th><th>信息</th><th>变化值</th><th>团名</th><th>外联</th></tr>
               </thead>
               <tbody>
                 
                 <tr data-id="161130252" title="Popover title"  data-container="body" data-toggle="popover" data-placement="top" data-content="顶部的 Popover 中的一些内容">
                   <td>2016-12-01 11:18:28</td>
                   <td> 票款(有充值)</td>
                   <td>-1106.00</td>
                   <td>R161228-BYW161130252</td>
                   <td>李毅文</td>
                 </tr>
                 
               </tbody>
            </table> -->
        <div class="row <?php echo empty($examine)?"hidden":"";?>" style="width:90%;margin:0 auto;">
          <div class="">       
            <table class="table table-hover" id="list_table">
               <thead>
                 <tr><th>时间</th><th>信息</th><th>变化值</th><th>团名</th><th>外联</th></tr>
               </thead>
               <tbody>
                 
                  <?php foreach ($data as $key => $value) {?>
                  <tr data-id="<?php echo $value[8];?>"  title="Popover title"  data-container="body" data-toggle="popover" data-placement="top" data-content="顶部的 Popover 中的一些内容">
                   <td><?php echo $value[2];?></td><td><?php echo $value[3];?></td><td><?php echo $value[1];?></td><td><?php echo $value[6];?></td><td><?php echo $value[7];?></td>
                  </tr>
                  <?php }?>
                 
               </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    
</div>
<div class="popover fade top in" role="tooltip" id="popover" style="width:auto;max-width: 100% !important;top: 139.6px; left: 50%; display: none;">
  <div class="arrow"></div>
  <h3 class="popover-title">我的支付</h3>
  <div class="popover-content">
    <table class="table" id="my_pay_data">
      <thead>
        <tr>
          <td>序号</td><td>车次</td><td>出发日期</td><td>价格</td><td>备注</td>
        </tr>
      </thead>
      <tbody>
        
      </tbody>
    </table>
  </div>
</div>
<script>

  $(".date").datepicker({
    'format': 'yyyy-m-d',
    'autoclose': true
  });
  $("body").click(function(){
    $("#popover").css("display","none");
  });
  $("#popover").click(function(e){
    e.stopPropagation();//阻止事件冒泡，防止点击这个div也被隐藏
  });
  var popover_top=0;
  var tr="";
  $("#list_table>tbody>tr").click(function(e){
    e.stopPropagation();
    popover_top=$(this).offset().top-$("#popover").height();
    var this_id=$(this).attr("data-id");
    var THIS=$(this);
    url="<?php echo site_url('apps/train/index/get_ht_my_pay?').'id=';?>"+this_id;
    $.ajax({
        url:url,
        beforeSend:function(data){
          
          // $("#popover").css("top",popover_top);
          // $("#popover").css("display","block");
        },
        success:function(data){
            tr="";
            if(data.status==1){
              $.each(data.datas,function(n,value){
                tr+="<tr><td>"+(n+1)+"</td><td>"+value["TOC_TrainNumber"]+"</td><td>"+value["TOC_DepartureDate"]+"</td><td>"+value["TOC_TicketCost"]+"</td><td>"+value["TOC_Memo"]+"</td></tr>";              
              });
            }
            $("#my_pay_data>tbody").html(tr); 
            popover_top=THIS.offset().top-$("#popover").height();
            $("#popover").css("top",popover_top);
            $("#popover").css("display","block");
        },
        dataType: "json",       
    });
  });
</script>