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

#import "OrderViewController.h"
#import "JavenMultipleViewWithHeader.h"
#import "NoPaymentTableViewController.h"
#import "MJRefresh.h"
@interface OrderViewController ()
@property (nonatomic, strong) JavenMultipleViewWithHeader *viewMutiple;
@end

@implementation OrderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"订单管理";
    [self setUpView];
    
    // Do any additional setup after loading the view.
}



- (void)setUpView {
    
    NSArray *arrTitle = @[@"全部订单",@"待支付",@"已支付",@"待发货",@"配送中"];
    
    NSMutableArray *arrVC = [NSMutableArray array];
    
    
    for (int i = 0; i < arrTitle.count; i++) {
        NSLog(@"-----%ld", (long)i);
        NoPaymentTableViewController *noPayMentVC = [[NoPaymentTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
        noPayMentVC.orderTag = arrTitle[i];
        [arrVC addObject:noPayMentVC];
        if (i == 0) [noPayMentVC.tableView.mj_header beginRefreshing];
    }

    _viewMutiple = [[JavenMultipleViewWithHeader alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight)
                                                                views:arrVC
                                                               titles:arrTitle
                                                               target:self
                                                      selectTextColor:kCustomGreenColor
                                                selectBackgroundColor:kBacroundColor
                                                            textColor:kTextColorBlack
                                                      backgroundColor:kBacroundColor
                                                          titleHeight:40
                                                        titleBtnWidth:kWidth / arrTitle.count];
    
    _viewMutiple.getCurrentBlock = ^(NoPaymentTableViewController *vc){
        [vc.tableView.mj_header beginRefreshing];
    };
    [self.view addSubview:_viewMutiple];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"orderManagement"];//("PageOne"为页面名称，可自定义)
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"orderManagement"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
