fix(ledger): REWARD_EXPIRED条目显示权益类型+已过期标签

- 奖励过期条目显示具体权益名(分享权益/省团队权益等)+ 红色"已过期"标签
- 图标改为灰色 timer_off,金额文字改为灰色,背景微灰
- 与正常权益收入条目有明显视觉区分

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-28 12:01:36 -08:00
parent 724fb08be4
commit 4bd40970d0
1 changed files with 56 additions and 18 deletions

View File

@ -940,21 +940,36 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
/// ///
Widget _buildLedgerItem(LedgerEntry entry) { Widget _buildLedgerItem(LedgerEntry entry) {
final isIncome = entry.isIncome; final isIncome = entry.isIncome;
final bool isExpiredReward = entry.entryType == 'REWARD_EXPIRED';
// //
final bool isPlantPayment = entry.entryType == 'PLANT_PAYMENT' && entry.refOrderId != null; final bool isPlantPayment = entry.entryType == 'PLANT_PAYMENT' && entry.refOrderId != null;
final bool isRewardEntry = entry.allocationType != null; final bool isRewardEntry = entry.allocationType != null && !isExpiredReward;
final bool isSettlementEntry = entry.entryType == 'REWARD_SETTLED'; final bool isSettlementEntry = entry.entryType == 'REWARD_SETTLED';
final bool isWithdrawalEntry = entry.entryType == 'WITHDRAWAL'; final bool isWithdrawalEntry = entry.entryType == 'WITHDRAWAL';
final bool isTransferEntry = entry.entryType == 'TRANSFER_IN' || entry.entryType == 'TRANSFER_OUT'; final bool isTransferEntry = entry.entryType == 'TRANSFER_IN' || entry.entryType == 'TRANSFER_OUT';
final bool isClickable = isPlantPayment || isRewardEntry || isSettlementEntry || isWithdrawalEntry || isTransferEntry; final bool isClickable = isPlantPayment || isRewardEntry || isSettlementEntry || isWithdrawalEntry || isTransferEntry;
// timer_off + "已过期"
final Color iconBgColor = isExpiredReward
? const Color(0x1A9E9E9E)
: (isIncome ? const Color(0x1A4CAF50) : const Color(0x1AE53935));
final Color iconColor = isExpiredReward
? const Color(0xFF9E9E9E)
: (isIncome ? const Color(0xFF4CAF50) : const Color(0xFFE53935));
final IconData iconData = isExpiredReward
? Icons.timer_off_outlined
: (isIncome ? Icons.arrow_downward : Icons.arrow_upward);
// "分享权益""奖励"
final String expiredTitle = entry.allocationTypeName ?? '奖励';
return GestureDetector( return GestureDetector(
onTap: isClickable ? () => _showEntryDetail(entry) : null, onTap: isClickable ? () => _showEntryDetail(entry) : null,
child: Container( child: Container(
margin: const EdgeInsets.only(bottom: 8), margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: isExpiredReward ? const Color(0xFFFAFAFA) : Colors.white,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
@ -971,16 +986,10 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
width: 40, width: 40,
height: 40, height: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isIncome color: iconBgColor,
? const Color(0x1A4CAF50)
: const Color(0x1AE53935),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: Icon( child: Icon(iconData, size: 20, color: iconColor),
isIncome ? Icons.arrow_downward : Icons.arrow_upward,
size: 20,
color: isIncome ? const Color(0xFF4CAF50) : const Color(0xFFE53935),
),
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
// //
@ -988,14 +997,41 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( if (isExpiredReward) ...[
entry.displayName, Row(
style: const TextStyle( children: [
fontSize: 14, Text(
fontWeight: FontWeight.w500, expiredTitle,
color: Color(0xFF5D4037), style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Color(0xFF9E9E9E),
),
),
const SizedBox(width: 6),
Container(
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1),
decoration: BoxDecoration(
color: const Color(0x1AE53935),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
'已过期',
style: TextStyle(fontSize: 10, color: Color(0xFFE53935)),
),
),
],
), ),
), ] else ...[
Text(
entry.displayName,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Color(0xFF5D4037),
),
),
],
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
_formatDate(entry.createdAt), _formatDate(entry.createdAt),
@ -1021,7 +1057,9 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: isIncome ? const Color(0xFF4CAF50) : const Color(0xFFE53935), color: isExpiredReward
? const Color(0xFF9E9E9E)
: (isIncome ? const Color(0xFF4CAF50) : const Color(0xFFE53935)),
), ),
), ),
), ),