revert(app): 回滚 C2C 页面的卖出限制

C2C 卖出的是积分值,不是积分股,不受预种卖出限制约束。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-04 05:57:24 -08:00
parent ee734fb7b9
commit 4904337e97
1 changed files with 13 additions and 38 deletions

View File

@ -711,10 +711,9 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
final isSell = _selectedType == 1; final isSell = _selectedType == 1;
final capabilities = ref.watch(capabilitiesProvider).valueOrNull ?? CapabilityMap.defaultAll(); final capabilities = ref.watch(capabilitiesProvider).valueOrNull ?? CapabilityMap.defaultAll();
final c2cEnabled = capabilities.c2cEnabled; final c2cEnabled = capabilities.c2cEnabled;
final isSellRestricted = isSell && (ref.watch(sellRestrictionProvider).valueOrNull ?? false);
// #11: 11 // #11: 11
bool isValid = c2cEnabled && !isSellRestricted && quantity >= 1; bool isValid = c2cEnabled && quantity >= 1;
if (isSell) { if (isSell) {
// //
if (_selectedPaymentMethods.any((m) => m != 'GREEN_POINTS')) { if (_selectedPaymentMethods.any((m) => m != 'GREEN_POINTS')) {
@ -726,39 +725,17 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column( child: SizedBox(
children: [ width: double.infinity,
if (isSellRestricted) height: 50,
Container( child: ElevatedButton(
width: double.infinity, onPressed: isValid && !c2cState.isLoading
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), ? _handlePublish
margin: const EdgeInsets.only(bottom: 8), : !c2cEnabled
decoration: BoxDecoration( ? () => ScaffoldMessenger.of(context).showSnackBar(
color: _red.withOpacity(0.08), const SnackBar(content: Text('您的C2C交易功能已被限制'), backgroundColor: _red),
borderRadius: BorderRadius.circular(8), )
border: Border.all(color: _red.withOpacity(0.3)), : null,
),
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,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: _selectedType == 0 ? _green : _red, backgroundColor: _selectedType == 0 ? _green : _red,
foregroundColor: Colors.white, foregroundColor: Colors.white,
@ -784,9 +761,7 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), ),
),
],
), ),
); );
} }