// // FKGroupOrderViewModel.m // FirstLink // // Created by jack on 15/10/8. // Copyright © 2015年 FirstLink. All rights reserved. // #import "FKGroupOrderProgressViewModel.h" #import "FKGroupMemberItem.h" @implementation FKGroupOrderProgressViewModel - (GroupState)getGroupState{ if ([self.orderItem.status isKindOfClass:[NSString class]] && self.orderItem.status.length > 0){ return (GroupState)self.orderItem.status.integerValue; } return GroupStateUnknow; } - (NSUInteger)remainMenberCount{ return self.orderItem.maxGrouponCount.integerValue - self.orderItem.memberArray.count; } - (NSString *)remainMemberWarnStr{ if (self.orderItem.status.intValue == 3) { return @"人数不够,拼团失败"; } if ([self remainMenberCount] <= 0) return @"人数已满,拼团成功"; return [NSString stringWithFormat:@"还差%ld人,小伙伴还等什么~", (unsigned long)[self remainMenberCount]]; } - (NSUInteger)maxGroupCount{ if ([self.orderItem.maxGrouponCount isKindOfClass:[NSString class]]) return self.orderItem.maxGrouponCount.integerValue; return 0; } - (NSArray *)memberImgUrlArray{ NSMutableArray *arrayM = [NSMutableArray arrayWithCapacity:self.orderItem.memberArray.count]; for (FKGroupMemberItem *member in self.orderItem.memberArray) { [arrayM addObject:member.headPic]; } return arrayM; } - (kGroupPostStatus)getGroupPostStatus{ if ([self.orderItem.postStatus isKindOfClass:[NSString class]]) { return (kGroupPostStatus)[self.orderItem.postStatus integerValue]; } return kGroupPostStatusUnknow; } @end