Sfoglia il codice sorgente

购物车_initialize

Chris 6 anni fa
parent
commit
410ff72ea8

+ 21 - 5
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -144,7 +144,6 @@
 		A77F2CA02231FE45001BD3F6 /* BaseWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A77F2C9F2231FE45001BD3F6 /* BaseWebViewController.swift */; };
 		A77F2CB52232010F001BD3F6 /* ShoppingMallViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A77F2CA72232010F001BD3F6 /* ShoppingMallViewController.swift */; };
 		A77F2CB72232010F001BD3F6 /* MineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A77F2CAD2232010F001BD3F6 /* MineViewController.swift */; };
-		A77F2CB82232010F001BD3F6 /* ShoppingCartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A77F2CB22232010F001BD3F6 /* ShoppingCartViewController.xib */; };
 		A77F2CB92232010F001BD3F6 /* ShoppingCartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A77F2CB32232010F001BD3F6 /* ShoppingCartViewController.swift */; };
 		A77F2CC3223203BA001BD3F6 /* AppDelegate+Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = A77F2CC2223203BA001BD3F6 /* AppDelegate+Window.swift */; };
 		A77F2CC722320627001BD3F6 /* WRNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = A77F2CC522320627001BD3F6 /* WRNavigationBar.swift */; };
@@ -244,6 +243,9 @@
 		A7D46092227619CD00A5A54E /* BaiduToCityFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D46091227619CC00A5A54E /* BaiduToCityFactory.swift */; };
 		A7D460942276854500A5A54E /* BaiduToCity2Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D460932276854500A5A54E /* BaiduToCity2Model.swift */; };
 		A7DC467F22783A47001F3EFC /* EditExpressAddressTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DC467E22783A47001F3EFC /* EditExpressAddressTableViewCell.swift */; };
+		BDF47D7A228271F600941AB9 /* ShoppingCartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF47D79228271F600941AB9 /* ShoppingCartView.swift */; };
+		BDF47D7E22827C3F00941AB9 /* ProductSlidingTopBottomCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF47D7D22827C3F00941AB9 /* ProductSlidingTopBottomCollectionViewCell.swift */; };
+		BDF47D80228288F900941AB9 /* ShoppingCartAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF47D7F228288F900941AB9 /* ShoppingCartAccountView.swift */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -414,7 +416,6 @@
 		A77F2C9F2231FE45001BD3F6 /* BaseWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseWebViewController.swift; sourceTree = "<group>"; };
 		A77F2CA72232010F001BD3F6 /* ShoppingMallViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShoppingMallViewController.swift; sourceTree = "<group>"; };
 		A77F2CAD2232010F001BD3F6 /* MineViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MineViewController.swift; sourceTree = "<group>"; };
-		A77F2CB22232010F001BD3F6 /* ShoppingCartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShoppingCartViewController.xib; sourceTree = "<group>"; };
 		A77F2CB32232010F001BD3F6 /* ShoppingCartViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShoppingCartViewController.swift; sourceTree = "<group>"; };
 		A77F2CC2223203BA001BD3F6 /* AppDelegate+Window.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AppDelegate+Window.swift"; sourceTree = "<group>"; };
 		A77F2CC522320627001BD3F6 /* WRNavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WRNavigationBar.swift; sourceTree = "<group>"; };
@@ -517,6 +518,9 @@
 		A7DC467E22783A47001F3EFC /* EditExpressAddressTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditExpressAddressTableViewCell.swift; sourceTree = "<group>"; };
 		A7E03A30F40582782EC5DA89 /* Pods_RainbowPlanetTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RainbowPlanetTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		BD9052C044FD3AE4E62D3929 /* Pods-RainbowPlanet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RainbowPlanet.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RainbowPlanet/Pods-RainbowPlanet.debug.xcconfig"; sourceTree = "<group>"; };
+		BDF47D79228271F600941AB9 /* ShoppingCartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartView.swift; sourceTree = "<group>"; };
+		BDF47D7D22827C3F00941AB9 /* ProductSlidingTopBottomCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductSlidingTopBottomCollectionViewCell.swift; sourceTree = "<group>"; };
+		BDF47D7F228288F900941AB9 /* ShoppingCartAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartAccountView.swift; sourceTree = "<group>"; };
 		D469F6C3768252BCB7001EDD /* Pods_RainbowPlanet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RainbowPlanet.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
@@ -1544,6 +1548,7 @@
 			isa = PBXGroup;
 			children = (
 				A7284A672253BE35000BAEC4 /* Reactor */,
+				BDF47D782282645900941AB9 /* View */,
 				A77F2CB12232010F001BD3F6 /* ViewController */,
 			);
 			path = ShoppingCart;
@@ -1552,7 +1557,6 @@
 		A77F2CB12232010F001BD3F6 /* ViewController */ = {
 			isa = PBXGroup;
 			children = (
-				A77F2CB22232010F001BD3F6 /* ShoppingCartViewController.xib */,
 				A77F2CB32232010F001BD3F6 /* ShoppingCartViewController.swift */,
 			);
 			path = ViewController;
@@ -2109,6 +2113,16 @@
 			path = FMDB;
 			sourceTree = "<group>";
 		};
+		BDF47D782282645900941AB9 /* View */ = {
+			isa = PBXGroup;
+			children = (
+				BDF47D79228271F600941AB9 /* ShoppingCartView.swift */,
+				BDF47D7F228288F900941AB9 /* ShoppingCartAccountView.swift */,
+				BDF47D7D22827C3F00941AB9 /* ProductSlidingTopBottomCollectionViewCell.swift */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
 		FA8AAFBADE8BD144A5C36FDB /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
@@ -2199,7 +2213,7 @@
 			attributes = {
 				LastSwiftUpdateCheck = 1010;
 				LastUpgradeCheck = 1010;
-				ORGANIZATIONNAME = "南鑫林";
+				ORGANIZATIONNAME = RainbowPlanet;
 				TargetAttributes = {
 					A77F2C5C2231FB49001BD3F6 = {
 						CreatedOnToolsVersion = 10.1;
@@ -2251,7 +2265,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				A7CC74DE22703B4A003C4F38 /* MineModule.xcassets in Resources */,
-				A77F2CB82232010F001BD3F6 /* ShoppingCartViewController.xib in Resources */,
 				A7B4E71A22811F770012914A /* ShoppingCarModoule.xcassets in Resources */,
 				A71AF0BE226F1792001730FE /* ShoppingMallModule.xcassets in Resources */,
 				A7778C9722438F5D00C7C47A /* AlipaySDK.bundle in Resources */,
@@ -2421,6 +2434,7 @@
 				A7B4E7352281907A0012914A /* CMSModel.swift in Sources */,
 				A72A72BE22321DE000B21995 /* Extension+RxTimer.swift in Sources */,
 				A7CC74EA22706ACD003C4F38 /* MessageViewController.swift in Sources */,
+				BDF47D7E22827C3F00941AB9 /* ProductSlidingTopBottomCollectionViewCell.swift in Sources */,
 				A72A72C422321DE000B21995 /* Extension+CAGradientLayer.swift in Sources */,
 				A7778CA72243A05400C7C47A /* IQKeyboardManagerSwiftManager.swift in Sources */,
 				A7B4E738228191CC0012914A /* CommondModel.swift in Sources */,
@@ -2493,6 +2507,7 @@
 				A7CC7526227196A8003C4F38 /* AccountSecurityTableViewCell.swift in Sources */,
 				A7CC74F122706FE3003C4F38 /* MessageOneCollectionViewCell.swift in Sources */,
 				A72A72D622321E2700B21995 /* ThirdPartyMacro.swift in Sources */,
+				BDF47D80228288F900941AB9 /* ShoppingCartAccountView.swift in Sources */,
 				A7284401224DBB7700F82F30 /* SwiftMoyaNetWorkServiceUser.swift in Sources */,
 				A7B4E728228160BA0012914A /* ShoppingMallRightSideleftPictureCollectionViewCell.swift in Sources */,
 				A72843FC224DB6B800F82F30 /* SwiftMoyaServiceUserApi.swift in Sources */,
@@ -2572,6 +2587,7 @@
 				A71AA52622732068008FF1A5 /* SwiftMoyaServiceConfigApi.swift in Sources */,
 				A77F2C982231FD25001BD3F6 /* BaseNavigationViewController.swift in Sources */,
 				A7A98E1B227EEE49005306E9 /* SpecialView.swift in Sources */,
+				BDF47D7A228271F600941AB9 /* ShoppingCartView.swift in Sources */,
 				A7824AFB2271EA2600ABA381 /* SelfMentionContactsListView.swift in Sources */,
 				A72A72AB22321DE000B21995 /* SwiftProgressHUD.swift in Sources */,
 				A7CC751C22716426003C4F38 /* SetLogoutTableViewCell.swift in Sources */,

+ 129 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ProductSlidingTopBottomCollectionViewCell.swift

@@ -0,0 +1,129 @@
+//
+//  ProductSlidingTopBottomCollectionViewCell.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/8.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class ProductSlidingTopBottomCollectionViewCell: UICollectionViewCell {
+    class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> ProductSlidingTopBottomCollectionViewCell {
+        let ID = "ProductSlidingTopBottomCollectionViewCell"
+        collectionView.register(ProductSlidingTopBottomCollectionViewCell.self, forCellWithReuseIdentifier: ID)
+        let cell : ProductSlidingTopBottomCollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: ID, for: indexPath) as! ProductSlidingTopBottomCollectionViewCell
+        cell.indexPath = indexPath
+        return cell
+    }
+    //MARK: - indexPath
+    var indexPath: IndexPath?{
+        didSet {
+            
+        }
+    }
+    //MARK: - 初始化
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        setupViews()
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    //MRAK: - 设置View
+    private func setupViews() {
+        addSubview(iconImagView)
+        addSubview(titleLabel)
+        addSubview(detailTitleLabel)
+        addSubview(sellPriceLabel)
+        addSubview(markPriceLabel)
+        addSubview(plusButton)
+    }
+    
+    private func setupLayouts() {
+        iconImagView.snp.makeConstraints { (make) in
+            make.top.left.right.equalToSuperview()
+            make.height.equalTo(120)
+        }
+        titleLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(iconImagView.snp.bottom).offset(4)
+            make.left.equalTo(5)
+            make.right.equalTo(-5)
+            make.height.equalTo(15)
+        }
+        detailTitleLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(titleLabel.snp.bottom).offset(5)
+            make.right.left.equalTo(titleLabel)
+            make.height.equalTo(12)
+        }
+        sellPriceLabel.snp.remakeConstraints { (make) in
+            make.left.equalTo(titleLabel)
+            make.bottom.equalTo(5)
+        }
+        markPriceLabel.snp.remakeConstraints { (make) in
+            make.left.equalTo(sellPriceLabel.snp.right).offset(3)
+            make.bottom.equalTo(5)
+        }
+        plusButton.snp.makeConstraints { (make) in
+            make.bottom.equalTo(5)
+            make.right.equalTo(-5)
+            make.size.equalTo(22)
+        }
+        
+    }
+    
+    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 = "海南冰糖心木瓜 1个装"
+        titleLabel.textColor = k333333Color
+        titleLabel.font = kScaleMediumFont15
+        titleLabel.textAlignment = .left
+        titleLabel.numberOfLines = 1
+        return titleLabel
+    }()
+    
+    private lazy var detailTitleLabel: UILabel = {
+        let detailTitleLabel = UILabel()
+        detailTitleLabel.text = "酸甜可口营养无限"
+        detailTitleLabel.textColor = k999999Color
+        detailTitleLabel.font = kScaleRegularFont12
+        detailTitleLabel.textAlignment = .left
+        return detailTitleLabel
+    }()
+    
+    private lazy var sellPriceLabel: UILabel = {
+        let sellPriceLabel = UILabel()
+        sellPriceLabel.text = "¥11.8"
+        sellPriceLabel.textColor = kfe352bColor
+        sellPriceLabel.font = kScaleBoldFont14
+        sellPriceLabel.textAlignment = .left
+        return sellPriceLabel
+    }()
+    
+    private lazy var markPriceLabel: UILabel = {
+        let markPriceLabel = UILabel()
+        markPriceLabel.text = "¥24.4"
+        markPriceLabel.textColor = kbbbbbbColor
+        markPriceLabel.font = kScaleRegularFont11
+        let attrString = NSMutableAttributedString(string: "¥24.4")
+        attrString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
+        markPriceLabel.attributedText = attrString
+        return markPriceLabel
+    }()
+    
+    private lazy var plusButton: UIButton = {
+        let plusButton = UIButton(type: UIButton.ButtonType.custom)
+        plusButton.setImage(kImage(name: "shopping_mall_plus"), for: UIControl.State.normal)
+        return plusButton
+    }()
+    
+}

+ 104 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartAccountView.swift

@@ -0,0 +1,104 @@
+//
+//  ShoppingCartAccountView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/8.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import RxSwift
+import RxCocoa
+
+class ShoppingCartAccountView: BaseView {
+    
+    override func setupViews() {
+        addSubview(allSelectBtn)
+        addSubview(accountBtn)
+        addSubview(priceLabel)
+        addSubview(prePriceLabel)
+        
+        self.backgroundColor = kffffffColor
+    }
+    
+    override func setupLayouts() {
+        allSelectBtn.snp.makeConstraints { (make) in
+            make.left.equalToSuperview().offset(10)
+            make.centerY.equalToSuperview()
+            make.height.equalTo(30)
+            make.width.equalTo(54)
+        }
+
+        accountBtn.snp.makeConstraints { (make) in
+            make.right.equalToSuperview().offset(-14)
+            make.centerY.equalToSuperview()
+            make.width.equalTo(100)
+            make.height.equalTo(37)
+        }
+
+        priceLabel.snp.makeConstraints { (make) in
+            make.centerY.equalToSuperview()
+            make.right.equalTo(accountBtn.snp_left).offset(-12)
+            make.height.equalTo(25)
+        }
+
+        prePriceLabel.snp.makeConstraints { (make) in
+            make.centerY.equalToSuperview()
+            make.right.equalTo(priceLabel.snp_left).offset(-1)
+        }
+        
+    }
+    
+    private lazy var allSelectBtn: UIButton = {
+        let allSelectBtn = UIButton(type: UIButton.ButtonType.custom)
+        allSelectBtn.setTitle("全选", for: UIControl.State.normal)
+        allSelectBtn.setTitleColor(k333333Color, for: UIControl.State.normal)
+        allSelectBtn.setTitleColor(k666666Color, for: UIControl.State.selected)
+        allSelectBtn.setImage(UIImage.imageWithColor(color: kDisabledButtonColor), for: UIControl.State.selected)
+        allSelectBtn.setImage(UIImage.imageWithColor(color: kEnabledButtonColor), for: UIControl.State.normal)
+        allSelectBtn.titleLabel?.font = kScaleRegularFont16
+        allSelectBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
+            
+//            if let loginBlock = self?.loginBlock {
+//                loginBlock((self?.phoneNumber)!,(self?.password)!)
+//            }
+            print("点击了全选")
+            
+        }).disposed(by: disposeBag)
+        return allSelectBtn
+    }()
+    
+    private lazy var accountBtn: UIButton = {
+        let accountBtn = UIButton(type: UIButton.ButtonType.custom)
+        accountBtn.backgroundColor = kFFA42FColor
+        accountBtn.setTitle("结算(0)", for: UIControl.State.normal)
+        accountBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        accountBtn.titleLabel?.font = kScaleRegularFont15
+        accountBtn.cornerRadius = 18
+        accountBtn.masksToBounds = true
+        accountBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
+//            if let forgetPasswordBlock = self?.forgetPasswordBlock {
+//                forgetPasswordBlock()
+//            }
+            print("点击了结算")
+        }).disposed(by: disposeBag)
+        return accountBtn
+    }()
+    
+    private lazy var priceLabel: UILabel = {
+        let priceLabel = UILabel()
+        priceLabel.text = "¥0.00"
+        priceLabel.textColor = kFE352BColor
+        priceLabel.font = kScaleBoldFont18
+        return priceLabel
+    }()
+    
+    private lazy var prePriceLabel: UILabel = {
+        let prePriceLabel = UILabel()
+        prePriceLabel.text = "合计"
+        prePriceLabel.textColor = k333333Color
+        prePriceLabel.font = kScaleRegularFont16
+        return prePriceLabel
+    }()
+    
+}

+ 127 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift

@@ -0,0 +1,127 @@
+//
+//  ShoppingCartView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/8.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class ShoppingCartView: BaseView {
+    
+    override func setupViews() {
+        self.backgroundColor = kf7f8faColor
+        addSubview(accountView)
+        addSubview(tableView)
+        let emptyView =  EmptyView.shared.diyCustomEmptyViewStyle2(iconStr: "page04", titleStr: "当前暂无数据")
+        emptyView.contentViewY = kScaleValue(value: 182)
+        tableView.ly_emptyView = emptyView
+        tableView.ly_startLoading()
+    }
+    
+    override func setupLayouts() {
+        accountView.snp.makeConstraints { (make) in
+            make.left.right.bottom.equalToSuperview()
+            make.height.equalTo(48)
+        }
+        tableView.snp.makeConstraints { (make) in
+            make.edges.equalToSuperview()
+            make.bottom.equalTo(accountView.snp_top).offset(-20)
+        }
+    }
+    
+    lazy var accountView: ShoppingCartAccountView = {
+        let accountView = ShoppingCartAccountView()
+        return accountView
+    }()
+    
+    lazy var tableView: UITableView = {
+        let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
+        tableView.separatorStyle = .none
+        tableView.backgroundColor = kf7f8faColor
+        tableView.dataSource = self
+        tableView.delegate = self
+        tableView.estimatedRowHeight = 0.000001
+        tableView.estimatedSectionFooterHeight = 0.000001
+        tableView.estimatedSectionHeaderHeight = 0.000001
+        return tableView
+    }()
+
+}
+
+extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
+    func numberOfSections(in tableView: UITableView) -> Int {
+        return 3
+    }
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        switch section {
+        case 0:
+            return 3
+        case 1:
+            return 1
+        case 2:
+            return 1
+        default:
+            return 1
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        switch indexPath.section {
+        case 0:
+            let cell = ShoppingMallCategoryTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.frame = tableView.bounds
+            cell.layoutIfNeeded()
+            cell.reloadData()
+            return cell
+        case 1:
+            let cell = ShoppingMallRightSideleftPictureTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.frame = tableView.bounds
+            cell.layoutIfNeeded()
+            cell.reloadData()
+            return cell
+        case 2:
+            let cell = ShoppingMallBarChartTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.frame = tableView.bounds
+            cell.layoutIfNeeded()
+            cell.reloadData()
+            return cell
+            
+        default:
+            return UITableViewCell()
+        }
+        
+    }
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        switch indexPath.section {
+        case 0:
+            return  UITableView.automaticDimension
+        case 1:
+            return  UITableView.automaticDimension
+        case 2:
+            return  UITableView.automaticDimension
+        default:
+            return 0
+        }
+        
+    }
+    
+    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
+        return 10
+    }
+    
+    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+        return nil
+    }
+    
+    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
+        return 0.000001
+    }
+    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
+        return nil
+    }
+    
+}

+ 36 - 12
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/ViewController/ShoppingCartViewController.swift

@@ -3,27 +3,51 @@
 //  RainbowPlanet
 //
 //  Created by 南鑫林 on 2019/3/7.
-//  Copyright © 2019 南鑫林. All rights reserved.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
 //
 
 import UIKit
+import RxSwift
 
 class ShoppingCartViewController: BaseViewController {
 
     override func viewDidLoad() {
         super.viewDidLoad()
-
-        // Do any additional setup after loading the view.
+        setupViews()
+        setupLayouts()
+        setupData()
     }
-
-    /*
-    // MARK: - Navigation
-
-    // In a storyboard-based application, you will often want to do a little preparation before navigation
-    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
-        // Get the new view controller using segue.destination.
-        // Pass the selected object to the new view controller.
+    
+    override func setupViews() {
+        navigationBar.title = "购物车"
+        
+    }
+    
+    override func setupLayouts() {
+        
+    }
+    
+    override func setupData() {
+        //TODO:获取购物车列表
+//        SwiftMoyaNetWorkServiceCMS.shared().cmsTemplateSetTemplateNameApi {
+//            [weak self] (data) -> (Void) in
+//            self?.setShoppingCartView()
+        self.setShoppingCartView()
+//        }
+    }
+    
+    /// 添加view
+    func setShoppingCartView() {
+        view.addSubview(shoppingCartView)
+        shoppingCartView.snp.makeConstraints { (make) in
+            make.bottom.left.right.equalToSuperview()
+            make.top.equalTo(kNavBarTotalHeight)
+        }
     }
-    */
+    
+    private lazy var shoppingCartView: ShoppingCartView = {
+        let shoppingCartView = ShoppingCartView()
+        return shoppingCartView
+    }()
 
 }

+ 0 - 36
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/ViewController/ShoppingCartViewController.xib

@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
-    <device id="retina4_7" orientation="portrait">
-        <adaptation id="fullscreen"/>
-    </device>
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
-        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <objects>
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ShoppingCartViewController" customModule="RainbowPlanet" customModuleProvider="target">
-            <connections>
-                <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
-            </connections>
-        </placeholder>
-        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
-            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-            <subviews>
-                <textField opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="6MV-62-dMb">
-                    <rect key="frame" x="128" y="179" width="97" height="30"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                    <nil key="textColor"/>
-                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                    <textInputTraits key="textInputTraits"/>
-                </textField>
-            </subviews>
-            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-            <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
-            <point key="canvasLocation" x="-14" y="54"/>
-        </view>
-    </objects>
-</document>