Files
suixinkan_ios_new/suixinkan/Features/Main/ViewModels/MainTabBadgeViewModel.swift
汉秋 5541a0b106 新增自定义主 TabBar 与全局扫码核销流程
引入可配置的自定义 TabBar(含订单角标)、中央扫码入口跳转核销订单页,并更新迁移清单中最近完成的模块。

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
}
}
}