2026-01-01 14:43:43 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="global-add-bill">
|
|
|
|
|
|
<!-- Floating Add Bill Button -->
|
2026-01-27 15:29:25 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="floating-add"
|
|
|
|
|
|
@click="openAddBill"
|
|
|
|
|
|
>
|
2026-01-01 14:43:43 +08:00
|
|
|
|
<van-icon name="plus" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Add Bill Modal -->
|
2026-02-20 14:57:19 +08:00
|
|
|
|
<PopupContainerV2
|
|
|
|
|
|
v-model:show="showAddBill"
|
2026-01-27 15:29:25 +08:00
|
|
|
|
title="记一笔"
|
2026-02-20 14:57:19 +08:00
|
|
|
|
:height="'75%'"
|
2026-01-27 15:29:25 +08:00
|
|
|
|
>
|
2026-02-20 14:57:19 +08:00
|
|
|
|
<div style="padding: 0">
|
|
|
|
|
|
<van-tabs
|
|
|
|
|
|
v-model:active="activeTab"
|
|
|
|
|
|
shrink
|
2026-01-27 15:29:25 +08:00
|
|
|
|
>
|
2026-02-20 14:57:19 +08:00
|
|
|
|
<van-tab
|
|
|
|
|
|
title="一句话录账"
|
|
|
|
|
|
name="one"
|
|
|
|
|
|
>
|
|
|
|
|
|
<OneLineBillAdd
|
|
|
|
|
|
:key="componentKey"
|
|
|
|
|
|
@success="handleSuccess"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</van-tab>
|
|
|
|
|
|
<van-tab
|
|
|
|
|
|
title="手动录账"
|
|
|
|
|
|
name="manual"
|
|
|
|
|
|
>
|
|
|
|
|
|
<ManualBillAdd
|
|
|
|
|
|
:key="componentKey"
|
|
|
|
|
|
@success="handleSuccess"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</van-tab>
|
|
|
|
|
|
</van-tabs>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</PopupContainerV2>
|
2026-01-01 14:43:43 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref, defineEmits } from 'vue'
|
2026-02-21 10:10:16 +08:00
|
|
|
|
import PopupContainerV2 from '@/components/Common/PopupContainerV2.vue'
|
2026-01-01 14:43:43 +08:00
|
|
|
|
import OneLineBillAdd from '@/components/Bill/OneLineBillAdd.vue'
|
|
|
|
|
|
import ManualBillAdd from '@/components/Bill/ManualBillAdd.vue'
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['success'])
|
|
|
|
|
|
|
|
|
|
|
|
const showAddBill = ref(false)
|
|
|
|
|
|
const activeTab = ref('one')
|
2026-01-01 15:20:59 +08:00
|
|
|
|
const componentKey = ref(0)
|
2026-01-01 14:43:43 +08:00
|
|
|
|
|
|
|
|
|
|
const openAddBill = () => {
|
|
|
|
|
|
showAddBill.value = true
|
2026-01-01 15:20:59 +08:00
|
|
|
|
// 清理状态,默认选中一句话录账
|
|
|
|
|
|
activeTab.value = 'one'
|
|
|
|
|
|
|
|
|
|
|
|
// 清理子组件状态通过 key 强制重渲染
|
|
|
|
|
|
componentKey.value++
|
2026-01-01 14:43:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleSuccess = () => {
|
|
|
|
|
|
showAddBill.value = false
|
|
|
|
|
|
|
|
|
|
|
|
emit('success')
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.floating-add {
|
|
|
|
|
|
position: fixed;
|
2026-01-01 15:20:59 +08:00
|
|
|
|
bottom: 95px; /* Above tabbar */
|
2026-01-01 14:43:43 +08:00
|
|
|
|
right: 20px;
|
|
|
|
|
|
width: 50px;
|
|
|
|
|
|
height: 50px;
|
|
|
|
|
|
background-color: var(--van-primary-color);
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
|
|
|
|
z-index: 999;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: transform 0.2s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.floating-add:active {
|
|
|
|
|
|
transform: scale(0.9);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.van-tabs__wrap) {
|
|
|
|
|
|
position: sticky;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
z-index: 10;
|
2026-01-13 17:00:44 +08:00
|
|
|
|
background-color: var(--van-background-2);
|
2026-01-01 14:43:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|