Bläddra i källkod

Merge branch 'feature/nanxinlin' into develop

南鑫林 6 år sedan
förälder
incheckning
fc6d592498
44 ändrade filer med 531 tillägg och 186 borttagningar
  1. 16 4
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 2 0
      RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift
  3. 104 12
      RainbowPlanet/RainbowPlanet/Base/BaseWebViewController/BaseWebViewController.swift
  4. 57 0
      RainbowPlanet/RainbowPlanet/Manager/PayManager/PayManagerPay/PayManagerPay.swift
  5. 2 2
      RainbowPlanet/RainbowPlanet/Manager/PayManager/PayManagerView/CommonPayHeader.swift
  6. 8 1
      RainbowPlanet/RainbowPlanet/Manager/PayManager/PayManagerView/CommonPayView.swift
  7. 11 1
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/SearchModule/SearchResult/View/SearchResultNavigationbarView.swift
  8. 16 1
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/SearchModule/SearchResult/View/SearchResultView.swift
  9. 38 0
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/SearchModule/SearchResult/ViewController/SearchResultViewController.swift
  10. 4 0
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderListViewController.swift
  11. 27 8
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderViewController.swift
  12. 17 4
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderDetail/ViewController/OrderDetailViewController.swift
  13. 46 10
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderLogistics/View/OrderLogisticsInfoCell.swift
  14. 1 1
      RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/RegisterLogin/View/RegisterLoginView.swift
  15. 1 41
      RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartPayOrder/ViewController/ShoppingCartPayOrderController.swift
  16. 11 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/View/CategorySearchView.swift
  17. 5 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/View/CategoryTableViewCell.swift
  18. 14 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/View/CategoryView.swift
  19. 41 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/ViewController/CategoryViewController.swift
  20. 0 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailHeader/ProductDetailFSPagerViewCell.swift
  21. 0 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailHeader/ProductDetailSectionHeader.swift
  22. 0 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailHeader/ProductDetailTableViewHeaderView.swift
  23. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailView.swift
  24. 0 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/ViewController/ProductDetailViewController.swift
  25. 5 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/ProductCollectionReusableView/ProductFloorBannerView.swift
  26. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/ProductCollectionReusableView/ProductFloorCenterHeaderCollectionReusableView.swift
  27. 2 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/ProductCollectionReusableView/ProductFloorFullLeftHeaderCollectionReusableView.swift
  28. 2 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/ProductCollectionReusableView/ProductFloorLeftHeaderCollectionReusableView.swift
  29. 12 14
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHBigTableViewCell.swift
  30. 12 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHSmallTableViewCell.swift
  31. 1 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallBanner/ShoppingMallBannerFSPagerViewCell.swift
  32. 4 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallBanner/ShoppingMallBannerTableViewCell.swift
  33. 7 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallCategory/ShoppingMallCategoryTableViewCell.swift
  34. 0 3
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/Floor/ShoppingMallFloorTableViewCell.swift
  35. 5 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/FloorCell/ShoppingMallSlidingLeftRight/ShoppingMallSlidingLeftRightBgCollectionViewCell.swift
  36. 5 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallSepcial/ShoppingMallSepcialTableViewCell.swift
  37. 38 5
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift
  38. 3 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/ViewController/SpecialViewController.swift
  39. 2 60
      RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSModel.swift
  40. 1 1
      RainbowPlanet/RainbowPlanet/Service/Model/OrderModel/OrderCreateBackModel.swift
  41. 0 1
      RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductDetailModel.swift
  42. 5 5
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaNetWorkServiceOrder.swift
  43. 2 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift
  44. 2 2
      RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/AlertSheetView.swift

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

@@ -8,6 +8,7 @@
 
 /* Begin PBXBuildFile section */
 		0A110C4CD931995B8E8BF7C5 /* Pods_RainbowPlanet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D469F6C3768252BCB7001EDD /* Pods_RainbowPlanet.framework */; };
+		A7003EA3229192CC004E51FB /* PayManagerPay.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7003EA2229192CC004E51FB /* PayManagerPay.swift */; };
 		A70B2C042283D06B00B2449F /* ProductFloorFullLeftHeaderCollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70B2C032283D06B00B2449F /* ProductFloorFullLeftHeaderCollectionReusableView.swift */; };
 		A70B2C072284305400B2449F /* ProductModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70B2C062284305400B2449F /* ProductModel.swift */; };
 		A70B2C102286A3BC00B2449F /* ProductDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70B2C0F2286A3BC00B2449F /* ProductDetailModel.swift */; };
@@ -388,6 +389,7 @@
 /* Begin PBXFileReference section */
 		57C497E128081597F165C771 /* Pods-RainbowPlanet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RainbowPlanet.release.xcconfig"; path = "Pods/Target Support Files/Pods-RainbowPlanet/Pods-RainbowPlanet.release.xcconfig"; sourceTree = "<group>"; };
 		88DF1EFD2E202DA7C627E8A7 /* Pods_RainbowPlanetUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RainbowPlanetUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		A7003EA2229192CC004E51FB /* PayManagerPay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayManagerPay.swift; sourceTree = "<group>"; };
 		A70B2C032283D06B00B2449F /* ProductFloorFullLeftHeaderCollectionReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFloorFullLeftHeaderCollectionReusableView.swift; sourceTree = "<group>"; };
 		A70B2C062284305400B2449F /* ProductModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductModel.swift; sourceTree = "<group>"; };
 		A70B2C0F2286A3BC00B2449F /* ProductDetailModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductDetailModel.swift; sourceTree = "<group>"; };
@@ -814,6 +816,14 @@
 			name = Pods;
 			sourceTree = "<group>";
 		};
+		A7003EA1229192AD004E51FB /* PayManagerPay */ = {
+			isa = PBXGroup;
+			children = (
+				A7003EA2229192CC004E51FB /* PayManagerPay.swift */,
+			);
+			path = PayManagerPay;
+			sourceTree = "<group>";
+		};
 		A70B2C0522841F1B00B2449F /* FloorCell */ = {
 			isa = PBXGroup;
 			children = (
@@ -897,9 +907,10 @@
 		A70B2C192286B4ED00B2449F /* View */ = {
 			isa = PBXGroup;
 			children = (
-				A70B843322911AF600882BC5 /* ProductDetailView.swift */,
+				A70B2C3B228819E900B2449F /* ProductDetailHeader */,
 				A70B2C702289016600B2449F /* ProductDetailSkuView */,
 				A70B2C39228819CA00B2449F /* Cell */,
+				A70B843322911AF600882BC5 /* ProductDetailView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -1070,7 +1081,6 @@
 				A70B2C722289019200B2449F /* ProductDetailSkuView.swift */,
 				A70B2C74228920BA00B2449F /* ProductDetailSkuSectionHeaerCollectionReusableView.swift */,
 				A70B2C34228815F700B2449F /* ProductDetailProductSkuLabelCollectionViewCell.swift */,
-				A70B2C3B228819E900B2449F /* ProductDetailHeader */,
 			);
 			path = ProductDetailSkuView;
 			sourceTree = "<group>";
@@ -1606,6 +1616,7 @@
 		A72A730522321F1D00B21995 /* PayManager */ = {
 			isa = PBXGroup;
 			children = (
+				A7003EA1229192AD004E51FB /* PayManagerPay */,
 				BDEF778F228571C200ED0AC0 /* PayManagerView */,
 				A72A7331223256D700B21995 /* PayManager */,
 				A72A730622321F2900B21995 /* AlipayManager */,
@@ -1771,10 +1782,10 @@
 		A775CBFC2237483E00EBDCF8 /* View */ = {
 			isa = PBXGroup;
 			children = (
+				A7A98E3422802A60005306E9 /* ShoppingMallBanner */,
 				A7B4E730228177A90012914A /* ShoppingMallFloor */,
 				A7A98E3E22804647005306E9 /* ShoppingMallSepcial */,
 				A7A98E38228030F8005306E9 /* ShoppingMallCategory */,
-				A7A98E3422802A60005306E9 /* ShoppingMallBanner */,
 				A775CBFD2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift */,
 				A775CBFF223774A300EBDCF8 /* ShoppingMallView.swift */,
 				A7A98E3022801B10005306E9 /* ShoppingMallListView.swift */,
@@ -2025,9 +2036,9 @@
 		A77F2CA32232010F001BD3F6 /* ShoppingMallModule */ = {
 			isa = PBXGroup;
 			children = (
+				A77F2CA42232010F001BD3F6 /* ShoppingMall */,
 				A7FF1550228AC22700A85748 /* ProductAllComment */,
 				A70B2C122286B14C00B2449F /* ProductView */,
-				A77F2CA42232010F001BD3F6 /* ShoppingMall */,
 				A70B2C112286B10000B2449F /* ProductDetail */,
 				A70B2C5622886AAA00B2449F /* Shop */,
 				A7A98E03227EB7FD005306E9 /* Category */,
@@ -3415,6 +3426,7 @@
 				A77F2CB52232010F001BD3F6 /* ShoppingMallViewController.swift in Sources */,
 				A71AA513227215B5008FF1A5 /* ExpressAddressListView.swift in Sources */,
 				A7B4E723228154750012914A /* ProductFloorBannerView.swift in Sources */,
+				A7003EA3229192CC004E51FB /* PayManagerPay.swift in Sources */,
 				A7DC467F22783A47001F3EFC /* EditExpressAddressTableViewCell.swift in Sources */,
 				A7A98E4522804C63005306E9 /* ShoppingMallSepcialCollectionViewCell.swift in Sources */,
 				A7824B082271F53A00ABA381 /* EditSetDefaultTableViewCell.swift in Sources */,

+ 2 - 0
RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift

@@ -15,6 +15,8 @@ class BaseTabbarViewController: UITabBarController {
         return _sharedInstance
     }
 
+    
+    
     override func viewDidLoad() {
         super.viewDidLoad()
 

+ 104 - 12
RainbowPlanet/RainbowPlanet/Base/BaseWebViewController/BaseWebViewController.swift

@@ -7,24 +7,116 @@
 //
 
 import UIKit
+import WebKit
 
 class BaseWebViewController: BaseViewController {
-
+    
+    
     override func viewDidLoad() {
         super.viewDidLoad()
-
-        // Do any additional setup after loading the view.
+        setupViews()
+        setupLayouts()
     }
     
-
-    /*
-    // MARK: - Navigation
-
-    // In a storyboard-based application, you will often want to do a little preparation before navigation
-    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
-        // Get the new view controller using segue.destination.
-        // Pass the selected object to the new view controller.
+    override func didReceiveMemoryWarning() {
+        super.didReceiveMemoryWarning()
+        // Dispose of any resources that can be recreated.
+    }
+    
+    //加载普通URL
+    var URLString : String?
+    //加载本地URL
+    var HTMLName : String?
+    //加载本地的js
+    var scriptMessageHandlerArray : Array<Any>?
+    //POST加载字典
+    var parameters = [String : Any]()
+    
+    //MARK: - view
+    override func setupViews() {
+        view.addSubview(wkWebView)
+    }
+    override func setupLayouts() {
+    }
+    
+    //MARK: -  action
+    @objc private func backAction() {
+        
+        self.wkWebView.webView.stopLoading()
+        if self.wkWebView.webView.canGoBack {
+            self.wkWebView.webView.goBack()
+        }else {
+            self.navigationController?.popViewController(animated: true)
+        }
     }
-    */
+    
+    
+    //MARK: - lazy
+    
+    lazy var wkWebView: WebView = {
+        let wkWebView = WebView.init(frame: CGRect(x: 0, y: kNavBarTotalHeight, width: kScreenWidth, height: kScreenHeight - kNavBarTotalHeight))
+        wkWebView.delegate = self
+        wkWebView.webConfig = webConfig
+        //// 加载普通URL
+        if (URLString != nil) {
+            wkWebView.webloadType(self, .URLString(url: URLString!))
+        }
+        
+        // 加载本地URL
+        if (HTMLName != nil && scriptMessageHandlerArray != nil) {
+            webConfig.scriptMessageHandlerArray = scriptMessageHandlerArray as! [String]
+            wkWebView.webloadType(self, .HTMLName(name: HTMLName!))
+        }
+        
+        // POST加载
+        if !parameters.isEmpty &&  URLString != nil {
+            wkWebView.webloadType(self, .POST(url: URLString!, parameters: parameters))
+        }
+        
+        return wkWebView
+    }()
+    
+    lazy var webConfig: WKWebViewConfig = {
+        var webConfig = WKWebViewConfig()
+        return webConfig
+    }()
+    
+}
 
+extension BaseWebViewController:WKWebViewDelegate{
+    /// 服务器开始请求的时候调用
+    func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void){
+        
+    }
+    
+    /// 页面开始加载
+    func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!){
+        
+    }
+    
+    /// 页面加载完成
+    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!){
+        
+    }
+    
+    /// 跳转失败的时候调用
+    func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error){
+        
+    }
+    
+    /// 内容加载失败
+    func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error){
+        
+    }
+    
+    /// 执行JS注入方法
+    func webViewUserContentController(_ scriptMessageHandlerArray:[String], didReceive message: WKScriptMessage){
+        
+    }
+    
+    /// JS执行回调方法
+    func webViewEvaluateJavaScript(_ result:Any?,error:Error?){
+        
+    }
 }
+

+ 57 - 0
RainbowPlanet/RainbowPlanet/Manager/PayManager/PayManagerPay/PayManagerPay.swift

@@ -0,0 +1,57 @@
+//
+//  PayManagerPay.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/5/19.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class PayManagerPay: NSObject {
+    static let shared : PayManagerPay = PayManagerPay()
+    
+    
+    func payAlertView(orderPayModel: OrderCreateBackModel){
+        // 弹出支付方式View
+        AlertSheetView.payAlertSheetView(paymentAmount:orderPayModel.money ?? "",cancelClosure: {
+            [weak self] in
+            self?.pushVC(payStatus: false)
+            }, sureClosure: { [weak self] (payType) in
+                switch payType {
+                case .wechatPay:
+                    self?.payWeixinpayApi(orderPayModel: orderPayModel)
+                case .aliPay:
+                    self?.payAlipayApi(orderPayModel: orderPayModel)
+                }
+        })
+    }
+    // 微信支付
+    func payWeixinpayApi(orderPayModel: OrderCreateBackModel) {
+        SwiftMoyaNetWorkServicePay.shared().payWeixinpayApi(paraMdl: orderPayModel) { [weak self] (weChatpayOrderModel) -> (Void) in
+            PayManager.shared().weixinpay(wechatpayOrderModel: weChatpayOrderModel as! WeChatpayOrderModel, successPayBlock: {
+                self?.pushVC(payStatus: true)
+            }, failPayBlock: {
+                self?.pushVC(payStatus: false)
+            })
+        }
+    }
+    
+    // 支付宝支付
+    func payAlipayApi(orderPayModel: OrderCreateBackModel) {
+        SwiftMoyaNetWorkServicePay.shared().payAlipayApi(paraMdl: orderPayModel) { [weak self] (orderString) -> (Void) in
+            PayManager.shared().alipay(orderString: orderString as? String ?? "" , successPayBlock: {
+                self?.pushVC(payStatus: true)
+            }, failPayBlock: {
+                self?.pushVC(payStatus: false)
+            })
+        }
+    }
+    
+    //跳转到字符失败,跟支付成功页面
+    func pushVC(payStatus: Bool){
+        let vc = ShoppingCartFinishPayController()
+        vc.payStatus = payStatus
+        getCurrentVC().navigationController?.pushViewController(vc, animated: true)
+    }
+}

+ 2 - 2
RainbowPlanet/RainbowPlanet/Manager/PayManager/PayManagerView/CommonPayHeader.swift

@@ -15,9 +15,9 @@ class CommonPayHeader: BaseView {
     typealias DismissBlock = () -> Void
     var dismissBlock : DismissBlock?
     
-    var payAmount: Int? {
+    var payAmount: String? {
         didSet {
-            titleLabel.text = "支付金额¥\(payAmount ?? 0)"
+            titleLabel.text = "支付金额 ¥\(payAmount ?? "")"
         }
     }
     

+ 8 - 1
RainbowPlanet/RainbowPlanet/Manager/PayManager/PayManagerView/CommonPayView.swift

@@ -63,6 +63,7 @@ class CommonPayView: FWPopupView {
         tableView.estimatedRowHeight = 0.000001
         tableView.estimatedSectionFooterHeight = 0.000001
         tableView.estimatedSectionHeaderHeight = 0.000001
+        tableView.isScrollEnabled = false
         return tableView
     }()
     
@@ -80,6 +81,12 @@ class CommonPayView: FWPopupView {
         return confirmPayBtn
     }()
     
+    var paymentAmount:String? {
+        didSet {
+            tableView.reloadData()
+        }
+    }
+    
 }
 
 extension CommonPayView : UITableViewDelegate, UITableViewDataSource {
@@ -139,7 +146,7 @@ extension CommonPayView : UITableViewDelegate, UITableViewDataSource {
     
     func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
         let headerView = CommonPayHeader(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 50))
-        headerView.payAmount = 155
+        headerView.payAmount = paymentAmount
         headerView.dismissBlock = {
             [weak self] in
             if let disTransBlock = self?.disTransBlock {

+ 11 - 1
RainbowPlanet/RainbowPlanet/Modules/CommonModules/SearchModule/SearchResult/View/SearchResultNavigationbarView.swift

@@ -134,11 +134,21 @@ class SearchResultNavigationbarView: BaseView {
                 shoppingCarBlock()
             }
         }).disposed(by: disposeBag)
-        shoppingCarButton.pp.addBadge(number: 5)
 //        shoppingCarButton.pp.setBadge(height: 14)
 //        shoppingCarButton.pp.badgeView.font = kRegularFont10
         shoppingCarButton.pp.badgeView.backgroundColor = kfe352bColor
         shoppingCarButton.pp.moveBadge(x: -2, y: 2)
         return shoppingCarButton
     }()
+    
+    var productCartCountModel : ProductCartCountModel? {
+        didSet {
+            
+            if productCartCountModel?.count == 0 {
+                shoppingCarButton.pp.hiddenBadge()
+            }else {
+                shoppingCarButton.pp.addBadge(number: productCartCountModel?.count ?? 0)
+            }
+        }
+    }
 }

+ 16 - 1
RainbowPlanet/RainbowPlanet/Modules/CommonModules/SearchModule/SearchResult/View/SearchResultView.swift

@@ -51,6 +51,12 @@ class SearchResultView: BaseView {
         tableView.masksToBounds = true
         return tableView
     }()
+    
+    typealias DidSelectRow = (_ indexPath: IndexPath) -> Void
+    var didSelectRow : DidSelectRow?
+    
+    typealias AddCartClosure = (ProductSearchModel,IndexPath) -> Void
+    var addCartClosure : AddCartClosure?
 }
 
 extension SearchResultView :UITableViewDataSource,UITableViewDelegate  {
@@ -67,11 +73,20 @@ extension SearchResultView :UITableViewDataSource,UITableViewDelegate  {
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let cell = ProductHBigTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
         cell.productSearchModel = productSearchModelArray![indexPath.row]
+        cell.plusClosure = {
+            [weak self] (productSearchModel,indexPath) in
+            
+            if let addCartClosure = self?.addCartClosure {
+                addCartClosure(productSearchModel!,indexPath!)
+            }
+        }
         return cell
     }
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-        
+        if let didSelectRow = self.didSelectRow {
+            didSelectRow(indexPath)
+        }
     }
     
 }

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

@@ -43,6 +43,7 @@ class SearchResultViewController: BaseViewController {
         searchResultView.tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) {
             [weak self] (page) in
             self?.productSearchApi(page: page)
+            self?.productGetCartCountApi()
         }
         searchResultView.tableView.addFooterWithWithHeader(withAutomaticallyRefresh: true) {
             [weak self] (page) in
@@ -58,8 +59,22 @@ class SearchResultViewController: BaseViewController {
             self?.productSearchApi(page: 1)
         }
         navigationBarView.shoppingCarBlock = {
+            [weak self] in
+            self?.tabBarController?.selectedIndex = 1
+        }
+        
+        searchResultView.didSelectRow = {
+            [weak self] indexPath in
+            let vc = ProductDetailViewController()
+            let productSearch = self?.productSearchModelArray[indexPath.row]
+            vc.productSearchModel = productSearch
+            self?.navigationController?.pushViewController(vc, animated: true)
             
         }
+        searchResultView.addCartClosure = {
+            [weak self]  (productSearchModel,indexPath) in
+            self?.addCart(productSearchModel: productSearchModel, indexPath: indexPath)
+        }
     }
     
     private lazy var navigationBarView: SearchResultNavigationbarView = {
@@ -90,4 +105,27 @@ class SearchResultViewController: BaseViewController {
             }
         }
     }
+    
+    /// 获取购物车数量
+    func productGetCartCountApi() {
+        SwiftMoyaNetWorkServiceProduct.shared().productGetCartCountApi {
+            [weak self] (productCartCountModel) -> (Void) in
+            self?.navigationBarView.productCartCountModel = productCartCountModel as? ProductCartCountModel
+        }
+    }
+    
+    /// 添加购物车
+    ///
+    /// - Returns:
+    func addCart(productSearchModel:ProductSearchModel,indexPath:IndexPath) {
+        
+        
+        productSearchModel.isSelect = 1
+        SwiftMoyaNetWorkServiceProduct.shared().productCartListAddApi(productSearchModel: productSearchModel, completion: {
+            [weak self] (cartAmountModel) -> (Void) in
+            self?.searchResultView.tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.none)
+            SwiftProgressHUD.shared().showText("已加入购物车")
+            self?.productGetCartCountApi()
+        })
+    }
 }

+ 4 - 0
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderListViewController.swift

@@ -58,6 +58,10 @@ class OrderListViewController: UIViewController {
         
     }
     
+    
+    /// 订单列表
+    ///
+    /// - Parameter page: <#page description#>
     func orderPurchaseOrderListApi(page:Int = 1) {
         
         SwiftMoyaNetWorkServiceOrder.shared().orderPurchaseOrderListApi(page: page, status: orderVCType.map { $0.rawValue } ?? -1) {

+ 27 - 8
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderViewController.swift

@@ -138,7 +138,6 @@ extension OrderViewController : JXSegmentedViewDelegate {
 
 extension OrderViewController :JXSegmentedListContainerViewDataSource {
     
-    
     func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
         if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
             return titleDataSource.dataSource.count
@@ -150,7 +149,7 @@ extension OrderViewController :JXSegmentedListContainerViewDataSource {
         vc.orderVCType =  OrderVCType(rawValue: index-1)
         vc.setButtonBlock = {
             [weak self] (button,orderModel) in
-            self?.setButton(button: button, orderModel: orderModel)
+            self?.setButton(button: button, orderModel: orderModel, vc: vc)
         }
         
         vc.didSelectBlock = {
@@ -158,25 +157,30 @@ extension OrderViewController :JXSegmentedListContainerViewDataSource {
             let orderDetailVC = OrderDetailViewController()
             orderDetailVC.orderModel = orderModel
             orderDetailVC.cancelOrderClosure = {
-                vc.change = true
+                vc.orderPurchaseOrderListApi(page: 1)
             }
             self?.navigationController?.pushViewController(orderDetailVC, animated: true)
         }
         return vc
     }
     
-    func setButton(button:UIButton,orderModel:OrderModel) {
+    func setButton(button:UIButton,orderModel:OrderModel,vc: OrderListViewController) {
         if button.titleLabel?.text == "去付款" {
-            
+            // 弹出支付方式View
+            let orderPayModel = OrderCreateBackModel()
+            orderPayModel.money = "\(orderModel.realPrice ?? 0)"
+            orderPayModel.patchNum = orderModel.patchNum
+            PayManagerPay.shared.payAlertView(orderPayModel: orderPayModel)
         }
         if button.titleLabel?.text == "取消订单" {
-            
+            orderPurchaseCloseApi(orderModel: orderModel, vc: vc)
         }
         if button.titleLabel?.text == "确认收货" {
-            
+            orderPurchaseConfirmApi(orderModel: orderModel, vc: vc)
         }
         if button.titleLabel?.text == "查看物流" {
-            
+            let vc = OrderLogisticsController()
+            self.navigationController?.pushViewController(vc, animated: true)
         }
         if button.titleLabel?.text == "退款详情" {
             let vc = OrderRefunddetailsViewController()
@@ -199,4 +203,19 @@ extension OrderViewController :JXSegmentedListContainerViewDataSource {
             self.navigationController?.pushViewController(vc, animated: true)
         }
     }
+    
+    
+    /// 取消订单
+    func orderPurchaseCloseApi(orderModel:OrderModel,vc: OrderListViewController) {
+        SwiftMoyaNetWorkServiceOrder.shared().orderPurchaseCloseApi(patchNum: orderModel.patchNum ?? "") { (data) -> (Void) in
+            vc.orderPurchaseOrderListApi(page: 1)
+        }
+    }
+    
+    /// 确认收货
+    func orderPurchaseConfirmApi(orderModel:OrderModel,vc: OrderListViewController) {
+        SwiftMoyaNetWorkServiceOrder.shared().orderPurchaseConfirmApi(purchaseId: orderModel.purchaseNo!) { (data) -> (Void) in
+            vc.orderPurchaseOrderListApi(page: 1)
+        }
+    }
 }

+ 17 - 4
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderDetail/ViewController/OrderDetailViewController.swift

@@ -88,7 +88,11 @@ class OrderDetailViewController: BaseViewController {
     
     func setButton(button:UIButton) {
         if button.titleLabel?.text == "去付款" {
-            
+            // 弹出支付方式View
+            let orderPayModel = OrderCreateBackModel()
+            orderPayModel.money = "\(self.orderDetailModel?.realPrice ?? 0)"
+            orderPayModel.patchNum = self.orderDetailModel?.patchNum
+            PayManagerPay.shared.payAlertView(orderPayModel: orderPayModel)
         }
         if button.titleLabel?.text == "取消订单" {
             SwiftMoyaNetWorkServiceOrder.shared().orderPurchaseCloseApi(patchNum: self.orderDetailModel?.patchNum ?? "") {
@@ -100,10 +104,17 @@ class OrderDetailViewController: BaseViewController {
             }
         }
         if button.titleLabel?.text == "确认收货" {
-            
+            SwiftMoyaNetWorkServiceOrder.shared().orderPurchaseConfirmApi(purchaseId: self.orderDetailModel?.purchaseNo ?? "") {
+                 [weak self] (data) -> (Void) in
+                if let cancelOrderClosure = self?.cancelOrderClosure {
+                    cancelOrderClosure()
+                }
+                self?.navigationController?.popViewController(animated: true)
+            }
         }
         if button.titleLabel?.text == "查看物流" {
-            
+            let vc = OrderLogisticsController()
+            self.navigationController?.pushViewController(vc, animated: true)
         }
         if button.titleLabel?.text == "退款详情" {
             let vc = OrderRefunddetailsViewController()
@@ -111,7 +122,9 @@ class OrderDetailViewController: BaseViewController {
             self.navigationController?.pushViewController(vc, animated: true)
         }
         if button.titleLabel?.text == "去评价" {
-            print("--去评价1")
+            let vc = OrderCommentController()
+            vc.orderDetailModel = self.orderDetailModel
+            self.navigationController?.pushViewController(vc, animated: true)
         }
         if button.titleLabel?.text == "再次购买" {
             let vc = ShopViewController()

+ 46 - 10
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderLogistics/View/OrderLogisticsInfoCell.swift

@@ -20,6 +20,11 @@ class OrderLogisticsInfoCell: UITableViewCell {
         didSet {
             if isFirstCell == true {
                 topLineView.isHidden = true
+                twoLabel.isHidden = false
+                threeLabel.isHidden = false
+            }else {
+                twoLabel.isHidden = true
+                threeLabel.isHidden = true
             }
         }
     }
@@ -61,7 +66,9 @@ class OrderLogisticsInfoCell: UITableViewCell {
         self.selectionStyle = .none
         
         addSubview(informationLabel)
-        addSubview(iconImageView)
+        addSubview(threeLabel)
+        addSubview(twoLabel)
+        addSubview(oneLabel)
         addSubview(timeInfoLabel)
         addSubview(topLineView)
         addSubview(botLineView)
@@ -73,8 +80,18 @@ class OrderLogisticsInfoCell: UITableViewCell {
             make.right.equalTo(-28)
             make.left.equalTo(48)
         }
-        iconImageView.snp.makeConstraints { (make) in
+        oneLabel.snp.makeConstraints { (make) in
             make.left.equalToSuperview().offset(18)
+            make.size.equalTo(6)
+            make.centerY.equalTo(informationLabel)
+        }
+        twoLabel.snp.makeConstraints { (make) in
+            make.centerX.equalTo(oneLabel)
+            make.size.equalTo(9)
+            make.centerY.equalTo(informationLabel)
+        }
+        threeLabel.snp.makeConstraints { (make) in
+            make.centerX.equalTo(oneLabel)
             make.size.equalTo(12)
             make.centerY.equalTo(informationLabel)
         }
@@ -85,24 +102,43 @@ class OrderLogisticsInfoCell: UITableViewCell {
             make.height.equalTo(17)
         }
         topLineView.snp.makeConstraints { (make) in
-            make.centerX.equalTo(iconImageView)
+            make.centerX.equalTo(oneLabel)
             make.top.equalToSuperview()
-            make.bottom.equalTo(iconImageView.snp_top)
+            make.bottom.equalTo(oneLabel.snp_top)
             make.width.equalTo(1)
         }
         botLineView.snp.makeConstraints { (make) in
-            make.centerX.equalTo(iconImageView)
-            make.top.equalTo(iconImageView.snp_bottom)
+            make.centerX.equalTo(oneLabel)
+            make.top.equalTo(oneLabel.snp_bottom)
             make.bottom.equalToSuperview()
             make.width.equalTo(1)
         }
     }
     
     
-    private lazy var iconImageView: UIImageView = {
-        let iconImageView = UIImageView()
-        iconImageView.image = kImage(name: "shopping_cart_trade_finish")
-        return iconImageView
+    private lazy var oneLabel: UILabel = {
+        let oneLabel = UILabel()
+        oneLabel.backgroundColor = ke6e6e6Color
+        oneLabel.layer.cornerRadius = 3
+        oneLabel.masksToBounds = true
+        return oneLabel
+    }()
+    private lazy var twoLabel: UILabel = {
+        let twoLabel = UILabel()
+        twoLabel.backgroundColor = UIColor.white
+        twoLabel.layer.cornerRadius = 4.5
+        twoLabel.isHidden = true
+        twoLabel.masksToBounds = true
+        twoLabel.isHidden = true
+        return twoLabel
+    }()
+    private lazy var threeLabel: UILabel = {
+        let threeLabel = UILabel()
+        threeLabel.backgroundColor = kFFA42FColor.withAlphaComponent(0.4)
+        threeLabel.layer.cornerRadius = 6
+        threeLabel.masksToBounds = true
+        threeLabel.isHidden = true
+        return threeLabel
     }()
     
     private lazy var informationLabel: UILabel = {

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/RegisterLogin/View/RegisterLoginView.swift

@@ -44,7 +44,7 @@ class RegisterLoginView: BaseView {
 
     private lazy var iconImageView: UIImageView = {
         let iconImageView = UIImageView()
-        iconImageView.image = kImage(name: "pic_preload")
+        iconImageView.image = kImage(name: "logo")
         return iconImageView
     }()
 

+ 1 - 41
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartPayOrder/ViewController/ShoppingCartPayOrderController.swift

@@ -117,47 +117,7 @@ class ShoppingCartPayOrderController: BaseViewController {
         
         SwiftMoyaNetWorkServiceOrder.shared().orderCreateApi(paraMdl: paraMdl) { (orderBackModel) -> (Void) in
             // 弹出支付方式View
-            AlertSheetView.payAlertSheetView(cancelClosure: {
-                [weak self] in
-                self?.pushVC(payStatus: false)
-            }, sureClosure: { [weak self] (payType) in
-                switch payType {
-                case .wechatPay:
-                    self?.payWeixinpayApi(orderPayModel: orderBackModel as! OrderCreateBackModel)
-                case .aliPay:
-                    self?.payAlipayApi(orderPayModel: orderBackModel as! OrderCreateBackModel)
-                }
-            })
+            PayManagerPay.shared.payAlertView(orderPayModel: orderBackModel as! OrderCreateBackModel)
         }
     }
-    
-    // 微信支付
-    func payWeixinpayApi(orderPayModel: OrderCreateBackModel) {
-        SwiftMoyaNetWorkServicePay.shared().payWeixinpayApi(paraMdl: orderPayModel) { [weak self] (weChatpayOrderModel) -> (Void) in
-            PayManager.shared().weixinpay(wechatpayOrderModel: weChatpayOrderModel as! WeChatpayOrderModel, successPayBlock: {
-                self?.pushVC(payStatus: true)
-            }, failPayBlock: {
-                self?.pushVC(payStatus: false)
-            })
-        }
-    }
-    
-    //跳转到字符失败,跟支付成功页面
-    func pushVC(payStatus: Bool){
-        let vc = ShoppingCartFinishPayController()
-        vc.payStatus = payStatus
-        self.navigationController?.pushViewController(vc, animated: true)
-    }
-    
-    // 支付宝支付
-    func payAlipayApi(orderPayModel: OrderCreateBackModel) {
-        SwiftMoyaNetWorkServicePay.shared().payAlipayApi(paraMdl: orderPayModel) { [weak self] (orderString) -> (Void) in
-            PayManager.shared().alipay(orderString: orderString as? String ?? "" , successPayBlock: {
-                 self?.pushVC(payStatus: true)
-            }, failPayBlock: {
-                self?.pushVC(payStatus: false)
-            })
-        }
-    }
-    
 }

+ 11 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/View/CategorySearchView.swift

@@ -18,6 +18,17 @@ class CategorySearchView: BaseView {
     typealias SearchResultBlock = (_ keyWord:String) -> Void
     var searchResultBlock : SearchResultBlock?
     
+    var productCartCountModel : ProductCartCountModel? {
+        didSet {
+            
+            if productCartCountModel?.count == 0 {
+               shoppingCarButton.pp.hiddenBadge()
+            }else {
+                shoppingCarButton.pp.addBadge(number: productCartCountModel?.count ?? 0)
+            }
+        }
+    }
+    
     override func setupViews() {
         addSubview(shoppingCarButton)
         addSubview(searchbgView)
@@ -87,7 +98,6 @@ class CategorySearchView: BaseView {
                 shoppingCarBlock()
             }
         }).disposed(by: disposeBag)
-        shoppingCarButton.pp.addBadge(number: 5)
         //        shoppingCarButton.pp.setBadge(height: 14)
         //        shoppingCarButton.pp.badgeView.font = kRegularFont10
         shoppingCarButton.pp.badgeView.backgroundColor = kfe352bColor

+ 5 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/View/CategoryTableViewCell.swift

@@ -39,6 +39,11 @@ class CategoryTableViewCell: UITableViewCell {
         isHighlighted = selected
         titleLable.isHighlighted = selected
         h_Label.isHidden = !selected
+        if selected {
+            backgroundColor = UIColor.white
+        }else {
+            backgroundColor = UIColor.clear
+        }
     }
     
     //MRAK: - 设置View

+ 14 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/View/CategoryView.swift

@@ -44,9 +44,16 @@ class CategoryView: BaseView {
     typealias RightDidSelectRow = (_ indexPath: IndexPath) -> Void
     var rightDidSelectRow : RightDidSelectRow?
     
+    typealias AddCartClosure = (ProductSearchModel,IndexPath) -> Void
+    var addCartClosure : AddCartClosure?
+    
     override func setupViews() {
         addSubview(leftTableView)
         addSubview(rightTableView)
+        let emptyView =  EmptyView.shared.diyCustomEmptyViewStyle2(iconStr: "page04", titleStr: "当前暂无数据")
+        emptyView.contentViewY = kScaleValue(value: 182)
+        rightTableView.ly_emptyView = emptyView
+        rightTableView.ly_startLoading()
     }
     
     override func setupLayouts() {
@@ -117,6 +124,13 @@ extension CategoryView : UITableViewDataSource, UITableViewDelegate {
             } else {
                 let cell = ProductHSmallTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
                 cell.productSearchModel = productSearchModelArray![indexPath.row]
+                cell.plusClosure = {
+                    [weak self] (productSearchModel,indexPath) in
+                    
+                    if let addCartClosure = self?.addCartClosure {
+                        addCartClosure(productSearchModel!,indexPath!)
+                    }
+                }
                 return cell
             }
     }

+ 41 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/ViewController/CategoryViewController.swift

@@ -41,6 +41,9 @@ class CategoryViewController: BaseViewController {
     }
     
     override func setupData() {
+        
+        productGetCartCountApi()
+
         categorySearchView.searchbgView.rx.tap.subscribe(onNext: {
             [weak self] in
             let vc = SearchViewController()
@@ -49,6 +52,10 @@ class CategoryViewController: BaseViewController {
                 
             })
         }).disposed(by: disposeBag)
+        categorySearchView.shoppingCarBlock = {
+            [weak self] in
+            self?.tabBarController?.selectedIndex = 1
+        }
         
         categoryView.leftTableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) {
             [weak self] (page) in
@@ -72,9 +79,20 @@ class CategoryViewController: BaseViewController {
             self?.productSearchApi(page: page)
         }
         
+        
         categoryView.rightDidSelectRow = {
              [weak self] indexPath in
+            let vc = ProductDetailViewController()
+            let productSearch = self?.productSearchModelArray[indexPath.row]
+            vc.productSearchModel = productSearch
+            self?.navigationController?.pushViewController(vc, animated: true)
+            
+        }
+        categoryView.addCartClosure = {
+            [weak self]  (productSearchModel,indexPath) in
+            self?.addCart(productSearchModel: productSearchModel, indexPath: indexPath)
         }
+        
     }
 
     private lazy var categorySearchView: CategorySearchView = {
@@ -129,4 +147,27 @@ class CategoryViewController: BaseViewController {
             }
         }
     }
+    
+    /// 获取购物车数量
+    func productGetCartCountApi() {
+        SwiftMoyaNetWorkServiceProduct.shared().productGetCartCountApi {
+            [weak self] (productCartCountModel) -> (Void) in
+            self?.categorySearchView.productCartCountModel = productCartCountModel as? ProductCartCountModel
+        }
+    }
+    
+    /// 添加购物车
+    ///
+    /// - Returns:
+    func addCart(productSearchModel:ProductSearchModel,indexPath:IndexPath) {
+        
+        
+        productSearchModel.isSelect = 1
+        SwiftMoyaNetWorkServiceProduct.shared().productCartListAddApi(productSearchModel: productSearchModel, completion: {
+            [weak self] (cartAmountModel) -> (Void) in
+            self?.categoryView.rightTableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.none)
+            SwiftProgressHUD.shared().showText("已加入购物车", view: (self?.categoryView.rightTableView)!, textAlignment: .center)
+            self?.productGetCartCountApi()
+        })
+    }
 }

RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailSkuView/ProductDetailHeader/ProductDetailFSPagerViewCell.swift → RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailHeader/ProductDetailFSPagerViewCell.swift


RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailSkuView/ProductDetailHeader/ProductDetailSectionHeader.swift → RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailHeader/ProductDetailSectionHeader.swift


RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailSkuView/ProductDetailHeader/ProductDetailTableViewHeaderView.swift → RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailHeader/ProductDetailTableViewHeaderView.swift


+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/ProductDetailView.swift

@@ -241,8 +241,8 @@ class ProductDetailView: BaseView {
             }else {
                 cartImageView.pp.addBadge(number: productCartCount)
             }
-            self.tableView.reloadData()
             self.view.hide()
+            self.tableView.reloadData()
         }
     }
     var productCartCountModel : ProductCartCountModel? {

+ 0 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/ViewController/ProductDetailViewController.swift

@@ -160,8 +160,6 @@ class ProductDetailViewController: BaseViewController {
                 self?.productDetailView.productSearchListModel = productSearchListModel
             }
         }
-        
-       
     }
     
     

+ 5 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/ProductCollectionReusableView/ProductFloorBannerView.swift

@@ -26,6 +26,11 @@ class ProductFloorBannerView: BaseView {
         bannerButton.setBackgroundImage(kImage(name: "pic_preload"), for: UIControl.State.normal)
         bannerButton.cornerRadius = 4
         bannerButton.masksToBounds = true
+        bannerButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ShoppingMallFloor"), object: self?.cmsRuleModel)
+
+        }).disposed(by: disposeBag)
         return bannerButton
     }()
     

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/ProductCollectionReusableView/ProductFloorCenterHeaderCollectionReusableView.swift

@@ -81,6 +81,7 @@ class ProductFloorCenterHeaderCollectionReusableView: UICollectionReusableView {
             floorLayout()
             floorIsHidden()
             floorTitleView.cmsRuleModel = cmsRuleModel?.rule
+            floorBannerView.cmsRuleModel = cmsRuleModel?.rule
         }
     }
     
@@ -159,5 +160,4 @@ class ProductFloorCenterHeaderCollectionReusableView: UICollectionReusableView {
         }
     }
     
-    
 }

+ 2 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/ProductCollectionReusableView/ProductFloorFullLeftHeaderCollectionReusableView.swift

@@ -82,6 +82,7 @@ class ProductFloorFullLeftHeaderCollectionReusableView: UICollectionReusableView
             floorLayout()
             floorIsHidden()
             floorTitleView.cmsRuleModel = cmsRuleModel?.rule
+            floorBannerView.cmsRuleModel = cmsRuleModel?.rule
         }
     }
     
@@ -159,4 +160,5 @@ class ProductFloorFullLeftHeaderCollectionReusableView: UICollectionReusableView
             floorBannerView.isHidden = false
         }
     }
+
 }

+ 2 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/ProductCollectionReusableView/ProductFloorLeftHeaderCollectionReusableView.swift

@@ -89,6 +89,8 @@ class ProductFloorLeftHeaderCollectionReusableView: UICollectionReusableView {
             floorLayout()
             floorIsHidden()
             floorTitleView.cmsRuleModel = cmsRuleModel?.rule
+            floorBannerView.cmsRuleModel = cmsRuleModel?.rule
+
         }
     }
     

+ 12 - 14
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHBigTableViewCell.swift

@@ -7,20 +7,14 @@
 //
 
 import UIKit
+import RxSwift
 
 class ProductHBigTableViewCell: UITableViewCell {
     
-    override var frame: CGRect {
-        get {
-            return super.frame
-        }
-        set {
-            var frame = newValue
-            frame.origin.x += 14
-            frame.size.width -= 2 * 14
-            super.frame = frame
-        }
-    }
+    let disposeBag = DisposeBag()
+    
+    typealias PlusClosure = (_ productSearchModel: ProductSearchModel?,_ indexPath:IndexPath?) -> Void
+    var plusClosure : PlusClosure?
     
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ProductHBigTableViewCell {
         let ID = "ProductHBigTableViewCell"
@@ -136,15 +130,18 @@ class ProductHBigTableViewCell: UITableViewCell {
     private lazy var markPriceLabel: UILabel = {
         let markPriceLabel = UILabel()
         markPriceLabel.font = kScaleRegularFont13
-        let attributeString = NSMutableAttributedString(string:"¥24.4")
-        attributeString.changeStrikethrough(atAllStyle: NSUnderlineStyle(rawValue: NSUnderlineStyle.single.rawValue), color: kbbbbbbColor)
-        markPriceLabel.attributedText = attributeString
         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
+            if let plusClosure = self?.plusClosure {
+                plusClosure(self?.productSearchModel, self?.indexPath)
+            }
+        }).disposed(by: disposeBag)
         return plusButton
     }()
     
@@ -157,6 +154,7 @@ class ProductHBigTableViewCell: UITableViewCell {
             sellPriceLabel.text = "¥\(productSearchModel?.price ?? 0)"
             let attributeString = NSMutableAttributedString(string:"¥\(productSearchModel?.originPrice ?? 0)")
             attributeString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
+            markPriceLabel.textColor = kbbbbbbColor
             markPriceLabel.attributedText = attributeString
 
         }

+ 12 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHSmallTableViewCell.swift

@@ -7,8 +7,14 @@
 //
 
 import UIKit
+import RxSwift
 
 class ProductHSmallTableViewCell: UITableViewCell {
+    
+    let disposeBag = DisposeBag()
+    
+    typealias PlusClosure = (_ productSearchModel: ProductSearchModel?,_ indexPath:IndexPath?) -> Void
+    var plusClosure : PlusClosure?
 
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ProductHSmallTableViewCell {
         let ID = "ProductHSmallTableViewCell"
@@ -136,6 +142,12 @@ class ProductHSmallTableViewCell: UITableViewCell {
     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
+            if let plusClosure = self?.plusClosure {
+                plusClosure(self?.productSearchModel, self?.indexPath)
+            }
+        }).disposed(by: disposeBag)
         return plusButton
     }()
     

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallBanner/ShoppingMallBannerFSPagerViewCell.swift

@@ -49,6 +49,7 @@ class ShoppingMallBannerFSPagerViewCell: FSPagerViewCell {
     
     private lazy var bgImageView: UIImageView = {
         let bgImageView = UIImageView()
+        bgImageView.isUserInteractionEnabled = true
         return bgImageView
     }()
     

+ 4 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallBanner/ShoppingMallBannerTableViewCell.swift

@@ -97,7 +97,10 @@ extension ShoppingMallBannerTableViewCell:FSPagerViewDataSource,FSPagerViewDeleg
     
     func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) {
         pagerView.deselectItem(at: index, animated: true)
-        pagerView.scrollToItem(at: index, animated: true)
+        let cmsRuleModel = (cmsRuleModels?[index])!
+        
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ShoppingMallBanner"), object: cmsRuleModel.rule)
+        
     }
     
 }

+ 7 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallCategory/ShoppingMallCategoryTableViewCell.swift

@@ -18,7 +18,6 @@ class ShoppingMallCategoryTableViewCell: UITableViewCell {
             var frame = newValue
             frame.origin.x += 14 * kScaleWidth
             frame.size.width -= 14 * kScaleWidth * 2
-//            frame.origin.y += 10 
             super.frame = frame
         }
     }
@@ -119,6 +118,11 @@ extension ShoppingMallCategoryTableViewCell: UICollectionViewDelegateFlowLayout,
         
     }
     
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        let cmsRuleModel = (cmsRuleModels?[indexPath.row])!
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ShoppingMallCategory"), object: cmsRuleModel.rule)
+    }
+    
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
         return CGSize(width:(kScreenWidth-kScaleWidth * 39)/5, height: kScaleValue(value: 67))
     }
@@ -127,6 +131,8 @@ extension ShoppingMallCategoryTableViewCell: UICollectionViewDelegateFlowLayout,
         return UIEdgeInsets(top: 12, left: 0, bottom: 12, right: 0)
     }
     
+    
+    
 }
 
 

+ 0 - 3
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/Floor/ShoppingMallFloorTableViewCell.swift

@@ -355,7 +355,4 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
             return 0
         }
     }
-    
-
 }
-

+ 5 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/FloorCell/ShoppingMallSlidingLeftRight/ShoppingMallSlidingLeftRightBgCollectionViewCell.swift

@@ -115,6 +115,11 @@ extension ShoppingMallSlidingLeftRightBgCollectionViewCell: UICollectionViewDele
         
     }
     
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        let productModel = productModels?[indexPath.section]
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ProductDetailVC"), object: productModel)
+    }
+    
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
         return CGSize(width:120, height: 180)
     }

+ 5 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallSepcial/ShoppingMallSepcialTableViewCell.swift

@@ -17,7 +17,6 @@ class ShoppingMallSepcialTableViewCell: UITableViewCell {
             var frame = newValue
             frame.origin.x += 14 * kScaleWidth
             frame.size.width -= 14 * kScaleWidth * 2
-//            frame.origin.y += 10
             super.frame = frame
         }
     }
@@ -98,6 +97,11 @@ extension ShoppingMallSepcialTableViewCell: UICollectionViewDelegateFlowLayout,U
         return cell
     }
     
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        let cmsRuleModel = (cmsRuleModels?[indexPath.row])!
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ShoppingMallSepcial"), object: cmsRuleModel.rule)
+    }
+    
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
         return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
     }

+ 38 - 5
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift

@@ -47,6 +47,23 @@ class ShoppingMallViewController: BaseViewController {
             vc.productModel = productModel
             self?.navigationController?.pushViewController(vc, animated: true)
         }
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("ShoppingMallBanner"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
+            let cmsRuleModel = notification.object as? CMSRuleModel
+            self?.pushVCCMSRule(cmsRuleModel: cmsRuleModel, areaType: "banner")
+        }
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("ShoppingMallCategory"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
+            let cmsRuleModel = notification.object as? CMSRuleModel
+            self?.pushVCCMSRule(cmsRuleModel: cmsRuleModel, areaType: "category")
+        }
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("ShoppingMallSpecial"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
+            let cmsRuleModel = notification.object as? CMSRuleModel
+            self?.pushVCCMSRule(cmsRuleModel: cmsRuleModel, areaType: "special")
+        }
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("ShoppingMallFloor"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
+            let cmsRuleModel = notification.object as? CMSRuleModel
+            self?.pushVCCMSRule(cmsRuleModel: cmsRuleModel, areaType: "floor")
+        }
         //搜索
         navigationBarView.searchBlock = {
             [weak self] in
@@ -59,11 +76,8 @@ class ShoppingMallViewController: BaseViewController {
         //分类
         navigationBarView.categoryButton.rx.tap.subscribe(onNext: {
             [weak self] in
-//            let vc = CategoryViewController()
-//            vc.navigationBar.title = "团购分类"
-//            self?.navigationController?.pushViewController(vc, animated: true)
-            let vc = SpecialViewController()
-            vc.navigationBar.title = "专题页面"
+            let vc = CategoryViewController()
+            vc.navigationBar.title = "团购分类"
             self?.navigationController?.pushViewController(vc, animated: true)
         }).disposed(by: disposeBag)
         
@@ -72,6 +86,25 @@ class ShoppingMallViewController: BaseViewController {
             self.cmsTemplateSetTemplateNameApi()
         }
     }
+    
+    func pushVCCMSRule(cmsRuleModel:CMSRuleModel?,areaType:String) {
+        switch cmsRuleModel?.rule?.linkType  {
+        case 1:
+            let vc = SpecialViewController()
+            vc.navigationBar.title = cmsRuleModel?.title
+            vc.cmsRuleModel = cmsRuleModel
+            vc.area_type = areaType
+            self.navigationController?.pushViewController(vc, animated: true)
+            break
+        case 2:
+            let vc = BaseWebViewController()
+            vc.URLString = cmsRuleModel?.linkUrl
+            self.navigationController?.pushViewController(vc, animated: true)
+            break
+        default:
+            break
+        }
+    }
 
     private lazy var navigationBarView: ShoppingMallNavigationBarView = {
         let navigationBarView = ShoppingMallNavigationBarView()

+ 3 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/ViewController/SpecialViewController.swift

@@ -10,6 +10,9 @@ import UIKit
 
 class SpecialViewController: BaseViewController {
     
+    var cmsRuleModel : CMSRuleModel?
+    var area_type : String?
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()

+ 2 - 60
RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSModel.swift

@@ -106,9 +106,9 @@ class CMSContentModel : NSObject, NSCoding, Mappable{
     
 }
 
-class CMSRuleModel : NSObject, NSCoding, Mappable{
+class CMSRuleModel : NSObject, Mappable{
     
-    var linkType : String?
+    var linkType : Int?
     var linkUrl : String?
     var showNum : Int?
     var title : String?
@@ -141,63 +141,5 @@ class CMSRuleModel : NSObject, NSCoding, Mappable{
         
     }
     
-    /**
-     * NSCoding required initializer.
-     * Fills the data from the passed decoder
-     */
-    @objc required init(coder aDecoder: NSCoder)
-    {
-        linkType = aDecoder.decodeObject(forKey: "link_type") as? String
-        linkUrl = aDecoder.decodeObject(forKey: "link_url") as? String
-        showNum = aDecoder.decodeObject(forKey: "show_num") as? Int
-        title = aDecoder.decodeObject(forKey: "title") as? String
-        url = aDecoder.decodeObject(forKey: "url") as? String
-        id = aDecoder.decodeObject(forKey: "id") as? Int
-        productId = aDecoder.decodeObject(forKey: "product_id") as? String
-        rule = aDecoder.decodeObject(forKey: "rule") as? CMSRuleModel
-        showType = aDecoder.decodeObject(forKey: "show_type") as? Int
-        subjectId = aDecoder.decodeObject(forKey: "subject_id") as? String
-        
-    }
-    
-    /**
-     * NSCoding required method.
-     * Encodes mode properties into the decoder
-     */
-    @objc func encode(with aCoder: NSCoder)
-    {
-        if linkType != nil{
-            aCoder.encode(linkType, forKey: "link_type")
-        }
-        if linkUrl != nil{
-            aCoder.encode(linkUrl, forKey: "link_url")
-        }
-        if showNum != nil{
-            aCoder.encode(showNum, forKey: "show_num")
-        }
-        if title != nil{
-            aCoder.encode(title, forKey: "title")
-        }
-        if url != nil{
-            aCoder.encode(url, forKey: "url")
-        }
-        if id != nil{
-            aCoder.encode(id, forKey: "id")
-        }
-        if productId != nil{
-            aCoder.encode(productId, forKey: "product_id")
-        }
-        if rule != nil{
-            aCoder.encode(rule, forKey: "rule")
-        }
-        if showType != nil{
-            aCoder.encode(showType, forKey: "show_type")
-        }
-        if subjectId != nil{
-            aCoder.encode(subjectId, forKey: "subject_id")
-        }
-        
-    }
-    
 }
 

+ 1 - 1
RainbowPlanet/RainbowPlanet/Service/Model/OrderModel/OrderCreateBackModel.swift

@@ -20,7 +20,7 @@ class OrderCreateBackModel : NSObject, Mappable{
         return OrderCreateBackModel()
     }
     required init?(map: Map){}
-    private override init(){}
+    override init(){}
     
     func mapping(map: Map)
     {

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

@@ -117,7 +117,6 @@ class ProductDetailLabelModel : NSObject, Mappable{
     
 }
 
-
 /// 参数模型
 class ProductDetailParameterModel : NSObject, Mappable{
     

+ 5 - 5
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaNetWorkServiceOrder.swift

@@ -163,11 +163,11 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     func orderPurchaseConfirmApi(purchaseId:String = "",completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(purchaseId, forKey: "purchase_id")
-//        SwiftProgressHUD.shared().showWait()
-//        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceOrderApi.orderPurchaseConfirm(parameters: parameters))) { (data) in
-//            SwiftProgressHUD.shared().hide()
-//            completion("")
-//        }
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceOrderApi.orderPurchaseConfirm(parameters: parameters))) { (data) in
+            SwiftProgressHUD.shared().hide()
+            completion("")
+        }
     }
     
     // MARK: - 关闭订单

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

@@ -207,7 +207,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
         parameters.updateValue(productMdl.id ?? 0, forKey: "product_id")
         parameters.updateValue(productMdl.price ?? 0, forKey: "product_price")
         parameters.updateValue(productMdl.skuId ?? 0, forKey: "sku_id")
-        parameters.updateValue(productMdl.totalCount ?? 0, forKey: "amount")
+        parameters.updateValue(1, forKey: "amount")
         parameters.updateValue(productMdl.isSelect ?? 0, forKey: "is_select")
         parameters.updateValue(productMdl.name ?? "", forKey: "product_name")
         parameters.updateValue(productMdl.img  ?? "", forKey: "product_img")
@@ -245,7 +245,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
         parameters.updateValue(productSearchModel.id ?? "", forKey: "product_id")
         parameters.updateValue(productSearchModel.price ?? "", forKey: "product_price")
         parameters.updateValue(productSearchModel.skuId ?? "", forKey: "sku_id")
-        parameters.updateValue(productSearchModel.totalCount ?? "", forKey: "amount")
+        parameters.updateValue(1, forKey: "amount")
         parameters.updateValue(productSearchModel.isSelect ?? 1, forKey: "is_select")
         parameters.updateValue(productSearchModel.name ?? "", forKey: "product_name")
         parameters.updateValue(productSearchModel.img  ?? "", forKey: "product_img")

+ 2 - 2
RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/AlertSheetView.swift

@@ -91,9 +91,9 @@ class AlertSheetView: NSObject {
     }
     
     /// 自定义支付View
-    class func payAlertSheetView(cancelClosure:@escaping () -> Void, sureClosure:@escaping (_ pType: PayType) -> Void) {
+    class func payAlertSheetView(paymentAmount:String, cancelClosure:@escaping () -> Void, sureClosure:@escaping (_ pType: PayType) -> Void) {
         let payView = CommonPayView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kSafeTabBarHeight + 300))
-        
+        payView.paymentAmount = paymentAmount
         let vProperty = FWPopupViewProperty()
         vProperty.popupCustomAlignment = .bottomCenter
         vProperty.popupAnimationType = .frame