sort 및 페이징
This commit is contained in:
@@ -26,7 +26,8 @@ import {
|
|||||||
SettlementsHistoryParams,
|
SettlementsHistoryParams,
|
||||||
SettlementsHistoryResponse,
|
SettlementsHistoryResponse,
|
||||||
SettlementsHistorySummaryParams,
|
SettlementsHistorySummaryParams,
|
||||||
SettlementsHistorySummaryResponse
|
SettlementsHistorySummaryResponse,
|
||||||
|
SettlementsTransactionSummaryParams
|
||||||
} from '../model/types';
|
} from '../model/types';
|
||||||
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
@@ -52,7 +53,6 @@ export const ListWrap = ({
|
|||||||
const [transactionDatelistItems, setTransactionDateListItems] = useState<Array<SettlementsTransactionListContent>>([]);
|
const [transactionDatelistItems, setTransactionDateListItems] = useState<Array<SettlementsTransactionListContent>>([]);
|
||||||
const [filterOn, setFilterOn] = useState<boolean>(false);
|
const [filterOn, setFilterOn] = useState<boolean>(false);
|
||||||
const [pageParam, setPageParam] = useState<DefaultRequestPagination>(DEFAULT_PAGE_PARAM);
|
const [pageParam, setPageParam] = useState<DefaultRequestPagination>(DEFAULT_PAGE_PARAM);
|
||||||
const [nextCursor, setNextCursor] = useState<string | null>(null);
|
|
||||||
const [mid, setMid] = useState<string>(userMid);
|
const [mid, setMid] = useState<string>(userMid);
|
||||||
const [periodType, setPeriodType] = useState<SettlementPeriodType>(SettlementPeriodType.SETTLEMENT_DATE);
|
const [periodType, setPeriodType] = useState<SettlementPeriodType>(SettlementPeriodType.SETTLEMENT_DATE);
|
||||||
const [startDate, setStartDate] = useState(startDateFromCalendar? moment(startDateFromCalendar).format('YYYYMMDD'): moment().format('YYYYMMDD'));
|
const [startDate, setStartDate] = useState(startDateFromCalendar? moment(startDateFromCalendar).format('YYYYMMDD'): moment().format('YYYYMMDD'));
|
||||||
@@ -97,7 +97,7 @@ export const ListWrap = ({
|
|||||||
entries.forEach((entry: IntersectionObserverEntry) => {
|
entries.forEach((entry: IntersectionObserverEntry) => {
|
||||||
if(entry.isIntersecting){
|
if(entry.isIntersecting){
|
||||||
console.log('Element is now intersecting with the root. [' + onActionIntersect + ']');
|
console.log('Element is now intersecting with the root. [' + onActionIntersect + ']');
|
||||||
if(onActionIntersect && !!nextCursor){
|
if(onActionIntersect && !!pageParam.cursor){
|
||||||
callList({
|
callList({
|
||||||
type: 'page'
|
type: 'page'
|
||||||
});
|
});
|
||||||
@@ -133,17 +133,9 @@ export const ListWrap = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(option?.type === 'page'){
|
if(option?.type !== 'page' && listParams.page){
|
||||||
if(listParams.page){
|
|
||||||
listParams.page.cursor = nextCursor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setNextCursor(null);
|
|
||||||
if(listParams.page){
|
|
||||||
listParams.page.cursor = null;
|
listParams.page.cursor = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
settlementsHistory(listParams).then((rs: SettlementsHistoryResponse) => {
|
settlementsHistory(listParams).then((rs: SettlementsHistoryResponse) => {
|
||||||
if(option?.type === 'page'){
|
if(option?.type === 'page'){
|
||||||
@@ -156,11 +148,17 @@ export const ListWrap = ({
|
|||||||
setSettlementDateListItems(rs.content);
|
setSettlementDateListItems(rs.content);
|
||||||
}
|
}
|
||||||
if(rs.hasNext){
|
if(rs.hasNext){
|
||||||
setNextCursor(rs.nextCursor);
|
setPageParam({
|
||||||
|
...pageParam,
|
||||||
|
...{ cursor: rs.nextCursor }
|
||||||
|
});
|
||||||
setOnActionIntersect(true);
|
setOnActionIntersect(true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
setNextCursor(null);
|
setPageParam({
|
||||||
|
...pageParam,
|
||||||
|
...{ cursor: null }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
settlementsHistorySummary(listSummaryParams).then((rs: SettlementsHistorySummaryResponse) => {
|
settlementsHistorySummary(listSummaryParams).then((rs: SettlementsHistorySummaryResponse) => {
|
||||||
@@ -173,42 +171,32 @@ export const ListWrap = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
const callTransactionList = (option?: {
|
const callTransactionList = (option?: {
|
||||||
sortType?: SortTypeKeys,
|
|
||||||
val?: string,
|
|
||||||
type?: string
|
type?: string
|
||||||
}) => {
|
}) => {
|
||||||
let params = {
|
let listSummaryParams: SettlementsTransactionSummaryParams = {
|
||||||
mid: mid,
|
mid: mid,
|
||||||
periodType: periodType,
|
periodType: periodType,
|
||||||
startDate: startDate,
|
startDate: startDate,
|
||||||
endDate: endDate,
|
endDate: endDate,
|
||||||
paymentMethod: paymentMethod,
|
paymentMethod: paymentMethod,
|
||||||
|
transactionIds: transactionIds,
|
||||||
page: pageParam
|
page: pageParam
|
||||||
};
|
};
|
||||||
|
let listParams = {
|
||||||
let summaryParams = {
|
...listSummaryParams,
|
||||||
...params,
|
|
||||||
...{
|
...{
|
||||||
transactionIds: transactionIds
|
page: {
|
||||||
|
...pageParam,
|
||||||
|
...{ sortType: sortType }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(params.page){
|
delete listParams.transactionIds;
|
||||||
params.page.sortType = option?.sortType || sortType;
|
|
||||||
setPageParam(params.page);
|
|
||||||
}
|
|
||||||
if(option?.type === 'page'){
|
|
||||||
if(params.page){
|
|
||||||
params.page.cursor = nextCursor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setNextCursor(null);
|
|
||||||
if(params.page){
|
|
||||||
params.page.cursor = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
settlementsTransactionList(params).then((rs) => {
|
if(option?.type !== 'page' && listParams.page){
|
||||||
|
listParams.page.cursor = null;
|
||||||
|
}
|
||||||
|
settlementsTransactionList(listParams).then((rs) => {
|
||||||
if(option?.type === 'page'){
|
if(option?.type === 'page'){
|
||||||
setTransactionDateListItems([
|
setTransactionDateListItems([
|
||||||
...transactionDatelistItems,
|
...transactionDatelistItems,
|
||||||
@@ -219,15 +207,21 @@ export const ListWrap = ({
|
|||||||
setTransactionDateListItems(rs.content);
|
setTransactionDateListItems(rs.content);
|
||||||
}
|
}
|
||||||
if(rs.hasNext){
|
if(rs.hasNext){
|
||||||
setNextCursor(rs.nextCursor);
|
setPageParam({
|
||||||
|
...pageParam,
|
||||||
|
...{ cursor: rs.nextCursor }
|
||||||
|
});
|
||||||
setOnActionIntersect(true);
|
setOnActionIntersect(true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
setNextCursor(null);
|
setPageParam({
|
||||||
|
...pageParam,
|
||||||
|
...{ cursor: null }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
settlementsTransactionSummary(summaryParams).then((rs) => {
|
settlementsTransactionSummary(listSummaryParams).then((rs) => {
|
||||||
setSettlementAmount(rs.settlementAmount);
|
setSettlementAmount(rs.settlementAmount);
|
||||||
setTransactionAmount(rs.transactionAmount);
|
setTransactionAmount(rs.transactionAmount);
|
||||||
setPaymentFeeAmount(rs.paymentFeeAmount);
|
setPaymentFeeAmount(rs.paymentFeeAmount);
|
||||||
@@ -366,7 +360,6 @@ export const ListWrap = ({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setNextCursor(null);
|
|
||||||
callList();
|
callList();
|
||||||
}, [
|
}, [
|
||||||
mid, periodType, sortType,
|
mid, periodType, sortType,
|
||||||
|
|||||||
@@ -106,19 +106,15 @@ export const SettlementInfoSection = ({
|
|||||||
>
|
>
|
||||||
정산 정보 <SectionTitleArrow isOpen={ isOpen }></SectionTitleArrow>
|
정산 정보 <SectionTitleArrow isOpen={ isOpen }></SectionTitleArrow>
|
||||||
</div>
|
</div>
|
||||||
{ (transactionCategory === TransactionCategory.AllTransaction) &&
|
|
||||||
<SlideDown className={'my-dropdown-slidedown'}>
|
<SlideDown className={'my-dropdown-slidedown'}>
|
||||||
{ !!isOpen &&
|
{ !!isOpen &&
|
||||||
<ul className="kv-list">
|
<ul className="kv-list">
|
||||||
{ subLi() }
|
{ (transactionCategory === TransactionCategory.AllTransaction) &&
|
||||||
</ul>
|
subLi()
|
||||||
}
|
|
||||||
</SlideDown>
|
|
||||||
}
|
}
|
||||||
{ (transactionCategory === TransactionCategory.Escrow) &&
|
{ (transactionCategory === TransactionCategory.Escrow) &&
|
||||||
<SlideDown className={'my-dropdown-slidedown'}>
|
<>
|
||||||
{ !!isOpen &&
|
|
||||||
<ul className="kv-list">
|
|
||||||
<li className="kv-row">
|
<li className="kv-row">
|
||||||
<span className="k">· 승인정산일</span>
|
<span className="k">· 승인정산일</span>
|
||||||
<span className="v">{ moment(settlementInfo?.approvalSettlementDate).format('YYYY.MM.DD') }</span>
|
<span className="v">{ moment(settlementInfo?.approvalSettlementDate).format('YYYY.MM.DD') }</span>
|
||||||
@@ -149,10 +145,11 @@ export const SettlementInfoSection = ({
|
|||||||
></NumericFormat>
|
></NumericFormat>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
</>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
</SlideDown>
|
</SlideDown>
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -59,9 +59,7 @@ export const FaqListPage = () => {
|
|||||||
category: selectedCategory,
|
category: selectedCategory,
|
||||||
searchCl: (!!searchValue)? SearchCl.HEAD: null,
|
searchCl: (!!searchValue)? SearchCl.HEAD: null,
|
||||||
searchValue: searchValue,
|
searchValue: searchValue,
|
||||||
...{
|
|
||||||
page: pageParam
|
page: pageParam
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if(type !== 'page' && listParams.page){
|
if(type !== 'page' && listParams.page){
|
||||||
listParams.page.cursor = null;
|
listParams.page.cursor = null;
|
||||||
|
|||||||
@@ -54,13 +54,12 @@ export const NoticeListPage = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const callList = (type?: string) => {
|
const callList = (type?: string) => {
|
||||||
|
setOnActionIntersect(false);
|
||||||
let listParams: NoticeListParams = {
|
let listParams: NoticeListParams = {
|
||||||
informCl: informCl,
|
informCl: informCl,
|
||||||
searchCl: (!!searchKeyword)? SearchCl.HEAD: null,
|
searchCl: (!!searchKeyword)? SearchCl.HEAD: null,
|
||||||
searchKeyword: searchKeyword,
|
searchKeyword: searchKeyword,
|
||||||
...{
|
|
||||||
page: pageParam
|
page: pageParam
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if(type !== 'page' && listParams.page){
|
if(type !== 'page' && listParams.page){
|
||||||
listParams.page.cursor = null;
|
listParams.page.cursor = null;
|
||||||
@@ -86,7 +85,7 @@ export const NoticeListPage = () => {
|
|||||||
else{
|
else{
|
||||||
setPageParam({
|
setPageParam({
|
||||||
...pageParam,
|
...pageParam,
|
||||||
...{ cursor: rs.nextCursor }
|
...{ cursor: null }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -59,9 +59,7 @@ export const QnaListPage = () => {
|
|||||||
let listParams: QnaListParams = {
|
let listParams: QnaListParams = {
|
||||||
mid: mid,
|
mid: mid,
|
||||||
statusCode: statusCode,
|
statusCode: statusCode,
|
||||||
...{
|
|
||||||
page: pageParam
|
page: pageParam
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if(type !== 'page'){
|
if(type !== 'page'){
|
||||||
if(listParams.page){
|
if(listParams.page){
|
||||||
|
|||||||
@@ -98,15 +98,13 @@ export const AllTransactionListPage = () => {
|
|||||||
let listParams: AllTransactionListParams = {
|
let listParams: AllTransactionListParams = {
|
||||||
...listSummaryParams,
|
...listSummaryParams,
|
||||||
...{
|
...{
|
||||||
page: pageParam
|
page: {
|
||||||
|
...pageParam,
|
||||||
|
...{ sortType: sortType }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(listParams.page){
|
|
||||||
listParams.page.sortType = option?.sortType || sortType;
|
|
||||||
setPageParam(listParams.page);
|
|
||||||
}
|
|
||||||
|
|
||||||
allTransactionList(listParams).then((rs: AllTransactionListResponse) => {
|
allTransactionList(listParams).then((rs: AllTransactionListResponse) => {
|
||||||
console.log(rs.content)
|
console.log(rs.content)
|
||||||
setListItems(rs.content);
|
setListItems(rs.content);
|
||||||
|
|||||||
Reference in New Issue
Block a user