From c0c983be1a3394b08f31890202a06c0bf8b133d1 Mon Sep 17 00:00:00 2001 From: "focp212@naver.com" Date: Fri, 24 Oct 2025 16:28:32 +0900 Subject: [PATCH] =?UTF-8?q?sort=20=EB=B0=8F=20=ED=8E=98=EC=9D=B4=EC=A7=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/settlement/ui/list-wrap.tsx | 79 +++++++++---------- .../ui/section/settlement-info-section.tsx | 25 +++--- src/pages/support/faq/list-page.tsx | 4 +- src/pages/support/notice/list-page.tsx | 7 +- src/pages/support/qna/list-page.tsx | 4 +- .../transaction/all-transaction/list-page.tsx | 12 ++- 6 files changed, 57 insertions(+), 74 deletions(-) diff --git a/src/entities/settlement/ui/list-wrap.tsx b/src/entities/settlement/ui/list-wrap.tsx index 252a06c..cc6ca0d 100644 --- a/src/entities/settlement/ui/list-wrap.tsx +++ b/src/entities/settlement/ui/list-wrap.tsx @@ -26,7 +26,8 @@ import { SettlementsHistoryParams, SettlementsHistoryResponse, SettlementsHistorySummaryParams, - SettlementsHistorySummaryResponse + SettlementsHistorySummaryResponse, + SettlementsTransactionSummaryParams } from '../model/types'; import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types'; import { useStore } from '@/shared/model/store'; @@ -52,7 +53,6 @@ export const ListWrap = ({ const [transactionDatelistItems, setTransactionDateListItems] = useState>([]); const [filterOn, setFilterOn] = useState(false); const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM); - const [nextCursor, setNextCursor] = useState(null); const [mid, setMid] = useState(userMid); const [periodType, setPeriodType] = useState(SettlementPeriodType.SETTLEMENT_DATE); const [startDate, setStartDate] = useState(startDateFromCalendar? moment(startDateFromCalendar).format('YYYYMMDD'): moment().format('YYYYMMDD')); @@ -97,7 +97,7 @@ export const ListWrap = ({ entries.forEach((entry: IntersectionObserverEntry) => { if(entry.isIntersecting){ console.log('Element is now intersecting with the root. [' + onActionIntersect + ']'); - if(onActionIntersect && !!nextCursor){ + if(onActionIntersect && !!pageParam.cursor){ callList({ type: 'page' }); @@ -133,16 +133,8 @@ export const ListWrap = ({ } } }; - if(option?.type === 'page'){ - if(listParams.page){ - listParams.page.cursor = nextCursor; - } - } - else{ - setNextCursor(null); - if(listParams.page){ - listParams.page.cursor = null; - } + if(option?.type !== 'page' && listParams.page){ + listParams.page.cursor = null; } settlementsHistory(listParams).then((rs: SettlementsHistoryResponse) => { @@ -156,11 +148,17 @@ export const ListWrap = ({ setSettlementDateListItems(rs.content); } if(rs.hasNext){ - setNextCursor(rs.nextCursor); + setPageParam({ + ...pageParam, + ...{ cursor: rs.nextCursor } + }); setOnActionIntersect(true); } else{ - setNextCursor(null); + setPageParam({ + ...pageParam, + ...{ cursor: null } + }); } }); settlementsHistorySummary(listSummaryParams).then((rs: SettlementsHistorySummaryResponse) => { @@ -173,42 +171,32 @@ export const ListWrap = ({ }); }; const callTransactionList = (option?: { - sortType?: SortTypeKeys, - val?: string, type?: string }) => { - let params = { + let listSummaryParams: SettlementsTransactionSummaryParams = { mid: mid, periodType: periodType, startDate: startDate, endDate: endDate, paymentMethod: paymentMethod, + transactionIds: transactionIds, page: pageParam }; - - let summaryParams = { - ...params, - ...{ - transactionIds: transactionIds + let listParams = { + ...listSummaryParams, + ...{ + page: { + ...pageParam, + ...{ sortType: sortType } + } } }; - if(params.page){ - params.page.sortType = option?.sortType || sortType; - setPageParam(params.page); - } - if(option?.type === 'page'){ - if(params.page){ - params.page.cursor = nextCursor; - } + delete listParams.transactionIds; + + if(option?.type !== 'page' && listParams.page){ + listParams.page.cursor = null; } - else{ - setNextCursor(null); - if(params.page){ - params.page.cursor = null; - } - } - - settlementsTransactionList(params).then((rs) => { + settlementsTransactionList(listParams).then((rs) => { if(option?.type === 'page'){ setTransactionDateListItems([ ...transactionDatelistItems, @@ -219,15 +207,21 @@ export const ListWrap = ({ setTransactionDateListItems(rs.content); } if(rs.hasNext){ - setNextCursor(rs.nextCursor); + setPageParam({ + ...pageParam, + ...{ cursor: rs.nextCursor } + }); setOnActionIntersect(true); } else{ - setNextCursor(null); + setPageParam({ + ...pageParam, + ...{ cursor: null } + }); } }); - settlementsTransactionSummary(summaryParams).then((rs) => { + settlementsTransactionSummary(listSummaryParams).then((rs) => { setSettlementAmount(rs.settlementAmount); setTransactionAmount(rs.transactionAmount); setPaymentFeeAmount(rs.paymentFeeAmount); @@ -366,7 +360,6 @@ export const ListWrap = ({ }, []); useEffect(() => { - setNextCursor(null); callList(); }, [ mid, periodType, sortType, diff --git a/src/entities/transaction/ui/section/settlement-info-section.tsx b/src/entities/transaction/ui/section/settlement-info-section.tsx index 9a3ba37..38b0177 100644 --- a/src/entities/transaction/ui/section/settlement-info-section.tsx +++ b/src/entities/transaction/ui/section/settlement-info-section.tsx @@ -106,19 +106,15 @@ export const SettlementInfoSection = ({ > 정산 정보 - { (transactionCategory === TransactionCategory.AllTransaction) && - - { !!isOpen && -
    - { subLi() } -
+ + + { !!isOpen && +
    + { (transactionCategory === TransactionCategory.AllTransaction) && + subLi() } - - } - { (transactionCategory === TransactionCategory.Escrow) && - - { !!isOpen && -
      + { (transactionCategory === TransactionCategory.Escrow) && + <>
    • ·  승인정산일 { moment(settlementInfo?.approvalSettlementDate).format('YYYY.MM.DD') } @@ -149,10 +145,11 @@ export const SettlementInfoSection = ({ >
    • -
    + } -
    +
} +
) diff --git a/src/pages/support/faq/list-page.tsx b/src/pages/support/faq/list-page.tsx index f97e73b..200b06c 100644 --- a/src/pages/support/faq/list-page.tsx +++ b/src/pages/support/faq/list-page.tsx @@ -59,9 +59,7 @@ export const FaqListPage = () => { category: selectedCategory, searchCl: (!!searchValue)? SearchCl.HEAD: null, searchValue: searchValue, - ...{ - page: pageParam - } + page: pageParam }; if(type !== 'page' && listParams.page){ listParams.page.cursor = null; diff --git a/src/pages/support/notice/list-page.tsx b/src/pages/support/notice/list-page.tsx index 3abb88e..228fcad 100644 --- a/src/pages/support/notice/list-page.tsx +++ b/src/pages/support/notice/list-page.tsx @@ -54,13 +54,12 @@ export const NoticeListPage = () => { }); const callList = (type?: string) => { + setOnActionIntersect(false); let listParams: NoticeListParams = { informCl: informCl, searchCl: (!!searchKeyword)? SearchCl.HEAD: null, searchKeyword: searchKeyword, - ...{ - page: pageParam - } + page: pageParam }; if(type !== 'page' && listParams.page){ listParams.page.cursor = null; @@ -86,7 +85,7 @@ export const NoticeListPage = () => { else{ setPageParam({ ...pageParam, - ...{ cursor: rs.nextCursor } + ...{ cursor: null } }); } }); diff --git a/src/pages/support/qna/list-page.tsx b/src/pages/support/qna/list-page.tsx index ab6cb1a..d0af63b 100644 --- a/src/pages/support/qna/list-page.tsx +++ b/src/pages/support/qna/list-page.tsx @@ -59,9 +59,7 @@ export const QnaListPage = () => { let listParams: QnaListParams = { mid: mid, statusCode: statusCode, - ...{ - page: pageParam - } + page: pageParam }; if(type !== 'page'){ if(listParams.page){ diff --git a/src/pages/transaction/all-transaction/list-page.tsx b/src/pages/transaction/all-transaction/list-page.tsx index 26ca584..d530e2c 100644 --- a/src/pages/transaction/all-transaction/list-page.tsx +++ b/src/pages/transaction/all-transaction/list-page.tsx @@ -98,15 +98,13 @@ export const AllTransactionListPage = () => { let listParams: AllTransactionListParams = { ...listSummaryParams, ...{ - page: pageParam + page: { + ...pageParam, + ...{ sortType: sortType } + } } }; - - if(listParams.page){ - listParams.page.sortType = option?.sortType || sortType; - setPageParam(listParams.page); - } - + allTransactionList(listParams).then((rs: AllTransactionListResponse) => { console.log(rs.content) setListItems(rs.content);