// // PriceDetailItem.m // FirstLink // // Created by jack on 15/7/2. // Copyright (c) 2015年 FirstLink. All rights reserved. // #import "PriceDetailItem.h" @implementation PriceDetailItem + (NSDictionary *)mts_mapping { return @{@"estimate_price" : mts_key(estimate_price), @"refer_price" : mts_key(refer_price), @"international_postage" : mts_key(international_postage), @"vip_price" : mts_key(vip_price), @"groupon_price" : mts_key(group_price), @"member_count" : mts_key(maxGroupMemberCount), @"arrival_time" : mts_key(arrival_time), @"weight" : mts_key(singleWeight), @"source" : mts_key(source), @"buy_channel" : mts_key(buyChannel), }; } + (BOOL)mts_shouldSetUndefinedKeys { return NO; } - (NSString*)totalPrice { CGFloat estimatePrice = [FLStringHelper convertFenStringToYuanValue:self.estimate_price]; CGFloat internationalPostage = [FLStringHelper convertFenStringToYuanValue:self.international_postage]; return [NSString stringWithFormat:@"¥%.2f", estimatePrice + internationalPostage]; } - (NSString*)groupPrice { CGFloat groupPrice = [FLStringHelper convertFenStringToYuanValue:self.group_price]; CGFloat internationalPostage = [FLStringHelper convertFenStringToYuanValue:self.international_postage]; return [NSString stringWithFormat:@"¥%.2f", groupPrice + internationalPostage]; } - (NSString*)vipPrice { if (self.vip_price.length > 0) { CGFloat vipPrice = [FLStringHelper convertFenStringToYuanValue:self.vip_price]; CGFloat internationalPostage = [FLStringHelper convertFenStringToYuanValue:self.international_postage]; return [NSString stringWithFormat:@"¥%.2f", (vipPrice + internationalPostage)]; } return nil; } - (NSAttributedString *)totalPriceAttString{ NSString *totalPrice = [self totalPrice]; NSMutableAttributedString *attM = [[NSMutableAttributedString alloc]initWithString:totalPrice]; [attM addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(0, 1)]; return attM; } @end