|
@@ -720,7 +720,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
self?.product_Info.displayPriceString = nil
|
|
|
self?.product_Info.displayCnyPriceString = nil
|
|
|
self?.product_Info.individualPriceString = batchProductPrice.price
|
|
|
-
|
|
|
+ self?.product_Info.individualCnyPriceString = batchProductPrice.cnyPrice
|
|
|
+
|
|
|
self?.priceRefresh(productsModel: self?.product_Info ?? KMListingProductsModel())
|
|
|
}
|
|
|
} 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
|
|
|
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 {
|
|
|
let alert = NSAlert()
|
|
|
alert.alertStyle = .critical
|
|
@@ -834,8 +856,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
}
|
|
|
|
|
|
var couponCode = ""
|
|
|
- if coupomErrorLabel.isHidden {
|
|
|
- couponCode = coupomTextField.stringValue
|
|
|
+ if product_Info.verifyofferCode.isEmpty == false {
|
|
|
+ couponCode = product_Info.verifyofferCode
|
|
|
}
|
|
|
|
|
|
let model = KMProductModel.shared
|
|
@@ -902,7 +924,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
model.createSubscriber(productId: _product_Info.id,
|
|
|
paymentMethod: getPurchasePaymentMethod(),
|
|
|
price: priceString,
|
|
|
- discountFlag: getPurchaseDiscountFlag(),
|
|
|
+ discountFlag: getOneTimePurchaseDiscountFlag(),
|
|
|
couponCode: couponCode,
|
|
|
num: pdfCount) { success, result in
|
|
|
if success {
|
|
@@ -964,8 +986,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
return 4
|
|
|
} else {
|
|
|
var couponCode = ""
|
|
|
- if coupomErrorLabel.isHidden {
|
|
|
- couponCode = coupomTextField.stringValue
|
|
|
+ if _product_Info.verifyofferCode.isEmpty == false {
|
|
|
+ couponCode = _product_Info.verifyofferCode
|
|
|
}
|
|
|
|
|
|
if(couponCode.isEmpty == false) {//判断是否有使用优惠卷
|
|
@@ -1187,6 +1209,19 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
|
|
|
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 { //实际支付的价格
|