|
@@ -281,21 +281,49 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
func updateProduct_Info() -> Void { //重新获取产品接口
|
|
func updateProduct_Info() -> Void { //重新获取产品接口
|
|
if KMMemberInfo.shared.isLogin {
|
|
if KMMemberInfo.shared.isLogin {
|
|
let model = KMProductModel.shared
|
|
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
|
|
return
|
|
}
|
|
}
|
|
- guard let products : [KMListingProductsModel] = productResults.listingProducts else {
|
|
|
|
|
|
+ guard let batchProductPrice : KMBatchProductPriceModel = pricesArrays.batchProductPrice else {
|
|
return
|
|
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)
|
|
refreshLicenseCodeView(isReveal: true)
|
|
refreshLicenseCodeErrorView(isReveal: false)
|
|
refreshLicenseCodeErrorView(isReveal: false)
|
|
|
|
|
|
- removeButton1.isEnabled = false
|
|
|
|
|
|
+ if pdfCount > 1 {
|
|
|
|
+ removeButton1.isEnabled = true
|
|
|
|
+ } else {
|
|
|
|
+ removeButton1.isEnabled = false
|
|
|
|
+ }
|
|
amountTextField1.delegate = self
|
|
amountTextField1.delegate = self
|
|
|
|
|
|
couponButton.title = NSLocalizedString("I have a coupon?", comment: "")
|
|
couponButton.title = NSLocalizedString("I have a coupon?", comment: "")
|
|
@@ -651,11 +683,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
pdfCount += 1
|
|
pdfCount += 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if pdfCount > 1 {
|
|
|
|
- removeButton1.isEnabled = true
|
|
|
|
- } else {
|
|
|
|
- removeButton1.isEnabled = false
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
if pdfCount > 100 {
|
|
if pdfCount > 100 {
|
|
wechatPayButton2.isHidden = false
|
|
wechatPayButton2.isHidden = false
|
|
cardButton.isHidden = true
|
|
cardButton.isHidden = true
|
|
@@ -686,35 +714,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
let model = KMProductModel.shared
|
|
let model = KMProductModel.shared
|
|
isBatchProductPriceGetFinsed = false
|
|
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) {
|
|
@IBAction func payButtonAction(_ sender: NSButton) {
|
|
@@ -784,6 +785,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
self?.product_Info.cnyPriceString = cnyPriceString //批量时将总价赋给priceString,只显示priceString价格了,其他的置空
|
|
self?.product_Info.cnyPriceString = cnyPriceString //批量时将总价赋给priceString,只显示priceString价格了,其他的置空
|
|
|
|
|
|
self?.product_Info.upgradePriceString = couponModel.upgradePriceString
|
|
self?.product_Info.upgradePriceString = couponModel.upgradePriceString
|
|
|
|
+ self?.product_Info.cnyUpgradePriceString = couponModel.upgradecnyPriceString
|
|
self?.product_Info.displayPriceString = couponModel.displayPriceString
|
|
self?.product_Info.displayPriceString = couponModel.displayPriceString
|
|
self?.product_Info.displayCnyPriceString = couponModel.displayCnyPriceString
|
|
self?.product_Info.displayCnyPriceString = couponModel.displayCnyPriceString
|
|
|
|
|
|
@@ -1079,7 +1081,11 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
|
|
|
prodocumentView.isHidden = false
|
|
prodocumentView.isHidden = false
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if pdfCount > 1 {
|
|
|
|
+ removeButton1.isEnabled = true
|
|
|
|
+ } else {
|
|
|
|
+ removeButton1.isEnabled = false
|
|
|
|
+ }
|
|
if(newValue == "advanced-annual-subscription-trail" ||
|
|
if(newValue == "advanced-annual-subscription-trail" ||
|
|
newValue == "ai-subscription-year-trail") {
|
|
newValue == "ai-subscription-year-trail") {
|
|
couponView.isHidden = true
|
|
couponView.isHidden = true
|
|
@@ -1091,7 +1097,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
for product in products {
|
|
for product in products {
|
|
if product.code == _product_code {
|
|
if product.code == _product_code {
|
|
self.product_Info = product;
|
|
self.product_Info = product;
|
|
- //更新价格
|
|
|
|
self.updateProduct_Info()
|
|
self.updateProduct_Info()
|
|
break
|
|
break
|
|
}
|
|
}
|
|
@@ -1289,7 +1294,11 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
let preferredLanguage = Locale.preferredLanguages.first ?? "en"
|
|
let preferredLanguage = Locale.preferredLanguages.first ?? "en"
|
|
var priceString = product_Info.priceString ?? ""
|
|
var priceString = product_Info.priceString ?? ""
|
|
if(product_Info.upgradePriceString?.isEmpty == false) {
|
|
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) {
|
|
} else if(product_Info.displayPriceString?.isEmpty == false) {
|
|
if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "CN" {
|
|
if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "CN" {
|
|
priceString = product_Info.displayCnyPriceString ?? ""
|
|
priceString = product_Info.displayCnyPriceString ?? ""
|