南鑫林 5 yıl önce
ebeveyn
işleme
52512f8bba

+ 23 - 1
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderShopAndStatusTableViewCell.swift

@@ -7,8 +7,14 @@
 //
 
 import UIKit
+import RxSwift
 
 class OrderShopAndStatusTableViewCell: UITableViewCell {
+    
+    let disposeBag = DisposeBag()
+    
+    typealias ShopClosure = (_ orderModel: OrderModel) -> Void
+    var shopClosure : ShopClosure?
 
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> OrderShopAndStatusTableViewCell {
         let ID = "OrderShopAndStatusTableViewCell"
@@ -64,9 +70,24 @@ class OrderShopAndStatusTableViewCell: UITableViewCell {
         shopButton.setTitleColor(k333333Color, for: UIControl.State.normal)
         shopButton.titleLabel?.font = kRegularFont14
         shopButton.setImage(kImage(name: "my_arrows_unfold"), for: UIControl.State.normal)
+        shopButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            if self?.orderModel != nil {
+                if let shopClosure = self?.shopClosure {
+                    shopClosure((self?.orderModel)!)
+                }
+            }
+            
+            if self?.orderDetailModel != nil {
+                if let shopClosure = self?.shopClosure {
+                    shopClosure((self?.orderDetailModel)!)
+                }
+            }
+            
+        }).disposed(by: disposeBag)
         return shopButton
     }()
-    
+        
     private lazy var statusLabel: UILabel = {
         let statusLabel = UILabel()
         statusLabel.font = kRegularFont14
@@ -83,6 +104,7 @@ class OrderShopAndStatusTableViewCell: UITableViewCell {
         didSet {
             shopButton.setTitle(orderModel?.shopName ?? "", for: UIControl.State.normal)
             shopButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.right, imageTitleSpace: 5)
+            
             if orderModel?.feedbackStatus == 0 { //未维权
                 switch orderModel?.status {
                 case 0: //待付款

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

@@ -35,6 +35,9 @@ class OrderListViewController: UIViewController {
     typealias SetButtonBlock = (_ button:UIButton,_ orderModel:OrderModel) -> Void
     var setButtonBlock : SetButtonBlock?
     
+    typealias ShopButtonBlock = (OrderModel) -> Void
+    var shopButtonBlock : ShopButtonBlock?
+    
     typealias DidSelectBlock = (_ orderModel:OrderModel) -> Void
     var didSelectBlock : DidSelectBlock?
     
@@ -186,6 +189,12 @@ extension OrderListViewController : UITableViewDelegate, UITableViewDataSource {
             switch indexPath.row {
             case 0:
                 let cell = OrderShopAndStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                cell.shopClosure = {
+                    [weak self] orderModel in
+                    if let shopButtonBlock = self?.shopButtonBlock {
+                        shopButtonBlock(orderModel)
+                    }
+                }
                 cell.orderModel = orderModel
                 return cell
             case 1:
@@ -253,6 +262,12 @@ extension OrderListViewController : UITableViewDelegate, UITableViewDataSource {
             switch indexPath.row {
             case 0:
                 let cell = OrderShopAndStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                cell.shopClosure = {
+                    [weak self] orderModel in
+                    if let shopButtonBlock = self?.shopButtonBlock {
+                        shopButtonBlock(orderModel)
+                    }
+                }
                 cell.orderModel = orderModel
                 return cell
             case 1:

+ 6 - 0
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderViewController.swift

@@ -164,6 +164,12 @@ extension OrderViewController :JXSegmentedListContainerViewDataSource {
             self?.orderListViewController = vc
             self?.setButton(button: button, orderModel: orderModel, vc: vc)
         }
+        vc.shopButtonBlock = {
+            [weak self] (orderModel) in
+            let vc1 = ShopViewController()
+            vc1.shopId = orderModel.shopId
+            self?.navigationController?.pushViewController(vc1, animated: true)
+        }
         
         vc.didSelectBlock = {
             [weak self] (orderModel) in

+ 7 - 0
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderDetail/ViewController/OrderDetailViewController.swift

@@ -254,7 +254,14 @@ extension OrderDetailViewController : UITableViewDelegate, UITableViewDataSource
             switch indexPath.row {
             case 0:
                 let cell = OrderShopAndStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                cell.shopClosure = {
+                    [weak self] orderModel in
+                    let vc = ShopViewController()
+                    vc.shopId = orderModel.shopId
+                    self?.navigationController?.pushViewController(vc, animated: true)
+                }
                 cell.orderDetailModel = self.orderDetailModel
+
                 return cell
             case detail!.count + 1:
                 if self.orderDetailModel?.deliverType == 1 { //自提

+ 5 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/ViewController/CategoryViewController.swift

@@ -16,6 +16,11 @@ class CategoryViewController: BaseViewController {
     
     var leftIndexPath : IndexPath =  IndexPath(row: 0, section: 0)
     
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        productGetCartCountApi()
+    }
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -41,8 +46,6 @@ class CategoryViewController: BaseViewController {
     }
     
     override func setupData() {
-        
-        productGetCartCountApi()
 
         categorySearchView.searchbgView.rx.tap.subscribe(onNext: {
             [weak self] in

+ 6 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/ViewController/SpecialViewController.swift

@@ -14,6 +14,12 @@ class SpecialViewController: BaseViewController {
     var area_type : String?
     var productSearchModelArray = Array<ProductSearchModel>()
     
+
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        productGetCartCountApi()
+    }
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -43,7 +49,6 @@ class SpecialViewController: BaseViewController {
         if area_type == "floor" {
             specialView.cmsRuleModel = cmsRuleModel
         }
-        productGetCartCountApi()
         specialView.tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
             self?.cmsTemplateSetProductListApi()
         }

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

@@ -60,7 +60,6 @@ public let requestClosure = { (endpoint: Endpoint, done: MoyaProvider.RequestRes
 /// NetworkActivityPlugin插件用来监听网络请求,界面上做相应的展示
 ///但这里我没怎么用这个。。。 loading的逻辑直接放在网络处理里面了
 public let networkPlugin = NetworkActivityPlugin.init { (changeType, targetType) in
-    print("networkPlugin \(changeType)")
     //targetType 是当前请求的基本信息
     switch(changeType){
     case .began: