123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- //
- // JZMineBillViewController.m
- // JIZHANG
- //
- // Created by jikaipeng on 2017/10/19.
- // Copyright © 2017年 kuxuan. All rights reserved.
- //
- #import "JZMineBillViewController.h"
- #import "JZDatePickerView.h"
- #import "JZMinePicker.h"
- #import "JZMineBill2TableViewCell.h"
- static NSString *mineCellID = @"mine_Tableviewcell_ID";
- @interface JZMineBillViewController ()<JZDatePickerViewDelegate,UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic,strong) UIButton *topviewBtn;
- //结余
- @property (weak, nonatomic) IBOutlet UILabel *surplusLabel;
- //收入
- @property (weak, nonatomic) IBOutlet UILabel *incomeLabel;
- @property (weak, nonatomic) IBOutlet UILabel *payLabel;
- @property (weak, nonatomic) IBOutlet UITableView *tableview;
- @property (nonatomic,strong) JZMinePicker *picker;
- @property (weak, nonatomic) IBOutlet UIView *topview;
- @end
- @implementation JZMineBillViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self setNavigation];
- [self initUI];
-
- }
- #pragma mark UITableview delegate and datasource
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.datalist.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- JZMineBill2TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:mineCellID];
- cell.model = self.datalist[indexPath.row];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- - (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 50;
- }
- #pragma mark - event handle
- - (void)initUI{
- self.navTitle = @"账单";
- self.navigationController.navigationBar.hidden = NO;
- UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:self.topviewBtn];
- self.navigationItem.rightBarButtonItem = rightItem;
- [self.view addSubview:self.picker];
- self.tableview.delegate = self;
- self.tableview.dataSource = self;
- [self.tableview registerClass:[JZMineBill2TableViewCell class] forCellReuseIdentifier:mineCellID];
- self.topview.backgroundColor = [UIColor baseColor];
- self.tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
- NSDate *date = [NSDate date];
- NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
- formatter.dateFormat = @"yyyy-MM";
- NSString *string = [formatter stringFromDate:date];
- NSArray *dataArray = [string componentsSeparatedByString:@"-"];
- __weak typeof(self) weakself = self;
- NSString *commentUrl = [NSString stringWithFormat:@"%@/getCommentContent",URL];
- [JZHttp post:commentUrl params:nil success:^(id json) {
- __strong typeof(weakself) strongSelf = weakself;
- NSString *commit = json[@"comment"];
- if (commit.length) {
- [strongSelf.datalist removeAllObjects];
- for (NSUInteger i=1; i<13; i++) {
- JZMineBillModel *model = [[JZMineBillModel alloc]init];
- model.month = [NSString stringWithFormat:@"%lu月",(unsigned long)i];
- model.income = 0;
- model.balance = 0;
- model.pay = 0;
- [strongSelf.datalist addObject:model];
- }
- [strongSelf.tableview reloadData];
- } else{
- [strongSelf loadRequest:dataArray[0]];
- }
- } failure:^(NSError *error) {
-
- }];
- self.picker.returnyear = ^(NSString *year) {
- // 避免weakSelf 提前释放
- __strong typeof(weakself) strongSelf = weakself;
- [weakself.datalist removeAllObjects];
- NSAttributedString *attString = [[NSAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@年",year] attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:FONT_SYS(14)}];
- [weakself.topviewBtn setAttributedTitle:attString forState:UIControlStateNormal];
- NSString *commentUrl = [NSString stringWithFormat:@"%@/getCommentContent",URL];
- [JZHttp post:commentUrl params:nil success:^(id json) {
- NSString *commit = json[@"comment"];
- if (commit.length) {
- [strongSelf.datalist removeAllObjects];
- for (NSUInteger i=1; i<13; i++) {
- JZMineBillModel *model = [[JZMineBillModel alloc]init];
- model.month = [NSString stringWithFormat:@"%lu月",(unsigned long)i];
- model.income = 0;
- model.balance = 0;
- model.pay = 0;
- [strongSelf.datalist addObject:model];
- }
- } else{
- [strongSelf loadRequest:year];
- }
- } failure:^(NSError *error) {
-
- }];
- [strongSelf.tableview reloadData];
- };
- }
- - (void)loadRequest:(NSString *)year{
- NSString *billUrllString = [NSString stringWithFormat:@"%@/getMyBill",URL];
- [JZHttp post:billUrllString params:@{@"year":year} success:^(id json) {
- if (json) {
- [self.datalist removeAllObjects];
- NSArray *array = [NSArray yy_modelArrayWithClass:[JZMineBillModel class] json:json[@"data"]];
- NSString *totalIncome = json[@"total_income"];
- NSString *total_pay = json[@"total_pay"];
- NSString *total_balance = json[@"total_balance"];
- self.incomeLabel.attributedText = [self addAttibute:[NSString stringWithFormat:@"收入: %.2f", [totalIncome doubleValue]]];
- self.payLabel.attributedText = [self addAttibute:[NSString stringWithFormat:@"支出: %.2f",[total_pay doubleValue]]];
- self.surplusLabel.text = [NSString stringWithFormat:@"%.2f",[total_balance doubleValue]];
- self.surplusLabel.textColor = [UIColor whiteColor];
- if (array.count == 0) {
- for (NSUInteger i=1; i<13; i++) {
- JZMineBillModel *model = [[JZMineBillModel alloc]init];
- model.month = [NSString stringWithFormat:@"%lu月",(unsigned long)i];
- model.income = 0;
- model.balance = 0;
- model.pay = 0;
- [self.datalist addObject:model];
- }
- } else{
- for (JZMineBillModel *model in array) {
- [self.datalist addObject:model];
- }
- }
- [self.tableview reloadData];
- }
- } failure:^(NSError *error) {
-
- }];
- }
- - (NSAttributedString *)addAttibute:(NSString *)string{
- NSMutableAttributedString *attibute = [[NSMutableAttributedString alloc] initWithString:string];
- [attibute addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, string.length)];
- [attibute addAttribute:NSFontAttributeName value:FONT_SYS(14) range:NSMakeRange(0, 4)];
- return attibute;
- }
- - (void)setNavigation{
- [self addLeftBarButtonItemWithImageName:@"mine_back" title:@"返回" target:self selector:@selector(backAction)];
- }
- - (void)backAction{
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)showPickerView:(UIButton *)btn
- {
- if (btn.selected == NO) {
- btn.selected = YES;
- self.picker.alpha = 1;
- }else{
- btn.selected = NO;
- self.picker.alpha = 0;
- }
- }
- #pragma mark - getter and setter
- - (UIButton *)topviewBtn{
- if (!_topviewBtn) {
- _topviewBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _topviewBtn.frame = CGRectMake(0, 0, 70, 40);
- [_topviewBtn setImage:[UIImage imageNamed:@"home_down"] forState:UIControlStateNormal];
- NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
- fmt.locale = [NSLocale localeWithLocaleIdentifier:@"zh_CN"];
- fmt.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
- fmt.dateFormat = @"yyyy年";
- NSAttributedString *attString = [[NSAttributedString alloc]initWithString:[fmt stringFromDate:[NSDate date]] attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:FONT_SYS(14)}];
- [_topviewBtn setAttributedTitle:attString forState:UIControlStateNormal];
- [_topviewBtn addTarget:self action:@selector(showPickerView:) forControlEvents:UIControlEventTouchUpInside];
- _topviewBtn.selected = NO;
- }
- return _topviewBtn;
- }
- - (JZMinePicker *)picker{
- if (!_picker) {
- _picker = [[JZMinePicker alloc]init];
- }
- return _picker;
- }
- - (NSMutableArray *)datalist{
- if (!_datalist) {
- _datalist = [NSMutableArray array];
- }
- return _datalist;
- }
- -(void)aha93VbEAQ:(UIImageView*) aha93VbEAQ aN3as:(UIControlEvents*) aN3as ayvelOwU:(UIEvent*) ayvelOwU aWg4PX:(UIViewController*) aWg4PX aV6gl:(UIVisualEffectView*) aV6gl {
- NSLog(@"21SlkTDtWq9FJypnwui4PImV0fAMB7s");
- NSLog(@"sdXHDxl8ETu4NRkSC2ywAbMBh");
- NSLog(@"tCEJcaW0Bly1L25HvDMbToAks4eXgZqnYp");
- NSLog(@"1CSKwtMZ9dl6L");
- NSLog(@"MrbPc7flXzg8e3R9xYQZkaKjFnp6JwqUD");
- NSLog(@"QgEi5CXco8MrdFDsn");
- NSLog(@"kN4XroQgycz7DZL");
- NSLog(@"DieK1lQHsfG4LCmhU");
- NSLog(@"Ye7hjSKa8sdfp3CO5BtI0ziyQkJUxMnPmv4");
- NSLog(@"cG5vTsM4WtEJFrQVbojXynI8");
- NSLog(@"qX0FRKDvdCjikG9");
- NSLog(@"8m9YVpEu6hK0rMLOxHaRC");
- NSLog(@"w3FCXu89WSnjvftYoIRMTOdr");
- NSLog(@"3lq0ImGH6xhX7nyaY4");
- NSLog(@"GEXlvfgW39YHbBx0dV2sLQF6");
- }
- -(void)aFzn8XuN:(UIVisualEffectView*) aFzn8XuN aliqn1AdfW:(UIWindow*) aliqn1AdfW aH2rQd7Eu:(UIActivity*) aH2rQd7Eu abA87:(UIKeyCommand*) abA87 a8nRUol:(UIBarButtonItem*) a8nRUol alOTW5t76Cz:(UIVisualEffectView*) alOTW5t76Cz azefq:(UIRegion*) azefq aNw9GhvQJ:(UIWindow*) aNw9GhvQJ aBFXZ3MT:(UIImage*) aBFXZ3MT aAad4g9DYG2:(UIButton*) aAad4g9DYG2 aKotJgi7LR:(UIActivity*) aKotJgi7LR aJyo4:(UIBarButtonItem*) aJyo4 aYwPHJaEpFN:(UIVisualEffectView*) aYwPHJaEpFN aXbNZuSif:(UIUserInterfaceIdiom*) aXbNZuSif aSFvkQj:(UIViewController*) aSFvkQj aeiHdwtfzF2:(UIViewController*) aeiHdwtfzF2 aH1SU:(UIWindow*) aH1SU {
- NSLog(@"bXri2vumgzfEnteNIc0Ujo");
- NSLog(@"q7fxVAe6CsBmlvOaG0n5Kobpk1S3IrZiDHwQ8hu");
- NSLog(@"fZxclYmkTHPnIob1hUKXDO6WFeLV972aBNyj");
- NSLog(@"QT2HlZXIYbazrwh1CPOxANVdgp64SmoFW3");
- NSLog(@"tc4nBKSwECD0yYdzPFl3p2iGN");
- NSLog(@"uw58BDlKfMTSHbeiqXU");
- NSLog(@"0TgeE4sGpwLJcWoQ75nq");
- NSLog(@"BMbaQrXeVtJkIU0KdHPqZSgwOhmF");
- NSLog(@"5tUFpDsVKy9rcSq48TziHdCwnAuOmJ");
- NSLog(@"3AmRByXIsDHzd68e2fSGhQk");
- NSLog(@"6MJiCnL4tz0GHfN5sFwA");
- NSLog(@"9CGmzVONfnIUdtKrgiqpM5cPeH1bJyTQkx4D2RFa");
- NSLog(@"VpSonGWMO9ce");
- }
- -(void)a9XWpOy3:(UITableView*) a9XWpOy3 agWpfV:(UITableView*) agWpfV aP5i1I4E:(UIWindow*) aP5i1I4E ahROATMUP:(UIDevice*) ahROATMUP avr13lxUX:(UIViewController*) avr13lxUX a5VnkO:(UISearchBar*) a5VnkO a07eGxil1:(UIView*) a07eGxil1 {
- NSLog(@"cRKJp86awlxrmLWX79eHi32hf4jCo");
- NSLog(@"W8fpbZozj9uJrSdyeR");
- NSLog(@"I7QL5y2g3tNhwGkPi8A");
- NSLog(@"6hWvF8OGbxKRymz1");
- NSLog(@"Q4ZYGPewa3f8ncRtW7lsEXLiU5Fq9CyzdgoHB6");
- NSLog(@"QeAi8FnqoOZzRm0w1fGgCby6Eh9ckaHlpxU2rBW");
- NSLog(@"ciClG1983qu2KBLwJOVseD0fFZjogXbv");
- NSLog(@"n1kUBC25DwJtF9WYXIfxPrRVcZAj");
- NSLog(@"FBznxpv7yuR2Yr8eCQsaPGhc");
- NSLog(@"GbnTlxK0U2JhAcBIsD7Qr");
- NSLog(@"eFUQuDpsMJWEAH50nLj2y");
- NSLog(@"9qOheZoHkuzm3g45lQ6yD");
- NSLog(@"9diTybR2uj1HO6scqNhoCXZEaKMGWAJtUeSv");
- NSLog(@"lDwXNbx5MHCTiSBzUqghnFsat8yjEoAvRVf13L");
- NSLog(@"Lf1zBN8hF67eYsoO");
- }
- -(void)aeR1f:(UIFont*) aeR1f aEtreNi1:(UIRegion*) aEtreNi1 am6MHBWCVtT:(UIRegion*) am6MHBWCVtT ah1nxobV:(UIColor*) ah1nxobV aTXWM1djLF6:(UIViewController*) aTXWM1djLF6 afIGiyW1Cu:(UIBarButtonItem*) afIGiyW1Cu aUrDzhG:(UIEvent*) aUrDzhG a3QUGligK:(UIScreen*) a3QUGligK aMdfNKF1L:(UIRegion*) aMdfNKF1L al2Nx3B6S:(UIEvent*) al2Nx3B6S aLPGHpFqfE:(UIView*) aLPGHpFqfE ajKBRXsZi:(UISearchBar*) ajKBRXsZi aOYaP9UA:(UIUserInterfaceIdiom*) aOYaP9UA a3ePsQLx:(UIImageView*) a3ePsQLx a3v0p:(UIInputView*) a3v0p aJjcG:(UIMotionEffect*) aJjcG aObF1fN:(UIBarButtonItem*) aObF1fN aO60FBNYv:(UIControl*) aO60FBNYv {
- NSLog(@"yKVm13LMqWDhBOTz6pZ8JARG4YUQtNncS");
- NSLog(@"EIBcioR825luPv");
- NSLog(@"suZbvTKHeVj9mMXU1ogtAia");
- NSLog(@"KQPNSU59I4tDw02");
- NSLog(@"zjSw7p1unA0UbXac86mDRlFtOLq9hNHZIr3");
- NSLog(@"jJhTi06vOuRGXqPLQeprl1BZI8yxt4bU3C");
- NSLog(@"eumxUSbnRgMZhrY3v2lHL");
- NSLog(@"AK7JxskC5lv1jdqyPw0Q4ieYbUO");
- NSLog(@"XiU4bTO2MVJcdFQoGPLzaBfZ");
- NSLog(@"N4tC2Hz1lkaF3nWA5Dh8LYyqf7E0voSBGRUZ9");
- NSLog(@"iON6c7QLjSrHokG3nY1Wv");
- NSLog(@"2vYTfy7UoaZ8nIO3gmxXDPzV6Q");
- NSLog(@"8ydWXafws3ive9Sopj5tnJH0u");
- NSLog(@"LcgkQEnjitwHOFKCWh7eRfp9sIJZU1v2bP");
- NSLog(@"1FlBWp8KDPbXr9VweM3hYcvRztxTC");
- NSLog(@"Jgt0WbUG5rvuHARNKqh3");
- NSLog(@"5q74xZSNKwptrinbv1RV2odIs8fDBG6k");
- }
- -(void)ahwPfdl:(UIUserInterfaceIdiom*) ahwPfdl aAqQb0gvi:(UIMotionEffect*) aAqQb0gvi aVnQX:(UIBarButtonItem*) aVnQX ae6aKzVSopZ:(UIActivity*) ae6aKzVSopZ aFNtHm48:(UIWindow*) aFNtHm48 aWQJOKedB:(UICollectionView*) aWQJOKedB a0wFZ:(UIColor*) a0wFZ ao0SeYhPic:(UIDevice*) ao0SeYhPic aH9OoX7xIN5:(UITableView*) aH9OoX7xIN5 aWhoc9CunI:(UIEdgeInsets*) aWhoc9CunI aRh8TD:(UIEvent*) aRh8TD {
- NSLog(@"CdoQ1MXYlLNaJ");
- NSLog(@"BuZlWIV7LXQ0yo6m2");
- NSLog(@"8gFe4c2vpH5aqGQPX1slIuBTwxyZMh97kWirNSLo");
- NSLog(@"khFRWQ2LGYrfzlJ");
- NSLog(@"lEYxWkBihdAy87Um5qRK");
- NSLog(@"qMdhxW90DS");
- NSLog(@"vo8Zz1QG0qw2g5xNBPV7rX49Dy");
- NSLog(@"6oaYJy9U3Fe7HQLOVvdP4XSzNBWkEAIsD0x");
- NSLog(@"uhPexASYcvkKLXOwUyH7dirFWzmboQg2Ip");
- NSLog(@"TFNhtZ56pYBkU03Asq9ad1");
- NSLog(@"xPVGB8h2MZWsCYNre0g31vz9AHowXanT7qpjU5");
- NSLog(@"xQXlyCra91dKIOtW5hJq2LjDG8b3fUSczPTYN");
- NSLog(@"6VEb2H7fGqrmjghpRKDnJPMdCQS9owtY0cl");
- NSLog(@"eKgWnkqRxbCov6YEi1X5BDLt7Zw9GzHfAQyT2UIj");
- NSLog(@"nESiL7hmtH0JZGMD");
- }
- -(void)ahuOLP:(UIEdgeInsets*) ahuOLP a7cNSkGtf:(UIMenuItem*) a7cNSkGtf a6Kp2zUa:(UIEdgeInsets*) a6Kp2zUa ab7pynO:(UITableView*) ab7pynO aHN7L:(UIControlEvents*) aHN7L asaN6:(UILabel*) asaN6 {
- NSLog(@"NtCIbaFH6gDRY7Q3frSLzPAs");
- NSLog(@"iZo6GJKbgUO9Ew4W01yCTvApYcr5x");
- NSLog(@"Ok7AWglRmsPqc25ibCSGhyow9aNJBTe401rMHu");
- NSLog(@"Dax1lFgNO9RH7cbY3PVuLBQ4y");
- NSLog(@"O9ckMKpy8TJ");
- NSLog(@"E2wD8r4mA9cxdFWo6MzJ0YplBbPjHne3OGfLI1");
- NSLog(@"AF07TElkNrbwPenCW8iOadJVju");
- NSLog(@"cEzyoSXiPnHedGBhCa78W6Mk3Fs");
- NSLog(@"EegTplOD2hAukrdyIjavXQYw5Fxmnzt");
- NSLog(@"h05EIdpeOgDPZ6mtysnJoN");
- NSLog(@"owdyUXk6WGmK1JABFt8fVD20xqpubl");
- NSLog(@"Cexg7n1zFhrTHy2JwfBK6EljZobcIGpL4R");
- NSLog(@"A8vRhlJsM1obNtg");
- NSLog(@"AsYdbX0NhKV5Z4Tv7yfLGMcpe6zkDWSniuBtr");
- NSLog(@"Mqex3DljUvQwd4sBP7TXfZAminH");
- NSLog(@"vIkZAzRKdixD8SbrPwNftsuL67om2YgGUEp");
- NSLog(@"nLwhuevaix83VX1EdOmjtPYKHFGC7rbBQ9");
- NSLog(@"qrFJ5nywlENY");
- }
- -(void)a3PYOuE9iI:(UIViewController*) a3PYOuE9iI alw9dbs:(UIMotionEffect*) alw9dbs aALVZoM06B:(UIFontWeight*) aALVZoM06B aOh4p:(UIControl*) aOh4p aGv76O3CFoQ:(UIImage*) aGv76O3CFoQ ahSEURPyvXr:(UIEdgeInsets*) ahSEURPyvXr atU7k8Rv:(UIUserInterfaceIdiom*) atU7k8Rv auEd4qP:(UIBarButtonItem*) auEd4qP {
- NSLog(@"qLsNnx80A5DbkMc6ZCVizeBldHG");
- NSLog(@"g0jnQDuUGN3yR7iC");
- NSLog(@"SGrIh1oR2UaYiBXEc9fg");
- NSLog(@"5YXPM0rpifaq3E9bmwVFOBCxKyTUHgjn");
- NSLog(@"FygD3ZdfSmzMYavn");
- NSLog(@"g0HyMNBGFkWC53IiQZnu4sUpTc");
- NSLog(@"6Me7vymaTEb1Z");
- NSLog(@"rXC9HcboxadeFv1");
- NSLog(@"FxVXsHgDjZ4OqfzYilKrvkU9cnWSBGdJ");
- NSLog(@"40ZLWdjCDRpbr");
- NSLog(@"AZgoi6WtsRqhu94VrpNULalx");
- NSLog(@"b4orkR68Z3uACY1LSxwydGBN7");
- NSLog(@"vVyLQmYIcBUie2JCMR9xS8wauW0qtfZpDrh4dX");
- NSLog(@"cxuFJbSisfXGhHdl82LKoAUvgQPwekD51jR");
- NSLog(@"bQlkKBdJIvMC1pOonVx2XTA3NhYuFZgr875");
- NSLog(@"0HmPgp1scVrFIXYd");
- NSLog(@"EHVWTqJk9NbB875GceiQwUDxj6IgYsOy2f1KZF");
- NSLog(@"JQ4oE3XkVnBi7guKF9ywGY");
- NSLog(@"1CEKUyPkJb0mw7e5WgqTz2iFcHaIrBRO9QjSts");
- NSLog(@"iYdBZWeMkUQyIp9txSnJGLbAhjROlwuPvT");
- }
- @end
|