feat(ui): 계좌/분류 선택을 바텀시트로 (정기결제 폼)
Deploy / deploy (push) Failing after 13m8s

- BottomSheet.vue: 아래에서 올라오는 콘텐츠 높이 시트(재사용)
- SheetSelect.vue: 필드형 트리거 → 바텀시트 단일 선택(계좌/카드)
- 정기결제 폼: 계좌는 SheetSelect, 분류는 트리거 → 시트 안 CategoryPicker
  (선택 전에는 목록 미노출, 선택 시 값 채움)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
sb
2026-07-09 22:53:23 +09:00
parent ed607e1cda
commit d20d3c3027
3 changed files with 260 additions and 6 deletions
+54 -6
View File
@@ -1,10 +1,11 @@
<script setup>
import { computed, onMounted, reactive, ref } from 'vue'
import { computed, onMounted, reactive, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { accountApi } from '@/api/accountApi'
import IconBtn from '@/components/ui/IconBtn.vue'
import CategoryPicker from '@/components/ui/CategoryPicker.vue'
import ChipSelect from '@/components/ui/ChipSelect.vue'
import SheetSelect from '@/components/ui/SheetSelect.vue'
import BottomSheet from '@/components/ui/BottomSheet.vue'
const route = useRoute()
const router = useRouter()
@@ -16,6 +17,7 @@ const categories = ref([])
const loading = ref(false)
const submitting = ref(false)
const formError = ref(null)
const catSheet = ref(false)
const form = reactive({
title: '',
@@ -35,6 +37,8 @@ const form = reactive({
endDate: '',
active: true,
})
// 분류가 최종 선택(비어있지 않은 값)되면 시트 닫기
watch(() => form.category, (v) => { if (v) catSheet.value = false })
const TYPES = [
{ value: 'EXPENSE', label: '지출', cls: 'chip-expense' },
@@ -227,11 +231,12 @@ async function submit() {
@click="form.walletKind = k.value; onWalletKindChange()"
>{{ k.label }}</button>
</div>
<ChipSelect
<SheetSelect
v-if="form.walletKind"
v-model="form.walletId"
:options="fromWalletOptions"
:disabled="submitting"
title="계좌 선택" placeholder="계좌를 선택하세요"
empty-text="등록된 계좌가 없습니다"
/>
</div>
@@ -247,18 +252,28 @@ async function submit() {
@click="form.toWalletKind = k.value; onToWalletKindChange()"
>{{ k.label }}</button>
</div>
<ChipSelect
<SheetSelect
v-if="form.toWalletKind"
v-model="form.toWalletId"
:options="toWalletOptions"
:disabled="submitting"
title="입금 계좌 선택" placeholder="계좌를 선택하세요"
empty-text="등록된 계좌가 없습니다"
/>
</div>
<!-- 분류 CategoryPicker (이체 제외) -->
<!-- 분류 트리거 바텀시트(CategoryPicker) (이체 제외) -->
<div v-if="form.type !== 'TRANSFER'" class="field">
<span class="field-label">분류</span>
<button
type="button" class="sheet-trigger" :class="{ empty: !form.category }"
:disabled="submitting" @click="catSheet = true"
>
<span class="st-label">{{ form.category || '분류를 선택하세요' }}</span>
<span class="st-caret"></span>
</button>
</div>
<BottomSheet v-model="catSheet" title="분류 선택">
<CategoryPicker
v-model="form.category"
:type="form.type"
@@ -266,7 +281,7 @@ async function submit() {
:disabled="submitting"
@category-added="loadCategories()"
/>
</div>
</BottomSheet>
<label>메모<input v-model="form.memo" type="text" placeholder="(선택)" :disabled="submitting" /></label>
@@ -405,4 +420,37 @@ async function submit() {
gap: 0.5rem;
margin-top: 0.5rem;
}
/* 분류 시트 트리거(필드형) */
.sheet-trigger {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
width: 100%;
padding: 0.55rem 0.75rem;
border: 1px solid var(--color-border);
border-radius: 6px;
background: var(--color-background-soft);
color: var(--color-text);
font-size: 0.9rem;
cursor: pointer;
text-align: left;
}
.sheet-trigger:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.sheet-trigger.empty .st-label {
opacity: 0.5;
}
.st-label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.st-caret {
opacity: 0.5;
font-size: 0.8rem;
flex-shrink: 0;
}
</style>