지급대행
This commit is contained in:
@@ -3,7 +3,15 @@ import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { HeaderType, SortByKeys } from '@/entities/common/model/types';
|
||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||
import { useExtensionPayoutListMutation } from '@/entities/additional-service/api/payout/use-extension-payout-list-mutation';
|
||||
import { ExtensionPayoutExcelParams, ExtensionPayoutExcelResponse, ExtensionPayoutListParams, ExtensionPayoutListResponse, PayoutDisbursementStatus, PayoutSearchCl } from '@/entities/additional-service/model/payout/types';
|
||||
import {
|
||||
ExtensionPayoutExcelParams,
|
||||
ExtensionPayoutExcelResponse,
|
||||
ExtensionPayoutListParams,
|
||||
ExtensionPayoutListResponse,
|
||||
PayoutContent,
|
||||
PayoutDisbursementStatus,
|
||||
PayoutSearchCl
|
||||
} from '@/entities/additional-service/model/payout/types';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||
import {
|
||||
@@ -15,12 +23,16 @@ import {
|
||||
import moment from 'moment';
|
||||
import { SortOptionsBox } from '@/entities/common/ui/sort-options-box';
|
||||
import { useExtensionPayoutExcelMutation } from '@/entities/additional-service/api/payout/use-extension-payout-excel-mutation';
|
||||
import { PayoutFilter } from '@/entities/additional-service/ui/filter/payout-filter';
|
||||
import { PayoutDisbursementStatusBtnGroup } from '@/entities/additional-service/model/payout/constant';
|
||||
import { ListDateGroup } from '@/entities/additional-service/ui/list-date-group';
|
||||
import { AdditionalServiceCategory } from '@/entities/additional-service/model/types';
|
||||
|
||||
export const PayoutListPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
|
||||
|
||||
const [sortBy, setSortBy] = useState<SortByKeys>(SortByKeys.New);
|
||||
const [listItems, setListItems] = useState<Record<string, Array<PayoutContent>>>({});
|
||||
const [filterOn, setFilterOn] = useState<boolean>(false);
|
||||
const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM);
|
||||
const [mid, setMid] = useState<string>('nictest001m');
|
||||
@@ -79,7 +91,7 @@ export const PayoutListPage = () => {
|
||||
page: pageParam
|
||||
};
|
||||
extensionPayoutList(params).then((rs: ExtensionPayoutListResponse) => {
|
||||
|
||||
setListItems(assembleData(rs.content));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -98,6 +110,29 @@ export const PayoutListPage = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const assembleData = (content: Array<PayoutContent>) => {
|
||||
let data: any = {};
|
||||
if(content && content.length > 0){
|
||||
for(let i=0;i<content?.length;i++){
|
||||
let date;
|
||||
if(searchCl === PayoutSearchCl.REQUEST_DATE){
|
||||
date = content[i]?.requestDate?.substring(0, 8);
|
||||
}
|
||||
else if(searchCl === PayoutSearchCl.PROXY_DATE){
|
||||
date = content[i]?.settlementDate?.substring(0, 8);
|
||||
}
|
||||
let groupDate = moment(date).format('YYYYMMDD');
|
||||
if(!!groupDate && !data.hasOwnProperty(groupDate)){
|
||||
data[groupDate] = [];
|
||||
}
|
||||
if(!!groupDate && data.hasOwnProperty(groupDate)){
|
||||
data[groupDate].push(content[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
const onClickToDownloadExcel = () => {
|
||||
callDownloadExcel();
|
||||
};
|
||||
@@ -108,7 +143,7 @@ export const PayoutListPage = () => {
|
||||
setSortBy(sort);
|
||||
callExtensionPayoutList({sortBy: sort});
|
||||
};
|
||||
const onClickToRequestStatus = (val: PayoutDisbursementStatus) => {
|
||||
const onClickToDisbursementStatus = (val: PayoutDisbursementStatus) => {
|
||||
setDisbursementStatus(val);
|
||||
callExtensionPayoutList({val: val});
|
||||
};
|
||||
@@ -118,6 +153,23 @@ export const PayoutListPage = () => {
|
||||
callExtensionPayoutList();
|
||||
}, []);
|
||||
|
||||
const getPayoutList = () => {
|
||||
let rs = [];
|
||||
if(Object.keys(listItems).length > 0){
|
||||
for (const [key, value] of Object.entries(listItems)) {
|
||||
rs.push(
|
||||
<ListDateGroup
|
||||
additionalServiceCategory={ AdditionalServiceCategory.Payout }
|
||||
key={ key }
|
||||
date={ key }
|
||||
items={ value }
|
||||
></ListDateGroup>
|
||||
);
|
||||
}
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<main>
|
||||
@@ -173,87 +225,48 @@ export const PayoutListPage = () => {
|
||||
></SortOptionsBox>
|
||||
<div className="excrow">
|
||||
<div className="full-menu-keywords no-padding">
|
||||
<span className="keyword-tag active">전체</span>
|
||||
<span className="keyword-tag">요청</span>
|
||||
<span className="keyword-tag">성공</span>
|
||||
<span className="keyword-tag">실패</span>
|
||||
{
|
||||
PayoutDisbursementStatusBtnGroup.map((value, index) => (
|
||||
<span
|
||||
key={ `key-service-code=${ index }` }
|
||||
className={ `keyword-tag ${(disbursementStatus === value.value)? 'active': ''}` }
|
||||
onClick={ () => onClickToDisbursementStatus(value.value) }
|
||||
>{ value.name }</span>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="transaction-list">
|
||||
<div className="date-header">25.06.08(일)</div>
|
||||
<div
|
||||
className="transaction-item approved"
|
||||
onClick={ () => onClickToGoDetail() }
|
||||
>
|
||||
<div className="transaction-status">
|
||||
<div className="status-dot blue"></div>
|
||||
</div>
|
||||
<div className="transaction-content">
|
||||
<div className="transaction-title">카카오스타일</div>
|
||||
<div className="transaction-details gap-0">
|
||||
<span>요청</span>
|
||||
<span className="separator">ㅣ</span>
|
||||
<span>cruiquis01m</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="transaction-amount">5,254,000원</div>
|
||||
<div className="transaction-list">
|
||||
{ getPayoutList() }
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={ () => onClickToNavigation() }
|
||||
>지급대행 신청</button>
|
||||
</div>
|
||||
<div className="transaction-item approved">
|
||||
<div className="transaction-status">
|
||||
<div className="status-dot blue"></div>
|
||||
</div>
|
||||
<div className="transaction-content">
|
||||
<div className="transaction-title">카카오스타일</div>
|
||||
<div className="transaction-details gap-0">
|
||||
<span>요청</span>
|
||||
<span className="separator">ㅣ</span>
|
||||
<span>cruiquis01m</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="transaction-amount">5,254,000원</div>
|
||||
</div>
|
||||
|
||||
<div className="date-header">25.06.08(일)</div>
|
||||
<div className="transaction-item approved">
|
||||
<div className="transaction-status">
|
||||
<div className="status-dot blue"></div>
|
||||
</div>
|
||||
<div className="transaction-content">
|
||||
<div className="transaction-title">카카오스타일</div>
|
||||
<div className="transaction-details gap-0">
|
||||
<span>요청</span>
|
||||
<span className="separator">ㅣ</span>
|
||||
<span>cruiquis01m</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="transaction-amount">5,254,000원</div>
|
||||
</div>
|
||||
<div className="transaction-item approved">
|
||||
<div className="transaction-status">
|
||||
<div className="status-dot blue"></div>
|
||||
</div>
|
||||
<div className="transaction-content">
|
||||
<div className="transaction-title">카카오스타일</div>
|
||||
<div className="transaction-details gap-0">
|
||||
<span>요청</span>
|
||||
<span className="separator">ㅣ</span>
|
||||
<span>cruiquis01m</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="transaction-amount">5,254,000원</div>
|
||||
</div>
|
||||
</section>
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={ () => onClickToNavigation() }
|
||||
>지급대행 신청</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<PayoutFilter
|
||||
filterOn={ filterOn }
|
||||
setFilterOn={ setFilterOn }
|
||||
mid={ mid }
|
||||
searchCl={ searchCl }
|
||||
fromDate={ fromDate }
|
||||
toDate={ toDate }
|
||||
disbursementStatus= { disbursementStatus }
|
||||
minAmount={ minAmount }
|
||||
maxAmount={ maxAmount }
|
||||
setMid={ setMid }
|
||||
setSearchCl={ setSearchCl }
|
||||
setFromDate={ setFromDate }
|
||||
setToDate={ setToDate }
|
||||
setDisbursementStatus={ setDisbursementStatus }
|
||||
setMinAmount={ setMinAmount }
|
||||
setMaxAmount={ setMaxAmount }
|
||||
></PayoutFilter>
|
||||
</>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user