No Description

CashCouponUseItem.m 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // DiscountItem.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/6/27.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "CashCouponUseItem.h"
  9. @implementation CashCouponUseItem
  10. + (NSDictionary *)mts_mapping
  11. {
  12. return @{@"min_amount" : mts_key(minAmount),
  13. @"max_amount" : mts_key(maxAmount),
  14. @"cash_coupon_amount" : mts_key(cashAmount)
  15. };
  16. }
  17. + (BOOL)mts_shouldSetUndefinedKeys
  18. {
  19. return NO;
  20. }
  21. - (BOOL)isContainWithUnitPrice:(CGFloat)unitPrice
  22. {
  23. if (unitPrice <= 0) return NO;
  24. NSString *minAmountStr = [FLStringHelper convertFenToYuan:self.minAmount];
  25. NSString *maxAmountStr = [FLStringHelper convertFenToYuan:self.maxAmount];
  26. // NSString *amountStr = [FLStringHelper convertFenToYuan:self.cashAmount];
  27. CGFloat minAmount = minAmountStr.floatValue;
  28. CGFloat maxAmount = maxAmountStr.floatValue;
  29. // CGFloat cashMount = amountStr.floatValue;
  30. if (maxAmount == 0 && unitPrice > minAmount) return YES;
  31. if (unitPrice > minAmount && unitPrice <= maxAmount) return YES;
  32. return NO;
  33. }
  34. @end