|
@@ -0,0 +1,149 @@
|
|
|
+//
|
|
|
+// ShoppingCartPayOrderItemCell.swift
|
|
|
+// RainbowPlanet
|
|
|
+//
|
|
|
+// Created by Christopher on 2019/5/9.
|
|
|
+// Copyright © 2019 RainbowPlanet. All rights reserved.
|
|
|
+// 订单支付--商品列表Cell
|
|
|
+
|
|
|
+import UIKit
|
|
|
+
|
|
|
+class ShoppingCartPayOrderItemCell: UITableViewCell {
|
|
|
+
|
|
|
+ override var frame: CGRect {
|
|
|
+ get {
|
|
|
+ return super.frame
|
|
|
+ }
|
|
|
+ set {
|
|
|
+ var frame = newValue
|
|
|
+ frame.origin.x += 14 * kScaleWidth
|
|
|
+ frame.size.width -= 14 * kScaleWidth * 2
|
|
|
+ super.frame = frame
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ShoppingCartPayOrderItemCell {
|
|
|
+ let ID = "ShoppingCartPayOrderItemCell"
|
|
|
+ tableView.register(ShoppingCartPayOrderItemCell.self, forCellReuseIdentifier: ID)
|
|
|
+ let cell : ShoppingCartPayOrderItemCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! ShoppingCartPayOrderItemCell
|
|
|
+ cell.indexPath = indexPath
|
|
|
+ return cell
|
|
|
+ }
|
|
|
+
|
|
|
+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
|
|
+ super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
|
+ setupViews()
|
|
|
+ setupLayouts()
|
|
|
+ }
|
|
|
+
|
|
|
+ required init?(coder aDecoder: NSCoder) {
|
|
|
+ fatalError("init(coder:) has not been implemented")
|
|
|
+ }
|
|
|
+
|
|
|
+ var indexPath: IndexPath? {
|
|
|
+ didSet {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //MRAK: - 设置View
|
|
|
+ private func setupViews() {
|
|
|
+ self.selectionStyle = .none
|
|
|
+ // cornerRadius = 4
|
|
|
+ // masksToBounds = true
|
|
|
+
|
|
|
+ addSubview(iconImagView)
|
|
|
+ addSubview(titleLabel)
|
|
|
+ addSubview(deliveryTime)
|
|
|
+ addSubview(sellScaleLabel)
|
|
|
+ addSubview(sellNumberLabel)
|
|
|
+ addSubview(sellPriceLabel)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private func setupLayouts() {
|
|
|
+ iconImagView.snp.makeConstraints { (make) in
|
|
|
+ make.top.left.equalToSuperview().offset(14)
|
|
|
+ make.width.height.equalTo(92)
|
|
|
+ make.bottom.equalToSuperview().offset(-14)
|
|
|
+ }
|
|
|
+ titleLabel.snp.makeConstraints { (make) in
|
|
|
+ make.left.equalTo(iconImagView.snp_right).offset(10)
|
|
|
+ make.top.equalTo(14)
|
|
|
+ make.right.equalTo(-26)
|
|
|
+ make.height.equalTo(20)
|
|
|
+ }
|
|
|
+ deliveryTime.snp.makeConstraints { (make) in
|
|
|
+ make.top.equalTo(titleLabel.snp.bottom).offset(8)
|
|
|
+ make.right.left.equalTo(titleLabel)
|
|
|
+ make.height.equalTo(17)
|
|
|
+ }
|
|
|
+ sellScaleLabel.snp.makeConstraints { (make) in
|
|
|
+ make.top.equalTo(deliveryTime.snp.bottom).offset(8)
|
|
|
+ make.left.right.equalTo(deliveryTime)
|
|
|
+ make.height.equalTo(17)
|
|
|
+ }
|
|
|
+ sellNumberLabel.snp.makeConstraints { (make) in
|
|
|
+ make.top.equalTo(sellScaleLabel.snp.bottom).offset(4)
|
|
|
+ make.left.equalTo(sellScaleLabel)
|
|
|
+ make.height.equalTo(17)
|
|
|
+ }
|
|
|
+ sellPriceLabel.snp.remakeConstraints { (make) in
|
|
|
+ make.right.equalTo(-14)
|
|
|
+ make.height.equalTo(20)
|
|
|
+ make.centerY.equalTo(sellNumberLabel)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private lazy var iconImagView: UIImageView = {
|
|
|
+ let iconImagView = UIImageView()
|
|
|
+ iconImagView.image = kImage(name: "pic_preload")
|
|
|
+ return iconImagView
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var titleLabel: UILabel = {
|
|
|
+ let titleLabel = UILabel()
|
|
|
+ titleLabel.text = "妈妈冬装外套棉袄短款"
|
|
|
+ titleLabel.textColor = k333333Color
|
|
|
+ titleLabel.font = kBoldFont14
|
|
|
+ titleLabel.textAlignment = .left
|
|
|
+ titleLabel.numberOfLines = 1
|
|
|
+ return titleLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var deliveryTime: UILabel = {
|
|
|
+ let deliveryTime = UILabel()
|
|
|
+ deliveryTime.text = "预计配送时间:次日达"
|
|
|
+ deliveryTime.textColor = k666666Color
|
|
|
+ deliveryTime.font = kRegularFont12
|
|
|
+ deliveryTime.textAlignment = .left
|
|
|
+ return deliveryTime
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var sellScaleLabel: UILabel = {
|
|
|
+ let sellScaleLabel = UILabel()
|
|
|
+ sellScaleLabel.text = "规格:3个装"
|
|
|
+ sellScaleLabel.textColor = k999999Color
|
|
|
+ sellScaleLabel.font = kRegularFont12
|
|
|
+ return sellScaleLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var sellNumberLabel: UILabel = {
|
|
|
+ let sellNumberLabel = UILabel()
|
|
|
+ sellNumberLabel.text = "x1"
|
|
|
+ sellNumberLabel.textColor = k999999Color
|
|
|
+ sellNumberLabel.font = kRegularFont12
|
|
|
+ return sellNumberLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var sellPriceLabel: UILabel = {
|
|
|
+ let sellPriceLabel = UILabel()
|
|
|
+ sellPriceLabel.text = "¥258"
|
|
|
+ sellPriceLabel.textColor = k333333Color
|
|
|
+ sellPriceLabel.font = kRegularFont14
|
|
|
+ sellPriceLabel.textAlignment = .left
|
|
|
+ return sellPriceLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+}
|