<?php
if($op==""){
 if($chsh_usertype==1){$op="yue";}else{$op="dian";}
}?>
 		<div class="userMain">
			<div class="uMain_title"><span class="pay">在线购买</span></div>
			<div class="uMain_content">
				<div class="stageBox">
					<div class="stageBoxTop"><span></span></div>
					<div class="stageBoxCenter">
						<div class="stageBoxCenterContent">
							<div class="main_nav">
								<ul>
				                                     <li <?php if($op=="yue"){ echo "class='nava_4'";}else{ echo "class='navb_4'";}?>><a href="?ac=pay&op=<?php if($chsh_usertype==1){echo'yue">月';}else{echo'dian">点';}?>卡列表</a></li>				 
				                                     <li <?php if($op=="my"){ echo "class='nava_4'";}else{ echo "class='navb_4'";}?>><a href="?ac=pay&op=my">我的卡号</a></li>
				                                     <li class='navb_4'><a href="?ac=change">在线升级</a></li>
								</ul>
								<div class="action"><a href="?ac=paycz&op=add">在线充值</a></div>
							</div>
							<div class="main_nav2">
								<ul>
								<li class='nav2b_4'></li>
								<li class='nav2b_4'></li>
								<li class='nav2b_4'><b>您当前余额：<font color=red>&nbsp;￥<?php echo $chsh_rmb?>.00&nbsp;元</font>,&nbsp;&nbsp;您可以购买:&nbsp;<font color="009966"><?php if($chsh_usertype==0){ echo "点卡";}else{ echo "月卡";}?></font>&nbsp;进行充值,&nbsp;&nbsp;您的<?php echo $chsh_type?>&nbsp;<font color="#ff0000"><?php echo $chsh_points?></font></b></li>
								</ul>
							</div>
							<div class="minHeight500">
								<div class="paylist"><ul>
<?php
$a=1;
	global $db;
if($op=="dian"){
	$sql="select * from s_card where S_CardState=0 and S_CardGroup=0 order by s_id desc";
}elseif($op=="yue"){
	$sql="select * from s_card where S_CardState=0 and S_CardGroup=1 order by s_id desc";
}else{
	$sql="select * from s_card where S_CardState=1 and S_CardVip='".$chsh_username."' order by s_id desc";
}
		$Arr=getuserpage($sql,"20");//sql,每页显示条数
		$result=$db->query($Arr[2]);
		$numdate="a";
		if($result){
			while ($row = $db ->fetch_array($result)){
		$numdate="b";
?>
<li>
<span class="cbox"><?php echo $a?>.</span>
<span class="mnameb">卡号：<a><?php echo $row["S_CardNum"]?></a></span>
<?php 
if($row["S_CardGroup"]==0){
?>
<span class='mname'>类型：<a>点卡</a></span>
<span class='mname'>点数：<a><?php echo $row["S_CardWorth"]?>点</a></span>
<?php
}else{
?>
<span class='mname'>类型：<a>月卡</a></span>
<span class='mname'>月数：<a><?php echo $row["S_CardWorth"]?>个月</a></span>
<?php
} 
if($op=="my"){
?>
<span class="mname">人民币：<a>￥<?php echo $row["S_RMB"]?>.00</a></span>
<?php
}else{
?>
<span class="mname">价钱：<a>￥<?php echo $row["S_RMB"]?>.00</a></span>
<?php
}
if($op=="my"){
   if($row["S_CardUsed"]==1){
         echo "<span class=mname><font color=0000ff>已经使用</font></a></span>";
   }else{
         echo "<span class=mname><a href='do.php?ac=pay&id=".$row["S_ID"]."'><b>立即使用</b></a></span>";
   }
}elseif(($chsh_usertype==$row["S_CardGroup"])&&($chsh_rmb >= $row["S_RMB"])){
?>
<span class="mname"><a href="do.php?ac=pay&id=<?php echo $row["S_ID"]?>"><b>立即购买</b></a></span>
<?php
}else{
        if($chsh_usertype==$row["S_CardGroup"]){
?>
<span class="mname"><a href="?ac=paycz"><font color="0000ff">余额不足,请先充值</font></a></span>
<?php
        }else{
?>
<span class="mname"><font color="0000ff"><a>你不能购买此类型卡</a></font></span>
<?php
        }
}
?>													
</li>
<?php
$a=$a+1;
}
if($numdate=="a"){
		echo("<div class='nothing'>目前没有此类型充值卡。</div>");
}
?>	
</ul>																</div>
																<div class="page">
		
									<div class="pages"><?php echo $Arr[0];?></div>
<?php
}
?>
								</div>
															</div>
						</div>
					</div>
					<div class="stageBoxBottom"><span></span></div>
				</div>
			</div>