fix(mining-app): C2C接单验证收款信息 + 数字显示优化

- 接BUY单时验证收款账号和姓名必填,仅绿积分时自动使用账户ID
- 所有C2C价格/数量/金额显示改用formatCompact,去掉多余小数位

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-30 14:31:08 -08:00
parent 17f8a61bcf
commit 7d548dac4e
2 changed files with 52 additions and 18 deletions

View File

@ -372,7 +372,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
Text('单价', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))), Text('单价', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
'${formatPrice(order.price)} 积分值', '${formatCompact(order.price)} 积分值',
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -389,7 +389,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
Text('数量', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))), Text('数量', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
'${formatAmount(order.quantity)} 积分值', '${formatCompact(order.quantity)} 积分值',
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -414,7 +414,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
children: [ children: [
Text('总金额', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))), Text('总金额', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
Text( Text(
'${formatAmount(order.totalAmount)} 积分值', '${formatCompact(order.totalAmount)} 积分值',
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -490,7 +490,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
'${formatAmount(order.quantity)} 积分值', '${formatCompact(order.quantity)} 积分值',
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -499,7 +499,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
), ),
), ),
Text( Text(
'${formatAmount(order.totalAmount)} 积分值', '${formatCompact(order.totalAmount)} 积分值',
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -641,7 +641,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('单价', style: TextStyle(fontSize: 13, color: AppColors.textSecondaryOf(context))), Text('单价', style: TextStyle(fontSize: 13, color: AppColors.textSecondaryOf(context))),
Text('${formatPrice(order.price)} 积分值', style: TextStyle(fontSize: 13, color: AppColors.textPrimaryOf(context))), Text('${formatCompact(order.price)} 积分值', style: TextStyle(fontSize: 13, color: AppColors.textPrimaryOf(context))),
], ],
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
@ -649,7 +649,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('可用数量', style: TextStyle(fontSize: 13, color: AppColors.textSecondaryOf(context))), Text('可用数量', style: TextStyle(fontSize: 13, color: AppColors.textSecondaryOf(context))),
Text('${formatAmount(order.quantity)} 积分值', style: TextStyle(fontSize: 13, color: AppColors.textPrimaryOf(context))), Text('${formatCompact(order.quantity)} 积分值', style: TextStyle(fontSize: 13, color: AppColors.textPrimaryOf(context))),
], ],
), ),
], ],
@ -855,14 +855,48 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
Expanded( Expanded(
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
Navigator.pop(context); if (isTakingBuyOrder) {
_takeOrder( final hasOtherMethods = selectedPaymentMethods.any((m) => m != 'GREEN_POINTS');
order, String effectiveAccount;
quantity: quantityController.text.trim(), String effectiveRealName;
paymentMethod: isTakingBuyOrder ? selectedPaymentMethods.join(',') : null,
paymentAccount: isTakingBuyOrder ? paymentAccountController.text.trim() : null, if (hasOtherMethods) {
paymentRealName: isTakingBuyOrder ? paymentRealNameController.text.trim() : null, effectiveAccount = paymentAccountController.text.trim();
); effectiveRealName = paymentRealNameController.text.trim();
if (effectiveAccount.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('请填写收款账号')),
);
return;
}
if (effectiveRealName.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('请填写收款人姓名')),
);
return;
}
} else {
// 绿使ID作为收款信息
final user = ref.read(userNotifierProvider);
effectiveAccount = user.accountSequence ?? '';
effectiveRealName = user.nickname ?? user.accountSequence ?? '';
}
Navigator.pop(context);
_takeOrder(
order,
quantity: quantityController.text.trim(),
paymentMethod: selectedPaymentMethods.join(','),
paymentAccount: effectiveAccount,
paymentRealName: effectiveRealName,
);
} else {
Navigator.pop(context);
_takeOrder(
order,
quantity: quantityController.text.trim(),
);
}
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: _orange, backgroundColor: _orange,

View File

@ -662,7 +662,7 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
children: [ children: [
const Text('交易总额', style: TextStyle(fontSize: 14, color: _grayText)), const Text('交易总额', style: TextStyle(fontSize: 14, color: _grayText)),
Text( Text(
'${formatAmount(total.toString())} 积分值', '${formatCompact(total.toString())} 积分值',
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -677,7 +677,7 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
children: [ children: [
const Text('积分值数量', style: TextStyle(fontSize: 14, color: _grayText)), const Text('积分值数量', style: TextStyle(fontSize: 14, color: _grayText)),
Text( Text(
'${formatAmount(quantity.toString())} 积分值', '${formatCompact(quantity.toString())} 积分值',
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -847,7 +847,7 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
Text('数量: $quantity 积分值'), Text('数量: $quantity 积分值'),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
'总额: ${formatAmount((double.parse(price) * double.parse(quantity)).toString())} 积分值', '总额: ${formatCompact((double.parse(price) * double.parse(quantity)).toString())} 积分值',
style: const TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(fontWeight: FontWeight.bold),
), ),
if (isSell) ...[ if (isSell) ...[