@@ -5,17 +5,19 @@ import { formatLimit } from '../../shared/utils/format';
55import * as styles from './savings-detail-page.css' ;
66import Header from '../../shared/components/header/header' ;
77
8- type Option = {
9- interestType : string ;
10- reserveType : string ;
11- saveTerm : number ;
12- baseRate : number ;
13- maxRate : number ;
8+ type SimilarProducts = {
9+ productId : number ;
10+ optionId : number ;
11+ bankName : string ;
12+ productName : string ;
13+ maxLimitDiff : number ;
14+ termDiff : number ;
15+ baseRateDiff : number ;
16+ maxRateDiff : number ;
1417} ;
1518
1619type ProductDetail = {
1720 productId : number ;
18- optionId : number ;
1921 bankName : string ;
2022 productName : string ;
2123 joinDeny : string ;
@@ -25,41 +27,19 @@ type ProductDetail = {
2527 etcNote : string ;
2628 maxLimit : string ;
2729 maturityInterestInfo : string ;
28- options : Option [ ] ;
30+ optionId : number ;
31+ interestType : string ;
32+ reserveType : string ;
33+ saveTerm : number ;
34+ baseRate : number ;
35+ maxRate : number ;
36+ similarProducts : SimilarProducts [ ] ;
2937} ;
3038
3139const SavingsDetailPage = ( ) => {
3240 const { productId, optionId } = useParams ( ) ;
3341
34- // TODO:API 연결 후 mockdata 삭제
35- const mockDetail : ProductDetail = {
36- productId : 50 ,
37- optionId : 167 ,
38- bankName : '수협은행' ,
39- productName : 'Sh해양플라스틱Zero!적금' ,
40- joinDeny : '제한없음' ,
41- joinMember : '실명의 개인' ,
42- joinWay : '영업점,인터넷,스마트폰' ,
43- specialCondition :
44- '* 최대우대금리:0.5%\n1. 해양플라스틱감축서약 : 0.1% (신규시) \n2. 봉사활동 또는 상품홍보 : 0.2% (만기시) \n3. 입출금통장 최초신규 : 0.2% (만기시)\n4. 자동이체 출금실적 : 0.2% (만기시)\n - 수협신용카드 / 당행 펀드 / 수협체크카드' ,
45- etcNote : '- 1인 1계좌 \n- 월 가입한도 : 20만원' ,
46- maxLimit : '200,000' ,
47- maturityInterestInfo :
48- '* 만기후 1년 이내\n - 만기당시 상호부금 \n계약기간별 기본금리 1/2\n* 만기후 1년 초과\n - 만기당시 보통예금 기본금리' ,
49- options : [
50- {
51- interestType : '단리' ,
52- reserveType : '자유적립식' ,
53- saveTerm : 12 ,
54- baseRate : 3.65 ,
55- maxRate : 4.15 ,
56- } ,
57- ] ,
58- } ;
59-
60- // TODO: API 연결 후 주석 삭제
61- //const [detail, setDetail] = useState<ProductDetail | null>(null);
62- const [ detail , setDetail ] = useState < ProductDetail | null > ( mockDetail ) ;
42+ const [ detail , setDetail ] = useState < ProductDetail | null > ( null ) ;
6343
6444 useEffect ( ( ) => {
6545 if ( ! productId || ! optionId ) return ;
@@ -69,9 +49,9 @@ const SavingsDetailPage = () => {
6949 } ) ;
7050 } , [ productId , optionId ] ) ;
7151
72- if ( ! detail ) return < div > Loading... </ div > ;
73-
74- const option = detail . options [ 0 ] ;
52+ if ( ! detail ) {
53+ return < div className = { styles . notFound } > 찾으시는 상품이 존재하지 않습니다. </ div > ;
54+ }
7555
7656 return (
7757 < >
@@ -110,31 +90,29 @@ const SavingsDetailPage = () => {
11090 </ div >
11191 </ div >
11292
113- { option && (
114- < div className = { styles . optionContainer } >
115- < h3 className = { styles . optionText } > 상품 옵션 ⭐</ h3 >
116- < div className = { styles . optionTextContainer } >
117- < h4 className = { styles . optionTitle } > 이자 유형:</ h4 >
118- < p className = { styles . optionValue } > { option . interestType } </ p >
119- </ div >
120- < div className = { styles . optionTextContainer } >
121- < h4 className = { styles . optionTitle } > 적립 방식:</ h4 >
122- < p className = { styles . optionValue } > { option . reserveType } </ p >
123- </ div >
124- < div className = { styles . optionTextContainer } >
125- < h4 className = { styles . optionTitle } > 저축 기간:</ h4 >
126- < p className = { styles . optionValue } > { option . saveTerm } 개월</ p >
127- </ div >
128- < div className = { styles . optionTextContainer } >
129- < h4 className = { styles . optionTitle } > 기본 금리:</ h4 >
130- < p className = { styles . optionValue } > { option . baseRate } %</ p >
131- </ div >
132- < div className = { styles . optionTextContainer } >
133- < h4 className = { styles . optionTitle } > 최대 금리:</ h4 >
134- < p className = { styles . optionValue } > { option . maxRate } %</ p >
135- </ div >
93+ < div className = { styles . optionContainer } >
94+ < h3 className = { styles . optionText } > 상품 옵션 ⭐</ h3 >
95+ < div className = { styles . optionTextContainer } >
96+ < h4 className = { styles . optionTitle } > 이자 유형:</ h4 >
97+ < p className = { styles . optionValue } > { detail . interestType } </ p >
13698 </ div >
137- ) }
99+ < div className = { styles . optionTextContainer } >
100+ < h4 className = { styles . optionTitle } > 적립 방식:</ h4 >
101+ < p className = { styles . optionValue } > { detail . reserveType } </ p >
102+ </ div >
103+ < div className = { styles . optionTextContainer } >
104+ < h4 className = { styles . optionTitle } > 저축 기간:</ h4 >
105+ < p className = { styles . optionValue } > { detail . saveTerm } 개월</ p >
106+ </ div >
107+ < div className = { styles . optionTextContainer } >
108+ < h4 className = { styles . optionTitle } > 기본 금리:</ h4 >
109+ < p className = { styles . optionValue } > { detail . baseRate } %</ p >
110+ </ div >
111+ < div className = { styles . optionTextContainer } >
112+ < h4 className = { styles . optionTitle } > 최대 금리:</ h4 >
113+ < p className = { styles . optionValue } > { detail . maxRate } %</ p >
114+ </ div >
115+ </ div >
138116 </ div >
139117
140118 { /* TODO: 유사 상품 리스트 API 연결 후 구현 */ }
0 commit comments