完善实名认证、钱包与打卡点模块 UI 与业务逻辑。
对齐 Android 实名认证流程与审核页、钱包提现/积分兑换界面,优化打卡点列表与详情交互,并补充相关资源、主题 token 与单元测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -19,6 +19,7 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
private let contentStack = UIStackView()
|
||||
private let pointsCard = UIView()
|
||||
private let pointsValueLabel = UILabel()
|
||||
private let summaryLoadingIndicator = UIActivityIndicatorView(style: .large)
|
||||
private let inputCard = UIView()
|
||||
private let pointsInputField = UITextField()
|
||||
private let withdrawablePointsLabel = UILabel()
|
||||
@ -29,6 +30,7 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
private let submitButton = AppButton(title: "立即兑换")
|
||||
|
||||
private var dataSource: UITableViewDiffableDataSource<Section, PointWithdrawItem>!
|
||||
private var tableHeightConstraint: Constraint?
|
||||
private var lastShownMessage: String?
|
||||
|
||||
/// 初始化积分兑现页面。
|
||||
@ -47,13 +49,17 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
}
|
||||
|
||||
override func setupNavigationBar() {
|
||||
title = "积分兑现"
|
||||
let titleLabel = UILabel()
|
||||
titleLabel.text = "积分兑现"
|
||||
titleLabel.textColor = WalletTokens.text333
|
||||
titleLabel.font = UIFont.systemFont(ofSize: 18)
|
||||
navigationItem.titleView = titleLabel
|
||||
}
|
||||
|
||||
override func setupUI() {
|
||||
view.backgroundColor = UIColor(hex: 0xF5F6F8)
|
||||
view.backgroundColor = WalletTokens.pageBackground
|
||||
contentStack.axis = .vertical
|
||||
contentStack.spacing = 16
|
||||
contentStack.spacing = WalletTokens.cardGap
|
||||
bottomBar.backgroundColor = .white
|
||||
|
||||
view.addSubview(scrollView)
|
||||
@ -72,21 +78,21 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
make.leading.trailing.bottom.equalToSuperview()
|
||||
}
|
||||
submitButton.snp.makeConstraints { make in
|
||||
make.top.equalToSuperview().offset(16)
|
||||
make.leading.trailing.equalToSuperview().inset(16)
|
||||
make.top.equalToSuperview().offset(WalletTokens.screenInset)
|
||||
make.leading.trailing.equalToSuperview().inset(WalletTokens.screenInset)
|
||||
make.bottom.equalTo(view.safeAreaLayoutGuide).inset(22)
|
||||
}
|
||||
submitButton.layer.cornerRadius = WalletTokens.bottomButtonRadius
|
||||
scrollView.snp.makeConstraints { make in
|
||||
make.top.leading.trailing.equalToSuperview()
|
||||
make.bottom.equalTo(bottomBar.snp.top)
|
||||
}
|
||||
contentStack.snp.makeConstraints { make in
|
||||
make.edges.equalToSuperview().inset(16)
|
||||
make.edges.equalToSuperview().inset(WalletTokens.screenInset)
|
||||
make.width.equalTo(scrollView).offset(-32)
|
||||
}
|
||||
tableView.snp.makeConstraints { make in
|
||||
make.height.greaterThanOrEqualTo(260)
|
||||
make.height.lessThanOrEqualTo(420)
|
||||
tableHeightConstraint = make.height.equalTo(200).constraint
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +103,8 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
pointsInputField.addTarget(self, action: #selector(pointsInputChanged), for: .editingChanged)
|
||||
refreshControl.addTarget(self, action: #selector(refreshPulled), for: .valueChanged)
|
||||
submitButton.addTarget(self, action: #selector(submitTapped), for: .touchUpInside)
|
||||
Task { await viewModel.loadInitial(api: walletAPI) }
|
||||
Task { await viewModel.refreshOverview(api: walletAPI) }
|
||||
Task { await viewModel.refreshWithdrawList(api: walletAPI) }
|
||||
}
|
||||
|
||||
private func configureTable() {
|
||||
@ -106,7 +113,7 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
tableView.delegate = self
|
||||
tableView.rowHeight = UITableView.automaticDimension
|
||||
tableView.estimatedRowHeight = 120
|
||||
tableView.refreshControl = refreshControl
|
||||
scrollView.refreshControl = refreshControl
|
||||
tableView.register(PointWithdrawRecordCell.self, forCellReuseIdentifier: PointWithdrawRecordCell.reuseIdentifier)
|
||||
dataSource = UITableViewDiffableDataSource<Section, PointWithdrawItem>(tableView: tableView) { tableView, indexPath, item in
|
||||
let cell = tableView.dequeueReusableCell(
|
||||
@ -121,47 +128,82 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
private func applyState() {
|
||||
pointsValueLabel.text = "\(viewModel.withdrawnPoints)"
|
||||
withdrawablePointsLabel.text = "\(viewModel.withdrawnPoints)"
|
||||
pointsValueLabel.isHidden = viewModel.overviewLoading
|
||||
if viewModel.overviewLoading {
|
||||
summaryLoadingIndicator.startAnimating()
|
||||
} else {
|
||||
summaryLoadingIndicator.stopAnimating()
|
||||
}
|
||||
pointsInputField.text = viewModel.pointsInput
|
||||
submitButton.isEnabled = (Int(viewModel.pointsInput) ?? 0) > 0
|
||||
refreshControl.endRefreshing()
|
||||
if !viewModel.withdrawRefreshing, !viewModel.overviewLoading {
|
||||
refreshControl.endRefreshing()
|
||||
}
|
||||
var snapshot = NSDiffableDataSourceSnapshot<Section, PointWithdrawItem>()
|
||||
snapshot.appendSections([.main])
|
||||
snapshot.appendItems(viewModel.withdrawRecords, toSection: .main)
|
||||
dataSource.apply(snapshot, animatingDifferences: true)
|
||||
updateEmptyState()
|
||||
dataSource.apply(snapshot, animatingDifferences: true) { [weak self] in
|
||||
self?.updateTablePresentation()
|
||||
}
|
||||
showMessageIfNeeded(viewModel.statusMessage)
|
||||
showMessageIfNeeded(viewModel.errorMessage)
|
||||
}
|
||||
|
||||
private func updateEmptyState() {
|
||||
guard viewModel.withdrawRecords.isEmpty, !viewModel.withdrawLoading else {
|
||||
private func updateTablePresentation() {
|
||||
tableView.layoutIfNeeded()
|
||||
let isEmpty = viewModel.withdrawRecords.isEmpty
|
||||
updateLoadingFooter()
|
||||
guard isEmpty, !viewModel.withdrawLoading else {
|
||||
tableView.backgroundView = nil
|
||||
let minimumHeight: CGFloat = viewModel.withdrawLoading ? 56 : 44
|
||||
let height = max(minimumHeight, min(tableView.contentSize.height, 400))
|
||||
tableHeightConstraint?.update(offset: height)
|
||||
tableView.isScrollEnabled = tableView.contentSize.height > 400
|
||||
return
|
||||
}
|
||||
let label = UILabel()
|
||||
label.text = "暂无提现记录"
|
||||
label.font = .systemFont(ofSize: 14)
|
||||
label.textColor = UIColor(hex: 0xB3B8C2)
|
||||
label.font = WalletTokens.bodyFont
|
||||
label.textColor = WalletTokens.textDisabled
|
||||
label.textAlignment = .center
|
||||
tableView.backgroundView = label
|
||||
tableHeightConstraint?.update(offset: 200)
|
||||
tableView.isScrollEnabled = false
|
||||
}
|
||||
|
||||
private func updateLoadingFooter() {
|
||||
guard viewModel.withdrawLoading else {
|
||||
tableView.tableFooterView = UIView(frame: .zero)
|
||||
return
|
||||
}
|
||||
let footer = UIView(frame: CGRect(x: 0, y: 0, width: tableView.bounds.width, height: 56))
|
||||
let indicator = UIActivityIndicatorView(style: .medium)
|
||||
indicator.color = WalletTokens.primary
|
||||
indicator.startAnimating()
|
||||
footer.addSubview(indicator)
|
||||
indicator.snp.makeConstraints { make in make.center.equalToSuperview() }
|
||||
tableView.tableFooterView = footer
|
||||
}
|
||||
|
||||
private func makeSummaryCard() -> UIView {
|
||||
pointsCard.backgroundColor = UIColor(hex: 0x1677FF)
|
||||
pointsCard.layer.cornerRadius = 16
|
||||
pointsCard.backgroundColor = WalletTokens.summaryBackground
|
||||
pointsCard.layer.cornerRadius = WalletTokens.contentRadius
|
||||
pointsCard.clipsToBounds = true
|
||||
|
||||
let title = UILabel()
|
||||
title.text = "可提现积分"
|
||||
title.font = .systemFont(ofSize: 14)
|
||||
title.font = WalletTokens.bodyFont
|
||||
title.textColor = UIColor.white.withAlphaComponent(0.8)
|
||||
title.textAlignment = .center
|
||||
pointsValueLabel.font = .systemFont(ofSize: 36, weight: .bold)
|
||||
pointsValueLabel.font = WalletTokens.displayFont
|
||||
pointsValueLabel.textColor = .white
|
||||
pointsValueLabel.textAlignment = .center
|
||||
|
||||
pointsCard.addSubview(title)
|
||||
pointsCard.addSubview(pointsValueLabel)
|
||||
summaryLoadingIndicator.color = .white
|
||||
summaryLoadingIndicator.hidesWhenStopped = true
|
||||
pointsCard.addSubview(summaryLoadingIndicator)
|
||||
title.snp.makeConstraints { make in
|
||||
make.top.equalToSuperview().offset(16)
|
||||
make.leading.trailing.equalToSuperview().inset(24)
|
||||
@ -171,35 +213,40 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
make.leading.trailing.equalToSuperview().inset(24)
|
||||
make.bottom.equalToSuperview().inset(16)
|
||||
}
|
||||
summaryLoadingIndicator.snp.makeConstraints { make in
|
||||
make.center.equalTo(pointsValueLabel)
|
||||
}
|
||||
return pointsCard
|
||||
}
|
||||
|
||||
private func makeInputCard() -> UIView {
|
||||
inputCard.backgroundColor = .white
|
||||
inputCard.layer.cornerRadius = 12
|
||||
inputCard.layer.cornerRadius = WalletTokens.cardRadius
|
||||
inputCard.clipsToBounds = true
|
||||
|
||||
let title = makeTitle("积分提现", size: 18)
|
||||
let titleSpacer = UIView()
|
||||
titleSpacer.snp.makeConstraints { make in make.height.equalTo(WalletTokens.compactGap) }
|
||||
let row = UIStackView()
|
||||
row.axis = .horizontal
|
||||
row.spacing = 16
|
||||
let label = makeBody("可提现积分", color: .black, weight: .medium)
|
||||
withdrawablePointsLabel.font = .systemFont(ofSize: 14, weight: .medium)
|
||||
withdrawablePointsLabel.textColor = UIColor(hex: 0xFF7B00)
|
||||
withdrawablePointsLabel.font = WalletTokens.bodyMediumFont
|
||||
withdrawablePointsLabel.textColor = WalletTokens.points
|
||||
row.addArrangedSubview(label)
|
||||
row.addArrangedSubview(withdrawablePointsLabel)
|
||||
|
||||
let inputContainer = UIView()
|
||||
inputContainer.layer.cornerRadius = 4
|
||||
inputContainer.layer.cornerRadius = WalletTokens.chipRadius
|
||||
inputContainer.layer.borderWidth = 1
|
||||
inputContainer.layer.borderColor = UIColor(hex: 0xEEEEEE).cgColor
|
||||
inputContainer.layer.borderColor = WalletTokens.border.cgColor
|
||||
pointsInputField.placeholder = "请输入积分"
|
||||
pointsInputField.keyboardType = .numberPad
|
||||
pointsInputField.font = .systemFont(ofSize: 14)
|
||||
pointsInputField.font = WalletTokens.bodyFont
|
||||
let allButton = UIButton(type: .system)
|
||||
allButton.setTitle("全部提现", for: .normal)
|
||||
allButton.setTitleColor(UIColor(hex: 0x0073FF), for: .normal)
|
||||
allButton.titleLabel?.font = .systemFont(ofSize: 14)
|
||||
allButton.setTitleColor(WalletTokens.primary, for: .normal)
|
||||
allButton.titleLabel?.font = WalletTokens.bodyFont
|
||||
allButton.addTarget(self, action: #selector(withdrawAllTapped), for: .touchUpInside)
|
||||
inputContainer.addSubview(pointsInputField)
|
||||
inputContainer.addSubview(allButton)
|
||||
@ -212,14 +259,14 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
make.trailing.equalToSuperview().inset(12)
|
||||
make.centerY.equalToSuperview()
|
||||
}
|
||||
inputContainer.snp.makeConstraints { make in make.height.equalTo(46) }
|
||||
inputContainer.snp.makeConstraints { make in make.height.equalTo(WalletTokens.inputHeight) }
|
||||
|
||||
let ratio = makeBody("积分金额兑换比例12积分=1元人民币", color: UIColor(hex: 0xEF4444))
|
||||
ratio.font = .systemFont(ofSize: 12)
|
||||
let ratio = makeBody("积分金额兑换比例12积分=1元人民币", color: WalletTokens.danger)
|
||||
ratio.font = WalletTokens.captionFont
|
||||
|
||||
let stack = UIStackView(arrangedSubviews: [title, row, inputContainer, ratio])
|
||||
let stack = UIStackView(arrangedSubviews: [title, titleSpacer, row, inputContainer, ratio])
|
||||
stack.axis = .vertical
|
||||
stack.spacing = 12
|
||||
stack.spacing = WalletTokens.compactGap
|
||||
inputCard.addSubview(stack)
|
||||
stack.snp.makeConstraints { make in make.edges.equalToSuperview().inset(16) }
|
||||
return inputCard
|
||||
@ -227,20 +274,21 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
|
||||
private func makeRecordCard() -> UIView {
|
||||
recordCard.backgroundColor = .white
|
||||
recordCard.layer.cornerRadius = 12
|
||||
recordCard.layer.cornerRadius = WalletTokens.cardRadius
|
||||
recordCard.clipsToBounds = true
|
||||
let title = makeTitle("积分提现记录", size: 14)
|
||||
title.textColor = UIColor(hex: 0x0073FF)
|
||||
title.textColor = WalletTokens.primary
|
||||
title.font = UIFont.systemFont(ofSize: 14, weight: .bold)
|
||||
title.textAlignment = .center
|
||||
recordCard.addSubview(title)
|
||||
recordCard.addSubview(tableView)
|
||||
title.snp.makeConstraints { make in
|
||||
make.top.equalToSuperview().offset(16)
|
||||
make.leading.trailing.equalToSuperview().inset(16)
|
||||
make.top.equalToSuperview().offset(WalletTokens.cardPadding)
|
||||
make.leading.trailing.equalToSuperview().inset(WalletTokens.cardPadding)
|
||||
}
|
||||
tableView.snp.makeConstraints { make in
|
||||
make.top.equalTo(title.snp.bottom).offset(12)
|
||||
make.leading.trailing.bottom.equalToSuperview().inset(16)
|
||||
make.top.equalTo(title.snp.bottom).offset(WalletTokens.rowGap)
|
||||
make.leading.trailing.bottom.equalToSuperview().inset(WalletTokens.cardPadding)
|
||||
}
|
||||
return recordCard
|
||||
}
|
||||
@ -276,7 +324,8 @@ final class PointsRedemptionViewController: BaseViewController, UITableViewDeleg
|
||||
}
|
||||
|
||||
@objc private func refreshPulled() {
|
||||
Task { await viewModel.loadInitial(api: walletAPI) }
|
||||
Task { await viewModel.refreshOverview(api: walletAPI) }
|
||||
Task { await viewModel.refreshWithdrawList(api: walletAPI) }
|
||||
}
|
||||
|
||||
@objc private func submitTapped() {
|
||||
@ -301,9 +350,11 @@ private final class PointWithdrawRecordCell: UITableViewCell {
|
||||
private let amountLabel = UILabel()
|
||||
private let timeLabel = UILabel()
|
||||
private let progressView = UIProgressView(progressViewStyle: .bar)
|
||||
private let percentLabel = UILabel()
|
||||
private let stepsStack = UIStackView()
|
||||
private let infoLabel = UILabel()
|
||||
private let statusLabel = UILabel()
|
||||
private let remarkLabel = UILabel()
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
@ -329,41 +380,52 @@ private final class PointWithdrawRecordCell: UITableViewCell {
|
||||
progressView.progress = Float(progress) / 100.0
|
||||
progressView.progressTintColor = style.progress
|
||||
progressView.isHidden = progress == 0
|
||||
percentLabel.isHidden = progress == 0
|
||||
stepsStack.isHidden = progress == 0
|
||||
percentLabel.text = "\(progress)%"
|
||||
configureSteps(progress: progress, tint: style.progress)
|
||||
infoLabel.text = infoText(for: record)
|
||||
remarkLabel.text = record.rejectReason.isEmpty ? "" : "备注信息:\(record.rejectReason)"
|
||||
remarkLabel.isHidden = record.rejectReason.isEmpty
|
||||
updateDynamicConstraints(progress: progress, showsRemark: !record.rejectReason.isEmpty)
|
||||
}
|
||||
|
||||
private func setupUI() {
|
||||
selectionStyle = .none
|
||||
backgroundColor = .white
|
||||
cardView.backgroundColor = .white
|
||||
cardView.layer.cornerRadius = 16
|
||||
cardView.layer.cornerRadius = WalletTokens.contentRadius
|
||||
cardView.layer.borderWidth = 1
|
||||
cardView.layer.borderColor = UIColor(hex: 0xF3F4F6).cgColor
|
||||
cardView.layer.borderColor = WalletTokens.cardBorder.cgColor
|
||||
cardView.clipsToBounds = true
|
||||
pointsLabel.font = .systemFont(ofSize: 18, weight: .medium)
|
||||
pointsLabel.textColor = .black
|
||||
amountLabel.font = .systemFont(ofSize: 18, weight: .medium)
|
||||
amountLabel.textColor = UIColor(hex: 0xEF4444)
|
||||
pointsLabel.font = WalletTokens.metricMediumFont
|
||||
pointsLabel.textColor = WalletTokens.textPrimary
|
||||
amountLabel.font = WalletTokens.metricMediumFont
|
||||
amountLabel.textColor = WalletTokens.danger
|
||||
amountLabel.textAlignment = .right
|
||||
timeLabel.font = .systemFont(ofSize: 14)
|
||||
timeLabel.textColor = UIColor(hex: 0x7B8EAA)
|
||||
progressView.trackTintColor = UIColor(hex: 0xF2F4F8)
|
||||
timeLabel.font = WalletTokens.bodyFont
|
||||
timeLabel.textColor = WalletTokens.textMuted
|
||||
progressView.trackTintColor = WalletTokens.progressTrack
|
||||
progressView.layer.cornerRadius = 3
|
||||
progressView.clipsToBounds = true
|
||||
percentLabel.font = WalletTokens.bodyMediumFont
|
||||
percentLabel.textColor = WalletTokens.textTertiary
|
||||
percentLabel.textAlignment = .right
|
||||
stepsStack.axis = .horizontal
|
||||
stepsStack.distribution = .equalSpacing
|
||||
statusLabel.font = .systemFont(ofSize: 12)
|
||||
statusLabel.font = WalletTokens.captionFont
|
||||
statusLabel.textAlignment = .center
|
||||
statusLabel.layer.cornerRadius = 4
|
||||
statusLabel.layer.cornerRadius = WalletTokens.chipRadius
|
||||
statusLabel.clipsToBounds = true
|
||||
infoLabel.font = .systemFont(ofSize: 14)
|
||||
infoLabel.textColor = UIColor(hex: 0x4B5563)
|
||||
infoLabel.font = WalletTokens.bodyFont
|
||||
infoLabel.textColor = WalletTokens.textSecondary
|
||||
infoLabel.numberOfLines = 0
|
||||
remarkLabel.font = WalletTokens.bodyFont
|
||||
remarkLabel.textColor = WalletTokens.danger
|
||||
remarkLabel.numberOfLines = 0
|
||||
|
||||
contentView.addSubview(cardView)
|
||||
[pointsLabel, amountLabel, timeLabel, progressView, stepsStack, infoLabel, statusLabel].forEach(cardView.addSubview)
|
||||
[pointsLabel, amountLabel, timeLabel, progressView, percentLabel, stepsStack, infoLabel, statusLabel, remarkLabel].forEach(cardView.addSubview)
|
||||
|
||||
cardView.snp.makeConstraints { make in
|
||||
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 6, left: 0, bottom: 6, right: 0))
|
||||
@ -382,25 +444,47 @@ private final class PointWithdrawRecordCell: UITableViewCell {
|
||||
}
|
||||
progressView.snp.makeConstraints { make in
|
||||
make.top.equalTo(timeLabel.snp.bottom).offset(12)
|
||||
make.leading.trailing.equalToSuperview().inset(16)
|
||||
make.height.equalTo(6)
|
||||
make.leading.equalToSuperview().offset(WalletTokens.cardPadding)
|
||||
make.trailing.equalTo(percentLabel.snp.leading).offset(-WalletTokens.rowGap)
|
||||
make.height.equalTo(WalletTokens.progressHeight)
|
||||
}
|
||||
percentLabel.snp.makeConstraints { make in
|
||||
make.centerY.equalTo(progressView)
|
||||
make.trailing.equalToSuperview().inset(WalletTokens.cardPadding)
|
||||
}
|
||||
stepsStack.snp.makeConstraints { make in
|
||||
make.top.equalTo(progressView.snp.bottom).offset(8)
|
||||
make.leading.trailing.equalToSuperview().inset(16)
|
||||
}
|
||||
infoLabel.snp.makeConstraints { make in
|
||||
make.top.equalTo(stepsStack.snp.bottom).offset(10)
|
||||
make.leading.equalToSuperview().offset(16)
|
||||
make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-8)
|
||||
make.bottom.equalToSuperview().inset(14)
|
||||
}
|
||||
statusLabel.snp.makeConstraints { make in
|
||||
make.centerY.equalTo(infoLabel)
|
||||
make.trailing.equalToSuperview().inset(16)
|
||||
make.height.equalTo(22)
|
||||
make.width.greaterThanOrEqualTo(70)
|
||||
}
|
||||
updateDynamicConstraints(progress: 0, showsRemark: false)
|
||||
}
|
||||
|
||||
private func updateDynamicConstraints(progress: Int, showsRemark: Bool) {
|
||||
infoLabel.snp.remakeConstraints { make in
|
||||
if progress > 0 {
|
||||
make.top.equalTo(stepsStack.snp.bottom).offset(WalletTokens.compactGap)
|
||||
} else {
|
||||
make.top.equalTo(timeLabel.snp.bottom).offset(WalletTokens.compactGap)
|
||||
}
|
||||
make.leading.equalToSuperview().offset(WalletTokens.cardPadding)
|
||||
make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-WalletTokens.compactGap)
|
||||
if !showsRemark {
|
||||
make.bottom.equalToSuperview().inset(14)
|
||||
}
|
||||
}
|
||||
remarkLabel.snp.remakeConstraints { make in
|
||||
make.top.equalTo(infoLabel.snp.bottom).offset(WalletTokens.tinyGap)
|
||||
make.leading.trailing.equalToSuperview().inset(WalletTokens.cardPadding)
|
||||
if showsRemark {
|
||||
make.bottom.equalToSuperview().inset(14)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func configureSteps(progress: Int, tint: UIColor) {
|
||||
@ -408,15 +492,10 @@ private final class PointWithdrawRecordCell: UITableViewCell {
|
||||
["提交申请", "审核中", "打款中", "已完成"].enumerated().forEach { index, title in
|
||||
let label = UILabel()
|
||||
label.text = title
|
||||
label.font = .systemFont(ofSize: 11)
|
||||
label.textColor = progress >= Int((Float(index) / 3.0) * 100) ? tint : UIColor(hex: 0x7B8EAA)
|
||||
label.font = WalletTokens.stepFont
|
||||
label.textColor = progress >= Int((Float(index) / 3.0) * 100) ? tint : WalletTokens.textMuted
|
||||
stepsStack.addArrangedSubview(label)
|
||||
}
|
||||
let percent = UILabel()
|
||||
percent.text = "\(progress)%"
|
||||
percent.font = .systemFont(ofSize: 12, weight: .medium)
|
||||
percent.textColor = UIColor(hex: 0x9CA3AF)
|
||||
stepsStack.addArrangedSubview(percent)
|
||||
}
|
||||
|
||||
private func statusText(for status: Int) -> String {
|
||||
@ -431,13 +510,13 @@ private final class PointWithdrawRecordCell: UITableViewCell {
|
||||
private func statusStyle(for status: Int) -> (background: UIColor, text: UIColor, progress: UIColor) {
|
||||
switch status {
|
||||
case 2:
|
||||
(UIColor(hex: 0xF0FDF4), UIColor(hex: 0x22C55E), UIColor(hex: 0x1677FF))
|
||||
(WalletTokens.successBackground, WalletTokens.success, WalletTokens.summaryBackground)
|
||||
case 1:
|
||||
(UIColor(hex: 0xFFF0E2), UIColor(hex: 0xFF7B00), UIColor(hex: 0x1677FF))
|
||||
(WalletTokens.pointsPendingBackground, WalletTokens.points, WalletTokens.summaryBackground)
|
||||
case 3:
|
||||
(UIColor(hex: 0xFFE7E7), UIColor(hex: 0xEF4444), UIColor(hex: 0xFF4D4F))
|
||||
(WalletTokens.dangerBackground, WalletTokens.danger, WalletTokens.progressDanger)
|
||||
default:
|
||||
(UIColor(hex: 0xE6F1FF), UIColor(hex: 0x1677FF), UIColor(hex: 0x1677FF))
|
||||
(WalletTokens.infoBackground, WalletTokens.summaryBackground, WalletTokens.summaryBackground)
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,8 +531,7 @@ private final class PointWithdrawRecordCell: UITableViewCell {
|
||||
private func infoText(for record: PointWithdrawItem) -> String {
|
||||
switch record.status {
|
||||
case 3:
|
||||
let remark = record.rejectReason.isEmpty ? "" : "\n备注信息:\(record.rejectReason)"
|
||||
return "审核时间:\(record.reviewedAt.isEmpty ? "暂无" : record.reviewedAt)\(remark)"
|
||||
return "审核时间:\(record.reviewedAt.isEmpty ? "暂无" : record.reviewedAt)"
|
||||
case 2:
|
||||
return "到账时间:\(record.paymentTime.isEmpty ? "暂无" : record.paymentTime)"
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user