添加景区选择与合作订单流程并对齐 Android

This commit is contained in:
2026-07-07 10:48:43 +08:00
parent ef1d3b4af5
commit c4057537d2
50 changed files with 5603 additions and 191 deletions

View File

@ -0,0 +1,106 @@
//
// OrderSourceLeadCell.swift
// suixinkan
//
import SnapKit
import UIKit
/// cell Android `SourceLeadItem`
final class OrderSourceLeadCell: UITableViewCell {
static let reuseIdentifier = "OrderSourceLeadCell"
var onCallPhone: ((String) -> Void)?
var onImageTap: (([String], Int) -> Void)?
var onSelect: (() -> Void)?
private let cardView = UIView()
private let tagLabel = UILabel()
private let checkView = UIImageView()
private let contentViewPanel = OrderSourceLeadContentView()
private let actionButton = UIButton(type: .system)
private var currentImages: [String] = []
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .clear
contentView.backgroundColor = .clear
setupUI()
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func configure(lead: OrderSourceLead, selected: Bool) {
currentImages = lead.images
contentViewPanel.apply(lead: lead, compact: false, enablePhoneCall: true)
contentViewPanel.onCallPhone = { [weak self] phone in self?.onCallPhone?(phone) }
contentViewPanel.onImageTap = { [weak self] images, index in
self?.onImageTap?(images, index)
}
checkView.isHidden = !selected
cardView.layer.borderColor = (selected ? AppColor.primary : OrderTokens.sourceBorder).cgColor
cardView.backgroundColor = selected ? AppColor.primaryLight.withAlphaComponent(0.4) : .white
actionButton.setTitle(selected ? "当前已选择" : "选择此带客单", for: .normal)
actionButton.setTitleColor(selected ? AppColor.primary : .white, for: .normal)
actionButton.backgroundColor = selected ? AppColor.primaryLight : AppColor.primary
}
private func setupUI() {
cardView.layer.cornerRadius = AppRadius.sm
cardView.layer.borderWidth = 1
contentView.addSubview(cardView)
tagLabel.text = "带客单"
tagLabel.font = .systemFont(ofSize: 13, weight: .medium)
tagLabel.textColor = AppColor.primary
tagLabel.backgroundColor = AppColor.primaryLight.withAlphaComponent(0.8)
tagLabel.layer.cornerRadius = 4
tagLabel.clipsToBounds = true
tagLabel.textAlignment = .center
checkView.image = UIImage(systemName: "checkmark")
checkView.tintColor = AppColor.primary
checkView.contentMode = .scaleAspectFit
actionButton.titleLabel?.font = .systemFont(ofSize: 14)
actionButton.layer.cornerRadius = 6
actionButton.addTarget(self, action: #selector(selectTapped), for: .touchUpInside)
cardView.addSubview(tagLabel)
cardView.addSubview(checkView)
cardView.addSubview(contentViewPanel)
cardView.addSubview(actionButton)
cardView.snp.makeConstraints { make in
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 0, bottom: 12, right: 0))
}
tagLabel.snp.makeConstraints { make in
make.leading.top.equalToSuperview().inset(12)
make.height.equalTo(24)
make.width.greaterThanOrEqualTo(56)
}
checkView.snp.makeConstraints { make in
make.trailing.equalToSuperview().inset(12)
make.centerY.equalTo(tagLabel)
make.width.height.equalTo(20)
}
contentViewPanel.snp.makeConstraints { make in
make.top.equalTo(tagLabel.snp.bottom).offset(10)
make.leading.trailing.equalToSuperview().inset(12)
}
actionButton.snp.makeConstraints { make in
make.top.equalTo(contentViewPanel.snp.bottom).offset(10)
make.leading.trailing.bottom.equalToSuperview().inset(12)
make.height.equalTo(40)
}
}
@objc private func selectTapped() {
onSelect?()
}
}