MoviaBox/MoviaBox/Class/Wallet/View/SPCoinOrderRecordCell.swift

90 lines
2.4 KiB
Swift

//
// SPCoinOrderRecordCell.swift
// MoviaBox
//
// Created by on 2025/4/29.
//
import UIKit
class SPCoinOrderRecordCell: SPTableViewCell {
var model: SPRechargeRecordModel? {
didSet {
titleLabel.text = "Recharge Coins".localized
timeLabel.text = model?.created_at
coinLabel.text = "+\(model?.value ?? "0")"
}
}
//MARK: UI
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = .fontMedium(ofSize: 16)
label.textColor = .colorFF3232()
return label
}()
private lazy var timeLabel: UILabel = {
let label = UILabel()
label.font = .fontRegular(ofSize: 14)
label.textColor = .colorFFFFFF()
return label
}()
private lazy var coinLabel: UILabel = {
let label = UILabel()
label.font = .fontMedium(ofSize: 16)
label.textColor = .colorFF3232()
return label
}()
private lazy var coinImageView: UIImageView = {
let imageView = UIImageView(image: UIImage(named: "coin_icon_06"))
return imageView
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
_setupUI()
}
@MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension SPCoinOrderRecordCell {
private func _setupUI() {
contentView.addSubview(titleLabel)
contentView.addSubview(timeLabel)
contentView.addSubview(coinLabel)
contentView.addSubview(coinImageView)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(32)
make.top.equalToSuperview().offset(15)
}
timeLabel.snp.makeConstraints { make in
make.left.equalTo(titleLabel)
make.bottom.equalToSuperview().offset(-15)
}
coinImageView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(coinLabel.snp.left).offset(-4)
}
coinLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-25)
}
}
}