📄 cartlist.jsp
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.net.*" errorPage="" %>
<%@ page import="java.util.*" %>
<%@ page import="MyFly.Book.Bookclass" %>
<%@ page session="true" %>
<%@ page import="MyFly.Book.Books"%>
<%@ page import="MyFly.Book.bookmn" %>
<%@ page import="MyFly.Book.Indentlist" %>
<jsp:useBean id="book_list" scope="page" class="MyFly.Book.bookmn" />
<jsp:useBean id="classlist" scope="page" class="MyFly.Book.Bookclasslist" />
<jsp:useBean id="shop" scope="page" class="MyFly.Book.Purchase" />
<%
String userid = (String) session.getAttribute("userid");
if ( userid == null )
userid = "";
String modi = request.getParameter("modi");
String del = request.getParameter("del");
String payoutCar = request.getParameter("payout");
String clearCar = request.getParameter("clear");
String mesg = "";
if (modi!=null && !modi.equals("")) {
if ( !shop.modiShoper(request) ){
if (shop.getIsEmpty())
mesg = "你要的修改购买的图书数量不足你的购买数量!";
else
mesg = "修改购买数量出错!";
} else {
mesg = "修改成功";
}
}else if ( del != null && !del.equals("") ) {
if ( !shop.delShoper(request) ) {
mesg = "删除清单中的图书时出错!" ;
}
}else if (payoutCar != null && !payoutCar.equals("") ) {
if (shop.payout(request) ) {
mesg = "你的购物车中的物品已提交给本店,你的订单号为 "+ shop.getIndentNo() + "<br>请及时付款,以便我们发货!";
session.removeAttribute("shopcar");
} else {
if(!shop.getIsLogin())
mesg = "你还没有登录,请先<a href=login.jsp>登录</a>后再提交";
else
mesg = "对不起,提交出错,请稍后重试";
}
} else if (clearCar != null && ! clearCar.equals("") ) {
session.removeAttribute("shopcar");
mesg = "购物车中的物品清单已清空";
}
%>
<script language="javascript">
function openScript(url,name, width, height){
var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
function checklogin() {
if (document.payout.userid.value=="")
{
alert("你还没有登录,请登录后再提交购物清单地。");
//window.location.href="findpwd.jsp";
return false;
}
return true;
}
function check()
{
if (document.change.amount.value<1){
alert("你的购买数量有问题");
document.change.amount.focus();
return false;
}
return true;
}
</script>
<html>
<head>
<title>-购物车-</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Robots" content="index,follow">
<link rel="stylesheet" href="../image/buyok_shop.css" type="text/css"></head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="20">
<table width="580" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="565" height="25"><div align="center"><span class="red">购物清单</span> <img src="../image/gowu1.gif" width="11" height="7"> 收货人信息[配送方式] <img src="../image/gowu2.gif" width="10" height="7"> 检查订单信息 <img src="../image/gowu2.gif" width="10" height="7"> 生成订单 </div></td>
</tr>
<tr>
<td height="38"><div align="center"><strong><font color="#FF3333">您的购物清单</font></strong></div></td>
</tr>
<tr><td>
<%
if (!mesg.equals("") )
out.println("<p ><font color=#ff0000>" + mesg + "</font></p>");
Vector shoplist = (Vector) session.getAttribute("shopcar");//读出购物车的列表
if (shoplist==null || shoplist.size()<0 ){
if (mesg.equals(""))
out.println("<p><font color=#ff0000>你还没有选择购买图书!请先购买</font></p>");
} else {
%>
<table border="0" cellspacing="1" cellpadding="4" align="center" width="630" bgcolor="#CCCCCC">
<form action="cartlist.jsp" method="POST" name="change">
<tr bgcolor="#FFFFFF">
<td width="167" align="center"><font color="B0266D">图 书 名 称</font></td>
<td width="89" align="center"><font color="B0266D">作 者</font></td>
<td width="107" align="center"><font color="B0266D">数 量</font></td>
<td width="35" align="center"><font color="B0266D">原价</font></td>
<td width="58" align="center"><font color="B0266D">现价</font></td>
<td width="77" align="center"><font color="B0266D">修改</font></td>
<td width="77" align="center"><font color="B0266D">删除</font></td>
</tr>
<%
float totalprice =0;
int totalamount = 0;
float totalprice1=0;//市场价
float save=0;
for (int i=0; i<shoplist.size();i++){
Indentlist iList = (Indentlist) shoplist.elementAt(i);
if (book_list.getOnebook(String.valueOf(iList.getBookNo()))) {//整型转化为字符型
Books bk = (Books) book_list.getBooklist().elementAt(0);
totalprice = totalprice + bk.getPreferPrice() * iList.getAmount();//优惠价格
totalamount = totalamount + iList.getAmount();
totalprice1= totalprice1 +bk.getMarketPrice() * iList.getAmount();//市场价格
save=totalprice1-totalprice;
//System.out.print(totalprice1);
%>
<tr bgcolor="#FFFFFF">
<td width="167"> <font color="B0266D"><%= bk.getProductName() %></font></td>
<td width="89"> <font color="B0266D"><%= bk.getAuthor() %></font></td>
<td width="107" align="center">
<input type="Text" name="amount" value="<%= iList.getAmount()%>" size="4" maxlength="4" class="form"></td>
<td width="35" align=center><font color="B0266D"><%= bk.getMarketPrice() %></font></td>
<td width="58" align=center><font color="B0266D"><%= bk.getPreferPrice() %></font></td>
<td width="77" align=center>
<form name="modi" method="post" action="cartlist.jsp">
<input type="submit" name="modi" value="修改" onclick="return(check());">
<input type="hidden" name="bookid" value="<%= iList.getBookNo() %>" >
</form>
</td>
<td width="77" align=center>
<form name="del" method="post" action="cartlist.jsp">
<input type="submit" name="del" value="删除">
<input type="hidden" name="bookid" value="<%= iList.getBookNo() %>" >
</form>
</td>
</tr>
<% }
} %>
<tr bgcolor="#FFFFFF">
<td colspan="7" height="35" align=left valign="middle"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="40%" height="31"><div align="right"><font color="B0266D"> 商品总价:<%= totalprice%> </font></div></td>
<td width="23%"> <span class="red">您共节省了:<%=save%></span></td>
<td width="30%"><span class="red"> 总数量:<%= totalamount%>本 </span></td>
<%
session.setAttribute("goods_num",totalamount);
session.setAttribute("goods_price",Float.valueOf(totalprice));//还没加邮费
%>
</tr>
</table></td>
</form>
<tr>
<td colspan="7" bgcolor="#ffffff" height=19 align=center><table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="31%" align="right" valign="bottom">
</td>
<form name="payout" method="post" action="orderinfo.jsp">
<td width="40%" valign="middle">
<input type="hidden" name="totalprice" value="<%= String.valueOf(totalprice) %>">
<input type="hidden" name="userid" value="<%= userid %>">
<a href="#" language=javascript onClick="javascript:window.close()" ><img src="../image/bt_2.gif" width="110" height="27" border="0"></a>
<input type="hidden" name="payout" value="提交我的购物车">
<input align="bottom" name="imageField" type="image" src="../image/bt_1.gif" width="97" height="27" border="0" onClick="javascript:return(checklogin());">
</td>
</form>
<% } %>
</tr>
</table></td>
</tr>
</table>
</tr></table>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -