<%@page contentType="text/html;charset=GBK" %>
<%@ taglib uri="/bean" prefix="bean" %>
<%@ taglib uri="/html" prefix="html" %>
<%@ taglib uri="/logic" prefix="logic" %>
<%@ taglib uri="/keyshop" prefix="keyshop" %>
<%@include file="/jsp/pub/pub.jsp"%>
<%
	//设置网页title, 关键字,网页描述。
	PAGETITLE = "购物车" + PAGETITLE;
	PAGEDESCRIPTION =  PAGETITLE;
	PAGEKEYWORDS = PAGETITLE;
%>
<%@include file="/jsp/pub/top.jsp"%>
<%
	String returnUrl = (String)request.getAttribute("returnUrl");
	if(!StringUtil.isEmpty(returnUrl)) {
%>
<SCRIPT>
window.location = '<%=CONTEXT + returnUrl%>'
</SCRIPT>
<%
	}
%>  
<script>
function submitForm(actionType) {
	document.cartForm.actionType.value = actionType;
	document.cartForm.submit();
}
</script>
<table width="830" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td  height=4 bgcolor="#FFFFFF"></td>
  </tr>
</table>
<table width="830" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td valign="top">
      <table width="830" border="0" align="center" cellpadding="0" cellspacing="0">
      	<TR align=left > 
			    <TD><IMG src="<%=CONTEXT%>/img/gouwu-shangpin.gif" width="476" height="27">
			    </TD>
			  </TR>
        <tr> 
          <td>
            <table width="100%" bgColor=#016e3b border="0" cellSpacing=1 cellPadding=1 >
             	<%
						 	 	List searchResult = (List)request.getAttribute("searchresult");
						 	 	double zongjia=0.00;
						 	 	double listPrice=0.00;
						 	 	int cou=0;
						  	if(SESSION_USER != null && searchResult != null && searchResult.size() > 0) {
						  %>
						  <html:form action="/fg/order/cart">
						  <html:hidden property="channelId" value="<%=currentChannel.getId()%>"/>
						  <input type="hidden" name="actionType"/>
              <tr align="center" background="<%=CONTEXT%>/img/zc/title_bg.gif"> 
              	<TD align=middle bgColor=#FFC9C9 height=23><FONT color=#ED2E2E>次序</FONT></TD>
              	<TD align=middle bgColor=#FFC9C9 height=23><FONT color=#ED2E2E>图片</FONT></TD>
			          <TD align=middle bgColor=#FFC9C9 height=23><FONT color=#ED2E2E>商品名称</FONT></TD>
			          <TD align=middle bgColor=#FFC9C9 height=23><FONT color=#ED2E2E>市场价</FONT></TD>
	              <TD align=middle bgColor=#FFC9C9 height=23><FONT color=#ED2E2E>会员价</FONT></TD>
	              <TD align=center bgColor=#FFC9C9 height=23><FONT color=#ED2E2E>数量</FONT></TD>
	              <TD align=middle bgColor=#FFC9C9 height=23><FONT color=#ED2E2E>小计</FONT></TD>
	              <TD align=middle bgColor=#FFC9C9 height=23><FONT color=#ED2E2E>清除</FONT></TD>
              </tr>
              <logic:iterate id="result" name="searchresult" type="CartManager.CartManagerProduct" scope="request">
						  <%
						  cou++;
						  	if(result.getProduct() != null) {
						  	zongjia=zongjia+result.getNumber() * result.getProduct().getUnitPrice();
						  	listPrice=listPrice+result.getNumber() * result.getProduct().getListPrice();
						  %>
              <tr align="center" > 
              	<td align="center" bgColor=#ffffff ><a class="leftIndex_Title01" href="<%=PRODUCTVIEW%>&bean.id=<%=result.getId()%>" target="_blank"><%=cou%></a></td>
                <td align="center" bgColor=#ffffff ><a class="leftIndex_Title01" href="<%=PRODUCTVIEW%>&bean.id=<%=result.getId()%>" target="_blank"> <img src="<%=CONTEXT%>/<%=result.getProduct().getPopPicture()%>" border="0" width="50" hight="50"></a></td>
                <td align="center" bgColor=#ffffff ><a class="leftIndex_Title01" href="<%=PRODUCTVIEW%>&bean.id=<%=result.getId()%>" target="_blank"> <%=result.getProduct().getName()%> </a></td>
                <td align="center" bgColor=#ffffff >￥<%=result.getProduct().getListPrice()%>元</td>
						    <td align="center" bgColor=#ffffff >￥<%=result.getProduct().getUnitPrice()%>元</td>
						    <td align="center" bgColor=#ffffff ><input type="txt" value="<%=result.getNumber()%>" class="i03" name="cart_productNumber<%=result.getId()%>" size="5" onkeypress="intOnly();" /></td>
						    <td align="center" class=w06 bgColor=#ffffff >￥<%=result.getNumber() * result.getProduct().getUnitPrice()%>元</td>
						    <td align="center" class=w06 bgColor=#ffffff >
						    	<input type="button" name="Submit322" onclick="window.location='<%=CONTEXT%>/fg/order/cart.do?channelId=<%=currentChannel.getId()%>&actionType=removeproduct&productId=<%=result.getId()%>'" value="删除">
						    </td>
              </tr>
              <%
						  	}
						  %>
						  </logic:iterate>
              <tr> 
                <td bgColor=#FFC9C9  colspan="8" align="right">消费总金额为:<%=zongjia%>￥，你共节省<%=listPrice-zongjia%>￥</td>
              </tr>
            </table>
            <table width="100%"  border="0" cellSpacing=0 cellPadding=0 >
              <tr align="center"> 
					      <td  colspan="8">
					      	<table width="60%" height="51" border="0" cellpadding="0" cellspacing="0">
									    <tr align="center"> 
									      <td height="39">
									      	<a href="<%=CONTEXT%>/index.jsp"><img onclick="javascript:window.location='<%=CONTEXT%>/index.jsp'" src="<%=CONTEXT%>/img/cart01.gif"  border="0"/></td>
									      <td><a href="#"><img onclick="javascript:submitForm('updateproduct')"  src="<%=CONTEXT%>/img/cart03.gif"  border="0"></a></td>
									      <td><a href="#"><img  onclick="javascript:location.href='<%=CONTEXT%>/fg/order/order.do?actionType=add&init=true'"  src="<%=CONTEXT%>/img/cart04.gif" border="0"></a></td>
									    </tr>
									</table>
					      </td>
					    </tr>
					  </table>  
              </html:form> 
               <%
						  	} else {
						  %>
						<table width="100%"  border="0" cellSpacing=0 cellPadding=0 >  
						  <tr> 
						    <td>
						    	您的购物车中暂时没有商品
						    </td>
							</tr>
						</table>
						  <%
						  	}
						  %>
            
            <img src="<%=CONTEXT%>/img/login/line_2.gif" width="650" height="6"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table width="830" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height=7 bgcolor="#FFFFFF"></td>
  </tr>
</table>   
<%@include file="/jsp/pub/bottom.jsp"%>      
