下载账单页面

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]}

View File

@@ -75,6 +75,7 @@ const NutUICalendar = React.forwardRef<CalendarUIRef, NutUICalendarProps>(({
}))
const handleDateChange = (newValue: any) => {
console.log('xxxxxxxxxxxxxxxxxxxxxx', newValue)
setSelectedValue(newValue)
onChange?.(newValue as any)
}
@@ -144,20 +145,20 @@ const NutUICalendar = React.forwardRef<CalendarUIRef, NutUICalendarProps>(({
syncMonthTo(dayList[0])
onChange?.(dayList)
}
const handleMonthChange = (value: any) => {
const [year, month] = value;
const newDate = new Date(year, month - 1, 1);
setCurrent(newDate);
calendarRef.current?.jumpTo(year, month)
}
return (
<View>
{/* 快速操作行 */}
{
showQuickActions &&
showQuickActions &&
<View className={styles['quick-actions']}>
<View className={styles['quick-action']} onClick={selectWeekend}></View>
<View className={styles['quick-action']} onClick={selectWeek}></View>
@@ -187,7 +188,7 @@ const NutUICalendar = React.forwardRef<CalendarUIRef, NutUICalendarProps>(({
</Text>
))}
</View>
{/* NutUI CalendarCard 组件 */}
<CalendarCard
ref={calendarRef}
@@ -198,14 +199,14 @@ const NutUICalendar = React.forwardRef<CalendarUIRef, NutUICalendarProps>(({
onPageChange={handlePageChange}
/>
</View>
{ visible && <PopupPicker
visible={visible}
setvisible={setvisible}
value={[current.getFullYear(), current.getMonth() + 1]}
{ visible && <PopupPicker
visible={visible}
setvisible={setvisible}
value={[current.getFullYear(), current.getMonth() + 1]}
type="month"
onChange={(value) => handleMonthChange(value)}/> }
</View>
)
})
export default NutUICalendar
export default NutUICalendar