Ver código fonte

退款,商品选中校验Fixed

Chris 6 anos atrás
pai
commit
2f60095556

+ 15 - 1
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/ViewController/OrderApplyRefundController.swift

@@ -254,6 +254,19 @@ extension OrderApplyRefundController {
         tableView.reloadSections([0], with: UITableView.RowAnimation.none)
     }
     
+    // 校验商品是否全未选
+    func judgeAllUnselected() -> Bool {
+        var isAllUnsel: Bool = true
+        for productMdl in productArr ?? [] {
+            if productMdl.isSelect == 1 {
+                isAllUnsel = false
+                break
+            }
+        }
+        return isAllUnsel
+    }
+    
+    
     // 计算退款金额
     func calculateRefundAmount() -> Int {
         var totalPrice: Int = 0
@@ -276,7 +289,8 @@ extension OrderApplyRefundController {
     // 申请退款
     func applyOrderRefund() {
         
-        if productArr?.isEmpty ?? true {
+        let isAllUnselected: Bool = judgeAllUnselected()
+        if isAllUnselected {
             SwiftProgressHUD.shared().showText("请选择退款商品")
             return
         }