|
@@ -1,168 +0,0 @@
|
|
|
-//
|
|
|
-// AddressManagerExpressTableViewCell.swift
|
|
|
-// RainbowPlanet
|
|
|
-//
|
|
|
-// Created by 南鑫林 on 2019/4/25.
|
|
|
-// Copyright © 2019 南鑫林. All rights reserved.
|
|
|
-// Abandoned(May.27,2019)
|
|
|
-
|
|
|
-import UIKit
|
|
|
-
|
|
|
-class AddressManagerExpressTableViewCell: UITableViewCell {
|
|
|
-
|
|
|
- class func cellWith(tableView:UITableView,indexPath:IndexPath) -> AddressManagerExpressTableViewCell {
|
|
|
- let ID = "AddressManagerExpressTableViewCell"
|
|
|
- tableView.register(AddressManagerExpressTableViewCell.self, forCellReuseIdentifier: ID)
|
|
|
- let cell : AddressManagerExpressTableViewCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! AddressManagerExpressTableViewCell
|
|
|
- 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
|
|
|
- addSubview(nameLabel)
|
|
|
- addSubview(moblieLabel)
|
|
|
- addSubview(defalutLabel)
|
|
|
- addSubview(addressLabel)
|
|
|
- addSubview(selectedButton)
|
|
|
- addSubview(lineLabel)
|
|
|
- }
|
|
|
-
|
|
|
- private func setupLayouts() {
|
|
|
- nameLabel.snp.makeConstraints { (make) in
|
|
|
- make.top.equalTo(15)
|
|
|
- make.left.equalTo(52)
|
|
|
- make.height.equalTo(23)
|
|
|
- }
|
|
|
-
|
|
|
- moblieLabel.snp.makeConstraints { (make) in
|
|
|
- make.left.equalTo(nameLabel.snp.right).offset(10)
|
|
|
- make.centerY.equalTo(nameLabel)
|
|
|
- make.height.equalTo(20)
|
|
|
- }
|
|
|
-
|
|
|
- addressLabel.snp.remakeConstraints { (make) in
|
|
|
- make.top.equalTo(nameLabel.snp.bottom).offset(5)
|
|
|
- make.left.equalTo(92)
|
|
|
- make.right.equalTo(-14)
|
|
|
- make.bottom.equalTo(-15)
|
|
|
- }
|
|
|
-
|
|
|
- defalutLabel.snp.makeConstraints { (make) in
|
|
|
- make.left.equalTo(nameLabel)
|
|
|
- make.top.equalTo(addressLabel).offset(2)
|
|
|
- make.width.equalTo(36)
|
|
|
- make.height.equalTo(17)
|
|
|
- }
|
|
|
-
|
|
|
- selectedButton.snp.makeConstraints { (make) in
|
|
|
- make.left.equalTo(14)
|
|
|
- make.top.equalTo(addressLabel.snp.top)
|
|
|
- make.size.equalTo(16)
|
|
|
- }
|
|
|
-
|
|
|
- lineLabel.snp.makeConstraints { (make) in
|
|
|
- make.top.right.equalToSuperview()
|
|
|
- make.left.equalTo(14)
|
|
|
- make.height.equalTo(0.5)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private lazy var nameLabel: UILabel = {
|
|
|
- let nameLabel = UILabel()
|
|
|
- nameLabel.textColor = k333333Color
|
|
|
- nameLabel.font = kMediumFont16
|
|
|
- return nameLabel
|
|
|
- }()
|
|
|
-
|
|
|
- private lazy var moblieLabel: UILabel = {
|
|
|
- let moblieLabel = UILabel()
|
|
|
- moblieLabel.textColor = k999999Color
|
|
|
- moblieLabel.font = kRegularFont14
|
|
|
- return moblieLabel
|
|
|
- }()
|
|
|
-
|
|
|
- private lazy var defalutLabel: UILabel = {
|
|
|
- let defalutLabel = UILabel()
|
|
|
- defalutLabel.backgroundColor = kFFF1EBColor
|
|
|
- defalutLabel.text = "默认"
|
|
|
- defalutLabel.textColor = kFE5706Color
|
|
|
- defalutLabel.font = kRegularFont13
|
|
|
- defalutLabel.cornerRadius = 17/2
|
|
|
- defalutLabel.masksToBounds = true
|
|
|
- defalutLabel.textAlignment = .center
|
|
|
- return defalutLabel
|
|
|
- }()
|
|
|
-
|
|
|
- private lazy var selectedButton: UIButton = {
|
|
|
- let selectedButton = UIButton(type: UIButton.ButtonType.custom)
|
|
|
- selectedButton.setImage(kImage(name: "common_uncheck_icon"), for: UIControl.State.normal)
|
|
|
- selectedButton.setImage(kImage(name: "common_check_icon"), for: UIControl.State.selected)
|
|
|
- return selectedButton
|
|
|
- }()
|
|
|
-
|
|
|
- private lazy var addressLabel: UILabel = {
|
|
|
- let addressLabel = UILabel()
|
|
|
- addressLabel.text = "陕西省 西安市 雁塔区 曲江街道 翠华南路创意盒子"
|
|
|
- addressLabel.textColor = k333333Color
|
|
|
- addressLabel.font = kRegularFont14
|
|
|
- addressLabel.numberOfLines = 0
|
|
|
- return addressLabel
|
|
|
- }()
|
|
|
-
|
|
|
- private lazy var lineLabel: UILabel = {
|
|
|
- let lineLabel = UILabel()
|
|
|
- lineLabel.backgroundColor = kf5f5f5Color
|
|
|
- return lineLabel
|
|
|
- }()
|
|
|
-
|
|
|
- var expressAddresModel: ExpressAddresModel? {
|
|
|
- didSet {
|
|
|
- nameLabel.text = expressAddresModel?.contactName
|
|
|
- moblieLabel.text = expressAddresModel?.contactMobile
|
|
|
- let provinceName = expressAddresModel!.provinceName
|
|
|
- let cityName = expressAddresModel!.cityName
|
|
|
- let areaName = expressAddresModel!.areaName
|
|
|
- let address = expressAddresModel!.address
|
|
|
-
|
|
|
- addressLabel.text = "\(String(describing: provinceName ?? ""))\(String(describing: cityName ?? ""))\(String(describing: areaName ?? ""))\(String(describing: address ?? ""))"
|
|
|
- if expressAddresModel!.isDefault == 1 {
|
|
|
- selectedButton.isSelected = true
|
|
|
- defalutLabel.isHidden = false
|
|
|
- addressLabel.snp.remakeConstraints { (make) in
|
|
|
- make.top.equalTo(nameLabel.snp.bottom).offset(5)
|
|
|
- make.left.equalTo(92)
|
|
|
- make.right.equalTo(-14)
|
|
|
- make.bottom.equalTo(-15)
|
|
|
- }
|
|
|
- }else {
|
|
|
- selectedButton.isSelected = false
|
|
|
- defalutLabel.isHidden = true
|
|
|
- addressLabel.snp.remakeConstraints { (make) in
|
|
|
- make.top.equalTo(nameLabel.snp.bottom).offset(5)
|
|
|
- make.left.equalTo(52)
|
|
|
- make.right.equalTo(-14)
|
|
|
- make.bottom.equalTo(-15)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|