|
@@ -26,11 +26,11 @@ class ShoppingCartListTableViewCell: UITableViewCell {
|
|
|
didSet {
|
|
|
// 已下架
|
|
|
if productMdl?.upStatus == 0 {
|
|
|
- self.resetButtonWithTitle("已下架")
|
|
|
+ self.resetDisableWithTitle("已下架")
|
|
|
}
|
|
|
// 已售罄
|
|
|
if productMdl?.stock == 0 {
|
|
|
- self.resetButtonWithTitle("已售罄")
|
|
|
+ self.resetDisableWithTitle("已售罄")
|
|
|
}
|
|
|
|
|
|
// 选中状态
|
|
@@ -82,6 +82,7 @@ class ShoppingCartListTableViewCell: UITableViewCell {
|
|
|
self.selectionStyle = .none
|
|
|
backgroundColor = kf7f8faColor
|
|
|
addSubview(bgView)
|
|
|
+ bgView.addSubview(disableLabel)
|
|
|
bgView.addSubview(selectedButton)
|
|
|
bgView.addSubview(iconImageView)
|
|
|
bgView.addSubview(titleLabel)
|
|
@@ -101,12 +102,15 @@ class ShoppingCartListTableViewCell: UITableViewCell {
|
|
|
make.right.equalTo(-14 * kScaleWidth)
|
|
|
make.height.equalTo(148)
|
|
|
}
|
|
|
- selectedButton.snp.makeConstraints { (make) in
|
|
|
+ disableLabel.snp.makeConstraints { (make) in
|
|
|
make.left.equalToSuperview()
|
|
|
make.top.equalTo(50)
|
|
|
make.width.equalTo(36)
|
|
|
make.height.equalTo(20)
|
|
|
}
|
|
|
+ selectedButton.snp.makeConstraints { (make) in
|
|
|
+ make.edges.equalTo(disableLabel.snp_edges)
|
|
|
+ }
|
|
|
iconImageView.snp.makeConstraints { (make) in
|
|
|
make.left.equalToSuperview().offset(40)
|
|
|
make.centerY.equalToSuperview()
|
|
@@ -158,20 +162,15 @@ class ShoppingCartListTableViewCell: UITableViewCell {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private func resetButtonWithTitle(_ title: String) {
|
|
|
+ private func resetDisableWithTitle(_ title: String) {
|
|
|
deliveryTime.isHidden = true
|
|
|
plusButton.isHidden = true
|
|
|
numberLabel.isHidden = true
|
|
|
reduceButton.isHidden = true
|
|
|
|
|
|
- selectedButton.setImage(kImage(name: ""), for: UIControl.State.normal)
|
|
|
- selectedButton.setTitle(title, for: .normal)
|
|
|
- selectedButton.setTitleColor(k333333Color, for: .normal)
|
|
|
- selectedButton.titleLabel?.font = kRegularFont10
|
|
|
- selectedButton.backgroundColor = kf5f5f5Color
|
|
|
- selectedButton.cornerRadius = 10
|
|
|
- selectedButton.masksToBounds = true
|
|
|
- selectedButton.isUserInteractionEnabled = false
|
|
|
+ disableLabel.text = title
|
|
|
+ disableLabel.isHidden = false
|
|
|
+ selectedButton.isHidden = true
|
|
|
}
|
|
|
|
|
|
private lazy var selectedButton: UIButton = {
|
|
@@ -188,6 +187,16 @@ class ShoppingCartListTableViewCell: UITableViewCell {
|
|
|
|
|
|
return selectedButton
|
|
|
}()
|
|
|
+
|
|
|
+ private lazy var disableLabel: UILabel = {
|
|
|
+ let disableLabel = UILabel()
|
|
|
+ disableLabel.textColor = k333333Color
|
|
|
+ disableLabel.font = kRegularFont10
|
|
|
+ disableLabel.backgroundColor = kf5f5f5Color
|
|
|
+ disableLabel.cornerRadius = 10
|
|
|
+ disableLabel.masksToBounds = true
|
|
|
+ return disableLabel
|
|
|
+ }()
|
|
|
|
|
|
private lazy var iconImageView: UIImageView = {
|
|
|
let iconImageView = UIImageView()
|