Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
shopping-mall
Commits
90177d68
Commit
90177d68
authored
Feb 03, 2021
by
Kim, Subin
Browse files
최종
parent
581c62c4
Changes
4
Show whitespace changes
Inline
Side-by-side
client/src/Components/ListCard.js
View file @
90177d68
...
@@ -54,12 +54,12 @@ function ListCard(props) {
...
@@ -54,12 +54,12 @@ function ListCard(props) {
<
Col
sm
=
{
3
}
xs
=
{
5
}
className
=
'
p-1
'
><
li
>
주문날짜
:
<
/li></
Col
>
<
Col
sm
=
{
3
}
xs
=
{
5
}
className
=
'
p-1
'
><
li
>
주문날짜
:
<
/li></
Col
>
<
Col
sm
=
{
8
}
xs
=
{
6
}
className
=
'
p-1
'
><
strong
>
{
e
.
createdAt
.
substring
(
0
,
10
)}
<
/strong></
Col
>
<
Col
sm
=
{
8
}
xs
=
{
6
}
className
=
'
p-1
'
><
strong
>
{
e
.
createdAt
.
substring
(
0
,
10
)}
<
/strong></
Col
>
<
Col
sm
=
{
3
}
xs
=
{
5
}
className
=
'
p-1
'
><
li
>
결제정보
:
<
/li></
Col
>
{
/*
<Col sm={3} xs={5} className='p-1'><li>결제정보 :</li></Col>
<Col sm={8} xs={6} className='p-1'><strong>{e.paymentWay}</strong>{e.paymentWay == 'Remittance' ? (
<Col sm={8} xs={6} className='p-1'><strong>{e.paymentWay}</strong>{e.paymentWay == 'Remittance' ? (
<>
<>
<br /><strong>{e.paymentInfo.bank} / ~ {e.paymentInfo.deadline}</strong>
<br /><strong>{e.paymentInfo.bank} / ~ {e.paymentInfo.deadline}</strong>
</>
</>
)
:
''
}
<
/Col
>
) : ''}</Col>
*/
}
<
/Row
>
<
/Row
>
<
/Col
>
<
/Col
>
<
/Card.Text
>
<
/Card.Text
>
...
...
client/src/Pages/Payment.js
View file @
90177d68
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Redirect
,
Link
,
useHistory
}
from
'
react-router-dom
'
;
import
{
useHistory
}
from
'
react-router-dom
'
;
import
DaumPostcode
from
"
react-daum-postcode
"
;
import
DaumPostcode
from
"
react-daum-postcode
"
;
import
ListCard
from
'
../Components/ListCard
'
;
import
ListCard
from
'
../Components/ListCard
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
...
@@ -7,20 +7,18 @@ import { isAuthenticated } from '../utils/auth';
...
@@ -7,20 +7,18 @@ import { isAuthenticated } from '../utils/auth';
import
catchErrors
from
'
../utils/catchErrors
'
;
import
catchErrors
from
'
../utils/catchErrors
'
;
import
{
Container
,
Row
,
Col
,
Button
,
Form
}
from
'
react-bootstrap
'
;
import
{
Container
,
Row
,
Col
,
Button
,
Form
}
from
'
react-bootstrap
'
;
function
Payment
(
{
match
,
location
}
)
{
function
Payment
()
{
const
[
cart
,
setCart
]
=
useState
([])
const
[
cart
,
setCart
]
=
useState
([])
const
[
order
,
setOrder
]
=
useState
({
products
:
[]
})
const
[
order
,
setOrder
]
=
useState
({
products
:
[]
})
const
[
userData
,
setUserData
]
=
useState
({})
const
[
userData
,
setUserData
]
=
useState
({})
const
[
error
,
setError
]
=
useState
()
const
[
error
,
setError
]
=
useState
()
const
[
post
,
setPost
]
=
useState
([])
const
[
post
,
setPost
]
=
useState
([])
const
[
redirect
,
setRedirect
]
=
useState
(
null
)
const
[
address
,
setAddress
]
=
useState
(
""
)
const
[
address
,
setAddress
]
=
useState
(
""
)
const
[
finalPrice
,
setFinalPrice
]
=
useState
(
0
)
const
[
finalPrice
,
setFinalPrice
]
=
useState
(
0
)
const
[
paymentWay
,
setPaymentWay
]
=
useState
([])
const
[
paymentWay
,
setPaymentWay
]
=
useState
([])
const
[
completeState
,
setCompleteState
]
=
useState
(
false
)
const
[
completeState
,
setCompleteState
]
=
useState
(
false
)
const
user
=
isAuthenticated
()
const
user
=
isAuthenticated
()
let
history
=
useHistory
();
let
history
=
useHistory
();
const
preCart
=
[]
useEffect
(()
=>
{
useEffect
(()
=>
{
getUser
()
getUser
()
...
@@ -79,7 +77,7 @@ function Payment({ match, location }) {
...
@@ -79,7 +77,7 @@ function Payment({ match, location }) {
function
handleReceiverInfo
(
e
)
{
function
handleReceiverInfo
(
e
)
{
const
{
name
,
value
}
=
e
.
target
const
{
name
,
value
}
=
e
.
target
console
.
log
(
name
,
value
)
console
.
log
(
name
,
value
)
setOrder
({
...
order
,
receiverInfo
:
{
...
order
.
receiverInfo
,
[
name
]:
value
}
})
setOrder
({
...
order
,
receiverInfo
:
{
...
order
.
receiverInfo
,
[
name
]:
value
}
})
}
}
...
@@ -170,59 +168,59 @@ function Payment({ match, location }) {
...
@@ -170,59 +168,59 @@ function Payment({ match, location }) {
order
.
products
.
map
((
el
)
=>
{
order
.
products
.
map
((
el
)
=>
{
cartIds
.
push
(
el
.
_id
)
cartIds
.
push
(
el
.
_id
)
})
})
//
try {
try
{
//
setError('')
setError
(
''
)
//
const response = await axios.post(`/api/order/addorder`, {
const
response
=
await
axios
.
post
(
`/api/order/addorder`
,
{
//
userId: user,
userId
:
user
,
//
...order,
...
order
,
//
paymentWay: completeState,
paymentWay
:
completeState
,
//
total: finalPrice + 2500
total
:
finalPrice
+
2500
//
})
})
//
const response2 = await axios.post(`/api/cart/deletecart2`, {
const
response2
=
await
axios
.
post
(
`/api/cart/deletecart2`
,
{
//
userId: user,
userId
:
user
,
//
cartId: cartIds
cartId
:
cartIds
//
})
})
//
const response3 = await axios.post(`/api/product/pluspurchase`, {
const
response3
=
await
axios
.
post
(
`/api/product/pluspurchase`
,
{
//
products: order.products
products
:
order
.
products
//
})
})
//
if (completeState === "kakaopay") {
if
(
completeState
===
"
kakaopay
"
)
{
//
let itemNames = ""
let
itemNames
=
""
//
if (cart.length > 1) {
if
(
cart
.
length
>
1
)
{
//
itemNames = cart[0].productId.pro_name + ' 외 ' + String(cart.length - 1) + '개'
itemNames
=
cart
[
0
].
productId
.
pro_name
+
'
외
'
+
String
(
cart
.
length
-
1
)
+
'
개
'
//
} else {
}
else
{
//
itemNames = cart[0].productId.pro_name
itemNames
=
cart
[
0
].
productId
.
pro_name
//
}
}
//
setError('')
setError
(
''
)
//
const response = await fetch('/api/kakaopay/test/single', {
const
response
=
await
fetch
(
'
/api/kakaopay/test/single
'
,
{
//
method: "POST",
method
:
"
POST
"
,
//
headers: {
headers
:
{
//
'Content-type': 'application/json'
'
Content-type
'
:
'
application/json
'
//
},
},
//
body: JSON.stringify({
body
:
JSON
.
stringify
({
//
cid: 'TC0ONETIME',
cid
:
'
TC0ONETIME
'
,
//
partner_order_id: 'partner_order_id',
partner_order_id
:
'
partner_order_id
'
,
//
partner_user_id: user,
partner_user_id
:
user
,
//
item_name: itemNames,
item_name
:
itemNames
,
//
quantity: cart.length,
quantity
:
cart
.
length
,
//
total_amount: finalPrice + 2500,
total_amount
:
finalPrice
+
2500
,
//
vat_amount: 200,
vat_amount
:
200
,
//
tax_free_amount: 0,
tax_free_amount
:
0
,
//
approval_url: 'http://localhost:3000/paymentcompleted',
approval_url
:
'
http://localhost:3000/paymentcompleted
'
,
//
fail_url: 'http://localhost:3000/shoppingcart',
fail_url
:
'
http://localhost:3000/shoppingcart
'
,
//
cancel_url: 'http://localhost:3000/shoppingcart',
cancel_url
:
'
http://localhost:3000/shoppingcart
'
,
//
})
})
//
})
})
//
const data = await response.json()
const
data
=
await
response
.
json
()
//
window.location.href = data.redirect_url
window
.
location
.
href
=
data
.
redirect_url
//
} else {
}
else
{
//
alert("주문이 완료되었습니다.")
alert
(
"
주문이 완료되었습니다.
"
)
//
history.push('/paymentcompleted')
history
.
push
(
'
/paymentcompleted
'
)
//
}
}
//
} catch (error) {
}
catch
(
error
)
{
//
catchErrors(error, setError)
catchErrors
(
error
,
setError
)
//
alert("주문에 실패하셨습니다. 다시 확인해주세요.")
alert
(
"
주문에 실패하셨습니다. 다시 확인해주세요.
"
)
//
window.location.reload()
window
.
location
.
reload
()
//
}
}
}
}
if
(
error
)
{
if
(
error
)
{
...
@@ -232,7 +230,7 @@ function Payment({ match, location }) {
...
@@ -232,7 +230,7 @@ function Payment({ match, location }) {
return
(
return
(
<
Container
className
=
"
mb-5
"
>
<
Container
className
=
"
mb-5
"
>
{
console
.
log
(
"
order=
"
,
order
)}
{
console
.
log
(
"
order=
"
,
order
)}
<
h3
className
=
"
my-5 font-weight-bold text-center
"
>
주문
/
결제
<
/h3
>
<
h3
className
=
"
my-5 font-weight-bold text-center
"
>
주문
/
결제
<
/h3
>
<
div
>
<
div
>
<
h5
className
=
"
font-weight-bold py-3 border-top border-bottom text-center
"
style
=
{{
background
:
'
#F7F3F3
'
}}
>
주문자
정보
<
/h5
>
<
h5
className
=
"
font-weight-bold py-3 border-top border-bottom text-center
"
style
=
{{
background
:
'
#F7F3F3
'
}}
>
주문자
정보
<
/h5
>
...
...
data/제작물/2020-21_winter_연구_발표회_간행물.hwp
0 → 100644
View file @
90177d68
File added
data/제작물/2020_winter_연구_발표회_게시물.pptx
0 → 100644
View file @
90177d68
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment