OrderdetailCell.m 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. //
  2. // OrderdetailCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/24.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "OrderdetailCell.h"
  9. @implementation OrderdetailCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. UILabel *line = [UILabel new];
  14. line.backgroundColor = NewLineGrayColor;
  15. [self.contentView addSubview:line];
  16. line.sd_layout
  17. .leftEqualToView(self.contentView)
  18. .heightIs(10)
  19. .rightEqualToView(self.contentView)
  20. .topEqualToView(self.contentView);
  21. UILabel *line1 = [UILabel new];
  22. line1.backgroundColor = NewButtonColor;
  23. ViewRadius(line1, 1);
  24. [self.contentView addSubview:line1];
  25. line1.sd_layout
  26. .leftSpaceToView(self.contentView, 15)
  27. .topSpaceToView(line, 15)
  28. .heightIs(fitScreenWidth(18))
  29. .widthIs(3);
  30. _title = [UILabel new];
  31. _title.font = NewFont(fitScreenWidth(14));
  32. _title.lineBreakMode = NSLineBreakByTruncatingTail;
  33. _title.numberOfLines = 1;
  34. [self.contentView addSubview:_title];
  35. _title.sd_layout
  36. .leftSpaceToView(line1, 10)
  37. .heightIs(fitScreenWidth(44))
  38. .topSpaceToView(line, 0)
  39. .rightSpaceToView(self.contentView, 15);
  40. UILabel *line2 = [UILabel new];
  41. line2.backgroundColor = NewLineGrayColor;
  42. [self.contentView addSubview:line2];
  43. line2.sd_layout
  44. .leftEqualToView(self.contentView)
  45. .heightIs(0.8)
  46. .rightEqualToView(self.contentView)
  47. .topSpaceToView(line, fitScreenWidth(44));
  48. _state = [UILabel new];
  49. _state.font = NewFont(fitScreenWidth(12));
  50. _state.textColor = [UIColor colorWithString:@"#FF8523"];
  51. ViewBorderRadius(_state, 5, 1, [UIColor colorWithString:@"#FF8523"]);
  52. _state.textAlignment = NSTextAlignmentCenter;
  53. [self.contentView addSubview:_state];
  54. _state.sd_layout
  55. .leftEqualToView(line1)
  56. .topSpaceToView(line2, 15)
  57. .heightIs(fitScreenWidth(20))
  58. .widthIs(fitScreenWidth(70));
  59. _ordernumber = [UILabel new];
  60. _ordernumber.font = NewFont(fitScreenWidth(12));
  61. _ordernumber.textColor =[UIColor colorWithString:@"#FF8523"];
  62. [_ordernumber setSingleLineAutoResizeWithMaxWidth:0];
  63. [self.contentView addSubview:_ordernumber];
  64. _ordernumber.sd_layout
  65. .leftSpaceToView(_state, fitScreenWidth(20))
  66. .heightIs(fitScreenWidth(14))
  67. .topEqualToView(_state);
  68. _number = [UILabel new];
  69. _number.font = NewBFont(fitScreenWidth(12));
  70. _number.textColor = NewButtonColor;
  71. [_number setSingleLineAutoResizeWithMaxWidth:0];
  72. // [self.contentView addSubview:_number];
  73. _number.sd_layout
  74. .rightSpaceToView(self.contentView, 10)
  75. .centerYEqualToView(_ordernumber)
  76. .heightIs(fitScreenHeight(12));
  77. UILabel *shuliang = [UILabel new];
  78. shuliang.text = @"数量:";
  79. shuliang.font = NewFont(fitScreenWidth(12));
  80. [shuliang setSingleLineAutoResizeWithMaxWidth:0];
  81. // [self.contentView addSubview:shuliang];
  82. shuliang.sd_layout
  83. .rightSpaceToView(_number, 1)
  84. .heightIs(fitScreenWidth(12))
  85. .centerYEqualToView(_ordernumber);
  86. _soufu = [UILabel new];
  87. _soufu.font = NewFont(fitScreenWidth(12));
  88. [_soufu setSingleLineAutoResizeWithMaxWidth:0];
  89. [self.contentView addSubview:_soufu];
  90. _soufu.sd_layout
  91. .leftEqualToView(_state)
  92. .heightIs(fitScreenWidth(12))
  93. .topSpaceToView(_state, 15);
  94. _weikuan = [UILabel new];
  95. _weikuan.font = NewFont(fitScreenWidth(12));
  96. [_weikuan setSingleLineAutoResizeWithMaxWidth:0];
  97. [self.contentView addSubview:_weikuan];
  98. _weikuan.sd_layout
  99. .leftSpaceToView(_soufu, 10)
  100. .heightIs(fitScreenWidth(12))
  101. .topSpaceToView(_state, 15);
  102. _time = [UILabel new];
  103. _time.font = NewFont(fitScreenWidth(12));
  104. _time.textColor = [UIColor colorWithString:@"#9A9A9A"];
  105. [_time setSingleLineAutoResizeWithMaxWidth:0];
  106. [self.contentView addSubview:_time];
  107. _time.sd_layout
  108. .rightSpaceToView(self.contentView, 15)
  109. .heightIs(fitScreenWidth(14))
  110. .centerYEqualToView(_state);
  111. UILabel *jiage = [UILabel new];
  112. jiage.text = @"输入金额:";
  113. jiage.font = NewFont(fitScreenWidth(14));
  114. [jiage setSingleLineAutoResizeWithMaxWidth:0];
  115. [self.contentView addSubview:jiage];
  116. jiage.sd_layout
  117. .leftEqualToView(_state)
  118. .heightIs(44)
  119. .bottomEqualToView(self.contentView);
  120. _price = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:[UIColor colorWithString:@"#FF8523"] placeholder:@"" hidden:NO tag:100 font:NewBFont(fitScreenWidth(14)) textAlignment:NSTextAlignmentLeft clearButtonMode:UITextFieldViewModeAlways clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeNumberPad returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES];
  121. [self.contentView addSubview:_price];
  122. _price.sd_layout
  123. .leftSpaceToView(jiage, 1)
  124. .heightIs(44)
  125. .widthIs(200)
  126. .bottomEqualToView(self.contentView);
  127. _zongjia = [UILabel new];
  128. [_zongjia setSingleLineAutoResizeWithMaxWidth:0];
  129. _zongjia.font = NewFont(fitScreenWidth(14));
  130. [self.contentView addSubview:_zongjia];
  131. _zongjia.sd_layout
  132. .centerYEqualToView(jiage)
  133. .heightIs(44)
  134. .rightSpaceToView(self.contentView, 15);
  135. }
  136. return self;
  137. }
  138. - (void)assignment:(OrderdetailModel*)model {
  139. // _title.text = model.commodityName;
  140. _state.text = model.orderStatus;
  141. _title.text = [NSString stringWithFormat:@"订单编号:%@",model.orderNo];
  142. _time.text = [NSString stringWithFormat:@"%@",model.createTime];
  143. _price.placeholder = model.orderAmount;
  144. // _number.text = @"一份";
  145. _soufu.text = [NSString stringWithFormat:@"首付款:%@",model.firstPayment];
  146. _weikuan.text = [NSString stringWithFormat:@"订单金额:%@",model.orderAmount];
  147. NSDictionary *dic = model.operatorActive;
  148. NSString *a = [NSString stringWithFormat:@"%@",dic[@"payForFirst"]];
  149. NSString *a1 = [NSString stringWithFormat:@"%@",dic[@"payForLast"]];
  150. if ([a isEqualToString:@"1"]||[a1 isEqualToString:@"1"]) {
  151. _price.enabled = YES;
  152. }else{
  153. _price.enabled = NO;
  154. }
  155. _zongjia.text = [NSString stringWithFormat:@"总额:%@",model.orderAmount];
  156. }
  157. - (void)awakeFromNib {
  158. [super awakeFromNib];
  159. // Initialization code
  160. }
  161. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  162. [super setSelected:selected animated:animated];
  163. // Configure the view for the selected state
  164. }
  165. @end