修复合作获客扫码绑定崩溃与 Toast 层级,并接入分成比例修改。
将扫码页提升到列表层弹出并补齐 AppDelegate.window,避免扫码时 UIKit 取主窗口崩溃;Toast 改用独立 UIWindow 显示在 sheet 之上;合作获客员支持短信验证修改分成比例,同时优化冷启动根视图创建时机并补充相关测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -9,10 +9,13 @@ import SwiftUI
|
||||
|
||||
/// 合作订单主页,展示获客线索与获客订单双 Tab 列表。
|
||||
struct CooperationOrderListView: View {
|
||||
@EnvironmentObject private var toastCenter: ToastCenter
|
||||
@Environment(\.cooperationOrderAPI) private var cooperationOrderAPI
|
||||
@Environment(\.globalLoading) private var globalLoading
|
||||
@StateObject private var viewModel = CooperationOrderListViewModel()
|
||||
@State private var route: CooperationOrderRoute?
|
||||
/// 扫码绑定页在列表层弹出,避免在 navigationDestination 子页内嵌 fullScreenCover 触发 SwiftUI 栈溢出。
|
||||
@State private var showBindScanner = false
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
@ -81,11 +84,28 @@ struct CooperationOrderListView: View {
|
||||
}
|
||||
}
|
||||
.background(CooperationOrderColors.pageBg.ignoresSafeArea())
|
||||
.fullScreenCover(isPresented: $showBindScanner) {
|
||||
OrderScannerPage(
|
||||
onClose: { showBindScanner = false },
|
||||
onSuccess: { raw in
|
||||
showBindScanner = false
|
||||
guard let saleUserId = SaleUserQrParser.parseSaleUserId(raw), saleUserId > 0 else {
|
||||
toastCenter.show("请扫描正确的获客员二维码")
|
||||
return
|
||||
}
|
||||
route = .bind(saleUserId: saleUserId)
|
||||
},
|
||||
onFailure: { error in
|
||||
showBindScanner = false
|
||||
toastCenter.show(error.localizedDescription)
|
||||
}
|
||||
)
|
||||
}
|
||||
.appNavigationDestination(item: $route) { destination in
|
||||
switch destination {
|
||||
case .acquirer:
|
||||
CooperationAcquirerView(onBind: { saleUserId in
|
||||
route = .bind(saleUserId: saleUserId)
|
||||
CooperationAcquirerView(onScanBind: {
|
||||
showBindScanner = true
|
||||
})
|
||||
case let .bind(saleUserId):
|
||||
BindAcquirerView(saleUserId: saleUserId, onSuccess: {
|
||||
|
||||
Reference in New Issue
Block a user