迁移合作订单完整能力,并统一 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

@ -28,13 +28,13 @@ final class StatisticsViewModel: ObservableObject {
}
///
func selectPeriod(_ period: StatisticsPeriod, api: StatisticsServing, scenicId: Int?, roleId: Int?) async throws {
func selectPeriod(_ period: StatisticsPeriod, api: StatisticsServing, scenicId: Int?, appRole: AppRoleCode?) async throws {
selectedPeriod = period
try await reload(api: api, scenicId: scenicId, roleId: roleId)
try await reload(api: api, scenicId: scenicId, appRole: appRole)
}
///
func reload(api: StatisticsServing, scenicId: Int?, roleId: Int?, showLoading: Bool = true) async throws {
func reload(api: StatisticsServing, scenicId: Int?, appRole: AppRoleCode?, showLoading: Bool = true) async throws {
guard let scenicId else {
reset()
return
@ -43,7 +43,7 @@ final class StatisticsViewModel: ObservableObject {
if showLoading { loading = true }
defer { if showLoading { loading = false } }
let isScenicAdmin = roleId == 53
let isScenicAdmin = appRole?.isScenicAdmin == true
async let summaryResult = api.summary(
scenicId: scenicId,
range: selectedPeriod.apiRange,
@ -66,7 +66,7 @@ final class StatisticsViewModel: ObservableObject {
}
///
func loadMore(api: StatisticsServing, scenicId: Int?, roleId: Int?) async throws {
func loadMore(api: StatisticsServing, scenicId: Int?, appRole: AppRoleCode?) async throws {
guard !loadingMore, hasMore, let scenicId else { return }
loadingMore = true
@ -79,7 +79,7 @@ final class StatisticsViewModel: ObservableObject {
endTime: selectedPeriod.apiEndTime,
page: nextPage,
pageSize: pageSize,
isScenicAdmin: roleId == 53
isScenicAdmin: appRole?.isScenicAdmin == true
)
dailyItems.append(contentsOf: result.data)
totalDailyCount = result.total