-
Course
-
-
-
-
-
+
+
+
+
+
{tab === "order" &&
}
diff --git a/src/pages/Admin/page/AdminPage/OrderCheck/OrderCheck.style.ts b/src/pages/Admin/page/AdminPage/OrderCheck/OrderCheck.style.ts
index 5d0cd9e..a8079ff 100644
--- a/src/pages/Admin/page/AdminPage/OrderCheck/OrderCheck.style.ts
+++ b/src/pages/Admin/page/AdminPage/OrderCheck/OrderCheck.style.ts
@@ -15,3 +15,11 @@ export const sectionTitle = (theme: Theme) => css`
${theme.font["head02-b-20"]}
margin-bottom: 1.2rem;
`;
+
+export const observerRefDiv = css`
+ height: 1px;
+`;
+
+export const orderDataSpinner = css`
+ margin: 2rem auto 0;
+`;
diff --git a/src/pages/Admin/page/AdminPage/OrderCheck/OrderCheck.tsx b/src/pages/Admin/page/AdminPage/OrderCheck/OrderCheck.tsx
index 9f6d145..21a9cfc 100644
--- a/src/pages/Admin/page/AdminPage/OrderCheck/OrderCheck.tsx
+++ b/src/pages/Admin/page/AdminPage/OrderCheck/OrderCheck.tsx
@@ -1,8 +1,15 @@
import { Filter, OrderTable } from "@pages/Admin/components";
-import { pageLayout, sectionStyle, sectionTitle } from "./OrderCheck.style";
-import { useRef, useState } from "react";
+import {
+ observerRefDiv,
+ orderDataSpinner,
+ pageLayout,
+ sectionStyle,
+ sectionTitle,
+} from "./OrderCheck.style";
+import { useRef, useState, useEffect, useCallback } from "react";
import { Dayjs } from "dayjs";
import { useFetchOrders } from "@apis/domains/admin/useFetchOrders";
+import { ClipLoader } from "react-spinners";
interface Option {
value: string;
@@ -20,9 +27,40 @@ const OrderCheck = () => {
deliveryDate: "",
productName: "",
deliveryStatus: "",
+ nextCursor: "",
});
- const { data: orderData } = useFetchOrders(query);
+ const { data, fetchNextPage, hasNextPage, isFetchingNextPage } =
+ useFetchOrders(query);
+
+ const orders = data ?? [];
+
+ const observerRef = useRef
(null);
+
+ const onIntersect = useCallback(
+ (entries: IntersectionObserverEntry[]) => {
+ if (entries[0].isIntersecting && hasNextPage && !isFetchingNextPage) {
+ fetchNextPage();
+ }
+ },
+ [fetchNextPage, hasNextPage, isFetchingNextPage]
+ );
+
+ useEffect(() => {
+ if (!observerRef.current) return;
+
+ const observer = new IntersectionObserver(onIntersect, {
+ root: null,
+ rootMargin: "0px",
+ threshold: 0,
+ });
+
+ observer.observe(observerRef.current);
+
+ return () => {
+ observer.disconnect();
+ };
+ }, [onIntersect]);
const handleSearchClick = () => {
const newQuery = {
@@ -31,6 +69,7 @@ const OrderCheck = () => {
deliveryDate: deliveryDateRef.current?.format("YYYY-MM-DD") || "",
productName: productRef.current?.value || "",
deliveryStatus: statusRef.current?.value || "",
+ nextCursor: "",
};
setQuery(newQuery);
};
@@ -46,6 +85,7 @@ const OrderCheck = () => {
deliveryDate: "",
productName: "",
deliveryStatus: "",
+ nextCursor: "",
});
};
@@ -62,7 +102,16 @@ const OrderCheck = () => {
handleResetClick={handleResetClick}
/>
-
+
+
+ {hasNextPage && !isFetchingNextPage && (
+
+ )}
);
};
diff --git a/src/pages/orderCheck/components/DialButton/DialButton.style.ts b/src/pages/orderCheck/components/DialButton/DialButton.style.ts
index 369750a..98a02c0 100644
--- a/src/pages/orderCheck/components/DialButton/DialButton.style.ts
+++ b/src/pages/orderCheck/components/DialButton/DialButton.style.ts
@@ -4,9 +4,8 @@ import { flexGenerator } from "@styles/generator";
export const buttonStyle = (index: number) => (theme: Theme) =>
css`
${flexGenerator()};
- padding: 1rem;
- width: 15rem;
- height: 12.8rem;
+ width: 100%;
+ height: 100%;
border: 1px solid ${theme.color.lightgray3};
background-color: ${index === 9 || index === 11
? theme.color.lightgray2
@@ -15,5 +14,5 @@ export const buttonStyle = (index: number) => (theme: Theme) =>
export const buttonSpan = (theme: Theme) => css`
color: ${theme.color.black};
- ${theme.font["dialNumber-56"]}
+ ${theme.font["dialNumber-56"]};
`;
diff --git a/src/pages/orderCheck/components/OrderInfoSection/OrderInfoSection.style.ts b/src/pages/orderCheck/components/OrderInfoSection/OrderInfoSection.style.ts
index aa85a78..f914667 100644
--- a/src/pages/orderCheck/components/OrderInfoSection/OrderInfoSection.style.ts
+++ b/src/pages/orderCheck/components/OrderInfoSection/OrderInfoSection.style.ts
@@ -3,26 +3,31 @@ import { flexGenerator } from "@styles/generator";
export const section3Container = (theme: Theme) => css`
${flexGenerator("column", "start", "start")};
- width: 38rem;
- min-height: 100%;
+ width: 35%;
+ height: 100%;
+ overflow-y: auto;
background-color: ${theme.color.white};
`;
+
export const section3InfoWrapper = css`
${flexGenerator("column", "start", "start")};
- gap: 1rem;
+ gap: 0.8rem;
+ margin-bottom: 1rem;
`;
export const section3Div = css`
${flexGenerator("column", "start", "start")};
gap: 0.5rem;
`;
+
export const graySpan = (theme: Theme) => css`
color: ${theme.color.lightgray4};
- ${theme.font["head01-b-24"]}
+ ${theme.font["head02-b-20"]};
`;
+
export const blackSpan = (theme: Theme) => css`
color: ${theme.color.black};
- ${theme.font["orderCheck-32"]}
+ ${theme.font["head01-b-24"]};
`;
export const statusStyle = (statusStyle: string) => (theme: Theme) =>
@@ -38,6 +43,7 @@ export const statusStyle = (statusStyle: string) => (theme: Theme) =>
export const buttonWrapper = css`
${flexGenerator("row", "space-between", "center")};
+ gap: 1rem;
width: 100%;
margin-top: auto;
`;
diff --git a/src/pages/orderCheck/components/OrderInfoSection/OrderInfoSection.tsx b/src/pages/orderCheck/components/OrderInfoSection/OrderInfoSection.tsx
index 04ad392..94ba67b 100644
--- a/src/pages/orderCheck/components/OrderInfoSection/OrderInfoSection.tsx
+++ b/src/pages/orderCheck/components/OrderInfoSection/OrderInfoSection.tsx
@@ -36,6 +36,11 @@ const OrderInfoSection = () => {
[]
);
+ const productCount = (mergedOrders || []).reduce(
+ (acc, current) => acc + current.productCount,
+ 0
+ );
+
const { mutate: mutatePayComplete } = usePatchPayComplete();
const { mutate: mutatePayCancel } = usePatchPayCancel();
@@ -49,21 +54,27 @@ const OrderInfoSection = () => {
- 주문번호
- {previousOrderNumber}
+ 접수일시
+ {orderInfo?.orderList[0].orderTimeInfo}
-
주문상태
-
- {orderStatus}
-
+
주문번호 / 주문상태
+
+ {`${previousOrderNumber} / `}
+
+
+ {orderStatus}
+
+
이름
{orderInfo?.senderName}
- {`상품 (총 ${orderCount}개)`}
+ {`상품 (주문 ${orderCount}개 / 총 상품 ${productCount}개)`}
{(mergedOrders || []).map((order, i) => (
css`
`;
export const section2Container = css`
- ${flexGenerator("column")};
- width: 45rem;
+ ${flexGenerator("column", "flex-start")};
+ flex: 1;
height: 100%;
`;
export const orderNumberStyle = (theme: Theme) => css`
- ${flexGenerator()}
+ ${flexGenerator()};
width: 100%;
- height: 12.6rem;
- padding: 2rem 0;
+ height: 100%;
+ max-height: 12.6rem;
+ padding: 1rem 0;
border: 1px solid ${theme.color.lightgray3};
background-color: ${theme.color.white};
`;
export const orderNumberSpan = (theme: Theme) => css`
color: ${theme.color.black};
- ${theme.font["dialNumber-72"]}
+ ${theme.font["dialNumber-72"]};
`;
export const dialButtonWrapper = css`
width: 100%;
+ height: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(4, 1fr);
diff --git a/src/pages/orderCheck/components/PayButton/PayButton.style.ts b/src/pages/orderCheck/components/PayButton/PayButton.style.ts
index dbe3cae..eb798a2 100644
--- a/src/pages/orderCheck/components/PayButton/PayButton.style.ts
+++ b/src/pages/orderCheck/components/PayButton/PayButton.style.ts
@@ -3,12 +3,12 @@ import { flexGenerator } from "@styles/generator";
export const buttonStyle = (theme: Theme) => css`
${flexGenerator()};
- width: 18rem;
- height: 8.8rem;
+ width: 100%;
+ height: 7rem;
padding: 1rem;
border: 1px solid ${theme.color.black};
border-radius: 20px;
- ${theme.font["orderCheck-36"]}
+ ${theme.font["orderCheck-32"]};
`;
export const buttonVariant = {
diff --git a/src/pages/orderCheck/page/OrderCheckPage.style.ts b/src/pages/orderCheck/page/OrderCheckPage.style.ts
index 558d71d..4053265 100644
--- a/src/pages/orderCheck/page/OrderCheckPage.style.ts
+++ b/src/pages/orderCheck/page/OrderCheckPage.style.ts
@@ -2,11 +2,11 @@ import { css, Theme } from "@emotion/react";
import { flexGenerator } from "@styles/generator";
export const orderCheckLayout = (theme: Theme) => css`
- ${flexGenerator()};
+ ${flexGenerator("row", "space-between", "flex-start")};
position: absolute;
top: 0;
left: 0;
- padding: 9.3rem 6.1rem 6.7rem;
+ padding: 5rem;
gap: 3rem;
width: 100vw;
height: 100%;
@@ -15,7 +15,7 @@ export const orderCheckLayout = (theme: Theme) => css`
export const refreshButton = (theme: Theme) => css`
position: absolute;
- top: 50px;
+ top: 30px;
right: 50px;
${flexGenerator()};
width: 8rem;
diff --git a/src/styles/global.ts b/src/styles/global.ts
index d6bf1bf..0f9f7b2 100644
--- a/src/styles/global.ts
+++ b/src/styles/global.ts
@@ -33,6 +33,7 @@ const GlobalStyle = css`
a {
text-decoration: none;
+ color: inherit;
}
select {
diff --git a/src/types/orderInfoWithOrderNumber.ts b/src/types/orderInfoWithOrderNumber.ts
index 34a9325..b555735 100644
--- a/src/types/orderInfoWithOrderNumber.ts
+++ b/src/types/orderInfoWithOrderNumber.ts
@@ -3,6 +3,7 @@ export interface OrderInfo {
productCount: number;
deliveryStatus: string;
price: number;
+ orderTimeInfo: string;
}
export interface OrderInfoData {
diff --git a/src/types/orderType.ts b/src/types/orderType.ts
index f5ecb22..1247f4f 100644
--- a/src/types/orderType.ts
+++ b/src/types/orderType.ts
@@ -1,4 +1,5 @@
export interface Order {
+ orderId: number;
deliveryId: number;
orderNumber: number;
senderName: string;
@@ -13,9 +14,11 @@ export interface Order {
deliveryStatus: string;
orderReceivedDate: string; // 날짜를 문자열로 표현
deliveryDate: string; // 날짜를 문자열로 표현
+ note: string;
}
// 전체 데이터 구조를 위한 타입 정의
export interface OrderData {
- orderList: Order[];
+ nextCursor: number | null;
+ orders: Order[];
}
diff --git a/yarn.lock b/yarn.lock
index c707fbf..6ffabf0 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -780,6 +780,18 @@
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.56.2.tgz#2def2fb0290cd2836bbb08afb0c175595bb8109b"
integrity sha512-gor0RI3/R5rVV3gXfddh1MM+hgl0Z4G7tj6Xxpq6p2I03NGPaJ8dITY9Gz05zYYb/EJq9vPas/T4wn9EaDPd4Q==
+"@tanstack/query-devtools@5.62.16":
+ version "5.62.16"
+ resolved "https://registry.yarnpkg.com/@tanstack/query-devtools/-/query-devtools-5.62.16.tgz#a4b71c6b5bbf7575861437ef9a9f232333569255"
+ integrity sha512-3ff6UBJr0H3nIhfLSl9911rvKqXf0u4B58jl0uYdDWLqPk9pCvYIbxC35cGxK2+8INl4IaFVUHb/IdgWrNkg3Q==
+
+"@tanstack/react-query-devtools@^5.62.16":
+ version "5.62.16"
+ resolved "https://registry.yarnpkg.com/@tanstack/react-query-devtools/-/react-query-devtools-5.62.16.tgz#be7ef75a72002d6e0792359dd1b5b305faa34bff"
+ integrity sha512-EjF0tgHnWYcqhk8KxGKnmGlYcnldhWjW3bbH2WZqxo7t41ytzkIQtZ/UyLph//YMmZZE/RVTmSo3rGq/EG9iCA==
+ dependencies:
+ "@tanstack/query-devtools" "5.62.16"
+
"@tanstack/react-query@^5.56.2":
version "5.56.2"
resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.56.2.tgz#3a0241b9d010910905382f5e99160997b8795f91"
@@ -1987,6 +1999,11 @@ react-select@^5.8.1:
react-transition-group "^4.3.0"
use-isomorphic-layout-effect "^1.1.2"
+react-spinners@^0.15.0:
+ version "0.15.0"
+ resolved "https://registry.yarnpkg.com/react-spinners/-/react-spinners-0.15.0.tgz#bb9536a3839ab4e1513bb98847d79cc1fc930b93"
+ integrity sha512-ZO3/fNB9Qc+kgpG3SfdlMnvTX6LtLmTnOogb3W6sXIaU/kZ1ydEViPfZ06kSOaEsor58C/tzXw2wROGQu3X2pA==
+
react-switch@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/react-switch/-/react-switch-7.0.0.tgz#400990bb9822864938e343ed24f13276a617bdc0"