<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page import="com.Service.*,com.Entity.*,com.DAOImple.*,com.DAO.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<title>订单</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<%
Use name=(Use)session.getAttribute("Useen");
if(name==null||name.equals("true"))
{
response.sendRedirect("UseLoginServlet");
}
%>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script><script type="text/javascript" src="js/jquery-1.7.1.min.js"></script></head>
<style>
*{
margin:0px;
padding:0px;
list-style:none;
}
.page
{
border:1px solid red;
background:#f5f5f5;
}
.block
{
margin:0px auto;
width:1004px;
}
.rui
{
height:110px;
background:#fff;
}
.rui .lg
{
height: 60px;
width: 60px;
float: left;
margin: 40px 10px;
}
.rui .lgone
{
height: 60px;
width: 540px;
float:left;
margin: 40px 10px;
}
.rui .lgtwo
{
height: 60px;
width: 300px;
float:right;
margin: 40px 10px;
}
.logoneFont
{
height: 45px;
line-height:45px;
width: 160px;
margin: 10px 0px 0px 10px;
font: normal 30px "microsoft yahei";
float:left;
}
.logoneTip
{float: left;
height: 45px;
line-height: 45px;
margin: 40px 0px 0px 0px;
font: normal 12px "microsoft yahei";
width: 350px;
color:#666
}
.rui1
{
height:880px;
border-radius: 1px;
background:#fff
}
.rui2
{
height:500px;
border-radius: 1px;
box-shadow: 0 0 5px rgba(0,0,0,0.2);
transition: all 0.3s ease;
background:#fff
}
.rui3
{
border:1px solid red;
border: 1px #00f solid;
height: 400px;
border: 1px solid red;
width: 990px;
top: 74px;
}
#solidframe
{
border:1px solid red;
border: 1px #00f solid;
height: 400px;
border: 1px solid red;
width: 990px;
top: 74px;
}
.rui4
{
border:1px #00f solid;
height:400px;
}
.lrggater table
{
border-bottom:2px solid #ccc;
height:55px;
line-height:55px;
text-align:center;
font: normal 20px "microsoft yahei";
color:#666;
}
.lrggater table td{
width:150px;
}
.lrggater .lrgsize
{
width:390px;
}
.lrggoods
{
height:350px;
margin:20px;
}
.lrggoods table
{
border-bottom:2px solid #ccc;
height:55px;
line-height:55px;
text-align:center;
font: normal 20px "microsoft yahei";
color:#666;
}
.lrggoods table
{
border-bottom:2px solid #ccc;
height:55px;
line-height:55px;
text-align:center;
font: normal 20px "microsoft yahei";
color:#666;
border:0px;
border-spacing:0px;
border-collapse:0px;
}
.lrggoods table td{
width:150px;
border-bottom:1px solid #ccc;
height: 115px;
}
.lrggoods .lrgsize1
{
width:390px;
}
#lrgTDPIC
{
height:100px;
width:70px;
float:left;
}
#lrgTDTitle img
{
height:100px;
width:100px;
float:left;
}
#lrgTDTitle1
{
height:100px;
width:165px;
float:left;
text-align:none;
}
#lrgTDName
{
height:60px;
width:160px;
position: relative;
top: 50px;
}
#lrgTDName1
{
height:35px;
line-height:35px;
position: relative;
font: normal 18px "microsoft yahei";
left: -5px;
}
#lrgerror
{
border-radius: 50%;
height: 30px;
width: 30px;
position: relative;
left: 40%;
cursor:pointer;
}
#lrgerror:hover
{
background:red;
color:#fff;
cursor:pointer;
}
#lrgNum
{
height:35px;
line-height:35px;
}
#lrgNum1
{
border:#ccc 1px solid;
height:35px;
line-height:35px;
width:35px;
float:left;
position: relative;
left: 10px;
font-size:36px;
font-weight:bold;
cursor:pointer;
background-image: linear-gradient(RGB(241,241,241),RGB(226,226,226));
}
#lrgNum1:hover
{
background:#CCC;
color:#fff;
}
#lrgNum3:hover
{
background:#CCC;
color:#fff;
}
#lrgNum2
{
height:35px;
line-height:35px;
width:35px;
float:left;
position: relative;
left: 15px;
font-size:24px;
cursor:pointer;
background-image: linear-gradient(RGB(241,241,241),RGB(226,226,226));
}
#lrgNum3
{
border:#ccc 1px solid;
height:35px;
line-height:35px;
width:35px;
float:left;
position: relative;
left: 20px;
font-size:26px;
font-weight:bold;
cursor:pointer;
background-image: linear-gradient(RGB(241,241,241),RGB(226,226,226));
}
.lrgtext
{
border:#ccc 1px solid;
height:35px;
line-height:35px;
width:35px;
cursor:pointer;
padding-left: 12px;
}
#lrgUse
{
border:red 1px solid;
height:35px;
line-height:35px;
width:135px;
float:right;
position: relative;
top: 23px;
color:#F60;
font: normal 20px "microsoft yahei";
cursor:pointer;
}
a
{
color:#F60;
text-decoration:none;
}
a:hover
{
color:red;
}
#lrgUse1
{
border:red 1px solid;
height:35px;
line-height:35px;
width:135px;
float:right;
position: relative;
top: 23px;
color:#F60;
font: normal 20px "microsoft yahei";
cursor:pointer;
}
.lrgPrice
{
height:30px;
width:80px;
float:left;
}
.lrgPrice1
{
height:30px;
width:30px;
float:left;
font: normal 20px "microsoft yahei";
cursor:pointer;
}
#lrgcheck
{
margin:50px auto;
border: 2px solid #F60;
}
</style>
<body class="page" style="min-width: 1004px">
<div id="headerNav">
<style>
#headerNav{background:#fff;height:120px; border-bottom:4px solid #F60;}
</style>
<div class="block rui" style="overflow: hidden;position:relative">
<div class="lg" id="lg">
<img src="pic/12.png" height="60px" width="60px" id="up"></img>
</div>
<div class="lgone">
<div class="logoneFont" style="overflow: hidden;position:relative">
确认订单</div>
<div class="logoneTip" style="overflow: hidden;position:relative">温馨提示:请认真填写订单信息</div>
</div>
<div class="lgtwo">
<div id="lrgUse" ><a href="form.jsp">我的订单</a></div>
<div id="lrgUse1" style="overflow: hidden;position:relative">${Useen.name }</div>
</div>
</div>
</div>
<!-- 头结束 -->
<div style="height:20px;"></div>
<div class="block rui1" style="overflow: hidden;position:relative">
<style>
#lrgaddress
{
/*border-bottom:2px solid linear-gradient(RGB(241,241,241),RGB(226,226,226));*/
height:300px;
background:#fff;
}
#lrgframeaddress
{
height:55px;
line-height:55px;
color: #F30;
font: normal 26px "microsoft yahei";
box-shadow: inset 0 10px 10px -10px rgba(0,0,0,0.2),inset 0 -10px 10px -10px rgba(0,0,0,0.2);
text-align:end;
}
#fontaddress
{
width:150px;
height:55px;
}
#fontaddress1
{
width:150px;
height:15px;
}
#fontcontent
{
height:200px;
width: 120px;
float:left;
}
#fontcontent1
{
border:1px solid #e2f2ff;
height:200px;
width: 120px;
float:left;
margin: 2px 19px;
font: normal 21px "microsoft yahei";
color:#333;
}
#fontcontent2
{
border:1px solid #e2f2ff;
height:200px;
width: 520px;
float:left;
font: normal 21px "microsoft yahei";
}
#addressTitle
{
height:45px;
line-height:45px;
margin:2px 2px;
}
#addressTitle1
{
height:45px;
line-height:45px;
margin:2px 2px;
text-align:left;
}
#addressTitle2
{
height:95px;
line-height:45px;
margin:2px 2px;
text-align:left;
}
#adt
{
height:45px;
line-height:45px;
width:300px;
text-align:left;
font: normal 21px "microsoft yahei";
color:#333;
box-shadow: inset 0 0 8px rgba(82, 168, 236, 0.6);
}
#ardt
{
box-shadow: inset 0 0 8px rgba(82, 168, 236, 0.6);
height:95px;
line-height:35px;
margin:2px 2px;
text-align:left;
width:400px;
resize:none;
color:#333;
font: normal 21px "microsoft yahei";
}
#zhifuaddress
{
height:65px;
margin:2px 2px;
}
#zhifuaddress1
{
height:65px;
margin:2px auto;
}
#zhifuaddress11
{
height:265px;
margin:2px auto;
}
#fumoney
{
height:65px;
width:150px;
float:left;
color: #666;
font: normal 26px "microsoft yahei";
text-align: end;
position: relative;
top: 15px;
}
#fumoney1
{
height:65px;
width:255px;
float:left;
margin: 0px 5px;
}
#fumoney2
{
height:65px;
width:255px;
float:left;
margin: 0px 5px;
}
#fumoney3
{
height:65px;
width:255px;
float:left;
margin: 0px 5px;
}
#fumoney111
{
height:65px;
width:150px;
color: #666;
font: normal 26px "microsoft yahei";
text-align: end;
position: relative;
top: 15px;
}
#fumoney11
{
height:185px;
width: 900px;
float:left;
margin: 0px 5px;
border:1px solid #e2f2ff;
position: relative;
left: 35px;
}
#fumoneyclick
{
left: 840px;
position: relative;
height:40px;
width:150px;
color: #666;
font: normal 26px "microsoft yahei";
border:1px solid red;
text-align:center;
background:#f30;
color:#fff;
cursor:pointer;
}
</style>
<form action="pp.jsp" method="post">
<div id="lrgaddress">
<div id="lrgframeaddress">
<div id="fontaddress1"></div>
<div id="fontaddress"> 确认订单: </div>
<div id="fontcontent"></div>
<div id="fontcontent1">
<div id="addressTitle">收货人: </div>
<div id="addressTitle">手机号: </div>
<div id="addressTitle">详细地址: </div>
</div>
<div id="fontcontent2">
<div id="addressTitle1"><input id="adt" name="usename" type="text"/></div>
<div id="addressTitle1"><input id="adt" type="text" maxlength="11" name="usetel"/></div>
<div id="addressTitle2">
<textarea id="ardt" name="useAddress"></textarea>
</div>
</div>
</div>
</div>
<div id="zhifuaddress">
<div id="fumoney">支付方式: </div>
<div id="fumoney1"><input type="radio" name="huo" value="1" style="position: relative;left: 60px;top: -23px;"/><img src="pic/huod_kan.jpg" style="width:100px;height:65px;position: relative;
left: 90px;"></img></div>
<div id="fumoney2"><input type="radio" name="huo" value="支付宝支付" style="position: relative;top: 6px;left: 23px;"/><img src="pic/zhifubao.gif" style="width:130px;height:35px;position: relative;left: 50px;top: 12px;"></img></div>
<div id="fumoney3"><input type="radio" name="huo" value="微信支付" style="position: relative;
top: 6px;
left: 23px;"/><img src="pic/weixin.jpg"style="width:130px;height:35px;position: relative;
left: 50px;
top: 14px;"></img></div>
<style>
#inP
{
border:1px solid red;
width:100px;
height:105px;
position: relative;
top: -50px;
}
#inP1
{
border:1px solid red;
width:100px;
height:105px;
}
</style>
</div>
<div id="zhifuaddress1">
<div id="fumoney">配送方式: </div>
<div id="fumoney1"><span style="position: relative;
top: 23px;color: #F30; font: normal 16px ;microsoft yahei"; ">快递配送(运费10元)</span></div>
</div>
<div id="zhifuaddress1">
<div id="fumoney">配送时间: </div>
<div id="fumoney1"><span style="position: relative;
top: 23px;color: #F30; font: normal 16px ;microsoft yahei"; ">5天内到达(请您及时领取)</span></div>
</div>
<div id="zhifuaddress11">
<div id="fumoney111">送货清单: </div>
<div id="fumoney11" style="overflow-y:auto;">
<!--<input type="text" value="${Useen.name}">
<input type="text" name="useIDEN" value="${Useen.id}">
-->
<%
Use useEn=(Use)session.getAttribute("Useen");
int useID=useEn.getId();//获取用户的ID
System.out.println("刘瑞光如何 获取用户的ID----"+useID);
OrderService im=new OrderService();
//CartItemService items =new CartItemService();
/*Map<Integer,CartItem> ducart=(Map<Integer,CartItem>)session.getAttribute("cart");
ducart=im.getCartItem( useID);*/
List<orderes> otable=im.findOrderById(useID);
for(orderes ene:otable)
{
%>
<li></li>
<img id="inP1" src="pic/<%=ene.getImg() %>"></img>
<input id="inP" name="Useid" value="<%=ene.getUseid() %>"/>
<input name="name" id="inP" value="<%=ene.getName() %>"/>
<input name="price" id="inP" value="<%=ene.getPrice() %>"/>
<input name="count" id="inP" value="<%=ene.getCountes() %>"/>
<input type="hidden" name="image" value="<%=ene.getImg() %>"/>
<%} %>
</div>
</div>
<div id="zhifuaddress1">
<div id="fumoneyclick"><input type="submit" value="去结算"> </div>
</div>
</form>
</div>
<div class="block rui4" style="overflow: hidden;position:relative"></div>
</body>
</html>
-------------------订单DAOImple----------------------
package com.DAOImple;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.DAO.OrderesDAO;
import com.DB.DB;
import com.Entity.goods;
import com.Entity.orderes;
public class OrderesDAOImple implements OrderesDAO {
private Connection con = null;
private Statement sta=null;
private PreparedStatement psta = null;
private ResultSet re=null;
public int insertOrderes(String address,String tel,String way,String useName,int useID) {
// TODO Auto-generated method stub
String sql="update orderes set address='"+address+"' ,tel='"+tel+"',way='"+way+"' ,useName='"+useName+"' , statuses='正在装车...' where useid="+useID+"";
System.out.println(sql);
int count=0;
try {
con=DB.getcon();
/*psta=con.prepareStatement(sql);
Object [] par={en.getAddress(),en.getTel(),en.getWay(),en.getUseName()};
DB.setUpdate(psta, par);
count=psta.executeUpdate();*/
sta=con.createStatement();
count=sta.executeUpdate(sql);
System.out.println("添加到订单表中----"+count);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
DB.closeAll(null, psta, con);
}
return count;
}
public int deleteOrder(int id) {
// TODO Auto-generated method stub
return 0;
}
public List<orderes> findOrderById(int id) {
// TODO Auto-generated method stub
List<orderes> table=new ArrayList<orderes>();
String sql="select * from dbo.orderes where useID=?";
try {
con=DB.getcon();
psta=con.prepareStatement(sql);
Object [] par={id};
DB.setUpdate(psta, par);
re=psta.executeQuery();
while(re.next())
{
orderes en=new orderes();
en.setUseid(re.getInt("useid"));
en.setGoodsid(re.getInt("goodsid"));
en.setCountes(re.getString("count"));
en.setImg(re.getString("image"));
en.setName(re.getString("name"));
en.setPrice(re.getString("price"));
table.add(en);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
DB.closeAll(re, psta, con);
}
return table;
}
public Map<orderes, ArrayList<goods>> getOrders(String sql, pageControler pc)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
public int updateOrder(int id) {
// TODO Auto-generated method stub
return 0;
}
public int addOrder(orderes en) {
// TODO Auto-generated method stub
int count=0;
//String sql="insert orderes(useID,createtime,total) values(?,?,?,?)";
//String sql="insert orderes(useID,total,statuses)values(?,?,?)";
//insert into orderes (name) select name from CartItem
//String sql="insert into orderes (useID) select useid from CartItem ";
//insert into orderes (useid,goodsid,name,count,price,image) select useid,goodsid,name,count,price,image from CartItem
String sql="insert into orderes (useid,goodsid,name,count,price,image) select useid,goodsid,name,count,price,image from CartItem ";
try {
con=DB.getcon();
sta=con.createStatement();
count=sta.executeUpdate(sql);
//psta=con.prepareStatement(sql);
//Object []par={en.getUseID(),en.getCratetime(),en.getTotal()};
//Object[] par={en.getUseID()};
//DB.setUpdate(psta, par);
//count=psta.executeUpdate();
System.out.println("添加到订单表中----"+count);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
DB.closeAll(null, psta, con);
}
return count;
}
}
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.DAO.OrderesDAO;
import com.DB.DB;
import com.Entity.goods;
import com.Entity.orderes;
public class OrderesDAOImple implements OrderesDAO {
private Connection con = null;
private Statement sta=null;
private PreparedStatement psta = null;
private ResultSet re=null;
public int insertOrderes(String address,String tel,String way,String useName,int useID) {
// TODO Auto-generated method stub
String sql="update orderes set address='"+address+"' ,tel='"+tel+"',way='"+way+"' ,useName='"+useName+"' , statuses='正在装车...' where useid="+useID+"";
System.out.println(sql);
int count=0;
try {
con=DB.getcon();
/*psta=con.prepareStatement(sql);
Object [] par={en.getAddress(),en.getTel(),en.getWay(),en.getUseName()};
DB.setUpdate(psta, par);
count=psta.executeUpdate();*/
sta=con.createStatement();
count=sta.executeUpdate(sql);
System.out.println("添加到订单表中----"+count);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
DB.closeAll(null, psta, con);
}
return count;
}
public int deleteOrder(int id) {
// TODO Auto-generated method stub
return 0;
}
public List<orderes> findOrderById(int id) {
// TODO Auto-generated method stub
List<orderes> table=new ArrayList<orderes>();
String sql="select * from dbo.orderes where useID=?";
try {
con=DB.getcon();
psta=con.prepareStatement(sql);
Object [] par={id};
DB.setUpdate(psta, par);
re=psta.executeQuery();
while(re.next())
{
orderes en=new orderes();
en.setUseid(re.getInt("useid"));
en.setGoodsid(re.getInt("goodsid"));
en.setCountes(re.getString("count"));
en.setImg(re.getString("image"));
en.setName(re.getString("name"));
en.setPrice(re.getString("price"));
table.add(en);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
DB.closeAll(re, psta, con);
}
return table;
}
public Map<orderes, ArrayList<goods>> getOrders(String sql, pageControler pc)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
public int updateOrder(int id) {
// TODO Auto-generated method stub
return 0;
}
public int addOrder(orderes en) {
// TODO Auto-generated method stub
int count=0;
//String sql="insert orderes(useID,createtime,total) values(?,?,?,?)";
//String sql="insert orderes(useID,total,statuses)values(?,?,?)";
//insert into orderes (name) select name from CartItem
//String sql="insert into orderes (useID) select useid from CartItem ";
//insert into orderes (useid,goodsid,name,count,price,image) select useid,goodsid,name,count,price,image from CartItem
String sql="insert into orderes (useid,goodsid,name,count,price,image) select useid,goodsid,name,count,price,image from CartItem ";
try {
con=DB.getcon();
sta=con.createStatement();
count=sta.executeUpdate(sql);
//psta=con.prepareStatement(sql);
//Object []par={en.getUseID(),en.getCratetime(),en.getTotal()};
//Object[] par={en.getUseID()};
//DB.setUpdate(psta, par);
//count=psta.executeUpdate();
System.out.println("添加到订单表中----"+count);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
DB.closeAll(null, psta, con);
}
return count;
}
}