Files
suixinkan_uikit/suixinkan/UI/Orders/HistoricalShootingInfoViewController.swift
汉秋 31d2b6094b Implement orders tab aligned with Android, including scan verify flows.
Add role-based order/deposit lists, AVFoundation QR scanning, verify dialogs, and ViewModel tests so photographers, scenic admins, and store admins match Android behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 16:59:53 +08:00

69 lines
2.1 KiB
Swift

//
// HistoricalShootingInfoViewController.swift
// suixinkan
//
import SnapKit
import UIKit
///
final class HistoricalShootingInfoViewController: BaseViewController, UITableViewDataSource {
private let orderNumber: String
private let orderAPI: OrderAPI
private var response: MultiTravelShootHistoryResponse?
private let tableView = UITableView(frame: .zero, style: .insetGrouped)
init(orderNumber: String, orderAPI: OrderAPI = NetworkServices.shared.orderAPI) {
self.orderNumber = orderNumber
self.orderAPI = orderAPI
super.init(nibName: nil, bundle: nil)
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setupNavigationBar() {
title = "历史拍摄"
}
override func setupUI() {
tableView.dataSource = self
view.addSubview(tableView)
tableView.snp.makeConstraints { $0.edges.equalToSuperview() }
}
override func viewDidLoad() {
super.viewDidLoad()
Task { await loadData() }
}
private func loadData() async {
showLoading()
defer { hideLoading() }
do {
response = try await orderAPI.shootHistory(orderNumber: orderNumber)
tableView.reloadData()
} catch {
showToast(error.localizedDescription)
}
}
func numberOfSections(in tableView: UITableView) -> Int { 1 }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
response?.photogSpotList.count ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
guard let spot = response?.photogSpotList[indexPath.row] else { return cell }
cell.textLabel?.text = spot.scenicSpotName
cell.detailTextLabel?.text = "\(spot.photographerDisplayName) · \(spot.files.count)个素材"
cell.accessoryType = .disclosureIndicator
return cell
}
}