删除没用的卡片
This commit is contained in:
@@ -9,18 +9,16 @@ import UIKit
|
|||||||
/// 日清列表的分区。
|
/// 日清列表的分区。
|
||||||
enum OfflineDailyListSection: Hashable {
|
enum OfflineDailyListSection: Hashable {
|
||||||
case records
|
case records
|
||||||
case batches
|
|
||||||
case empty
|
case empty
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 日清列表的条目数据。
|
/// 日清列表的条目数据。
|
||||||
enum OfflineDailyListItem: Hashable {
|
enum OfflineDailyListItem: Hashable {
|
||||||
case record(OfflineCollectionRecord)
|
case record(OfflineCollectionRecord)
|
||||||
case batch(OfflineSettlementBatch)
|
|
||||||
case empty(isToday: Bool)
|
case empty(isToday: Bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 线下收款日清页,展示单营业日汇总、明细与独立补缴流水。
|
/// 线下收款日清页,展示单营业日汇总、收款明细与补缴操作。
|
||||||
final class OfflineCollectionDailyViewController: BaseViewController {
|
final class OfflineCollectionDailyViewController: BaseViewController {
|
||||||
private let viewModel: OfflineCollectionDailyViewModel
|
private let viewModel: OfflineCollectionDailyViewModel
|
||||||
|
|
||||||
@@ -137,7 +135,6 @@ final class OfflineCollectionDailyViewController: BaseViewController {
|
|||||||
tableView.estimatedRowHeight = 92
|
tableView.estimatedRowHeight = 92
|
||||||
tableView.delegate = self
|
tableView.delegate = self
|
||||||
tableView.register(OfflineCollectionRecordCell.self, forCellReuseIdentifier: OfflineCollectionRecordCell.reuseIdentifier)
|
tableView.register(OfflineCollectionRecordCell.self, forCellReuseIdentifier: OfflineCollectionRecordCell.reuseIdentifier)
|
||||||
tableView.register(OfflineSettlementBatchCell.self, forCellReuseIdentifier: OfflineSettlementBatchCell.reuseIdentifier)
|
|
||||||
tableView.register(OfflineCollectionEmptyCell.self, forCellReuseIdentifier: OfflineCollectionEmptyCell.reuseIdentifier)
|
tableView.register(OfflineCollectionEmptyCell.self, forCellReuseIdentifier: OfflineCollectionEmptyCell.reuseIdentifier)
|
||||||
dataSource = makeDataSource()
|
dataSource = makeDataSource()
|
||||||
|
|
||||||
@@ -264,11 +261,6 @@ final class OfflineCollectionDailyViewController: BaseViewController {
|
|||||||
snapshot.appendSections([.records])
|
snapshot.appendSections([.records])
|
||||||
snapshot.appendItems(viewModel.records.map(OfflineDailyListItem.record), toSection: .records)
|
snapshot.appendItems(viewModel.records.map(OfflineDailyListItem.record), toSection: .records)
|
||||||
}
|
}
|
||||||
if !viewModel.batches.isEmpty {
|
|
||||||
currentSections.append(.batches)
|
|
||||||
snapshot.appendSections([.batches])
|
|
||||||
snapshot.appendItems(viewModel.batches.map(OfflineDailyListItem.batch), toSection: .batches)
|
|
||||||
}
|
|
||||||
dataSource.apply(snapshot, animatingDifferences: view.window != nil)
|
dataSource.apply(snapshot, animatingDifferences: view.window != nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,13 +274,6 @@ final class OfflineCollectionDailyViewController: BaseViewController {
|
|||||||
) as? OfflineCollectionRecordCell else { return UITableViewCell() }
|
) as? OfflineCollectionRecordCell else { return UITableViewCell() }
|
||||||
cell.apply(record: record)
|
cell.apply(record: record)
|
||||||
return cell
|
return cell
|
||||||
case let .batch(batch):
|
|
||||||
guard let cell = tableView.dequeueReusableCell(
|
|
||||||
withIdentifier: OfflineSettlementBatchCell.reuseIdentifier,
|
|
||||||
for: indexPath
|
|
||||||
) as? OfflineSettlementBatchCell else { return UITableViewCell() }
|
|
||||||
cell.apply(batch: batch)
|
|
||||||
return cell
|
|
||||||
case let .empty(isToday):
|
case let .empty(isToday):
|
||||||
guard let cell = tableView.dequeueReusableCell(
|
guard let cell = tableView.dequeueReusableCell(
|
||||||
withIdentifier: OfflineCollectionEmptyCell.reuseIdentifier,
|
withIdentifier: OfflineCollectionEmptyCell.reuseIdentifier,
|
||||||
@@ -404,7 +389,7 @@ extension OfflineCollectionDailyViewController: UITableViewDelegate {
|
|||||||
let container = UIView()
|
let container = UIView()
|
||||||
container.backgroundColor = AppColor.pageBackground
|
container.backgroundColor = AppColor.pageBackground
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.text = listSection == .records ? "线下收款明细" : "线下收款补缴流水"
|
label.text = "线下收款明细"
|
||||||
label.font = .systemFont(ofSize: 15, weight: .semibold)
|
label.font = .systemFont(ofSize: 15, weight: .semibold)
|
||||||
label.textColor = AppColor.textPrimary
|
label.textColor = AppColor.textPrimary
|
||||||
container.addSubview(label)
|
container.addSubview(label)
|
||||||
@@ -551,68 +536,6 @@ final class OfflineCollectionRecordCell: UITableViewCell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 线下收款补缴流水单元格。
|
|
||||||
final class OfflineSettlementBatchCell: UITableViewCell {
|
|
||||||
static let reuseIdentifier = "OfflineSettlementBatchCell"
|
|
||||||
|
|
||||||
private let cardView = UIView()
|
|
||||||
private let identifierLabel = UILabel()
|
|
||||||
private let amountLabel = UILabel()
|
|
||||||
private let detailLabel = UILabel()
|
|
||||||
|
|
||||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
||||||
setupUI()
|
|
||||||
}
|
|
||||||
|
|
||||||
@available(*, unavailable)
|
|
||||||
required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 用成功补缴流水刷新单元格。
|
|
||||||
func apply(batch: OfflineSettlementBatch) {
|
|
||||||
identifierLabel.text = batch.id
|
|
||||||
amountLabel.text = OfflineCollectionMoney.display(batch.amountFen)
|
|
||||||
detailLabel.text = "\(OfflineCollectionDate.dateTimeText(batch.paidAt)) · \(batch.payerName) · 关联 \(batch.recordCount) 笔"
|
|
||||||
}
|
|
||||||
|
|
||||||
private func setupUI() {
|
|
||||||
selectionStyle = .none
|
|
||||||
backgroundColor = .clear
|
|
||||||
contentView.backgroundColor = .clear
|
|
||||||
cardView.backgroundColor = UIColor(hex: 0xF4FBF7)
|
|
||||||
cardView.layer.cornerRadius = AppRadius.lg
|
|
||||||
cardView.layer.borderColor = UIColor(hex: 0xCDEED8).cgColor
|
|
||||||
cardView.layer.borderWidth = 1
|
|
||||||
|
|
||||||
identifierLabel.font = .systemFont(ofSize: 13, weight: .semibold)
|
|
||||||
identifierLabel.textColor = AppColor.success
|
|
||||||
amountLabel.font = .systemFont(ofSize: 18, weight: .bold)
|
|
||||||
amountLabel.textColor = AppColor.textPrimary
|
|
||||||
amountLabel.textAlignment = .right
|
|
||||||
detailLabel.font = .systemFont(ofSize: 12)
|
|
||||||
detailLabel.textColor = AppColor.textSecondary
|
|
||||||
detailLabel.numberOfLines = 0
|
|
||||||
|
|
||||||
let topRow = UIStackView(arrangedSubviews: [identifierLabel, amountLabel])
|
|
||||||
topRow.axis = .horizontal
|
|
||||||
topRow.distribution = .fillEqually
|
|
||||||
let stack = UIStackView(arrangedSubviews: [topRow, detailLabel])
|
|
||||||
stack.axis = .vertical
|
|
||||||
stack.spacing = AppSpacing.sm
|
|
||||||
cardView.addSubview(stack)
|
|
||||||
contentView.addSubview(cardView)
|
|
||||||
cardView.snp.makeConstraints { make in
|
|
||||||
make.top.bottom.equalToSuperview().inset(5)
|
|
||||||
make.leading.trailing.equalToSuperview().inset(AppSpacing.screenHorizontalInset)
|
|
||||||
}
|
|
||||||
stack.snp.makeConstraints { make in
|
|
||||||
make.edges.equalToSuperview().inset(AppSpacing.md)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 日清页在指定营业日无记录时展示的空状态单元格。
|
/// 日清页在指定营业日无记录时展示的空状态单元格。
|
||||||
final class OfflineCollectionEmptyCell: UITableViewCell {
|
final class OfflineCollectionEmptyCell: UITableViewCell {
|
||||||
static let reuseIdentifier = "OfflineCollectionEmptyCell"
|
static let reuseIdentifier = "OfflineCollectionEmptyCell"
|
||||||
|
|||||||
Reference in New Issue
Block a user