<?
include("../config/conn.php");
include("../config/function.php");
sesCheck();
$sqluser="select * from yjcode_user where uid='".$_SESSION[SHOPUSER]."'";mysql_query("SET NAMES 'GBK'");$resuser=mysql_query($sqluser);
if(!$rowuser=mysql_fetch_array($resuser)){php_toheader("../reg/");}
$sj=date("Y-m-d H:i:s");

//函数B
if($_GET[action]=="del"){
deletetable("yjcode_car where id=".$_GET[id]." and userid=".$rowuser[id]);
php_toheader("car.php");
}
//函数E
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="x-ua-compatible" content="ie=7" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户管理面板 - <?=webname?></title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/personalCenter.css">
<link rel="stylesheet" type="text/css" href="css/global.css">
<link rel="stylesheet" type="text/css" href="css/index.css">
<!--<link rel="stylesheet" type="text/css" href="css/gameListStyle.css">
<link rel="stylesheet" type="text/css" href="css/oldstyle.css">-->
<link rel="stylesheet" type="text/css" href="css/layui.css">
<script language="javascript" src="../js/basic.js"></script>
<script language="javascript" src="js/index.js"></script>
<script language="javascript">
function xuanall(){
xuan();
carmoney();
}

function carmoney(){
am=0;
carallv=parseInt($("carallnum").innerHTML);
for(i=0;i<carallv;i++){
 c=$("check"+i).checked;
 if(c==true){
  inpmoney=parseFloat($("inpmoney"+i).value)
  inpnum=parseInt($("inpnum"+i).value)
  am=addNum(am,accMul(inpnum,inpmoney));
 }
}
$("moneyall").innerHTML=am;
}

function carjs(){
carid="";
carallv=parseInt($("carallnum").innerHTML);
for(i=0;i<carallv;i++){
 c=$("check"+i).checked;
 if(c==true){
  carid=carid+$("check"+i).value+"-"+$("inpnum"+i).value+"c";
 }
}
if(carid==""){alert("未选择任何结算商品");return false;}
location.href="carpay.php?carid="+carid;
}

</script>
</head>
<body style="background:#f7f7f7;">
<? include("top.php");?>



<div class="personal_center main_wrap clear">
<? include("left.php");?>
<div class="realName">
        <div class="rn_title">
            <span>购物车</span>
        </div>

<!--RB-->
<div class="right">
<ul class="carcap">
<li class="l0"><input name="C2" onclick="xuanall()" checked="checked" type="checkbox" value="" /></li>
<li class="l1">商品信息</li>
<li class="l4">购买数量</li>
<li class="l2">单价</li>
<li class="l3">操作</li>
</ul>
<?
$i=0;
while0("*","yjcode_car where userid=".$rowuser[id]." order by sj desc");while($row=mysql_fetch_array($res)){
 while1("*","yjcode_pro where bh='".$row[probh]."' and zt=0 and ifxj=0");if($row1=mysql_fetch_array($res1)){
 $money=returnyhmoney($row1[yhxs],$row1[money2],$row1[money3],$sj,$row1[yhsj1],$row1[yhsj2],$row1[id]);
 $money1=$row1["money1"];
 $tp="../".returntp("bh='".$row[probh]."' order by iffm desc","-2");
 $au="../product/view".$row1[id].".html";
?>
 <ul class="carlist">
 <li class="cap">
 <a class="s1" href="http://wpa.qq.com/msgrd?v=1&uin=<?=returnqq($row1[userid])?>&site=<?=weburl?>&menu=yes" target="_blank">卖家：<?=returnnc($row1[userid])?></a>
 <span class="s2"><?=$row[sj]?></span>
 </li>
 <li class="l0"><input onclick="carmoney()" <? if($row1[kcnum]>0){?>checked="checked"<? }else{?> disabled="disabled"<? }?> name="C1" id="check<?=$i?>" type="checkbox" value="<?=$row[id]?>" /></li>
 <li class="l1"><a href="<?=$au?>" target="_blank"><img border="0" src="<?=returntppd($tp,"img/none60x60.gif")?>" width="50" height="50" /></a></li>
 <li class="l11">
 <a href="<?=$au?>" target="_blank" class="a2" title="<?=$row1["tit"]?>"><?=returntitdian($row1["tit"],128)?></a><br>
 <? 
 if(!empty($row[tcid])){
 while2("*","yjcode_taocan where id=".$row[tcid]);if($row2=mysql_fetch_array($res2)){
 $money=$row2[money1];
 $money1=$row2[money2];
 $tit=$row2[tit];
 if($row2[admin]==2){$tit=$tit." ".$row2[tit2];}
 ?>
 套餐：<?=$tit?>
 <? }}?>
 </li>
 <li class="l4">
 <input style="display:none;" id="inpmoney<?=$i?>" type="text" value="<?=$money?>" />
 <input class="inp1" id="inpnum<?=$i?>" onchange="carmoney()" onkeyup="value=value.replace(/[^\d]/g,'');carmoney();" type="text" value="<?=$row[num]?>" />
 </li>
 <li class="l2"><s>￥<?=$money1?></s><br><strong>￥<?=returnjgdian($money)?></strong></li>
 <li class="l3"><a href="car.php?action=del&id=<?=$row[id]?>">删除</a></li>
 </ul>
<?
 $i++;
 }
}
?>
<ul class="carjs">
<li class="l4"><img src="img/js.gif" style="cursor:pointer;" onclick="carjs()" /></li>
<li class="l5">合计：<span class="s1">￥</span><span class="s2" id="moneyall">0</span></li>
</ul>
<span id="carallnum" style="display:none;"><?=$i?></span>
<script language="javascript">
carmoney();
</script>
</div> 
<!--RE-->

</div>
<? include("bottom.php");?>
</body>
</html>