迁移合作订单完整能力,并统一 AppRoleCode 角色权限与首页菜单展示。
新增 CooperationOrder 模块(双 Tab 列表、获客员绑定、主 Tab 扫码)、订单来源/带客单绑定及配套 API 测试;同步引入 roleCode 权限匹配与相关单元测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -0,0 +1,30 @@
|
||||
//
|
||||
// CooperationAcquirerViewModel.swift
|
||||
// suixinkan
|
||||
//
|
||||
// Created by Codex on 2026/6/29.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
/// 合作获客员列表 ViewModel。
|
||||
@MainActor
|
||||
final class CooperationAcquirerViewModel: ObservableObject {
|
||||
@Published var acquirers: [CooperativeSaler] = []
|
||||
@Published private(set) var hasLoadedOnce = false
|
||||
|
||||
/// 重新加载当前门店下的合作获客员。
|
||||
func reload(api: CooperationOrderServing, storeId: Int?) async {
|
||||
do {
|
||||
let storeParam = storeId.flatMap { $0 > 0 ? $0 : nil }
|
||||
let data = try await api.cooperativeSalers(storeId: storeParam, page: 1, pageSize: 20)
|
||||
acquirers = data.list
|
||||
} catch {
|
||||
if !hasLoadedOnce {
|
||||
acquirers = []
|
||||
}
|
||||
}
|
||||
hasLoadedOnce = true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user