Showing
2 changed files
with
10 additions
and
2 deletions
... | @@ -42,7 +42,7 @@ import UIKit | ... | @@ -42,7 +42,7 @@ import UIKit |
42 | 42 | ||
43 | 43 | ||
44 | func configureCell(coupon: swiftApi.CouponItemModel) { | 44 | func configureCell(coupon: swiftApi.CouponItemModel) { |
45 | -// COUPONSET: desc, img_preview, name, terms, merchant_uuid | 45 | +// COUPONSET: desc, img_preview, name, terms, merchant_uuid, discount_type, final_price |
46 | // COUPON: coupon, expiration, discount, status | 46 | // COUPON: coupon, expiration, discount, status |
47 | // MERCHANT: _img_preview,_admin_name | 47 | // MERCHANT: _img_preview,_admin_name |
48 | 48 | ||
... | @@ -62,7 +62,11 @@ import UIKit | ... | @@ -62,7 +62,11 @@ import UIKit |
62 | 62 | ||
63 | // couponImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | 63 | // couponImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) |
64 | // nameLabel.text = couponSetData?.name ?? "" | 64 | // nameLabel.text = couponSetData?.name ?? "" |
65 | - dicountLabel.text = (coupon.discount ?? "") + "€" | 65 | + let discount = couponSetData?.discount_type == "value" ? ((coupon.discount ?? "") + "€") |
66 | + : couponSetData?.discount_type == "percentage" ? ((coupon.discount ?? "") + "%") | ||
67 | + : couponSetData?.discount_type == "plus_one" ? "1+1" | ||
68 | + : ((coupon.discount ?? "") + "€") | ||
69 | + dicountLabel.text = discount | ||
66 | let htmlText = couponSetData?.inner_text ?? "" | 70 | let htmlText = couponSetData?.inner_text ?? "" |
67 | discriptionLabel.text = htmlText.htmlToString | 71 | discriptionLabel.text = htmlText.htmlToString |
68 | expirationLabel.text = "Ισχύει έως "+(coupon.expiration ?? "") | 72 | expirationLabel.text = "Ισχύει έως "+(coupon.expiration ?? "") | ... | ... |
... | @@ -425,6 +425,8 @@ public class swiftApi { | ... | @@ -425,6 +425,8 @@ public class swiftApi { |
425 | public let visible: Bool? | 425 | public let visible: Bool? |
426 | public let terms: String? | 426 | public let terms: String? |
427 | public let merchant_uuid: String? | 427 | public let merchant_uuid: String? |
428 | + public let discount_type: String? // "value" / "percentage" / "plus_one" | ||
429 | + public let final_price: Float? | ||
428 | 430 | ||
429 | public init(dictionary: [String: Any]) { | 431 | public init(dictionary: [String: Any]) { |
430 | self.uuid = dictionary["uuid"] as? String? ?? "" | 432 | self.uuid = dictionary["uuid"] as? String? ?? "" |
... | @@ -440,6 +442,8 @@ public class swiftApi { | ... | @@ -440,6 +442,8 @@ public class swiftApi { |
440 | self.visible = dictionary["visible"] as? Bool? ?? false | 442 | self.visible = dictionary["visible"] as? Bool? ?? false |
441 | self.terms = dictionary["terms"] as? String? ?? "" | 443 | self.terms = dictionary["terms"] as? String? ?? "" |
442 | self.merchant_uuid = dictionary["merchant_uuid"] as? String? ?? "" | 444 | self.merchant_uuid = dictionary["merchant_uuid"] as? String? ?? "" |
445 | + self.discount_type = dictionary["discount_type"] as? String? ?? "" | ||
446 | + self.final_price = dictionary["final_price"] as? Float? ?? 0.0 | ||
443 | 447 | ||
444 | let expirationObject = dictionary["expiration"] as? [String: Any]? ?? ["":""] | 448 | let expirationObject = dictionary["expiration"] as? [String: Any]? ?? ["":""] |
445 | let expirationString = expirationObject?["value"] as? String? ?? "" | 449 | let expirationString = expirationObject?["value"] as? String? ?? "" | ... | ... |
-
Please register or login to post a comment