Nav apraksta

PriceDetailItem.m 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // PriceDetailItem.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/7/2.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "PriceDetailItem.h"
  9. @implementation PriceDetailItem
  10. + (NSDictionary *)mts_mapping
  11. {
  12. return @{@"estimate_price" : mts_key(estimate_price),
  13. @"refer_price" : mts_key(refer_price),
  14. @"international_postage" : mts_key(international_postage),
  15. @"vip_price" : mts_key(vip_price),
  16. @"groupon_price" : mts_key(group_price),
  17. @"member_count" : mts_key(maxGroupMemberCount),
  18. @"arrival_time" : mts_key(arrival_time),
  19. @"weight" : mts_key(singleWeight),
  20. @"source" : mts_key(source),
  21. @"buy_channel" : mts_key(buyChannel),
  22. };
  23. }
  24. + (BOOL)mts_shouldSetUndefinedKeys
  25. {
  26. return NO;
  27. }
  28. - (NSString*)totalPrice {
  29. CGFloat estimatePrice = [FLStringHelper convertFenStringToYuanValue:self.estimate_price];
  30. CGFloat internationalPostage = [FLStringHelper convertFenStringToYuanValue:self.international_postage];
  31. return [NSString stringWithFormat:@"¥%.2f", estimatePrice + internationalPostage];
  32. }
  33. - (NSString*)groupPrice {
  34. CGFloat groupPrice = [FLStringHelper convertFenStringToYuanValue:self.group_price];
  35. CGFloat internationalPostage = [FLStringHelper convertFenStringToYuanValue:self.international_postage];
  36. return [NSString stringWithFormat:@"¥%.2f", groupPrice + internationalPostage];
  37. }
  38. - (NSString*)vipPrice {
  39. if (self.vip_price.length > 0) {
  40. CGFloat vipPrice = [FLStringHelper convertFenStringToYuanValue:self.vip_price];
  41. CGFloat internationalPostage = [FLStringHelper convertFenStringToYuanValue:self.international_postage];
  42. return [NSString stringWithFormat:@"¥%.2f", (vipPrice + internationalPostage)];
  43. }
  44. return nil;
  45. }
  46. - (NSAttributedString *)totalPriceAttString{
  47. NSString *totalPrice = [self totalPrice];
  48. NSMutableAttributedString *attM = [[NSMutableAttributedString alloc]initWithString:totalPrice];
  49. [attM addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(0, 1)];
  50. return attM;
  51. }
  52. @end