u
This commit is contained in:
1 parent
1934225c53
commit
e51f4948d4
10 files changed
+89
-66
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { MoneyRecordGroup, MoneyRecordItem } from '@/types/money/record'
|
||||
import type { MoneyRecord, MoneyRecordGroup } from '@/types/money/record'
|
||||
import React, { useCallback, useState } from 'react'
|
||||
import { RefreshControl, SectionList, Text, TouchableHighlight, Vibration, View } from 'react-native'
|
||||
import {
|
||||
@@ -11,11 +11,13 @@ import {
|
||||
import { LucideIcon } from '@/components/common/ao'
|
||||
import EmptyState from '@/components/common/EmptyStatus'
|
||||
import MoneyCategoryIcon from '@/components/common/MoneyCategoryIcon'
|
||||
import { useMoneyCategoryStore } from '@/store/moneyCategory'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { MoneyCategoryEnum } from '@/types/money/category'
|
||||
|
||||
interface StaticTransactionsProps {
|
||||
records: MoneyRecordGroup[]
|
||||
onUpdate?: (data: MoneyRecordItem) => void
|
||||
onUpdate?: (data: MoneyRecord) => void
|
||||
onDelete?: (id: number) => void
|
||||
onDetail?: (id: number) => void
|
||||
onRefreshData?: () => void
|
||||
@@ -30,6 +32,7 @@ export default function StaticTransactions({
|
||||
onLoadMore,
|
||||
onRefreshData,
|
||||
}: StaticTransactionsProps) {
|
||||
const moneyCategoryStore = useMoneyCategoryStore()
|
||||
const userID = useUserStore().userInfo?.id
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [loadingMore, setLoadingMore] = useState(false)
|
||||
@@ -119,6 +122,7 @@ export default function StaticTransactions({
|
||||
)}
|
||||
|
||||
renderItem={({ item }) => {
|
||||
const category = moneyCategoryStore.getCategoryById(item.category_id)
|
||||
return (
|
||||
<Menu
|
||||
renderer={renderers.Popover}
|
||||
@@ -146,12 +150,12 @@ export default function StaticTransactions({
|
||||
}}
|
||||
>
|
||||
<View className="relative w-10 h-10 rounded-full bg-gray-100 items-center justify-center">
|
||||
<MoneyCategoryIcon name={item.category_icon} size={24} color="#000" />
|
||||
<MoneyCategoryIcon name={category?.icon} size={24} color="#000" />
|
||||
</View>
|
||||
|
||||
<View className="flex-1">
|
||||
<Text className="text-gray-800 text-base">
|
||||
{item.remark ? item.remark : item.category_name}
|
||||
{item.remark ? item.remark : category?.name}
|
||||
</Text>
|
||||
{
|
||||
item.user_id !== userID && (
|
||||
@@ -166,7 +170,7 @@ export default function StaticTransactions({
|
||||
<Text
|
||||
className="text-sm text-gray-600 text-right"
|
||||
>
|
||||
{item.category_type === 1 ? '+' : '-'}
|
||||
{category?.type === MoneyCategoryEnum.Income ? '+' : '-'}
|
||||
{' '}
|
||||
{item.amount}
|
||||
</Text>
|
||||
|
||||
@@ -34,6 +34,7 @@ export default function Money() {
|
||||
record_time: searchParams.record_time,
|
||||
}).then((res) => {
|
||||
if (res.isSuccess) {
|
||||
console.log(res.data.records)
|
||||
moneyRecordStore.setRecords(res.data.records, searchParams.record_time)
|
||||
}
|
||||
else {
|
||||
@@ -62,7 +63,7 @@ export default function Money() {
|
||||
}
|
||||
}, []),
|
||||
)
|
||||
|
||||
|
||||
return (
|
||||
<View
|
||||
className="flex-1"
|
||||
|
||||
Reference in new issue
Block a user