ソースを参照

自提点弹框刷新 && 购物车列表

Chris 6 年 前
コミット
dfd72d5da8

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartList/ShoppingCartListTableViewCell.swift

@@ -196,6 +196,7 @@ class ShoppingCartListTableViewCell: UITableViewCell {
         disableLabel.textColor = k333333Color
         disableLabel.font = kRegularFont10
         disableLabel.backgroundColor = kf5f5f5Color
+        disableLabel.textAlignment = .center
         disableLabel.cornerRadius = 10
         disableLabel.masksToBounds = true
         return disableLabel

+ 8 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartList/ShoppingCartListTableViewHeader.swift

@@ -33,6 +33,14 @@ class ShoppingCartListTableViewHeader: BaseView {
         }
     }
     
+    var isShopDisabled: Bool? {
+        didSet {
+            if self.isShopDisabled ?? false {
+                selectedButton.isHidden = true
+            }
+        }
+    }
+    
     override var frame: CGRect {
         get {
             return super.frame

+ 12 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift

@@ -362,6 +362,7 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
         if cartListModelArr?.count ?? 0 > 0 && section < cartListModelArr!.count {
             let headerView = ShoppingCartListTableViewHeader(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 58))
             headerView.shopName = cartListModelArr![section].shopName
+            headerView.isShopDisabled = judgeSectionAllDisabled(section)
             headerView.isSectionSelected = self.judgeSectionSelectedStatus(section)
             headerView.secSelectBlock = { [weak self]
                 (isSectionSel) in
@@ -539,4 +540,15 @@ extension ShoppingCartView {
         }
     }
     
+    // 校验Section内商品是否全不可用(售罄/下架)
+    func judgeSectionAllDisabled(_ section: Int) -> Bool {
+        let cartProListMdl: CartProductListModel = cartListModelArr![section]
+        for productMdl in cartProListMdl.productList! {
+            if productMdl.stock != 0 && productMdl.upStatus != 0 {
+                return false
+            }
+        }
+        return true
+    }
+    
 }

+ 4 - 4
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/MainView/ShoppingMallView.swift

@@ -17,7 +17,8 @@ class ShoppingMallView: UIView {
     override init(frame: CGRect) {
         super.init(frame: frame)
         DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2)) {
-            self.addressPopView()
+            let addrMdl = SelfMentionAddressModel.getModel()
+            self.addressPopView(address: addrMdl?.address ?? "")
         }
         self.cmsTemplateSetTemplateNameApi()
     }
@@ -103,8 +104,6 @@ class ShoppingMallView: UIView {
     //初始化自提地址提示View
     lazy var selfAddressPopView: PopTopTriangleView = {
         let selfAddressPopView = PopTopTriangleView()
-        let addrMdl = SelfMentionAddressModel.getModel()
-        selfAddressPopView.address = addrMdl?.address
         return selfAddressPopView
     }()
     
@@ -169,11 +168,12 @@ class ShoppingMallView: UIView {
     }()
     
     /// 8.自提地址
-    func addressPopView() {
+    func addressPopView(address: String) {
         let deliverType = DeliveryMethodTypeModel.shared().getModel()?.deliveryMethodType
         if deliverType == "1" {
             // 自提
             addSubview(selfAddressPopView)
+            selfAddressPopView.address = address
             selfAddressPopView.snp.remakeConstraints { (make) in
                 make.top.equalToSuperview()
                 make.left.equalToSuperview().offset(14)

+ 2 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift

@@ -110,7 +110,8 @@ class ShoppingMallViewController: BaseViewController {
             [weak self] in
             let model = DeliveryMethodTypeModel.shared().getModel()
             if model?.deliveryMethodType == "1" { //自提
-                self?.shoppingMallView.addressPopView()
+                let addrMdl = SelfMentionAddressModel.getModel()
+                self?.shoppingMallView.addressPopView(address: addrMdl?.address ?? "")
             }            
         }
         return navigationBarView