| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- import 'package:flutter/material.dart';
-
- /// 营业收费 Tab
- class RevenueTab extends StatelessWidget {
- const RevenueTab({super.key});
-
- @override
- Widget build(BuildContext context) {
- final theme = Theme.of(context);
- final colorScheme = theme.colorScheme;
-
- return RefreshIndicator(
- onRefresh: () async {
- await Future.delayed(const Duration(seconds: 1));
- },
- child: ListView(
- padding: const EdgeInsets.all(16),
- children: [
- // ---------- 本月营收概览 ----------
- Card(
- elevation: 0,
- color: colorScheme.primaryContainer.withAlpha(80),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
- child: Padding(
- padding: const EdgeInsets.all(20),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('本月营收', style: TextStyle(fontSize: 14, color: colorScheme.onSurfaceVariant)),
- const SizedBox(height: 8),
- Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(
- '¥ 358,620',
- style: TextStyle(
- fontSize: 32,
- fontWeight: FontWeight.bold,
- color: colorScheme.primary,
- ),
- ),
- const SizedBox(width: 8),
- Padding(
- padding: const EdgeInsets.only(bottom: 6),
- child: Text(
- '较上月 ↑ 5.8%',
- style: TextStyle(fontSize: 13, color: Colors.green.shade700),
- ),
- ),
- ],
- ),
- const SizedBox(height: 16),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- _StatItem(label: '已收', value: '¥312,450', color: Colors.green),
- _StatItem(label: '待收', value: '¥46,170', color: Colors.orange),
- _StatItem(label: '欠费', value: '¥12,800', color: Colors.red),
- ],
- ),
- ],
- ),
- ),
- ),
- const SizedBox(height: 24),
-
- // ---------- 快捷操作 ----------
- Text('快捷操作', style: theme.textTheme.titleMedium),
- const SizedBox(height: 12),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- _RevenueAction(icon: Icons.receipt, label: '抄表录入', color: Colors.blue, onTap: () {}),
- _RevenueAction(icon: Icons.payment, label: '缴费记录', color: Colors.green, onTap: () {}),
- _RevenueAction(icon: Icons.notifications_active, label: '催缴通知', color: Colors.orange, onTap: () {}),
- _RevenueAction(icon: Icons.analytics, label: '营收报表', color: Colors.purple, onTap: () {}),
- ],
- ),
- const SizedBox(height: 24),
-
- // ---------- 近期账单 ----------
- Text('近期账单', style: theme.textTheme.titleMedium),
- const SizedBox(height: 12),
- _BillTile(
- customer: '张三',
- address: '阳光小区3-501',
- amount: '¥ 85.50',
- period: '2024-05',
- status: '已缴费',
- statusColor: Colors.green,
- ),
- _BillTile(
- customer: '李四',
- address: '翠湖花园2-302',
- amount: '¥ 120.00',
- period: '2024-05',
- status: '待缴费',
- statusColor: Colors.orange,
- ),
- _BillTile(
- customer: '王五',
- address: '东方名城8-101',
- amount: '¥ 65.20',
- period: '2024-05',
- status: '已缴费',
- statusColor: Colors.green,
- ),
- _BillTile(
- customer: '赵六',
- address: '锦绣家园5-601',
- amount: '¥ 98.80',
- period: '2024-05',
- status: '欠费',
- statusColor: Colors.red,
- ),
- ],
- ),
- );
- }
- }
-
- class _StatItem extends StatelessWidget {
- final String label;
- final String value;
- final Color color;
-
- const _StatItem({required this.label, required this.value, required this.color});
-
- @override
- Widget build(BuildContext context) {
- return Column(
- children: [
- Text(value, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: color)),
- const SizedBox(height: 4),
- Text(label, style: const TextStyle(fontSize: 12, color: Colors.grey)),
- ],
- );
- }
- }
-
- class _RevenueAction extends StatelessWidget {
- final IconData icon;
- final String label;
- final Color color;
- final VoidCallback onTap;
-
- const _RevenueAction({
- required this.icon,
- required this.label,
- required this.color,
- required this.onTap,
- });
-
- @override
- Widget build(BuildContext context) {
- return InkWell(
- onTap: onTap,
- borderRadius: BorderRadius.circular(12),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Container(
- width: 48,
- height: 48,
- decoration: BoxDecoration(
- color: color.withAlpha(30),
- borderRadius: BorderRadius.circular(12),
- ),
- child: Icon(icon, color: color, size: 24),
- ),
- const SizedBox(height: 6),
- Text(label, style: const TextStyle(fontSize: 12)),
- ],
- ),
- );
- }
- }
-
- class _BillTile extends StatelessWidget {
- final String customer;
- final String address;
- final String amount;
- final String period;
- final String status;
- final Color statusColor;
-
- const _BillTile({
- required this.customer,
- required this.address,
- required this.amount,
- required this.period,
- required this.status,
- required this.statusColor,
- });
-
- @override
- Widget build(BuildContext context) {
- return Card(
- margin: const EdgeInsets.only(bottom: 8),
- child: ListTile(
- leading: CircleAvatar(
- backgroundColor: Colors.blue.shade50,
- child: Text(customer[0], style: TextStyle(color: Colors.blue.shade700)),
- ),
- title: Text(customer),
- subtitle: Text('$address | $period'),
- trailing: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(amount, style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 15)),
- const SizedBox(height: 2),
- Text(status, style: TextStyle(fontSize: 12, color: statusColor)),
- ],
- ),
- ),
- );
- }
- }
|