Rebuild order list UI to strictly match Android OrderView and DepositOrderCard.
Add OrderTokens and shared order components, restore filter bar pills, list loading states, and role-specific card layouts with deposit badge mapping tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -18,23 +18,19 @@ final class AppStatusBadge: UIView {
|
||||
case neutral
|
||||
}
|
||||
|
||||
/// 订单 badge 字号与内边距样式。
|
||||
enum OrderBadgeStyle {
|
||||
case photographer
|
||||
case deposit
|
||||
}
|
||||
|
||||
private let label = UILabel()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
AppFont.captionMedium.apply(to: label)
|
||||
label.textAlignment = .center
|
||||
addSubview(label)
|
||||
label.snp.makeConstraints { make in
|
||||
make.edges.equalToSuperview().inset(
|
||||
UIEdgeInsets(
|
||||
top: AppSpacing.xxs,
|
||||
left: AppSpacing.xs,
|
||||
bottom: AppSpacing.xxs,
|
||||
right: AppSpacing.xs
|
||||
)
|
||||
)
|
||||
}
|
||||
applyOrderBadgeStyle(.photographer)
|
||||
layer.cornerRadius = AppRadius.xs
|
||||
clipsToBounds = true
|
||||
}
|
||||
@ -44,6 +40,26 @@ final class AppStatusBadge: UIView {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
/// 设置订单 badge 样式(摄影师 14sp / 店铺 12sp)。
|
||||
func applyOrderBadgeStyle(_ style: OrderBadgeStyle) {
|
||||
switch style {
|
||||
case .photographer:
|
||||
label.font = .app(.bodyMedium)
|
||||
label.snp.remakeConstraints { make in
|
||||
make.edges.equalToSuperview().inset(
|
||||
UIEdgeInsets(top: 0, left: AppSpacing.xxs, bottom: 0, right: AppSpacing.xxs)
|
||||
)
|
||||
}
|
||||
case .deposit:
|
||||
label.font = .app(.caption)
|
||||
label.snp.remakeConstraints { make in
|
||||
make.edges.equalToSuperview().inset(
|
||||
UIEdgeInsets(top: 2, left: AppSpacing.xs, bottom: 2, right: AppSpacing.xs)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 按语义色调与文案刷新展示。
|
||||
func apply(tone: Tone, text: String) {
|
||||
label.text = text
|
||||
@ -61,15 +77,16 @@ final class AppStatusBadge: UIView {
|
||||
label.textColor = AppColor.danger
|
||||
backgroundColor = AppColor.dangerBackground
|
||||
case .neutral:
|
||||
label.textColor = AppColor.textTabInactive
|
||||
backgroundColor = AppColor.inputBackground
|
||||
label.textColor = OrderTokens.depositRefunded
|
||||
backgroundColor = OrderTokens.depositRefundedBackground
|
||||
}
|
||||
}
|
||||
|
||||
/// 订单状态映射(对齐 Android OrderView)。
|
||||
/// 摄影师订单状态映射(对齐 Android `OrderView`)。
|
||||
func applyOrderStatus(_ status: Int, text: String) {
|
||||
applyOrderBadgeStyle(.photographer)
|
||||
switch status {
|
||||
case 18, 20:
|
||||
case 18:
|
||||
apply(tone: .info, text: text)
|
||||
case 30:
|
||||
apply(tone: .success, text: text)
|
||||
@ -79,4 +96,21 @@ final class AppStatusBadge: UIView {
|
||||
apply(tone: .warning, text: text)
|
||||
}
|
||||
}
|
||||
|
||||
/// 店铺订单状态映射(对齐 Android `DepositOrderCard`)。
|
||||
func applyDepositOrderStatus(_ status: Int, text: String) {
|
||||
applyOrderBadgeStyle(.deposit)
|
||||
switch status {
|
||||
case 20:
|
||||
apply(tone: .info, text: text)
|
||||
case 30:
|
||||
label.text = text
|
||||
label.textColor = OrderTokens.depositSuccess
|
||||
backgroundColor = OrderTokens.depositSuccessBackground
|
||||
case 50:
|
||||
apply(tone: .neutral, text: text)
|
||||
default:
|
||||
apply(tone: .warning, text: text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user