下载账单页面

This commit is contained in:
2025-09-24 17:31:16 +08:00
parent 4183260d6b
commit dd1136d1e6
9 changed files with 314 additions and 20 deletions

View File

@@ -7,7 +7,8 @@ import dayjs from 'dayjs'
import styles from './index.module.scss'
export interface DialogCalendarCardProps {
value?: Date
onChange?: (date: Date) => void
searchType?: 'single' | 'range' | 'multiple'
onChange?: (date: Date | Date[]) => void
visible: boolean
onClose: () => void
title?: React.ReactNode
@@ -15,6 +16,7 @@ export interface DialogCalendarCardProps {
const DialogCalendarCard: React.FC<DialogCalendarCardProps> = ({
visible,
searchType,
onClose,
title,
value,
@@ -60,6 +62,14 @@ const DialogCalendarCard: React.FC<DialogCalendarCardProps> = ({
}
const handleChange = (d: Date | Date[]) => {
if (searchType === 'range') {
if (Array.isArray(d)) {
if (d.length === 2) {
onChange?.(d as Date[])
return
}
}
}
if (Array.isArray(d)) {
setSelected(d[0])
} else {
@@ -120,10 +130,11 @@ const DialogCalendarCard: React.FC<DialogCalendarCardProps> = ({
zIndex={1000}
>
{
type === 'year' &&
type === 'year' &&
<View className={styles['calendar-container']}>
<CalendarUI
ref={calendarRef}
type={searchType}
value={selected}
onChange={handleChange}
showQuickActions={false}
@@ -131,16 +142,16 @@ const DialogCalendarCard: React.FC<DialogCalendarCardProps> = ({
/></View>
}
{
type === 'month' && <PickerCommon
type === 'month' && <PickerCommon
ref={pickerRef}
onChange={handleDateTimePickerChange}
type="month"
value={[selected.getFullYear(), selected.getMonth() + 1]}
/>
}
{
type === 'time' && <PickerCommon
type === 'time' && <PickerCommon
ref={hourMinutePickerRef}
type="hour"
value={[selectedHour, selectedMinute]}