下载账单、优化账单查询

This commit is contained in:
2025-09-28 22:45:30 +08:00
parent 8a3e41cef6
commit 883491f466
7 changed files with 180 additions and 57 deletions

View File

@@ -2,41 +2,71 @@ import React, { useState, useEffect } from "react";
import { View, Text } from "@tarojs/components";
import "./index.scss";
import httpService from "@/services/httpService";
import Taro from "@tarojs/taro";
interface BillRecord {
id: number;
file_name: string;
download_url: string;
file_size: number;
create_time: string;
expire_time: string;
bill_date_range_start: string;
bill_date_range_end: string;
bill_transaction_type: string;
bill_transaction_sub_type: string;
date_range_desc: string;
transaction_type_desc: string;
transaction_sub_type_desc: string;
}
const DownloadBillRecords: React.FC = () => {
const [records, setRecords] = useState<BillRecord[]>([]);
const [params, setParams] = useState({
page: 1,
limit: 20,
});
useEffect(() => {
fetchRecords();
}, []);
const fetchRecords = async () => {
try {
const response = await httpService.post<{ rows: BillRecord[] }>('/wallet/download_history', params);
setRecords(response.data.rows);
} catch (error) {
console.log(error);
Taro.showToast({
title: '获取账单记录失败',
icon: 'none',
duration: 2000,
});
}
};
return (
<View className="download-bill-records-page">
<View className="records-container">
<View className="record-item">
<View className="title-text"></View>
<View className="info-item">
<Text></Text>
<Text>2025912 19:03:06</Text>
</View>
<View className="info-item">
<Text></Text>
<Text>2025912 19:03:06 2025912 19:03:06</Text>
</View>
<View className="info-item">
<Text></Text>
<Text className="btn"></Text>
</View>
</View>
<View className="record-item">
<View className="title-text"></View>
<View className="info-item">
<Text></Text>
<Text>2025912 19:03:06</Text>
</View>
<View className="info-item">
<Text></Text>
<Text>2025912 19:03:06 2025912 19:03:06</Text>
</View>
<View className="info-item">
<Text></Text>
<Text className="btn"></Text>
</View>
</View>
{
records.map((record) => (
<View className="record-item" key={record.id}>
<View className="title-text">{record.file_name}</View>
<View className="info-item">
<Text></Text>
<Text>{record.create_time}</Text>
</View>
<View className="info-item">
<Text></Text>
<Text>{record.date_range_desc}</Text>
</View>
<View className="info-item">
<Text></Text>
<Text className="btn"></Text>
</View>
</View>
))
}
</View>
<View className="tips">7</View>
</View>