feat(mobile): 流水明细中 REWARD_PENDING 标注"已转可结算"
用户购买预种后 hasPlanted=true,所有 PENDING 奖励转为 SETTLED, 此时流水中历史的 REWARD_PENDING 条目追加"(已转可结算)"标注, 避免用户误以为还有未领取的奖励。仅在 pendingUsdt=0 时显示。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d849ca7bc2
commit
b13d873f64
|
|
@ -1507,6 +1507,18 @@ class LedgerEntry {
|
||||||
return allocationTypeName ?? entryTypeName;
|
return allocationTypeName ?? entryTypeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [2026-03-01] 获取带状态标注的显示名称
|
||||||
|
/// 当用户已无待领取奖励时,REWARD_PENDING 流水追加"(已转可结算)"标注
|
||||||
|
String displayNameWithStatus({bool userHasNoPending = false}) {
|
||||||
|
final baseName = allocationTypeName ?? entryTypeName;
|
||||||
|
|
||||||
|
if (entryType == 'REWARD_PENDING' && userHasNoPending) {
|
||||||
|
return '$baseName (已转可结算)';
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseName;
|
||||||
|
}
|
||||||
|
|
||||||
/// 是否为收入
|
/// 是否为收入
|
||||||
bool get isIncome => amount > 0;
|
bool get isIncome => amount > 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
|
||||||
int _currentPage = 1;
|
int _currentPage = 1;
|
||||||
static const int _pageSize = 20;
|
static const int _pageSize = 20;
|
||||||
|
|
||||||
|
// [2026-03-01] 用户是否已无待领取奖励(用于标注 REWARD_PENDING 流水)
|
||||||
|
bool _userHasNoPending = false;
|
||||||
|
|
||||||
// 流水类型选项
|
// 流水类型选项
|
||||||
final List<Map<String, String>> _entryTypes = [
|
final List<Map<String, String>> _entryTypes = [
|
||||||
{'value': '', 'label': '全部'},
|
{'value': '', 'label': '全部'},
|
||||||
|
|
@ -76,7 +79,7 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
|
||||||
try {
|
try {
|
||||||
final walletService = ref.read(walletServiceProvider);
|
final walletService = ref.read(walletServiceProvider);
|
||||||
|
|
||||||
// 并行加载统计和趋势
|
// 并行加载统计、趋势和钱包信息
|
||||||
final results = await Future.wait([
|
final results = await Future.wait([
|
||||||
walletService.getLedgerStatistics(),
|
walletService.getLedgerStatistics(),
|
||||||
walletService.getLedgerTrend(days: 30),
|
walletService.getLedgerTrend(days: 30),
|
||||||
|
|
@ -85,10 +88,12 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
|
||||||
pageSize: _pageSize,
|
pageSize: _pageSize,
|
||||||
entryType: _selectedEntryType,
|
entryType: _selectedEntryType,
|
||||||
),
|
),
|
||||||
|
walletService.getMyWallet(), // [2026-03-01] 获取 pendingUsdt 判断是否还有待领取
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
final ledgerData = results[2] as PaginatedLedger;
|
final ledgerData = results[2] as PaginatedLedger;
|
||||||
|
final walletInfo = results[3] as WalletResponse;
|
||||||
|
|
||||||
// 调试:打印加载的流水数据
|
// 调试:打印加载的流水数据
|
||||||
debugPrint('[LedgerDetailPage] ======== 加载流水数据 ========');
|
debugPrint('[LedgerDetailPage] ======== 加载流水数据 ========');
|
||||||
|
|
@ -103,6 +108,7 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
|
||||||
_statistics = results[0] as LedgerStatistics;
|
_statistics = results[0] as LedgerStatistics;
|
||||||
_trend = results[1] as LedgerTrend;
|
_trend = results[1] as LedgerTrend;
|
||||||
_ledger = ledgerData;
|
_ledger = ledgerData;
|
||||||
|
_userHasNoPending = walletInfo.rewards.pendingUsdt <= 0;
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -989,7 +995,7 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
entry.displayName,
|
entry.displayNameWithStatus(userHasNoPending: _userHasNoPending),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue