|
@@ -720,7 +720,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
self?.product_Info.displayPriceString = nil
|
|
self?.product_Info.displayPriceString = nil
|
|
self?.product_Info.displayCnyPriceString = nil
|
|
self?.product_Info.displayCnyPriceString = nil
|
|
self?.product_Info.individualPriceString = batchProductPrice.price
|
|
self?.product_Info.individualPriceString = batchProductPrice.price
|
|
-
|
|
|
|
|
|
+ self?.product_Info.individualCnyPriceString = batchProductPrice.cnyPrice
|
|
|
|
+
|
|
self?.priceRefresh(productsModel: self?.product_Info ?? KMListingProductsModel())
|
|
self?.priceRefresh(productsModel: self?.product_Info ?? KMListingProductsModel())
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -762,8 +763,29 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
|
|
|
KMMemberCenterManager.manager.checkCoupon(productId: product_Info.id, userId: KMMemberInfo.shared.userID, code: coupomTextField.stringValue) {[weak self] success, result in
|
|
KMMemberCenterManager.manager.checkCoupon(productId: product_Info.id, userId: KMMemberInfo.shared.userID, code: coupomTextField.stringValue) {[weak self] success, result in
|
|
if(success == true) {
|
|
if(success == true) {
|
|
-// self?.product_Info.price =
|
|
|
|
-// self?.priceRefresh(productsModel: product_Info)
|
|
|
|
|
|
+
|
|
|
|
+ guard let productResult : KMMemberProductResult = result else {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ guard let couponModel : KMCheckCouponModel = productResult.checkCoupon else {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let priceString = couponModel.priceString
|
|
|
|
+ self?.product_Info.priceString = priceString
|
|
|
|
+
|
|
|
|
+ let cnyPriceString = couponModel.cnyPriceString
|
|
|
|
+ self?.product_Info.cnyPriceString = cnyPriceString //批量时将总价赋给priceString,只显示priceString价格了,其他的置空
|
|
|
|
+
|
|
|
|
+ self?.product_Info.upgradePriceString = couponModel.upgradePriceString
|
|
|
|
+ self?.product_Info.displayPriceString = couponModel.displayPriceString
|
|
|
|
+ self?.product_Info.displayCnyPriceString = couponModel.displayCnyPriceString
|
|
|
|
+
|
|
|
|
+ self?.product_Info.individualPriceString = couponModel.priceString
|
|
|
|
+ self?.product_Info.individualCnyPriceString = couponModel.cnyPriceString
|
|
|
|
+ self?.product_Info.verifyofferCode = self?.coupomTextField.stringValue ?? ""
|
|
|
|
+
|
|
|
|
+ self?.priceRefresh(productsModel: self?._product_Info ?? KMListingProductsModel())
|
|
}else {
|
|
}else {
|
|
let alert = NSAlert()
|
|
let alert = NSAlert()
|
|
alert.alertStyle = .critical
|
|
alert.alertStyle = .critical
|
|
@@ -834,8 +856,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
}
|
|
}
|
|
|
|
|
|
var couponCode = ""
|
|
var couponCode = ""
|
|
- if coupomErrorLabel.isHidden {
|
|
|
|
- couponCode = coupomTextField.stringValue
|
|
|
|
|
|
+ if product_Info.verifyofferCode.isEmpty == false {
|
|
|
|
+ couponCode = product_Info.verifyofferCode
|
|
}
|
|
}
|
|
|
|
|
|
let model = KMProductModel.shared
|
|
let model = KMProductModel.shared
|
|
@@ -902,7 +924,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
model.createSubscriber(productId: _product_Info.id,
|
|
model.createSubscriber(productId: _product_Info.id,
|
|
paymentMethod: getPurchasePaymentMethod(),
|
|
paymentMethod: getPurchasePaymentMethod(),
|
|
price: priceString,
|
|
price: priceString,
|
|
- discountFlag: getPurchaseDiscountFlag(),
|
|
|
|
|
|
+ discountFlag: getOneTimePurchaseDiscountFlag(),
|
|
couponCode: couponCode,
|
|
couponCode: couponCode,
|
|
num: pdfCount) { success, result in
|
|
num: pdfCount) { success, result in
|
|
if success {
|
|
if success {
|
|
@@ -964,8 +986,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
return 4
|
|
return 4
|
|
} else {
|
|
} else {
|
|
var couponCode = ""
|
|
var couponCode = ""
|
|
- if coupomErrorLabel.isHidden {
|
|
|
|
- couponCode = coupomTextField.stringValue
|
|
|
|
|
|
+ if _product_Info.verifyofferCode.isEmpty == false {
|
|
|
|
+ couponCode = _product_Info.verifyofferCode
|
|
}
|
|
}
|
|
|
|
|
|
if(couponCode.isEmpty == false) {//判断是否有使用优惠卷
|
|
if(couponCode.isEmpty == false) {//判断是否有使用优惠卷
|
|
@@ -1187,6 +1209,19 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
|
|
|
return priceString
|
|
return priceString
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ func showsinglePriceString()->String { //单价
|
|
|
|
+ let preferredLanguage = Locale.preferredLanguages.first ?? "en"
|
|
|
|
+ var priceString = product_Info.priceString ?? ""
|
|
|
|
+ if preferredLanguage.hasPrefix("zh-Hans") || preferredLanguage.hasPrefix("zh-Hant") {
|
|
|
|
+ priceString = product_Info.individualPriceString ?? ""
|
|
|
|
+ } else {
|
|
|
|
+ priceString = product_Info.individualCnyPriceString ?? ""
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return priceString
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
func showPayPriceString()->String { //实际支付的价格
|
|
func showPayPriceString()->String { //实际支付的价格
|