- Flutter 3.x 项目初始化(pubspec.yaml + 目录结构) - 核心依赖:dio/go_router/provider/shared_preferences/hive/geolocator - 统一登录页 + Token管理(TokenService + AuthInterceptor) - 底部Tab三合一导航(供水/巡检/营收) - 供水管理Tab:监测数据列表(MonitorListPage) - 巡检Tab:任务列表+状态筛选+进度展示(PatrolTaskListPage) - 营收Tab:抄表页面+账单列表(MeterReadingPage/BillListPage) - 消息推送服务(PushService) - GPS定位服务(LocationService) - 拍照/相册服务(CameraService) - 离线缓存服务(CacheService) - Android/iOS打包配置+权限声明 - GoRouter路由+Auth认证守卫 - Provider状态管理
65 lines
1.7 KiB
Dart
65 lines
1.7 KiB
Dart
/// 账单模型
|
|
class BillModel {
|
|
final String id;
|
|
final String billNo;
|
|
final String userName;
|
|
final String userAddress;
|
|
final String meterNo;
|
|
final double previousReading;
|
|
final double currentReading;
|
|
final double usage;
|
|
final double amount;
|
|
final String status; // unpaid, paid, overdue
|
|
final String period;
|
|
final DateTime dueDate;
|
|
|
|
BillModel({
|
|
required this.id,
|
|
required this.billNo,
|
|
required this.userName,
|
|
required this.userAddress,
|
|
required this.meterNo,
|
|
required this.previousReading,
|
|
required this.currentReading,
|
|
required this.usage,
|
|
required this.amount,
|
|
required this.status,
|
|
required this.period,
|
|
required this.dueDate,
|
|
});
|
|
|
|
factory BillModel.fromJson(Map<String, dynamic> json) {
|
|
return BillModel(
|
|
id: json['id']?.toString() ?? '',
|
|
billNo: json['billNo'] ?? '',
|
|
userName: json['userName'] ?? '',
|
|
userAddress: json['userAddress'] ?? '',
|
|
meterNo: json['meterNo'] ?? '',
|
|
previousReading: (json['previousReading'] ?? 0).toDouble(),
|
|
currentReading: (json['currentReading'] ?? 0).toDouble(),
|
|
usage: (json['usage'] ?? 0).toDouble(),
|
|
amount: (json['amount'] ?? 0).toDouble(),
|
|
status: json['status'] ?? 'unpaid',
|
|
period: json['period'] ?? '',
|
|
dueDate: DateTime.tryParse(json['dueDate'] ?? '') ?? DateTime.now(),
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'billNo': billNo,
|
|
'userName': userName,
|
|
'userAddress': userAddress,
|
|
'meterNo': meterNo,
|
|
'previousReading': previousReading,
|
|
'currentReading': currentReading,
|
|
'usage': usage,
|
|
'amount': amount,
|
|
'status': status,
|
|
'period': period,
|
|
'dueDate': dueDate.toIso8601String(),
|
|
};
|
|
}
|
|
}
|