revert(app): 回滚 C2C 页面的卖出限制
C2C 卖出的是积分值,不是积分股,不受预种卖出限制约束。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ee734fb7b9
commit
4904337e97
|
|
@ -711,10 +711,9 @@ class _C2cPublishPageState extends ConsumerState<C2cPublishPage> {
|
|||
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<C2cPublishPage> {
|
|||
|
||||
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<C2cPublishPage> {
|
|||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue