123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- //
- // DRChildOrderCell.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/5/18.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRChildOrderCell.h"
- #import "CCCopyLabel.h"
- @interface DRChildOrderCell ()
- @property (nonatomic, strong) UIImageView *icon;
- @property (nonatomic, strong) CCCopyLabel *orderTitle;
- @property (nonatomic, strong) UILabel *orderDate;
- @property (nonatomic, strong) UILabel *orderPrice;
- @property (nonatomic, strong) UILabel *orderType;
- @end
- @implementation DRChildOrderCell
- + (instancetype)cellWithTableView:(UITableView *)tableView {
- static NSString *cellID = nil;
- cellID = NSStringFromClass([self class]);
- DRChildOrderCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
- if (!cell) {
- cell = [[DRChildOrderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
- }
- return cell;
-
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- [self initSubView];
- }
- return self;
- }
- - (void)initSubView {
-
- [self.contentView addSubview:self.icon];
- [self.contentView addSubview:self.orderTitle];
- [self.contentView addSubview:self.orderDate];
- [self.contentView addSubview:self.orderPrice];
- [self.contentView addSubview:self.orderType];
-
- [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.centerY.mas_equalTo(self.mas_centerY);
- make.width.height.mas_equalTo(28);
- }];
-
- [self.orderTitle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.icon.mas_right).mas_offset(15);
- make.top.mas_equalTo(13);
- }];
-
- [self.orderDate mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.orderTitle);
- make.top.mas_equalTo(self.orderTitle.mas_bottom).mas_offset(4);
- }];
-
- [self.orderPrice mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-15);
- make.centerY.mas_equalTo(self);
- }];
- [self.orderType mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.orderDate.mas_right).offset(FITSIZE(12));
- make.centerY.equalTo(self.orderDate.mas_centerY);
- }];
- }
- - (UILabel *)orderTitle {
- if (!_orderTitle) {
- _orderTitle = [[CCCopyLabel alloc] init];
- _orderTitle.font = [UIFont systemFontOfSize:16];
- _orderTitle.text = @"佣金收入";
- _orderTitle.textColor = [UIColor YHColorWithHex:0x666666];
- }
- return _orderTitle;
- }
- - (UILabel *)orderDate {
- if (!_orderDate) {
- _orderDate = [[UILabel alloc] init];
- _orderDate.textColor = [UIColor YHColorWithHex:0x999999];
- _orderDate.font = [UIFont systemFontOfSize:12];
- _orderDate.text = @"日期:--";
- }
- return _orderDate;
- }
- - (UILabel *)orderPrice {
- if (!_orderPrice) {
- _orderPrice = [[UILabel alloc] init];
- _orderPrice.font = [UIFont systemFontOfSize:18];
- _orderPrice.textAlignment = NSTextAlignmentRight;
- _orderPrice.text = @"+0.00";
- }
- return _orderPrice;
- }
- -(UILabel *)orderType{
- if (!_orderType) {
- _orderType=[[UILabel alloc]init];
- _orderType.textColor = [UIColor YHColorWithHex:0x999999];
- _orderType.font = [UIFont systemFontOfSize:12];
- _orderType.text = @"";
- }
- return _orderType;
- }
- - (UIImageView *)icon {
- if (!_icon) {
- _icon = [[UIImageView alloc] init];
- _icon.image = [UIImage imageNamed:@"comission_left"];
- _icon.layer.cornerRadius = 14;
- }
- return _icon;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- -(void)setModel:(DRChildOrderModel *)model{
- _model=model;
- switch ([model.type integerValue]) {
- case 0:
- {
- self.orderTitle.text=@"红包收入";
- }
- break;
- case 1:
- case 3:
- {
- self.orderTitle.text=@"佣金收入";
- }
- break;
- case 2:
- {
- self.orderTitle.text=@"提现扣除";
- }
- break;
- default:
- break;
- }
- self.orderDate.text=[NSString stringWithFormat:@"%@",model.create_at];
- NSString *type=@"+";
- if ([model.type integerValue]==2) {
- self.orderPrice.textColor=[UIColor YHColorWithHex:0xEC1B1B];
- type=@"-"; //提现
- switch ([model.state_of_embodiment integerValue]) {
- case 0:
- {
- self.orderType.text=@"申请中";
- }
- break;
- case 1:
- {
- self.orderType.text=@"已通过";
- }
- break;
- case 2:
- {
- self.orderType.text=@"未通过";
- }
- break;
- default:
- break;
- }
- }else{
- self.orderPrice.textColor=[UIColor YHColorWithHex:0x15CB6C];
- self.orderType.text=@"";
- }
- self.orderPrice.text=[NSString stringWithFormat:@"%@%@",type,model.rebate];
- }
- @end
|