- getListDateGroup 수정
- 알림톡 필터 추가 - 일부 부가서비스 엑셀다운로드 바텀시트 추가
This commit is contained in:
@@ -21,7 +21,6 @@ import { KeyInPaymentList } from '@/entities/additional-service/ui/key-in-paymen
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { KeyInPaymentListItem, KeyInPaymentPaymentStatus } from '@/entities/additional-service/model/key-in/types';
|
||||
import { keyInPaymentPaymentStatusBtnGroup } from '@/entities/additional-service/model/key-in/constant';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
|
||||
export const KeyInPaymentPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
@@ -31,32 +30,12 @@ export const KeyInPaymentPage = () => {
|
||||
const [listItems, setListItems] = useState<Array<KeyInPaymentListItem>>([]);
|
||||
const [filterOn, setFilterOn] = useState<boolean>(false);
|
||||
const [pageParam, setPageParam] = useState<DefaultRequestPagination>(DEFAULT_PAGE_PARAM);
|
||||
const [nextCursor, setNextCursor] = useState<string | null>(null);
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
const [startDate, setStartDate] = useState(moment().format('YYYY-MM-DD'));
|
||||
const [endDate, setEndDate] = useState(moment().format('YYYY-MM-DD'));
|
||||
const [paymentStatus, setPaymentStatus] = useState<KeyInPaymentPaymentStatus>(KeyInPaymentPaymentStatus.ALL)
|
||||
const [minAmount, setMinAmount] = useState<number>();
|
||||
const [maxAmount, setMaxAmount] = useState<number>();
|
||||
const [onActionIntersect, setOnActionIntersect] = useState<boolean>(false);
|
||||
const onIntersect: IntersectionObserverCallback = (entries: Array<IntersectionObserverEntry>) => {
|
||||
entries.forEach((entry: IntersectionObserverEntry) => {
|
||||
if (entry.isIntersecting) {
|
||||
console.log('Element is now intersecting with the root. [' + onActionIntersect + ']');
|
||||
if (onActionIntersect) {
|
||||
callList();
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log('Element is no longer intersecting with the root.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const { setTarget } = useIntersectionObserver({
|
||||
threshold: 1,
|
||||
onIntersect
|
||||
});
|
||||
|
||||
useSetHeaderTitle('KEY-IN 결제');
|
||||
useSetHeaderType(HeaderType.LeftArrow);
|
||||
@@ -70,17 +49,8 @@ export const KeyInPaymentPage = () => {
|
||||
|
||||
const callList = (option?: {
|
||||
sortType?: SortTypeKeys,
|
||||
status?: KeyInPaymentPaymentStatus,
|
||||
resetPage?: boolean
|
||||
status?: KeyInPaymentPaymentStatus
|
||||
}) => {
|
||||
setOnActionIntersect(false);
|
||||
|
||||
const currentPageParam = option?.resetPage
|
||||
? { ...DEFAULT_PAGE_PARAM, sortType: option?.sortType ?? sortType }
|
||||
: { ...pageParam, sortType: option?.sortType ?? sortType };
|
||||
|
||||
setPageParam(currentPageParam);
|
||||
|
||||
let newMinAmount = minAmount;
|
||||
if (!!minAmount && typeof (minAmount) === 'string') {
|
||||
newMinAmount = parseInt(minAmount);
|
||||
@@ -96,28 +66,16 @@ export const KeyInPaymentPage = () => {
|
||||
paymentStatus: paymentStatus,
|
||||
minAmount: newMinAmount,
|
||||
maxAmount: newMaxAmount,
|
||||
... {
|
||||
page: currentPageParam
|
||||
}
|
||||
page: pageParam
|
||||
};
|
||||
|
||||
if (listParams.page) {
|
||||
listParams.page.sortType = option?.sortType || sortType;
|
||||
setPageParam(listParams.page);
|
||||
}
|
||||
|
||||
keyinList(listParams).then((rs) => {
|
||||
// resetPage면 기존 리스트 무시, 아니면 추가
|
||||
setListItems(option?.resetPage ? rs.content : [
|
||||
...listItems,
|
||||
...rs.content
|
||||
]);
|
||||
if (rs.hasNext) {
|
||||
setNextCursor(rs.nextCursor);
|
||||
setPageParam({
|
||||
...currentPageParam, // pageParam이 아니라 currentPageParam 사용
|
||||
cursor: rs.nextCursor
|
||||
});
|
||||
setOnActionIntersect(true)
|
||||
}
|
||||
else {
|
||||
setNextCursor(null);
|
||||
}
|
||||
setListItems(rs.content);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -149,21 +107,19 @@ export const KeyInPaymentPage = () => {
|
||||
const onClickToSort = (sort: SortTypeKeys) => {
|
||||
setSortType(sort);
|
||||
callList({
|
||||
sortType: sort,
|
||||
resetPage: true
|
||||
sortType: sort
|
||||
});
|
||||
};
|
||||
|
||||
const onClickToPaymentStatus = (val: KeyInPaymentPaymentStatus) => {
|
||||
setPaymentStatus(val);
|
||||
callList({
|
||||
status: val,
|
||||
resetPage: true
|
||||
status: val
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
callList({resetPage: true});
|
||||
callList();
|
||||
}, [
|
||||
mid,
|
||||
startDate,
|
||||
@@ -234,7 +190,6 @@ export const KeyInPaymentPage = () => {
|
||||
listItems={listItems}
|
||||
additionalServiceCategory={AdditionalServiceCategory.KeyInPayment}
|
||||
mid={mid}
|
||||
setTarget={setTarget}
|
||||
></KeyInPaymentList>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user