123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- //
- // DRCommissionHeaderView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/5/18.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRCommissionHeaderView.h"
- @interface DRCommissionHeaderView ()
- @property (nonatomic, strong) UILabel *blancePrice;
- @property (nonatomic, strong) UILabel *totalPrice;
- @property (nonatomic, strong) UILabel *didPrice;
- @property (nonatomic, strong) UIButton *didBtn;
- @end
- @implementation DRCommissionHeaderView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor changeColor];
- [self initSubViews];
- [self request];
- }
- return self;
- }
- -(void)request{
- NSString *url=[NSString stringWithFormat:@"%@/api/v2/adzoneCreate/commisonPrice",BaseURL];
- [DRHttp post:url params:nil success:^(id json) {
- if (json[@"data"]) {
- NSString *blanceStr=json[@"data"][@"all"];
- NSString *totalStr=json[@"data"][@"notEnd"];
- NSString *didStr=json[@"data"][@"end"];
- self.blancePrice.text =[NSString stringWithFormat:@"%.2f",[blanceStr floatValue]];
- self.totalPrice.text =[NSString stringWithFormat:@"总收入(元):%.2f",[totalStr floatValue]];
- self.didPrice.text =[NSString stringWithFormat:@"已提现(元):%.2f",[didStr floatValue]];
- }
- } failure:^(NSError *error) {
-
- }];
-
- }
- - (void)initSubViews {
- UILabel *blanceTitle = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, 100, 20)];
- blanceTitle.textColor = [UIColor whiteColor];
- blanceTitle.font = [UIFont systemFontOfSize:14];
- blanceTitle.text = @"佣金总计(元)";
- [self addSubview:blanceTitle];
-
- self.blancePrice = [[UILabel alloc] initWithFrame:CGRectMake(15, blanceTitle.bottom+5, SCREEN_WIDTH-100, 40)];
- self.blancePrice.textColor = [UIColor whiteColor];
- self.blancePrice.font = [UIFont boldSystemFontOfSize:32];
- self.blancePrice.text = @"--.--";
- [self addSubview:self.blancePrice];
-
- self.totalPrice = [[UILabel alloc] initWithFrame:CGRectMake(15, self.blancePrice.bottom+10, SCREEN_WIDTH/2-20, 20)];
- self.totalPrice.text = @"待结算(元):--";
- self.totalPrice.textColor = [UIColor whiteColor];
- self.totalPrice.font = [UIFont systemFontOfSize:14];
- [self addSubview:self.totalPrice];
-
- self.didPrice = [[UILabel alloc] initWithFrame:CGRectMake(self.totalPrice.right+10, self.totalPrice.top, SCREEN_WIDTH/2-20, 20)];
- self.didPrice.textAlignment = NSTextAlignmentRight;
- self.didPrice.font = [UIFont systemFontOfSize:14];
- self.didPrice.textColor = [UIColor whiteColor];
- self.didPrice.text = @"已结算(元):--";
- [self addSubview:self.didPrice];
-
- self.didBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-10-80, self.didPrice.top-23-20, 80, 20)];
- [self.didBtn setTitle:@"查看红包" forState:UIControlStateNormal];
- [self.didBtn setImage:[UIImage imageNamed:@"goto_white"] forState:UIControlStateNormal];
- self.didBtn.titleLabel.font = [UIFont systemFontOfSize:12];
- [self.didBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [self.didBtn setButtonImageTitleStyle:ButtonImageTitleStyleRight padding:0];
- [self addSubview:self.didBtn];
- }
- @end
|