引入统一设计令牌并迁移首页、订单和数据 UI

This commit is contained in:
2026-07-06 17:58:18 +08:00
parent 71ab38af8d
commit 28dc004110
31 changed files with 737 additions and 213 deletions

View File

@ -107,34 +107,34 @@ final class OrderCardCell: UITableViewCell {
}
private func setupUI() {
cardView.backgroundColor = .white
cardView.layer.cornerRadius = 12
cardView.backgroundColor = AppColor.cardBackground
cardView.layer.cornerRadius = AppRadius.lg
orderNumberLabel.font = .systemFont(ofSize: 14)
orderNumberLabel.textColor = .black
createdAtLabel.font = .systemFont(ofSize: 12)
createdAtLabel.textColor = UIColor(hex: 0x6B7280)
typeChip.font = .systemFont(ofSize: 12)
orderNumberLabel.font = .app(.body)
orderNumberLabel.textColor = AppColor.textPrimary
createdAtLabel.font = .app(.caption)
createdAtLabel.textColor = AppColor.textSecondary
typeChip.font = .app(.caption)
typeChip.textColor = AppColor.primary
typeChip.backgroundColor = UIColor(hex: 0xEFF6FF)
typeChip.layer.cornerRadius = 4
typeChip.backgroundColor = AppColor.primaryLight
typeChip.layer.cornerRadius = AppRadius.xs
typeChip.clipsToBounds = true
typeChip.textAlignment = .center
configureActionButton(refundButton, title: "退款", color: UIColor(hex: 0xEF4444), bg: UIColor(hex: 0xFFE7E7))
configureActionButton(verifyButton, title: "核销订单", color: .white, bg: UIColor(hex: 0x0073FF))
configureActionButton(refundButton, title: "退款", color: AppColor.danger, bg: AppColor.dangerBackground)
configureActionButton(verifyButton, title: "核销订单", color: .white, bg: AppColor.primary)
refundButton.addTarget(self, action: #selector(refundTapped), for: .touchUpInside)
verifyButton.addTarget(self, action: #selector(verifyTapped), for: .touchUpInside)
uploadTaskButton.setTitle("上传任务", for: .normal)
uploadTaskButton.setTitleColor(AppColor.primary, for: .normal)
uploadTaskButton.titleLabel?.font = .systemFont(ofSize: 16)
uploadTaskButton.backgroundColor = UIColor(hex: 0xEFF6FF)
uploadTaskButton.layer.cornerRadius = 12
uploadTaskButton.titleLabel?.font = .app(.subtitle)
uploadTaskButton.backgroundColor = AppColor.primaryLight
uploadTaskButton.layer.cornerRadius = AppRadius.lg
uploadTaskButton.addTarget(self, action: #selector(uploadTaskTapped), for: .touchUpInside)
actionStack.axis = .horizontal
actionStack.spacing = 12
actionStack.spacing = AppSpacing.sm
actionStack.distribution = .fillEqually
actionStack.addArrangedSubview(refundButton)
actionStack.addArrangedSubview(verifyButton)
@ -143,27 +143,27 @@ final class OrderCardCell: UITableViewCell {
infoStack.spacing = 6
cancelButton.setTitle("取消订单", for: .normal)
cancelButton.setTitleColor(UIColor(hex: 0xEF4444), for: .normal)
cancelButton.titleLabel?.font = .systemFont(ofSize: 14)
cancelButton.setTitleColor(AppColor.danger, for: .normal)
cancelButton.titleLabel?.font = .app(.body)
cancelButton.addTarget(self, action: #selector(cancelTapped), for: .touchUpInside)
orderSourceButton.setTitleColor(AppColor.primary, for: .normal)
orderSourceButton.titleLabel?.font = .systemFont(ofSize: 14)
orderSourceButton.titleLabel?.font = .app(.body)
orderSourceButton.contentHorizontalAlignment = .leading
orderSourceButton.addTarget(self, action: #selector(orderSourceTapped), for: .touchUpInside)
historicalButton.setTitle("历史拍摄", for: .normal)
historicalButton.setTitleColor(AppColor.primary, for: .normal)
historicalButton.titleLabel?.font = .systemFont(ofSize: 14)
historicalButton.titleLabel?.font = .app(.body)
historicalButton.addTarget(self, action: #selector(historicalTapped), for: .touchUpInside)
refinedStack.axis = .horizontal
refinedStack.spacing = 8
refinedStack.spacing = AppSpacing.xs
refinedNeedButton.setTitle("需要精修", for: .normal)
refinedNoButton.setTitle("无需精修", for: .normal)
[refinedNeedButton, refinedNoButton].forEach {
$0.titleLabel?.font = .systemFont(ofSize: 13)
$0.layer.cornerRadius = 6
$0.titleLabel?.font = .app(.body)
$0.layer.cornerRadius = AppRadius.sm
$0.layer.borderWidth = 1
}
refinedNeedButton.addTarget(self, action: #selector(refinedNeedTapped), for: .touchUpInside)
@ -185,7 +185,7 @@ final class OrderCardCell: UITableViewCell {
cardView.addSubview(cancelButton)
cardView.snp.makeConstraints { make in
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 16, bottom: 12, right: 16))
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: AppSpacing.md, bottom: AppSpacing.sm, right: AppSpacing.md))
}
orderNumberLabel.snp.makeConstraints { make in
make.top.leading.equalToSuperview().inset(16)
@ -240,9 +240,9 @@ final class OrderCardCell: UITableViewCell {
private func configureActionButton(_ button: UIButton, title: String, color: UIColor, bg: UIColor) {
button.setTitle(title, for: .normal)
button.setTitleColor(color, for: .normal)
button.titleLabel?.font = .systemFont(ofSize: 16)
button.titleLabel?.font = .app(.subtitle)
button.backgroundColor = bg
button.layer.cornerRadius = 8
button.layer.cornerRadius = AppRadius.sm
}
private func addInfoRow(title: String, value: String) {
@ -251,12 +251,12 @@ final class OrderCardCell: UITableViewCell {
row.distribution = .fillEqually
let titleLabel = UILabel()
titleLabel.text = title
titleLabel.font = .systemFont(ofSize: 13)
titleLabel.textColor = UIColor(hex: 0x6B7280)
titleLabel.font = .app(.body)
titleLabel.textColor = AppColor.textSecondary
let valueLabel = UILabel()
valueLabel.text = value
valueLabel.font = .systemFont(ofSize: 13)
valueLabel.textColor = AppColor.text333
valueLabel.font = .app(.body)
valueLabel.textColor = AppColor.textPrimary
valueLabel.textAlignment = .right
row.addArrangedSubview(titleLabel)
row.addArrangedSubview(valueLabel)
@ -269,12 +269,12 @@ final class OrderCardCell: UITableViewCell {
row.distribution = .fillEqually
let titleLabel = UILabel()
titleLabel.text = "手机号"
titleLabel.font = .systemFont(ofSize: 13)
titleLabel.textColor = UIColor(hex: 0x6B7280)
titleLabel.font = .app(.body)
titleLabel.textColor = AppColor.textSecondary
let valueButton = UIButton(type: .system)
valueButton.setTitle(OrderPhoneMask.mask(phone), for: .normal)
valueButton.setTitleColor(AppColor.primary, for: .normal)
valueButton.titleLabel?.font = .systemFont(ofSize: 13)
valueButton.titleLabel?.font = .app(.body)
valueButton.contentHorizontalAlignment = .trailing
valueButton.isHidden = hidden || phone.isEmpty
valueButton.addTarget(self, action: #selector(callTapped), for: .touchUpInside)
@ -285,7 +285,7 @@ final class OrderCardCell: UITableViewCell {
private func updateRefinedButtons(isRefined: Int, readOnly: Bool) {
let selectedBorder = AppColor.primary.cgColor
let normalBorder = UIColor(hex: 0xE5E7EB).cgColor
let normalBorder = AppColor.border.cgColor
refinedNeedButton.layer.borderColor = isRefined == 1 ? selectedBorder : normalBorder
refinedNoButton.layer.borderColor = isRefined == 2 ? selectedBorder : normalBorder
refinedNeedButton.isEnabled = !readOnly

View File

@ -6,20 +6,17 @@
import SnapKit
import UIKit
///
/// `AppStatusBadge`
final class OrderStatusBadgeView: UIView {
private let label = UILabel()
private let badge = AppStatusBadge()
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))
addSubview(badge)
badge.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
layer.cornerRadius = 4
clipsToBounds = true
}
@available(*, unavailable)
@ -28,20 +25,6 @@ final class OrderStatusBadgeView: UIView {
}
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)
}
badge.applyOrderStatus(status, text: text)
}
}

View File

@ -30,7 +30,6 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT
}
override func setupUI() {
view.backgroundColor = UIColor(hex: 0xF5F5F5)
view.addSubview(filterBar)
view.addSubview(listView)
listView.tableView.dataSource = self