<!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>
<title>购物车 - 订单号:{dede:var.carts.orders_id/}</title>
<meta http-equiv="Content-Type" content="text/html; charset={dede:global.cfg_soft_lang/}" />
<meta name="generator" content="DedeCMS V5.3" />
<meta name="author" content="desdev.cn" />
<link href="{dede:global.cfg_templeturl/}/style/dedecms.css" rel="stylesheet" media="screen" type="text/css" />
<link href="{dede:global.cfg_templeturl/}/style/table.css" rel="stylesheet" media="screen" type="text/css" />
<script type="text/javascript" language="javascript" src="../images/js/j.js"></script>
</head>
<body class="buycarpage">

<div class="header">
	<div class="top w960 center">
		<div class="title">
			<h1> <a href="{dede:global.cfg_basehost/}">{dede:global.cfg_webname/}</a></h1>
		</div><!-- /title -->
		<div class="welcome">
            <?php
            if(!$cfg_ml->IsLogin()){
            ?>
            您好,欢迎来到本网站, 请 <a href="../member/login.php?gourl=<?php echo urlencode(GetCurUrl());?>">登录</a> 或 <a href="../member/index_do.php?fmdo=user&dopost=regnew">注册</a>
            <?php
            }else{
            ?>
            <?php echo $cfg_ml->M_UserName; ?> 您好,欢迎来到本网站, <a href="../member/">会员中心</a> | <a href="../member/index_do.php?fmdo=login&dopost=exit">退出</a>
            <?php
            }
            ?>
		</div><!-- /banner -->
	</div><!-- /top -->
	<div class="nav mt1">
		<div class="w960 center">
			<ul>
              <li class="r1"><a href="{dede:global.cfg_memberurl/}">会员中心</a></li>
              <li class="r2"><a href="{dede:global.cfg_cmsurl/}/tags.php">TAG标签</a></li>
              <li class="r3"><a href="{dede:global.cfg_dataurl/}/sitemap.html">网站地图</a></li>
              <li class="r4"><a href="{dede:global.cfg_dataurl/}/rssmap.html">RSS订阅</a></li>
			</ul>
		</div>
	</div><!-- /nav -->
</div><!-- /header -->

<div class="w960 clear center mt1 cmt-box">
	<div class="sp-title"><h2>购物车</h2></div>
    <div id="errorChickCookie" class="clear center mt1" style="font-style:inherit;color:#666;font-weight:normal;padding-top:8px;padding-bottom:8px;text-align:center;"></div>	
    <div class="buycar">
		<h2>我的购物车 - 订单号:<em id="carId">{dede:var.carts.orders_id/}</em></h2>
		<form id="form1" name="form1" method="post" action="posttocar.php">
		<input id="dopost" name="do" type="hidden" value="del" />
        <!--startprint1-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="dede_table trlist">
			<thead>
				<tr>
					<td colspan="6">商品列表</td>
				</tr>
			</thead>
			<tbody>
				<!--以下列出购物车内购商品列表(数组),开始遍历数组-->
				<tr>
					<th>选择</th>
					<th>编号</th>
					<th>名称</th>
					<th>数量</th>
					<th>单价(元)</th>
					<th>操作</th>
				</tr>
                {dede:array.Items}
				<tr>
					<td height="23"><input type="checkbox" name="ids[]" value="{dede:value.id/}" /></td>
					<td height="23">{dede:value.id/}</td>
					<td height="23"><a href="view.php?aid={dede:value.id/}" target="_bank">{dede:value.title/}</a></td>
					<td height="23">
						<input name="buynum{dede:value.id/}" type="text" id="buynum{dede:value.id/}" value="{dede:value.buynum/}" size="5" maxlength="5" class="ipt-txt" />
						<small>{dede:value.units/}</small></td>
					<td height="23">{dede:value.price/}</td>
					<td height="23"><a href="posttocar.php?do=del&ids={dede:value.id/}">删除</a></td>
				</tr>
                {/dede:array}
				<!--构造购物车内商品列表结束-->
			</tbody>
			<tfoot>
				<tr>
					<td colspan="6" align="right">
						<div style="float:left;">
							共 <font color=red>{dede:var.carts.cart_count/}</font> 件商品,合计: <font color=red>{dede:var.carts.price_count/}</font>元	</div>
							<div style="float:right; height:33px;">
							<!--<input type="button" value="打印购物车" class="btn-2" onclick="printPage(1)"/>--> 
                            <input type="button" value="更新订单号" class="btn-2" onclick="makeCarId()"/>
							<input type="button" value="删除已选定" class="btn-2" onclick="DelPost()"/>
							<input type="button"  value="清空" onclick="if(confirm('确定清空购物车中的商品吗?')){ location='posttocar.php?do=clear' }" class="btn-2" />
							<input onclick="ChangePost()" type="button" value="更新数量" class="btn-2" />
							<input type="button"  value="下一步" onclick="location='carbuyaction.php'" class="btn-2" />
						</div>
					</td>
				</tr>
			</tfoot>
		</table>
        <!--endprint1-->
        </form>
	</div>    
</div>
<!--购物车列表操作javascript请不要随意改动-->
<script language="JavaScript" type="text/javascript">
//遍历checkbox使之全选中,或反选
function CheckAll()
{
	for (var i=0;i<document.form1.elements.length;i++)
	{
		var e = document.form1.elements[i];
		e.checked == true ? e.checked = false : e.checked = true;
	}
}
//改变表单dopost值为:update,后submit提交表单
function ChangePost()
{
	CheckAll();
	document.getElementById("dopost").value = 'update';
	document.form1.submit();
}
//改变表单dopost值为:del,后submit提交表单
function DelPost()
{
	document.getElementById("dopost").value = 'del';
	document.form1.submit();
}
//AJAX产生一个新的订单编号
function makeCarId()
{
	$.ajax({type: "POST", url: "car.php", data: "dopost=makeid", dataType: 'text',success: function(result){$("#carId").html(result);}}); 
}
//Print Page
function printPage(oper)
{
	if (oper < 10)
	{
		bdhtml = window.document.body.innerHTML;//获取当前页的html代码
		sprnstr = "<!--startprint"+oper+"-->";//设置打印开始区域
		eprnstr = "<!--endprint"+oper+"-->";//设置打印结束区域
		prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html
		prnhtml = prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html
		window.document.body.innerHTML = prnhtml;
		window.print();
		window.document.body.innerHTML = bdhtml;
	}else{
		window.print();
	}
}
</script>
<!--购物车列表操作javascript结束-->
<div class="footer w960 center mt1 clear">
	<!-- 
		为了支持织梦团队的发展,请您保留织梦内容管理系统的链接信息.
		我们对支持织梦团队发展的朋友表示真心的感谢!织梦因您更精彩!
	-->
	<p class="powered">
		Powered by <a href="http://www.dedecms.com" title="织梦内容管理系统(DedeCms)--国内最专业的PHP网站管理系统，轻松建站的首选利器。" target="_blank"><strong>DedeCMS<span>{dede:global.cfg_version/}</span></strong></a> &copy; 2004-2008 <a href="http://www.desdev.cn/" target="_blank">DesDev</a> Inc.	</p>
<!-- /powered -->
	<p class="copyright">
		{dede:global.cfg_powerby/}<br />{dede:global.cfg_beian/}
  </p>
</div>
<script language="JavaScript" type="text/javascript">
if(!navigator.cookieEnabled)
{
	$('#errorChickCookie').html('您浏览器的 cookie 功能被禁用,请启用此功能!');
	$('.buycar').hide();
}
</script>
</body>
</html>