瀏覽代碼

【会员系统】修复DMG比较表价格显示

wanjun 1 周之前
父節點
當前提交
facdd99670
共有 1 個文件被更改,包括 57 次插入31 次删除
  1. 57 31
      PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

+ 57 - 31
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -176,7 +176,11 @@ class KMProductModel: ObservableObject {
                 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)
+                    if model.displayPriceString == "0.00" {
+                        return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
+                    } else {
+                        return String(format: "%.2f", Float(model.displayPriceString ?? "0") ?? 0)
+                    }
                 } else {
                     return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
                 }
@@ -194,7 +198,11 @@ class KMProductModel: ObservableObject {
                 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)
+                    if model.displayCnyPriceString == "0.00" {
+                        return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
+                    } else {
+                        return String(format: "%.2f", Float(model.displayCnyPriceString ?? "0") ?? 0)
+                    }
                 } else {
                     return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
                 }
@@ -515,38 +523,52 @@ class KMProductModel: ObservableObject {
                     return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMStandardAnnualSubscriptionCodeKey_DMG))
                 }
             } else if type == .pdfReaderProAdvanced_dmg {
-                if isBlackFive {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
-                    } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
-                    }
-                } else if KMMemberInfo.shared.canTrail && state == .trial {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
+                if state == .dmg_Base {
+                    if isBlackFive {
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
+                        }
                     } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        }
                     }
                 } else {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                    if KMMemberInfo.shared.canTrail && state == .trial {
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
+                        }
                     } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        }
                     }
                 }
             } else if type == .pdfReaderProPermanent_dmg {
-                if isBlackFive {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
+                if state == .dmg_Base {
+                    if isBlackFive {
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
+                        }
                     } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
+                        }
                     }
                 } else {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
-                    } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
-                    }
+                    
                 }
             } else if type == .pdfReaderProAIAnnual_dmg {
                 if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
@@ -674,8 +696,6 @@ class KMProductModel: ObservableObject {
             } else {
                 if isBlackFive {
                     code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
-                } else if KMMemberInfo.shared.canTrail && state == .trial {
-                    code = KMAdvancedAnnualSubscriptionTrailCodeKey_DMG
                 } else {
                     code = KMAdvancedAnnualSubscriptionCodeKey_DMG
                 }
@@ -757,12 +777,18 @@ class KMProductModel: ObservableObject {
 #if VERSION_DMG
     // DMG
             var code = ""
-            if isBlackFive {
-                code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
-            } else if KMMemberInfo.shared.canTrail && state == .trial {
-                code = KMAdvancedAnnualSubscriptionTrailCodeKey_DMG
+            if state == .dmg_Base {
+                if isBlackFive {
+                    code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
+                } else {
+                    code = KMAdvancedAnnualSubscriptionCodeKey_DMG
+                }
             } else {
-                code = KMAdvancedAnnualSubscriptionCodeKey_DMG
+                if KMMemberInfo.shared.canTrail && state == .trial {
+                    code = KMAdvancedAnnualSubscriptionTrailCodeKey_DMG
+                } else {
+                    code = KMAdvancedAnnualSubscriptionCodeKey_DMG
+                }
             }
             let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
             embeddedWC.showWindow(nil)