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:
parent
8163804f23
commit
6b72831cd9
|
|
@ -25,7 +25,10 @@ final kycStatusProvider = FutureProvider.autoDispose<KycStatusResponse>((ref) as
|
||||||
/// 层级2: 实人认证 (人脸活体检测)
|
/// 层级2: 实人认证 (人脸活体检测)
|
||||||
/// 层级3: KYC (证件照上传验证)
|
/// 层级3: KYC (证件照上传验证)
|
||||||
class KycEntryPage extends ConsumerWidget {
|
class KycEntryPage extends ConsumerWidget {
|
||||||
const KycEntryPage({super.key});
|
/// 从认种流程跳转时带的订单号,KYC成功后需要跳转到合同签署
|
||||||
|
final String? orderNo;
|
||||||
|
|
||||||
|
const KycEntryPage({super.key, this.orderNo});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
|
@ -257,7 +260,8 @@ class KycEntryPage extends ConsumerWidget {
|
||||||
// 手机号未验证,跳转到验证手机号页面
|
// 手机号未验证,跳转到验证手机号页面
|
||||||
_showPhoneVerificationRequiredDialog(context);
|
_showPhoneVerificationRequiredDialog(context);
|
||||||
} else {
|
} else {
|
||||||
context.push(RoutePaths.kycId);
|
// 传递 orderNo 到 KycIdPage
|
||||||
|
context.push(RoutePaths.kycId, extra: orderNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,15 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'kyc_entry_page.dart';
|
import 'kyc_entry_page.dart' show kycStatusProvider, kycServiceProvider;
|
||||||
import '../../../home/presentation/pages/home_shell_page.dart';
|
|
||||||
import '../../../../core/di/injection_container.dart';
|
|
||||||
import '../../../../routes/route_paths.dart';
|
import '../../../../routes/route_paths.dart';
|
||||||
|
|
||||||
/// KYC 层级1: 实名认证页面 (三要素验证: 姓名+身份证号+手机号)
|
/// KYC 层级1: 实名认证页面 (三要素验证: 姓名+身份证号+手机号)
|
||||||
class KycIdPage extends ConsumerStatefulWidget {
|
class KycIdPage extends ConsumerStatefulWidget {
|
||||||
const KycIdPage({super.key});
|
/// 从认种流程跳转时带的订单号,KYC成功后需要跳转到合同签署
|
||||||
|
final String? orderNo;
|
||||||
|
|
||||||
|
const KycIdPage({super.key, this.orderNo});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ConsumerState<KycIdPage> createState() => _KycIdPageState();
|
ConsumerState<KycIdPage> createState() => _KycIdPageState();
|
||||||
|
|
@ -85,9 +86,16 @@ class _KycIdPageState extends ConsumerState<KycIdPage> {
|
||||||
behavior: SnackBarBehavior.floating,
|
behavior: SnackBarBehavior.floating,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// 刷新状态并返回
|
// 刷新状态
|
||||||
ref.invalidate(kycStatusProvider);
|
ref.invalidate(kycStatusProvider);
|
||||||
context.pop(true);
|
|
||||||
|
// 如果有 orderNo,说明是从认种流程来的,跳转到合同签署页面
|
||||||
|
if (widget.orderNo != null) {
|
||||||
|
context.go('${RoutePaths.contractSigning}/${widget.orderNo}');
|
||||||
|
} else {
|
||||||
|
// 否则直接返回
|
||||||
|
context.pop(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_errorMessage = result.errorMessage ?? '验证失败,请检查信息是否正确';
|
_errorMessage = result.errorMessage ?? '验证失败,请检查信息是否正确';
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,8 @@ class _PlantingLocationPageState extends ConsumerState<PlantingLocationPage> {
|
||||||
|
|
||||||
final goToKyc = await KycRequiredDialog.show(context: context);
|
final goToKyc = await KycRequiredDialog.show(context: context);
|
||||||
if (goToKyc == true && mounted) {
|
if (goToKyc == true && mounted) {
|
||||||
context.push(RoutePaths.kycEntry);
|
// 传递 orderNo,KYC 成功后自动跳转到合同签署
|
||||||
|
context.push(RoutePaths.kycEntry, extra: widget.orderNo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (mounted) {
|
} else if (mounted) {
|
||||||
|
|
|
||||||
|
|
@ -368,7 +368,11 @@ final appRouterProvider = Provider<GoRouter>((ref) {
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RoutePaths.kycEntry,
|
path: RoutePaths.kycEntry,
|
||||||
name: RouteNames.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 (手机号验证)
|
// KYC Phone Verification Page (手机号验证)
|
||||||
|
|
@ -382,7 +386,11 @@ final appRouterProvider = Provider<GoRouter>((ref) {
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RoutePaths.kycId,
|
path: RoutePaths.kycId,
|
||||||
name: RouteNames.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: 实人认证 - 人脸活体)
|
// KYC Face Verification Page (层级2: 实人认证 - 人脸活体)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue