import React, { useState, useEffect, useRef } from 'react'; import MainNav from '../Components/MainNav'; import SubNav from '../Components/SubNav'; import DaumPostcode from "react-daum-postcode"; import { Container, Card, Row, Col, Button, Form, FormGroup } from 'react-bootstrap'; import { Redirect } from 'react-router-dom'; function Payment() { const [paymentWay, setPaymentWay] = useState([]) const [isAddress, setIsAddress] = useState(""); const [isZoneCode, setIsZoneCode] = useState(); const [isPostOpen, setIsPostOpen] = useState(); const [post, setPost] = useState([]) const [redirect, setRedirect] = useState(null) const [address, setAddress] = useState("") const [num, setNum] = useState(0) function postClick() { if (post.length !== 0) { setPost([]) } else { setPost(
) } } const handleComplete = (data) => { let fullAddress = data.address; let extraAddress = ""; console.log(data) if (data.addressType === "R") { if (data.bname !== "") { extraAddress += data.bname; console.log(extraAddress) } if (data.buildingName !== "") { extraAddress += extraAddress !== "" ? `, ${data.buildingName}` : data.buildingName; } fullAddress += extraAddress !== "" ? ` (${extraAddress})` : ""; } setAddress({ full: fullAddress, zone: data.zonecode }); console.log(fullAddress); } const postCodeStyle = { // display: "block", position: "absolute", width: "400px", height: "500px", padding: "7px", zIndex: "1000" }; function handleClick() { if (paymentWay.length !== 0) { setPaymentWay([]) } else { const a = (
입금은행 입금자 입금예정일
) setPaymentWay(a) } } function handleClick2() { if (paymentWay.length !== 0) { setPaymentWay([]) } } async function kakaopay() { const response = await fetch('/api/kakaopay/test/single', { method: "POST", headers: { 'Content-type': 'application/json' }, body: JSON.stringify({ cid: 'TC0ONETIME', partner_order_id: 'partner_order_id', partner_user_id: 'partner_user_id', item_name: '앙고라 반목 폴라 베이직 모헤어 니트 (T)', quantity: 1, total_amount: 22000, vat_amount: 200, tax_free_amount: 0, approval_url: 'http://localhost:3000/kakaopay/success', fail_url: 'http://localhost:3000/kakaopay/fail', cancel_url: 'http://localhost:3000/kakaopay/cancel', }) }) const data = await response.json() console.log(data) window.location.href = data.redirect_url // setRedirect(data.redirect_url) } function plusNum() { setNum(num + 1) } function minusNum() { if (num === 0) { setNum(0) } else { setNum(num - 1) } } function deleteCart() { //장바구니 DB에서 해당 항목 삭제 console.log('카트에 담긴 항목을 삭제했습니다.') } if (redirect) { console.log(redirect) return } return (

주문/결제

주문자 정보
이름 이메일 휴대전화
받는사람 정보
이름 주소 {post} 상세 주소를 입력하세요. 휴대전화
주문상품정보
제품명 가격 옵션 수량
  • 총 상품금액 12,000원
  • 배송비 2,500원
결제금액14,500원
결제수단
{paymentWay}
) } export default Payment