ThimraTV/MoviaBox/Class/Wallet/View/SPConsumptionRecordsCell.swift
2025-05-13 13:54:39 +08:00

94 lines
2.6 KiB
Swift

//
// SPConsumptionRecordsCell.swift
// MoviaBox
//
// Created by on 2025/4/29.
//
import UIKit
class SPConsumptionRecordsCell: SPTableViewCell {
var model: SPBuyRecordsModel? {
didSet {
titleLabel.text = "movia_Purchase_Single_Episode".localized
timeLabel.text = model?.created_at
let episode = String(format: "movia_text_episcode_ios".localized, "\(model?.episode ?? "0")") + "\(model?.name ?? "")"
desLabel.text = episode
coinLabel.text = "-\(model?.coins ?? 0) " + "movia_profile_Coins".localized
}
}
//MARK: UI
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = .fontRegular(ofSize: 12)
label.textColor = .colorFF3232()
return label
}()
private lazy var timeLabel: UILabel = {
let label = UILabel()
label.font = .fontRegular(ofSize: 12)
label.textColor = .colorFFFFFF()
return label
}()
private lazy var desLabel: UILabel = {
let label = UILabel()
label.font = .fontRegular(ofSize: 12)
label.textColor = .colorFFFFFF()
return label
}()
private lazy var coinLabel: UILabel = {
let label = UILabel()
label.font = .fontRegular(ofSize: 12)
label.textColor = .colorFF3232()
return label
}()
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 SPConsumptionRecordsCell {
private func _setupUI() {
contentView.addSubview(titleLabel)
contentView.addSubview(timeLabel)
contentView.addSubview(desLabel)
contentView.addSubview(coinLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(32)
make.top.equalToSuperview().offset(16)
}
timeLabel.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-32)
make.centerY.equalTo(titleLabel)
}
desLabel.snp.makeConstraints { make in
make.left.equalTo(titleLabel)
make.bottom.equalToSuperview().offset(-16)
make.width.lessThanOrEqualTo(kSPScreenWidth - 190)
}
coinLabel.snp.makeConstraints { make in
make.centerY.equalTo(desLabel)
make.right.equalTo(timeLabel)
}
}
}