暫無描述

FKGroupOrderProgressViewModel.m 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // FKGroupOrderViewModel.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/10/8.
  6. // Copyright © 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "FKGroupOrderProgressViewModel.h"
  9. #import "FKGroupMemberItem.h"
  10. @implementation FKGroupOrderProgressViewModel
  11. - (GroupState)getGroupState{
  12. if ([self.orderItem.status isKindOfClass:[NSString class]] && self.orderItem.status.length > 0){
  13. return (GroupState)self.orderItem.status.integerValue;
  14. }
  15. return GroupStateUnknow;
  16. }
  17. - (NSUInteger)remainMenberCount{
  18. return self.orderItem.maxGrouponCount.integerValue - self.orderItem.memberArray.count;
  19. }
  20. - (NSString *)remainMemberWarnStr{
  21. if (self.orderItem.status.intValue == 3) {
  22. return @"人数不够,拼团失败";
  23. }
  24. if ([self remainMenberCount] <= 0)
  25. return @"人数已满,拼团成功";
  26. return [NSString stringWithFormat:@"还差%ld人,小伙伴还等什么~", (unsigned long)[self remainMenberCount]];
  27. }
  28. - (NSUInteger)maxGroupCount{
  29. if ([self.orderItem.maxGrouponCount isKindOfClass:[NSString class]]) return self.orderItem.maxGrouponCount.integerValue;
  30. return 0;
  31. }
  32. - (NSArray *)memberImgUrlArray{
  33. NSMutableArray *arrayM = [NSMutableArray arrayWithCapacity:self.orderItem.memberArray.count];
  34. for (FKGroupMemberItem *member in self.orderItem.memberArray) {
  35. [arrayM addObject:member.headPic];
  36. }
  37. return arrayM;
  38. }
  39. - (kGroupPostStatus)getGroupPostStatus{
  40. if ([self.orderItem.postStatus isKindOfClass:[NSString class]]) {
  41. return (kGroupPostStatus)[self.orderItem.postStatus integerValue];
  42. }
  43. return kGroupPostStatusUnknow;
  44. }
  45. @end