<script type="text/javascript" src="https://data.chinahighlights.com/js/train/StationInfo.js"></script>
<div style="width:90%;margin:30px auto;">
	<div class="panel panel-primary" style="width:60%;margin:0 auto;">
      <div class="panel-heading">
        <h3 class="panel-title"><?php echo $result["train_date"];?>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $result["checi"];?>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo isset($result["ordernumber"])?$result["ordernumber"]:"";?></h3>
      </div>
      <div class="panel-body">
      	<?php if((int)$result["status"]>1):?>
	      	<p style="display:inline-block"><?php echo $result["from_station_name"];?><span class="from_station_en"> </span><br><span class="start_time"></span></p><span class="glyphicon glyphicon-arrow-right"> </span><p style="display:inline-block"> <?php echo $result["to_station_name"];?><span class="to_station_en"> </span><br><span class="arrive_time"></span></p>
	      	<?php foreach ($result["passengers"] as $v):?>
	      		<p style="border-top:1px dashed #000; height:1px;margin-top:10px;" ></p>
	      		<p><?php echo @$v["passengersename"]."({$v['piaotypename']})&nbsp;&nbsp;&nbsp;&nbsp;{$v['zwname']}&nbsp;&nbsp;{$v['cxin']}&nbsp;&nbsp;&nbsp;&nbsp;票价：￥{$v['price']}";?></p>
	      	<?php endforeach;?>
	      	<?php if((int)$result["status"]===2):?>
	      	<p style="border-top:1px dashed #000; height:1px;margin-top:10px;" ></p>
	      	<p>占座成功，请在：<?php echo date("Y-m-d H:i:s",strtotime($result["deal_time"])+30*60);?> 前付款，超时将失效</p>
	    	
	    		<?php if((strtotime($result["deal_time"])+30*60)<time()):?>
	    			<p style="border-top:1px dashed #000; height:1px;margin-top:10px;" ></p>
					<p style="text-align:center;color:red;">订单已超时失效</p>
	    		<?php else:?>
	    			<p style="border-top:1px dashed #000; height:1px;margin-top:10px;" ></p>
					<p style="text-align:center;"><a href="cancel_order?order=<?php echo $result['orderid']?>" style="padding:5px 15px;" class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-remove"></span>取消订单</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="pay?order=<?php echo $result['orderid']?>" style="padding:5px 15px;" class="btn btn-success btn-sm">￥支付</a></p>	
	    		<?php endif;?>
	    		
	    	<?php endif;?>
	    	<?php if((int)$result["status"]===4):?>
	    	<p style="border-top:1px dashed #000; height:1px;margin-top:10px;" ></p>
	    	<p>出票成功</p>	
	    	<p style="border-top:1px dashed #000; height:1px;margin-top:10px;" ></p>
	    	<p style="text-align:center;"><a href="refund?order=<?php echo $result['orderid']?>" style="padding:5px 15px;" class="btn btn-warning btn-sm">前往退票 <span class="glyphicon glyphicon-forward"></span></a></p>
	    	<?php endif;?>

	    	<?php if((int)$result["status"]===6):?>
	    	<p style="border-top:1px dashed #000; height:1px;margin-top:10px;" ></p>
	    	<p>正在处理退票</p>
	    	<p style="text-align:center;"><a href="refund?order=<?php echo $result['orderid']?>" style="padding:5px 15px;" class="btn btn-warning btn-sm">查看详情 <span class="glyphicon glyphicon-forward"></span></a></p>
	    	<?php endif;?>

	    	<?php if((int)$result["status"]===7):?>
	    	<p style="border-top:1px dashed #000; height:1px;margin-top:10px;" ></p>
	    	<p><?php echo $result["msg"];?></p>
	    	<p style="text-align:center;"><a href="refund?order=<?php echo $result['orderid']?>" style="padding:5px 15px;" class="btn btn-warning btn-sm">查看详情 <span class="glyphicon glyphicon-forward"></span></a></p>
	    	<?php endif;?>
	    <?php else:?>
	    	<p><?php echo $result["msg"];?></p>  	
	    <?php endif;?>  	
      </div>
  	</div>
</div>   	
<script>
var StationInfoArr = StationInfo.split("@");
var StationNameArr = new Array();
var code_name = new Array();
var station_cn_en = new Array();
var form_data = {};
for (var i = 0; i < StationInfoArr.length; ++i) {
	StationNameArr.push(StationInfoArr[i].split("|"));
	code_name[StationNameArr[i][1]] = [StationNameArr[i][2]];
	station_cn_en[StationNameArr[i][3]] = StationNameArr[i][2];
}
$(function(){
	var from_station_en = code_name['<?php echo $result['from_station_code']?>'];
	var to_station_en = code_name['<?php echo $result['to_station_code']?>'];
	var start_time = '<?php echo $result['start_time']?>';
	var arrive_time = '<?php echo $result['arrive_time']?>';

	//console.log(code_name);
	$('.from_station_en').html('('+from_station_en+') ');
	$('.to_station_en').html('('+to_station_en+')');
	$('.start_time').html('('+start_time.substring(0,start_time.length-3)+')');
	$('.arrive_time').html('('+arrive_time.substring(0,arrive_time.length-3)+')');
});	
</script>

