diff --git a/frontend/mining-app/lib/presentation/pages/c2c/c2c_publish_page.dart b/frontend/mining-app/lib/presentation/pages/c2c/c2c_publish_page.dart index 2a64afce..deeff72d 100644 --- a/frontend/mining-app/lib/presentation/pages/c2c/c2c_publish_page.dart +++ b/frontend/mining-app/lib/presentation/pages/c2c/c2c_publish_page.dart @@ -711,10 +711,9 @@ class _C2cPublishPageState extends ConsumerState { final isSell = _selectedType == 1; final capabilities = ref.watch(capabilitiesProvider).valueOrNull ?? CapabilityMap.defaultAll(); final c2cEnabled = capabilities.c2cEnabled; - final isSellRestricted = isSell && (ref.watch(sellRestrictionProvider).valueOrNull ?? false); // #11: 价格固定为1,数量最小为1 - bool isValid = c2cEnabled && !isSellRestricted && quantity >= 1; + bool isValid = c2cEnabled && quantity >= 1; if (isSell) { // 如果选择了其他支付方式,还需要填写收款账号和姓名 if (_selectedPaymentMethods.any((m) => m != 'GREEN_POINTS')) { @@ -726,39 +725,17 @@ class _C2cPublishPageState extends ConsumerState { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16), - child: Column( - children: [ - if (isSellRestricted) - Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), - margin: const EdgeInsets.only(bottom: 8), - decoration: BoxDecoration( - color: _red.withOpacity(0.08), - borderRadius: BorderRadius.circular(8), - border: Border.all(color: _red.withOpacity(0.3)), - ), - child: const Text( - '预种积分股暂时不可卖出,请先完成预种合并(满5份合成1棵树后即可卖出)', - style: TextStyle(fontSize: 12, color: _red), - textAlign: TextAlign.center, - ), - ), - SizedBox( - width: double.infinity, - height: 50, - child: ElevatedButton( - onPressed: isValid && !c2cState.isLoading - ? _handlePublish - : isSellRestricted - ? () => ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text('预种积分股暂时不可卖出,请先完成预种合并'), backgroundColor: _red), - ) - : !c2cEnabled - ? () => ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text('您的C2C交易功能已被限制'), backgroundColor: _red), - ) - : null, + child: SizedBox( + width: double.infinity, + height: 50, + child: ElevatedButton( + onPressed: isValid && !c2cState.isLoading + ? _handlePublish + : !c2cEnabled + ? () => ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('您的C2C交易功能已被限制'), backgroundColor: _red), + ) + : null, style: ElevatedButton.styleFrom( backgroundColor: _selectedType == 0 ? _green : _red, foregroundColor: Colors.white, @@ -784,9 +761,7 @@ class _C2cPublishPageState extends ConsumerState { fontWeight: FontWeight.bold, ), ), - ), - ), - ], + ), ), ); }