feat: 영수증 OCR 상호명→메모, 카드사 감지→카드 자동선택
CI / build (push) Failing after 15m1s

- 상호 추출 개선(GS25 등 숫자 포함 상호 허용, 날짜·전화·사업자·주소 제외)
- 카드 결제 영수증의 카드사 감지 → 등록된 카드(issuer/name 매칭) 자동 선택
- 매칭 실패해도 카드결제면 계좌종류를 카드로 좁혀줌
- 결과 표시에 💳카드명 추가

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-06-03 17:56:18 +09:00
parent 41d6f11531
commit 537cea31b0
2 changed files with 58 additions and 10 deletions
+22 -1
View File
@@ -100,7 +100,20 @@ async function runOcr(image) {
if (r.amount) form.amount = r.amount
if (r.date) form.entryDate = r.date
if (r.store && !form.memo) form.memo = r.store
ocrResult.value = { amount: r.amount, date: r.date, store: r.store }
// 카드 결제 영수증이면 등록된 카드 자동 선택 (카드사 매칭)
let cardName = null
if (form.type === 'EXPENSE') {
const card = r.cardIssuer ? matchCardWallet(r.cardIssuer) : null
if (card) {
form.walletKind = 'CARD'
form.walletId = card.id
cardName = card.name
} else if (r.isCard) {
form.walletKind = 'CARD' // 카드결제지만 매칭 실패 → 카드 목록만 좁혀줌
form.walletId = ''
}
}
ocrResult.value = { amount: r.amount, date: r.date, store: r.store, card: cardName }
if (!r.amount && !r.date) {
formError.value = '영수증에서 정보를 충분히 인식하지 못했습니다. 직접 입력하거나 더 선명한 사진으로 다시 시도하세요.'
}
@@ -134,6 +147,13 @@ function walletKindOf(id) {
const w = wallets.value.find((x) => x.id === id)
return w ? w.type : ''
}
// 영수증에서 감지한 카드사명으로 등록된 카드(CARD) 찾기
function matchCardWallet(issuer) {
if (!issuer) return null
return wallets.value.find(
(w) => w.type === 'CARD' && ((w.issuer || '').includes(issuer) || (w.name || '').includes(issuer)),
)
}
function onWalletKindChange() {
form.walletId = ''
}
@@ -546,6 +566,7 @@ onMounted(async () => {
<template v-if="ocrResult.amount">{{ won(ocrResult.amount) }}</template>
<template v-if="ocrResult.date"> · {{ ocrResult.date }}</template>
<template v-if="ocrResult.store"> · {{ ocrResult.store }}</template>
<template v-if="ocrResult.card"> · 💳{{ ocrResult.card }}</template>
자동 입력됨
</span>
<span v-else class="receipt-hint">사진에서 금액·날짜·상호를 자동 입력</span>