Procházet zdrojové kódy

【会员系统】DMG 购买订单价格随支付方式修改

zenghong před 1 týdnem
rodič
revize
a1a79b27e5

+ 60 - 12
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift

@@ -712,8 +712,16 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         var discount1: Float = 0.0
         var original1: Float = 0.0
         var abbreviation = "USD"
-        if NSLocalizedString("USD", comment: "") == "CNY" {
-            abbreviation = "CNY"
+        
+        if self.paymentMethod == .wxpay {
+            if NSLocalizedString("USD", comment: "") == "CNY" {
+                abbreviation = "CNY"
+            }
+        }
+        if self.paymentMethod == .alipay {
+            if NSLocalizedString("USD", comment: "") == "CNY" {
+                abbreviation = "CNY"
+            }
         }
         
         if _dmgProductType == .advanced_annual_subscription_trail       ||
@@ -745,9 +753,20 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
             }
             var fullString = String(format: tipsString, product_Info.price)
             let preferredLanguage = Locale.preferredLanguages.first ?? "en"
+            
             if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
                 fullString = String(format: tipsString, product_Info.cnyPrice)
             }
+            if self.paymentMethod == .wxpay {
+                if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
+                    fullString = String(format: tipsString, product_Info.cnyPrice)
+                }
+            }
+            if self.paymentMethod == .alipay {
+                if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
+                    fullString = String(format: tipsString, product_Info.cnyPrice)
+                }
+            }
             
             prmiumLabel.stringValue = String(format: "%@ %@", abbreviation, fullString)
             
@@ -799,9 +818,18 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
             
             discount1 = product_Info.price.floatValue //优惠价格拿原价
             original1 = product_Info.price.floatValue
-            if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
-                discount1 = product_Info.cnyPrice.floatValue  //优惠价格拿原价
-                original1 = product_Info.cnyPrice.floatValue
+            
+            if self.paymentMethod == .wxpay {
+                if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
+                    discount1 = product_Info.cnyPrice.floatValue  //优惠价格拿原价
+                    original1 = product_Info.cnyPrice.floatValue
+                }
+            }
+            if self.paymentMethod == .alipay {
+                if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
+                    discount1 = product_Info.cnyPrice.floatValue  //优惠价格拿原价
+                    original1 = product_Info.cnyPrice.floatValue
+                }
             }
             
             listPrice = original1 * Float(amountTextField1.stringValue)!
@@ -832,8 +860,15 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
             }
             var fullString = String(format: tipsString, product_Info.price)
             let preferredLanguage = Locale.preferredLanguages.first ?? "en"
-            if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
-                fullString = String(format: tipsString, product_Info.cnyPrice)
+            if self.paymentMethod == .wxpay {
+                if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
+                    fullString = String(format: tipsString, product_Info.cnyPrice)
+                }
+            }
+            if self.paymentMethod == .alipay {
+                if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
+                    fullString = String(format: tipsString, product_Info.cnyPrice)
+                }
             }
             
             prmiumLabel.stringValue = String(format: "%@ %@", abbreviation, fullString)
@@ -843,12 +878,23 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 discount1 = product_Info.displayPrice.floatValue //优惠价格拿更新后的批量价格
             }
             original1 = product_Info.price.floatValue
-            if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
-                discount1 = product_Info.cnyPrice.floatValue  //优惠价格拿原价
-                if pdfCount > 1 , isBatchProductPriceGetFinsed {
-                    discount1 = product_Info.displayCnyPrice.floatValue //优惠价格拿更新后的批量价格
+            if self.paymentMethod == .wxpay {
+                if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
+                    discount1 = product_Info.cnyPrice.floatValue  //优惠价格拿原价
+                    if pdfCount > 1 , isBatchProductPriceGetFinsed {
+                        discount1 = product_Info.displayCnyPrice.floatValue //优惠价格拿更新后的批量价格
+                    }
+                    original1 = product_Info.cnyPrice.floatValue
+                }
+            }
+            if self.paymentMethod == .alipay {
+                if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
+                    discount1 = product_Info.cnyPrice.floatValue  //优惠价格拿原价
+                    if pdfCount > 1 , isBatchProductPriceGetFinsed {
+                        discount1 = product_Info.displayCnyPrice.floatValue //优惠价格拿更新后的批量价格
+                    }
+                    original1 = product_Info.cnyPrice.floatValue
                 }
-                original1 = product_Info.cnyPrice.floatValue
             }
             
             listPrice = original1 * Float(amountTextField1.stringValue)!
@@ -1343,6 +1389,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         emailErrorLabel(isReveal: false)
         confirmPayment(isConfirm: false)
         paymentMethod = KMPaymentType(rawValue: uint32(sender.tag)) ?? .paypal
+        // 价格刷新
+        priceRefresh(productsModel: _product_Info)
     }
     
     @IBAction func couponButtonAction(_ sender: NSButton) {