90 lines
3.6 KiB
Objective-C
90 lines
3.6 KiB
Objective-C
//
|
|
// GolaCoastListViewCell.m
|
|
// Ifish
|
|
//
|
|
// Created by imac on 2017/4/25.
|
|
// Copyright © 2017年 lianlian. All rights reserved.
|
|
//
|
|
|
|
#import "GolaCoastListViewCell.h"
|
|
|
|
@implementation GolaCoastListViewCell
|
|
|
|
- (void)awakeFromNib {
|
|
[super awakeFromNib];
|
|
// Initialization code
|
|
}
|
|
-(void)loadCellwith:(DiscountCoupon *)model
|
|
{
|
|
NSString *coastYuanT = [NSString stringWithFormat:@"¥%d",model.moneyValue];
|
|
NSMutableAttributedString *coastYuanStr =[[NSMutableAttributedString alloc] initWithString:coastYuanT];
|
|
[coastYuanStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(0, 1)];
|
|
self.coastYuan.attributedText = coastYuanStr;
|
|
|
|
|
|
|
|
NSString *duihuancishu = nil;
|
|
if ([model.exchangeCount isKindOfClass:[NSNull class]]) {
|
|
duihuancishu = [NSString stringWithFormat:@"已兑换0次"];
|
|
}else{
|
|
duihuancishu = [NSString stringWithFormat:@"已兑换%@次",model.exchangeCount];
|
|
}
|
|
NSString *exCount = [NSString stringWithFormat:@"%@",model.exchangeCount];
|
|
NSRange cishuNumberRange = [duihuancishu rangeOfString:exCount];
|
|
NSMutableAttributedString *cishuStr =[[NSMutableAttributedString alloc] initWithString:duihuancishu];
|
|
[cishuStr addAttribute:NSForegroundColorAttributeName value:RGB(254, 121, 63) range:cishuNumberRange];
|
|
|
|
self.duiHuanCiShu.attributedText = cishuStr;
|
|
|
|
|
|
NSString *canusegold = [NSString stringWithFormat:@"%ld金币可兑换",(long)model.needGold];
|
|
NSString *canusegoldNum = [NSString stringWithFormat:@"%ld",(long)model.needGold];
|
|
NSRange canusegoldRange = [canusegold rangeOfString:canusegoldNum];
|
|
NSMutableAttributedString *canusegoldStr =[[NSMutableAttributedString alloc] initWithString:canusegold];
|
|
[canusegoldStr addAttribute:NSForegroundColorAttributeName value:RGB(254, 121, 63) range:canusegoldRange];
|
|
[canusegoldStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:canusegoldRange];
|
|
|
|
self.canUserGold.attributedText = canusegoldStr;
|
|
|
|
self.useConditionfrist.text = [NSString stringWithFormat:@"1.%@",model.tagText];
|
|
if (!model.useNeedMoney||[model.useNeedMoney isKindOfClass:[NSNull class]]) {
|
|
self.useConditionSec.text = [NSString stringWithFormat:@"2.无使用门槛"];
|
|
}else{
|
|
self.useConditionSec.text = [NSString stringWithFormat:@"2.满%@元可用",model.useNeedMoney];
|
|
}
|
|
if (!model.validEndDate||[model.validEndDate isKindOfClass:[NSNull class]]) {
|
|
self.useConditionThr.text = [NSString stringWithFormat:@"3.永久有效"];
|
|
}else{
|
|
if ([model.validStartDate isKindOfClass:[NSNull class]]) {
|
|
model.validStartDate = @"";
|
|
}
|
|
self.useConditionThr.text = [NSString stringWithFormat:@"3.%@致%@",model.validStartDate,model.validEndDate];
|
|
}
|
|
|
|
|
|
if (model.moneyValue <=1) {
|
|
self.coastYuan.textColor = RGB(78, 210, 254);
|
|
self.goldLineView.backgroundColor = RGB(78, 210, 254);
|
|
}else if (model.moneyValue >=10&&model.moneyValue <20){
|
|
self.coastYuan.textColor = RGB(78, 157, 254);
|
|
self.goldLineView.backgroundColor = RGB(78, 157, 254);
|
|
}else if (model.moneyValue >=20&&model.moneyValue <50){
|
|
self.coastYuan.textColor = RGB(254, 127, 78);
|
|
self.goldLineView.backgroundColor = RGB(254, 127, 78);
|
|
}else if (model.moneyValue >=50){
|
|
self.coastYuan.textColor = RGB(254, 181, 78);
|
|
self.goldLineView.backgroundColor = RGB(254, 181, 78);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
|
[super setSelected:selected animated:animated];
|
|
|
|
// Configure the view for the selected state
|
|
}
|
|
|
|
@end
|