Browse Source

订单支付 -- initial built

Chris 6 years ago
parent
commit
bc8710a484

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

@@ -248,6 +248,9 @@
 		BD20F1D32283D0ED00677D8E /* ShoppingCartPaySuccessCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1D22283D0ED00677D8E /* ShoppingCartPaySuccessCell.swift */; };
 		BD20F1D52283D15500677D8E /* ShoppingCartPayFailureCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1D42283D15500677D8E /* ShoppingCartPayFailureCell.swift */; };
 		BD20F1D82283D2AA00677D8E /* ShoppingCartModule.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BD20F1D72283D2AA00677D8E /* ShoppingCartModule.xcassets */; };
+		BDD4FB1222840597006FE833 /* ShoppingCartPayOrderController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD4FB1122840597006FE833 /* ShoppingCartPayOrderController.swift */; };
+		BDD4FB1422840954006FE833 /* ShoppingCartOrderPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD4FB1322840954006FE833 /* ShoppingCartOrderPayView.swift */; };
+		BDD4FB1722840DD3006FE833 /* OrderPayAcountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD4FB1622840DD3006FE833 /* OrderPayAcountView.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 */; };
@@ -531,6 +534,9 @@
 		BD20F1D42283D15500677D8E /* ShoppingCartPayFailureCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartPayFailureCell.swift; sourceTree = "<group>"; };
 		BD20F1D72283D2AA00677D8E /* ShoppingCartModule.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ShoppingCartModule.xcassets; 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>"; };
+		BDD4FB1122840597006FE833 /* ShoppingCartPayOrderController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartPayOrderController.swift; sourceTree = "<group>"; };
+		BDD4FB1322840954006FE833 /* ShoppingCartOrderPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartOrderPayView.swift; sourceTree = "<group>"; };
+		BDD4FB1622840DD3006FE833 /* OrderPayAcountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderPayAcountView.swift; 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>"; };
@@ -1574,6 +1580,7 @@
 			isa = PBXGroup;
 			children = (
 				A77F2CB32232010F001BD3F6 /* ShoppingCartViewController.swift */,
+				BDD4FB1122840597006FE833 /* ShoppingCartPayOrderController.swift */,
 				BD20F1CC2283C51300677D8E /* ShoppingCartFinishPayController.swift */,
 			);
 			path = ViewController;
@@ -2139,14 +2146,24 @@
 			path = ShoppingCartFinishPay;
 			sourceTree = "<group>";
 		};
+		BDD4FB1522840A69006FE833 /* ShoppingCartOrderPay */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			path = ShoppingCartOrderPay;
+			sourceTree = "<group>";
+		};
 		BDF47D782282645900941AB9 /* View */ = {
 			isa = PBXGroup;
 			children = (
 				BDF47D882282D94D00941AB9 /* ShoppingCartList */,
 				BDF47D832282BF4300941AB9 /* ShoppingCartHotSale */,
+				BDD4FB1522840A69006FE833 /* ShoppingCartOrderPay */,
 				BD20F1D12283D09E00677D8E /* ShoppingCartFinishPay */,
 				BDF47D79228271F600941AB9 /* ShoppingCartView.swift */,
 				BDF47D7F228288F900941AB9 /* ShoppingCartAccountView.swift */,
+				BDD4FB1322840954006FE833 /* ShoppingCartOrderPayView.swift */,
+				BDD4FB1622840DD3006FE833 /* OrderPayAcountView.swift */,
 				BD20F1CE2283CE2300677D8E /* ShoppingCartFinishPayView.swift */,
 			);
 			path = View;
@@ -2495,6 +2512,7 @@
 				A7284A7322546460000BAEC4 /* SwiftMoyaServicePayApi.swift in Sources */,
 				A7A98DFF227E8501005306E9 /* SwiftMoyaNetWorkServiceProduct.swift in Sources */,
 				A7CC74DC2270352F003C4F38 /* MineOrderCollectionViewCell.swift in Sources */,
+				BDD4FB1222840597006FE833 /* ShoppingCartPayOrderController.swift in Sources */,
 				A7284404224DBFBD00F82F30 /* UserModel.swift in Sources */,
 				A7CC74D822700359003C4F38 /* MineTableViewHeaderView.swift in Sources */,
 				A71D2A602265673A00A55D16 /* RegisterLoginView.swift in Sources */,
@@ -2573,6 +2591,7 @@
 				A7A98E41228046C5005306E9 /* ShoppingMallSepcialTableViewCell.swift in Sources */,
 				A7CC753A2271B98B003C4F38 /* AddressManagerAddTableViewCell.swift in Sources */,
 				A71AF0AC226EDE37001730FE /* SearchNavigationbarView.swift in Sources */,
+				BDD4FB1422840954006FE833 /* ShoppingCartOrderPayView.swift in Sources */,
 				A7CC75432271E038003C4F38 /* SelfMentionContactsListViewController.swift in Sources */,
 				BDF47D872282C92200941AB9 /* ShoppingCartListTableViewHeader.swift in Sources */,
 				A7778CDF22461BAD00C7C47A /* PhoneCountryAreaSectionHeaderView.swift in Sources */,
@@ -2686,6 +2705,7 @@
 				A72A72CF22321E2700B21995 /* NotificationCenterMacro.swift in Sources */,
 				A72A72BF22321DE000B21995 /* Extension+UIButton.swift in Sources */,
 				A71901702275EF9900104A50 /* NXLRealm.swift in Sources */,
+				BDD4FB1722840DD3006FE833 /* OrderPayAcountView.swift in Sources */,
 				A7CC753C2271C177003C4F38 /* AddressManagerSelfMentionTableViewCell.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;

+ 76 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/OrderPayAcountView.swift

@@ -0,0 +1,76 @@
+//
+//  OrderPayAcountView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/9.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  订单支付--结算View
+
+import UIKit
+import RxSwift
+import RxCocoa
+
+class OrderPayAcountView: BaseView {
+    
+    override func setupViews() {
+        self.backgroundColor = kffffffColor
+        addSubview(accountBtn)
+        addSubview(priceLabel)
+        addSubview(prePriceLabel)
+    }
+    
+    override func setupLayouts() {
+        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 accountBtn: UIButton = {
+        let accountBtn = UIButton(type: UIButton.ButtonType.custom)
+        accountBtn.backgroundColor = kFFA42FColor
+        accountBtn.setTitle("提交订单", 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
+    }()
+    
+}

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartAccountView.swift

@@ -4,7 +4,7 @@
 //
 //  Created by Christopher on 2019/5/8.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//  购物车结算View
+//  购物车--首页结算View
 
 import UIKit
 import RxSwift

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

@@ -0,0 +1,104 @@
+//
+//  ShoppingCartOrderPayView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/9.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  购物车--订单支付View
+
+import UIKit
+
+class ShoppingCartOrderPayView: 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.equalToSuperview()
+            make.bottom.equalTo(-kSafeTabBarHeight)
+            make.height.equalTo(48)
+        }
+        tableView.snp.makeConstraints { (make) in
+            make.edges.equalToSuperview()
+            make.bottom.equalTo(accountView.snp_top).offset(-20)
+        }
+    }
+    
+    lazy var accountView: OrderPayAcountView = {
+        let accountView = OrderPayAcountView()
+        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 ShoppingCartOrderPayView : UITableViewDelegate, UITableViewDataSource {
+    func numberOfSections(in tableView: UITableView) -> Int {
+        return 2
+    }
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        switch section {
+        case 0:
+            return 1
+        case 1:
+            return 2
+        default:
+            return 1
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        switch indexPath.section {
+        case 0:
+            let cell = ShoppingCartListNoneItemCell.cellWith(tableView: tableView, indexPath: indexPath)
+            return cell
+        case 1:
+            let cell = ShoppingCartListTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            return cell
+            
+        default:
+            return UITableViewCell()
+        }
+        
+    }
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        return  UITableView.automaticDimension
+    }
+    
+    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
+    }
+    
+}

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift

@@ -4,7 +4,7 @@
 //
 //  Created by Christopher on 2019/5/8.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//  购物车首页View
+//  购物车--首页View
 
 import UIKit
 

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

@@ -0,0 +1,53 @@
+//
+//  ShoppingCartPayOrderController.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/9.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  购物车--订单支付
+
+import UIKit
+import RxSwift
+
+class ShoppingCartPayOrderController: 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.setOrderPayView()
+        //        }
+    }
+    
+    /// 添加view
+    func setOrderPayView() {
+        view.addSubview(orderPayView)
+        orderPayView.snp.makeConstraints { (make) in
+            make.bottom.left.right.equalToSuperview()
+            make.top.equalTo(kNavBarTotalHeight)
+        }
+    }
+    
+    private lazy var orderPayView: ShoppingCartOrderPayView = {
+        let orderPayView = ShoppingCartOrderPayView()
+        return orderPayView
+    }()
+    
+}