|
@@ -281,21 +281,49 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
func updateProduct_Info() -> Void { //重新获取产品接口
|
|
|
if KMMemberInfo.shared.isLogin {
|
|
|
let model = KMProductModel.shared
|
|
|
- model.getDMGProductPriceInfosForMember(productId: product_Info.id, isEducation: 0) { [weak self] success, result in
|
|
|
- if success {
|
|
|
- guard let productResults : KMMemberProductResult = result else {
|
|
|
+ if(pdfCount > 1) {
|
|
|
+ model.getDMGBatchProductPriceInfosForMember(productId: _product_Info.id, num: pdfCount) { [weak self] success, result in
|
|
|
+ guard let pricesArrays : KMMemberProductResult = result else {
|
|
|
return
|
|
|
}
|
|
|
- guard let products : [KMListingProductsModel] = productResults.listingProducts else {
|
|
|
+ guard let batchProductPrice : KMBatchProductPriceModel = pricesArrays.batchProductPrice else {
|
|
|
return
|
|
|
}
|
|
|
- guard let product : KMListingProductsModel = products.first else {
|
|
|
- return
|
|
|
+ //原价更新
|
|
|
+ let priceString = batchProductPrice.totalPrice
|
|
|
+ self?.product_Info.priceString = priceString
|
|
|
+
|
|
|
+ let cnyPriceString = batchProductPrice.cnyTotalPrice
|
|
|
+ self?.product_Info.cnyPriceString = cnyPriceString //批量时将总价赋给priceString,只显示priceString价格了,其他的置空
|
|
|
+
|
|
|
+ self?.product_Info.upgradePriceString = nil
|
|
|
+ self?.product_Info.displayPriceString = nil
|
|
|
+ self?.product_Info.displayCnyPriceString = nil
|
|
|
+ self?.product_Info.individualPriceString = batchProductPrice.price
|
|
|
+ self?.product_Info.individualCnyPriceString = batchProductPrice.cnyPrice
|
|
|
+
|
|
|
+ if self?._paymentMethod == .alipay || self?._paymentMethod == .wxpay {
|
|
|
+ self?.updatePrice()
|
|
|
}
|
|
|
- self?.product_Info = product;
|
|
|
- for tProduct in products {
|
|
|
- if tProduct.id == self?.product_Info.id {
|
|
|
- self?.product_Info = product;
|
|
|
+ self?.priceRefresh(productsModel: self?.product_Info ?? KMListingProductsModel())
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ model.getDMGProductPriceInfosForMember(productId: product_Info.id, isEducation: 0) { [weak self] success, result in
|
|
|
+ if success {
|
|
|
+ guard let productResults : KMMemberProductResult = result else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ guard let products : [KMListingProductsModel] = productResults.listingProducts else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ guard let product : KMListingProductsModel = products.first else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ self?.product_Info = product;
|
|
|
+ for tProduct in products {
|
|
|
+ if tProduct.id == self?.product_Info.id {
|
|
|
+ self?.product_Info = product;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -344,7 +372,11 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
refreshLicenseCodeView(isReveal: true)
|
|
|
refreshLicenseCodeErrorView(isReveal: false)
|
|
|
|
|
|
- removeButton1.isEnabled = false
|
|
|
+ if pdfCount > 1 {
|
|
|
+ removeButton1.isEnabled = true
|
|
|
+ } else {
|
|
|
+ removeButton1.isEnabled = false
|
|
|
+ }
|
|
|
amountTextField1.delegate = self
|
|
|
|
|
|
couponButton.title = NSLocalizedString("I have a coupon?", comment: "")
|
|
@@ -651,11 +683,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
pdfCount += 1
|
|
|
}
|
|
|
}
|
|
|
- if pdfCount > 1 {
|
|
|
- removeButton1.isEnabled = true
|
|
|
- } else {
|
|
|
- removeButton1.isEnabled = false
|
|
|
- }
|
|
|
+
|
|
|
if pdfCount > 100 {
|
|
|
wechatPayButton2.isHidden = false
|
|
|
cardButton.isHidden = true
|
|
@@ -686,35 +714,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
let model = KMProductModel.shared
|
|
|
isBatchProductPriceGetFinsed = false
|
|
|
|
|
|
- if(pdfCount > 1) {
|
|
|
- model.getDMGBatchProductPriceInfosForMember(productId: _product_Info.id, num: pdfCount) { [weak self] success, result in
|
|
|
- guard let pricesArrays : KMMemberProductResult = result else {
|
|
|
- return
|
|
|
- }
|
|
|
- guard let batchProductPrice : KMBatchProductPriceModel = pricesArrays.batchProductPrice else {
|
|
|
- return
|
|
|
- }
|
|
|
- //原价更新
|
|
|
- let priceString = batchProductPrice.totalPrice
|
|
|
- self?.product_Info.priceString = priceString
|
|
|
-
|
|
|
- let cnyPriceString = batchProductPrice.cnyTotalPrice
|
|
|
- self?.product_Info.cnyPriceString = cnyPriceString //批量时将总价赋给priceString,只显示priceString价格了,其他的置空
|
|
|
-
|
|
|
- self?.product_Info.upgradePriceString = nil
|
|
|
- self?.product_Info.displayPriceString = nil
|
|
|
- self?.product_Info.displayCnyPriceString = nil
|
|
|
- self?.product_Info.individualPriceString = batchProductPrice.price
|
|
|
- self?.product_Info.individualCnyPriceString = batchProductPrice.cnyPrice
|
|
|
-
|
|
|
- if self?._paymentMethod == .alipay || self?._paymentMethod == .wxpay {
|
|
|
- self?.updatePrice()
|
|
|
- }
|
|
|
- self?.priceRefresh(productsModel: self?.product_Info ?? KMListingProductsModel())
|
|
|
- }
|
|
|
- } else {
|
|
|
- updateProduct_Info()
|
|
|
- }
|
|
|
+ updateProduct_Info()
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@IBAction func payButtonAction(_ sender: NSButton) {
|
|
@@ -784,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
|
|
|
|
|
@@ -1079,7 +1081,11 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
|
|
|
prodocumentView.isHidden = false
|
|
|
}
|
|
|
-
|
|
|
+ if pdfCount > 1 {
|
|
|
+ removeButton1.isEnabled = true
|
|
|
+ } else {
|
|
|
+ removeButton1.isEnabled = false
|
|
|
+ }
|
|
|
if(newValue == "advanced-annual-subscription-trail" ||
|
|
|
newValue == "ai-subscription-year-trail") {
|
|
|
couponView.isHidden = true
|
|
@@ -1091,7 +1097,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
for product in products {
|
|
|
if product.code == _product_code {
|
|
|
self.product_Info = product;
|
|
|
- //更新价格
|
|
|
self.updateProduct_Info()
|
|
|
break
|
|
|
}
|
|
@@ -1289,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 ?? ""
|