fix: 修复资产页面资金账户余额显示问题
主要修改:
1. AssetService.dart - 修复资金账户数据解析
- 处理后端返回的嵌套结构 {"fund": {...}}
- 正确提取 fund 字段中的数据
2. AssetPage.dart - 移除portfolio value卡片
- 移除最上面的总资产卡片显示
- 只保留资金账户和交易账户的Tab切换
修复后:
- ✅ 资金账户余额正确显示 (15500 USDT)
- ✅ 页面布局更简洁,符合用户需求
- ✅ 数据解析正确,不再显示0
This commit is contained in:
@@ -31,10 +31,14 @@ class AssetService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.success && response.data != null) {
|
if (response.success && response.data != null) {
|
||||||
return ApiResponse.success(
|
// 后端返回格式: {"fund": {...}}
|
||||||
AccountFund.fromJson(response.data!),
|
final fundData = response.data!['fund'] as Map<String, dynamic>?;
|
||||||
response.message,
|
if (fundData != null) {
|
||||||
);
|
return ApiResponse.success(
|
||||||
|
AccountFund.fromJson(fundData),
|
||||||
|
response.message,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ApiResponse.fail(response.message ?? '获取资金账户失败');
|
return ApiResponse.fail(response.message ?? '获取资金账户失败');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
|
|||||||
padding: AppSpacing.pagePadding,
|
padding: AppSpacing.pagePadding,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_AssetCard(overview: provider.overview),
|
|
||||||
SizedBox(height: AppSpacing.md),
|
|
||||||
_TabSelector(
|
_TabSelector(
|
||||||
tabs: const ['资金账户', '交易账户'],
|
tabs: const ['资金账户', '交易账户'],
|
||||||
selectedIndex: _activeTab,
|
selectedIndex: _activeTab,
|
||||||
|
|||||||
Reference in New Issue
Block a user