Browse Source

Merge branch 'develop' into feature/nanxinlin

* develop:
  购物车 -- 选中状态逻辑
  自提信息相关
南鑫林 6 years ago
parent
commit
256d959f15
14 changed files with 215 additions and 224 deletions
  1. 4 12
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 23 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartHotSale/ShoppingCartHotSaleTableViewCell.swift
  3. 66 11
      RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift
  4. 4 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/ViewController/ShoppingCartViewController.swift
  5. 8 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartPayOrder/View/AdressCell/OrderPaySelfPickInfoCell.swift
  6. 4 3
      RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartPayOrder/View/ShoppingCartOrderPayView.swift
  7. 8 18
      RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartPayOrder/ViewController/ShoppingCartPayOrderController.swift
  8. 0 148
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/CollectionViewCell/ProductCartHotSaleCollectionCell/ProductCartHotSaleCollectionCell.swift
  9. 13 21
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/CollectionViewCell/ProductSlidingTopBottom/ProductSlidingTopBottomCollectionViewCell.swift
  10. 44 0
      RainbowPlanet/RainbowPlanet/Service/Model/UserModel/DefaultContactInfoModel.swift
  11. 9 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift
  12. 2 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaServiceProductApi.swift
  13. 16 1
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift
  14. 14 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaServiceUserApi.swift

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

@@ -281,7 +281,6 @@
 		A7DC467F22783A47001F3EFC /* EditExpressAddressTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DC467E22783A47001F3EFC /* EditExpressAddressTableViewCell.swift */; };
 		A7FF1555228AC27600A85748 /* ProductAllCommentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1554228AC27600A85748 /* ProductAllCommentView.swift */; };
 		A7FF1557228AC3E800A85748 /* ProductAllCommentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1556228AC3E800A85748 /* ProductAllCommentViewController.swift */; };
-		BD15CCD122895E1800EDCE93 /* ProductCartHotSaleCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD15CCD022895E1800EDCE93 /* ProductCartHotSaleCollectionCell.swift */; };
 		BD20F1CB2283C12000677D8E /* ShoppingCartListNoneItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1CA2283C12000677D8E /* ShoppingCartListNoneItemCell.swift */; };
 		BD20F1CD2283C51300677D8E /* ShoppingCartFinishPayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1CC2283C51300677D8E /* ShoppingCartFinishPayController.swift */; };
 		BD20F1CF2283CE2300677D8E /* ShoppingCartFinishPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1CE2283CE2300677D8E /* ShoppingCartFinishPayView.swift */; };
@@ -304,6 +303,7 @@
 		BDE3045F228554CA001D050F /* ProductCartAmountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDE3045E228554CA001D050F /* ProductCartAmountModel.swift */; };
 		BDEF7791228571DC00ED0AC0 /* CommonPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDEF7790228571DC00ED0AC0 /* CommonPayView.swift */; };
 		BDEF7793228575A800ED0AC0 /* CommonPayCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDEF7792228575A800ED0AC0 /* CommonPayCell.swift */; };
+		BDF45F0D228C00B8004E2682 /* DefaultContactInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF45F0C228C00B8004E2682 /* DefaultContactInfoModel.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 */; };
@@ -619,7 +619,6 @@
 		A7E03A30F40582782EC5DA89 /* Pods_RainbowPlanetTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RainbowPlanetTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		A7FF1554228AC27600A85748 /* ProductAllCommentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductAllCommentView.swift; sourceTree = "<group>"; };
 		A7FF1556228AC3E800A85748 /* ProductAllCommentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductAllCommentViewController.swift; sourceTree = "<group>"; };
-		BD15CCD022895E1800EDCE93 /* ProductCartHotSaleCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductCartHotSaleCollectionCell.swift; sourceTree = "<group>"; };
 		BD20F1CA2283C12000677D8E /* ShoppingCartListNoneItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartListNoneItemCell.swift; sourceTree = "<group>"; };
 		BD20F1CC2283C51300677D8E /* ShoppingCartFinishPayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartFinishPayController.swift; sourceTree = "<group>"; };
 		BD20F1CE2283CE2300677D8E /* ShoppingCartFinishPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartFinishPayView.swift; sourceTree = "<group>"; };
@@ -643,6 +642,7 @@
 		BDE3045E228554CA001D050F /* ProductCartAmountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductCartAmountModel.swift; sourceTree = "<group>"; };
 		BDEF7790228571DC00ED0AC0 /* CommonPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonPayView.swift; sourceTree = "<group>"; };
 		BDEF7792228575A800ED0AC0 /* CommonPayCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonPayCell.swift; sourceTree = "<group>"; };
+		BDF45F0C228C00B8004E2682 /* DefaultContactInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultContactInfoModel.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>"; };
@@ -731,7 +731,6 @@
 		A70B2C132286B1C500B2449F /* CollectionViewCell */ = {
 			isa = PBXGroup;
 			children = (
-				BD15CCCF22895DBD00EDCE93 /* ProductCartHotSaleCollectionCell */,
 				A70B2C472288413E00B2449F /* ProductDetailHotSell */,
 				A70B2C172286B47B00B2449F /* ProductSlidingTopBottom */,
 				A70B2C162286B44600B2449F /* ProductMallBarChart */,
@@ -1194,6 +1193,7 @@
 				A757C92D22744ACE00226355 /* AddressManagerListModel.swift */,
 				A79057012276C9770037F823 /* SetPasswordModel.swift */,
 				A79057072276FEB00037F823 /* SelfMentionContactsModel.swift */,
+				BDF45F0C228C00B8004E2682 /* DefaultContactInfoModel.swift */,
 			);
 			path = UserModel;
 			sourceTree = "<group>";
@@ -2535,14 +2535,6 @@
 			path = ViewController;
 			sourceTree = "<group>";
 		};
-		BD15CCCF22895DBD00EDCE93 /* ProductCartHotSaleCollectionCell */ = {
-			isa = PBXGroup;
-			children = (
-				BD15CCD022895E1800EDCE93 /* ProductCartHotSaleCollectionCell.swift */,
-			);
-			path = ProductCartHotSaleCollectionCell;
-			sourceTree = "<group>";
-		};
 		BD3474F722859788000908C5 /* ShoppingCartPayOrder */ = {
 			isa = PBXGroup;
 			children = (
@@ -2948,6 +2940,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				A70B2C3322880BB700B2449F /* ProductDetailProductSkuTableViewCell.swift in Sources */,
+				BDF45F0D228C00B8004E2682 /* DefaultContactInfoModel.swift in Sources */,
 				A72A72BA22321DE000B21995 /* Extension+String.swift in Sources */,
 				A77F2CA02231FE45001BD3F6 /* BaseWebViewController.swift in Sources */,
 				BD20F1D52283D15500677D8E /* ShoppingCartPayFailureCell.swift in Sources */,
@@ -3061,7 +3054,6 @@
 				A7CC7526227196A8003C4F38 /* AccountSecurityTableViewCell.swift in Sources */,
 				A7CC74F122706FE3003C4F38 /* MessageOneCollectionViewCell.swift in Sources */,
 				A72A72D622321E2700B21995 /* ThirdPartyMacro.swift in Sources */,
-				BD15CCD122895E1800EDCE93 /* ProductCartHotSaleCollectionCell.swift in Sources */,
 				BDF47D80228288F900941AB9 /* ShoppingCartAccountView.swift in Sources */,
 				A7284401224DBB7700F82F30 /* SwiftMoyaNetWorkServiceUser.swift in Sources */,
 				A7B4E728228160BA0012914A /* ProductRightSideleftPictureCollectionViewCell.swift in Sources */,

+ 23 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartHotSale/ShoppingCartHotSaleTableViewCell.swift

@@ -10,6 +10,9 @@ import UIKit
 
 class ShoppingCartHotSaleTableViewCell: UITableViewCell {
     
+    typealias RefreshBlock = () -> Void
+    var refreshBlock : RefreshBlock?
+    
     // 热销ModelArr
     var hotSaleModelArr : Array<ProductSearchModel>? {
         didSet {
@@ -143,6 +146,20 @@ class ShoppingCartHotSaleTableViewCell: UITableViewCell {
         self.collectionView.collectionViewLayout.invalidateLayout()
     }
     
+    // 添加购物车
+    func addCart(productSearchModel:ProductSearchModel,indexPath:IndexPath) {
+        productSearchModel.isSelect = 1
+        SwiftMoyaNetWorkServiceProduct.shared().productCartListAddApi(productSearchModel: productSearchModel, completion: {
+            [weak self] (cartAmountModel) -> (Void) in
+            self!.collectionView.reloadItems(at: [indexPath])
+            SwiftProgressHUD.shared().showText("已加入购物车")
+            // 回调通知购物车section刷新
+            if let refreshBlock = self?.refreshBlock {
+                refreshBlock()
+            }
+        })
+    }
+    
 }
 
 extension ShoppingCartHotSaleTableViewCell: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource {
@@ -155,8 +172,12 @@ extension ShoppingCartHotSaleTableViewCell: UICollectionViewDelegateFlowLayout,U
     }
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
-        let cell = ProductCartHotSaleCollectionCell.cellWith(collectionView: collectionView, indexPath: indexPath)
-        cell.hotProductModel = hotSaleModelArr![indexPath.row]
+        let cell = ProductSlidingTopBottomCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
+        cell.productSearchModel = hotSaleModelArr![indexPath.row]
+        cell.plusClosure = {
+            [weak self] (productSearchModel,indexPath) in
+            self?.addCart(productSearchModel: productSearchModel!, indexPath: indexPath!)
+        }
         return cell
     }
     

+ 66 - 11
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift

@@ -41,9 +41,14 @@ class ShoppingCartView: BaseView {
     // 已选商品ModelArr
     private var selModelArr: Array<CartProductListModel> = []
     
+    // 订单支付--次级block
     typealias OrderPayTransBlock = (_ selMdlArr: Array<CartProductListModel>, _ totalPrice: Int) -> Void
     var orderPayTransBlock : OrderPayTransBlock?
     
+    // 刷新列表(数据)--次级block
+    typealias RefreshTransBlock = () -> Void
+    var refreshTransBlock : RefreshTransBlock?
+    
     override func setupViews() {
         self.backgroundColor = kf7f8faColor
         addSubview(accountView)
@@ -77,8 +82,7 @@ class ShoppingCartView: BaseView {
         
         accountView.allSelectBlock = { [weak self]
             (isAllSelected) in
-            self?.allSelectedAction(isAllSelected)
-            self?.refreshAccountView()
+            self?.productCartAllSelApi(isSel: isAllSelected)
         }
         
         accountView.orderPayBlock = {
@@ -139,6 +143,12 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
                 hotSaleCell.hotSaleModelArr = hotSaleModelArr
                 hotSaleCell.layoutIfNeeded()
                 hotSaleCell.reloadData()
+                hotSaleCell.refreshBlock = {
+                    [weak self] in
+                    if let refreshTransBlock = self?.refreshTransBlock {
+                        refreshTransBlock()
+                    }
+                }
                 return hotSaleCell
             default:
                 return UITableViewCell()
@@ -152,11 +162,8 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
                 
                 cell.productSelBlock = { [weak self]
                     (isProductSel) in
-                self?.cartListModelArr![indexPath.section].productList![indexPath.row].isSelect = isProductSel
-                    
-                    self?.tableView.reloadSections([indexPath.section], with: UITableView.RowAnimation.none)
-                    self?.judgeAllSelectedStatus()
-                    self?.refreshAccountView()
+                    let productMdl: ProductModel = (self?.cartListModelArr![indexPath.section].productList![indexPath.row])!
+                    self?.productCartIsSelApi(pro_id: productMdl.id!, isSel: isProductSel, indexPath: indexPath)
                 }
                 
                 cell.changeProductBlock = { [weak self]
@@ -181,6 +188,12 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
                 hotSaleCell.hotSaleModelArr = hotSaleModelArr
                 hotSaleCell.layoutIfNeeded()
                 hotSaleCell.reloadData()
+                hotSaleCell.refreshBlock = {
+                    [weak self] in
+                    if let refreshTransBlock = self?.refreshTransBlock {
+                        refreshTransBlock()
+                    }
+                }
                 return hotSaleCell
             }
         }
@@ -205,9 +218,12 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
             headerView.isSectionSelected = self.judgeSectionSelectedStatus(section)
             headerView.secSelectBlock = { [weak self]
                 (isSectionSel) in
-                self?.shopSelectedAction(isSectionSel, section: section)
-                self?.judgeAllSelectedStatus()
-                self?.refreshAccountView()
+                let proListMdl: CartProductListModel = (self?.cartListModelArr![section])!
+                self?.productCartIsSelApi(shop_id: proListMdl.shopId!, isSel: isSectionSel, section: section)
+                
+//                self?.shopSelectedAction(isSectionSel, section: section)
+//                self?.judgeAllSelectedStatus()
+//                self?.refreshAccountView()
             }
             return headerView
             
@@ -223,8 +239,19 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
         return nil
     }
     
-    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
+    func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
+        // 非商品Item拦截滑动删除
+        if cartListModelArr?.isEmpty ?? true {
+            return false
+        }
+        if  indexPath.section == cartListModelArr!.count {
+            return false
+        }
         
+        return true
+    }
+    
+    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
         if editingStyle == .delete {
             // 删除商品
             let productId = cartListModelArr![indexPath.section].productList?[indexPath.row].id
@@ -319,4 +346,32 @@ extension ShoppingCartView {
         self.accountView.tNumber = totalNum
     }
     
+    // 选中单个商品
+    func productCartIsSelApi(pro_id:Int = 0, isSel:Int, indexPath:IndexPath) {
+        SwiftMoyaNetWorkServiceProduct.shared().productCartIsSelApi(id: pro_id, shop_id: 0, isSelect: isSel) { (data) -> (Void) in
+            self.cartListModelArr![indexPath.section].productList![indexPath.row].isSelect = isSel
+            
+            self.tableView.reloadSections([indexPath.section], with: UITableView.RowAnimation.none)
+            self.judgeAllSelectedStatus()
+            self.refreshAccountView()
+        }
+    }
+    
+    // 选中section内商品
+    func productCartIsSelApi(shop_id:Int = 0, isSel:Int, section:Int) {
+        SwiftMoyaNetWorkServiceProduct.shared().productCartIsSelApi(id: 0, shop_id: shop_id, isSelect: isSel) { (data) -> (Void) in
+            self.shopSelectedAction(isSel, section: section)
+            self.judgeAllSelectedStatus()
+            self.refreshAccountView()
+        }
+    }
+    
+    // 全选商品
+    func productCartAllSelApi(isSel:Int) {
+        SwiftMoyaNetWorkServiceProduct.shared().productCartAllSelApi(isSelect: isSel) { (data) -> (Void) in
+            self.allSelectedAction(isSel)
+            self.refreshAccountView()
+        }
+    }
+    
 }

+ 4 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/ViewController/ShoppingCartViewController.swift

@@ -72,6 +72,10 @@ class ShoppingCartViewController: BaseViewController {
             vc.totalProductPrice = totalPrice
             self?.navigationController?.pushViewController(vc, animated: true)
         }
+        shoppingCartView.refreshTransBlock = {
+            [weak self] in
+            self?.productCartListApi()            
+        }
         return shoppingCartView
     }()
     

+ 8 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartPayOrder/View/AdressCell/OrderPaySelfPickInfoCell.swift

@@ -10,6 +10,14 @@ import UIKit
 
 class OrderPaySelfPickInfoCell: UITableViewCell {
     
+    // 默认联系人Mdl
+    var contactMdl: DefaultContactInfoModel? {
+        didSet {
+            nameLabel.text = contactMdl?.name
+            phoneLabel.text = contactMdl?.mobile
+        }
+    }
+    
     override var frame: CGRect {
         get {
             return super.frame
@@ -76,7 +84,6 @@ class OrderPaySelfPickInfoCell: UITableViewCell {
     
     private lazy var nameLabel: UILabel = {
         let nameLabel = UILabel()
-        nameLabel.text = "范德彪"
         nameLabel.textColor = k333333Color
         nameLabel.font = kRegularFont14
         return nameLabel
@@ -84,7 +91,6 @@ class OrderPaySelfPickInfoCell: UITableViewCell {
     
     private lazy var phoneLabel: UILabel = {
         let phoneLabel = UILabel()
-        phoneLabel.text = "158xxxx5481"
         phoneLabel.textColor = k333333Color
         phoneLabel.font = kRegularFont14
         return phoneLabel

+ 4 - 3
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartPayOrder/View/ShoppingCartOrderPayView.swift

@@ -45,7 +45,7 @@ class ShoppingCartOrderPayView: BaseView {
     }
     
     // 自提地址信息Mdl
-    var selfAddressArrMdl: Array<SelfAddresModel>? {
+    var selfAddressInfoMdl: DefaultContactInfoModel? {
         didSet {
             self.tableView.reloadSections([0], with: UITableView.RowAnimation.none)
         }
@@ -126,7 +126,7 @@ extension ShoppingCartOrderPayView : UITableViewDelegate, UITableViewDataSource
             switch deliverType {
             case "1":
                 // 自提
-                if selfAddressArrMdl?.isEmpty ?? true  {
+                if selfAddressInfoMdl == nil  {
                     if indexPath.row == 0 {
                         // 自提添加收货人信息
                         let cell = OrderPaySelfPickAddInfoCell.cellWith(tableView: tableView, indexPath: indexPath)
@@ -140,6 +140,7 @@ extension ShoppingCartOrderPayView : UITableViewDelegate, UITableViewDataSource
                     if indexPath.row == 0 {
                         // 自提个人信息
                         let cell = OrderPaySelfPickInfoCell.cellWith(tableView: tableView, indexPath: indexPath)
+                        cell.contactMdl = selfAddressInfoMdl
                         return cell
                     } else {
                         // 自提地址信息
@@ -231,7 +232,7 @@ extension ShoppingCartOrderPayView : UITableViewDelegate, UITableViewDataSource
         switch deliverType {
         case "1":
             // 自提
-            if selfAddressArrMdl?.isEmpty ?? true {
+            if selfAddressInfoMdl == nil {
                 if indexPath.row == 0 {
                     if let jumpNavBlock = self.jumpNavBlock {
                         jumpNavBlock(WillJumpType.selfAddInfo)

+ 8 - 18
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartPayOrder/ViewController/ShoppingCartPayOrderController.swift

@@ -50,7 +50,7 @@ class ShoppingCartPayOrderController: BaseViewController {
         
         switch deliverType {
         case "1":
-            self.userSelfAddressListApi()
+            self.userDefaultContactApi()
         case "2":
             // 获取默认快递信息
             self.userDefaultExpressApi()
@@ -89,18 +89,12 @@ class ShoppingCartPayOrderController: BaseViewController {
                 let vc = ExpressAddressListViewController()
                 self?.navigationController?.pushViewController(vc, animated: true)
             case WillJumpType.selfAddInfo:
-                print("------自提添加")
                 let vc = EditSelfMentionContactsViewController()
-//                vc.saveClosure = {
-//                    [weak self] in
-//                    self?.userExpreesContactsListApi()
-//                }
-//                if let selfMentionContactsModel = selfMentionContactsModel   {
-//                    vc.selfMentionContactsModel = selfMentionContactsModel
-//                }
                 self?.navigationController?.pushViewController(vc, animated: true)
             case WillJumpType.selfPersonalInfo:
                 print("------自提个人信息")
+                let vc = SelfMentionContactsListViewController()
+                self?.navigationController?.pushViewController(vc, animated: true)
             case WillJumpType.selfAddressInfo:                
                 let vc = SelfRecommendationViewController()
                 self?.navigationController?.pushViewController(vc, animated: true)
@@ -117,15 +111,11 @@ class ShoppingCartPayOrderController: BaseViewController {
         }
     }
     
-    // 获取用户自提点
-    func userSelfAddressListApi() {
-        SwiftMoyaNetWorkServiceUser.shared().userSelfAndExpressAddressListApi(type: 1) {
-            
-            [weak self] (addressManagerListModel) -> (Void) in
-            let addrListMdl = addressManagerListModel as? AddressManagerListModel            
-            // 自提点数组只返回1条数据
-            self?.orderPayView.selfAddressArrMdl = addrListMdl?.selfAddress
-        }
+    // 获取默认用户自提信息
+    func userDefaultContactApi() {
+        SwiftMoyaNetWorkServiceUser.shared().userDefaultContactApi { [weak self] (contactModel) -> (Void) in
+            self?.orderPayView.selfAddressInfoMdl = contactModel as? DefaultContactInfoModel
+        }        
     }
     
 }

+ 0 - 148
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/CollectionViewCell/ProductCartHotSaleCollectionCell/ProductCartHotSaleCollectionCell.swift

@@ -1,148 +0,0 @@
-//
-//  ProductCartHotSaleCollectionCell.swift
-//  RainbowPlanet
-//
-//  Created by Christopher on 2019/5/13.
-//  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
-
-import UIKit
-import RxSwift
-import RxCocoa
-
-class ProductCartHotSaleCollectionCell: UICollectionViewCell {
-    
-    let disposeBag = DisposeBag()
-    
-    var hotProductModel: ProductSearchModel? {
-        didSet {
-            iconImagView.kf.setImage(with: kURLImage(name: hotProductModel?.img ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
-            titleLabel.text = hotProductModel?.saleName
-            sellNumberLabel.text = "已售\(hotProductModel?.totalCount ?? 0)件"
-            sellPriceLabel.text = "¥\(hotProductModel?.price ?? 0)"
-            let attrString = NSMutableAttributedString(string:"¥\(hotProductModel?.originPrice ?? 0)")
-            attrString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
-            markPriceLabel.attributedText = attrString
-        }
-    }
-    
-    class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> ProductCartHotSaleCollectionCell {
-        let ID = "ProductCartHotSaleCollectionCell"
-        collectionView.register(ProductCartHotSaleCollectionCell.self, forCellWithReuseIdentifier: ID)
-        let cell : ProductCartHotSaleCollectionCell = collectionView.dequeueReusableCell(withReuseIdentifier: ID, for: indexPath) as! ProductCartHotSaleCollectionCell
-        cell.indexPath = indexPath
-        return cell
-    }
-    //MARK: - indexPath
-    var indexPath: IndexPath?{
-        didSet {
-            
-        }
-    }
-    //MARK: - 初始化
-    override init(frame: CGRect) {
-        super.init(frame: frame)
-        backgroundColor = UIColor.white
-        cornerRadius = 4
-        masksToBounds = true
-        setupViews()
-        setupLayouts()
-        
-    }
-    
-    required init?(coder aDecoder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-    
-    //MRAK: - 设置View
-    private func setupViews() {
-        addSubview(iconImagView)
-        addSubview(titleLabel)
-        addSubview(sellNumberLabel)
-        addSubview(sellPriceLabel)
-        addSubview(markPriceLabel)
-        addSubview(plusButton)
-    }
-    
-    private func setupLayouts() {
-        iconImagView.snp.makeConstraints { (make) in
-            make.top.left.right.equalToSuperview()
-            make.height.equalTo(150 * kScaleWidth)
-        }
-        titleLabel.snp.makeConstraints { (make) in
-            make.left.equalTo(10)
-            make.top.equalTo(iconImagView.snp.bottom).offset(10)
-            make.right.equalTo(-10)
-            make.height.equalTo(23)
-        }
-        sellNumberLabel.snp.makeConstraints { (make) in
-            make.top.equalTo(titleLabel.snp.bottom).offset(15)
-            make.left.right.equalTo(titleLabel)
-            make.height.equalTo(13)
-        }
-        sellPriceLabel.snp.remakeConstraints { (make) in
-            make.left.equalTo(titleLabel)
-            make.bottom.equalTo(-10)
-            make.height.equalTo(19)
-        }
-        markPriceLabel.snp.remakeConstraints { (make) in
-            make.left.equalTo(sellPriceLabel.snp.right).offset(5)
-            make.centerY.equalTo(sellPriceLabel)
-            make.height.equalTo(13)
-        }
-        plusButton.snp.makeConstraints { (make) in
-            make.right.equalTo(-10)
-            make.bottom.equalTo(-10)
-            make.size.equalTo(25)
-        }
-        
-    }
-    
-    private lazy var iconImagView: UIImageView = {
-        let iconImagView = UIImageView()
-        iconImagView.image = kImage(name: "pic_preload")
-        return iconImagView
-    }()
-    
-    private lazy var titleLabel: UILabel = {
-        let titleLabel = UILabel()
-        titleLabel.textColor = k333333Color
-        titleLabel.font = kScaleMediumFont15
-        titleLabel.textAlignment = .left
-        titleLabel.numberOfLines = 1
-        return titleLabel
-    }()
-    
-    private lazy var sellNumberLabel: UILabel = {
-        let sellNumberLabel = UILabel()
-        sellNumberLabel.textColor = k999999Color
-        sellNumberLabel.font = kScaleRegularFont12
-        return sellNumberLabel
-    }()
-    
-    private lazy var sellPriceLabel: UILabel = {
-        let sellPriceLabel = UILabel()
-        sellPriceLabel.textColor = kfe352bColor
-        sellPriceLabel.font = kScaleBoldFont15
-        sellPriceLabel.textAlignment = .left
-        return sellPriceLabel
-    }()
-    
-    private lazy var markPriceLabel: UILabel = {
-        let markPriceLabel = UILabel()
-        markPriceLabel.textColor = kbbbbbbColor
-        markPriceLabel.font = kScaleRegularFont13
-        return markPriceLabel
-    }()
-    
-    private lazy var plusButton: UIButton = {
-        let plusButton = UIButton(type: UIButton.ButtonType.custom)
-        plusButton.setImage(kImage(name: "shopping_mall_plus"), for: UIControl.State.normal)
-        plusButton.rx.tap.subscribe(onNext: { [weak self] (data) in
-            print("添加购物车")
-        }).disposed(by: disposeBag)
-        
-        return plusButton
-    }()
-    
-}

+ 13 - 21
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/CollectionViewCell/ProductSlidingTopBottom/ProductSlidingTopBottomCollectionViewCell.swift

@@ -13,6 +13,18 @@ class ProductSlidingTopBottomCollectionViewCell: UICollectionViewCell {
     
     let disposeBag = DisposeBag()
     
+    var productSearchModel: ProductSearchModel? {
+        didSet {
+            iconImagView.kf.setImage(with: kURLImage(name: productSearchModel?.img ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
+            titleLabel.text = productSearchModel?.saleName
+            sellNumberLabel.text = "已售\(productSearchModel?.totalCount ?? 0)件"
+            sellPriceLabel.text = "¥\(productSearchModel?.price ?? 0)"
+            let attrString = NSMutableAttributedString(string:"¥\(productSearchModel?.originPrice ?? 0)")
+            attrString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
+            markPriceLabel.attributedText = attrString
+        }
+    }
+    
     typealias PlusClosure = (_ productSearchModel: ProductSearchModel?,_ indexPath:IndexPath?) -> Void
      var plusClosure : PlusClosure?
     
@@ -96,7 +108,6 @@ class ProductSlidingTopBottomCollectionViewCell: UICollectionViewCell {
     
     private lazy var titleLabel: UILabel = {
         let titleLabel = UILabel()
-        titleLabel.text = "海南冰糖心木瓜 1个装"
         titleLabel.textColor = k333333Color
         titleLabel.font = kScaleMediumFont15
         titleLabel.textAlignment = .left
@@ -105,8 +116,7 @@ class ProductSlidingTopBottomCollectionViewCell: UICollectionViewCell {
     }()
     
     private lazy var sellNumberLabel: UILabel = {
-        let sellNumberLabel = UILabel()
-        sellNumberLabel.text = "已售2400件"
+        let sellNumberLabel = UILabel()        
         sellNumberLabel.textColor = k999999Color
         sellNumberLabel.font = kScaleRegularFont12
         return sellNumberLabel
@@ -114,7 +124,6 @@ class ProductSlidingTopBottomCollectionViewCell: UICollectionViewCell {
     
     private lazy var sellPriceLabel: UILabel = {
         let sellPriceLabel = UILabel()
-        sellPriceLabel.text = "¥11.8"
         sellPriceLabel.textColor = kfe352bColor
         sellPriceLabel.font = kScaleBoldFont15
         sellPriceLabel.textAlignment = .left
@@ -123,12 +132,8 @@ class ProductSlidingTopBottomCollectionViewCell: UICollectionViewCell {
     
     private lazy var markPriceLabel: UILabel = {
         let markPriceLabel = UILabel()
-        markPriceLabel.text = "¥24.4"
         markPriceLabel.textColor = kbbbbbbColor
         markPriceLabel.font = kScaleRegularFont13
-        let attrString = NSMutableAttributedString(string: "¥24.4")
-        attrString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
-        markPriceLabel.attributedText = attrString
         return markPriceLabel
     }()
     
@@ -145,17 +150,4 @@ class ProductSlidingTopBottomCollectionViewCell: UICollectionViewCell {
         return plusButton
     }()
     
-    var productSearchModel: ProductSearchModel? {
-        didSet {
-            iconImagView.kf.setImage(with: kURLImage(name: productSearchModel?.img ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
-            titleLabel.text = productSearchModel?.name
-            sellNumberLabel.text = "已售\(productSearchModel?.totalCount ?? 0)件"
-            sellPriceLabel.text = "¥\(productSearchModel?.price ?? 0)"
-            let attributeString = NSMutableAttributedString(string:"¥\(productSearchModel?.originPrice ?? 0)")
-            attributeString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
-            markPriceLabel.attributedText = attributeString
-
-        }
-    }
-    
 }

+ 44 - 0
RainbowPlanet/RainbowPlanet/Service/Model/UserModel/DefaultContactInfoModel.swift

@@ -0,0 +1,44 @@
+//
+//  DefaultContactInfoModel.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/15.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import ObjectMapper
+
+
+class DefaultContactInfoModel : NSObject, Mappable{
+    
+    var createdAt : AnyObject?
+    var deletedAt : AnyObject?
+    var id : Int?
+    var isDefault : Int?
+    var mobile : String?
+    var name : String?
+    var uid : Int?
+    var updatedAt : AnyObject?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return DefaultContactInfoModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        createdAt <- map["created_at"]
+        deletedAt <- map["deleted_at"]
+        id <- map["id"]
+        isDefault <- map["is_default"]
+        mobile <- map["mobile"]
+        name <- map["name"]
+        uid <- map["uid"]
+        updatedAt <- map["updated_at"]
+        
+    }
+    
+}

+ 9 - 2
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift

@@ -318,7 +318,11 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         parameters.updateValue(shop_id, forKey: "shop_id")
-        parameters.updateValue(isSelect, forKey: "isSelect")
+        parameters.updateValue(isSelect, forKey: "is_select")
+        
+        // 本地获取deliver_type
+        let deliver_type = DeliveryMethodTypeModel.shared().getModel()?.deliveryMethodType
+        parameters.updateValue(deliver_type ?? "0", forKey: "deliver_type")
         
         SwiftProgressHUD.shared().showWait()
         SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceProductApi.productCartIsSel(parameters: parameters))) { (rootModel) in
@@ -336,11 +340,14 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///   - completion: 回调
     func productCartAllSelApi(isSelect:Int = 0, completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
-        parameters.updateValue(isSelect, forKey: "isSelect")
+        parameters.updateValue(isSelect, forKey: "is_select")
         // 本地获取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")
         
         SwiftProgressHUD.shared().showWait()
         SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceProductApi.productCartAllSel(parameters: parameters))) { (rootModel) in

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

@@ -51,11 +51,11 @@ public let kProductCartAmountApi = "/product/setProductAmount"
 
 // MARK: - 购物车-选中
 /// 购物车-选中
-public let kProductCartIsSelApi = "/cart/isSelect"
+public let kProductCartIsSelApi = "/product/isSelect"
 
 // MARK: - 购物车-全选
 /// 购物车-全选
-public let kProductCartAllSelApi = "/cart/isSelectAll"
+public let kProductCartAllSelApi = "/product/isSelectAll"
 
 
 /// 商品

+ 16 - 1
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift

@@ -390,14 +390,29 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         let parameters = Dictionary<String,Any>()
         SwiftProgressHUD.shared().showWait()
         SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceUserApi.userDefaultExpress(parameters: parameters))) {(rootModel) in
-            let rootModel = rootModel as! RootModel
             SwiftProgressHUD.shared().hide()
+            let rootModel = rootModel as! RootModel
             
             let expressAddrModel = ExpressAddresModel(JSONString: rootModel.data ?? "")
             completion(expressAddrModel as Any)
         }
     }
     
+    // MARK: - 获取默认快递信息
+    /// 获取默认快递信息
+    ///
+    /// - Parameter completion: 成功回调
+    func userDefaultContactApi(completion: @escaping apiCallBack) {
+        let parameters = Dictionary<String,Any>()
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceUserApi.userDefaultContact(parameters: parameters))) {(rootModel) in
+            SwiftProgressHUD.shared().hide()
+            let rootModel = rootModel as! RootModel
+            
+            let contactMdl = DefaultContactInfoModel(JSONString: rootModel.data ?? "")
+            completion(contactMdl as Any)
+        }
+    }
     
     // MARK: - 新增、编辑 自提地址收货人信息
     /// 新增、编辑 自提地址收货人信息

+ 14 - 2
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaServiceUserApi.swift

@@ -73,6 +73,10 @@ public let kUserExpreesContactsListApi = "/user/expreesContactsList"
 /// 获取默认快递信息
 public let kUserDefaultExpressApi = "/user/getDefault"
 
+// MARK: - 获取默认自提收货人
+/// 获取默认自提收货人
+public let kUserDefaultContactApi = "/user/getContactsDefault"
+
 // MARK: - 新增、编辑 自提地址收货人信息
 /// 新增、编辑 自提地址收货人信息
 public let kUserSaveExpreesContactsApi = "/user/saveExpreesContacts"
@@ -111,6 +115,7 @@ public let kUserSetDeliverTypeApi = "/user/setDeliverType"
 /// - userAddressDelete: 删除(自提/快递)地址
 /// - userExpreesContactsList: 自提点收货人列表
 /// - userDefaultExpress: 获取默认快递信息
+/// - userDefaultContact: 获取默认自提收货人
 /// - userSaveExpreesContacts: 新增、编辑 自提地址收货人信息
 /// - userDelExpreesContacts: 删除自提点收货人信息
 /// - userSetExpreesContactsDefault: 自提点收货人信息,设置默认
@@ -133,6 +138,7 @@ public enum SwiftMoyaServiceUserApi {
     case userAddressDelete(parameters:Dictionary<String, Any>)
     case userExpreesContactsList(parameters:Dictionary<String, Any>)
     case userDefaultExpress(parameters:Dictionary<String, Any>)
+    case userDefaultContact(parameters:Dictionary<String, Any>)
     case userSaveExpreesContacts(parameters:Dictionary<String, Any>)
     case userDelExpreesContacts(parameters:Dictionary<String, Any>)
     case userSetExpreesContactsDefault(parameters:Dictionary<String, Any>)
@@ -161,6 +167,7 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userAddressDelete,
              .userExpreesContactsList,
              .userDefaultExpress,
+             .userDefaultContact,
              .userSaveExpreesContacts,
              .userDelExpreesContacts,
              .userSetExpreesContactsDefault,
@@ -205,6 +212,8 @@ extension SwiftMoyaServiceUserApi: TargetType {
             return kUserExpreesContactsListApi
         case .userDefaultExpress:
             return kUserDefaultExpressApi
+        case .userDefaultContact:
+            return kUserDefaultContactApi
         case .userSaveExpreesContacts:
             return kUserSaveExpreesContactsApi
         case .userDelExpreesContacts:
@@ -237,12 +246,13 @@ extension SwiftMoyaServiceUserApi: TargetType {
             :
             return .post
         case .userAddressIsDefault,
-             .userExpreesContactsList,
              .userSetDeliverType
             :
             return .put
         case .userSelfAddressList,
-             .userDefaultExpress
+             .userExpreesContactsList,
+             .userDefaultExpress,
+             .userDefaultContact
             :
             return .get
         case .userAddressDelete,
@@ -273,6 +283,7 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userAddressDelete(var parameters),
              .userExpreesContactsList(var parameters),
              .userDefaultExpress(var parameters),
+             .userDefaultContact(var parameters),
              .userSaveExpreesContacts(var parameters),
              .userDelExpreesContacts(var parameters),
              .userSetExpreesContactsDefault(var parameters),
@@ -316,6 +327,7 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userAddressDelete,
              .userExpreesContactsList,
              .userDefaultExpress,
+             .userDefaultContact,
              .userSaveExpreesContacts,
              .userDelExpreesContacts,
              .userSetExpreesContactsDefault,