//
//  OrderDetailTopView.m
//  ALand
//
//  Created by Z on 16/3/30.
//  Copyright © 2016年 Z. All rights reserved.
//

#import "OrderDetailTopView.h"

@interface OrderDetailTopView ()
@property (weak, nonatomic) IBOutlet UIView *viewExpress;
@property (weak, nonatomic) IBOutlet UIImageView *imgIcon;
@property (weak, nonatomic) IBOutlet UILabel *labelState;

@end
@implementation OrderDetailTopView
- (void)awakeFromNib {
    
       
}

- (void)updateByOrderType {
    
    if ([self.orderType isEqualToString: @"配送中"] || [self.orderType isEqualToString:@""]) {
    }else{
        [self.viewExpress removeFromSuperview];

    }
    
}
- (void)updateHeight {
    
    self.height = self.bottomView.bottom;
}

- (void)viewWithModel:(JavenOrderModel *)model {
    self.labelState.text = [model.state getOrderStateString];
    self.imgIcon.image = [UIImage imageNamed:[model.state getOrderStateImage]];
    self.labelName.text = model.address.name;
    JavenAddress *address = model.address;
    self.labelAddress.text = [NSString stringWithFormat:@"%@%@%@%@%@", address.nation ? address.nation : @"", address.province, address.city, address.country, address.address];
    self.labelPhoneNumber.text = model.consumer.mobilephone;
    self.labelExpressTime.text = model.lastModifyInfo.time;
    WS(weakSelf)
    [[HTTPCilent shareCilent] GET:[NSString stringWithFormat:@"order/getLogistics/%@", model.uuid] parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        if (kIsResponseSuccess(responseObject)) {
            weakSelf.labelExpress.text = responseObject[@"logistics"];
        }
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
    }];
}

- (void)getLogistics {
}


- (IBAction)actionCall:(id)sender {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", self.labelPhoneNumber.text]]];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
