feat(mobile-app): KYC成功后自动跳转合同签署页面

从认种流程进入KYC时传递orderNo参数:
- 认种页面 -> KYC Entry -> KYC ID 传递 orderNo
- KYC成功后如果有orderNo则跳转合同签署
- 直接进入KYC(无orderNo)则正常返回

修改文件:
- app_router.dart: KYC路由支持orderNo参数
- kyc_entry_page.dart: 接收并传递orderNo
- kyc_id_page.dart: 成功后判断是否跳转合同签署
- planting_location_page.dart: 跳转KYC时传递orderNo

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-25 07:07:43 -08:00
parent 8163804f23
commit 6b72831cd9
4 changed files with 32 additions and 11 deletions

View File

@ -25,7 +25,10 @@ final kycStatusProvider = FutureProvider.autoDispose<KycStatusResponse>((ref) as
/// 2: ()
/// 3: KYC ()
class KycEntryPage extends ConsumerWidget {
const KycEntryPage({super.key});
/// KYC成功后需要跳转到合同签署
final String? orderNo;
const KycEntryPage({super.key, this.orderNo});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -257,7 +260,8 @@ class KycEntryPage extends ConsumerWidget {
//
_showPhoneVerificationRequiredDialog(context);
} else {
context.push(RoutePaths.kycId);
// orderNo KycIdPage
context.push(RoutePaths.kycId, extra: orderNo);
}
}
},

View File

@ -2,14 +2,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:go_router/go_router.dart';
import 'kyc_entry_page.dart';
import '../../../home/presentation/pages/home_shell_page.dart';
import '../../../../core/di/injection_container.dart';
import 'kyc_entry_page.dart' show kycStatusProvider, kycServiceProvider;
import '../../../../routes/route_paths.dart';
/// KYC 1: (: ++)
class KycIdPage extends ConsumerStatefulWidget {
const KycIdPage({super.key});
/// KYC成功后需要跳转到合同签署
final String? orderNo;
const KycIdPage({super.key, this.orderNo});
@override
ConsumerState<KycIdPage> createState() => _KycIdPageState();
@ -85,9 +86,16 @@ class _KycIdPageState extends ConsumerState<KycIdPage> {
behavior: SnackBarBehavior.floating,
),
);
//
//
ref.invalidate(kycStatusProvider);
context.pop(true);
// orderNo
if (widget.orderNo != null) {
context.go('${RoutePaths.contractSigning}/${widget.orderNo}');
} else {
//
context.pop(true);
}
} else {
setState(() {
_errorMessage = result.errorMessage ?? '验证失败,请检查信息是否正确';

View File

@ -287,7 +287,8 @@ class _PlantingLocationPageState extends ConsumerState<PlantingLocationPage> {
final goToKyc = await KycRequiredDialog.show(context: context);
if (goToKyc == true && mounted) {
context.push(RoutePaths.kycEntry);
// orderNoKYC
context.push(RoutePaths.kycEntry, extra: widget.orderNo);
return;
}
} else if (mounted) {

View File

@ -368,7 +368,11 @@ final appRouterProvider = Provider<GoRouter>((ref) {
GoRoute(
path: RoutePaths.kycEntry,
name: RouteNames.kycEntry,
builder: (context, state) => const KycEntryPage(),
builder: (context, state) {
// orderNo
final orderNo = state.extra as String?;
return KycEntryPage(orderNo: orderNo);
},
),
// KYC Phone Verification Page ()
@ -382,7 +386,11 @@ final appRouterProvider = Provider<GoRouter>((ref) {
GoRoute(
path: RoutePaths.kycId,
name: RouteNames.kycId,
builder: (context, state) => const KycIdPage(),
builder: (context, state) {
// orderNo
final orderNo = state.extra as String?;
return KycIdPage(orderNo: orderNo);
},
),
// KYC Face Verification Page (2: - )