//
//  OrderListModel.m
//  Car
//
//  Created by Javen on 2016/12/26.
//  Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//

#import "OrderListModel.h"

@implementation OrderListModel


- (instancetype)initWithDictionary:(NSDictionary *)dict error:(NSError *__autoreleasing *)err {
    self = [super initWithDictionary:dict error:err];
    if (self) {
        if ([self.checkState isEqualToString:@"checked"]) {
            self.isSelected = YES;
        }else{
            self.isSelected = NO;
        }
    }
    return self;
}

- (NSString *)paymentString {
  if (!_paymentString) {
    if ([self.payMethod isEqualToString:@"weixin_pub"]) {
      _paymentString = @"微信支付";
    }else if([self.payMethod isEqualToString:@"alipay"]){
      _paymentString = @"支付宝支付";
    }else{
      _paymentString = @"未知支付方式";
    };
  }
  return _paymentString;
}

- (NSString *)stateString {
  if (!_stateString) {
    if ([self.state isEqualToString:@"nonpay"]) {
      _stateString = @"未支付";
    }else if ([self.state isEqualToString:@"paid"]){
      _stateString = @"已支付";
    }else{
      _stateString = @"异常状态";
    }
  }
  return _stateString;
}

- (NSString *)invoiceString {
  if (!_invoiceString) {
    if ([self.invoice isEqualToString:@"Y"]) {
      _invoiceString = @"已开发票";
    }else if ([self.invoice isEqualToString:@"N"]){
      _invoiceString = @"未开发票";
    }else{
      _invoiceString = @"异常状态";
    }
  }
  return _invoiceString;
}

- (NSString *)printStateString {
  if (!_printStateString) {
    if ([self.printState isEqualToString:@"noprint"]) {
      _printStateString = @"未打印";
    }else if ([self.printState isEqualToString:@"wait"]){
      _printStateString = @"等待中";
    }else if ([self.printState isEqualToString:@"printed"]){
      _printStateString = @"打印完成";
    }else{
      _printStateString = @"异常状态";
    }
  }
  return _printStateString;
}

@end
