fix(mining-app): C2C接单验证收款信息 + 数字显示优化
- 接BUY单时验证收款账号和姓名必填,仅绿积分时自动使用账户ID - 所有C2C价格/数量/金额显示改用formatCompact,去掉多余小数位 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
17f8a61bcf
commit
7d548dac4e
|
|
@ -372,7 +372,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
|
|||
Text('单价', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${formatPrice(order.price)} 积分值',
|
||||
'${formatCompact(order.price)} 积分值',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -389,7 +389,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
|
|||
Text('数量', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${formatAmount(order.quantity)} 积分值',
|
||||
'${formatCompact(order.quantity)} 积分值',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -414,7 +414,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
|
|||
children: [
|
||||
Text('总金额', style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
|
||||
Text(
|
||||
'${formatAmount(order.totalAmount)} 积分值',
|
||||
'${formatCompact(order.totalAmount)} 积分值',
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -490,7 +490,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
|
|||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${formatAmount(order.quantity)} 积分值',
|
||||
'${formatCompact(order.quantity)} 积分值',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -499,7 +499,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
|
|||
),
|
||||
),
|
||||
Text(
|
||||
'${formatAmount(order.totalAmount)} 积分值',
|
||||
'${formatCompact(order.totalAmount)} 积分值',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -641,7 +641,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
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),
|
||||
|
|
@ -649,7 +649,7 @@ class _C2cMarketPageState extends ConsumerState<C2cMarketPage>
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
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(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
_takeOrder(
|
||||
order,
|
||||
quantity: quantityController.text.trim(),
|
||||
paymentMethod: isTakingBuyOrder ? selectedPaymentMethods.join(',') : null,
|
||||
paymentAccount: isTakingBuyOrder ? paymentAccountController.text.trim() : null,
|
||||
paymentRealName: isTakingBuyOrder ? paymentRealNameController.text.trim() : null,
|
||||
);
|
||||
if (isTakingBuyOrder) {
|
||||
final hasOtherMethods = selectedPaymentMethods.any((m) => m != 'GREEN_POINTS');
|
||||
String effectiveAccount;
|
||||
String effectiveRealName;
|
||||
|
||||
if (hasOtherMethods) {
|
||||
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(
|
||||
backgroundColor: _orange,
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
|
|||
children: [
|
||||
const Text('交易总额', style: TextStyle(fontSize: 14, color: _grayText)),
|
||||
Text(
|
||||
'${formatAmount(total.toString())} 积分值',
|
||||
'${formatCompact(total.toString())} 积分值',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -677,7 +677,7 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
|
|||
children: [
|
||||
const Text('积分值数量', style: TextStyle(fontSize: 14, color: _grayText)),
|
||||
Text(
|
||||
'${formatAmount(quantity.toString())} 积分值',
|
||||
'${formatCompact(quantity.toString())} 积分值',
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -847,7 +847,7 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
|
|||
Text('数量: $quantity 积分值'),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'总额: ${formatAmount((double.parse(price) * double.parse(quantity)).toString())} 积分值',
|
||||
'总额: ${formatCompact((double.parse(price) * double.parse(quantity)).toString())} 积分值',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
if (isSell) ...[
|
||||
|
|
|
|||
Loading…
Reference in New Issue