| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- //
- // PurchaseintentionCell.m
- // jitao
- //
- // Created by 罗云飞 on 2017/12/9.
- // Copyright © 2017年 罗云飞. All rights reserved.
- //
- #import "PurchaseintentionCell.h"
- @implementation PurchaseintentionCell{
-
- }
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- UILabel *headline = [UILabel new];
- headline.backgroundColor = NewGroupTableViewBackgroundColor;
- [self.contentView addSubview:headline];
-
- headline.sd_layout
- .widthIs(SCREEN_WIDTH)
- .topEqualToView(self.contentView)
- .heightIs(10);
-
- UIImageView *image = [UIImageView new];
- [image setImage:[UIImage imageNamed:@"dd1"]];
- [image setBackgroundColor:NewClearColor];
- [self.contentView addSubview:image];
-
- image.sd_layout
- .leftSpaceToView(self.contentView, 18)
- .topSpaceToView(headline, 13)
- .heightIs(19)
- .widthIs(14);
-
-
- _title = [UILabel new];
- _title.textColor = NewBlackColor;
- _title.font = NewFont(fitScreenWidth(14));
- _title.lineBreakMode = NSLineBreakByTruncatingTail;
- _title.numberOfLines = 1;
- // [self.contentView addSubview:_title];
-
- // _title.sd_layout
- // .leftSpaceToView(image, fitScreenWidth(7))
- // .topSpaceToView(headline, 15)
- // .heightIs(fitScreenWidth(14))
- // .rightSpaceToView(self.contentView, 35);
-
- UILabel *line = [UILabel new];
- line.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:line];
-
- line.sd_layout
- .leftEqualToView(self.contentView)
- .heightIs(0.8)
- .rightEqualToView(self.contentView)
- .topSpaceToView(headline, fitScreenHeight(44));
-
- _state = [UILabel new];
- _state.textColor = [UIColor colorWithString:@"#FF8523"];
- ViewBorderRadius(_state, 3, 1, [UIColor colorWithString:@"#FF8523"]);
- _state.font = NewFont(fitScreenWidth(11));
- _state.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:_state];
-
- _state.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .widthIs(fitScreenWidth(75))
- .heightIs(fitScreenWidth(20))
- .bottomSpaceToView(self.contentView, 10+30+5);
-
- _jiage = [UILabel new];
- _jiage.textColor = [UIColor colorWithString:@"#FF8523"];
- _jiage.font = NewFont(fitScreenWidth(13));
- [_jiage setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_jiage];
- _jiage.sd_layout
- .centerYEqualToView(_state)
- .rightSpaceToView(self.contentView, 15)
- .heightIs(15);
-
- _ordernumber = [UILabel new];
- _ordernumber.textColor = [UIColor colorWithString:@"#FF8523"];
- _ordernumber.font = NewFont(fitScreenWidth(14));
- _ordernumber.lineBreakMode = NSLineBreakByTruncatingTail;
- _ordernumber.numberOfLines = 1;
- [self.contentView addSubview:_ordernumber];
-
- _ordernumber.sd_layout
- .leftSpaceToView(image, fitScreenWidth(7))
- .topSpaceToView(headline, 15)
- .heightIs(fitScreenWidth(14))
- .rightSpaceToView(self.contentView, 35);
-
- _time = [UILabel new];
- _time.font = NewFont(fitScreenWidth(11));
- [_time setSingleLineAutoResizeWithMaxWidth:0];
- _time.textColor = [UIColor colorWithString:@"#9A9A9A"];
- [self.contentView addSubview:_time];
-
- _time.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .heightIs(10)
- .topSpaceToView(line, 10);
- _content = [UILabel new];
- _content.font = NewFont(fitScreenWidth(13));
- _content.textColor = [UIColor colorWithString:@"#9A9A9A"];
- _content.lineBreakMode = NSLineBreakByTruncatingTail;
- _content.numberOfLines = 1;
- [self.contentView addSubview:_content];
- _content.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .topSpaceToView(_time, 10)
- .rightSpaceToView(self.contentView, 15)
- .heightIs(15);
-
- _content1 = [UILabel new];
- _content1.font = NewFont(fitScreenWidth(13));
- _content1.textColor = [UIColor colorWithString:@"#9A9A9A"];
- _content1.lineBreakMode = NSLineBreakByTruncatingTail;
- _content1.numberOfLines = 1;
- [self.contentView addSubview:_content1];
- _content1.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .topSpaceToView(_content, 5)
- .rightSpaceToView(self.contentView, 15)
- .heightIs(15);
-
- _content2 = [UILabel new];
- _content2.font = NewFont(fitScreenWidth(13));
- _content2.textColor = [UIColor colorWithString:@"#9A9A9A"];
- _content2.lineBreakMode = NSLineBreakByTruncatingTail;
- _content2.numberOfLines = 1;
- [self.contentView addSubview:_content2];
-
- _content2.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .topSpaceToView(_content1, 5)
- .rightSpaceToView(self.contentView, 15)
- .heightIs(15);
-
- _cancelintention = [UIButton new];
- [_cancelintention setTitleColor:NewWhiteColor forState:UIControlStateNormal];
- _cancelintention.titleLabel.font = NewFont(fitScreenWidth(12));
- [_cancelintention setBackgroundColor:NewButtonColor];
- NewTouchUpInside(_cancelintention, _cancelintentionclick:);
- ViewRadius(_cancelintention, 3);
- [_cancelintention setHidden:YES];
- [self.contentView addSubview:_cancelintention];
-
- _cancelintention.sd_layout
- .rightSpaceToView(self.contentView, 15)
- .bottomSpaceToView(self.contentView, 10)
- .heightIs(30)
- .widthIs(100);
-
- _cancelintention1111= [UIButton new];
- [_cancelintention1111 setTitleColor:NewWhiteColor forState:UIControlStateNormal];
- _cancelintention1111.titleLabel.font = NewFont(fitScreenWidth(12));
- [_cancelintention1111 setBackgroundColor:NewButtonColor];
- ViewRadius(_cancelintention1111, 3);
- NewTouchUpInside(_cancelintention1111, _cancelintentionclick:);
- [_cancelintention1111 setHidden:YES];
- [self.contentView addSubview:_cancelintention1111];
-
- _cancelintention1111.sd_layout
- .rightSpaceToView(_cancelintention, 20)
- .bottomSpaceToView(self.contentView, 10)
- .heightIs(30)
- .widthIs(100);
-
-
- }
- return self;
- }
- - (void)assignment:(PurchaseintentionModel *)model commoditysModel:(NSArray *)arr{
- _jiage.text = [NSString stringWithFormat:@"总额:%@",model.orderAmount];
- _title.text = model.commodityName;
- _state.text = model.orderStatus;
- _ordernumber.text = [NSString stringWithFormat:@"订单编号:%@",model.orderNo];
- [_time setText:model.createTime];
- if (arr.count>0) {
- if (arr.count == 1) {
- _content.text = [NSString stringWithFormat:@"%@",arr[0][@"commodityName"]];
- }else if (arr.count == 2){
- _content1.text = [NSString stringWithFormat:@"%@",arr[1][@"commodityName"]];
- }else if (arr.count == 3){
- _content2.text = [NSString stringWithFormat:@"%@",arr[2][@"commodityName"]];
- }
- }
-
- NSDictionary *dic = model.operatorActive;
- NSString *a = [NSString stringWithFormat:@"%@",dic[@"refuseIntention"]];
- NSString *a1 = [NSString stringWithFormat:@"%@",dic[@"applyForCancel"]];
- NSString *a2 = [NSString stringWithFormat:@"%@",dic[@"payForFirst"]];
- NSString *a3 = [NSString stringWithFormat:@"%@",dic[@"payForLast"]];
- NSString *a4 = [NSString stringWithFormat:@"%@",dic[@"applyForWithdraw"]];
- NSString *a5 = [NSString stringWithFormat:@"%@",dic[@"confirmPayForLast"]];
- NSString *a6 = [NSString stringWithFormat:@"%@",dic[@"confirmRefund"]];
- NSString *a7 = [NSString stringWithFormat:@"%@",dic[@"confirmWithdraw"]];
- NSString *a8 = [NSString stringWithFormat:@"%@",dic[@"confirmIntention"]];
- NSString *a9 = [NSString stringWithFormat:@"%@",dic[@"confirmPayForFirst"]];
-
- NSString *a10 = [NSString stringWithFormat:@"%@",dic[@"applyForRefund"]];
- NSString *a11 = [NSString stringWithFormat:@"%@",dic[@"agreeRefund"]];
- NSString *a12 = [NSString stringWithFormat:@"%@",dic[@"refuseRefund"]];
-
- NSArray *array = @[a.length>0?a:@"0",
- a1.length>0?a1:@"0",
- a2.length>0?a2:@"0",
- a3.length>0?a3:@"0",
- a4.length>0?a4:@"0",
- a5.length>0?a5:@"0",
- a6.length>0?a6:@"0",
- a7.length>0?a7:@"0",
- a8.length>0?a8:@"0",
- a9.length>0?a9:@"0",
- a10.length>0?a10:@"0",
- a11.length>0?a11:@"0",
- a12.length>0?a12:@"0"];
- NSMutableArray *dataArray = [NSMutableArray array];
-
- for (int i=0; i<array.count; i++) {
- NSString *state = array[i];
- if ([state isEqualToString:@"1"]) {
- switch (i) {
- case 0:
- [dataArray addObject:@{@"title":@"拒绝意向",@"state":@"1"}];
- break;
- case 1:
- [dataArray addObject:@{@"title":@"取消订单",@"state":@"1"}];
- break;
- case 2:
- [dataArray addObject:@{@"title":@"支付首付",@"state":@"1"}];
- break;
- case 3:
- [dataArray addObject:@{@"title":@"支付尾款",@"state":@"1"}];
- break;
- case 4:
- [dataArray addObject:@{@"title":@"提现",@"state":@"1"}];
- break;
- case 5:
- [dataArray addObject:@{@"title":@"确认支付尾款",@"state":@"1"}];
- break;
- case 6:
- [dataArray addObject:@{@"title":@"确认退款",@"state":@"1"}];
- break;
- case 7:
- [dataArray addObject:@{@"title":@"确认提现",@"state":@"1"}];
- break;
- case 8:
- [dataArray addObject:@{@"title":@"确认意向",@"state":@"1"}];
- break;
- case 9:
- [dataArray addObject:@{@"title":@"确认支付首付",@"state":@"1"}];
- break;
- case 10:
- [dataArray addObject:@{@"title":@"申请退款",@"state":@"1"}];
- break;
- case 11:
- [dataArray addObject:@{@"title":@"同意退款",@"state":@"1"}];
- break;
- case 12:
- [dataArray addObject:@{@"title":@"拒绝退款",@"state":@"1"}];
- break;
-
- default:
- break;
- }
- }
- }
-
- if (dataArray.count==0||dataArray.count>2) {
-
- _cancelintention.hidden = YES;
- _cancelintention1111.hidden = YES;
-
- }else if (dataArray.count==1) {
-
- [_cancelintention setTitle:dataArray[0][@"title"] forState:UIControlStateNormal];
- _cancelintention.hidden = NO;
- _cancelintention1111.hidden = YES;
-
- }else if (dataArray.count==2) {
-
- [_cancelintention setTitle:dataArray[0][@"title"] forState:UIControlStateNormal];
- [_cancelintention1111 setTitle:dataArray[1][@"title"] forState:UIControlStateNormal];
- _cancelintention.hidden = NO;
- _cancelintention1111.hidden = NO;
-
- }
-
- }
- - (void)_cancelintentionclick:(UIButton *)sender {
- if (self.delegate && [self.delegate respondsToSelector:@selector(transButIndex:)]) {
- [self.delegate transButIndex:sender];
- }
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- // Configure the view for the selected state
- }
- @end
|