重建订单列表 UI 并严格对齐 Android 订单卡片

This commit is contained in:
2026-07-07 09:12:06 +08:00
parent 28dc004110
commit 3bc017260f
17 changed files with 1235 additions and 379 deletions

View File

@ -0,0 +1,101 @@
//
// OrderPhoneRowView.swift
// suixinkan
//
import SnapKit
import UIKit
/// / Android
final class OrderPhoneRowView: UIView {
enum Style {
case photographer
case deposit
}
var onTap: (() -> Void)?
private let style: Style
private let titleLabel = UILabel()
private let phoneLabel = UILabel()
private let phoneButton = UIButton(type: .system)
private let iconButton = UIButton(type: .system)
init(style: Style) {
self.style = style
super.init(frame: .zero)
setupUI()
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func apply(phone: String, hidden: Bool = false) {
let masked = OrderPhoneMask.mask(phone)
phoneLabel.text = masked
isHidden = hidden || phone.isEmpty
}
private func setupUI() {
titleLabel.font = .app(.body)
titleLabel.textColor = OrderTokens.label563
titleLabel.text = "手机号:"
phoneLabel.font = .systemFont(ofSize: 14, weight: .medium)
phoneLabel.textAlignment = .right
phoneButton.addTarget(self, action: #selector(handleTap), for: .touchUpInside)
iconButton.addTarget(self, action: #selector(handleTap), for: .touchUpInside)
addSubview(titleLabel)
addSubview(phoneLabel)
addSubview(phoneButton)
addSubview(iconButton)
titleLabel.snp.makeConstraints { make in
make.leading.top.bottom.equalToSuperview()
}
switch style {
case .photographer:
phoneLabel.textColor = OrderTokens.valueBlack
iconButton.backgroundColor = OrderTokens.phoneIconBackground
iconButton.layer.cornerRadius = 12
iconButton.tintColor = AppColor.primary
iconButton.setImage(UIImage(systemName: "phone.fill"), for: .normal)
iconButton.snp.makeConstraints { make in
make.trailing.centerY.equalToSuperview()
make.width.height.equalTo(24)
}
phoneLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.trailing.equalTo(iconButton.snp.leading).offset(-7)
}
case .deposit:
phoneLabel.textColor = AppColor.primary
iconButton.tintColor = AppColor.primary
iconButton.setImage(UIImage(systemName: "phone.fill"), for: .normal)
iconButton.snp.makeConstraints { make in
make.trailing.centerY.equalToSuperview()
make.width.height.equalTo(16)
}
phoneLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.trailing.equalTo(iconButton.snp.leading).offset(-AppSpacing.xxs)
}
}
phoneButton.snp.makeConstraints { make in
make.leading.equalTo(phoneLabel)
make.trailing.equalTo(iconButton)
make.top.bottom.equalToSuperview()
}
}
@objc private func handleTap() {
onTap?()
}
}