diff --git a/src/components/ui/AccountPicker.vue b/src/components/ui/AccountPicker.vue
new file mode 100644
index 0000000..5b0575f
--- /dev/null
+++ b/src/components/ui/AccountPicker.vue
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ emptyText }}
+
+
+
+
diff --git a/src/views/account/AccountView.vue b/src/views/account/AccountView.vue
index 055a1e3..b03122d 100644
--- a/src/views/account/AccountView.vue
+++ b/src/views/account/AccountView.vue
@@ -8,6 +8,7 @@ import { appLock } from '@/composables/appLock'
import IconBtn from '@/components/ui/IconBtn.vue'
import CategoryPicker from '@/components/ui/CategoryPicker.vue'
import SheetSelect from '@/components/ui/SheetSelect.vue'
+import AccountPicker from '@/components/ui/AccountPicker.vue'
import BottomSheet from '@/components/ui/BottomSheet.vue'
import { imageToBlob, parseReceiptText } from '@/utils/receiptOcr'
import { cardNotif } from '@/native/cardNotif'
@@ -1047,7 +1048,7 @@ onMounted(async () => {
/>
-
+
@@ -1238,9 +1239,9 @@ onMounted(async () => {
대상(대출/카드)
-
wallets.value.filter((w) => w.type === form.walletKind))
-const toWalletsOfKind = computed(() => wallets.value.filter((w) => w.type === form.toWalletKind))
const fromWalletKinds = computed(() =>
WALLET_KINDS.filter((k) => k.value !== 'CARD' || form.type === 'EXPENSE'),
)
const toWalletKinds = computed(() => WALLET_KINDS.filter((k) => k.value !== 'CARD'))
-function walletOpts(list) {
- return list.map((w) => ({ value: w.id, label: `${w.name}${w.issuer ? ` (${w.issuer})` : ''}` }))
-}
-const fromWalletOptions = computed(() => walletOpts(walletsOfKind.value))
-const toWalletOptions = computed(() => walletOpts(toWalletsOfKind.value))
-function walletKindOf(id) {
- const w = wallets.value.find((x) => x.id === id)
- return w ? w.type : ''
-}
-function onWalletKindChange() {
- form.walletId = ''
-}
-function onToWalletKindChange() {
- form.toWalletId = ''
-}
+// 구분에 따라 선택 가능한 출금/입금 계좌 목록(계좌 종류로 필터)
+const fromWallets = computed(() =>
+ wallets.value.filter((w) => fromWalletKinds.value.some((k) => k.value === w.type)),
+)
+const toWallets = computed(() =>
+ wallets.value.filter((w) => toWalletKinds.value.some((k) => k.value === w.type)),
+)
function onTypeChange() {
form.category = ''
- if (!fromWalletKinds.value.some((k) => k.value === form.walletKind)) {
- form.walletKind = ''
- form.walletId = ''
- }
+ // 선택된 출금 계좌가 새 구분에서 허용되지 않으면 해제
+ const fw = wallets.value.find((w) => w.id === form.walletId)
+ if (fw && !fromWalletKinds.value.some((k) => k.value === fw.type)) form.walletId = ''
}
function todayStr() {
@@ -118,9 +107,7 @@ async function load() {
amount: r.amount,
category: r.category || '',
memo: r.memo || '',
- walletKind: walletKindOf(r.walletId),
walletId: r.walletId || '',
- toWalletKind: walletKindOf(r.toWalletId),
toWalletId: r.toWalletId || '',
frequency: r.frequency,
dayOfMonth: r.dayOfMonth || 1,
@@ -220,42 +207,24 @@ async function submit() {
-
+
{{ form.type === 'TRANSFER' ? '출금 계좌' : '계좌/카드' }}
-
-
-
-
-
+
입금 계좌
-
-
-
-