123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- //
- // OrderCell.m
- // jiaPei
- //
- // Created by apple on 16/6/7.
- // Copyright © 2016年 JCZ. All rights reserved.
- //
- #import "OrderCell.h"
- #import "EvaluationAndPayVC.h"
- #import "ShowCommentVC.h"
- #import "OrbitVC.h"
- @implementation OrderCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
-
- self.backgroundColor = [UIColor whiteColor];
-
- NSMutableArray *labelArray = [NSMutableArray arrayWithCapacity:7];
- for (int i = 0; i < 7; i ++) {
-
- UILabel *label = [UILabel new];
- [label setTextAlignment:NSTextAlignmentLeft];
- label.font = [UIFont scaleSize:Font16];
- label.textColor = contentTextColor;
- [self.contentView addSubview:label];
- [labelArray addObject:label];
- }
-
- orderNumLabel = labelArray[0];
- lineLabel = labelArray[1];
- nameLabel = labelArray[2];
- beginTimeLabel = labelArray[3];
- endTimeLabel = labelArray[4];
- priceLabel = labelArray[5];
- staticLabel = labelArray[6];
-
- orderNumLabel.textAlignment = NSTextAlignmentRight;
- priceLabel.textAlignment = NSTextAlignmentRight;
- staticLabel.textAlignment = NSTextAlignmentRight;
- staticLabel.textColor = [UIColor orangeColor];
-
- lineLabel.backgroundColor = lineColor;
-
-
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- //轨迹
- [btn setTitle:@"" textColor:defGreen font:Font16 fotState:UIControlStateNormal];
- [btn target:self Tag:2];
- [self.contentView addSubview:btn];
- orbitBtn = btn;
- //投诉/评价/支付
- btn = [UIButton buttonWithType:UIButtonTypeCustom];
- [btn setTitle:@"" textColor:defGreen font:Font16 fotState:UIControlStateNormal];
- [btn target:self Tag:1];
- [self.contentView addSubview:btn];
- lookBtn = btn;
- }
- return self;
- }
- +(OrderCell *)cellForTabelView:(UITableView*)tableView
- {
- OrderCell* cell = [tableView dequeueReusableCellWithIdentifier:@"OrderCell"];
- if (!cell) {
- cell = [[OrderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"OrderCell"];
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
- }
- return cell;
- }
- -(void)layoutSubviews
- {
- [super layoutSubviews];
- CGFloat wid = self.width;
- CGFloat x,y,w,h,bd;
-
- x = y = 0;
- bd = 5;
- w = wid - 20;
- h = 30;
- orderNumLabel.frame = setDIYFrame;
-
- x = 0;
- y += h;
- w = wid;
- h = 1.0;
- lineLabel.frame = setDIYFrame;
-
- x = 20;
- y += h + bd;
- w = wid - 40;
- h = 20;
- beginTimeLabel.frame = setDIYFrame;
- priceLabel.frame = setDIYFrame;
-
- y += h + bd;
-
- endTimeLabel.frame = setDIYFrame;
- staticLabel.frame = setDIYFrame;
-
- y += h + bd;
- nameLabel.frame = setDIYFrame;
-
- y -= 2;
- h = 25;
- w = 70;
-
- [lookBtn borderColor:defGreen width:1 cornorRadios:5];//评论投诉
- [orbitBtn borderColor:defGreen width:1 cornorRadios:5];//轨迹
- [orbitBtn setTitle:@"查看轨迹" forState:UIControlStateNormal];
-
- switch ([self.type integerValue]) {
- case 0:
- //轨迹
- x = wid - w - 20;//最右
- orbitBtn.frame = setDIYFrame;
- w = 0;
- lookBtn.frame = setDIYFrame;
- break;
- case 1:
- //轨迹
- x = wid - 2*w - 30;
- orbitBtn.frame = setDIYFrame;
- //收钱
- x = wid - w - 20;//最右
- lookBtn.frame = setDIYFrame;
- break;
- case 2:
- //轨迹
- x = wid - w - 20;//最右
- orbitBtn.frame = setDIYFrame;
- w = 0;
- lookBtn.frame = setDIYFrame;
- break;
- case 3:
- //轨迹
- x = wid - 2*w - 30;
- orbitBtn.frame = setDIYFrame;
- //查看评价
- x = wid - w - 20;//最右
- lookBtn.frame = setDIYFrame;
- break;
- case 4:
- //轨迹
- x = wid - 2*w - 30;
- orbitBtn.frame = setDIYFrame;
- //查看投诉
- x = wid - w - 20;//最右
- lookBtn.frame = setDIYFrame;
- break;
- default:
- break;
- }
-
- }
- -(void)setDataDic:(NSDictionary *)dataDic
- {
- switch ([self.type integerValue]) {
- case 0:
- break;
- case 1:
- [lookBtn setTitle:@"收款" forState:UIControlStateNormal];
- break;
- case 2:
- break;
- case 3:
- [lookBtn setTitle:@"查看评价" forState:UIControlStateNormal];
- break;
- case 4:
- [lookBtn setTitle:@"查看投诉" forState:UIControlStateNormal];
- break;
-
- default:
- break;
- }
-
- _dataDic = dataDic;
- NSString *stateString = @"未评价,未支付";
- if ([dataDic[@"RO_IS_PAY"] integerValue] == 1) {
- stateString = @"已支付,未评价";
- if ([dataDic[@"RO_IS_EVALUATE"] integerValue] == 1){
- stateString = @"已支付,已评价";
- }
- }
-
- orderNumLabel.text = [NSString stringWithFormat:@"订单号:%@",dataDic[@"RO_ORDER_NO"]];
- nameLabel.text = [NSString stringWithFormat:@"学员:%@",dataDic[@"RO_USER_NAME"]];
- beginTimeLabel.text = [NSString stringWithFormat:@"开始时间:%@",dataDic[@"RO_START_TIME"]];
- endTimeLabel.text = [NSString stringWithFormat:@"结束时间:%@",dataDic[@"RO_END_TIME"]];
- priceLabel.text = [NSString stringWithFormat:@"价格:%@元",dataDic[@"RO_MONEY"]];
- staticLabel.text = stateString;
-
- if ([dataDic[@"RO_END_TIME"] length] < 1) {
- endTimeLabel.text = @"结束时间:暂无";
- }
- if ([dataDic[@"RO_MONEY"] length] < 1) {
- endTimeLabel.text = @"价格:0元";
- }
- }
- -(void)btnClick:(UIButton *)btn
- {
- //1,评价/支付/投诉。2,轨迹
- if (btn.tag == 1) {
- switch ([self.type integerValue]) {
- case 0:
- break;
- case 1:
- //@"收款"
- payBlock(_dataDic);
- break;
- case 2:
- break;
- case 3:
- {
- //评价
- EvaluationAndPayVC *vc = [[EvaluationAndPayVC alloc] init];
- vc.dataDic = _dataDic;
- [_skipVC.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 4:
- {
- //投诉
- ShowCommentVC *show = [[ShowCommentVC alloc] init];
- show.classID = _dataDic[@"RO_CLASS_ID"];
- show.stuId = _dataDic[@"RO_USER_ID"];
- [_skipVC.navigationController pushViewController:show animated:YES];
- }
- break;
-
- default:
- break;
- }
- }else if (btn.tag == 2) {
-
- //轨迹
- OrbitVC *orbit = [[OrbitVC alloc] init];
- orbit.classId = _dataDic[@"RO_CLASS_ID"];
- orbit.stuOutId = _dataDic[@"OUTID"];
- [_skipVC.navigationController pushViewController:orbit animated:YES];
- }
- }
- - (void)payClickToBlock:(MyBlockType)block
- {
- payBlock = block;
- }
- @end
|