瀏覽代碼

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

wanjun 2 天之前
父節點
當前提交
7ca2b55ff6
共有 1 個文件被更改,包括 14 次插入2 次删除
  1. 14 2
      PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

+ 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 ""