| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 | 
							- //
 
- //  KWMineHomeOrderSubView.m
 
- //  westkissMob
 
- //
 
- //  Created by iOS on 2022/10/12.
 
- //
 
- #import "KWMineHomeOrderSubView.h"
 
- @interface KWMineHomeOrderSubView ()
 
- @property (nonatomic, strong) UILabel *titleLB;
 
- @property (nonatomic, strong) UILabel *priceLb;
 
- @property (nonatomic, strong) UILabel *xLB;
 
- @property (nonatomic, strong) UILabel *numLB;
 
- @property (nonatomic, strong) UIImageView *imgV;
 
- @property (nonatomic, strong) UILabel *giftTipV;
 
- @property (nonatomic, strong) UIButton *editBt;
 
- @property (nonatomic, strong) KWMineOrderProInfoModel *m;
 
- @end
 
- @implementation KWMineHomeOrderSubView
 
- - (void)setData:(KWMineOrderProInfoModel *)model canEdit:(BOOL)canEdit {
 
-     self.m = model;
 
-     self.titleLB.text = model.name;
 
-     self.priceLb.text = [NSString stringWithFormat:@"%@%.2f",  model.currency_symbol, [model.price floatValue]];
 
-     self.numLB.text = model.qty_ordered;
 
-     NSString *imageStr = [NSString stringWithFormat:@"https:%@%@%@",HostPath,ProductImgPath,model.image];
 
-     [self.imgV sd_setImageWithURL:[NSURL URLWithString:imageStr.urlEncode] placeholderImage:[UIImage imageNamed:@"product_defualtImg"]];
 
-     self.editBt.hidden = !canEdit;
 
-     [self showGift:model.is_gift.intValue == 1];
 
- }
 
- - (void)showGift:(BOOL)isGift {
 
-     self.giftTipV.hidden = !isGift;
 
-     self.numLB.hidden = isGift;
 
-     self.xLB.hidden = isGift;
 
-     self.priceLb.hidden = isGift;
 
-     if (isGift) {
 
-         self.editBt.hidden = true;
 
-     }
 
- }
 
- - (void)btAction:(UIButton *)bt {
 
-     if (self.m && self.toAddCommentBlock) {
 
-         self.toAddCommentBlock(self.m);
 
-     }
 
-     UIViewController *vc = [CTMediator.sharedInstance Goods_WriteReview:@{@"entity_id":self.m.product_id}];
 
-     [Current_normalTool.currentNav pushViewController:vc animated:true];
 
- }
 
- -(instancetype)init {
 
-     self = [super init];
 
-     if (self) {
 
-         [self loadSubV];
 
-     }
 
-     return self;
 
- }
 
- - (void)loadSubV {
 
-     self.backgroundColor = UIColor.clearColor;
 
-     [self addSubview:self.imgV];
 
-     [self addSubview:self.titleLB];
 
-     [self addSubview:self.priceLb];
 
-     [self addSubview:self.xLB];
 
-     [self addSubview:self.numLB];
 
-     [self addSubview:self.editBt];
 
-     [self addSubview:self.giftTipV];
 
-     
 
-     
 
-     [_imgV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.top.equalTo(self).offset(0);
 
-         make.left.equalTo(self).offset(0);
 
-         make.bottom.equalTo(self).offset(0);
 
-         make.width.height.equalTo(@86);
 
-     }];
 
-     
 
-     [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.top.equalTo(self.imgV);
 
-         make.left.equalTo(self.imgV.mas_right).offset(10);
 
-         make.right.equalTo(self).offset(0);
 
-         make.height.equalTo(@35);
 
-     }];
 
-     
 
-     [self.priceLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
 
-     [self.priceLb mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.bottom.equalTo(self.imgV);
 
-         make.left.equalTo(self.titleLB);
 
-         make.height.equalTo(@17);
 
-     }];
 
-     [self.xLB mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.width.equalTo(@17);
 
-         make.height.equalTo(@17);
 
-         make.left.equalTo(self.priceLb.mas_right);
 
-         make.centerY.equalTo(self.priceLb);
 
-     }];
 
-     [self.numLB mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.width.equalTo(@25);
 
-         make.height.equalTo(@17);
 
-         make.left.equalTo(self.xLB.mas_right);
 
-         make.centerY.equalTo(self.priceLb);
 
-     }];
 
-     [self.editBt mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.bottom.centerY.equalTo(self.priceLb);
 
-         make.width.height.equalTo(@24);
 
-         make.right.equalTo(self);
 
-     }];
 
-     [self.giftTipV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.leading.equalTo(self.titleLB);
 
-         make.bottom.equalTo(self.imgV);
 
-         make.width.equalTo(@86);
 
-         make.height.equalTo(@23);
 
-     }];
 
-     
 
- }
 
- - (UIImageView *)imgV {
 
-     if (!_imgV) {
 
-         UIImageView *imgV = [[UIImageView alloc] init];
 
-         _imgV = imgV;
 
-     }
 
-     return _imgV;
 
- }
 
- - (UILabel *)titleLB {
 
-     if (!_titleLB) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.font = [UIFont fontWithName:Rob_Regular size:12];
 
-         lb.textColor = [UIColor blackColor];
 
-         lb.backgroundColor = [UIColor clearColor];
 
-         lb.numberOfLines = 2;
 
-         _titleLB = lb;
 
-     }
 
-     return _titleLB;
 
- }
 
- - (UILabel *)priceLb {
 
-     if (!_priceLb) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.font = [UIFont fontWithName:Rob_Bold size:14];
 
-         lb.textColor = _0B0B0B;
 
-         lb.backgroundColor = [UIColor clearColor];
 
-         _priceLb = lb;
 
-     }
 
-     return _priceLb;
 
- }
 
- - (UILabel *)xLB {
 
-     if (!_xLB) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.font = [UIFont fontWithName:Rob_Regular size:14];
 
-         lb.textColor = _0B0B0B;
 
-         lb.backgroundColor = [UIColor clearColor];
 
-         lb.textAlignment = NSTextAlignmentCenter;
 
-         lb.text = @"x";
 
-         _xLB = lb;
 
-     }
 
-     return _xLB;
 
- }
 
- - (UILabel *)numLB {
 
-     if (!_numLB) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.font = [UIFont fontWithName:Rob_Regular size:14];
 
-         lb.textColor = _0B0B0B;
 
-         lb.backgroundColor = [UIColor clearColor];
 
-         _numLB = lb;
 
-     }
 
-     return _numLB;
 
- }
 
- - (UIButton *)editBt {
 
-     if (!_editBt) {
 
-         UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
 
-         [bt setImage:[UIImage imageNamed:@"mine_add_comment"] forState:UIControlStateNormal];
 
-         [bt addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside];
 
-         _editBt = bt;
 
-     }
 
-     return _editBt;
 
- }
 
- - (UILabel *)giftTipV {
 
-     if (!_giftTipV) {
 
-         UILabel *lb = [UILabel baseLb];
 
-         lb.font = [UIFont fontWithName:Rob_Regular size:12];
 
-         lb.textAlignment = NSTextAlignmentCenter;
 
-         lb.textColor = Col_000;
 
-         lb.text = @"Gift";
 
-         lb.backgroundColor = _F0FFF9;
 
-         lb.layer.cornerRadius = 3;
 
-         lb.layer.masksToBounds = true;
 
-         lb.hidden = true;
 
-         _giftTipV = lb;
 
-     }
 
-     return _giftTipV;
 
- }
 
- @end
 
 
  |