feat(mining-app): P2P转出记录显示手续费及合计扣除

- P2pTransferModel 新增 fee 字段解析
- 转出卡片聚合显示:转账金额 + 手续费 + 合计扣除
- 转入卡片保持只显示转账金额

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-30 20:45:37 -08:00
parent 7180e2ac27
commit 7c416adecd
2 changed files with 84 additions and 15 deletions

View File

@ -5,6 +5,7 @@ class P2pTransferModel {
final String toAccountSequence;
final String toPhone;
final String amount;
final String fee;
final String? memo;
final String status;
final DateTime createdAt;
@ -15,6 +16,7 @@ class P2pTransferModel {
required this.toAccountSequence,
required this.toPhone,
required this.amount,
required this.fee,
this.memo,
required this.status,
required this.createdAt,
@ -27,6 +29,7 @@ class P2pTransferModel {
toAccountSequence: json['toAccountSequence'] ?? '',
toPhone: json['toPhone'] ?? '',
amount: json['amount']?.toString() ?? '0',
fee: json['fee']?.toString() ?? '0',
memo: json['memo'],
status: json['status'] ?? 'PENDING',
createdAt: json['createdAt'] != null

View File

@ -214,24 +214,84 @@ class P2pTransferRecordsPage extends ConsumerWidget {
const SizedBox(height: 12),
const Divider(height: 1),
const SizedBox(height: 12),
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'转账金额',
style: TextStyle(fontSize: 13, color: _grayText),
),
Text(
'${isSend ? '-' : '+'}${formatAmount(record.amount)} 积分值',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: isSend ? _orange : _green,
// + +
//
if (isSend) ...[
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'转账金额',
style: TextStyle(fontSize: 13, color: _grayText),
),
Text(
'-${formatAmount(record.amount)} 积分值',
style: const TextStyle(fontSize: 13, color: _darkText),
),
],
),
//
if (double.tryParse(record.fee) != null && double.parse(record.fee) > 0) ...[
const SizedBox(height: 6),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'手续费',
style: TextStyle(fontSize: 13, color: _grayText),
),
Text(
'-${formatAmount(record.fee)} 积分值',
style: const TextStyle(fontSize: 13, color: _darkText),
),
],
),
const SizedBox(height: 8),
const Divider(height: 1),
const SizedBox(height: 8),
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'合计扣除',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: _darkText),
),
Text(
'-${formatAmount(_addAmounts(record.amount, record.fee))} 积分值',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: _orange,
),
),
],
),
] else ...[
//
// ()
],
),
] else ...[
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'转账金额',
style: TextStyle(fontSize: 13, color: _grayText),
),
Text(
'+${formatAmount(record.amount)} 积分值',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: _green,
),
),
],
),
],
const SizedBox(height: 8),
//
Row(
@ -298,6 +358,12 @@ class P2pTransferRecordsPage extends ConsumerWidget {
);
}
String _addAmounts(String a, String b) {
final va = double.tryParse(a) ?? 0;
final vb = double.tryParse(b) ?? 0;
return (va + vb).toStringAsFixed(8);
}
String _maskPhone(String phone) {
if (phone.length != 11) return phone;
return '${phone.substring(0, 3)}****${phone.substring(7)}';