refactor: 我的页去除重复的会员中心入口 + 会员中心删除合作门店

- 我的页用户卡片已跳转会员中心,删除列表中的重复入口
- 会员中心页移除合作门店(门店筛选/列表/请求),保留会员卡/最近优惠/广告激励

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-31 16:34:34 +08:00
co-authored by Claude Opus 4.7
parent cdfd8cff59
commit 01d8c72366
2 changed files with 1 additions and 135 deletions
+1 -127
View File
@@ -5,58 +5,13 @@ import 'package:fluttertoast/fluttertoast.dart';
import 'package:go_router/go_router.dart';
import '../../core/ads/ads_service.dart';
import '../../core/auth/auth_provider.dart';
import '../../core/config/app_config.dart';
import '../../features/cps/cps_provider.dart';
import '../../shared/widgets/error_view.dart';
import '../../shared/widgets/loading_view.dart';
import 'member_provider.dart';
import 'pay_page.dart';
class PartnerStoreInfo {
final int id;
final String name;
final int type; // 1 造型/发型店,2 服装店
final String address;
final String commissionPolicy;
const PartnerStoreInfo({
required this.id,
required this.name,
required this.type,
required this.address,
required this.commissionPolicy,
});
}
class StoreNotifier extends AsyncNotifier<List<PartnerStoreInfo>> {
@override
Future<List<PartnerStoreInfo>> build() async {
final api = ref.read(apiClientProvider);
final list = await api.get<List<dynamic>>('/partner-store/list');
return list
.map((e) => PartnerStoreInfo(
id: (e['id'] as num).toInt(),
name: e['name'] as String? ?? '',
type: (e['type'] as num?)?.toInt() ?? 1,
address: e['address'] as String? ?? '',
commissionPolicy: e['commission_policy'] as String? ?? '',
))
.toList();
}
Future<void> refresh() async {
state = const AsyncLoading();
state = await AsyncValue.guard(build);
}
}
final storeProvider =
AsyncNotifierProvider<StoreNotifier, List<PartnerStoreInfo>>(StoreNotifier.new);
const _storeTypeLabels = {1: '造型', 2: '服装'};
/// 会员中心:会员状态/套餐充值/广告激励 + 合作门店(P0;最近优惠 P1)
/// 会员中心:会员状态/套餐充值/广告激励 + 最近优惠
class MemberCenterPage extends ConsumerStatefulWidget {
const MemberCenterPage({super.key});
@@ -65,7 +20,6 @@ class MemberCenterPage extends ConsumerStatefulWidget {
}
class _MemberCenterPageState extends ConsumerState<MemberCenterPage> {
int? _typeFilter;
bool _rewarding = false;
// web 上无 Platformdart:io 不可用),且 web 端默认走系统浏览器收银台
@@ -120,8 +74,6 @@ class _MemberCenterPageState extends ConsumerState<MemberCenterPage> {
@override
Widget build(BuildContext context) {
final member = ref.watch(memberProvider);
final stores = ref.watch(storeProvider);
final scheme = Theme.of(context).colorScheme;
return Scaffold(
appBar: AppBar(title: const Text('会员中心')),
body: ListView(
@@ -141,84 +93,6 @@ class _MemberCenterPageState extends ConsumerState<MemberCenterPage> {
onClaim: (adType, msg) => _claimReward(adType, msg),
),
],
const SizedBox(height: 16),
Row(
children: [
Text('合作门店',
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
const Spacer(),
ChoiceChip(
label: const Text('全部'),
selected: _typeFilter == null,
onSelected: (_) => setState(() => _typeFilter = null),
),
const SizedBox(width: 8),
for (final entry in _storeTypeLabels.entries) ...[
ChoiceChip(
label: Text(entry.value),
selected: _typeFilter == entry.key,
onSelected: (_) => setState(() => _typeFilter = entry.key),
),
const SizedBox(width: 8),
],
],
),
const SizedBox(height: 8),
stores.when(
loading: () => const Padding(
padding: EdgeInsets.only(top: 32),
child: LoadingView(text: '加载门店...')),
error: (e, _) => Padding(
padding: const EdgeInsets.only(top: 32),
child: ErrorView(
message: e.toString().replaceFirst('Exception: ', ''),
onRetry: () => ref.read(storeProvider.notifier).refresh(),
),
),
data: (list) {
final shown = _typeFilter == null
? list
: list.where((s) => s.type == _typeFilter).toList();
if (shown.isEmpty) {
return const Padding(
padding: EdgeInsets.only(top: 32),
child: Center(
child: Text('附近暂无可合作门店',
style: TextStyle(color: Colors.grey))),
);
}
return Column(
children: [
for (final s in shown) ...[
Card(
child: ListTile(
leading: CircleAvatar(
backgroundColor: scheme.primaryContainer,
child: Icon(
s.type == 1 ? Icons.content_cut : Icons.checkroom),
),
title: Text(s.name),
subtitle: Text('${s.address}\n${s.commissionPolicy}'),
isThreeLine: true,
trailing: member.value?.isVip == true
? const Chip(
label: Text('会员价'),
labelStyle: TextStyle(
color: Colors.white, fontSize: 10),
backgroundColor: Colors.amber,
visualDensity: VisualDensity.compact,
padding: EdgeInsets.zero,
)
: const Icon(Icons.chevron_right,
color: Colors.grey),
),
),
const SizedBox(height: 8),
],
],
);
},
),
],
),
);
-8
View File
@@ -64,14 +64,6 @@ class MinePage extends ConsumerWidget {
trailing: const Icon(Icons.chevron_right, color: Colors.grey),
onTap: () => context.push('/wardrobe'),
),
const Divider(height: 1, indent: 56),
ListTile(
leading: const Icon(Icons.workspace_premium),
title: const Text('会员中心'),
subtitle: const Text('会员权益 · 套餐充值 · 合作门店 · 最近优惠'),
trailing: const Icon(Icons.chevron_right, color: Colors.grey),
onTap: () => context.push('/commercial'),
),
],
),
),