<?

include("../../config/conn.php");

include("../../config/function.php");

sesCheck_m();

$userid=returnuserid($_SESSION[SHOPUSER]);

//函数B

if($_GET[action]=="del"){

deletetable("yjcode_car where id=".$_GET[id]." and userid=".$userid);

php_toheader("car.php");

}

//函数E

?>

<html>

<html>

<head>

<meta http-equiv="x-ua-compatible" content="ie=7" />

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>

<title>会员中心 <?=webname?></title>

<link rel="stylesheet" href="../css/basic.css">

<link rel="stylesheet" href="index.css">

<script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>

<script language="javascript" src="../js/basic.js"></script>

<script language="javascript" src="index.js"></script>

<script language="javascript">

function xuanall(){

xuan();

carmoney();

}

function carmoney(){

am=0;

carallv=parseInt(document.getElementById("carallnum").innerHTML);

for(i=0;i<carallv;i++){

 c=document.getElementById("check"+i).checked;

 if(c==true){

  inpmoney=parseFloat(document.getElementById("inpmoney"+i).value)

  inpnum=parseInt(document.getElementById("inpnum"+i).value)

  am=addNum(am,accMul(inpnum,inpmoney));

 }

}

document.getElementById("moneyall").innerHTML=am;

}



function carjs(){

carid="";

carallv=parseInt(document.getElementById("carallnum").innerHTML);

for(i=0;i<carallv;i++){

 c=document.getElementById("check"+i).checked;

 if(c==true){

  carid=carid+document.getElementById("check"+i).value+"-"+document.getElementById("inpnum"+i).value+"c";

 }

}

if(carid==""){alert("未选择任何结算商品");return false;}

location.href="carpay.php?carid="+carid;

}



</script>

</head>

<body>

<? include("top.php");?>



<div class="boxcap box">

 <div class="d1"><a href="../">用户中心</a> - 购物车</div>

</div>



<?

$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";

?>

<div class="carM box">

 <div class="d1">卖家：<?=returnnc($row1[userid])?></div>

 <div class="d2"><a href="car.php?action=del&id=<?=$row[id]?>">删除</a></div>

</div>

<div class="car box">

 <div class="d1"><input onClick="carmoney()" checked="checked" name="C1" id="check<?=$i?>" type="checkbox" value="<?=$row[id]?>" /></div>

 <div class="d2"><a href="<?=$au?>" target="_blank"><img border="0" src="<?=returntppd($tp,"img/none60x60.gif")?>" width="50" height="50" /></a></div>

 <div class="d3">

 <?=returntitdian($row1["tit"],60)?><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?>

 <? }}?><br>

 <input style="display:none;" id="inpmoney<?=$i?>" type="text" value="<?=$money?>" />

 <strong>￥<?=returnjgdian($money)?></strong>&nbsp;&nbsp;&nbsp;<s>￥<?=$money1?></s>

 </div>

 <div class="d4"><input class="inp1" id="inpnum<?=$i?>" onChange="carmoney()" onKeyUp="value=value.replace(/[^\d]/g,'');carmoney();" type="text" value="<?=$row[num]?>" /></div>

</div>

<?

 $i++;

 }

}

?>



<div class="carjs box">

 <div class="d1">合计：<span class="s1">￥</span><span class="s2" id="moneyall">0</span></div>

 <div class="d2"><img src="../../user/img/js.gif" onClick="carjs()" /></div>

</div>

<span id="carallnum" style="display:none;"><?=$i?></span>

<script language="javascript">

carmoney();

</script>



<? include("bottom.php");?>

</body>

</html>