//
//  OrderInformationTableViewCell.m
//  Lighting
//
//  Created by 曹云霄 on 16/5/4.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "OrderInformationTableViewCell.h"

@implementation OrderInformationTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


#pragma mark -订单赋值
- (void)setModel:(OrderBill *)model
{
    _model = model;
    self.orderNumber.text = _model.order.orderNumber;
    self.orderTime.text = [self dateAsString:_model.order.orderTime];
    self.orderStatus.text = [BaseViewController ReturnOrderStateTitleWithStateCode:[_model.order.orderState integerValue] withPoint:CGPointMake(self.orderStatus.frame.origin.x, self.orderStatus.frame.origin.y) WithCode:0];
    self.orderStatus.textColor = [BaseViewController ReturnOrderStateTitleWithStateCode:[_model.order.orderState integerValue] withPoint:CGPointMake(self.orderStatus.frame.origin.x, self.orderStatus.frame.origin.y) WithCode:1];
    self.operatorName.text = _model.employee.realName;
}



#pragma mark -时间转换NSDate转NSString
- (NSString*)dateAsString:(NSDate*)date {
    
    NSDateFormatter *formatter=[[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString * timeString = [formatter stringFromDate:date];
    return timeString;
    
}




- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
