Selaa lähdekoodia

【会员系统】修改比较表活跃、折扣、原价状态下产品金额

wanjun 2 päivää sitten
vanhempi
commit
7ca2b55ff6

+ 14 - 2
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -173,7 +173,13 @@ class KMProductModel: ObservableObject {
         guard let productModels = dmgProductDatas?.listingProducts else { return "" }
         for model in productModels {
             if model.code == productCode {
-                return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
+                if model.upgradePriceString?.isEmpty == false {
+                    return String(format: "%.2f", Float(model.upgradePriceString ?? "0") ?? 0)
+                } else if model.displayPriceString?.isEmpty == false {
+                    return String(format: "%.2f", Float(model.displayPriceString ?? "0") ?? 0)
+                } else {
+                    return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
+                }
             }
         }
         return ""
@@ -185,7 +191,13 @@ class KMProductModel: ObservableObject {
         guard let productModels = dmgProductDatas?.listingProducts else { return "" }
         for model in productModels {
             if model.code == productCode {
-                return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
+                if model.cnyUpgradePriceString?.isEmpty == false {
+                    return String(format: "%.2f", Float(model.cnyUpgradePriceString ?? "0") ?? 0)
+                } else if model.displayCnyPriceString?.isEmpty == false {
+                    return String(format: "%.2f", Float(model.displayCnyPriceString ?? "0") ?? 0)
+                } else {
+                    return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
+                }
             }
         }
         return ""