| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- //
- // CategoryPriceCell.m
- // iSales-NPD
- //
- // Created by Jack on 2016/10/11.
- // Copyright © 2016年 United Software Applications, Inc. All rights reserved.
- //
- #import "CategoryPriceCell.h"
- #import "SetCategoryPriceController.h"
- #import "config.h"
- @interface CategoryPriceCell ()
- @property (strong, nonatomic) IBOutlet UILabel *categoryLabel;
- @property (strong, nonatomic) IBOutlet UILabel *priceLabel;
- @end
- @implementation CategoryPriceCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (void)setCategoryPrice:(NSDictionary *)categoryPrice {
- _categoryPrice = categoryPrice;
-
- NSString *basePrice = [categoryPrice objectForKey:@"base_price"];
- NSString *discount = [categoryPrice objectForKey:@"price_discount"];
- NSString *price = @"";
- switch (basePrice.integerValue) {
- case 0:{
- basePrice = [RASingleton sharedInstance].deliveryString;
- }
- break;
- case 1:{
- basePrice = flat_price;
- }
-
- default:
- break;
- }
-
- if ([discount hasPrefix:@"-"]) {
-
- discount = [discount substringFromIndex:1];
- price = [NSString stringWithFormat:@"%@ - %@",basePrice,discount];
-
- } else if ([discount hasSuffix:@"%"]) {
-
- price = [NSString stringWithFormat:@"%@ x %@",basePrice,discount];
-
- } else {
-
- price = [NSString stringWithFormat:@"%@ + %@",basePrice,discount];
-
- }
-
- self.categoryLabel.text = [self.categoryPrice objectForKey:@"title"];
-
- self.priceLabel.text = price;
- }
- @end
|