Files
suixinkan_ios_new/suixinkan/Features/Main/ViewModels/MainTabBadgeViewModel.swift
汉秋 1d1eb46ed8 Add custom main tab bar with global scan-to-verify flow.
Introduce configurable custom TabBar with order badge, central scanner routing to verification orders, and update the migration checklist for recently completed modules.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 10:52:45 +08:00

32 lines
863 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// MainTabBadgeViewModel.swift
// suixinkan
//
// Created by Codex on 2026/6/23.
//
import Foundation
import Observation
@MainActor
@Observable
/// Tab ViewModel Tab
final class MainTabBadgeViewModel {
private(set) var pendingWriteOffCount: Int?
///
func refreshPendingWriteOffCount(api: OrderServing, scenicId: Int?, storeId: Int?) async {
guard let scenicId, scenicId > 0 else {
pendingWriteOffCount = nil
return
}
do {
let result = try await api.writeOffList(scenicId: scenicId, storeId: storeId, page: 1, pageSize: 1)
pendingWriteOffCount = min(result.total, 99)
} catch {
pendingWriteOffCount = nil
}
}
}