完善钱包提现状态展示与举报摄影师列表交互。

对齐 Android 提现进度与时间线映射,优化钱包与积分兑换页刷新逻辑,并补充相关单元测试与真机测试说明。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 16:51:32 +08:00
parent 5138c1c11a
commit 05804ba7d6
9 changed files with 440 additions and 99 deletions

View File

@ -372,11 +372,12 @@ private final class PointWithdrawRecordCell: UITableViewCell {
amountLabel.text = record.amount != nil && record.status == 2 ? "+\(formatAmount(record.amount))" : ""
amountLabel.isHidden = amountLabel.text?.isEmpty ?? true
timeLabel.text = record.createdAt.isEmpty ? "----" : record.createdAt
let style = statusStyle(for: record.status)
statusLabel.text = statusText(for: record.status)
let display = PointWithdrawStatusDisplay(status: record.status)
let style = statusStyle(for: display.tone)
statusLabel.text = display.title
statusLabel.textColor = style.text
statusLabel.backgroundColor = style.background
let progress = progress(for: record.status)
let progress = display.progress
progressView.progress = Float(progress) / 100.0
progressView.progressTintColor = style.progress
progressView.isHidden = progress == 0
@ -498,45 +499,28 @@ private final class PointWithdrawRecordCell: UITableViewCell {
}
}
private func statusText(for status: Int) -> String {
switch status {
case 2: "提现成功"
case 1: "提现中"
case 3: "提现失败"
default: "未知"
}
}
private func statusStyle(for status: Int) -> (background: UIColor, text: UIColor, progress: UIColor) {
switch status {
case 2:
private func statusStyle(for tone: WalletStatusTone) -> (background: UIColor, text: UIColor, progress: UIColor) {
switch tone {
case .success:
(WalletTokens.successBackground, WalletTokens.success, WalletTokens.summaryBackground)
case 1:
case .warning:
(WalletTokens.pointsPendingBackground, WalletTokens.points, WalletTokens.summaryBackground)
case 3:
case .danger:
(WalletTokens.dangerBackground, WalletTokens.danger, WalletTokens.progressDanger)
default:
case .info:
(WalletTokens.infoBackground, WalletTokens.summaryBackground, WalletTokens.summaryBackground)
}
}
private func progress(for status: Int) -> Int {
switch status {
case 1: 40
case 3: 100
default: 0
}
}
private func infoText(for record: PointWithdrawItem) -> String {
let display = PointWithdrawStatusDisplay(status: record.status)
let value: String
switch record.status {
case 3:
return "审核时间:\(record.reviewedAt.isEmpty ? "暂无" : record.reviewedAt)"
case 2:
return "到账时间:\(record.paymentTime.isEmpty ? "暂无" : record.paymentTime)"
default:
return "预计到账时间:\(record.estimatedReceiptTime.isEmpty ? "暂无" : record.estimatedReceiptTime)"
case 3: value = record.reviewedAt
case 2: value = record.paymentTime
default: value = record.estimatedReceiptTime
}
return "\(display.timeTitle)\(value.isEmpty ? "暂无" : value)"
}
private func formatAmount(_ value: Double?) -> String {

View File

@ -33,14 +33,16 @@ final class WalletWithdrawRecordCell: UITableViewCell {
amountLabel.text = WalletViewModel.formatAmount(record.amount)
statusLabel.text = record.statusLabel.isEmpty ? "--" : record.statusLabel
timeLabel.text = record.createdAt.isEmpty ? "--" : record.createdAt
let style = statusStyle(for: record.settlementStatus)
let display = WalletWithdrawStatusDisplay(status: record.settlementStatus)
let style = statusStyle(for: display.tone)
statusLabel.textColor = style.text
statusLabel.backgroundColor = style.background
progressView.progressTintColor = style.progress
progressView.progress = progress(for: record.settlementStatus)
configureSteps(progress: progress(for: record.settlementStatus), tint: style.progress)
progressView.isHidden = record.settlementStatus == 50
stepsStack.isHidden = record.settlementStatus == 50
let progress = Float(display.progress) / 100
progressView.progress = progress
configureSteps(progress: progress, tint: style.progress)
progressView.isHidden = !display.showsTimeline
stepsStack.isHidden = !display.showsTimeline
infoLabel.attributedText = infoText(for: record)
infoLabel.isHidden = infoLabel.attributedText?.length == 0
infoLabel.snp.remakeConstraints { make in
@ -141,30 +143,19 @@ final class WalletWithdrawRecordCell: UITableViewCell {
stepsStack.addArrangedSubview(percent)
}
private func statusStyle(for status: Int) -> (background: UIColor, text: UIColor, progress: UIColor) {
switch status {
case 50, 20:
private func statusStyle(for tone: WalletStatusTone) -> (background: UIColor, text: UIColor, progress: UIColor) {
switch tone {
case .success:
(WalletTokens.settlementSuccessBackground, WalletTokens.settlementSuccess, WalletTokens.summaryBackground)
case 60, 30:
case .danger:
(WalletTokens.settlementDangerBackground, WalletTokens.progressDanger, WalletTokens.progressDanger)
case 40:
case .warning:
(WalletTokens.warningBackground, WalletTokens.warning, WalletTokens.summaryBackground)
default:
case .info:
(WalletTokens.infoBackground, WalletTokens.summaryBackground, WalletTokens.summaryBackground)
}
}
private func progress(for status: Int) -> Float {
switch status {
case 10: 0.1
case 40: 0.4
case 20: 0.8
case 30: 1.0
case 60: 0.0
default: 1.0
}
}
private func infoText(for record: WalletWithdrawItem) -> NSAttributedString {
let result = NSMutableAttributedString()
let normal: [NSAttributedString.Key: Any] = [

View File

@ -320,14 +320,7 @@ final class WalletViewController: BaseViewController, UITableViewDelegate {
}
@objc private func refreshPulled() {
Task {
switch viewModel.selectedTab {
case .withdraw:
await viewModel.refreshWithdraw(api: walletAPI)
case .transaction:
await viewModel.refreshTransaction(api: walletAPI)
}
}
Task { await viewModel.refreshSelectedTab(api: walletAPI) }
}
@objc private func withdrawTapped() {