Browse Source

no message

南鑫林 6 years ago
parent
commit
c6f6d71e8b

+ 2 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailView.swift

@@ -510,6 +510,8 @@ extension ProductDetailView : UITableViewDelegate, UITableViewDataSource {
                     rect.size.height = tableView.frame.size.height - kNavBarTotalHeight - rect.size.height
                     
                     tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: rect.size.height, right: 0)
+                }else {
+                    tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
                 }
                 
                 if indexPath!.section % 2 == 0  {

+ 2 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/View/ShopSectionHeaderView.swift

@@ -96,5 +96,7 @@ class ShopSectionHeaderView: BaseView {
         }).disposed(by: disposeBag)
         return salesVolumeButton
     }()
+    
+    
 
 }

+ 9 - 5
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/View/ShopView.swift

@@ -13,9 +13,12 @@ class ShopView: BaseView {
     typealias DidSelectItemBlock = (_ indexPath: IndexPath) -> Void
     var didSelectItemBlock : DidSelectItemBlock?
     
+    typealias PlusCloSure = () -> Void
+    var plusCloSure : PlusCloSure?
+    
     var shopModel : ShopModel? {
         didSet {
-            tableView.reloadSections([0], with: UITableView.RowAnimation.none)
+           tableView.reloadData()
         }
     }
     
@@ -36,8 +39,6 @@ class ShopView: BaseView {
         }
     }
     
-    
-    
     override func setupViews() {
         addSubview(tableView)
     }
@@ -95,12 +96,15 @@ extension ShopView : UITableViewDelegate, UITableViewDataSource {
                     didSelectItemBlock(indexPath)
                 }
             }
+            cell.plusCloSure = {
+                if let plusCloSure = self.plusCloSure {
+                    plusCloSure()
+                }
+            }
             return cell
         default:
             return UITableViewCell()
         }
-       
-        
     }
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
             return UITableView.automaticDimension

+ 0 - 5
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/View/ShopViewShopInfoTableViewCell.swift

@@ -108,10 +108,6 @@ class ShopViewShopInfoTableViewCell: UITableViewCell {
         descriptionLabel.font = kRegularFont14
         descriptionLabel.numberOfLines = 0
         descriptionLabel.sizeToFit()
-        let str = "彩虹星球专营店主营生鲜蔬菜肉类生禽彩虹星球专营店主营生鲜蔬菜、肉类生禽彩虹彩虹星球专营店主营生鲜蔬菜肉类生禽彩虹星球专营店主营生鲜蔬菜、肉类生禽彩虹彩虹星球专营店主营生鲜蔬菜肉类生禽彩虹星球专营店主营生鲜蔬菜、肉类生禽彩虹…"
-        let attributeString = NSMutableAttributedString(string:str)
-        attributeString.changeAllLineSpacing(2)
-        descriptionLabel.attributedText = attributeString
         return descriptionLabel
     }()
     
@@ -191,7 +187,6 @@ class ShopViewShopInfoTableViewCell: UITableViewCell {
     var paginationModel: PaginationModel? {
         didSet{
             productNumberLabel.text = "全部商品:\(paginationModel?.total ?? 0)"
-
         }
     }
 }

+ 6 - 6
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/View/ShopViewTableViewCell.swift

@@ -19,6 +19,9 @@ class ShopViewTableViewCell: UITableViewCell {
     typealias DidSelectItemBlock = (_ indexPath: IndexPath) -> Void
     var didSelectItemBlock : DidSelectItemBlock?
     
+    typealias PlusCloSure = () -> Void
+    var plusCloSure : PlusCloSure?
+    
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ShopViewTableViewCell {
         let ID = "ShopViewTableViewCell"
         tableView.register(ShopViewTableViewCell.self, forCellReuseIdentifier: ID)
@@ -91,12 +94,13 @@ class ShopViewTableViewCell: UITableViewCell {
             productSearchModel.isSelect = 1
         SwiftMoyaNetWorkServiceProduct.shared().productCartListAddApi(productSearchModel: productSearchModel, completion: {
             [weak self] (cartAmountModel) -> (Void) in
-            self!.collectionView.reloadItems(at: [indexPath])
+            if let plusCloSure = self?.plusCloSure {
+                plusCloSure()
+            }
             SwiftProgressHUD.shared().showText("已加入购物车")
         })
     }
     
-
 }
 
 extension ShopViewTableViewCell: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource {
@@ -131,8 +135,4 @@ extension ShopViewTableViewCell: UICollectionViewDelegateFlowLayout,UICollection
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
         return UIEdgeInsets(top: 10, left: 14 * kScaleWidth, bottom: 10, right: 14 * kScaleWidth)
     }
-    
-    
-    
 }
-

+ 10 - 4
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/ViewController/ShopViewController.swift

@@ -27,7 +27,9 @@ class ShopViewController: BaseViewController {
         navigationBar.barBackgroundColor = kFFA42FColor
         navigationBar.titleLabelColor = UIColor.white
         navigationBar.wr_setLeftButton(image: kImage(name: "navbar_back_white")!)
-        navigationBar.wr_setRightButton(image: kImage(name: "navbar_shopping_white")!)
+        navigationBar.wr_setRightButton(image: kImage(name:
+            "navbar_shopping_white")!)
+        statusBarStyle = .lightContent
         navigationBar.onClickRightButton = {
             [weak self] in
             let vc = ShoppingCartViewController()
@@ -46,9 +48,8 @@ class ShopViewController: BaseViewController {
     
     override func setupData() {
         
-        productGetCartCountApi()
-        
         shopView.tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
+             self?.productGetCartCountApi()
              self?.shopViewApi()
              self?.productListApi(page: page)
         }
@@ -74,7 +75,10 @@ class ShopViewController: BaseViewController {
             vc.shopId = productSearch?.shopId
             self?.navigationController?.pushViewController(vc, animated: true)
         }
-       
+        shopView.plusCloSure = {
+            [weak self] in
+            self?.productGetCartCountApi()
+        }
     }
     
     private lazy var shopView: ShopView = {
@@ -117,6 +121,8 @@ class ShopViewController: BaseViewController {
             [weak self] (productCartCountModel) -> (Void) in
             let productCartCountModel = productCartCountModel as!  ProductCartCountModel
             if productCartCountModel.count != 0 {
+                self?.navigationBar.rightButton.pp.badgeView.isUserInteractionEnabled = false
+                self?.navigationBar.rightButton.pp.badgeView.offset = CGPoint(x: -13, y: 13)
                 self?.navigationBar.rightButton.pp.addBadge(number: productCartCountModel.count ?? 0)
             }else {
                 self?.navigationBar.rightButton.pp.badgeView.isHidden = true