Files
suixinkan_ios_new/suixinkan/Features/Main/ViewModels/MainTabBadgeViewModel.swift

41 lines
1.1 KiB
Swift
Raw Permalink 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 Combine
@MainActor
/// Tab ViewModel Tab
final class MainTabBadgeViewModel: ObservableObject {
@Published 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,
orderStatus: nil,
orderVerifyStatus: nil,
startTime: nil,
endTime: nil,
userPhone: nil
)
pendingWriteOffCount = min(result.total, 99)
} catch {
pendingWriteOffCount = nil
}
}
}