Sfoglia il codice sorgente

Merge branch 'develop' into feature/nanxinlin

南鑫林 6 anni fa
parent
commit
06a16eff7a

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

@@ -318,6 +318,7 @@
 		A7FF1596228CFA8100A85748 /* OrderListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1595228CFA8100A85748 /* OrderListViewController.swift */; };
 		A7FF1598228D092A00A85748 /* OrderListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1597228D092A00A85748 /* OrderListModel.swift */; };
 		A7FF159C228D9E3D00A85748 /* OrderRefundDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF159B228D9E3C00A85748 /* OrderRefundDetailModel.swift */; };
+		BD09C84122955B480080D5A4 /* PopTopTriangleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD09C84022955B480080D5A4 /* PopTopTriangleView.swift */; };
 		BD1DC6C5228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6C3228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift */; };
 		BD1DC6C6228CFD0B00B89C57 /* SwiftMoyaServiceOrderApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6C4228CFD0B00B89C57 /* SwiftMoyaServiceOrderApi.swift */; };
 		BD1DC6C9228D005000B89C57 /* OrderCreateParameterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6C8228D005000B89C57 /* OrderCreateParameterModel.swift */; };
@@ -716,6 +717,7 @@
 		A7FF1595228CFA8100A85748 /* OrderListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderListViewController.swift; sourceTree = "<group>"; };
 		A7FF1597228D092A00A85748 /* OrderListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderListModel.swift; sourceTree = "<group>"; };
 		A7FF159B228D9E3C00A85748 /* OrderRefundDetailModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderRefundDetailModel.swift; sourceTree = "<group>"; };
+		BD09C84022955B480080D5A4 /* PopTopTriangleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PopTopTriangleView.swift; sourceTree = "<group>"; };
 		BD1DC6C3228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkServiceOrder.swift; sourceTree = "<group>"; };
 		BD1DC6C4228CFD0B00B89C57 /* SwiftMoyaServiceOrderApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftMoyaServiceOrderApi.swift; sourceTree = "<group>"; };
 		BD1DC6C8228D005000B89C57 /* OrderCreateParameterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderCreateParameterModel.swift; sourceTree = "<group>"; };
@@ -1794,6 +1796,7 @@
 				A775CBFD2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift */,
 				A775CBFF223774A300EBDCF8 /* ShoppingMallView.swift */,
 				A7A98E3022801B10005306E9 /* ShoppingMallListView.swift */,
+				BD09C84022955B480080D5A4 /* PopTopTriangleView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -3598,6 +3601,7 @@
 				A7CC750A22715755003C4F38 /* MessageDetailesViewController.swift in Sources */,
 				BDAA40F7228E947500CF841D /* OrderApplyRefundAccountCell.swift in Sources */,
 				A71AF0B8226EF9EC001730FE /* SearchResultNavigationbarView.swift in Sources */,
+				BD09C84122955B480080D5A4 /* PopTopTriangleView.swift in Sources */,
 				A70B2C5A22886ADF00B2449F /* ShopViewController.swift in Sources */,
 				BDF862AE228E57E1000DEF84 /* OrderCommentDefaultCollectionCell.swift in Sources */,
 				A70B2C3E228825B100B2449F /* ProductDetailEvaluationTableViewCell.swift in Sources */,

+ 3 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartHotSale/ShoppingCartHotSaleTableViewCell.swift

@@ -61,7 +61,7 @@ class ShoppingCartHotSaleTableViewCell: UITableViewCell {
         collectionView.snp.makeConstraints { (make) in
             make.top.equalTo(39)
             make.left.right.equalToSuperview()
-            make.height.equalTo(200)
+            make.bottom.equalToSuperview()
         }
     }
     
@@ -109,6 +109,8 @@ class ShoppingCartHotSaleTableViewCell: UITableViewCell {
         collectionView.dataSource = self;
         collectionView.showsVerticalScrollIndicator = false
         collectionView.showsHorizontalScrollIndicator = false
+        collectionView.bounces = false
+        collectionView.isScrollEnabled = false
         return collectionView
     }()
     

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

@@ -50,9 +50,10 @@ class ShoppingCartListNoneItemCell: UITableViewCell {
     
     private func setupLayouts() {
         bgView.snp.makeConstraints { (make) in
-            make.top.bottom.equalToSuperview()
+            make.top.equalToSuperview()
             make.left.equalTo(14 * kScaleWidth)
             make.right.equalTo(-14 * kScaleWidth)
+            make.height.equalTo(302)
         }
         iconImageView.snp.makeConstraints { (make) in
             make.top.equalTo(30)
@@ -70,7 +71,6 @@ class ShoppingCartListNoneItemCell: UITableViewCell {
         
         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)

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

@@ -96,7 +96,7 @@ class ShoppingCartListTableViewCell: UITableViewCell {
     
     private func setupLayouts() {
         bgView.snp.makeConstraints { (make) in
-            make.top.bottom.equalToSuperview()
+            make.top.equalToSuperview()
             make.left.equalTo(14 * kScaleWidth)
             make.right.equalTo(-14 * kScaleWidth)
             make.height.equalTo(148)
@@ -120,7 +120,7 @@ class ShoppingCartListTableViewCell: UITableViewCell {
         }
         deliveryTime.snp.makeConstraints { (make) in
             make.top.equalTo(titleLabel.snp.bottom).offset(8)
-            make.right.left.equalTo(titleLabel)
+            make.left.right.equalTo(titleLabel)
             make.height.equalTo(17)
         }
         sellScaleLabel.snp.makeConstraints { (make) in

+ 32 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift

@@ -26,10 +26,20 @@ class ShoppingCartView: BaseView {
     // 热销ModelArr
     var hotSaleModelArr : Array<ProductSearchModel>? {
         didSet {
+            // 预计算热销Cell行高
+            let count = self.hotSaleModelArr?.count ?? 0
+            let rows = count / 2 + count % 2
+            let cSpace  = 10 * (rows - 1)  + 30
+            let collectionH: CGFloat = (170 * kScaleWidth + 80) * CGFloat(rows) + CGFloat(cSpace)
+            self.hotSaleHeight = collectionH + 39
+            
             tableView.reloadData()
         }
     }
     
+    // 热销Cell行高
+    private var hotSaleHeight: CGFloat = 0
+    
     // 已选商品总价
     private var totalPrice: Int = 0
     // 已选商品件数
@@ -123,7 +133,7 @@ class ShoppingCartView: BaseView {
         tableView.backgroundColor = kf7f8faColor
         tableView.dataSource = self
         tableView.delegate = self
-        tableView.estimatedRowHeight = 0.000001
+        tableView.estimatedRowHeight = self.hotSaleHeight
         tableView.estimatedSectionFooterHeight = 0.000001
         tableView.estimatedSectionHeaderHeight = 0.000001
         return tableView
@@ -248,7 +258,27 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
     }
     
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
-        return  UITableView.automaticDimension
+        if cartListModelArr?.isEmpty ?? true {
+            switch indexPath.section {
+            case 0:
+                // 购物车列表为空
+                return 302
+            case 1:
+                // 超值热卖                
+                return self.hotSaleHeight
+            default:
+                return UITableView.automaticDimension
+            }
+            
+        } else {
+            if indexPath.section < cartListModelArr!.count {
+                // 购物车列表Item
+                return 148                
+            } else {
+                // 超值热卖
+                return self.hotSaleHeight
+            }
+        }
     }
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

+ 86 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/PopTopTriangleView.swift

@@ -0,0 +1,86 @@
+//
+//  PopTopTriangleView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/22.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class PopTopTriangleView: BaseView {
+    
+    var address: String? {
+        didSet {
+            addressLabel.text = self.address
+        }
+    }
+    
+    override func setupViews() {
+        self.backgroundColor = kffffffColor
+        addSubview(triangleView)
+        addSubview(contentView)
+        contentView.addSubview(addressLabel)
+    }
+    
+    override func setupLayouts() {
+        triangleView.snp.makeConstraints { (make) in
+            make.top.equalToSuperview()
+            make.left.equalToSuperview().offset(4)
+            make.width.equalTo(15)
+            make.height.equalTo(8)
+        }
+        
+        contentView.snp.makeConstraints { (make) in
+            make.top.equalTo(triangleView.snp_bottom)
+            make.left.right.equalToSuperview()
+            make.height.equalTo(24)
+        }
+        
+        addressLabel.snp.makeConstraints { (make) in
+            make.left.equalToSuperview().offset(5)
+            make.right.equalToSuperview().offset(-8)
+            make.bottom.equalToSuperview().offset(-5)
+            make.height.equalTo(14)
+        }
+        
+    }
+    
+    private lazy var triangleView: UIView = {
+        let triangleView = UIView(frame: CGRect(x: 0, y: 0, width: 8, height: 14))
+        triangleView.backgroundColor = kffffffColor
+        
+        // 画三角
+        let trianglePath = UIBezierPath()
+        var point = CGPoint(x: 0, y: 8)
+        trianglePath.move(to: point)
+        point = CGPoint(x: 14/2, y: 0)
+        trianglePath.addLine(to: point)
+        point = CGPoint(x: 14, y: 8)
+        trianglePath.addLine(to: point)
+        trianglePath.close()
+        let triangleLayer = CAShapeLayer()
+        triangleLayer.path = trianglePath.cgPath
+        triangleLayer.fillColor = kRGBAColor(r: 0, g: 0, b: 0, a: 0.6).cgColor
+        triangleView.layer.addSublayer(triangleLayer)
+        return triangleView
+    }()
+    
+    private lazy var contentView: UIView = {
+        let contentView = UIView()
+        contentView.backgroundColor = UIColor.black
+        contentView.alpha = 0.6
+        contentView.cornerRadius = 2
+        contentView.masksToBounds = true
+        return contentView
+    }()
+    
+    private lazy var addressLabel: UILabel = {
+        let addressLabel = UILabel()
+        addressLabel.text = "建设西路新旅城南门自提点"
+        addressLabel.textColor = kffffffColor
+        addressLabel.font = kScaleRegularFont14
+        return addressLabel
+    }()
+    
+}