Преглед изворни кода

【会员系统】- 价格显示问题

wangshuai пре 2 дана
родитељ
комит
84c1652505

+ 6 - 1
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift

@@ -785,6 +785,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                     self?.product_Info.cnyPriceString = cnyPriceString //批量时将总价赋给priceString,只显示priceString价格了,其他的置空
                     
                     self?.product_Info.upgradePriceString = couponModel.upgradePriceString
+                    self?.product_Info.cnyUpgradePriceString = couponModel.upgradecnyPriceString
                     self?.product_Info.displayPriceString = couponModel.displayPriceString
                     self?.product_Info.displayCnyPriceString = couponModel.displayCnyPriceString
                     
@@ -1293,7 +1294,11 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         let preferredLanguage = Locale.preferredLanguages.first ?? "en"
         var priceString = product_Info.priceString ?? ""
         if(product_Info.upgradePriceString?.isEmpty == false) {
-            priceString = product_Info.upgradePriceString ?? ""
+            if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "CN" {
+                priceString = product_Info.cnyUpgradePriceString ?? ""
+            } else {
+                priceString = product_Info.upgradePriceString ?? ""
+            }
         } else if(product_Info.displayPriceString?.isEmpty == false) {
             if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "CN" {
                 priceString = product_Info.displayCnyPriceString ?? ""

+ 22 - 2
PDF Office/PDF Master/MemberCenter/Model/KMMemberCenterManager.swift

@@ -962,7 +962,7 @@ class KMMemberCenterManager: NSObject {
                     var upgradePriceString:String?
                     var cnyPriceString:String?
                     var displayCnyPriceString:String?
-                    
+                    var upgradecnyPriceString:String?
                     
                     if let token = dict1["id"] { id = token as? String ?? id }
                     if let token = dict1["productName"] { productName = token as? String ?? productName }
@@ -987,6 +987,11 @@ class KMMemberCenterManager: NSObject {
                         displayPrice = token
                     }
                     
+                    if let token = dict1["cnyUpgradePrice"] as? NSNumber {
+                        let string = KMFormatNSNumber(token, to: 2)
+                        upgradecnyPriceString = string
+                    }
+                    
                     if let token = dict1["upgradePrice"] as? NSNumber {
                         let string = KMFormatNSNumber(token, to: 2)
                         upgradePriceString = string
@@ -1008,6 +1013,7 @@ class KMMemberCenterManager: NSObject {
                     let products = KMListingProductsModel(id: id, productName: productName, price: priceString, maxDeviceNum: maxDeviceNum, displayPrice: displayPriceString, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, cnyPrice: cnyPriceString, displayCnyPrice: displayCnyPriceString, upgradePrice: upgradePriceString, code: code)
                     products.individualPriceString = priceString
                     products.individualCnyPriceString = cnyPriceString
+                    products.cnyUpgradePriceString = upgradecnyPriceString
                     results.append(products)
                 }
 
@@ -1079,6 +1085,7 @@ class KMMemberCenterManager: NSObject {
                     var upgradePriceString:String?
                     var cnyPriceString:String?
                     var displayCnyPriceString:String?
+                    var upgradecnyPriceString:String?
 
                     if let token = dict1["id"] { id = token as? String ?? id }
                     if let token = dict1["productName"] { productName = token as? String ?? productName }
@@ -1116,8 +1123,14 @@ class KMMemberCenterManager: NSObject {
                         displayCnyPriceString = string
                         displayCnyPrice = token
                     }
+                    
+                    if let token = dict1["cnyUpgradePrice"] as? NSNumber {
+                        let string = KMFormatNSNumber(token, to: 2)
+                        upgradecnyPriceString = string
+                    }
 
                     let products = KMListingProductsModel(id: id, productName: productName, price: priceString, maxDeviceNum: maxDeviceNum, displayPrice: displayPriceString, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, cnyPrice: cnyPriceString, displayCnyPrice: displayCnyPriceString, upgradePrice: upgradePriceString, code: code)
+                    products.cnyUpgradePriceString = upgradecnyPriceString
                     products.individualPriceString = priceString
                     products.individualCnyPriceString = cnyPriceString
                     results.append(products)
@@ -1256,7 +1269,7 @@ class KMMemberCenterManager: NSObject {
                 var upgradePriceString:String?
                 var cnyPriceString:String?
                 var displayCnyPriceString:String?
-                
+                var upgradecnyPriceString:String?
                 
                 if let token = result["id"] { id = token as? String ?? id }
                 if let token = result["productName"] { productName = token as? String ?? productName }
@@ -1294,8 +1307,15 @@ class KMMemberCenterManager: NSObject {
                     displayCnyPriceString = string
                     displayCnyPrice = token
                 }
+                
+                if let token = result["cnyUpgradePrice"] as? NSNumber {
+                    let string = KMFormatNSNumber(token, to: 2)
+                    upgradecnyPriceString = string
+                }
 
                 let products = KMCheckCouponModel(id: id, productName: productName, price: priceString, maxDeviceNum: maxDeviceNum, displayPrice: displayPriceString, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, cnyPrice: cnyPriceString, displayCnyPrice: displayCnyPriceString, upgradePrice: upgradePriceString, code: code)
+                products.upgradecnyPriceString = upgradecnyPriceString
+                
                 let result1 = KMMemberProductResult(code: requestCode, msg: message, checkCoupon: products)
                 if requestCode == 200 {
                     complete(true, result1)

+ 4 - 2
PDF Office/PDF Master/MemberCenter/Model/KMMemberProductResult.swift

@@ -97,7 +97,8 @@ class KMListingProductsModel: NSObject {
     var displayCnyPriceString  : String? // 【可选】人民币优惠价格
     var displayPriceString     : String? // 【可选】教育优惠价格
     var upgradePriceString    : String? // 【可选】买断升级订阅价格
-    
+    var cnyUpgradePriceString    : String? // 【可选】买断升级订阅价格
+
     var individualPriceString    : String? // 每个单价
     var individualCnyPriceString    : String? // 每个单价
 
@@ -168,7 +169,8 @@ class KMCheckCouponModel: NSObject {
     var displayPriceString    : String? // 【可选】教育优惠价格
     var upgradePriceString    : String? // 【可选】买断升级订阅价格
     var verifyofferCode   : String = "" // 优惠码
-    
+    var upgradecnyPriceString:String?
+
     init(id: String, productName: String, price: String?, maxDeviceNum: Int, displayPrice: String?, levels: String, platforms: String, productLineId: Int, paymentModel: Int, cycle: Int, cnyPrice: String?, displayCnyPrice:  String?, upgradePrice:  String?, code: String) {
         self.id = id
         self.productName = productName