Browse Source

网络请求方式修改

南鑫林 6 years ago
parent
commit
1e0c058bef
18 changed files with 250 additions and 116 deletions
  1. 1 1
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 2 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductAllComment/View/ProductDetailEvaluationListTableViewCell.swift
  3. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailEvaluation/ProductDetailEvaluationTableViewCell.swift
  4. 7 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailHotSell/ProductDetailHotSellTableViewCell.swift
  5. 7 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailProductSku/ProductDetailProductSkuLabelCollectionViewCell.swift
  6. 112 48
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailProductSku/ProductDetailProductSkuTableViewCell.swift
  7. 7 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailSkuView/ProductDetailSkuSectionHeaerCollectionReusableView.swift
  8. 36 7
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailSkuView/ProductDetailSkuView.swift
  9. 2 16
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailView.swift
  10. 6 0
      RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductCommentListModel.swift
  11. 19 20
      RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductDetailModel.swift
  12. 13 13
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaServiceProductApi.swift
  13. 13 7
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaServiceUserApi.swift
  14. 1 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/ApiMacro.swift
  15. 23 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_jiancebaogao.imageset/Contents.json
  16. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_jiancebaogao.imageset/common_jiancebaogao.png
  17. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_jiancebaogao.imageset/common_jiancebaogao@2x.png
  18. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/CommonIcon/common_jiancebaogao.imageset/common_jiancebaogao@3x.png

+ 1 - 1
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -813,8 +813,8 @@
 			isa = PBXGroup;
 			children = (
 				A70B2C3222880BB700B2449F /* ProductDetailProductSkuTableViewCell.swift */,
-				A70B2C34228815F700B2449F /* ProductDetailProductSkuLabelCollectionViewCell.swift */,
 				A70B2C362288177300B2449F /* ProductDetailProductSkuIconCollectionViewCell.swift */,
+				A70B2C34228815F700B2449F /* ProductDetailProductSkuLabelCollectionViewCell.swift */,
 			);
 			path = ProductDetailProductSku;
 			sourceTree = "<group>";

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductAllComment/View/ProductDetailEvaluationListTableViewCell.swift

@@ -130,13 +130,13 @@ class ProductDetailEvaluationListTableViewCell: UITableViewCell {
     
     var productCommentModel: ProductCommentModel? {
         didSet {
-//            shopImageView.kf.setImage(with: kURLImage(name: productCommentModel?.logoImg ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
+            avatarImagView.kf.setImage(with: kURLImage(name: productCommentModel?.avatar ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
             nameLabel.text = productCommentModel?.username
             timeLabel.text = productCommentModel?.createdAt
             let attributeString = NSMutableAttributedString(string:productCommentModel?.content ?? "")
             attributeString.changeAllLineSpacing(2)
             infoLabel.attributedText = attributeString
-            skuLabel.text = "规格:"
+            skuLabel.text = "规格:\(productCommentModel?.skuName ?? "")"
             
         }
     }

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailEvaluation/ProductDetailEvaluationTableViewCell.swift

@@ -87,7 +87,7 @@ class ProductDetailEvaluationTableViewCell: UITableViewCell {
     
     var productCommentModel : ProductCommentModel? {
         didSet {
-//            avatarImageView.kf.setImage(with: kURLImage(name: productCommentModel? ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
+            avatarImageView.kf.setImage(with: kURLImage(name: productCommentModel?.avatar ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
             nickNameLabel.text = productCommentModel?.username
             let attributeString = NSMutableAttributedString(string:productCommentModel?.content ?? "")
             attributeString.changeAllLineSpacing(2)

+ 7 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailHotSell/ProductDetailHotSellTableViewCell.swift

@@ -109,6 +109,13 @@ extension ProductDetailHotSellTableViewCell: UICollectionViewDelegateFlowLayout,
         
     }
     
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        let vc = ProductDetailViewController()
+        vc.productSearchModel = productSearchListModel?.data?[indexPath.row]
+        getCurrentVC().navigationController?.pushViewController(vc, animated: true)
+        
+    }
+
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
         return CGSize(width:120, height: 153)
     }

+ 7 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailProductSku/ProductDetailProductSkuLabelCollectionViewCell.swift

@@ -55,4 +55,11 @@ class ProductDetailProductSkuLabelCollectionViewCell: UICollectionViewCell {
         titleLabel.font = kRegularFont13
         return titleLabel
     }()
+    
+    var productDetailSpecValueModel: ProductDetailSpecValueModel? {
+        didSet {
+            titleLabel.text = productDetailSpecValueModel?.value
+        }
+    }
+    
 }

+ 112 - 48
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailProductSku/ProductDetailProductSkuTableViewCell.swift

@@ -7,16 +7,22 @@
 //
 
 import UIKit
+import SwiftyJSON
 
 class ProductDetailProductSkuTableViewCell: UITableViewCell {
     
     var productDetailModel : ProductDetailModel? {
         didSet {
-            
+            if productDetailModel?.report?.isEmpty ?? true {
+                iconImageView.isHidden = true
+                titleLabel.isHidden = true
+            }else {
+                iconImageView.isHidden = false
+                titleLabel.isHidden = false
+            }
         }
     }
     
-    
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ProductDetailProductSkuTableViewCell {
         let ID = "ProductDetailProductSkuTableViewCell"
         tableView.register(ProductDetailProductSkuTableViewCell.self, forCellReuseIdentifier: ID)
@@ -43,34 +49,82 @@ class ProductDetailProductSkuTableViewCell: UITableViewCell {
     //MRAK: - 设置View
     private func setupViews() {
         self.selectionStyle = .none
-        addSubview(topBgView)
-        topBgView.addSubview(selectedLabel)
-        topBgView.addSubview(skuCollectionView)
+        addSubview(bgView)
+        bgView.addSubview(skuLabel)
+        bgView.addSubview(skuCollectionView)
+        bgView.addSubview(goImageView)
+        bgView.addSubview(selectedLabel)
+        
         addSubview(iconCollectionView)
+        addSubview(iconImageView)
+        addSubview(titleLabel)
+
     }
     
     private func setupLayouts() {
-        topBgView.snp.makeConstraints { (make) in
+        bgView.snp.makeConstraints { (make) in
             make.top.left.right.equalToSuperview()
-            make.bottom.equalTo(skuCollectionView)
+            make.bottom.equalTo(iconCollectionView.snp.top)
         }
-        skuCollectionView.snp.makeConstraints { (make) in
-            make.top.right.equalToSuperview()
-            make.width.equalTo(kScreenWidth - 54)
-            make.height.equalTo(44)
+
+
+        goImageView.snp.makeConstraints { (make) in
+            make.centerY.equalToSuperview()
+            make.right.equalTo(-14)
         }
+        
         selectedLabel.snp.makeConstraints { (make) in
             make.centerY.equalToSuperview()
             make.left.equalTo(14)
         }
+        
+        skuLabel.snp.makeConstraints { (make) in
+            make.centerY.equalToSuperview()
+            make.left.equalTo(selectedLabel.snp.right).offset(27)
+        }
+        
+        skuCollectionView.snp.makeConstraints { (make) in
+            make.top.equalToSuperview()
+            make.right.equalTo(goImageView.snp.left).offset(-10)
+            make.left.equalTo(selectedLabel.snp.right).offset(20)
+            make.height.equalTo(44)
+        }
+        
         iconCollectionView.snp.makeConstraints { (make) in
-            make.top.equalTo(skuCollectionView.snp.bottom)
+            make.top.equalTo(bgView.snp.bottom)
             make.height.equalTo(75)
-            make.left.right.equalTo(0)
+            make.left.equalTo(0)
+            make.width.equalTo(4*(kScreenWidth/5))
+        }
+        iconImageView.snp.remakeConstraints { (make) in
+            make.top.equalTo(bgView.snp.bottom).offset(10)
+            make.left.equalTo(iconCollectionView.snp.right).offset(((kScreenWidth/5)-(32*kScaleWidth))/2)
+            make.size.equalTo(32*kScaleWidth)
+        }
+        titleLabel.snp.remakeConstraints { (make) in
+            make.top.equalTo(iconImageView.snp.bottom).offset(5)
+            make.centerX.equalTo(iconImageView)
         }
-        
     }
     
+    lazy var bgView : UIView = {
+        let bgView = UIView()
+        bgView.addTapGesture(1, target: self, action: #selector(tapSku))
+        return bgView
+    }()
+    
+    @objc func tapSku() {
+        ProductDetailSkuView.productDetailSkuView(productDetailModel: productDetailModel!)
+    }
+    
+    lazy var skuLabel: UILabel = {
+        let skuLabel = UILabel()
+        skuLabel.text = "请选择规格"
+        skuLabel.textColor = k333333Color
+        skuLabel.font = kRegularFont13
+        return skuLabel
+    }()
+    
     private lazy var skuCollectionView: UICollectionView = {
         let skuCollectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: skuCollectionViewLayout)
         skuCollectionView.backgroundColor = UIColor.white
@@ -80,6 +134,7 @@ class ProductDetailProductSkuTableViewCell: UITableViewCell {
         skuCollectionView.showsHorizontalScrollIndicator = false
         skuCollectionView.cornerRadius = 4
         skuCollectionView.masksToBounds = true
+        skuCollectionView.isHidden = true
         return skuCollectionView
     }()
     
@@ -89,10 +144,25 @@ class ProductDetailProductSkuTableViewCell: UITableViewCell {
         skuCollectionViewLayout.minimumInteritemSpacing = 0
         skuCollectionViewLayout.estimatedItemSize = CGSize(width: 72, height: 25)
         skuCollectionViewLayout.scrollDirection = .vertical
-
+        
         return skuCollectionViewLayout
     }()
     
+    private lazy var selectedLabel : UILabel = {
+        let selectedLabel = UILabel()
+        selectedLabel.text = "选择"
+        selectedLabel.textColor = k999999Color
+        selectedLabel.font = kScaleRegularFont13
+        return selectedLabel
+    }()
+    
+    lazy var goImageView: UIImageView = {
+        let goImageView = UIImageView()
+        goImageView.image = kImage(name: "my_arrows_unfold")
+        return goImageView
+    }()
+    
+    
     private lazy var iconCollectionView: UICollectionView = {
         let iconCollectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: iconCollectionViewLayout)
         iconCollectionView.backgroundColor = UIColor.white
@@ -110,21 +180,24 @@ class ProductDetailProductSkuTableViewCell: UITableViewCell {
         iconCollectionViewLayout.minimumLineSpacing = 0
         iconCollectionViewLayout.minimumInteritemSpacing = 0
         iconCollectionViewLayout.estimatedItemSize = CGSize(width: kScreenWidth/5, height: kScaleWidth * 55)
+//        iconCollectionViewLayout.scrollDirection = .horizontal
         return iconCollectionViewLayout
     }()
-    
-    private lazy var topBgView: UIView = {
-        let topBgView = UIView()
-        return topBgView
+    lazy var iconImageView : UIImageView = {
+        let iconImageView = UIImageView()
+        iconImageView.image = kImage(name: "common_jiancebaogao")
+        return iconImageView
     }()
-    private lazy var selectedLabel : UILabel = {
-        let selectedLabel = UILabel()
-        selectedLabel.text = "已选"
-        selectedLabel.textColor = k999999Color
-        selectedLabel.font = kScaleRegularFont13
-        return selectedLabel
+    
+    lazy var titleLabel: UILabel = {
+        let titleLabel = UILabel()
+        titleLabel.text = "检测机构"
+        titleLabel.textColor = k333333Color
+        titleLabel.font = kRegularFont13
+        return titleLabel
     }()
     
+    
     //加载数据
     func reloadData() {
         
@@ -133,9 +206,11 @@ class ProductDetailProductSkuTableViewCell: UITableViewCell {
         //更新collectionView的高度约束
         let contentSize = self.skuCollectionView.collectionViewLayout.collectionViewContentSize
         skuCollectionView.snp.remakeConstraints { (make) in
-            make.top.right.equalToSuperview()
-            make.width.equalTo(kScreenWidth - 74)
             make.height.equalTo(contentSize.height)
+            make.top.equalToSuperview()
+            make.right.equalTo(goImageView.snp.left).offset(-10)
+            make.left.equalTo(selectedLabel.snp.right).offset(20)
+            make.bottom.equalTo(bgView)
         }
         self.skuCollectionView.collectionViewLayout.invalidateLayout()
         
@@ -144,9 +219,10 @@ class ProductDetailProductSkuTableViewCell: UITableViewCell {
         //更新collectionView的高度约束
         let contentSize1 = self.iconCollectionView.collectionViewLayout.collectionViewContentSize
         iconCollectionView.snp.remakeConstraints { (make) in
-            make.top.equalTo(skuCollectionView.snp.bottom)
+            make.top.equalTo(bgView.snp.bottom)
             make.height.equalTo(contentSize1.height)
-            make.left.right.equalTo(0)
+            make.left.equalTo(0)
+            make.width.equalTo(4*(kScreenWidth/5))
             make.bottom.equalToSuperview()
         }
         self.iconCollectionView.collectionViewLayout.invalidateLayout()
@@ -160,13 +236,11 @@ extension ProductDetailProductSkuTableViewCell: UICollectionViewDelegateFlowLayo
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        
         if collectionView == skuCollectionView {
-            return 10
+             return 3
         }else {
-            return 5
+             return 4
         }
-        
     }
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
@@ -178,21 +252,11 @@ extension ProductDetailProductSkuTableViewCell: UICollectionViewDelegateFlowLayo
             let cell = ProductDetailProductSkuIconCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
             return cell
         }
-    }
-    
-    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
-//        let productModels = productModelsArrays![indexPath.section]
-//        let productModel = productModels[indexPath.row]
-//        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ProductDetailVC"), object: productModel)
+       
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
-        
-        if collectionView == skuCollectionView {
-            return UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 10)
-        }else {
-           return UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0)
-        }
+        return UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0)
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
@@ -201,6 +265,7 @@ extension ProductDetailProductSkuTableViewCell: UICollectionViewDelegateFlowLayo
         }else {
             return 0
         }
+        
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
@@ -210,7 +275,6 @@ extension ProductDetailProductSkuTableViewCell: UICollectionViewDelegateFlowLayo
             return 0
         }
     }
-    
-    
-    
+
+
 }

+ 7 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailSkuView/ProductDetailSkuSectionHeaerCollectionReusableView.swift

@@ -9,7 +9,7 @@
 import UIKit
 
 class ProductDetailSkuSectionHeaerCollectionReusableView: UICollectionReusableView {
-    class func headerWith(collectionView:UICollectionView,kind: String,indexPath: IndexPath) -> UICollectionReusableView {
+    class func headerWith(collectionView:UICollectionView,kind: String,indexPath: IndexPath) -> ProductDetailSkuSectionHeaerCollectionReusableView {
         let ID = "ProductDetailSkuSectionHeaerCollectionReusableView"
         collectionView.register(ProductDetailSkuSectionHeaerCollectionReusableView.self, forSupplementaryViewOfKind: kind, withReuseIdentifier: ID)
         let headerView : ProductDetailSkuSectionHeaerCollectionReusableView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: ID, for: indexPath) as! ProductDetailSkuSectionHeaerCollectionReusableView
@@ -51,4 +51,10 @@ class ProductDetailSkuSectionHeaerCollectionReusableView: UICollectionReusableVi
         titleLabel.font = kRegularFont15
         return titleLabel
     }()
+    
+    var productDetailSpecModel: ProductDetailSpecModel? {
+        didSet {
+            titleLabel.text = productDetailSpecModel?.name
+        }
+    }
 }

+ 36 - 7
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailSkuView/ProductDetailSkuView.swift

@@ -63,14 +63,14 @@ class ProductDetailSkuView: FWPopupView {
         }
         
         topBgView.snp.makeConstraints { (make) in
-            make.top.equalToSuperview()
+            make.top.equalTo(42)
             make.left.equalTo(14)
             make.right.equalTo(-15)
             make.height.equalTo(115)
         }
         productImageView.snp.makeConstraints { (make
             ) in
-            make.top.left.equalToSuperview()
+            make.left.top.equalToSuperview()
             make.size.equalTo(100)
         }
         stockLabel.snp.makeConstraints { (make) in
@@ -170,7 +170,6 @@ class ProductDetailSkuView: FWPopupView {
     
     private lazy var priceLabel: UILabel = {
         let priceLabel = UILabel()
-        priceLabel.text = "¥16.8"
         priceLabel.textColor = kfe352bColor
         priceLabel.font = kMediumFont18
         return priceLabel
@@ -203,7 +202,7 @@ class ProductDetailSkuView: FWPopupView {
     private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
         let collectionViewLayout = UICollectionViewFlowLayout.init()
         collectionViewLayout.minimumLineSpacing = 10
-        collectionViewLayout.minimumInteritemSpacing = 0
+        collectionViewLayout.minimumInteritemSpacing = 10
         collectionViewLayout.estimatedItemSize = CGSize(width: 72, height: 25)
         return collectionViewLayout
     }()
@@ -287,20 +286,50 @@ class ProductDetailSkuView: FWPopupView {
         return sureButton
     }()
     
+    var productDetailModel : ProductDetailModel? {
+        didSet {
+            productImageView.kf.setImage(with: kURLImage(name: productDetailModel?.img ?? "pic_preload")
+                , placeholder: kImage(name: "pic_preload"))
+            for skuModel in (productDetailModel?.sku)! {
+                if skuModel.isMain == 1 {
+                    priceLabel.text = "¥\(skuModel.price ?? 0)"
+                    stockLabel.text = "库存\(skuModel.stock ?? 0)件"
+                }
+            }
+        }
+    }
+    
+    static func productDetailSkuView(productDetailModel : ProductDetailModel) {
+        let view = ProductDetailSkuView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kScreenHeight - 76 - kNavBarTotalHeight))
+        view.productDetailModel = productDetailModel
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .bottomCenter
+        vProperty.popupAnimationType = .frame
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
+        vProperty.touchWildToHide = "1"
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.animationDuration = 0.2
+        view.vProperty = vProperty
+        view.show()
+    }
+    
 
 }
 
 extension ProductDetailSkuView: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource {
+    
     func numberOfSections(in collectionView: UICollectionView) -> Int {
-        return 3
+        return productDetailModel?.spec?.isEmpty ?? true ? 0 : productDetailModel?.spec?.count ?? 0
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        return 6
+        let values = productDetailModel?.spec?[section].value
+        return values?.isEmpty ?? true ? 0 : values?.count ?? 0
     }
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         let cell = ProductDetailProductSkuLabelCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
+        cell.productDetailSpecValueModel = (productDetailModel?.spec?[indexPath.section].value?[indexPath.row])!
         return cell
         
     }
@@ -313,6 +342,7 @@ extension ProductDetailSkuView: UICollectionViewDelegateFlowLayout,UICollectionV
         if kind == UICollectionView.elementKindSectionHeader {
 
             let headerView = ProductDetailSkuSectionHeaerCollectionReusableView.headerWith(collectionView: collectionView, kind:  UICollectionView.elementKindSectionHeader, indexPath: indexPath)
+            headerView.productDetailSpecModel = productDetailModel?.spec?[indexPath.section]
             return headerView
         }
         return UICollectionReusableView()
@@ -323,4 +353,3 @@ extension ProductDetailSkuView: UICollectionViewDelegateFlowLayout,UICollectionV
     }
     
 }
-

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

@@ -169,8 +169,8 @@ class ProductDetailView: BaseView {
         buyButton.backgroundColor = kFFA42FColor
         buyButton.titleLabel?.font = kRegularFont16
         buyButton.rx.tap.subscribe(onNext: {
-            [weak self](data) in
-            self?.productDetailSkuView()
+            [weak self] (data) in
+            ProductDetailSkuView.productDetailSkuView(productDetailModel: (self?.productDetailModel!)!)
         }).disposed(by: disposeBag)
         return buyButton
     }()
@@ -184,20 +184,6 @@ class ProductDetailView: BaseView {
         return topButton
     }()
     
-    func productDetailSkuView() {
-        let view = ProductDetailSkuView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 157+113+257*kScaleWidth))
-        
-        let vProperty = FWPopupViewProperty()
-        vProperty.popupCustomAlignment = .bottomCenter
-        vProperty.popupAnimationType = .frame
-        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
-        vProperty.touchWildToHide = "1"
-        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-        vProperty.animationDuration = 0.2
-        view.vProperty = vProperty
-        view.show()
-    }
-    
 }
 
 extension ProductDetailView : UITableViewDelegate, UITableViewDataSource {

+ 6 - 0
RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductCommentListModel.swift

@@ -29,6 +29,7 @@ class ProductCommentListModel : NSObject, Mappable{
 
 class ProductCommentModel : NSObject, Mappable{
     
+    var avatar : String?
     var categoryName1 : String?
     var categoryName2 : String?
     var categoryName3 : String?
@@ -39,6 +40,8 @@ class ProductCommentModel : NSObject, Mappable{
     var productName : String?
     var purchaseNo : String?
     var shopName : String?
+    var skuId : Int?
+    var skuName : String?
     var star : Int?
     var username : String?
     
@@ -51,6 +54,7 @@ class ProductCommentModel : NSObject, Mappable{
     
     func mapping(map: Map)
     {
+        avatar <- map["avatar"]
         categoryName1 <- map["category_name1"]
         categoryName2 <- map["category_name2"]
         categoryName3 <- map["category_name3"]
@@ -61,6 +65,8 @@ class ProductCommentModel : NSObject, Mappable{
         productName <- map["product_name"]
         purchaseNo <- map["purchase_no"]
         shopName <- map["shop_name"]
+        skuId <- map["sku_id"]
+        skuName <- map["sku_name"]
         star <- map["star"]
         username <- map["username"]
         

+ 19 - 20
RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductDetailModel.swift

@@ -46,7 +46,9 @@ class ProductDetailModel : NSObject, Mappable{
     var label : [ProductDetailLabelModel]?
     var parameter : [ProductDetailParameterModel]?
     var sku : [ProductDetailSkuModel]?
-    var spec : [ProductDetailSpecNameModel]?
+    var spec : [ProductDetailSpecModel]?
+    
+    var skuStr : [ProductDetailSkuModel ]?
     
     func mapping(map: Map)
     {
@@ -142,9 +144,10 @@ class ProductDetailSkuModel : NSObject, Mappable{
     var costPrice : Int?
     var id : Int?
     var isMain : Int?
-    var names : [ProductDetailSkuNameModel]?
+    var key : String?
     var originPrice : Int?
     var price : Int?
+    var skuName : String?
     var stock : Int?
     
     
@@ -159,59 +162,55 @@ class ProductDetailSkuModel : NSObject, Mappable{
         costPrice <- map["cost_price"]
         id <- map["id"]
         isMain <- map["is_main"]
-        names <- map["names"]
+        key <- map["key"]
         originPrice <- map["origin_price"]
         price <- map["price"]
+        skuName <- map["sku_name"]
         stock <- map["stock"]
-        
     }
     
 }
 
+
 /// 规格的内容
-class ProductDetailSkuNameModel : NSObject, Mappable{
+class ProductDetailSpecModel : NSObject, Mappable{
     
-    var attributeItemId : Int?
+    var id : Int?
     var name : String?
-    var value : String?
+    var value : [ProductDetailSpecValueModel]?
     
     
     class func newInstance(map: Map) -> Mappable?{
-        return ProductDetailSkuNameModel()
+        return ProductDetailSpecModel()
     }
     required init?(map: Map){}
     private override init(){}
     
     func mapping(map: Map)
     {
-        attributeItemId <- map["attribute_item_id"]
+        id <- map["id"]
         name <- map["name"]
         value <- map["value"]
         
     }
 }
 
-
-/// 规格的内容
-class ProductDetailSpecNameModel : NSObject, Mappable{
-    
-    var attributeItemId : Int?
-    var name : String?
-    var value : [String]?
+class ProductDetailSpecValueModel : NSObject, Mappable{
     
+    var id : Int?
+    var value : String?
+    var isMain : Int?
     
     class func newInstance(map: Map) -> Mappable?{
-        return ProductDetailSpecNameModel()
+        return ProductDetailSpecValueModel()
     }
     required init?(map: Map){}
     private override init(){}
     
     func mapping(map: Map)
     {
-        attributeItemId <- map["attribute_item_id"]
-        name <- map["name"]
+        id <- map["id"]
         value <- map["value"]
-        
     }
     
 }

+ 13 - 13
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaServiceProductApi.swift

@@ -139,26 +139,26 @@ extension SwiftMoyaServiceProductApi: TargetType {
     
     public var method: Moya.Method {
         switch self {
-        case .productSearch,
-             .productCategory,
-             .productHomeProduct,
-             .productHotSale,
-             .productCommentList,
-             .productCartList,
-             .productDetail
+        case .productHomeProduct,
+             .productCartAdd
             :
             return .post
-        case .productCartAdd,
-             .productCartAmount,
+        case .productCartAmount,
              .productCartIsSel,
              .productCartAllSel
             :
-//            return .put
-            return .post
+            return .put
+        case .productSearch,
+             .productCategory,
+             .productCartList,
+             .productDetail,
+             .productCommentList,
+             .productHotSale
+            :
+            return .get
         case .productCartDelete
             :
-//            return .delete
-            return .post
+            return .delete
         }
     }
     

+ 13 - 7
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaServiceUserApi.swift

@@ -221,18 +221,24 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userSetPassword,
              .userUnbindWeixin,
              .userIsBindWeixin,
-             .userSelfAddressList,
              .userAddExpressAddress,
-             .userAddressIsDefault,
-             .userAddressDelete,
-             .userExpreesContactsList,
              .userSaveExpreesContacts,
-             .userDelExpreesContacts,
              .userSetExpreesContactsDefault,
-             .userAddSelfAddress,
-             .userSetDeliverType
+             .userAddSelfAddress
             :
             return .post
+        case .userAddressIsDefault,
+             .userExpreesContactsList,
+             .userSetDeliverType
+            :
+            return .put
+        case .userSelfAddressList
+            :
+            return .get
+        case .userAddressDelete,
+             .userDelExpreesContacts
+            :
+            return .delete
         }
     }
 

+ 1 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/ApiMacro.swift

@@ -72,6 +72,7 @@ public func appInfoHeader(parameters:Dictionary<String,Any>) -> Dictionary<Strin
     var parameters = parameters
     parameters.updateValue(AppInfo.vendor, forKey: "vendor")
     parameters.updateValue(AppInfo.clientName.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlFragmentAllowed) as Any, forKey: "clientName")
+
     parameters.updateValue(AppInfo.clientVersion, forKey: "clientVersion")
     parameters.updateValue(AppInfo.osName, forKey: "osName")
     parameters.updateValue(AppInfo.osVersion, forKey: "osVersion")

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

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

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


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


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