GuideIntegralViewController.m 2.21 KB
Newer Older
曹云霄's avatar
曹云霄 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
//
//  GuideIntegralViewController.m
//  Lighting
//
//  Created by 曹云霄 on 2016/11/16.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "GuideIntegralViewController.h"
#import "IntegralDetailsViewController.h"
#import "PrizeMainViewController.h"

@interface GuideIntegralViewController ()

@end

@implementation GuideIntegralViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addChildViewController];
}

#pragma mark - 积分赋值
- (void)integralAssignment:(RsScoreDetails *)scoreModel
{
    if (scoreModel.currentScore == 0) {
        scoreModel.quarterlyRanking = 0;
        scoreModel.annualRanking = 0;
    }
    self.currentIntegralLabel.text = [NSString stringWithFormat:@"%.0lf",scoreModel.currentScore];
    self.quarterIntegralLabel.text = [NSString stringWithFormat:@"%ld",scoreModel.quarterlyRanking];
    self.yearIntegralLabel.text = [NSString stringWithFormat:@"%ld",scoreModel.annualRanking];
}

#pragma mark - 添加积分明细、导购头像
- (void)addChildViewController
{
    IntegralDetailsViewController *integralDetails = [[[self class] getGuideIntegralStoryboardClass] instantiateViewControllerWithIdentifier:@"IntegralDetailsViewController"];
    integralDetails.cellType = IntrgralTableView;
    [self addChildViewController:integralDetails];
    integralDetails.view.frame = CGRectMake(0, 50, self.integralDetailsView.mj_w, self.integralDetailsView.mj_h-50);
    [self.integralDetailsView addSubview:integralDetails.view];
    NSString *headerurl = [Shoppersmanager manager].shoppers.employee.picture;
    [self.guideHeaderView sd_setImageWithURL:[NSURL URLWithString:headerurl] placeholderImage:GuideReplaceImage];
    WS(weakSelf);
    [integralDetails setReturnIntegralDetailsBlock:^(RsScoreDetails *model) {
        [weakSelf integralAssignment:model];
    }];
}

#pragma mark - 礼品兑换
- (IBAction)exchangeButtonClick:(UIButton *)sender {
    
    PrizeMainViewController *prizeMainVC = [[[self class] getGuideIntegralStoryboardClass] instantiateViewControllerWithIdentifier:@"PrizeMainViewController"];
57
    [self pushViewController:prizeMainVC animated:YES];
曹云霄's avatar
曹云霄 committed
58 59 60 61 62 63 64 65 66
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


@end