迁移合作订单完整能力,并统一 AppRoleCode 角色权限与首页菜单展示。

新增 CooperationOrder 模块(双 Tab 列表、获客员绑定、主 Tab 扫码)、订单来源/带客单绑定及配套 API 测试;同步引入 roleCode 权限匹配与相关单元测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 13:33:00 +08:00
parent d310d26293
commit 1970572edd
66 changed files with 4247 additions and 201 deletions

View File

@ -22,8 +22,8 @@ struct StatisticsView: View {
accountContext.currentScenic?.id
}
private var currentRoleId: Int? {
permissionContext.currentRole?.id
private var currentAppRole: AppRoleCode? {
permissionContext.currentAppRole
}
private var contentMaxWidth: CGFloat {
@ -62,7 +62,7 @@ struct StatisticsView: View {
.onChange(of: accountContext.currentScenic?.id) { _ in
Task { await reload() }
}
.onChange(of: permissionContext.currentRole?.id) { _ in
.onChange(of: permissionContext.currentRole?.roleCode) { _ in
Task { await reload() }
}
}
@ -289,7 +289,7 @@ struct StatisticsView: View {
private func selectPeriod(_ period: StatisticsPeriod) async {
do {
try await globalLoading.withLoading(message: "加载中...") {
try await viewModel.selectPeriod(period, api: statisticsAPI, scenicId: currentScenicId, roleId: currentRoleId)
try await viewModel.selectPeriod(period, api: statisticsAPI, scenicId: currentScenicId, appRole: currentAppRole)
}
} catch {
toastCenter.show(error.localizedDescription)
@ -299,7 +299,7 @@ struct StatisticsView: View {
private func reload(showLoading: Bool = true) async {
do {
try await globalLoading.withOptionalLoading(showLoading && currentScenicId != nil && viewModel.dailyItems.isEmpty, message: "加载中...") {
try await viewModel.reload(api: statisticsAPI, scenicId: currentScenicId, roleId: currentRoleId, showLoading: showLoading)
try await viewModel.reload(api: statisticsAPI, scenicId: currentScenicId, appRole: currentAppRole, showLoading: showLoading)
}
} catch {
toastCenter.show(error.localizedDescription)
@ -308,7 +308,7 @@ struct StatisticsView: View {
private func loadMore() async {
do {
try await viewModel.loadMore(api: statisticsAPI, scenicId: currentScenicId, roleId: currentRoleId)
try await viewModel.loadMore(api: statisticsAPI, scenicId: currentScenicId, appRole: currentAppRole)
} catch {
toastCenter.show(error.localizedDescription)
}