Payment.js 6.05 KB
Newer Older
Kim, Subin's avatar
Kim, Subin committed
1
import React, { useState, useEffect, useRef } from 'react';
Kim, Subin's avatar
Kim, Subin committed
2
3
import MainNav from '../Components/MainNav';
import SubNav from '../Components/SubNav';
4
import { Container, Card, Row, Col, Button, Form } from 'react-bootstrap';
Kim, Subin's avatar
Kim, Subin committed
5
6
7

function Payment() {

8
    const [paymentWay, setPaymentWay] = useState([])
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

    function handleClick() {
        if (paymentWay.length !== 0) {
            setPaymentWay([])
        }
        else {
            const a = (
                <div>
                    <Form>
                        <Form.Group controlId="exampleForm.ControlSelect1">
                            <Form.Label>입금은행</Form.Label>
                            <Form.Control as="select" placeholder="입금은행을 선택하세요.">
                                <option>농협 / 352-0559-2528-83 / 김수빈</option>
                                <option>우리은행 / 0000-000-000000 / 이재연</option>
                                <option>국민은행 / 111111-11-111111 / 윤대기</option>
                            </Form.Control>
                        </Form.Group>
                        <Form.Group controlId="formName">
                            <Form.Label>입금자</Form.Label>
                            <Form.Control type="email" placeholder="윤지원" />
                        </Form.Group>
                        <Form.Group controlId="formDay">
                            <Form.Label>입금예정일</Form.Label>
                            <Form.Control type="date" />
                        </Form.Group>
                    </Form>
                </div>)
            setPaymentWay(a)
        }
    }

40
    function handleClick2() {
41
42
43
44
45
46
        if (paymentWay.length !== 0) {
            setPaymentWay([])
            // paymentWay=[]
        }
    }

Kim, Subin's avatar
Kim, Subin committed
47
48
    return (
        <div>
Kim, Subin's avatar
Kim, Subin committed
49
50
            <MainNav />
            <SubNav />
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
            <Container>
                <h3 className="my-5 font-weight-bold text-center" style={{ color: '#F2A400' }}>주문/결제</h3>
                <div>
                    <h5 className="bg-light font-weight-bold py-3 border-top border-bottom text-center">주문자 정보</h5>
                    <Form>
                        <Form.Group controlId="formBasicName">
                            <Form.Label>이름</Form.Label>
                            <Form.Control type="text" placeholder="윤지원" />
                        </Form.Group>
                        <Form.Group controlId="formBasicEmail">
                            <Form.Label>이메일</Form.Label>
                            <Form.Control type="email" placeholder="jiwon5393@naver.com" />
                        </Form.Group>
                        <Form.Group controlId="formBasicTel">
                            <Form.Label>휴대전화</Form.Label>
                            <Form.Control type="tel" placeholder="010-0000-0000" />
                        </Form.Group>
                    </Form>

                </div>

                <div>
                    <h5 className="bg-light font-weight-bold py-3 border-top border-bottom text-center">배송지 정보</h5>
                </div>

                <div>
                    <h5 className="bg-light font-weight-bold py-3 border-top border-bottom text-center">주문상품정보</h5>
                    <Card >
                        <Row>
                            <Col className="text-center align-self-center">
                                <input className="" type="checkbox" id="exampleCheck1"></input>

                            </Col>
                            <Col>
                                <Card.Img className="img-fluid" variant="top" src="img/asd.jpg" style={{ width: '20rem' }} />
                            </Col>
                            <Col>
                                <Card.Body>
                                    <img src="https://img.icons8.com/fluent-systems-regular/24/000000/close-window.png" className="float-right" />
                                    <Card.Title className="font-weight-bold mt-3">제품명</Card.Title>
                                    <Card.Text>가격</Card.Text>
                                    <Card.Text>옵션</Card.Text>
                                    <div>
                                        <Button variant="outline-dark" size="sm">-</Button>
                                        <input type="text" style={{ width: '30px' }} className="align-middle mx-1" readOnly></input>
                                        <Button variant="outline-dark" size="sm">+</Button>
                                    </div>
                                </Card.Body>
                            </Col>
                        </Row>
                    </Card>
                </div>

                <div className="bg-light p-5 m-5">
                    <ul className="pl-0" style={{ listStyle: 'none' }}>
                        <li>
                            <span className="text-secondary"> 상품금액</span>
                            <span className="text-secondary float-right">12,000</span>
                        </li>
                        <li>
                            <span className="text-secondary">배송비</span>
                            <span className="text-secondary float-right">2,500</span>
                        </li>
                    </ul>
                    <div className="my-1 pt-2 border-top font-weight-bold">
                        결제금액<span className="float-right">14,500</span>
                    </div>
                </div>

                <div>
                    <h5 className="bg-light font-weight-bold py-3 border-top border-bottom text-center">결제수단</h5>
                    <div className="text-center">
                        <Button variant="success" onClick={handleClick} >무통장입금</Button>
                        <Button variant="warning" style={{ color: '#ffffff' }} onClick={handleClick2}>카카오페이</Button>
                    </div>
                    {paymentWay}

                </div>
            </Container>
Kim, Subin's avatar
Kim, Subin committed
130
131
132
133
134
        </div>
    )
}

export default Payment