// // QSLActivityVipCell.swift // QuickSearchLocation // // Created by Destiny on 2025/9/23. // import UIKit class QSLActivityVipCell: UICollectionViewCell { struct UX { static let topMainViewWidth = (QSLConst.qsl_kScreenW - 32.0.rpx) static let topMainViewHeight = 112.0.rpx static let smallMainViewWidth = (QSLConst.qsl_kScreenW-50.rpx)/2.0 static let smallMainViewHeight = 112.0.rpx static let bigMainViewWidth = (QSLConst.qsl_kScreenW - 32.0.rpx) static let bigMainViewHeight = 72.0.rpx } var type: GoodCellType = .small { didSet { self.updateUI() } } var goodModel: QSLGoodModel? lazy var bgView: UIImageView = { let view = UIImageView() return view }() lazy var mainView: UIView = { let view = UIView(frame: CGRect(x: 0, y: 0, width: UX.smallMainViewWidth, height: UX.smallMainViewHeight)) view.addFourCorner(topLeft: 11, topRight: 11, bottomLeft: 0, bottomRight: 0) view.backgroundColor = .white return view }() lazy var goodNameLabel: UILabel = { let label = UILabel() label.text("年度会员") label.boldFont(16) label.textColor = .hexStringColor(hexString: "#333333") return label }() lazy var priceLabel: UILabel = { let label = UILabel() label.textAlignment = .center label.text("¥128") label.mediumFont(24) label.textColor = .hexStringColor(hexString: "#404040") label.setSpecificTextColorFont("¥", color: .hexStringColor(hexString: "#404040"), font: UIFont.systemFont(ofSize: 14, weight: .medium)) return label }() lazy var originPriceLabel: UILabel = { let label = UILabel() label.text("¥299") label.font(13) label.textAlignment = .center label.textColor = .hexStringColor(hexString: "#96BEBA") label.centerLineText(lineValue: 1, underlineColor: .hexStringColor(hexString: "#96BEBA")) return label }() lazy var goodDailyPriceLabel: UILabel = { let label = UILabel() let text = "仅需¥9.2/天,时刻守护Ta的安全" label.text(text) label.font(9) label.textColor = .hexStringColor(hexString: "#5EA69D") label.setSpecificTextColorFont("¥", color: .hexStringColor(hexString: "#5EA69D"), font: UIFont.systemFont(ofSize: 9, weight: .heavy)) if let yuanIndex = text.firstIndex(of: "¥") { // 获取文本最后一位的index let lastIndex = text.index(before: text.endIndex) // 创建从¥后面一个字符到文本最后一位的range let contentRange = text.index(after: yuanIndex)..