瀏覽代碼

购物车列表 -- 存在[下架/售罄] fixed

Chris 6 年之前
父節點
當前提交
bcd2d10966

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

@@ -35,6 +35,9 @@ class ShoppingCartListTableViewCell: UITableViewCell {
             if productMdl?.stock == 0 {
             if productMdl?.stock == 0 {
                 self.resetDisableWithTitle("已售罄")
                 self.resetDisableWithTitle("已售罄")
             }
             }
+            if productMdl?.upStatus != 0 && productMdl?.stock != 0 {
+                self.resetEnabledCell()
+            }                        
             
             
             // 选中状态
             // 选中状态
             let selStatus = productMdl?.isSelect == 1 ? true : false
             let selStatus = productMdl?.isSelect == 1 ? true : false
@@ -176,6 +179,16 @@ class ShoppingCartListTableViewCell: UITableViewCell {
         selectedButton.isHidden = true
         selectedButton.isHidden = true
     }
     }
     
     
+    private func resetEnabledCell() {
+        deliveryTime.isHidden = false
+        plusButton.isHidden = false
+        numberLabel.isHidden = false
+        reduceButton.isHidden = false
+        
+        disableLabel.isHidden = true
+        selectedButton.isHidden = false
+    }
+    
     private lazy var selectedButton: UIButton = {
     private lazy var selectedButton: UIButton = {
         let selectedButton = UIButton(type: UIButton.ButtonType.custom)
         let selectedButton = UIButton(type: UIButton.ButtonType.custom)
         selectedButton.setImage(kImage(name: "common_uncheck_icon"), for: UIControl.State.normal)
         selectedButton.setImage(kImage(name: "common_uncheck_icon"), for: UIControl.State.normal)

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

@@ -460,6 +460,14 @@ extension ShoppingCartView {
     func judgeSectionSelectedStatus(_ section: Int) -> Int {
     func judgeSectionSelectedStatus(_ section: Int) -> Int {
         let cartProListMdl: CartProductListModel = cartListModelArr![section]
         let cartProListMdl: CartProductListModel = cartListModelArr![section]
         for productMdl in cartProListMdl.productList! {
         for productMdl in cartProListMdl.productList! {
+            // 忽略已售罄/下架商品选中状态
+            if productMdl.upStatus == 0 {
+                continue
+            }
+            if productMdl.stock == 0 {
+                continue
+            }
+            
             if productMdl.isSelect == 0 {
             if productMdl.isSelect == 0 {
                 return 0
                 return 0
             }
             }