123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- //
- // DROrderHeaderView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/5/18.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DROrderHeaderView.h"
- @interface DROrderHeaderView ()
- @property (nonatomic, strong) UILabel *blancePrice;
- @property (nonatomic, strong) UILabel *totalPrice;
- @property (nonatomic, strong) UILabel *didPrice;
- @property (nonatomic, strong) UIButton *didBtn;
- @property (nonatomic, copy ) NSString *money;
- @end
- @implementation DROrderHeaderView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor changeColor];
- self.money=@"0";
- [self initSubViews];
- [self request];
- }
- return self;
- }
- -(void)request{
- NSString *url=[NSString stringWithFormat:@"%@/api/v2/adzoneCreate/accountPrice",BaseURL];
- [DRHttp post:url params:nil success:^(id json) {
- if (json[@"data"]) {
- self.money=[NSString stringWithFormat:@"%@",json[@"data"][@"notEnd"]];
- self.blancePrice.text =[NSString stringWithFormat:@"¥%@",json[@"data"][@"notEnd"]];
- self.totalPrice.text =[NSString stringWithFormat:@"总收入:¥%@",json[@"data"][@"all"]];
- self.didPrice.text =[NSString stringWithFormat:@"已提现:¥%@",json[@"data"][@"end"]];
- }
- } failure:^(NSError *error) {
-
- }];
-
- }
- -(void)didAction{
- if (self.delegate && [self.delegate respondsToSelector:@selector(changeToWithdrawVCwithMoneyStr:)]) {
- [self.delegate changeToWithdrawVCwithMoneyStr:self.money];
- }
-
- }
- - (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-44, self.didPrice.top-23-20, 44, 20)];
- [self.didBtn setTitle:@"提现" forState:UIControlStateNormal];
- self.didBtn.titleLabel.font = [UIFont systemFontOfSize:12];
- [self.didBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- self.didBtn.layer.cornerRadius = 10;
- self.didBtn.layer.borderWidth = 1;
- self.didBtn.layer.borderColor = [UIColor whiteColor].CGColor;
- [self.didBtn addTarget:self action:@selector(didAction) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:self.didBtn];
- }
- @end
|