// // HomeStoreCardView.swift // suixinkan // import SnapKit import UIKit /// 店铺管理员门店信息卡片。 final class HomeStoreCardView: UIView { private let nameLabel = UILabel() private let addressLabel = UILabel() private let statusLabel = UILabel() override init(frame: CGRect) { super.init(frame: frame) backgroundColor = AppColor.cardBackground layer.cornerRadius = AppRadius.md nameLabel.font = .app(.title) nameLabel.textColor = AppColor.textPrimary addressLabel.font = .app(.body) addressLabel.textColor = AppColor.textSecondary addressLabel.numberOfLines = 2 statusLabel.font = .app(.captionMedium) statusLabel.textColor = AppColor.primary addSubview(nameLabel) addSubview(addressLabel) addSubview(statusLabel) nameLabel.snp.makeConstraints { make in make.top.leading.equalToSuperview().offset(AppSpacing.screenHorizontalInset) make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-AppSpacing.xs) } statusLabel.snp.makeConstraints { make in make.top.equalToSuperview().offset(AppSpacing.screenHorizontalInset) make.trailing.equalToSuperview().offset(-AppSpacing.screenHorizontalInset) } addressLabel.snp.makeConstraints { make in make.top.equalTo(nameLabel.snp.bottom).offset(AppSpacing.xs) make.leading.trailing.equalToSuperview().inset(AppSpacing.screenHorizontalInset) make.bottom.equalToSuperview().offset(-AppSpacing.screenHorizontalInset) } } @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func apply(store: StoreItem) { nameLabel.text = store.name addressLabel.text = store.address statusLabel.text = store.statusText.isEmpty ? "营业中" : store.statusText } }