This commit is contained in:
oneao committed 2026-03-05 22:24:22 +08:00
1 parent 173eb2dd37
commit 26ff2381b7
17 files changed
+596 -305

No files matched your search

@@ -1,11 +1,11 @@
import type { DateMorePickerMode } from '@/components/common/ao/DateMorePicker'
import type { FinanceCategory } from '@/types/finance/category'
import { useFocusEffect, useRouter } from 'expo-router'
import React, { useCallback, useEffect, useState } from 'react'
import React, { useCallback, useState } from 'react'
import { Image, Text, TouchableOpacity, View } from 'react-native'
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context'
import { toast } from 'sonner-native'
import { ADateMorePicker, ADatePicker, ADrawer, AListItem, LucideIcon } from '@/components/common/ao'
import { ADateMorePicker, ADrawer, AListItem, LucideIcon } from '@/components/common/ao'
import { resolveDateRange } from '@/components/common/ao/DateMorePicker'
import { Fab, FabIcon } from '@/components/ui/fab'
import { AddIcon } from '@/components/ui/icon'
@@ -45,18 +45,32 @@ export default function Money() {
function fetchFinanceRecords() {
const resolveDate = resolveDateRange(dateMode, searchParams.startTime)
let searchType = 0
let searchType: number | null = 0
let searchId: number | null = 0
if (searchParams.category) {
if (searchParams.category.id === -1 || searchParams.category.id === -2) {
if (searchParams.category.id === 0) {
searchId = null
searchType = null
}
else if (searchParams.category.id === -1 || searchParams.category.id === -2) {
searchId = null
searchType = searchParams.category.type
}
else {
searchId = searchParams.category.id
searchType = null
}
}
else {
searchId = null
searchType = null
}
listFinanceRecordsApi({
start_time: resolveDate.startTime,
end_time: resolveDate.endTime,
category_id: searchParams.category ? searchParams.category.id : 0,
category_id: searchId,
category_type: searchType,
}).then((res) => {
if (res.isSuccess) {
@@ -92,7 +106,7 @@ export default function Money() {
function timeModeTip() {
if (dateMode === 'unlimited') {
return '全部'
return '全部时间'
}
else if (dateMode === 'range') {
return `${searchParams.startTime} - ${searchParams.endTime}`
@@ -135,21 +149,21 @@ export default function Money() {
>
<Text className="font-semibold text-lg">
{
searchParams.category ? searchParams.category.name : '分类'
searchParams.category ? searchParams.category.name : '全部分类'
}
</Text>
<LucideIcon icon="ChevronDown" size={16} color="#666" clickable={false} />
</TouchableOpacity>
</View>
<TouchableOpacity
{/* <TouchableOpacity
className="flex flex-row items-center gap-2"
onPress={() => {
setShowActionsMenu(true)
}}
>
<LucideIcon icon="Menu" size={24} clickable={false} />
</TouchableOpacity>
</TouchableOpacity> */}
</View>
<View
@@ -249,21 +263,6 @@ export default function Money() {
}))
}}
/>
{/* <ADatePicker
show={showDatePicker}
mode="month"
date={searchParams.record_time}
onConfirm={(val) => {
setSearchParams({
...searchParams,
record_time: val,
})
setShowDatePicker(false)
}}
onClose={() => {
setShowDatePicker(false)
}}
/> */}
<CategorySheet
open={showCategorySheet}
@@ -280,7 +279,7 @@ export default function Money() {
}))
}}
/>
{/*
<ADrawer
visible={showActionsMenu}
hideModal={() => {
@@ -328,7 +327,7 @@ export default function Money() {
</View>
</View>
</SafeAreaView>
</ADrawer>
</ADrawer> */}
</View>
)
}
+7 -20
View File
@@ -2,9 +2,10 @@ import { useRouter } from 'expo-router'
import { Image, Text, View } from 'react-native'
import { SafeAreaView } from 'react-native-safe-area-context'
import { AButton } from '@/components/common/ao'
import { useNavStore } from '@/store/navigation'
export default function Index() {
const router = useRouter()
const navStore = useNavStore()
return (
<SafeAreaView className="flex-1 bg-white">
@@ -24,28 +25,14 @@ export default function Index() {
记录生活,记录情绪
</Text>
{/* <AButton
<AButton
className="w-full"
onPress={() => ('/finance')}
onPress={() => {
navStore.navigateTo('finance/index')
}}
>
开始使用
</AButton> */}
<View className="flex flex-row gap-3 mt-4">
<AButton
className="flex-1"
onPress={() => ('/finance')}
>
创建空间
</AButton>
<AButton
className="flex-1"
variant="outline"
onPress={() => ('/finance')}
>
加入空间
</AButton>
</View>
</AButton>
</View>
</SafeAreaView>
)