첫 커밋

This commit is contained in:
focp212@naver.com
2025-09-05 15:36:48 +09:00
commit 05238b04c1
825 changed files with 176358 additions and 0 deletions

View File

@@ -0,0 +1,188 @@
import { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import { PATHS } from '@/shared/constants/paths';
import { Dialog } from '@/shared/ui/dialogs/dialog';
import { overlay } from 'overlay-kit';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { useBillingDetailMutation } from '@/entities/transaction/api/use-billing-detail-mutation';
import { DetailAmountInfo } from '@/entities/transaction/ui/detail-amount-info';
import { DetailImportantInfo } from '@/entities/transaction/ui/detail-important-info';
import { DetailPaymentInfo } from '@/entities/transaction/ui/detail-payment-info';
import { DetailTransactionInfo } from '@/entities/transaction/ui/detail-transaction-info';
import { DetailSettlementInfo } from '@/entities/transaction/ui/detail-settlement-info';
import { DetailPartCancelInfo } from '@/entities/transaction/ui/detail-part-cancel-info';
import { HeaderType } from '@/entities/common/model/types';
import {
PageType,
BillingDetailParams,
DetailResponse,
DetailAmountInfoProps,
DetailImportantInfoProps,
DetailPaymentInfoProps,
DetailTransactionInfoProps,
DetailSettlementInfoProps,
DetailPartCancelInfoProps,
DetailInfoKeys
} from '@/entities/transaction/model/types';
import {
useSetOnBack,
useSetHeaderTitle,
useSetHeaderType,
useSetFooterMode
} from '@/widgets/sub-layout/use-sub-layout';
export const BillingDetailPage = () => {
const { navigate } = useNavigate();
const { tid } = useParams();
const [amountInfo, setAmountInfo] = useState<DetailAmountInfoProps>();
const [importantInfo, setImportantInfo] = useState<DetailImportantInfoProps>();
const [paymentInfo, setPaymentInfo] = useState<DetailPaymentInfoProps>();
const [transactionInfo, setTransactionInfo] = useState<DetailTransactionInfoProps>();
const [settlementInfo, setSettlementInfo] = useState<DetailSettlementInfoProps>();
const [partCancelInfo, setPartCancelInfo] = useState<DetailPartCancelInfoProps>();
const [showAmount, setShowAmount] = useState<boolean>(false);
const [showPayment, setShowPayment] = useState<boolean>(false);
const [showTransaction, setShowTransaction] = useState<boolean>(false);
const [showSettlement, setShowSettlement] = useState<boolean>(false);
const [showPartCancel, setShowPartCancel] = useState<boolean>(false);
useSetHeaderTitle('빌링 상세');
useSetHeaderType(HeaderType.RightClose);
useSetOnBack(() => {
navigate(PATHS.transaction.billing.list);
});
useSetFooterMode(false);
const { mutateAsync: billingDetail } = useBillingDetailMutation();
const callDetail = () => {
let billingDetailParams: BillingDetailParams = {
svcCd: 'st',
tid: tid
};
billingDetail(billingDetailParams).then((rs: DetailResponse) => {
setAmountInfo(rs.amountInfo);
setImportantInfo(rs.importantInfo);
setPaymentInfo(rs.paymentInfo);
setTransactionInfo(rs.transactionInfo);
setSettlementInfo(rs.settlementInfo);
setPartCancelInfo(rs.partCancelInfo);
});
};
useEffect(() => {
callDetail();
}, []);
const onClickToNavigate = (path: string) => {
let timeout = setTimeout(() => {
clearTimeout(timeout);
navigate(PATHS.transaction.allTransaction.cancel, {
state: {
tid: tid
}
});
}, 10)
};
const onClickToCancel = () => {
let msg = '거래를 취소하시겠습니까?';
overlay.open(({
isOpen,
close,
unmount
}) => {
return (
<Dialog
afterLeave={ unmount }
open={ isOpen }
onClose={ close }
onConfirmClick={ () => onClickToNavigate(PATHS.transaction.allTransaction.cancel) }
message={ msg }
buttonLabel={['취소', '확인']}
/>
);
});
};
const onClickToShowInfo = (info: DetailInfoKeys) => {
if(info === DetailInfoKeys.Amount){
setShowAmount(!showAmount);
}
else if(info === DetailInfoKeys.Payment){
setShowPayment(!showPayment);
}
else if(info === DetailInfoKeys.Transaction){
setShowTransaction(!showTransaction);
}
else if(info === DetailInfoKeys.Settlement){
setShowSettlement(!showSettlement);
}
else if(info === DetailInfoKeys.PartCancel){
setShowPartCancel(!showPartCancel);
}
};
return (
<>
<main>
<div className="tab-content">
<div className="tab-pane sub active">
<div className="option-list">
<div className="txn-detail">
<DetailAmountInfo
pageType={ PageType.Billing }
amountInfo={ amountInfo }
show={ showAmount }
tid={ tid }
onClickToShowInfo={ (info) => onClickToShowInfo(info) }
></DetailAmountInfo>
<div className="txn-divider minus"></div>
<DetailImportantInfo
pageType={ PageType.Billing }
importantInfo={ importantInfo }
></DetailImportantInfo>
<div className="txn-divider minus"></div>
<DetailPaymentInfo
pageType={ PageType.Billing }
paymentInfo={ paymentInfo }
show={ showPayment }
onClickToShowInfo={ (info) => onClickToShowInfo(info) }
></DetailPaymentInfo>
<div className="txn-divider"></div>
<DetailTransactionInfo
pageType={ PageType.Billing }
transactionInfo={ transactionInfo }
show={ showTransaction }
onClickToShowInfo={ (info) => onClickToShowInfo(info) }
></DetailTransactionInfo>
<div className="txn-divider"></div>
<DetailSettlementInfo
pageType={ PageType.Billing }
settlementInfo={ settlementInfo }
show={ showSettlement }
onClickToShowInfo={ (info) => onClickToShowInfo(info) }
></DetailSettlementInfo>
<div className="txn-divider"></div>
<DetailPartCancelInfo
pageType={ PageType.Billing }
partCancelInfo={ partCancelInfo }
show={ showPartCancel }
onClickToShowInfo={ (info) => onClickToShowInfo(info) }
></DetailPartCancelInfo>
</div>
</div>
<div className="apply-row">
<button
className="btn-50 btn-blue flex-1"
onClick={ () => onClickToCancel() }
> </button>
</div>
</div>
</div>
</main>
</>
);
};

View File

@@ -0,0 +1,187 @@
import moment from 'moment';
import { useEffect, useState } from 'react';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { PATHS } from '@/shared/constants/paths';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { BillingList } from '@/entities/transaction/ui/billing-list';
import { ListItem, PageType, SortByKeys } from '@/entities/transaction/model/types';
import { useBillingListMutation } from '@/entities/transaction/api/use-billing-list-mutation';
import { useDownloadExcelMutation } from '@/entities/transaction/api/use-download-excel-mutation';
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constants';
import { Filter } from '@/entities/transaction/ui/filter';
import { SortOptionsBox } from '@/entities/transaction/ui/sort-options-box';
import { HeaderType } from '@/entities/common/model/types';
import {
useSetOnBack,
useSetHeaderTitle,
useSetHeaderType,
useSetFooterMode
} from '@/widgets/sub-layout/use-sub-layout';
const serviceCodes = [
{name: '전체', key: 'all'},
{name: '진행중', key: 'process'},
{name: '성공', key: 'success'},
{name: '요청취소', key: 'cancel'}
];
export const BillingListPage = () => {
const { navigate } = useNavigate();
const [selectedServiceCode, setSelectedServiceCode] = useState<string>('all');
const [sortBy, setSortBy] = useState<SortByKeys>(SortByKeys.New);
const [listItems, setListItems] = useState({});
const [filterOn, setFilterOn] = useState<boolean>(false);
const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM);
const [fromDate, setFromDate] = useState(moment().subtract(1, 'month').format('YYYYMMDD'));
const [toDate, setToDate] = useState(moment().format('YYYYMMDD'));
useSetHeaderTitle('빌링');
useSetHeaderType(HeaderType.LeftArrow);
useSetOnBack(() => {
navigate(PATHS.home);
});
useSetFooterMode(true);
const { mutateAsync: billingList } = useBillingListMutation();
const { mutateAsync: downloadExcel } = useDownloadExcelMutation();
const callList = (option?: {
sortBy?: string,
val?: string
}) => {
let listSummaryParams = {
moid: 'string',
tid: 'string',
fromDate: fromDate,
toDate: toDate,
stateCode: '0',
serviceCode: (option?.val)? option.val: selectedServiceCode,
minAmount: 0,
maxAmount: 0,
dateCl: 'TRANS',
goodsName: 'string',
cardCode: 'st',
bankCode: 'str',
searchCl: 'CARD_NO',
searchValue: 'string',
};
pageParam.sortBy = (option?.sortBy)? option.sortBy: sortBy;
setPageParam(pageParam);
let listParam = {
...listSummaryParams,
...{page: pageParam}
};
billingList(listParam).then((rs) => {
setListItems(assembleData(rs.content));
});
}
const assembleData = (content: Array<ListItem>) => {
let data: any = {};
if(content && content.length > 0){
for(let i=0;i<content?.length;i++){
let stateDate = content[i]?.stateDate;
let groupDate = stateDate?.substring(0, 8);
if(!!groupDate && !data.hasOwnProperty(groupDate)){
data[groupDate] = [];
}
if(!!groupDate && data.hasOwnProperty(groupDate)){
data[groupDate].push(content[i]);
}
}
}
return data;
};
const onClickToOpenFilter = () => {
setFilterOn(!filterOn);
};
const onClickToDownloadExcel = () => {
// tid??? 확인 필요
downloadExcel({
// tid: tid
}).then((rs) => {
});
};
const onCliCkToSort = (sort: SortByKeys) => {
setSortBy(sort);
callList({sortBy: sort});
};
const onClickToServiceCode = (val: string) => {
setSelectedServiceCode(val);
callList({val: val});
};
useEffect(() => {
callList();
}, []);
return (
<>
<main>
<div className="tab-content">
<div className="tab-pane sub active" id="tab1">
<div className="summary-section">
<div className="credit-controls">
<div>
<input
type="text"
className="credit-period"
value={ moment(fromDate).format('YYYY.MM.DD') + '-' + moment(toDate).format('YYYY.MM.DD') }
readOnly={ true }
/>
<button className="filter-btn">
<img
src={ IMAGE_ROOT + '/ico_setting.svg' }
alt="검색옵션"
onClick={ () => onClickToOpenFilter() }
/>
</button>
</div>
<button className="download-btn">
<img
src={ IMAGE_ROOT + '/ico_download.svg' }
alt="다운로드"
onClick={ () => onClickToDownloadExcel() }
/>
</button>
</div>
</div>
<div className="filter-section">
<SortOptionsBox
sortBy={ sortBy }
onCliCkToSort={ onCliCkToSort }
></SortOptionsBox>
<div className="excrow">
<div className="full-menu-keywords no-padding">
{
serviceCodes.map((value, index) => (
<span
key={ `key-service-code=${ index }` }
className={ `keyword-tag ${(selectedServiceCode === value.key)? 'active': ''}` }
onClick={ () => onClickToServiceCode(value.key) }
>{ value.name }</span>
))
}
</div>
</div>
</div>
<BillingList
listItems={ listItems }
pageType={ PageType.Billing }
></BillingList>
</div>
</div>
</main>
<Filter
filterOn={ filterOn }
setFilterOn={ setFilterOn }
></Filter>
</>
);
};

View File

@@ -0,0 +1,123 @@
import { PATHS } from '@/shared/constants/paths';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { HeaderType } from '@/entities/common/model/types';
import {
useSetOnBack,
useSetHeaderTitle,
useSetHeaderType,
useSetFooterMode
} from '@/widgets/sub-layout/use-sub-layout';
export const BillingPaymentRequestPage = () => {
const { navigate } = useNavigate();
useSetHeaderTitle('빌링 결제 신청');
useSetHeaderType(HeaderType.RightClose);
useSetOnBack(() => {
navigate(PATHS.transaction.billing.list);
});
useSetFooterMode(false);
return (
<>
<main>
<div className="tab-content">
<div className="tab-pane sub active" id="tab1">
<div className="option-list">
<div className="billing-title"> </div>
<div className="billing-form">
<div className="billing-row">
<div className="billing-label"> <span>*</span></div>
<div className="billing-field">
<input
type="text"
value="BIKYvattest01m"
readOnly={ true }
/>
</div>
</div>
<div className="billing-row">
<div className="billing-label"> <span>*</span></div>
<div className="billing-field">
<input
type="text"
value="테스트상품123"
/>
</div>
</div>
<div className="billing-row">
<div className="billing-label"> <span>*</span></div>
<div className="billing-field">
<input
type="text"
value="1,000,000"
/>
</div>
</div>
<div className="billing-row">
<div className="billing-label"> <span>*</span></div>
<div className="billing-field">
<input
type="text"
value="P146733723"
/>
</div>
</div>
<div className="billing-row">
<div className="billing-label"> <span>*</span></div>
<div className="billing-field">
<input
type="text"
value="김테스트"
/>
</div>
</div>
<div className="billing-row">
<div className="billing-label"> </div>
<div className="billing-field">
<div className="input-wrapper date wid-100">
<input
type="text"
value="2025/03/21"
placeholder=""
/>
<button
className="date-btn"
type="button"
>
<img
src={ IMAGE_ROOT + '/ico_date.svg' }
alt="clear"
/>
</button>
</div>
</div>
</div>
<div className="billing-row">
<div className="billing-label"> </div>
<div className="billing-field">
<select>
<option value=""></option>
<option value="0"></option>
<option value="2">2</option>
<option value="3">3</option>
<option value="6">6</option>
</select>
</div>
</div>
</div>
</div>
<div className="apply-row">
<button className="btn-50 btn-blue flex-1"> </button>
</div>
</div>
</div>
</main>
</>
);
};