Browse Source

no message

南鑫林 6 years ago
parent
commit
157112df94
29 changed files with 438 additions and 42 deletions
  1. 31 3
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/SearchModule/SearchResult/ViewController/SearchResultViewController.swift
  3. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/ViewController/CategoryViewController.swift
  4. 15 4
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailShop/ProductDetailShopTableViewCell.swift
  5. 5 15
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailView.swift
  6. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHBigTableViewCell.swift
  7. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHSmallTableViewCell.swift
  8. 5 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/View/ShopSectionHeaderView.swift
  9. 17 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/View/ShopView.swift
  10. 12 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/View/ShopViewShopInfoTableViewCell.swift
  11. 43 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/ViewController/ShopViewController.swift
  12. 9 0
      RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductDetailModel.swift
  13. 10 5
      RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductSearchModel.swift
  14. 70 0
      RainbowPlanet/RainbowPlanet/Service/Model/ShopModel/ShopModel.swift
  15. 29 5
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift
  16. 41 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceShop/SwiftMoyaNetWorkServiceShop.swift
  17. 78 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceShop/SwiftMoyaServiceShopApi.swift
  18. 23 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_down.imageset/Contents.json
  19. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_down.imageset/common_store_arrow_down.png
  20. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_down.imageset/common_store_arrow_down@2x.png
  21. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_down.imageset/common_store_arrow_down@3x.png
  22. 23 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_normal.imageset/Contents.json
  23. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_normal.imageset/common_store_arrow_normal.png
  24. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_normal.imageset/common_store_arrow_normal@2x.png
  25. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_normal.imageset/common_store_arrow_normal@3x.png
  26. 23 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_top.imageset/Contents.json
  27. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_top.imageset/common_store_arrow_top.png
  28. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_top.imageset/common_store_arrow_top@2x.png
  29. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_top.imageset/common_store_arrow_top@3x.png

+ 31 - 3
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -41,6 +41,9 @@
 		A70B2C732289019200B2449F /* ProductDetailSkuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70B2C722289019200B2449F /* ProductDetailSkuView.swift */; };
 		A70B2C75228920BA00B2449F /* ProductDetailSkuSectionHeaerCollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70B2C74228920BA00B2449F /* ProductDetailSkuSectionHeaerCollectionReusableView.swift */; };
 		A70EBBC022561179000AD74F /* Extension+UITableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70EBBBF22561179000AD74F /* Extension+UITableView.swift */; };
+		A71738A622897892000AEA6A /* SwiftMoyaServiceShopApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71738A522897892000AEA6A /* SwiftMoyaServiceShopApi.swift */; };
+		A71738A822897E96000AEA6A /* SwiftMoyaNetWorkServiceShop.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71738A722897E96000AEA6A /* SwiftMoyaNetWorkServiceShop.swift */; };
+		A71738AB22898660000AEA6A /* ShopModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71738AA22898660000AEA6A /* ShopModel.swift */; };
 		A7190167227543DB00104A50 /* baidu_cityid_rel.json in Resources */ = {isa = PBXBuildFile; fileRef = A7190166227543DB00104A50 /* baidu_cityid_rel.json */; };
 		A71901692275464000104A50 /* ProvinceCityAreaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71901682275464000104A50 /* ProvinceCityAreaView.swift */; };
 		A719016B22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A719016A22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift */; };
@@ -359,6 +362,9 @@
 		A70B2C722289019200B2449F /* ProductDetailSkuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductDetailSkuView.swift; sourceTree = "<group>"; };
 		A70B2C74228920BA00B2449F /* ProductDetailSkuSectionHeaerCollectionReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductDetailSkuSectionHeaerCollectionReusableView.swift; sourceTree = "<group>"; };
 		A70EBBBF22561179000AD74F /* Extension+UITableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+UITableView.swift"; sourceTree = "<group>"; };
+		A71738A522897892000AEA6A /* SwiftMoyaServiceShopApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaServiceShopApi.swift; sourceTree = "<group>"; };
+		A71738A722897E96000AEA6A /* SwiftMoyaNetWorkServiceShop.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkServiceShop.swift; sourceTree = "<group>"; };
+		A71738AA22898660000AEA6A /* ShopModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShopModel.swift; sourceTree = "<group>"; };
 		A7190166227543DB00104A50 /* baidu_cityid_rel.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = baidu_cityid_rel.json; sourceTree = "<group>"; };
 		A71901682275464000104A50 /* ProvinceCityAreaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProvinceCityAreaView.swift; sourceTree = "<group>"; };
 		A719016A22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProvinceCityAreaTableViewCell.swift; sourceTree = "<group>"; };
@@ -814,10 +820,10 @@
 				A70B2C4F22884EF100B2449F /* ProductDetailDescription */,
 				A70B2C4A228845B200B2449F /* ProductDetailParameter */,
 				A70B2C442288408E00B2449F /* ProductDetailHotSell */,
-				A70B2C4122883B2F00B2449F /* ProductDetailShop */,
-				A70B2C3C2288259200B2449F /* ProductDetailEvaluation */,
-				A70B2C38228819B500B2449F /* ProductDetailProductSku */,
 				A70B2C3A228819DC00B2449F /* ProductDetailProductInfo */,
+				A70B2C38228819B500B2449F /* ProductDetailProductSku */,
+				A70B2C3C2288259200B2449F /* ProductDetailEvaluation */,
+				A70B2C4122883B2F00B2449F /* ProductDetailShop */,
 			);
 			path = Cell;
 			sourceTree = "<group>";
@@ -959,6 +965,23 @@
 			path = ProductDetailSkuView;
 			sourceTree = "<group>";
 		};
+		A71738A42289787C000AEA6A /* SwiftMoyaServiceShop */ = {
+			isa = PBXGroup;
+			children = (
+				A71738A522897892000AEA6A /* SwiftMoyaServiceShopApi.swift */,
+				A71738A722897E96000AEA6A /* SwiftMoyaNetWorkServiceShop.swift */,
+			);
+			path = SwiftMoyaServiceShop;
+			sourceTree = "<group>";
+		};
+		A71738A922898651000AEA6A /* ShopModel */ = {
+			isa = PBXGroup;
+			children = (
+				A71738AA22898660000AEA6A /* ShopModel.swift */,
+			);
+			path = ShopModel;
+			sourceTree = "<group>";
+		};
 		A71901622275411C00104A50 /* ProvinceCityArea */ = {
 			isa = PBXGroup;
 			children = (
@@ -1146,6 +1169,7 @@
 		A71D2A612265756E00A55D16 /* SwiftMoyaServiceApi */ = {
 			isa = PBXGroup;
 			children = (
+				A71738A42289787C000AEA6A /* SwiftMoyaServiceShop */,
 				A7A98E29228015BA005306E9 /* SwiftMoyaServiceCMS */,
 				A7A98DFB227E84D0005306E9 /* SwiftMoyaServiceProduct */,
 				A71AA5242273202E008FF1A5 /* SwiftMoyaServiceConfig */,
@@ -1503,6 +1527,7 @@
 		A738D203225AEAD000EEE860 /* Model */ = {
 			isa = PBXGroup;
 			children = (
+				A71738A922898651000AEA6A /* ShopModel */,
 				A7B4E736228190810012914A /* CommonModel */,
 				A72A73722233966800B21995 /* RootModel */,
 				A7A98E00227E88E8005306E9 /* ProductModel */,
@@ -2957,6 +2982,7 @@
 				A7CC750D227157DA003C4F38 /* MessageDetailesView.swift in Sources */,
 				BD7AB83622841A8B0030646A /* ShoppingCartPayOrderItemCell.swift in Sources */,
 				A71AA519227219D7008FF1A5 /* EditExpressAddressViewController.swift in Sources */,
+				A71738A822897E96000AEA6A /* SwiftMoyaNetWorkServiceShop.swift in Sources */,
 				BD20F1CD2283C51300677D8E /* ShoppingCartFinishPayController.swift in Sources */,
 				A729B5B022671310004AE098 /* MobileLoginView.swift in Sources */,
 				A71AA50C2272126A008FF1A5 /* EditAddressFooterView.swift in Sources */,
@@ -3057,6 +3083,7 @@
 				A7B4E71F228131720012914A /* ProductSlidingLeftRightCollectionViewCell.swift in Sources */,
 				A77F2CB72232010F001BD3F6 /* MineViewController.swift in Sources */,
 				A7778CA92244904500C7C47A /* Extension+Gifu.GIFImageView.swift in Sources */,
+				A71738AB22898660000AEA6A /* ShopModel.swift in Sources */,
 				A7A98E02227E8900005306E9 /* ProductSearchListModel.swift in Sources */,
 				A7A98E17227EED76005306E9 /* SpecialViewController.swift in Sources */,
 				A7778CB32244D73400C7C47A /* RegisterLoginViewController.swift in Sources */,
@@ -3128,6 +3155,7 @@
 				A729B5A82266F2E0004AE098 /* AlertSheetView.swift in Sources */,
 				A7CC75382271ADD6003C4F38 /* AddressManagerSelfMentionExpressHeaderView.swift in Sources */,
 				A738D66F225D9BD900EEE860 /* UMLoginModel.swift in Sources */,
+				A71738A622897892000AEA6A /* SwiftMoyaServiceShopApi.swift in Sources */,
 				A72A726722321DBD00B21995 /* LocationModel.swift in Sources */,
 				A7A98E10227EC531005306E9 /* ProductHSmallTableViewCell.swift in Sources */,
 				A7A98DFD227E84F4005306E9 /* SwiftMoyaServiceProductApi.swift in Sources */,

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommonModules/SearchModule/SearchResult/ViewController/SearchResultViewController.swift

@@ -76,7 +76,7 @@ class SearchResultViewController: BaseViewController {
     
     /// 搜索结果
     func productSearchApi(page:Int = 1) {
-        SwiftMoyaNetWorkServiceProduct.shared().productSearchApi(page:page ,keyword: self.keyWord) {
+        SwiftMoyaNetWorkServiceProduct.shared().productListApi(page:page ,keyword: self.keyWord) {
             [weak self] (productSearchListModel) -> (Void) in
             let productSearchListModel = productSearchListModel as? ProductSearchListModel
             if productSearchListModel?.pagination?.currentPage ?? 1  <= productSearchListModel?.pagination?.totalPages ?? 1 {

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/ViewController/CategoryViewController.swift

@@ -116,7 +116,7 @@ class CategoryViewController: BaseViewController {
     func productSearchApi(page:Int = 1) {
         let categoryModel = categoryModelArray[leftIndexPath.row]
 
-        SwiftMoyaNetWorkServiceProduct.shared().productSearchApi(page:page ,categoryId:categoryModel.id ?? 0) {
+        SwiftMoyaNetWorkServiceProduct.shared().productListApi(page:page ,categoryId:categoryModel.id ?? 0) {
             [weak self] (productSearchListModel) -> (Void) in
             let productSearchListModel = productSearchListModel as? ProductSearchListModel
             if productSearchListModel?.pagination?.currentPage ?? 1  <= productSearchListModel?.pagination?.totalPages ?? 1 {

+ 15 - 4
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailShop/ProductDetailShopTableViewCell.swift

@@ -13,8 +13,7 @@ class ProductDetailShopTableViewCell: UITableViewCell {
     
     let disposeBag = DisposeBag()
     
-    
-    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> UITableViewCell {
+    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ProductDetailShopTableViewCell {
         let ID = "ProductDetailShopTableViewCell"
         tableView.register(ProductDetailShopTableViewCell.self, forCellReuseIdentifier: ID)
         let cell : ProductDetailShopTableViewCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! ProductDetailShopTableViewCell
@@ -92,10 +91,22 @@ class ProductDetailShopTableViewCell: UITableViewCell {
         comeInButton.cornerRadius = 12
         comeInButton.masksToBounds = true
         comeInButton.backgroundColor = kFFA42FColor
-        comeInButton.rx.tap.subscribe(onNext: { (data) in
-            getCurrentVC().navigationController?.pushViewController(ShopViewController(), animated: true)
+        comeInButton.rx.tap.subscribe(onNext: { //跳转到店铺
+             [weak self] (data) in
+            let vc = ShopViewController()
+            vc.navigationBar.title = self?.productDetailModel?.shopName
+            vc.productDetailModel = self?.productDetailModel
+            getCurrentVC().navigationController?.pushViewController(vc, animated: true)
         }).disposed(by: disposeBag)
         return comeInButton
     }()
+    
+    var productDetailModel : ProductDetailModel? {
+        didSet {
+            shopImageView.kf.setImage(with: kURLImage(name: productDetailModel?.shopName ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
+            shopNameLabel.text = productDetailModel?.shopName
+            
+        }
+    }
 
 }

+ 5 - 15
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailView.swift

@@ -19,23 +19,14 @@ class ProductDetailView: BaseView {
                 tableView.scrollToTop()
             }else {
                 let reloadSection = 2 * index!
-                let indexPtah = IndexPath(row: 0, section: reloadSection)
-                tableView.scrollToRow(at: indexPtah, at: UITableView.ScrollPosition.top, animated: true)
-//                UIEdgeInsets insets = self.collectionView.scrollIndicatorInsets;
-//
-//                CGRect rect = attr.frame;
-//                rect.size = self.collectionView.frame.size;
-//                rect.size.height -= insets.top + insets.bottom;
-//                CGFloat offset = (rect.origin.y + rect.size.height) - self.collectionView.contentSize.height;
-//                if ( offset > 0.0 ) rect = CGRectOffset(rect, 0, -offset);
-//
-//                [_collectionView scrollRectToVisible:rect animated:YES];
-
+                let rect = tableView.rect(forSection: reloadSection)
+                tableView.setContentOffset(CGPoint(x: 0, y: rect.origin.y - kNavBarTotalHeight), animated: true)
             }
            
         }
     }
     
+    var titles = ["","","商品评价","","热销排行","商品参数","商品详情"]
     var productDetailModel : ProductDetailModel? {
         didSet {
             tableView.ly_startLoading()
@@ -50,9 +41,7 @@ class ProductDetailView: BaseView {
            
         }
     }
-    
-    let titles = ["","","商品评价(2300)","","热销排行","商品参数","商品详情"]
-    
+
     override func setupViews() {
         addSubview(bottomBgView)
         bottomBgView.addSubview(cartButton)
@@ -222,6 +211,7 @@ extension ProductDetailView : UITableViewDelegate, UITableViewDataSource {
             return cell
         case 3:
             let cell = ProductDetailShopTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.productDetailModel = productDetailModel
             return cell
         case 4:
             let cell = ProductDetailHotSellTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHBigTableViewCell.swift

@@ -151,7 +151,7 @@ class ProductHBigTableViewCell: UITableViewCell {
     var productSearchModel: ProductSearchModel? {
         didSet {
             iconImagView.kf.setImage(with: kURLImage(name: productSearchModel?.img ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
-            titleLabel.text = productSearchModel?.nameSkuName
+            titleLabel.text = productSearchModel?.name
             detailTitleLabel.text = productSearchModel?.saleName
             sellNumberLabel.text = "已售\(productSearchModel?.totalCount ?? 0)件"
             sellPriceLabel.text = "¥\(productSearchModel?.price ?? 0)"

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHSmallTableViewCell.swift

@@ -142,7 +142,7 @@ class ProductHSmallTableViewCell: UITableViewCell {
     var productSearchModel: ProductSearchModel? {
         didSet {
             iconImagView.kf.setImage(with: kURLImage(name: productSearchModel?.img ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
-            titleLabel.text = productSearchModel?.nameSkuName
+            titleLabel.text = productSearchModel?.name
             detailTitleLabel.text = productSearchModel?.saleName
             sellNumberLabel.text = "已售\(productSearchModel?.totalCount ?? 0)件"
             sellPriceLabel.text = "¥\(productSearchModel?.price ?? 0)"

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

@@ -21,10 +21,13 @@ class ShopSectionHeaderView: BaseView {
             make.top.bottom.left.equalToSuperview()
             make.width.equalToSuperview().dividedBy(2)
         }
+        priceButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.right, imageTitleSpace: 4)
         salesVolumeButton.snp.makeConstraints { (make) in
             make.top.bottom.right.equalToSuperview()
             make.width.equalToSuperview().dividedBy(2)
         }
+        salesVolumeButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.right, imageTitleSpace: 4)
+
     }
     
     lazy var priceButton: UIButton = {
@@ -32,7 +35,7 @@ class ShopSectionHeaderView: BaseView {
         priceButton.setTitle("价格", for: UIControl.State.normal)
         priceButton.setTitleColor(k333333Color, for: UIControl.State.normal)
         priceButton.titleLabel?.font = kRegularFont14
-        priceButton.setImage(kImage(name: ""), for: UIControl.State.normal)
+        priceButton.setImage(kImage(name: "common_store_arrow_top"), for: UIControl.State.normal)
         return priceButton
     }()
     
@@ -41,7 +44,7 @@ class ShopSectionHeaderView: BaseView {
         salesVolumeButton.setTitle("销量", for: UIControl.State.normal)
         salesVolumeButton.setTitleColor(k333333Color, for: UIControl.State.normal)
         salesVolumeButton.titleLabel?.font = kRegularFont14
-        salesVolumeButton.setImage(kImage(name: ""), for: UIControl.State.normal)
+        salesVolumeButton.setImage(kImage(name: "common_store_arrow_normal"), for: UIControl.State.normal)
         return salesVolumeButton
     }()
 

+ 17 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/View/ShopView.swift

@@ -9,8 +9,23 @@
 import UIKit
 
 class ShopView: BaseView {
-
-
+    
+    var shopModel : ShopModel? {
+        didSet {
+            tableView.reloadSections([0], with: UITableView.RowAnimation.none)
+        }
+    }
+    var productSearchModelArray : Array<ProductSearchModel>? {
+        didSet {
+            if productSearchModelArray?.isEmpty ?? true {
+                tableView.isHiddenFooter(true)
+            }else {
+                tableView.isHiddenFooter(false)
+            }
+           tableView.reloadSections([1], with: UITableView.RowAnimation.none)
+        }
+    }
+    
     override func setupViews() {
         addSubview(tableView)
     }

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

@@ -102,4 +102,16 @@ class ShopViewShopInfoTableViewCell: UITableViewCell {
         descriptionLabel.attributedText = attributeString
         return descriptionLabel
     }()
+    
+    var shopModel : ShopModel? {
+        didSet {
+            shopIconImageView.kf.setImage(with: kURLImage(name: shopModel?.logoImg ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
+             shopNameLabel.text = shopModel?.shopName
+            let str = shopModel?.shopDesc
+            let attributeString = NSMutableAttributedString(string:str ?? "")
+            attributeString.changeAllLineSpacing(2)
+            descriptionLabel.attributedText = attributeString
+            productNumberLabel.text = "全部商品:200"
+        }
+    }
 }

+ 43 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Shop/ViewController/ShopViewController.swift

@@ -10,15 +10,18 @@ import UIKit
 
 class ShopViewController: BaseViewController {
     
+    var productDetailModel : ProductDetailModel?
+    var productSearchModelArray = Array<ProductSearchModel>()
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
         setupLayouts()
+        setupData()
     }
     
     override func setupViews() {
         navigationBar.barBackgroundColor = kFFA42FColor
-        navigationBar.title = "彩虹星球专营店"
         navigationBar.titleLabelColor = UIColor.white
         navigationBar.wr_setLeftButton(image: kImage(name: "navbar_back_white")!)
         navigationBar.wr_setRightButton(image: kImage(name: "navbar_shopping_white")!)
@@ -35,9 +38,47 @@ class ShopViewController: BaseViewController {
             make.left.right.bottom.equalToSuperview()
         }
     }
-    lazy var shopView: ShopView = {
+    
+    override func setupData() {
+        shopView.tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
+             self?.shopViewApi()
+             self?.productListApi(page: page)
+        }
+        
+        shopView.tableView.addFooterWithWithHeader(withAutomaticallyRefresh: true) { [weak self] (page) in
+            self?.productListApi(page: page)
+        }
+       
+    }
+    
+    private lazy var shopView: ShopView = {
         let shopView = ShopView()
         return shopView
     }()
+    
+    /// 获取商家信息
+    private func shopViewApi() {
+        SwiftMoyaNetWorkServiceShop.shared().shopViewApi(shopId: productDetailModel?.shopId ?? 0) {
+            [weak self] (shopModel) -> (Void) in
+            let shopModel = shopModel as! ShopModel
+            self?.shopView.shopModel = shopModel
+        }
+    }
+    
+    /// 获取商家商品列表
+    private func productListApi(page:Int) {
+        SwiftMoyaNetWorkServiceProduct.shared().productListApi(page: 1, shopId: productDetailModel?.shopId ?? 0) {  [weak self] (productListModel) -> (Void) in
+            let productSearchListModel = productListModel as? ProductSearchListModel
+            if productSearchListModel?.pagination?.currentPage ?? 1  <= productSearchListModel?.pagination?.totalPages ?? 1 {
+                if productSearchListModel?.pagination?.currentPage == 1{
+                    self?.productSearchModelArray.removeAll()
+                }
+                self?.productSearchModelArray = (self?.productSearchModelArray)! + (productSearchListModel?.data!)!
+                self?.shopView.productSearchModelArray = self?.productSearchModelArray
+            }else {
+                self?.shopView.tableView.endFooterNoMoreData()
+            }
+        }
+    }
 
 }

+ 9 - 0
RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductDetailModel.swift

@@ -84,6 +84,8 @@ class ProductDetailModel : NSObject, Mappable{
     }
 }
 
+
+/// 检测标签
 class ProductDetailLabelModel : NSObject, Mappable{
     
     var isMain : Int?
@@ -105,6 +107,8 @@ class ProductDetailLabelModel : NSObject, Mappable{
     
 }
 
+
+/// 参数模型
 class ProductDetailParameterModel : NSObject, Mappable{
     
     var id : Int?
@@ -127,6 +131,8 @@ class ProductDetailParameterModel : NSObject, Mappable{
     }
 }
 
+
+/// 规格
 class ProductDetailSkuModel : NSObject, Mappable{
     
     var costPrice : Int?
@@ -158,6 +164,7 @@ class ProductDetailSkuModel : NSObject, Mappable{
     
 }
 
+/// 规格的内容
 class ProductDetailSkuNameModel : NSObject, Mappable{
     
     var attributeItemId : Int?
@@ -180,6 +187,8 @@ class ProductDetailSkuNameModel : NSObject, Mappable{
     }
 }
 
+
+/// 规格的内容
 class ProductDetailSpecNameModel : NSObject, Mappable{
     
     var attributeItemId : Int?

+ 10 - 5
RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductSearchModel.swift

@@ -15,15 +15,19 @@ class ProductSearchModel : NSObject, Mappable{
     var categoryName2 : String?
     var categoryName3 : String?
     var cityId : Int?
+    var cityName : AnyObject?
+    var deliverType : Int?
     var id : Int?
     var img : String?
     var isMain : Int?
     var label : [String]?
     var mainLabelName : String?
-    var nameSkuName : String?
+    var name : String?
     var originPrice : Int?
     var price : Int?
     var saleName : String?
+    var shopId : Int?
+    var shopName : String?
     var skuCode : String?
     var skuId : Int?
     var skuName : String?
@@ -46,15 +50,19 @@ class ProductSearchModel : NSObject, Mappable{
         categoryName2 <- map["category_name2"]
         categoryName3 <- map["category_name3"]
         cityId <- map["city_id"]
+        cityName <- map["city_name"]
+        deliverType <- map["deliver_type"]
         id <- map["id"]
         img <- map["img"]
         isMain <- map["is_main"]
         label <- map["label"]
         mainLabelName <- map["main_label_name"]
-        nameSkuName <- map["name&sku_name"]
+        name <- map["name"]
         originPrice <- map["origin_price"]
         price <- map["price"]
         saleName <- map["sale_name"]
+        shopId <- map["shop_id"]
+        shopName <- map["shop_name"]
         skuCode <- map["sku_code"]
         skuId <- map["sku_id"]
         skuName <- map["sku_name"]
@@ -65,7 +73,4 @@ class ProductSearchModel : NSObject, Mappable{
         upStatus <- map["up_status"]
         
     }
-    
 }
-
-

+ 70 - 0
RainbowPlanet/RainbowPlanet/Service/Model/ShopModel/ShopModel.swift

@@ -0,0 +1,70 @@
+//
+//	ShopModel.swift
+//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
+
+import Foundation 
+import ObjectMapper
+
+
+class ShopModel : NSObject, Mappable{
+
+	var address : String?
+	var cityId : Int?
+	var cityName : String?
+	var contactMobile : String?
+	var contactName : String?
+	var createdAt : String?
+	var deletedAt : AnyObject?
+	var foodTransLicense : String?
+	var licenseImg : String?
+	var logoImg : String?
+	var mobile : String?
+	var otherLicense : String?
+	var proportion : Int?
+	var provinceId : Int?
+	var provinceName : String?
+	var shopDesc : String?
+	var shopId : Int?
+	var shopName : String?
+	var shopShortName : String?
+	var star : Int?
+	var status : Int?
+	var updatedAt : String?
+	var verifyType : Int?
+
+
+	class func newInstance(map: Map) -> Mappable?{
+		return ShopModel()
+	}
+	required init?(map: Map){}
+	private override init(){}
+
+	func mapping(map: Map)
+	{
+		address <- map["address"]
+		cityId <- map["city_id"]
+		cityName <- map["city_name"]
+		contactMobile <- map["contact_mobile"]
+		contactName <- map["contact_name"]
+		createdAt <- map["created_at"]
+		deletedAt <- map["deleted_at"]
+		foodTransLicense <- map["food_trans_license"]
+		licenseImg <- map["license_img"]
+		logoImg <- map["logo_img"]
+		mobile <- map["mobile"]
+		otherLicense <- map["other_license"]
+		proportion <- map["proportion"]
+		provinceId <- map["province_id"]
+		provinceName <- map["province_name"]
+		shopDesc <- map["shop_desc"]
+		shopId <- map["shop_id"]
+		shopName <- map["shop_name"]
+		shopShortName <- map["shop_short_name"]
+		star <- map["star"]
+		status <- map["status"]
+		updatedAt <- map["updated_at"]
+		verifyType <- map["verify_type"]
+		
+	}
+
+}

+ 29 - 5
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift

@@ -22,8 +22,8 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// 数据回调
     typealias apiCallBack = (Any) -> (Void)
     
-    // MARK: - 搜索、列表、热销
-    /// 搜索、列表、热销
+    // MARK: - 搜索、列表
+    /// 搜索、列表
     ///
     /// - Parameters:
     ///   - keyword: 关键字:商品名称、子标题、规格
@@ -31,14 +31,38 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///   - order: 排序字段:商品分类排序、商品排序、价格、销量、好评率
     ///   - desc: 排序方式:desc、asc
     ///   - completion: 回调
-    func productSearchApi(page:Int = 1, keyword:String = "",categoryId:Int = 0, order:String = "",desc:String = "",completion: @escaping apiCallBack) {
+    func productListApi(page:Int = 1,shopId:Int  = 0, keyword:String = "",categoryId:Int = 0, order:String = "",desc:String = "",fieldOrder:Int = 0,completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
+        // 本地获取city_id
+        let loacationModel = LocationModel.shared().getLocationModel()
+        let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
+        parameters.updateValue(baiduToCityModel.areaCode, forKey: "city_id")
+        
+        // 本地获取deliver_type
+        let deliver_type = DeliveryMethodTypeModel.shared().getModel()?.deliveryMethodType
+        parameters.updateValue(deliver_type ?? "2", forKey: "deliver_type")
         parameters.updateValue(page, forKey: "page")
         parameters.updateValue(keyword, forKey: "keyword")
-        parameters.updateValue(categoryId, forKey: "category_id1")
         parameters.updateValue(order, forKey: "order")
         parameters.updateValue(desc, forKey: "desc")
-        parameters.updateValue(desc, forKey: "desc")
+        
+        if shopId != 0 {
+            parameters.updateValue("", forKey: "shop_id")
+        }else {
+            parameters.updateValue(shopId, forKey: "shop_id")
+        }
+        
+        if fieldOrder == 0 {
+            parameters.updateValue("", forKey: "field_order")
+        }else {
+            parameters.updateValue(fieldOrder, forKey: "field_order")
+        }
+        
+        if categoryId == 0 {
+            parameters.updateValue("", forKey: "category_id1")
+        }else {
+            parameters.updateValue(categoryId, forKey: "category_id1")
+        }
 
         SwiftProgressHUD.shared().showWait()
         SwiftMoyaNetWorkManager.shared()

+ 41 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceShop/SwiftMoyaNetWorkServiceShop.swift

@@ -0,0 +1,41 @@
+//
+//  SwiftMoyaNetWorkServiceShop.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/5/13.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import Moya
+import SwiftyJSON
+import ObjectMapper
+class SwiftMoyaNetWorkServiceShop: NSObject {
+    private static let _sharedInstance = SwiftMoyaNetWorkServiceShop()
+    
+    private override init() {} // 私有化init方法
+    
+    class func shared() -> SwiftMoyaNetWorkServiceShop {
+        return _sharedInstance
+    }
+    /// 数据回调
+    typealias apiCallBack = (Any) -> (Void)
+    
+    // MARK: - 获取商家信息
+    /// 获取商家信息
+    ///
+    /// - Parameters:
+    ///   - shopId: 商家id
+    ///   - completion: 回调
+    func shopViewApi(shopId:Int = 0 ,completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(shopId, forKey: "id")
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(ShopModel.self,target: MultiTarget(SwiftMoyaServiceShopApi.shopView(parameters: parameters))) {
+            (shopModel) in
+            SwiftProgressHUD.shared().hide()
+            completion(shopModel)
+        }
+    }
+    
+}

+ 78 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceShop/SwiftMoyaServiceShopApi.swift

@@ -0,0 +1,78 @@
+//
+//  SwiftMoyaServiceShopApi.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/5/13.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import Moya
+
+// MARK: - 获取商家信息
+/// 获取商家信息
+public let kShopViewApi = "/shop/view"
+
+
+public enum SwiftMoyaServiceShopApi {
+    case shopView(parameters:Dictionary<String, Any>)
+}
+
+extension SwiftMoyaServiceShopApi: TargetType {
+    
+    public var baseURL: URL {
+        switch self {
+        case .shopView
+            :
+            return URL(string: kApiDataPrefix())!
+        }
+    }
+    
+    public var path: String {
+        switch self {
+        case .shopView:
+            return kShopViewApi
+        }
+    }
+    
+    public var method: Moya.Method {
+        switch self {
+        case .shopView
+            :
+            return .post
+        }
+    }
+    
+    // MARK: - 请求任务事件(这里附带上参数)
+    public var task: Task {
+        switch self {
+        case .shopView(var parameters)
+            :
+            let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
+            parameters.updateValue(sign, forKey: "sign")
+            return .requestParameters(parameters: parameters, encoding: URLEncoding.default)
+        }
+    }
+    
+    
+    // MARK: - 是否执行Alamofire验证
+    public var validate: Bool {
+        return false
+    }
+    
+    // MARK: - 这个就是做单元测试模拟的数据,只会在单元测试文件中有作用
+    public var sampleData: Data {
+        return "{}".data(using: String.Encoding.utf8)!
+    }
+    
+    // MARK: - 请求头
+    public var headers: [String : String]? {
+        //同task,具体选择看后台 有application/x-www-form-urlencoded 、application/json
+        switch self {
+        case .shopView
+            :
+            return (headerParameters(headerType: .tokenHeader) as! [String : String])
+        }
+    }
+    
+}

+ 23 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_down.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_down.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_down@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_down@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_down.imageset/common_store_arrow_down.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_down.imageset/common_store_arrow_down@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_down.imageset/common_store_arrow_down@3x.png


+ 23 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_normal.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_normal.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_normal@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_normal@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_normal.imageset/common_store_arrow_normal.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_normal.imageset/common_store_arrow_normal@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_normal.imageset/common_store_arrow_normal@3x.png


+ 23 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_top.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_top.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_top@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "common_store_arrow_top@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_top.imageset/common_store_arrow_top.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_top.imageset/common_store_arrow_top@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_store_arrow_top.imageset/common_store_arrow_top@3x.png