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,34 +725,12 @@ 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: [
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, width: double.infinity,
height: 50, height: 50,
child: ElevatedButton( child: ElevatedButton(
onPressed: isValid && !c2cState.isLoading onPressed: isValid && !c2cState.isLoading
? _handlePublish ? _handlePublish
: isSellRestricted
? () => ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('预种积分股暂时不可卖出,请先完成预种合并'), backgroundColor: _red),
)
: !c2cEnabled : !c2cEnabled
? () => ScaffoldMessenger.of(context).showSnackBar( ? () => ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('您的C2C交易功能已被限制'), backgroundColor: _red), const SnackBar(content: Text('您的C2C交易功能已被限制'), backgroundColor: _red),
@ -786,8 +763,6 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
), ),
), ),
), ),
],
),
); );
} }