From eb6c3a83736bcfcd21218e1c5b1aca161b78f260 Mon Sep 17 00:00:00 2001 From: chanwoo7 Date: Thu, 19 Nov 2026 08:59:35 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=EA=B2=B0=EC=A0=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=C2=B7=EC=A3=BC=EA=B0=84=20=EC=A0=95=EC=82=B0=C2=B7?= =?UTF-8?q?=EC=9B=94=20=EC=88=98=EC=88=98=EB=A3=8C=EC=99=80=20=EB=A7=A4?= =?UTF-8?q?=EC=9E=A5=20=EC=A0=95=EC=82=B0=20=EA=B3=84=EC=A2=8C=C2=B7?= =?UTF-8?q?=EC=A7=84=ED=96=89=20=EC=A3=BC=EB=AC=B8=20=EA=B2=BD=EA=B3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BE가 주간 정산·월 수수료·결제 설정·매장 정산 계좌 API를 냈는데 관리자 화면이 없어 송금 완료 처리와 수수료율·입금 계좌 관리를 할 수 없었다. 판매자 정지·매장 숨기기 때는 진행 주문이 자동 취소되지 않는다는 걸 알려야 하고, 판매자 정지는 매장 숨김을 함께 할 수 있어야 한다. - settlements feature 신설 - /settlements: 상태·매장·정산 주(고른 날짜의 월요일) 필터, 정산 계좌 미등록 표시 - /settlements/$settlementId: 금액·포함 주문·송금할 계좌(원문 + 복사), [송금 완료](확인 문구·메모, 409면 알리고 재조회), 계좌가 없으면 비활성 + 매장 링크, 감사 이력 링크 - /settlements/monthly: 월 입력·이전/다음 달, 합계 + 매장별 - /settings: 수수료율(퍼센트 소수 둘째 자리 ↔ bp를 문자열로 변환, 생성 시점 고정 안내), 케이퀵 입금 계좌(없으면 주문을 받을 수 없다는 경고), 변경은 모두 사유 필수 - 매장 정산 계좌 카드·다이얼로그(react-hook-form + zod, 하이픈을 뺀 숫자 8~20자리)를 매장 상세 개요에 둔다 - 진행 주문 경고: 숨기기·정지 다이얼로그를 열 때 adminStoreInProgressOrderSummary로 상태별 건수와 '진행 주문 보기'(/orders?storeId&inProgress=true). 막지 않고, 조회 실패는 안내만 - ReasonDialog에 본문 슬롯 - 판매자 정지: 경고와 '매장도 숨기기'(기본 켬). 정지 성공 뒤 같은 사유로 adminSetStoreActive(false), 숨김 실패는 토스트만 하고 정지는 유지. 이미 숨긴 매장이면 체크박스 없음 - AccountStatusActions에 suspendExtra·afterSuspend(구매자 정지는 그대로) - 감사 대상 링크: SETTLEMENT → 정산 상세, PAYMENT_SETTING → /settings, SETTLEMENT_ACCOUNT → 기록의 매장 상세(대상 ID가 계좌 행 번호라 화면이 없다) - 사이드바: 운영 '정산', 설정 '결제 설정'. codegen·routeTree 갱신 테스트: 수수료율 퍼센트 → bp 표(5.55 → 555, 5.555·100.01 거절 등)와 0~10000 bp 왕복 전수, 계좌 입력·정산 검색·월 이동·라벨 폴백 표, 계좌번호 복사 토스트. 화면은 정산 목록 필터·페이지·실패, 상세 송금 완료·미등록 비활성·409 재조회·그 밖 오류·빈 칸, 월 수수료, 결제 설정(검증·전송 값·서버 거절), 매장 정산 계좌 등록·조회 실패, 숨기기 경고(건수·0건 미표시·조회 실패·다시 노출은 조회 없음), 판매자 정지 매장 숨김(성공·실패 토스트·끔·이미 숨김), 감사 대상 링크 4건. 반증: bp 상한, 문자열 변환(부동소수점 곱셈), 미등록 가드, 0건 가드, 숨김 실패 catch, 기본 켬을 하나씩 되돌리면 각각 2·1·1·2·1·3건이 실패한다. --- src/app/router.spec.ts | 1 + src/app/shell/nav.spec.ts | 3 + src/app/shell/nav.ts | 8 +- .../components/account-status-actions.tsx | 19 +- src/features/accounts/pages/users.spec.tsx | 2 + .../audit-logs/components/audit-links.tsx | 35 +- .../audit-logs/pages/audit-logs-page.tsx | 6 +- .../audit-logs/pages/audit-logs.spec.tsx | 19 + .../components/seller-status-actions.tsx | 64 ++ .../sellers/pages/seller-detail-page.tsx | 11 +- src/features/sellers/pages/sellers.spec.tsx | 118 ++++ src/features/settlements/api/queries.ts | 311 ++++++++++ src/features/settlements/bank-account.spec.ts | 51 ++ src/features/settlements/bank-account.ts | 39 ++ .../settlements/commission-rate.spec.ts | 54 ++ src/features/settlements/commission-rate.ts | 22 + .../components/account-number.spec.tsx | 26 + .../settlements/components/account-number.tsx | 21 + .../components/bank-account-dialog.tsx | 173 ++++++ .../components/commission-rate-dialog.tsx | 135 ++++ .../components/mark-paid-dialog.tsx | 43 ++ .../store-settlement-account-card.tsx | 85 +++ src/features/settlements/index.ts | 6 + .../pages/monthly-commissions-page.tsx | 121 ++++ .../pages/payment-settings-page.tsx | 124 ++++ .../pages/settlement-detail-page.tsx | 229 +++++++ .../pages/settlements-list-page.tsx | 192 ++++++ .../settlements/pages/settlements.spec.tsx | 576 ++++++++++++++++++ src/features/settlements/search.spec.ts | 99 +++ src/features/settlements/search.ts | 61 ++ src/features/settlements/status.ts | 25 + src/features/stores/api/queries.ts | 25 + .../components/in-progress-orders-warning.tsx | 46 ++ .../stores/components/store-active-toggle.tsx | 5 +- src/features/stores/index.ts | 2 + .../stores/pages/store-detail-page.tsx | 2 + src/features/stores/pages/stores.spec.tsx | 161 ++++- src/graphql/generated/gql.ts | 66 ++ src/graphql/generated/graphql.ts | 309 ++++++++++ src/routeTree.gen.ts | 88 +++ src/routes/_authed/_shell/settings.tsx | 7 + .../_shell/settlements/$settlementId.tsx | 12 + .../_authed/_shell/settlements/index.tsx | 19 + .../_authed/_shell/settlements/monthly.tsx | 19 + src/shared/ui/reason-dialog.tsx | 4 + 45 files changed, 3427 insertions(+), 17 deletions(-) create mode 100644 src/features/sellers/components/seller-status-actions.tsx create mode 100644 src/features/settlements/api/queries.ts create mode 100644 src/features/settlements/bank-account.spec.ts create mode 100644 src/features/settlements/bank-account.ts create mode 100644 src/features/settlements/commission-rate.spec.ts create mode 100644 src/features/settlements/commission-rate.ts create mode 100644 src/features/settlements/components/account-number.spec.tsx create mode 100644 src/features/settlements/components/account-number.tsx create mode 100644 src/features/settlements/components/bank-account-dialog.tsx create mode 100644 src/features/settlements/components/commission-rate-dialog.tsx create mode 100644 src/features/settlements/components/mark-paid-dialog.tsx create mode 100644 src/features/settlements/components/store-settlement-account-card.tsx create mode 100644 src/features/settlements/index.ts create mode 100644 src/features/settlements/pages/monthly-commissions-page.tsx create mode 100644 src/features/settlements/pages/payment-settings-page.tsx create mode 100644 src/features/settlements/pages/settlement-detail-page.tsx create mode 100644 src/features/settlements/pages/settlements-list-page.tsx create mode 100644 src/features/settlements/pages/settlements.spec.tsx create mode 100644 src/features/settlements/search.spec.ts create mode 100644 src/features/settlements/search.ts create mode 100644 src/features/settlements/status.ts create mode 100644 src/features/stores/components/in-progress-orders-warning.tsx create mode 100644 src/routes/_authed/_shell/settings.tsx create mode 100644 src/routes/_authed/_shell/settlements/$settlementId.tsx create mode 100644 src/routes/_authed/_shell/settlements/index.tsx create mode 100644 src/routes/_authed/_shell/settlements/monthly.tsx diff --git a/src/app/router.spec.ts b/src/app/router.spec.ts index f67de30..9e0ac6e 100644 --- a/src/app/router.spec.ts +++ b/src/app/router.spec.ts @@ -55,6 +55,7 @@ describe('ID 검색 파라미터 정밀도', () => { '/_authed/_shell/reviews accountId', '/_authed/_shell/reviews reviewId', '/_authed/_shell/reviews storeId', + '/_authed/_shell/settlements/ storeId', '/_authed/_shell/stores/ regionId', ].sort(), ); diff --git a/src/app/shell/nav.spec.ts b/src/app/shell/nav.spec.ts index 025f380..0b527bb 100644 --- a/src/app/shell/nav.spec.ts +++ b/src/app/shell/nav.spec.ts @@ -11,6 +11,9 @@ describe('nav', () => { { path: '/notifications/send', want: '알림' }, { path: '/banners/5', want: '배너' }, { path: '/search-chips', want: '검색 칩' }, + { path: '/settlements/monthly', want: '정산' }, + { path: '/settlements/31', want: '정산' }, + { path: '/settings', want: '결제 설정' }, ])('하위 화면도 메뉴 제목을 따른다: $path → $want', ({ path, want }) => { expect(titleFor(path)).toBe(want); }); diff --git a/src/app/shell/nav.ts b/src/app/shell/nav.ts index e29e2de..319be97 100644 --- a/src/app/shell/nav.ts +++ b/src/app/shell/nav.ts @@ -11,12 +11,14 @@ import { MapPinIcon, ScrollTextIcon, SearchIcon, + SettingsIcon, ShieldIcon, MessageSquareIcon, MessagesSquareIcon, ShoppingBagIcon, StoreIcon, UsersIcon, + WalletIcon, } from 'lucide-react'; /** 사이드바 메뉴. 각 영역 PR이 자기 항목을 붙인다 — Link의 to가 라우트 타입으로 검사되므로 있는 경로만 둔다. */ @@ -24,6 +26,7 @@ interface NavItem { to: | '/' | '/orders' + | '/settlements' | '/users' | '/sellers' | '/stores' @@ -38,7 +41,8 @@ interface NavItem { | '/notifications' | '/regions' | '/audit-logs' - | '/admins'; + | '/admins' + | '/settings'; label: string; icon: LucideIcon; } @@ -53,6 +57,7 @@ export const NAV_GROUPS: NavGroup[] = [ label: '운영', items: [ { to: '/orders', label: '주문', icon: ShoppingBagIcon }, + { to: '/settlements', label: '정산', icon: WalletIcon }, { to: '/reports', label: '신고', icon: FlagIcon }, { to: '/reviews', label: '리뷰', icon: MessageSquareIcon }, { to: '/review-comments', label: '리뷰 댓글', icon: MessagesSquareIcon }, @@ -80,6 +85,7 @@ export const NAV_GROUPS: NavGroup[] = [ ], }, { label: '기록', items: [{ to: '/audit-logs', label: '감사 로그', icon: ScrollTextIcon }] }, + { label: '설정', items: [{ to: '/settings', label: '결제 설정', icon: SettingsIcon }] }, ]; export function titleFor(pathname: string): string { diff --git a/src/features/accounts/components/account-status-actions.tsx b/src/features/accounts/components/account-status-actions.tsx index 820f2cb..716c8f5 100644 --- a/src/features/accounts/components/account-status-actions.tsx +++ b/src/features/accounts/components/account-status-actions.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { type ReactNode, useState } from 'react'; import { toast } from 'sonner'; import { type AccountStatus } from '@/graphql/generated/graphql'; @@ -28,10 +28,21 @@ interface Props { label: string; /** 성공 뒤 호출자의 캐시 무효화 */ onChanged: () => Promise | void; + /** 정지 다이얼로그에 덧붙일 내용(판매자: 진행 주문 경고·매장도 숨기기) */ + suspendExtra?: ReactNode; + /** 정지 성공 뒤 이어서 할 일. 실패 안내는 스스로 하고 던지지 않는다 — 정지는 이미 됐다 */ + afterSuspend?: (reason: string) => Promise; } /** USER·SELLER 공용 정지/정지 해제. 정지는 사유 필수(감사 로그), 해제는 확인만. */ -export function AccountStatusActions({ accountId, status, label, onChanged }: Props) { +export function AccountStatusActions({ + accountId, + status, + label, + onChanged, + suspendExtra, + afterSuspend, +}: Props) { const [open, setOpen] = useState(false); const [reason, setReason] = useState(''); const [busy, setBusy] = useState(false); @@ -62,8 +73,9 @@ export function AccountStatusActions({ accountId, status, label, onChanged }: Pr setBusy(true); try { await suspendAccount(accountId, trimmed); - await onChanged(); toast.success(`${label} 계정을 정지했습니다.`); + await afterSuspend?.(trimmed); + await onChanged(); setOpen(false); setReason(''); } catch (e) { @@ -86,6 +98,7 @@ export function AccountStatusActions({ accountId, status, label, onChanged }: Pr 즉시 로그아웃되고 앱·판매자 센터를 이용할 수 없게 됩니다. 사유는 감사 로그에 남습니다. + {suspendExtra}