From b1a07e7a87ca97362cbd1d83b81a32ef56ee976a Mon Sep 17 00:00:00 2001 From: chpark Date: Thu, 30 Apr 2026 21:54:32 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A7=A4=EC=9E=A5=20=EB=93=B1=EB=A1=9D?= =?UTF-8?q?=C2=B7=ED=91=9C=EC=8B=9C=20=EA=B8=88=EC=95=A1=20=EB=8B=A8?= =?UTF-8?q?=EC=9C=84=20=EB=A7=8C=EC=9B=90=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /stores/new 폼: 권리금/창업비용/월매출/월수익/보증금/월세 라벨을 "(원)" → "(만원)"으로 변경, placeholder도 만원 단위로 (예: 12000) - actions.ts: 입력값을 × 10000 변환 후 DB 저장 (DB는 원 단위 유지) - /stores/[id] 상세: formatKRW에서 원→억/만원 표시 (예: 1억 9500만원) - /stores 리스트: "만"/"억" 표기에 "원" 접미 추가 (예: 9900만원, 1.2억원) --- apps/web/src/app/stores/[id]/page.tsx | 10 +++++++++- apps/web/src/app/stores/new/actions.ts | 19 ++++++++++++------- apps/web/src/app/stores/new/page.tsx | 24 ++++++++++++------------ apps/web/src/app/stores/page.tsx | 4 ++-- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/apps/web/src/app/stores/[id]/page.tsx b/apps/web/src/app/stores/[id]/page.tsx index a9adece..3d33970 100644 --- a/apps/web/src/app/stores/[id]/page.tsx +++ b/apps/web/src/app/stores/[id]/page.tsx @@ -46,7 +46,15 @@ async function handleDeleteDraft(formData: FormData) { function formatKRW(value: number | null | undefined): string { if (value == null) return '-'; - return `${Number(value).toLocaleString('ko-KR')}원`; + // DB는 원 단위 → 표시는 만원/억 단위로 + const won = Number(value); + if (won === 0) return '0원'; + const eok = Math.floor(won / 100_000_000); + const man = Math.floor((won % 100_000_000) / 10_000); + if (eok > 0 && man > 0) return `${eok}억 ${man.toLocaleString('ko-KR')}만원`; + if (eok > 0) return `${eok}억원`; + if (man > 0) return `${man.toLocaleString('ko-KR')}만원`; + return `${won.toLocaleString('ko-KR')}원`; } function formatMargin(sales?: number | null, profit?: number | null): string { diff --git a/apps/web/src/app/stores/new/actions.ts b/apps/web/src/app/stores/new/actions.ts index 573f8b0..93aef8e 100644 --- a/apps/web/src/app/stores/new/actions.ts +++ b/apps/web/src/app/stores/new/actions.ts @@ -91,6 +91,11 @@ export async function createStoreDraftAction( locationHighlight || saleReason; + // 폼 입력은 만원 단위 → DB는 원 단위로 저장 (× 10000) + const MAN = 10000; + const toWon = (v: string | null) => (v ? Number(v) * MAN : undefined); + const toWonRequired = (v: string | null) => (v ? Number(v) * MAN : 0); + const input: CreateStoreDraftInput = { ownerUserId: session.user.dbId, listingTitle, @@ -100,9 +105,9 @@ export async function createStoreDraftAction( ...(depositAmount || monthlyRentAmount || premiumAmount || remainingLeaseMonths ? { lease: { - depositAmount: depositAmount ? Number(depositAmount) : 0, - monthlyRentAmount: monthlyRentAmount ? Number(monthlyRentAmount) : 0, - premiumAmount: premiumAmount ? Number(premiumAmount) : 0, + depositAmount: toWonRequired(depositAmount), + monthlyRentAmount: toWonRequired(monthlyRentAmount), + premiumAmount: toWonRequired(premiumAmount), remainingLeaseMonths: remainingLeaseMonths ? parseInt(remainingLeaseMonths, 10) : undefined, @@ -112,10 +117,10 @@ export async function createStoreDraftAction( ...(hasSale ? { sale: { - premiumAmount: premiumAmount ? Number(premiumAmount) : undefined, - monthlySalesAmount: monthlySalesAmount ? Number(monthlySalesAmount) : undefined, - monthlyProfitAmount: monthlyProfitAmount ? Number(monthlyProfitAmount) : undefined, - startupCostAmount: startupCostAmount ? Number(startupCostAmount) : undefined, + premiumAmount: toWon(premiumAmount), + monthlySalesAmount: toWon(monthlySalesAmount), + monthlyProfitAmount: toWon(monthlyProfitAmount), + startupCostAmount: toWon(startupCostAmount), listingDescription: listingDescription || undefined, locationHighlight: locationHighlight || undefined, saleReason: saleReason || undefined, diff --git a/apps/web/src/app/stores/new/page.tsx b/apps/web/src/app/stores/new/page.tsx index bb951ff..82ce451 100644 --- a/apps/web/src/app/stores/new/page.tsx +++ b/apps/web/src/app/stores/new/page.tsx @@ -124,21 +124,21 @@ export default function NewStorePage() {
- +
- + @@ -146,21 +146,21 @@ export default function NewStorePage() {
- +
- + @@ -205,21 +205,21 @@ export default function NewStorePage() {
- +
- + diff --git a/apps/web/src/app/stores/page.tsx b/apps/web/src/app/stores/page.tsx index 51c6afb..2f81c5d 100644 --- a/apps/web/src/app/stores/page.tsx +++ b/apps/web/src/app/stores/page.tsx @@ -10,11 +10,11 @@ function formatKRWShort(value: number | null | undefined): string { const v = Number(value); if (v >= 100_000_000) { const eok = v / 100_000_000; - return `${Number.isInteger(eok) ? eok : eok.toFixed(1)}억`; + return `${Number.isInteger(eok) ? eok : eok.toFixed(1)}억원`; } if (v >= 10_000) { const man = Math.round(v / 10_000); - return `${man.toLocaleString('ko-KR')}만`; + return `${man.toLocaleString('ko-KR')}만원`; } return `${v.toLocaleString('ko-KR')}원`; }