Commit 9d7a765b0336566c1305120fd747780c8ef11022
1 parent
ffd5b0f2
no message
Showing
8 changed files
with
624 additions
and
0 deletions
CNLiveBalanceModule/Classes/Model/CNLiveTradingRecordDetailModel.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTradingRecordDetailModel.h | ||
| 3 | +// CNLiveBalanceModule | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | ||
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | + | ||
| 13 | +@interface CNLiveTradingRecordDetailModel : NSObject | ||
| 14 | +@property (nonatomic, copy) NSString *bankName; | ||
| 15 | +@property (nonatomic, copy) NSString *desc; | ||
| 16 | +@property (nonatomic, copy) NSString *endTime; | ||
| 17 | +@property (nonatomic, copy) NSString *payType; | ||
| 18 | +@property (nonatomic, copy) NSString *recordId; | ||
| 19 | + | ||
| 20 | +@property (nonatomic, copy) NSString *remark; | ||
| 21 | +@property (nonatomic, copy) NSString *sourceId; | ||
| 22 | +@property (nonatomic, copy) NSString *sourceType; | ||
| 23 | +@property (nonatomic, copy) NSString *startTime; | ||
| 24 | +@property (nonatomic, copy) NSString *type; | ||
| 25 | + | ||
| 26 | +// 支付方式 | ||
| 27 | +@property (nonatomic, copy) NSString *payMethod; | ||
| 28 | +// 订单状态 | ||
| 29 | +@property (nonatomic, copy) NSString *state; | ||
| 30 | + | ||
| 31 | + | ||
| 32 | +// 订单详情 | ||
| 33 | +@property (nonatomic, copy) NSString *title; | ||
| 34 | +@property (nonatomic, copy) NSString *content; | ||
| 35 | +@property (nonatomic, assign) CGFloat height; | ||
| 36 | +@property (nonatomic, assign) CGFloat lineHeight; | ||
| 37 | + | ||
| 38 | +/* | ||
| 39 | + bankName = ""; | ||
| 40 | + desc = "\U60a8\U5728 \U98df\U8272\U5929\U9999 \U8d2d\U4e70\U4e86 \U5546\U54c1"; | ||
| 41 | + endTime = "2019-12-10 18:02:00"; | ||
| 42 | + payType = wjj; | ||
| 43 | + recordId = "transaction:9a3f8c53c2ed4a329eb862de1ea94d58"; | ||
| 44 | + | ||
| 45 | + remark = ""; | ||
| 46 | + sourceId = 8650bd6232fb405b829af0a144207a95; | ||
| 47 | + sourceType = order; | ||
| 48 | + startTime = ""; | ||
| 49 | + type = 2; | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + */ | ||
| 53 | + | ||
| 54 | +@end | ||
| 55 | + | ||
| 56 | +NS_ASSUME_NONNULL_END |
CNLiveBalanceModule/Classes/Model/CNLiveTradingRecordDetailModel.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTradingRecordDetailModel.m | ||
| 3 | +// CNLiveBalanceModule | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | ||
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveTradingRecordDetailModel.h" | ||
| 10 | + | ||
| 11 | +@implementation CNLiveTradingRecordDetailModel | ||
| 12 | + | ||
| 13 | +- (NSString *)payMethod{ | ||
| 14 | + NSString *payType = @"未知"; | ||
| 15 | + if ([self.payType isEqualToString:@"ali"]) { | ||
| 16 | + payType = @"支付宝"; | ||
| 17 | + } else if ([self.payType isEqualToString:@"wechat"]) { | ||
| 18 | + payType = @"微信"; | ||
| 19 | + } else if ([self.payType isEqualToString:@"wjj"]) { | ||
| 20 | + payType = @"零钱"; | ||
| 21 | + }else if ([self.payType isEqualToString:@"union"]) { | ||
| 22 | + payType = @"银行卡"; | ||
| 23 | + } | ||
| 24 | + return payType; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +- (NSString *)state{ | ||
| 28 | + NSString *state = @"未知"; | ||
| 29 | + if ([self.type isEqualToString:@"1"]) { | ||
| 30 | + state = @"未完成"; | ||
| 31 | + | ||
| 32 | + } else if ([self.type isEqualToString:@"2"] || [self.type isEqualToString:@"3"]) { | ||
| 33 | + state = @"已完成"; | ||
| 34 | + | ||
| 35 | + } else if ([self.type isEqualToString:@"4"]) { | ||
| 36 | + state = @"失败"; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + return state; | ||
| 40 | +} | ||
| 41 | +@end | ||
| 42 | + | ||
| 43 | + |
CNLiveBalanceModule/Classes/Personal/CNLiveTradingRecordDetailController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTradingRecordDetailController.h | ||
| 3 | +// CNLiveBalanceModule | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | ||
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 交易记录详情 | ||
| 11 | + */ | ||
| 12 | + | ||
| 13 | +#import "CNCommonViewController.h" | ||
| 14 | +@class CNLiveTradingRecordListModel; | ||
| 15 | + | ||
| 16 | +@interface CNLiveTradingRecordDetailController : CNCommonViewController | ||
| 17 | +@property (nonatomic, strong) CNLiveTradingRecordListModel *model; | ||
| 18 | + | ||
| 19 | +@end |
CNLiveBalanceModule/Classes/Personal/CNLiveTradingRecordDetailController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTradingRecordDetailController.m | ||
| 3 | +// CNLiveBalanceModule | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | ||
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveTradingRecordDetailController.h" | ||
| 10 | +#import "MJExtension.h" | ||
| 11 | +#import <SDWebImage/SDWebImage.h> | ||
| 12 | +#import "QMUIKit.h" | ||
| 13 | +#import "CNLiveNetworking.h" | ||
| 14 | +#import "CNLiveEnvironment.h" | ||
| 15 | + | ||
| 16 | +#import "CNUserInfoManager.h" | ||
| 17 | +#import "CNLiveBaseKit.h" | ||
| 18 | +#import "CNLiveCategory.h" | ||
| 19 | + | ||
| 20 | +#import "CNLiveServices.h" | ||
| 21 | +#import "CNLiveBalanceRequest.h" | ||
| 22 | + | ||
| 23 | +#import "CNLiveBalanceNavigationBar.h" | ||
| 24 | +#import "CNLiveTradingRecordView.h" | ||
| 25 | +#import "CNLiveTradingRecordModel.h" | ||
| 26 | +#import "CNLiveTradingRecordDetailModel.h" | ||
| 27 | +#import "CNLiveTradingRecordDetailCell.h" | ||
| 28 | +#import "CNLiveTradingRecordDetailHeaderView.h" | ||
| 29 | + | ||
| 30 | +@interface CNLiveTradingRecordDetailController ()<UITableViewDelegate, UITableViewDataSource,CNLiveBalanceNavigationBarDelegate> | ||
| 31 | +@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar; | ||
| 32 | +@property (nonatomic, strong) UITableView *tableView; | ||
| 33 | +@property (nonatomic, strong) CNLiveTradingRecordDetailHeaderView *headerView; | ||
| 34 | +@property (nonatomic, strong) NSMutableArray *data; | ||
| 35 | + | ||
| 36 | +@end | ||
| 37 | + | ||
| 38 | +@implementation CNLiveTradingRecordDetailController | ||
| 39 | +static const CGFloat height = 80; | ||
| 40 | + | ||
| 41 | +#pragma mark - 加载数据 | ||
| 42 | +- (void)loadData { | ||
| 43 | + [CNLiveBalanceRequest getTradingRecordDetailWithModel:self.model block:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError *error) { | ||
| 44 | + if (error) { | ||
| 45 | + [self showEmptyViewWithImage:[UIImage imageNamed:@"wufalianjie"] text:error.localizedDescription detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(loadData)]; | ||
| 46 | + [self setCNAPIErrorEmptyView]; | ||
| 47 | + self.emptyView.verticalOffset = -(NavigationContentTop+height); | ||
| 48 | + return; | ||
| 49 | + } | ||
| 50 | + if (isSuccess) { | ||
| 51 | + CNLiveTradingRecordDetailModel *model = [CNLiveTradingRecordDetailModel mj_objectWithKeyValues:data]; | ||
| 52 | + self.data = [CNLiveBalanceRequest handleDataWithModel:model name:self.model.iconBean.nickName]; | ||
| 53 | + [self.tableView reloadData]; | ||
| 54 | + } | ||
| 55 | + }]; | ||
| 56 | + | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +#pragma mark - 生命周期 | ||
| 60 | +- (void)viewWillAppear:(BOOL)animated{ | ||
| 61 | + [super viewWillAppear:animated]; | ||
| 62 | + self.navigationController.navigationBarHidden = YES; | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +- (void)viewDidLoad { | ||
| 66 | + [super viewDidLoad]; | ||
| 67 | + self.view.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0]; | ||
| 68 | + | ||
| 69 | + if (@available(iOS 11, *)) { | ||
| 70 | + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; | ||
| 71 | + } | ||
| 72 | + else { | ||
| 73 | + self.automaticallyAdjustsScrollViewInsets = NO; | ||
| 74 | + } | ||
| 75 | + [self createSubViews]; | ||
| 76 | + [self loadData]; | ||
| 77 | + | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | +- (void)createSubViews { | ||
| 81 | + [self.view addSubview:self.navigationBar]; | ||
| 82 | + self.headerView.model = self.model; | ||
| 83 | + self.tableView.tableHeaderView = self.headerView; | ||
| 84 | + [self.view addSubview:self.tableView]; | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +#pragma mark - UITableViewDelegate | ||
| 88 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
| 89 | + CNLiveTradingRecordDetailModel *model = self.data[indexPath.row]; | ||
| 90 | + return model.height; | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +#pragma mark - UITableViewDataSource | ||
| 94 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
| 95 | + return self.data.count; | ||
| 96 | + | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 100 | + CNLiveTradingRecordDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveTradingRecordDetailCell]; | ||
| 101 | + cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 102 | + cell.model = self.data[indexPath.row]; | ||
| 103 | + return cell; | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
| 107 | + | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +#pragma mark - 懒加载 | ||
| 111 | +- (NSMutableArray *)data { | ||
| 112 | + if (!_data) { | ||
| 113 | + _data = [[NSMutableArray alloc] init]; | ||
| 114 | + } | ||
| 115 | + return _data; | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | +- (CNLiveBalanceNavigationBar *)navigationBar { | ||
| 119 | + if (!_navigationBar) { | ||
| 120 | + _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | ||
| 121 | + _navigationBar.backgroundColor = [UIColor whiteColor]; | ||
| 122 | + _navigationBar.delegate = self; | ||
| 123 | + _navigationBar.title.text = @"交易记录"; | ||
| 124 | + _navigationBar.title.textColor = [UIColor blackColor]; | ||
| 125 | + UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]]; | ||
| 126 | + [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; | ||
| 127 | + _navigationBar.right = nil; | ||
| 128 | + | ||
| 129 | + } | ||
| 130 | + return _navigationBar; | ||
| 131 | +} | ||
| 132 | +- (UITableView *)tableView{ | ||
| 133 | + if(!_tableView){ | ||
| 134 | + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop) style:UITableViewStylePlain]; | ||
| 135 | + _tableView.delegate = self; | ||
| 136 | + _tableView.dataSource = self; | ||
| 137 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | ||
| 138 | + _tableView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0]; | ||
| 139 | + _tableView.estimatedRowHeight = 0; | ||
| 140 | + _tableView.estimatedSectionHeaderHeight = 0; | ||
| 141 | + _tableView.estimatedSectionFooterHeight = 0; | ||
| 142 | + [_tableView registerClass:[CNLiveTradingRecordDetailCell class] forCellReuseIdentifier:kCNLiveTradingRecordDetailCell]; | ||
| 143 | + } | ||
| 144 | + return _tableView; | ||
| 145 | +} | ||
| 146 | +- (CNLiveTradingRecordDetailHeaderView *)headerView { | ||
| 147 | + if (!_headerView) { | ||
| 148 | + _headerView = [[CNLiveTradingRecordDetailHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 150)]; | ||
| 149 | + } | ||
| 150 | + return _headerView; | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +#pragma mark - 响应方法 | ||
| 154 | +- (void)goBack { | ||
| 155 | + if (self.presentingViewController != nil) { | ||
| 156 | + [self dismissViewControllerAnimated:YES completion:nil]; | ||
| 157 | + } | ||
| 158 | + else { | ||
| 159 | + [self.navigationController popViewControllerAnimated:YES]; | ||
| 160 | + } | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +#pragma mark - CNLiveBalanceNavigationBarDelegate | ||
| 164 | +- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | ||
| 165 | + if ([actionEvents isEqualToString:@"1"]) { | ||
| 166 | + [self goBack]; | ||
| 167 | + }else if ([actionEvents isEqualToString:@"2"]){ | ||
| 168 | + | ||
| 169 | + } | ||
| 170 | +} | ||
| 171 | + | ||
| 172 | +@end |
CNLiveBalanceModule/Classes/View/CNLiveTradingRecordDetailCell.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTradingRecordDetailCell.h | ||
| 3 | +// CNLiveBalanceModule | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | ||
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | +@class CNLiveTradingRecordDetailModel; | ||
| 13 | +static NSString * const kCNLiveTradingRecordDetailCell = @"CNLiveTradingRecordDetailCell"; | ||
| 14 | + | ||
| 15 | +@interface CNLiveTradingRecordDetailCell : UITableViewCell | ||
| 16 | + | ||
| 17 | +@property (nonatomic, strong) CNLiveTradingRecordDetailModel *model; | ||
| 18 | + | ||
| 19 | +@end | ||
| 20 | + | ||
| 21 | +NS_ASSUME_NONNULL_END |
CNLiveBalanceModule/Classes/View/CNLiveTradingRecordDetailCell.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTradingRecordDetailCell.m | ||
| 3 | +// CNLiveBalanceModule | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/9/6. | ||
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveTradingRecordDetailCell.h" | ||
| 10 | +#import <Masonry/Masonry.h> | ||
| 11 | +#import <SDWebImage/SDWebImage.h> | ||
| 12 | + | ||
| 13 | +#import "CNLiveCategory.h" | ||
| 14 | +#import "CNLiveBaseKit.h" | ||
| 15 | + | ||
| 16 | +#import "CNLiveTradingRecordDetailModel.h" | ||
| 17 | + | ||
| 18 | +@interface CNLiveTradingRecordDetailCell() | ||
| 19 | +@property (nonatomic, strong) UILabel *title; | ||
| 20 | +@property (nonatomic, strong) UILabel *content; | ||
| 21 | +@property (nonatomic, strong) UIImageView *front; | ||
| 22 | +@property (nonatomic, strong) UIView *line; | ||
| 23 | + | ||
| 24 | +@end | ||
| 25 | + | ||
| 26 | +@implementation CNLiveTradingRecordDetailCell | ||
| 27 | +static const NSInteger margin = 15; | ||
| 28 | + | ||
| 29 | +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | ||
| 30 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | ||
| 31 | + if (self) { | ||
| 32 | + self.contentView.backgroundColor = [UIColor whiteColor]; | ||
| 33 | + [self.contentView addSubview:self.title]; | ||
| 34 | + [self.contentView addSubview:self.content]; | ||
| 35 | + [self.contentView addSubview:self.line]; | ||
| 36 | + [self.contentView addSubview:self.front]; | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | + return self; | ||
| 40 | +} | ||
| 41 | +- (void)setModel:(CNLiveTradingRecordDetailModel *)model{ | ||
| 42 | + _model = model; | ||
| 43 | + _title.text = model.title; | ||
| 44 | + _content.text = model.content; | ||
| 45 | + if([model.title isEqualToString:@"查看与此商户的交易记录"]){ | ||
| 46 | + _front.hidden = NO; | ||
| 47 | + _content.hidden = YES; | ||
| 48 | + | ||
| 49 | + }else{ | ||
| 50 | + _front.hidden = YES; | ||
| 51 | + _content.hidden = NO; | ||
| 52 | + | ||
| 53 | + } | ||
| 54 | + [self xw_layoutSubviews]; | ||
| 55 | + | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +- (void)xw_layoutSubviews{ | ||
| 59 | + [_line mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 60 | + make.left.equalTo(self.contentView.mas_left).with.offset(0); | ||
| 61 | + make.right.equalTo(self.contentView.mas_right).with.offset(0); | ||
| 62 | + make.top.equalTo(self.contentView.mas_top).with.offset(0); | ||
| 63 | + make.height.offset(self.model.lineHeight); | ||
| 64 | + | ||
| 65 | + }]; | ||
| 66 | + | ||
| 67 | + [_title mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 68 | + make.top.equalTo(self.line.mas_bottom); | ||
| 69 | + make.bottom.equalTo(self.contentView.mas_bottom); | ||
| 70 | + make.left.equalTo(self.contentView.mas_left).with.offset(margin); | ||
| 71 | + | ||
| 72 | + }]; | ||
| 73 | + | ||
| 74 | + [_content mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 75 | + make.top.equalTo(self.line.mas_bottom); | ||
| 76 | + make.bottom.equalTo(self.contentView.mas_bottom); | ||
| 77 | + make.right.equalTo(self.contentView.mas_right).with.offset(-margin); | ||
| 78 | + | ||
| 79 | + }]; | ||
| 80 | + | ||
| 81 | + [_front mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 82 | + make.top.equalTo(self.line.mas_bottom); | ||
| 83 | + make.bottom.equalTo(self.contentView.mas_bottom); | ||
| 84 | + make.right.equalTo(self.contentView.mas_right).with.offset(-margin); | ||
| 85 | + make.width.with.offset(margin); | ||
| 86 | + | ||
| 87 | + }]; | ||
| 88 | + | ||
| 89 | + | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +- (void)awakeFromNib { | ||
| 93 | + [super awakeFromNib]; | ||
| 94 | + // Initialization code | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
| 98 | + [super setSelected:selected animated:animated]; | ||
| 99 | + | ||
| 100 | + // Configure the view for the selected state | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +#pragma mark - 懒加载 | ||
| 104 | + | ||
| 105 | +- (UILabel *)title { | ||
| 106 | + if (!_title) { | ||
| 107 | + _title = [[UILabel alloc] init]; | ||
| 108 | + _title.numberOfLines = 1; | ||
| 109 | + _title.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1.0]; | ||
| 110 | + _title.font = UIFontCNMake(15.0); | ||
| 111 | + } | ||
| 112 | + return _title; | ||
| 113 | +} | ||
| 114 | + | ||
| 115 | +- (UILabel *)content { | ||
| 116 | + if (!_content) { | ||
| 117 | + _content = [[UILabel alloc] init]; | ||
| 118 | + _content.numberOfLines = 1; | ||
| 119 | + _content.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0]; | ||
| 120 | + _content.font = UIFontCNMake(15.0); | ||
| 121 | + } | ||
| 122 | + return _content; | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +- (UIView *)line { | ||
| 126 | + if (!_line) { | ||
| 127 | + _line = [[UIView alloc] init]; | ||
| 128 | + _line.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0]; | ||
| 129 | + } | ||
| 130 | + return _line; | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | + | ||
| 134 | +- (UIImageView *)front { | ||
| 135 | + if (!_front) { | ||
| 136 | + _front = [[UIImageView alloc] init]; | ||
| 137 | + UIImage *xw_image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveBalanceModule" targetClass:[self class]]; | ||
| 138 | + _front.image = xw_image; | ||
| 139 | + _front.contentMode = UIViewContentModeCenter; | ||
| 140 | + } | ||
| 141 | + return _front; | ||
| 142 | +} | ||
| 143 | +@end | ||
| 144 | + |
CNLiveBalanceModule/Classes/View/CNLiveTradingRecordDetailHeaderView.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTradingRecordDetailHeaderView.m | ||
| 3 | +// CNLiveBalanceModule | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/9/6. | ||
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | +@class CNLiveTradingRecordListModel; | ||
| 11 | + | ||
| 12 | +@interface CNLiveTradingRecordDetailHeaderView : UIView | ||
| 13 | +@property (nonatomic, strong) CNLiveTradingRecordListModel *model; | ||
| 14 | + | ||
| 15 | +@end |
CNLiveBalanceModule/Classes/View/CNLiveTradingRecordDetailHeaderView.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTradingRecordDetailHeaderView.m | ||
| 3 | +// CNLiveBalanceModule | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/9/6. | ||
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveTradingRecordDetailHeaderView.h" | ||
| 10 | +#import <Masonry/Masonry.h> | ||
| 11 | +#import "CNLiveBaseKit.h" | ||
| 12 | +#import "QMUIKit.h" | ||
| 13 | +#import "CNLiveCategory.h" | ||
| 14 | +#import <SDWebImage/SDWebImage.h> | ||
| 15 | +#import "CNLiveTradingRecordModel.h" | ||
| 16 | + | ||
| 17 | +@interface CNLiveTradingRecordDetailHeaderView () | ||
| 18 | +@property (nonatomic, strong) UIImageView *shopIcon; | ||
| 19 | +@property (nonatomic, strong) UILabel *shopName; | ||
| 20 | + | ||
| 21 | +@property (nonatomic, strong) UILabel *money; | ||
| 22 | +@property (nonatomic, strong) UILabel *tips; | ||
| 23 | + | ||
| 24 | +@end | ||
| 25 | + | ||
| 26 | +@implementation CNLiveTradingRecordDetailHeaderView | ||
| 27 | +static const NSInteger margin = 10; | ||
| 28 | +static const NSInteger height = 50; | ||
| 29 | + | ||
| 30 | +- (instancetype)initWithFrame:(CGRect)frame{ | ||
| 31 | + self = [super initWithFrame:frame]; | ||
| 32 | + if (self) { | ||
| 33 | + self.backgroundColor = [UIColor whiteColor]; | ||
| 34 | + [self createSubViews]; | ||
| 35 | + } | ||
| 36 | + return self; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +- (void)createSubViews { | ||
| 40 | + [self addSubview:self.shopIcon]; | ||
| 41 | + [self addSubview:self.shopName]; | ||
| 42 | + [self addSubview:self.money]; | ||
| 43 | + [self addSubview:self.tips]; | ||
| 44 | + | ||
| 45 | + [self.money mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 46 | + make.centerX.equalTo(self); | ||
| 47 | + make.centerY.equalTo(self); | ||
| 48 | + }]; | ||
| 49 | + [self.tips mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 50 | + make.bottom.equalTo(self.mas_bottom).offset(-margin); | ||
| 51 | + make.centerX.equalTo(self); | ||
| 52 | + make.height.offset(40); | ||
| 53 | + }]; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +- (void)setModel:(CNLiveTradingRecordListModel *)model { | ||
| 57 | + _model = model; | ||
| 58 | + if (![model.sum containsString:@"-"]) { | ||
| 59 | + self.money.text = [NSString stringWithFormat:@"+%@",model.sum]; | ||
| 60 | + } else { | ||
| 61 | + self.money.text = model.sum;//[NSString stringWithFormat:@"%.2f",model.money]; | ||
| 62 | + } | ||
| 63 | + if ([model.sourceType containsString:@"refill"] || [model.sourceType isEqualToString:@"group_vote"] || [model.sourceType containsString:@"refund"]) { | ||
| 64 | + // 收入 | ||
| 65 | + self.tips.text = @"收款金额"; | ||
| 66 | + if ([model.payType isEqualToString:@"ali"]) { | ||
| 67 | + self.shopIcon.image = [self getImageWithImageName:@"trading_record_ali_pay" bundleName:@"CNLiveBalanceModule" targetClass:[self class]]; | ||
| 68 | + self.shopName.text = @"支付宝支付"; | ||
| 69 | + } else if ([model.payType isEqualToString:@"wechat"]) { | ||
| 70 | + self.shopIcon.image = [self getImageWithImageName:@"trading_record_wechat_pay" bundleName:@"CNLiveBalanceModule" targetClass:[self class]]; | ||
| 71 | + self.shopName.text = @"微信支付"; | ||
| 72 | + } else if ([model.payType isEqualToString:@"wjj"]) { | ||
| 73 | + self.shopIcon.image = [self getImageWithImageName:@"trading_record_wjj_pay" bundleName:@"CNLiveBalanceModule" targetClass:[self class]]; | ||
| 74 | + self.shopName.text = @"网家家支付"; | ||
| 75 | + } else if ([model.payType isEqualToString:@"union"]) { | ||
| 76 | + self.shopIcon.image = [self getImageWithImageName:@"trading_record_union_pay" bundleName:@"CNLiveBalanceModule" targetClass:[self class]]; | ||
| 77 | + self.shopName.text = @"银行卡"; | ||
| 78 | + } else { | ||
| 79 | + self.shopIcon.image = [UIImage imageNamed:@""]; | ||
| 80 | + self.shopName.text = @"未知"; | ||
| 81 | + } | ||
| 82 | + } else if ([model.sourceType containsString:@"order"] || [model.sourceType containsString:@"payment"]) { | ||
| 83 | + // 支出 | ||
| 84 | + self.tips.text = @"付款金额"; | ||
| 85 | + self.shopIcon.layer.cornerRadius = 15.0; | ||
| 86 | + self.shopIcon.layer.masksToBounds = YES; | ||
| 87 | + UIImage *xw_image = [self getImageWithImageName:@"default_avatar_f" bundleName:@"CNLiveBalanceModule" targetClass:[self class]]; | ||
| 88 | + [self.shopIcon sd_setImageWithURL:[NSURL URLWithString:model.iconBean.image] placeholderImage:xw_image]; | ||
| 89 | + self.shopName.text = model.iconBean.nickName?model.iconBean.nickName:@"未知"; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + NSDictionary *dic = @{NSFontAttributeName:UIFontCNMake(16)}; | ||
| 93 | + CGFloat width = [self.shopName.text boundingRectWithSize:CGSizeMake(0, 0) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic context:nil].size.width+margin; | ||
| 94 | + if(width >= SCREEN_WIDTH){ | ||
| 95 | + width = SCREEN_WIDTH-40; | ||
| 96 | + } | ||
| 97 | + [_shopName mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 98 | + make.left.equalTo(self.mas_left).with.offset((SCREEN_WIDTH-width)/2.0+margin); | ||
| 99 | + make.right.mas_lessThanOrEqualTo(self.mas_right).with.offset(-margin); | ||
| 100 | + make.top.equalTo(self.mas_top).with.offset(margin); | ||
| 101 | + make.width.offset(width); | ||
| 102 | + make.height.offset(40); | ||
| 103 | + | ||
| 104 | + }]; | ||
| 105 | + | ||
| 106 | + [_shopIcon mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 107 | + make.right.equalTo(self.shopName.mas_left).with.offset(-margin); | ||
| 108 | + make.centerY.equalTo(self.shopName.mas_centerY); | ||
| 109 | + make.width.height.offset(30); | ||
| 110 | + }]; | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +#pragma mark - 懒加载 | ||
| 114 | +- (UIImageView *)shopIcon { | ||
| 115 | + if (!_shopIcon) { | ||
| 116 | + _shopIcon = [[UIImageView alloc] init]; | ||
| 117 | + _shopIcon.contentMode = UIViewContentModeScaleAspectFill; | ||
| 118 | + _shopIcon.backgroundColor = [UIColor whiteColor]; | ||
| 119 | + _shopIcon.image = [UIImage imageNamed:@"ye_wxzffs"]; //fenlei_touxiang2 | ||
| 120 | + } | ||
| 121 | + return _shopIcon; | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +- (UILabel *)shopName { | ||
| 125 | + if (!_shopName) { | ||
| 126 | + _shopName = [[UILabel alloc] init]; | ||
| 127 | + _shopName.textColor = [UIColor blackColor]; | ||
| 128 | + _shopName.font = UIFontCNMake(16);//[UIFont fontWithName:@"PingFangSC-Regular" size:16.0f]; | ||
| 129 | + } | ||
| 130 | + return _shopName; | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +- (UILabel *)money { | ||
| 134 | + if (!_money) { | ||
| 135 | + _money = [[UILabel alloc] init]; | ||
| 136 | + _money.textColor = RGB(34, 34, 34); | ||
| 137 | + _money.font = UIFontCNMake(36);//[UIFont fontWithName:@"PingFangSC-Regular" size:36]; | ||
| 138 | + _money.textAlignment = NSTextAlignmentCenter; | ||
| 139 | + } | ||
| 140 | + return _money; | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +- (UILabel *)tips { | ||
| 144 | + if (!_tips) { | ||
| 145 | + _tips = [[UILabel alloc] init]; | ||
| 146 | + _tips.text = @"付款金额"; | ||
| 147 | + _tips.textColor = RGB(156, 156, 156); | ||
| 148 | + _tips.font = UIFontCNMake(15);//[UIFont fontWithName:@"PingFangSC-Regular" size:15]; | ||
| 149 | + _tips.textAlignment = NSTextAlignmentCenter; | ||
| 150 | + } | ||
| 151 | + return _tips; | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | +@end |