Explorar el Código

购物车内无商品のCell

Chris hace 6 años
padre
commit
51e38b03a6

+ 8 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -243,6 +243,8 @@
 		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 */; };
+		BD20F1CB2283C12000677D8E /* ShoppingCartListNoneItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1CA2283C12000677D8E /* ShoppingCartListNoneItemCell.swift */; };
+		BD20F1CD2283C51300677D8E /* ShoppingCartFinishPayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1CC2283C51300677D8E /* ShoppingCartFinishPayController.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 */; };
@@ -520,6 +522,8 @@
 		A7D460932276854500A5A54E /* BaiduToCity2Model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaiduToCity2Model.swift; sourceTree = "<group>"; };
 		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; };
+		BD20F1CA2283C12000677D8E /* ShoppingCartListNoneItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartListNoneItemCell.swift; sourceTree = "<group>"; };
+		BD20F1CC2283C51300677D8E /* ShoppingCartFinishPayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartFinishPayController.swift; sourceTree = "<group>"; };
 		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>"; };
@@ -1564,6 +1568,7 @@
 			isa = PBXGroup;
 			children = (
 				A77F2CB32232010F001BD3F6 /* ShoppingCartViewController.swift */,
+				BD20F1CC2283C51300677D8E /* ShoppingCartFinishPayController.swift */,
 			);
 			path = ViewController;
 			sourceTree = "<group>";
@@ -2144,6 +2149,7 @@
 			children = (
 				BDF47D862282C92200941AB9 /* ShoppingCartListTableViewHeader.swift */,
 				BDF47D842282C59F00941AB9 /* ShoppingCartListTableViewCell.swift */,
+				BD20F1CA2283C12000677D8E /* ShoppingCartListNoneItemCell.swift */,
 			);
 			path = ShoppingCartList;
 			sourceTree = "<group>";
@@ -2492,6 +2498,7 @@
 				A7CC750D227157DA003C4F38 /* MessageDetailesView.swift in Sources */,
 				A7B4E72B2281752B0012914A /* ShoppingMallBarChartTableViewCell.swift in Sources */,
 				A71AA519227219D7008FF1A5 /* EditExpressAddressViewController.swift in Sources */,
+				BD20F1CD2283C51300677D8E /* ShoppingCartFinishPayController.swift in Sources */,
 				A729B5B022671310004AE098 /* MobileLoginView.swift in Sources */,
 				A71AA50C2272126A008FF1A5 /* EditAddressFooterView.swift in Sources */,
 				A7CC7528227196C4003C4F38 /* AccountSecuritySetTableViewCell.swift in Sources */,
@@ -2641,6 +2648,7 @@
 				A7284440224DFACD00F82F30 /* InfoModel.swift in Sources */,
 				A72A72B522321DE000B21995 /* Extension+UITextView.swift in Sources */,
 				BDF47D822282B3D100941AB9 /* ShoppingCartHotSaleTableViewCell.swift in Sources */,
+				BD20F1CB2283C12000677D8E /* ShoppingCartListNoneItemCell.swift in Sources */,
 				A757C92E22744ACE00226355 /* AddressManagerListModel.swift in Sources */,
 				A7541502224C5ECB002480B5 /* BaiduMapManager.swift in Sources */,
 				A757C9342274882E00226355 /* UIScrollView+MJRefreshEX.m in Sources */,

+ 118 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartList/ShoppingCartListNoneItemCell.swift

@@ -0,0 +1,118 @@
+//
+//  ShoppingCartListNoneItemCell.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/9.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  购物车无商品の缺省Cell
+
+import UIKit
+import RxSwift
+import RxCocoa
+
+class ShoppingCartListNoneItemCell: 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) -> ShoppingCartListNoneItemCell {
+        let ID = "ShoppingCartListNoneItemCell"
+        tableView.register(ShoppingCartListNoneItemCell.self, forCellReuseIdentifier: ID)
+        let cell : ShoppingCartListNoneItemCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! ShoppingCartListNoneItemCell
+        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(iconImageView)
+        addSubview(titleLabel)
+        addSubview(jumpButton)
+    }
+    
+    private func setupLayouts() {
+        iconImageView.snp.makeConstraints { (make) in
+            make.top.equalTo(30)
+            make.centerX.equalToSuperview()
+            make.width.equalTo(200)
+            make.height.equalTo(140)
+        }
+        
+        titleLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(iconImageView.snp.bottom).offset(16)
+            make.centerX.equalToSuperview()
+            make.left.equalToSuperview().offset(30)
+            make.right.equalToSuperview().offset(-30)
+        }
+        
+        jumpButton.snp.makeConstraints { (make) in
+            make.top.equalTo(titleLabel.snp.bottom).offset(30)
+            make.bottom.equalToSuperview().offset(-30)
+            make.centerX.equalToSuperview()
+            make.width.equalTo(160)
+            make.height.equalTo(36)
+        }
+        
+    }
+    
+    lazy var iconImageView : UIImageView = {
+        let iconImageView = UIImageView()
+        iconImageView.image = kImage(name: "page05")
+        return iconImageView
+    }()
+    
+    private lazy var titleLabel: UILabel = {
+        let titleLabel = UILabel()
+        titleLabel.text = "购物车内无商品"
+        titleLabel.textColor = k333333Color
+        titleLabel.font = kRegularFont14
+        titleLabel.textAlignment = .center
+        return titleLabel
+    }()
+    
+    private lazy var jumpButton: UIButton = {
+        let jumpButton = UIButton(type: UIButton.ButtonType.custom)
+        jumpButton.backgroundColor = kFFA42FColor
+        jumpButton.setTitle("到首页逛逛", for: UIControl.State.normal)
+        jumpButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        jumpButton.titleLabel?.font = kRegularFont16
+        jumpButton.cornerRadius = 18
+        jumpButton.masksToBounds = true
+//        jumpButton.rx.tap.subscribe(onNext: { [weak self] (data) in
+//            //            if let forgetPasswordBlock = self?.forgetPasswordBlock {
+//            //                forgetPasswordBlock()
+//            //            }
+//            print("点击了跳转到首页")
+//        }).disposed(by: disposeBag)
+        return jumpButton
+    }()
+    
+}
+

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartList/ShoppingCartListTableViewCell.swift

@@ -4,7 +4,7 @@
 //
 //  Created by Christopher on 2019/5/8.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
+//  购物车商品列表Cell
 
 import UIKit
 

+ 2 - 3
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartList/ShoppingCartListTableViewHeader.swift

@@ -4,7 +4,7 @@
 //
 //  Created by Christopher on 2019/5/8.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
+//  购物车商品列表Header
 
 import UIKit
 import RxSwift
@@ -25,8 +25,7 @@ class ShoppingCartListTableViewHeader: BaseView {
     }
     
     override func setupViews() {
-//        self.backgroundColor = kffffffColor
-        self.backgroundColor = UIColor.yellow
+        self.backgroundColor = kffffffColor
         addSubview(separateView)
         addSubview(titleButton)
     }

+ 11 - 12
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift

@@ -52,16 +52,18 @@ class ShoppingCartView: BaseView {
 
 extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
     func numberOfSections(in tableView: UITableView) -> Int {
-        return 3
+        return 4
     }
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
         switch section {
         case 0:
-            return 2
+            return 1
         case 1:
             return 3
         case 2:
+            return 2
+        case 3:
             return 1
         default:
             return 1
@@ -71,20 +73,15 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         switch indexPath.section {
         case 0:
-            let cell = ShoppingCartListTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-//            let cell = ShoppingMallCategoryTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-            cell.frame = tableView.bounds
-            cell.layoutIfNeeded()
-//            cell.reloadData()
+            let cell = ShoppingCartListNoneItemCell.cellWith(tableView: tableView, indexPath: indexPath)
             return cell
         case 1:
-//            let cell = ShoppingMallRightSideleftPictureTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
             let cell = ShoppingCartListTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-            cell.frame = tableView.bounds
-            cell.layoutIfNeeded()
-//            cell.reloadData()
             return cell
         case 2:
+            let cell = ShoppingCartListTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            return cell
+        case 3:
             let cell = ShoppingCartHotSaleTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
             cell.frame = tableView.bounds
             cell.layoutIfNeeded()
@@ -105,6 +102,8 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
             return  UITableView.automaticDimension
         case 2:
             return  UITableView.automaticDimension
+        case 3:
+            return  UITableView.automaticDimension
         default:
             return 0
         }
@@ -116,7 +115,7 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
     }
     
     func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
-        if section == 2 {
+        if section == 3 || section == 0 {
             return nil
         } else {
             let headerView = ShoppingCartListTableViewHeader(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 48))

+ 53 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/ViewController/ShoppingCartFinishPayController.swift

@@ -0,0 +1,53 @@
+//
+//  ShoppingCartFinishPayController.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/9.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import RxSwift
+
+class ShoppingCartFinishPayController: BaseViewController {
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        setupViews()
+        setupLayouts()
+        setupData()
+    }
+    
+    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
+    }()
+    
+}