123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- //
- // FKPriceWarnListCell.m
- // FirstLink
- //
- // Created by jack on 16/5/27.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKPriceWarnListCell.h"
- @implementation FKPriceWarnListCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
-
- [self addAllSubviews];
- self.contentView.backgroundColor = [UIColor whiteColor];
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return self;
- }
- - (void)addAllSubviews{
-
- [self.contentView addSubview:self.proImgView];
- [self.contentView addSubview:self.titleLabel];
- [self.contentView addSubview:self.currentPriceLabel];
- [self.contentView addSubview:self.originPriceLabel];
- [self.contentView addSubview:self.cutLine];
- [self.contentView addSubview:self.bookPirceLabel];
- [self.contentView addSubview:self.bookPirceBtn];
-
- [self.proImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.contentView).offset(5);
- make.centerY.equalTo(self.contentView);
- make.width.height.mas_equalTo([self get_imageMargin]);
- }];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.proImgView.mas_right).offset(10);
- make.top.equalTo(self.contentView).offset(20);
- make.right.equalTo(self.contentView).offset(- 15);
- }];
-
- [self.currentPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.titleLabel);
- make.bottom.equalTo(self.contentView).offset(- 21);
- }];
-
- [self.originPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.currentPriceLabel.mas_right).offset(2);
- make.baseline.equalTo(self.currentPriceLabel.mas_baseline);
- make.right.mas_lessThanOrEqualTo(self.bookPirceBtn.mas_left);
- }];
-
- [self.cutLine mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(self.originPriceLabel);
- make.width.mas_equalTo(self.originPriceLabel);
- make.height.mas_equalTo(0.5);
- }];
-
- [self.bookPirceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.contentView).offset(- 15);
- make.centerY.equalTo(self.currentPriceLabel);
- make.width.equalTo(self.bookPirceLabel).offset(10);
- make.height.mas_equalTo(23);
- }];
-
- [self.bookPirceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(self.bookPirceBtn);
- }];
- }
- - (CGFloat)get_imageMargin{
- return 95.0f;
- }
- - (void)configWithRemindItem:(FKRemindProductItem *)remindItem{
- if (remindItem){
- [self.proImgView setImageWithURL:remindItem.picUrl cdnWidth:[self get_imageMargin]];
- self.titleLabel.text = remindItem.title;
- self.currentPriceLabel.text = [FLStringHelper convertFenToRMBmoneyString:remindItem.price];
-
- self.originPriceLabel.text = nil;
- if ([FLStringHelper isValidString:remindItem.originPrice]){
- self.originPriceLabel.text = [FLStringHelper convertFenToRMBmoneyString:remindItem.originPrice];
- }
-
- self.bookPirceLabel.text = [NSString stringWithFormat:@"订阅价%@", [FLStringHelper convertFenToRMBmoneyString:remindItem.expectPrice]];
- }
- }
- #pragma mark - property
- - (UIImageView *)proImgView{
- if (_proImgView == nil) {
- _proImgView = [[UIImageView alloc]init];
- _proImgView.contentMode = UIViewContentModeScaleAspectFit;
- }
- return _proImgView;
- }
- - (UILabel *)titleLabel{
- if (_titleLabel == nil) {
- _titleLabel = [[UILabel alloc]init];
- _titleLabel.font = [UIFont systemFontOfSize:14];
- _titleLabel.textColor = UIColorFromRGB(0x333333);
- _titleLabel.numberOfLines = 2;
- }
- return _titleLabel;
- }
- - (UILabel *)currentPriceLabel{
- if (_currentPriceLabel == nil) {
- _currentPriceLabel = [[UILabel alloc]init];
- _currentPriceLabel.textColor = UIColorFromRGB(0x333333);
- _currentPriceLabel.font = [UIFont boldSystemFontOfSize:15];
- }
- return _currentPriceLabel;
- }
- - (UILabel *)originPriceLabel{
- if (_originPriceLabel == nil) {
- _originPriceLabel = [[UILabel alloc]init];
- _originPriceLabel.font = [UIFont boldSystemFontOfSize:9];
- _originPriceLabel.textColor = UIColorFromRGB(0x666666);
- _originPriceLabel.lineBreakMode = NSLineBreakByTruncatingTail;
- }
- return _originPriceLabel;
- }
- - (UIButton *)bookPirceBtn{
- if (_bookPirceBtn == nil) {
- _bookPirceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _bookPirceBtn.layer.cornerRadius = 3;
- _bookPirceBtn.layer.borderColor = UIColorFromRGB(0xcccccc).CGColor;
- _bookPirceBtn.layer.borderWidth = 0.5f;
- }
- return _bookPirceBtn;
- }
- - (UILabel *)bookPirceLabel{
- if (_bookPirceLabel == nil) {
- _bookPirceLabel = [[UILabel alloc]init];
- _bookPirceLabel.font = [UIFont systemFontOfSize:11];
- _bookPirceLabel.textColor = UIColorFromRGB(0x666666);
- _bookPirceLabel.backgroundColor = [UIColor whiteColor];
- [_bookPirceLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
- }
- return _bookPirceLabel;
- }
- - (UIView *)cutLine{
- if (_cutLine == nil) {
- _cutLine = [[UIView alloc]init];
- _cutLine.backgroundColor = UIColorFromRGB(0x666666);
- }
- return _cutLine;
- }
- @end
|