This commit is contained in:
sion
2026-04-07 01:05:05 +08:00
parent edad10ff06
commit 5ca1274607
83 changed files with 1561 additions and 1241 deletions

View File

@@ -14,7 +14,7 @@ class _FundOrderCard extends StatelessWidget {
Color _getStatusColor(int status, bool isDeposit) {
if (isDeposit) {
// 充值状态: 1=待付款, 2=待确认, 3=已完成, 4=已回, 5=已取消
// 充值狀態: 1=待付款, 2=待確認, 3=已完成, 4=已回, 5=已取消
switch (status) {
case 1:
return AppColorScheme.warning;
@@ -30,7 +30,7 @@ class _FundOrderCard extends StatelessWidget {
return AppColorScheme.muted;
}
} else {
// 提现状态: 1=待批, 2=已出款, 3=已回, 4=已取消, 5=待财务审
// 提現狀態: 1=待批, 2=已出款, 3=已回, 4=已取消, 5=待財務審
switch (status) {
case 1:
return AppColorScheme.warning;
@@ -54,11 +54,11 @@ class _FundOrderCard extends StatelessWidget {
case 1:
return '待付款';
case 2:
return '确认';
return '確認';
case 3:
return '已完成';
case 4:
return '';
return '';
case 5:
return '已取消';
default:
@@ -67,15 +67,15 @@ class _FundOrderCard extends StatelessWidget {
} else {
switch (status) {
case 1:
return '';
return '';
case 2:
return '已出款';
case 3:
return '';
return '';
case 4:
return '已取消';
case 5:
return '财务审';
return '財務審';
default:
return '未知';
}
@@ -121,7 +121,7 @@ class _FundOrderCard extends StatelessWidget {
if (order.fee != null) ...[
Row(
children: [
Text('续费(10%): ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('續費(10%): ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('-${order.fee} USDT', style: AppTextStyles.bodyMedium(context)),
],
),
@@ -130,7 +130,7 @@ class _FundOrderCard extends StatelessWidget {
if (order.receivableAmount != null) ...[
Row(
children: [
Text('账金额: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('賬金額: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('${order.receivableAmount} USDT', style: AppTextStyles.bodyMedium(context).copyWith(fontWeight: FontWeight.w700)),
],
),
@@ -139,7 +139,7 @@ class _FundOrderCard extends StatelessWidget {
if (order.network != null) ...[
Row(
children: [
Text('现网络: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('現網絡: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text(order.network!, style: AppTextStyles.bodyMedium(context)),
],
),
@@ -148,7 +148,7 @@ class _FundOrderCard extends StatelessWidget {
if (order.walletAddress != null) ...[
Row(
children: [
Text('地址: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('地址: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Expanded(
child: Text(
order.walletAddress!,
@@ -164,16 +164,16 @@ class _FundOrderCard extends StatelessWidget {
],
Row(
children: [
Text('订单号: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('訂單號: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text(order.orderNo, style: AppTextStyles.bodyMedium(context)),
],
),
SizedBox(height: AppSpacing.xs),
Row(
children: [
Text('创建时间: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('創建時間: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text(
order.createTime?.toString() ?? '',
order.createTime?.toString() ?? '',
style: AppTextStyles.bodyMedium(context),
),
],
@@ -182,7 +182,7 @@ class _FundOrderCard extends StatelessWidget {
SizedBox(height: AppSpacing.xs),
Row(
children: [
Text('回原因: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('回原因: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Expanded(
child: Text(
order.rejectReason!,
@@ -206,7 +206,7 @@ class _FundOrderCard extends StatelessWidget {
Expanded(
child: ShadButton.outline(
onPressed: () => _handleCancel(context),
child: const Text('取消订单'),
child: const Text('取消訂單'),
),
),
],
@@ -222,12 +222,12 @@ class _FundOrderCard extends StatelessWidget {
if (context.mounted) {
if (response.success) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('确认打款,等待')),
const SnackBar(content: Text('確認打款,等待')),
);
context.read<AssetProvider>().loadFundOrders();
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(response.message ?? '确认失败')),
SnackBar(content: Text(response.message ?? '確認失敗')),
);
}
}
@@ -238,12 +238,12 @@ class _FundOrderCard extends StatelessWidget {
if (context.mounted) {
if (response.success) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('订单已取消')),
const SnackBar(content: Text('訂單已取消')),
);
context.read<AssetProvider>().loadFundOrders();
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(response.message ?? '取消失')),
SnackBar(content: Text(response.message ?? '取消失')),
);
}
}

View File

@@ -22,7 +22,7 @@ class FundOrdersList extends StatelessWidget {
if (orders.isEmpty) {
return _EmptyState(
icon: LucideIcons.receipt,
message: '暂无订单记录',
message: '暫無訂單記錄',
);
}
@@ -43,7 +43,7 @@ class FundOrdersList extends StatelessWidget {
}
}
/// 空状态组
/// 空狀態組
class _EmptyState extends StatelessWidget {
final IconData icon;
final String message;
@@ -70,7 +70,7 @@ class _EmptyState extends StatelessWidget {
}
}
/// 充值订单卡片 - 公开类
/// 充值訂單卡片 - 公開類
class FundOrderCard extends StatelessWidget {
final OrderFund order;
@@ -78,12 +78,12 @@ class FundOrderCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
// 直接使用 _FundOrderCard 的实现
// 直接使用 _FundOrderCard 的實現
return _FundOrderCardContent(order: order);
}
}
/// 订单卡片
/// 訂單卡片
class _FundOrderCardContent extends StatelessWidget {
final OrderFund order;
@@ -127,11 +127,11 @@ class _FundOrderCardContent extends StatelessWidget {
case 1:
return '待付款';
case 2:
return '确认';
return '確認';
case 3:
return '已完成';
case 4:
return '';
return '';
case 5:
return '已取消';
default:
@@ -140,11 +140,11 @@ class _FundOrderCardContent extends StatelessWidget {
} else {
switch (status) {
case 1:
return '';
return '';
case 2:
return '已出款';
case 3:
return '';
return '';
case 4:
return '已取消';
default:
@@ -192,7 +192,7 @@ class _FundOrderCardContent extends StatelessWidget {
if (order.fee != null) ...[
Row(
children: [
Text('续费(10%): ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('續費(10%): ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('-${order.fee} USDT', style: AppTextStyles.bodyMedium(context)),
],
),
@@ -201,7 +201,7 @@ class _FundOrderCardContent extends StatelessWidget {
if (order.receivableAmount != null) ...[
Row(
children: [
Text('账金额: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('賬金額: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('${order.receivableAmount} USDT', style: AppTextStyles.bodyMedium(context).copyWith(fontWeight: FontWeight.w700)),
],
),
@@ -210,7 +210,7 @@ class _FundOrderCardContent extends StatelessWidget {
if (order.network != null) ...[
Row(
children: [
Text('现网络: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('現網絡: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text(order.network!, style: AppTextStyles.bodyMedium(context)),
],
),
@@ -219,7 +219,7 @@ class _FundOrderCardContent extends StatelessWidget {
if (order.walletAddress != null) ...[
Row(
children: [
Text('地址: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('地址: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Expanded(
child: Text(
order.walletAddress!,
@@ -234,16 +234,16 @@ class _FundOrderCardContent extends StatelessWidget {
],
Row(
children: [
Text('订单号: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('訂單號: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text(order.orderNo, style: AppTextStyles.bodyMedium(context)),
],
),
SizedBox(height: AppSpacing.xs),
Row(
children: [
Text('创建时间: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('創建時間: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text(
order.createTime?.toString() ?? '',
order.createTime?.toString() ?? '',
style: AppTextStyles.bodyMedium(context),
),
],

View File

@@ -13,7 +13,7 @@ import '../../../core/event/app_event_bus.dart';
import '../../../providers/asset_provider.dart';
import '../../../data/models/order_models.dart';
/// 充提订单页
/// 充提訂單頁
class FundOrdersPage extends StatefulWidget {
const FundOrdersPage({super.key});
@@ -22,7 +22,7 @@ class FundOrdersPage extends StatefulWidget {
}
class _FundOrdersPageState extends State<FundOrdersPage> {
int _activeTab = 0; // 0=全部, 1=充值, 2=提
int _activeTab = 0; // 0=全部, 1=充值, 2=提
StreamSubscription<AppEvent>? _eventSub;
@override
@@ -53,7 +53,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
}
// ============================================
// 建 UI
// 建 UI
// ============================================
@override
@@ -65,7 +65,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
icon: const Icon(LucideIcons.arrowLeft, size: 20),
onPressed: () => Navigator.of(context).pop(),
),
title: Text('充提记录', style: AppTextStyles.headlineLarge(context).copyWith(color: context.colors.onSurface)),
title: Text('充提記錄', style: AppTextStyles.headlineLarge(context).copyWith(color: context.colors.onSurface)),
backgroundColor: context.colors.surface,
elevation: 0,
scrolledUnderElevation: 0,
@@ -97,7 +97,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
children: [
_buildPillTab('全部', 0),
_buildPillTab('充值', 1),
_buildPillTab('', 2),
_buildPillTab('', 2),
],
),
),
@@ -153,7 +153,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
children: [
Icon(LucideIcons.inbox, size: 64, color: context.appColors.onSurfaceMuted),
const SizedBox(height: AppSpacing.md),
Text('暂无订单记录', style: AppTextStyles.headlineMedium(context).copyWith(color: context.colors.onSurfaceVariant)),
Text('暫無訂單記錄', style: AppTextStyles.headlineMedium(context).copyWith(color: context.colors.onSurfaceVariant)),
],
),
);
@@ -199,7 +199,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
],
if (order.withdrawContact != null) ...[
const SizedBox(height: AppSpacing.sm - AppSpacing.xs),
_buildDetailRow('联系方式', order.withdrawContact!),
_buildDetailRow('聯繫方式', order.withdrawContact!),
],
if (order.receivableAmount != null && !order.isDeposit) ...[
const SizedBox(height: AppSpacing.sm),
@@ -214,13 +214,13 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'建: ${_formatTime(order.createTime)}',
'建: ${_formatTime(order.createTime)}',
style: AppTextStyles.bodySmall(context).copyWith(color: context.appColors.onSurfaceMuted),
),
if (order.rejectReason != null)
Expanded(
child: Text(
'回: ${order.rejectReason}',
'回: ${order.rejectReason}',
style: AppTextStyles.bodySmall(context).copyWith(color: context.appColors.down),
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
@@ -241,7 +241,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
order.isDeposit ? '充值' : '',
order.isDeposit ? '充值' : '',
style: AppTextStyles.headlineMedium(context).copyWith(color: context.colors.onSurface),
),
_buildStatusBadge(order),
@@ -261,7 +261,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
if (order.isDeposit) {
switch (order.status) {
case 1: // 待付款
case 2: // 待确认
case 2: // 待確認
bgColor = AppColorScheme.warning.withValues(alpha: 0.12);
textColor = AppColorScheme.warning;
break;
@@ -269,14 +269,14 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
bgColor = upBg;
textColor = upColor;
break;
default: // 已回/已取消
default: // 已回/已取消
bgColor = downBg;
textColor = downColor;
}
} else {
switch (order.status) {
case 1: // 待
case 5: // 待财务审
case 1: // 待
case 5: // 待財務審
bgColor = AppColorScheme.warning.withValues(alpha: 0.12);
textColor = AppColorScheme.warning;
break;
@@ -284,7 +284,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
bgColor = upBg;
textColor = upColor;
break;
default: // 已回/已取消
default: // 已回/已取消
bgColor = downBg;
textColor = downColor;
}
@@ -320,10 +320,10 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
Widget _buildDetailRows(OrderFund order) {
return Column(
children: [
_buildDetailRow('订单号', order.orderNo),
_buildDetailRow('訂單號', order.orderNo),
const SizedBox(height: AppSpacing.sm - AppSpacing.xs),
if (order.network != null) ...[
_buildDetailRow('网络', order.network!),
_buildDetailRow('網絡', order.network!),
const SizedBox(height: AppSpacing.sm - AppSpacing.xs),
],
if (order.walletAddress != null) ...[
@@ -333,7 +333,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
trailing: GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: order.walletAddress!));
ToastUtils.show('地址已复制');
ToastUtils.show('地址已複製');
},
child: Icon(LucideIcons.copy, size: 14, color: context.appColors.onSurfaceMuted),
),
@@ -341,11 +341,11 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
const SizedBox(height: AppSpacing.sm - AppSpacing.xs),
],
if (order.fee != null && !order.isDeposit) ...[
_buildDetailRow('续费', '${order.fee}%'),
_buildDetailRow('續費', '${order.fee}%'),
const SizedBox(height: AppSpacing.sm - AppSpacing.xs),
],
_buildDetailRow(
'时间',
'時間',
_formatTime(order.createTime),
),
],
@@ -383,7 +383,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
// ---------------------------------------------------------------------------
Widget _buildRejectionReason(OrderFund order) {
return Text(
'原因: ${order.rejectReason}',
'原因: ${order.rejectReason}',
style: AppTextStyles.bodyMedium(context).copyWith(color: context.appColors.down),
);
}
@@ -401,7 +401,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('付金', style: AppTextStyles.headlineSmall(context).copyWith(color: context.colors.onSurfaceVariant)),
Text('付金', style: AppTextStyles.headlineSmall(context).copyWith(color: context.colors.onSurfaceVariant)),
Text('${order.receivableAmount} USDT', style: AppTextStyles.headlineMedium(context).copyWith(color: context.colors.onSurface)),
],
),
@@ -427,7 +427,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
borderRadius: AppRadius.radiusSm,
border: Border.all(color: downColor, width: 1),
),
child: Text('取消订单', style: AppTextStyles.headlineSmall(context).copyWith(color: downColor)),
child: Text('取消訂單', style: AppTextStyles.headlineSmall(context).copyWith(color: downColor)),
),
),
if (order.canCancel && order.canConfirmPay)
@@ -467,14 +467,14 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
void _confirmPay(OrderFund order) async {
final confirmed = await showShadConfirmDialog(
context: context,
title: '确认已打款',
description: '确认您已完成向指定地址的转账',
title: '確認已打款',
description: '確認您已完成向指定地址的轉賬',
);
if (confirmed == true && mounted) {
final response = await context.read<AssetProvider>().confirmPay(order.orderNo);
if (mounted) {
BotToast.showText(text: response.success ? '确认成功,等待' : response.message ?? '确认失败');
BotToast.showText(text: response.success ? '確認成功,等待' : response.message ?? '確認失敗');
}
}
}
@@ -482,15 +482,15 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
void _cancelOrder(OrderFund order) async {
final confirmed = await showShadConfirmDialog(
context: context,
title: '取消订单',
description: '定要取消订单 ${order.orderNo} ',
title: '取消訂單',
description: '定要取消訂單 ${order.orderNo} ',
destructive: true,
);
if (confirmed == true && mounted) {
final response = await context.read<AssetProvider>().cancelOrder(order.orderNo);
if (mounted) {
BotToast.showText(text: response.success ? '订单已取消' : response.message ?? '取消失');
BotToast.showText(text: response.success ? '訂單已取消' : response.message ?? '取消失');
}
}
}
@@ -512,7 +512,7 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
onPressed: () => Navigator.pop(context, false),
),
TextButton(
child: Text(destructive ? '定取消' : '确认'),
child: Text(destructive ? '定取消' : '確認'),
onPressed: () => Navigator.pop(context, true),
),
],

View File

@@ -8,7 +8,7 @@ import '../../../core/theme/app_theme_extension.dart';
import '../../../providers/asset_provider.dart';
import 'fund_orders_list.dart';
/// 订单管理
/// 訂單管理
class OrdersPage extends StatefulWidget {
const OrdersPage({super.key});
@@ -50,7 +50,7 @@ class _OrdersPageState extends State<OrdersPage> with AutomaticKeepAliveClientMi
child: Column(
children: [
TabSelector(
tabs: const ['订单记录', '交易记录'],
tabs: const ['訂單記錄', '交易記錄'],
selectedIndex: _activeTab,
onChanged: (index) => setState(() => _activeTab = index),
),
@@ -68,7 +68,7 @@ class _OrdersPageState extends State<OrdersPage> with AutomaticKeepAliveClientMi
}
}
/// Tab 选择
/// Tab 選擇
class TabSelector extends StatelessWidget {
final List<String> tabs;
final int selectedIndex;
@@ -129,7 +129,7 @@ class TabSelector extends StatelessWidget {
}
}
/// 交易订单列表
/// 交易訂單列表
class TradeOrdersList extends StatelessWidget {
final AssetProvider provider;
@@ -147,7 +147,7 @@ class TradeOrdersList extends StatelessWidget {
children: [
Icon(LucideIcons.receipt, size: 48, color: theme.colorScheme.mutedForeground),
SizedBox(height: AppSpacing.sm + AppSpacing.xs),
Text('暂无交易记录', style: theme.textTheme.muted),
Text('暫無交易記錄', style: theme.textTheme.muted),
],
),
),