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>
48 lines
1.3 KiB
Swift
48 lines
1.3 KiB
Swift
//
|
|
// OrderStatusBadgeView.swift
|
|
// suixinkan
|
|
//
|
|
|
|
import SnapKit
|
|
import UIKit
|
|
|
|
/// 订单状态标签。
|
|
final class OrderStatusBadgeView: UIView {
|
|
private let label = UILabel()
|
|
|
|
override init(frame: CGRect) {
|
|
super.init(frame: frame)
|
|
label.font = .systemFont(ofSize: 14, weight: .medium)
|
|
label.textAlignment = .center
|
|
addSubview(label)
|
|
label.snp.makeConstraints { make in
|
|
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 2, left: 4, bottom: 2, right: 4))
|
|
}
|
|
layer.cornerRadius = 4
|
|
clipsToBounds = true
|
|
}
|
|
|
|
@available(*, unavailable)
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
func apply(status: Int, text: String) {
|
|
label.text = text
|
|
switch status {
|
|
case 18, 20:
|
|
label.textColor = UIColor(hex: 0x0073FF)
|
|
backgroundColor = UIColor(hex: 0xEFF6FF)
|
|
case 30:
|
|
label.textColor = UIColor(hex: 0x10B981)
|
|
backgroundColor = UIColor(hex: 0xF0FDF4)
|
|
case 50:
|
|
label.textColor = UIColor(hex: 0xEF4444)
|
|
backgroundColor = UIColor(hex: 0xFFE7E7)
|
|
default:
|
|
label.textColor = UIColor(hex: 0xFF7B00)
|
|
backgroundColor = UIColor(hex: 0xFFF0E2)
|
|
}
|
|
}
|
|
}
|