123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- //
- // KBMineOrderView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/5/17.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "KBMineOrderView.h"
- @interface KBMineOrderView ()
- @property (nonatomic, strong) UILabel *waitCount;
- @property (nonatomic, strong) UILabel *didCount;
- @end
- @implementation KBMineOrderView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
- self.layer.cornerRadius = 6;
- self.layer.masksToBounds = YES;
- [self initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
- // UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, 60, 20)];
- // title.text = @"订单明细";
- // title.font = [UIFont systemFontOfSize:14];
- // [self addSubview:title];
- //
- // UIButton *moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-70-10, 10, 70, 20)];
- // moreBtn.centerY = title.centerY;
- // [moreBtn setTitleColor:[UIColor YHColorWithHex:0x999999] forState:UIControlStateNormal];
- // [moreBtn setTitle:@"查看更多" forState:UIControlStateNormal];
- // [moreBtn setImage:[UIImage imageNamed:@"accIcon_mine"] forState:UIControlStateNormal];
- // moreBtn.titleLabel.font = [UIFont systemFontOfSize:12];
- // [moreBtn setButtonImageTitleStyle:ButtonImageTitleStyleRight padding:-5];
- // [moreBtn addTarget:self action:@selector(moreBtnClick) forControlEvents:UIControlEventTouchUpInside];
- // [self addSubview:moreBtn];
- //
- // UIView *line = [[UIView alloc] initWithFrame:CGRectMake(15, title.bottom+10, self.width-30, 1)];
- // line.backgroundColor = [UIColor YHColorWithHex:0xE5E5E5];
- // [self addSubview:line];
-
-
- NSArray *imgBg = @[@"commission_one",@"commission_two",@"commission_three",@"commission_four"];
- NSArray *bg_titles = @[@"本月预估收入",@"上月预估收入",@"本月结算收入",@"上月结算收入"];
-
- CGFloat width = (self.width-45)/2;
- CGFloat height = 88;
-
- for (int i = 0; i < imgBg.count; i++) {
- UIImageView *leftImgView = [[UIImageView alloc] initWithFrame:CGRectMake(15+(15+width)*(i%2), (height+10)*(i/2), width, height)];
- // leftImgView.image = [UIImage imageNamed:imgBg[i]];
- leftImgView.contentMode = UIViewContentModeScaleAspectFill;
- leftImgView.userInteractionEnabled = YES;
- [self addSubview:leftImgView];
- leftImgView.tag = 500+i;
- UITapGestureRecognizer *tapImg = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageAcion:)];
- [leftImgView addGestureRecognizer:tapImg];
-
- UILabel *waitTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, leftImgView.width, 15)];
- waitTitle.textColor = [UIColor YHColorWithHex:0x9B9B9B];
- waitTitle.font = [UIFont systemFontOfSize:13];
- waitTitle.textAlignment = NSTextAlignmentCenter;
- waitTitle.centerX = leftImgView.width/2;
- waitTitle.text = bg_titles[i];
- [leftImgView addSubview:waitTitle];
-
- UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, waitTitle.bottom+15, leftImgView.width, 22)];
- countLabel.textColor = [UIColor homeRedColor];
- countLabel.font = [UIFont systemFontOfSize:20];
- countLabel.textAlignment = NSTextAlignmentCenter;
- countLabel.centerX = leftImgView.width/2;
- countLabel.text = @"--";
- countLabel.tag = 10000+i;
- [leftImgView addSubview:countLabel];
-
- // if (i > 1) {
- // UILabel *stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, countLabel.bottom+2, leftImgView.width, 15)];
- // stateLabel.textAlignment = NSTextAlignmentCenter;
- // stateLabel.textColor = [UIColor whiteColor];
- // stateLabel.font = [UIFont systemFontOfSize:12];
- // stateLabel.tag = 2000+i;
- // [leftImgView addSubview:stateLabel];
- // }
-
- if (i == 0) {
- UIView *line = [[UIView alloc] initWithFrame:CGRectMake(self.width/2, 15, 0.5, 63)];
- line.backgroundColor = [UIColor YHColorWithHex:0xD1D0D0];
- [self addSubview:line];
- }
- if (i == 2) {
- UIView *line = [[UIView alloc] initWithFrame:CGRectMake(self.width/2, 108, 0.5, 63)];
- line.backgroundColor = [UIColor YHColorWithHex:0xD1D0D0];
- [self addSubview:line];
- }
-
- }
-
-
- UIView *line = [[UIView alloc] initWithFrame:CGRectMake(15, self.height/2, self.width-30, 0.5)];
- line.backgroundColor = [UIColor YHColorWithHex:0xD1D0D0];
- [self addSubview:line];
-
-
-
- }
- #pragma mark ---- public -----
- - (void)setAccountInfoWithUserInfo:(KBUserInfo *)userInfo {
- NSArray *countNum = @[userInfo.this_month_forecast_income,
- userInfo.last_month_forecast_income,
- userInfo.this_month_settlement_income,
- userInfo.last_month_settlement_income
- ];
- for (int i = 0; i < countNum.count; i++) {
- UILabel *countLabel = [self viewWithTag:10000+i];
- NSString *countStr = [NSString stringWithFormat:@"¥%@",[countNum objectAtIndex:i]];
- countLabel.text = countStr;
- }
-
- UILabel *leftBottomState = [self viewWithTag:2000+2];
- leftBottomState.text = [userInfo.this_month_settlement_income_is_account boolValue] ? @"已到账" : @"未到账";
-
- UILabel *rightBottomState = [self viewWithTag:2000+3];
- rightBottomState.text = [userInfo.last_month_settlement_income_is_account boolValue] ? @"已到账" : @"未到账";
-
- }
- - (void)setUnloginInfo {
- for (int i = 0; i < 4; i++) {
- UILabel *countLabel = [self viewWithTag:10000+i];
- NSString *countStr = [NSString stringWithFormat:@"--"];
- countLabel.text = countStr;
- }
-
- UILabel *leftBottomState = [self viewWithTag:2000+2];
- leftBottomState.text = @"未到账";
-
- UILabel *rightBottomState = [self viewWithTag:2000+3];
- rightBottomState.text = @"未到账";
- }
- - (void)moreBtnClick {
- if (self.moreButtonClick) {
- self.moreButtonClick();
- }
- }
- - (void)tapImageAcion:(UITapGestureRecognizer *)tap {
- NSInteger index = tap.view.tag - 500;
- BOOL isThisMonth=NO;
- NSInteger type=0;
- switch (index) {
- case 0:
- isThisMonth = YES;
- break;
- case 2:
- type=1;
- isThisMonth = YES;
- break;
- case 1:
- isThisMonth = NO;
- break;
- case 3:
- type=1;
- isThisMonth = NO;
- break;
- default:
- break;
- }
-
- if (self.commissionClick) {
- self.commissionClick(isThisMonth,type);
- }
- }
- @end
|