Skip to content
Merged

Lim #104

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions public/stylesheets/buycheckStyle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
.title{
width: 1500px;
margin-left: auto;
margin-right: auto;
display: block;
margin-top: 50px;
margin-bottom: 40px;
position: relative;
height: 50px;
}
.title .order_state{
position: absolute;
right: 50px;
display: inline-block;
height: 20px;
font-size: 15px;
font-weight: bold;
bottom: 0px;
}

.title h1{
position: absolute;
left: 50px;
}

.middle_state{
line-height: 20px;
}

.done{
color: #ffc000;
}

.state_title{
width: 1500px;
margin-right: auto;
margin-left: auto;
}

.state_title .main_check{

font-size: 30px;
font-weight: bolder;
text-align: center;
}

.state_title .main_sub_check{
text-align: center;
color: gray;
}

.order_product_info_title{
width: 1500px;
margin-top: 20px;
margin-left: auto;
margin-right: auto;
}

.order_product_info_title p{
margin-left: 40px;
font-size: 20px;
font-weight: bold;
}

.order_product_info_body{
width: 1500px;
margin-left: auto;
margin-right: auto;
margin-top: 15px;
}

.order_product_info{
width: 1400px;
margin-left: auto;
margin-right: auto;
border: 3px solid #FFC000;
}
.order_product_info p{
margin: 5px;
}

.order_product_info p span{
font-weight: bold;
font-size: 16px;
}

._button{
width: 1400px;
height: 50px;
margin-top: 50px;
background: #ffc000;
margin-bottom: 50px;
position: relative;
margin-left: auto;
margin-right: auto;
display: block;
}
.check_btn_area{
width: 1500px;
height: 50px;
position: relative;
margin-left: auto;
margin-right: auto;
margin-bottom: 30px;
}

.check_btn{
width: 1406px;
height: 50px;
margin-top: 40px;
background: #ffc000;
margin-bottom: 50px;
position: relative;
margin-left: auto;
margin-right: auto;
display: block;
}

.check_btn a{
position: absolute;
width:100%;
height: 100%;
line-height: 50px;
cursor: pointer;
text-align: center;
font-weight: bold;
color: white;
font-size: 20px;
}

.check_btn a:active{
background: #ffA000;
}
26 changes: 24 additions & 2 deletions server/controller/orderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ class OrderController {

})
}
async getOrder_data(req,res,next){
pool.getConnection((err, conn)=>{
if(err) throw err;
conn.query(`SELECT * FROM product_order WHERE order_num = "${req.params.order_num}"`,(err, ordata)=>{
if(err) throw err;
req.ord = ordata;
conn.query(`SELECT * FROM product WHERE product_num = "${ordata[0].order_product_num}"`, (err, pdata)=>{
if(err) throw err;
conn.release();
req.prd = pdata;
next();
})

})
})
}

async getOrder(req,res, next){
pool.getConnection((err, conn)=>{
Expand Down Expand Up @@ -63,9 +79,15 @@ class OrderController {
req.body.order_product_count, req.body.order_product_num
], (err)=>{
if(err) throw err;
conn.query(`SELECT order_num FROM product_order WHERE order_date ="${nowTime}"`, (err, order_num)=>{
if(err) throw err;
conn.release();

req.order_num = order_num[0].order_num;

next();
})

conn.release();
next();
})
})
})
Expand Down
15 changes: 10 additions & 5 deletions server/routes/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ router.get('/', function(req, res) {
});


//감사합니다. 화면
router.get('/finish', function(req,res){
res.render('product/finish');
})

router.post('/order_buy',Order.SaveOrder, function(req, res, next){
console.log(req.body);
res.redirect('/order/finish');
router.post('/order_buy', Order.SaveOrder, function(req, res, next){
res.redirect('/order/buy_check/' + req.order_num);
})

//감사합니다 하기전에 구매 내역 안내 해주기
router.get('/buy_check/:order_num',Order.getOrder_data, function(req, res){
console.log(req.prd)
console.log(req.ord)
res.render('product/buy_check', {name:req.session.user.name, order_data:req.ord, p_data: req.prd});
})

router.get('/:product_num',Order.getOrder,function(req,res){
Expand Down Expand Up @@ -69,8 +76,6 @@ router.get('/buy/:product_num',Order.getOrder, Order.getAddress_cardInfo,functio





router.get('/makingbuy', function(req,res){

if(req.session.user){
Expand Down
2 changes: 1 addition & 1 deletion server/views/product/buy.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@

<div class="pay_button_area">
<div class="pay_button">
<a onclick="payMoney()"\>결제하기</a>
<a onclick="payMoney()">결제하기</a>
</div>
</div>

Expand Down
108 changes: 108 additions & 0 deletions server/views/product/buy_check.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!DOCTYPE html>
<html lang="kr">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel='stylesheet' href='/stylesheets/default.css' />
<link rel='stylesheet' href='/stylesheets/navstyle.css' />
<link rel='stylesheet' href='/stylesheets/buycheckStyle.css' />


<script type="text/javascript">
function setsub() {
var sublnb = document.getElementById("sublnb");
sublnb.style.display = "block";
sublnb.style.opacity = "1";
sublnb.style.visibility = "visible";
}

function outsub() {
var sublnb = document.getElementById("sublnb");
sublnb.style.display = "none"
sublnb.style.opacity = "0";
sublnb.style.visibility = "hidden";
}

function lsub() {
var looksub = document.getElementById("sublnb");
sublnb.style.display = "block";
sublnb.style.opacity = "1";
sublnb.style.visibility = "visible";
}

function loutsub() {
var looksub = document.getElementById("sublnb");
sublnb.style.display = "none";
sublnb.style.opacity = "0";
sublnb.style.visibility = "hidden";
}

function setsub2() {
var sublnb2 = document.getElementById("sublnb2");
sublnb2.style.display = "block";
sublnb2.style.opacity = "1";
sublnb2.style.visibility = "visible";
}

function outsub2() {
var sublnb2 = document.getElementById("sublnb2");
sublnb2.style.display = "none";
sublnb2.style.opacity = "0";
sublnb2.style.visibility = "hidden";
}

function lsub2() {
var sublnb2 = document.getElementById("sublnb2");
sublnb2.style.display = "block";
sublnb2.style.opacity = "1";
sublnb2.style.visibility = "visible";
}

function loutsub2() {
var sublnb2 = document.getElementById("sublnb2");
sublnb2.style.display = "none";
sublnb2.style.opacity = "0";
sublnb2.style.visibility = "hidden";
}
</script>
</head>
<body onload="select_box_change()">
<%- include("../head/nav") %>
<div class="title">
<h1>주문/결제</h1>
<div class="order_state"><span class="before">주문결제</span> <span class="middle_state">></span> <span class="done">주문완료</span></div>
</div>
<div class="state_title">
<p class="main_check">결제가 정상적으로 완료되었습니다.</p>
<p class="main_sub_check">주문 내역을 확인해 주세요</p>
</div>
<div class="order_product_info_title">
<p>상품 주문 정보</p>
</div>
<div class="order_product_info_body">
<div class="order_product_info">
<p><span>제품명: </span><%= p_data[0].product_name %></p>
<p><span>선택 수량: </span><%= order_data[0].order_product_count %></p>
<p><span>결제 금액: </span><%= order_data[0].order_money %></p>
</div>
</div>

<div class="order_product_info_title">
<p>상품 배송 정보</p>
</div>
<div class="order_product_info_body">
<div class="order_product_info">
<p><span>배송지 주소: </span><%= order_data[0].order_post_main %></p>
<p><span>배송지 상세 주소: </span><%= order_data[0].order_post_detail %></p>
<p><span>수령인: </span><%= order_data[0].order_get_user_name %></p>
</div>
</div>
<div class="check_btn_area">
<div class="check_btn">
<a href="/order/finish">확인</a>
</div>
</div>
</body>
</html>