学丽 5 years ago
parent
commit
266e1f6422
29 changed files with 554 additions and 57 deletions
  1. 15 8
      KuDianProject.xcodeproj/project.pbxproj
  2. 12 1
      KuDianProject/APPKDURL.h
  3. 4 1
      KuDianProject/Earning/Chart/SSWlineIncomeChartView.m
  4. 57 7
      KuDianProject/Earning/Controller/KDPAccountVC.m
  5. 2 0
      KuDianProject/Earning/Controller/KDPForecastOrderListVC.h
  6. 14 0
      KuDianProject/Earning/Controller/KDPForecastOrderListVC.m
  7. 27 2
      KuDianProject/Earning/Controller/KDPForecastVC.m
  8. 2 1
      KuDianProject/Earning/View/KDPAccountListCell.h
  9. 19 2
      KuDianProject/Earning/View/KDPAccountListCell.m
  10. 4 0
      KuDianProject/Earning/View/KDPEarnTableHeadView.h
  11. 59 7
      KuDianProject/Earning/View/KDPEarnTableHeadView.m
  12. 3 1
      KuDianProject/Earning/View/KDPForecastListCell.h
  13. 12 0
      KuDianProject/Earning/View/KDPForecastListCell.m
  14. 1 0
      KuDianProject/Login/model/KDPAccountModel.h
  15. 2 2
      KuDianProject/Login/model/KDPAccountModel.m
  16. 1 1
      KuDianProject/MainTab/KDPNavBar.m
  17. 4 0
      KuDianProject/PrefixHeader.pch
  18. 2 0
      KuDianProject/Public/KDPublicMethod.h
  19. 10 0
      KuDianProject/Public/KDPublicMethod.m
  20. 34 0
      KuDianProject/TOP/Controller/KDPBalanceModel.h
  21. 19 0
      KuDianProject/TOP/Controller/KDPBalanceModel.m
  22. 96 8
      KuDianProject/TOP/Controller/KDPGoodDetailVC.m
  23. 1 1
      KuDianProject/TOP/Controller/KDPProjectListVC.h
  24. 99 10
      KuDianProject/TOP/Controller/KDPProjectListVC.m
  25. 9 1
      KuDianProject/TOP/Controller/KDPTopViewController.m
  26. 1 1
      KuDianProject/TOP/View/Detail/KDPDetailGoodInformationView.m
  27. 1 0
      KuDianProject/TOP/View/KDPLiveEarningCell.h
  28. 33 3
      KuDianProject/TOP/View/KDPLiveEarningCell.m
  29. 11 0
      KuDianProject/TOP/View/KDPRecommendGoodCell.m

+ 15 - 8
KuDianProject.xcodeproj/project.pbxproj

101
 		C5DA002A22D4A8B50000DFA8 /* KDPBannerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DA002922D4A8B50000DFA8 /* KDPBannerModel.m */; };
101
 		C5DA002A22D4A8B50000DFA8 /* KDPBannerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DA002922D4A8B50000DFA8 /* KDPBannerModel.m */; };
102
 		C5DA002D22D4AACB0000DFA8 /* KDPGoodsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DA002C22D4AACB0000DFA8 /* KDPGoodsModel.m */; };
102
 		C5DA002D22D4AACB0000DFA8 /* KDPGoodsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DA002C22D4AACB0000DFA8 /* KDPGoodsModel.m */; };
103
 		C5EB45D222D58B2A006A24F0 /* KDPProjectListVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C5EB45D122D58B2A006A24F0 /* KDPProjectListVC.m */; };
103
 		C5EB45D222D58B2A006A24F0 /* KDPProjectListVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C5EB45D122D58B2A006A24F0 /* KDPProjectListVC.m */; };
104
+		C5EB45D922D5D70A006A24F0 /* KDPBalanceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C5EB45D822D5D70A006A24F0 /* KDPBalanceModel.m */; };
104
 		D5717435855D1EAB768416AB /* libPods-KuDianProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B9A054D75DA0898647035D54 /* libPods-KuDianProject.a */; };
105
 		D5717435855D1EAB768416AB /* libPods-KuDianProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B9A054D75DA0898647035D54 /* libPods-KuDianProject.a */; };
105
 /* End PBXBuildFile section */
106
 /* End PBXBuildFile section */
106
 
107
 
316
 		C5DA002C22D4AACB0000DFA8 /* KDPGoodsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPGoodsModel.m; sourceTree = "<group>"; };
317
 		C5DA002C22D4AACB0000DFA8 /* KDPGoodsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPGoodsModel.m; sourceTree = "<group>"; };
317
 		C5EB45D022D58B2A006A24F0 /* KDPProjectListVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KDPProjectListVC.h; sourceTree = "<group>"; };
318
 		C5EB45D022D58B2A006A24F0 /* KDPProjectListVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KDPProjectListVC.h; sourceTree = "<group>"; };
318
 		C5EB45D122D58B2A006A24F0 /* KDPProjectListVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPProjectListVC.m; sourceTree = "<group>"; };
319
 		C5EB45D122D58B2A006A24F0 /* KDPProjectListVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPProjectListVC.m; sourceTree = "<group>"; };
320
+		C5EB45D722D5D70A006A24F0 /* KDPBalanceModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KDPBalanceModel.h; path = KuDianProject/TOP/Controller/KDPBalanceModel.h; sourceTree = SOURCE_ROOT; };
321
+		C5EB45D822D5D70A006A24F0 /* KDPBalanceModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = KDPBalanceModel.m; path = KuDianProject/TOP/Controller/KDPBalanceModel.m; sourceTree = SOURCE_ROOT; };
319
 /* End PBXFileReference section */
322
 /* End PBXFileReference section */
320
 
323
 
321
 /* Begin PBXFrameworksBuildPhase section */
324
 /* Begin PBXFrameworksBuildPhase section */
673
 		C5D5623722CD9D300035A714 /* Earning */ = {
676
 		C5D5623722CD9D300035A714 /* Earning */ = {
674
 			isa = PBXGroup;
677
 			isa = PBXGroup;
675
 			children = (
678
 			children = (
679
+				C5EB45D422D5D6E8006A24F0 /* Model */,
676
 				C53FD3E322D2E61F00687706 /* Chart */,
680
 				C53FD3E322D2E61F00687706 /* Chart */,
677
 				C5D5623822CD9D300035A714 /* Controller */,
681
 				C5D5623822CD9D300035A714 /* Controller */,
678
-				C5D5623922CD9D300035A714 /* Model */,
679
 				C5D5623A22CD9D300035A714 /* View */,
682
 				C5D5623A22CD9D300035A714 /* View */,
680
 			);
683
 			);
681
 			path = Earning;
684
 			path = Earning;
696
 			path = Controller;
699
 			path = Controller;
697
 			sourceTree = "<group>";
700
 			sourceTree = "<group>";
698
 		};
701
 		};
699
-		C5D5623922CD9D300035A714 /* Model */ = {
700
-			isa = PBXGroup;
701
-			children = (
702
-			);
703
-			path = Model;
704
-			sourceTree = "<group>";
705
-		};
706
 		C5D5623A22CD9D300035A714 /* View */ = {
702
 		C5D5623A22CD9D300035A714 /* View */ = {
707
 			isa = PBXGroup;
703
 			isa = PBXGroup;
708
 			children = (
704
 			children = (
831
 			path = Model;
827
 			path = Model;
832
 			sourceTree = "<group>";
828
 			sourceTree = "<group>";
833
 		};
829
 		};
830
+		C5EB45D422D5D6E8006A24F0 /* Model */ = {
831
+			isa = PBXGroup;
832
+			children = (
833
+				C5EB45D722D5D70A006A24F0 /* KDPBalanceModel.h */,
834
+				C5EB45D822D5D70A006A24F0 /* KDPBalanceModel.m */,
835
+			);
836
+			name = Model;
837
+			path = "New Group";
838
+			sourceTree = "<group>";
839
+		};
834
 		EDAD9A798350EDEB3C0EA15C /* Pods */ = {
840
 		EDAD9A798350EDEB3C0EA15C /* Pods */ = {
835
 			isa = PBXGroup;
841
 			isa = PBXGroup;
836
 			children = (
842
 			children = (
1022
 				C5EB45D222D58B2A006A24F0 /* KDPProjectListVC.m in Sources */,
1028
 				C5EB45D222D58B2A006A24F0 /* KDPProjectListVC.m in Sources */,
1023
 				C5BAD0D722D47A510084663A /* UIButton+ImageTitleStyle.m in Sources */,
1029
 				C5BAD0D722D47A510084663A /* UIButton+ImageTitleStyle.m in Sources */,
1024
 				C5BAD0AF22D42EBA0084663A /* KDPCollectHistoryVC.m in Sources */,
1030
 				C5BAD0AF22D42EBA0084663A /* KDPCollectHistoryVC.m in Sources */,
1031
+				C5EB45D922D5D70A006A24F0 /* KDPBalanceModel.m in Sources */,
1025
 				C5BAD0CA22D46D990084663A /* KDPGoodDetailVC.m in Sources */,
1032
 				C5BAD0CA22D46D990084663A /* KDPGoodDetailVC.m in Sources */,
1026
 				C5BAD0B222D42ECA0084663A /* KDPIDViewController.m in Sources */,
1033
 				C5BAD0B222D42ECA0084663A /* KDPIDViewController.m in Sources */,
1027
 				76D7945422D2E02600C2ECFA /* KDPScreenViewController.m in Sources */,
1034
 				76D7945422D2E02600C2ECFA /* KDPScreenViewController.m in Sources */,

+ 12 - 1
KuDianProject/APPKDURL.h

31
 #define bannerURL [NSString stringWithFormat:@"%@api/adv/advByType",KDURL]
31
 #define bannerURL [NSString stringWithFormat:@"%@api/adv/advByType",KDURL]
32
 
32
 
33
 #define topGoodRecommURL [NSString stringWithFormat:@"%@api/home/getHomeGoodsListV1",KDURL]
33
 #define topGoodRecommURL [NSString stringWithFormat:@"%@api/home/getHomeGoodsListV1",KDURL]
34
+#define historyURL [NSString stringWithFormat:@"%@api/brower/record",KDURL]
34
 
35
 
35
-
36
+#define collectURL [NSString stringWithFormat:@"%@api/goods_collect/handelCollection",KDURL]
36
 #define goodDetailURL [NSString stringWithFormat:@"%@api/goods/detail",KDURL]
37
 #define goodDetailURL [NSString stringWithFormat:@"%@api/goods/detail",KDURL]
38
+
39
+#define projectGoodURL [NSString stringWithFormat:@"%@api/goods/listGoods",KDURL]
40
+#define ChartAllMoneyURL  [NSString stringWithFormat:@"%@api/order/myEarningOrderStatistics",KDURL]
41
+
42
+#define balanceURL [NSString stringWithFormat:@"%@api/earning/accountPrice",KDURL]
43
+
44
+#define BalancelistURL [NSString stringWithFormat:@"%@api/earning/myBalanceList",KDURL]
45
+
46
+#define foreastURL [NSString stringWithFormat:@"%@api/earning/monthEarnings",KDURL]
47
+#define foreastDetailURL [NSString stringWithFormat:@"%@api/earning/incomeDetailList",KDURL]
37
 #endif /* APPKDURL_h */
48
 #endif /* APPKDURL_h */

+ 4 - 1
KuDianProject/Earning/Chart/SSWlineIncomeChartView.m

296
         UILabel   *lab = [[UILabel alloc]init];
296
         UILabel   *lab = [[UILabel alloc]init];
297
         lab.bounds = CGRectMake(0, 0, self.barWidth+self.gapWidth*4/5, 20);
297
         lab.bounds = CGRectMake(0, 0, self.barWidth+self.gapWidth*4/5, 20);
298
         lab.center = CGPointMake(point.x, point.y+lab.bounds.size.height/2);
298
         lab.center = CGPointMake(point.x, point.y+lab.bounds.size.height/2);
299
-//        lab.text = [NSString stringWithFormat:@"%@",self.xValuesArr[i]];
299
+        if (self.xValuesArr.count<=6) {
300
+            lab.text = [NSString stringWithFormat:@"%@",self.xValuesArr[i]];
301
+        }
302
+
300
         lab.textColor=[UIColor colorWithHexString:@"#333333"];
303
         lab.textColor=[UIColor colorWithHexString:@"#333333"];
301
         lab.font = [UIFont systemFontOfSize:12];
304
         lab.font = [UIFont systemFontOfSize:12];
302
         lab.textAlignment = NSTextAlignmentCenter;
305
         lab.textAlignment = NSTextAlignmentCenter;

+ 57 - 7
KuDianProject/Earning/Controller/KDPAccountVC.m

12
 @interface KDPAccountVC ()<UITableViewDelegate,UITableViewDataSource>
12
 @interface KDPAccountVC ()<UITableViewDelegate,UITableViewDataSource>
13
 {
13
 {
14
     UILabel *_accountMoneyLabel;
14
     UILabel *_accountMoneyLabel;
15
+    UILabel *_tipeLabel;
16
+    NSInteger page_num;
15
 }
17
 }
16
 @property(nonatomic,strong)UITableView *accountView;
18
 @property(nonatomic,strong)UITableView *accountView;
19
+@property(nonatomic,strong)NSMutableArray *dataArray;
17
 @end
20
 @end
18
 
21
 
19
 @implementation KDPAccountVC
22
 @implementation KDPAccountVC
21
 - (void)viewDidLoad {
24
 - (void)viewDidLoad {
22
     [super viewDidLoad];
25
     [super viewDidLoad];
23
     [self setNavUI];
26
     [self setNavUI];
27
+    page_num = 1;
28
+    [self getAccountBalance];
29
+    [self getBalanceList];
30
+}
31
+-(void)getBalanceList
32
+{
33
+    [LoadingView show];
24
     
34
     
25
-    
35
+    [KDPNetworkRequestHTTP postURL:BalancelistURL params:@{@"page":@(page_num)} success:^(id  _Nonnull json) {
36
+        [LoadingView dismiss];
37
+        NSArray *array =[NSArray yy_modelArrayWithClass:[KDPBalanceModel class] json:json[@"data"]];
38
+        if (page_num ==1) {
39
+            [self.dataArray removeAllObjects];
40
+        }
41
+        [self.dataArray addObjectsFromArray:array];
42
+        [self.accountView reloadData];
43
+        
44
+    } failure:^(NSError * _Nonnull error) {
45
+        [LoadingView dismiss];
46
+    }];
47
+}
48
+-(void)getAccountBalance
49
+{
50
+    [LoadingView show];
51
+    [KDPNetworkRequestHTTP postURL:balanceURL params:nil success:^(id  _Nonnull json) {
52
+        [LoadingView dismiss];
53
+        _tipeLabel.text=json[@"data"][@"alert"];
54
+        NSString *contents = [NSString stringWithFormat:@"¥%@",json[@"data"][@"notEnd"]];
55
+        NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:contents];
56
+        
57
+        [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0,1)]; //设置字体字号和字体类别
58
+        _accountMoneyLabel.attributedText = str;
59
+    } failure:^(NSError * _Nonnull error) {
60
+        [LoadingView dismiss];
61
+    }];
26
 }
62
 }
27
 
63
 
28
 -(void)setNavUI
64
 -(void)setNavUI
32
     self.navBar.navTitleLabel.text=@"我的账户";
68
     self.navBar.navTitleLabel.text=@"我的账户";
33
     
69
     
34
     [self.view addSubview:self.accountView];
70
     [self.view addSubview:self.accountView];
35
-    [self.accountView mas_makeConstraints:^(MASConstraintMaker *make) {
36
-        
37
-    }];
71
+    
38
 }
72
 }
39
 
73
 
40
 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
74
 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
44
         listC=[[KDPAccountListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"account"];
78
         listC=[[KDPAccountListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"account"];
45
         listC.selectionStyle=UITableViewCellSelectionStyleNone;
79
         listC.selectionStyle=UITableViewCellSelectionStyleNone;
46
     }
80
     }
81
+    listC.model=self.dataArray[indexPath.row];
47
     return listC;
82
     return listC;
48
 }
83
 }
49
 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
84
 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
50
 {
85
 {
51
-    return 5;
86
+    return self.dataArray.count;
52
 }
87
 }
53
 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
88
 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
54
 {
89
 {
97
 
132
 
98
 -(void)addAccountviews
133
 -(void)addAccountviews
99
 {
134
 {
135
+    UIView *headV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 134)];
136
+    
100
     UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 104)];
137
     UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 104)];
101
     backV.backgroundColor=[UIColor gradientOneColor:[UIColor colorWithHexString:@"#FF235F"] toColor:[UIColor colorWithHexString:@"#FF7676"] Width:SCREEN_WIDTH];
138
     backV.backgroundColor=[UIColor gradientOneColor:[UIColor colorWithHexString:@"#FF235F"] toColor:[UIColor colorWithHexString:@"#FF7676"] Width:SCREEN_WIDTH];
102
-    self.accountView.tableHeaderView=backV;
103
-    
139
+    self.accountView.tableHeaderView=headV;
104
     
140
     
141
+    [headV addSubview:backV];
105
     _accountMoneyLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, backV.height)];
142
     _accountMoneyLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, backV.height)];
106
     _accountMoneyLabel.center=backV.center;
143
     _accountMoneyLabel.center=backV.center;
107
     _accountMoneyLabel.font=[UIFont systemFontOfSize:48];
144
     _accountMoneyLabel.font=[UIFont systemFontOfSize:48];
115
     _accountMoneyLabel.attributedText = str;
152
     _accountMoneyLabel.attributedText = str;
116
     [backV addSubview:_accountMoneyLabel];
153
     [backV addSubview:_accountMoneyLabel];
117
     
154
     
155
+    
156
+    _tipeLabel=[[UILabel alloc]initWithFrame:CGRectMake(10, backV.bottom, SCREEN_WIDTH-20, 30)];
157
+    _tipeLabel.font=[UIFont systemFontOfSize:12];
158
+    _tipeLabel.textColor=[UIColor colorWithHexString:@"#999999"];
159
+    [headV addSubview:_tipeLabel];
160
+}
161
+
162
+-(NSMutableArray *)dataArray
163
+{
164
+    if (!_dataArray) {
165
+        _dataArray=[NSMutableArray array];
166
+    }
167
+    return _dataArray;
118
 }
168
 }
119
 @end
169
 @end

+ 2 - 0
KuDianProject/Earning/Controller/KDPForecastOrderListVC.h

11
 NS_ASSUME_NONNULL_BEGIN
11
 NS_ASSUME_NONNULL_BEGIN
12
 
12
 
13
 @interface KDPForecastOrderListVC : KDPMainViewController
13
 @interface KDPForecastOrderListVC : KDPMainViewController
14
+@property(nonatomic,copy)NSString *yearMonthDay;
15
+@property(nonatomic,copy)NSString *isDay;
14
 
16
 
15
 @end
17
 @end
16
 
18
 

+ 14 - 0
KuDianProject/Earning/Controller/KDPForecastOrderListVC.m

12
 @interface KDPForecastOrderListVC ()<UITableViewDelegate,UITableViewDataSource>
12
 @interface KDPForecastOrderListVC ()<UITableViewDelegate,UITableViewDataSource>
13
 {
13
 {
14
     UILabel *_orderLabel;
14
     UILabel *_orderLabel;
15
+    
16
+    NSInteger page_num;
15
 }
17
 }
18
+
16
 @property(nonatomic,strong)UITableView *forecastView;
19
 @property(nonatomic,strong)UITableView *forecastView;
17
 
20
 
18
 
21
 
24
 - (void)viewDidLoad {
27
 - (void)viewDidLoad {
25
     [super viewDidLoad];
28
     [super viewDidLoad];
26
     [self setNavUI];
29
     [self setNavUI];
30
+    page_num = 1;
27
 }
31
 }
28
 -(void)setNavUI
32
 -(void)setNavUI
29
 {
33
 {
34
     [self.view addSubview:self.forecastView];
38
     [self.view addSubview:self.forecastView];
35
     
39
     
36
 }
40
 }
41
+-(void)getMonthOrderList
42
+{
43
+    [LoadingView show];
44
+    NSDictionary *param=@{@"page":@(page_num),@"yearMonthDay":self.yearMonthDay,@"type":@"1",@"isDay":self.isDay};
45
+    [KDPNetworkRequestHTTP postURL:foreastDetailURL params:param success:^(id  _Nonnull json) {
46
+        [LoadingView dismiss];
47
+    } failure:^(NSError * _Nonnull error) {
48
+        [LoadingView dismiss];
49
+    }];
50
+}
37
 
51
 
38
 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
52
 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
39
 {
53
 {

+ 27 - 2
KuDianProject/Earning/Controller/KDPForecastVC.m

12
 @interface KDPForecastVC ()<UITableViewDelegate,UITableViewDataSource>
12
 @interface KDPForecastVC ()<UITableViewDelegate,UITableViewDataSource>
13
 {
13
 {
14
     UILabel *_orderNumMoneyLabel;
14
     UILabel *_orderNumMoneyLabel;
15
+    
15
 }
16
 }
17
+@property(nonatomic,strong)NSMutableArray *dataArray;
16
 @property(nonatomic,strong)UITableView *forecastView;
18
 @property(nonatomic,strong)UITableView *forecastView;
17
 
19
 
18
 @end
20
 @end
22
 - (void)viewDidLoad {
24
 - (void)viewDidLoad {
23
     [super viewDidLoad];
25
     [super viewDidLoad];
24
     [self setNavUI];
26
     [self setNavUI];
27
+    [self getForecastEarn];
28
+    
29
+}
30
+-(void)getForecastEarn
31
+{
32
+    [LoadingView show];
33
+    [KDPNetworkRequestHTTP postURL:foreastURL params:@{@"type":@"1"} success:^(id  _Nonnull json) {
34
+        _orderNumMoneyLabel.text=[NSString stringWithFormat:@"预估订单:%@  收益:%@元",json[@"total_count"],json[@"total_rebate"]];
35
+        [self.dataArray removeAllObjects];
36
+        [self.dataArray addObjectsFromArray:[NSArray yy_modelArrayWithClass:[KDPBalanceModel class] json:json[@"all_month"]]];
37
+        [self.forecastView reloadData];
38
+        [LoadingView dismiss];
39
+    } failure:^(NSError * _Nonnull error) {
40
+        [LoadingView dismiss];
41
+    }];
25
 }
42
 }
26
 -(void)setNavUI
43
 -(void)setNavUI
27
 {
44
 {
40
         listC=[[KDPForecastListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"fore"];
57
         listC=[[KDPForecastListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"fore"];
41
         listC.selectionStyle=UITableViewCellSelectionStyleNone;
58
         listC.selectionStyle=UITableViewCellSelectionStyleNone;
42
     }
59
     }
43
-    listC.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
60
+    listC.model=self.dataArray[indexPath.row]; listC.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
44
     return listC;
61
     return listC;
45
 }
62
 }
46
 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
63
 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
47
 {
64
 {
48
-    return 5;
65
+    return self.dataArray.count;
49
 }
66
 }
50
 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
67
 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
51
 {
68
 {
108
     lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
125
     lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
109
     [backV addSubview:lineV];
126
     [backV addSubview:lineV];
110
 }
127
 }
128
+
129
+-(NSMutableArray *)dataArray
130
+{
131
+    if (!_dataArray) {
132
+        _dataArray=[NSMutableArray array];
133
+    }
134
+    return _dataArray;
135
+}
111
 @end
136
 @end

+ 2 - 1
KuDianProject/Earning/View/KDPAccountListCell.h

7
 //
7
 //
8
 
8
 
9
 #import <UIKit/UIKit.h>
9
 #import <UIKit/UIKit.h>
10
-
10
+#import "KDPBalanceModel.h"
11
 NS_ASSUME_NONNULL_BEGIN
11
 NS_ASSUME_NONNULL_BEGIN
12
 
12
 
13
 @interface KDPAccountListCell : UITableViewCell
13
 @interface KDPAccountListCell : UITableViewCell
16
 @property(nonatomic,strong)UILabel *timeLabel;
16
 @property(nonatomic,strong)UILabel *timeLabel;
17
 @property(nonatomic,strong)UILabel *moneyLabel;
17
 @property(nonatomic,strong)UILabel *moneyLabel;
18
 @property(nonatomic,strong)UILabel *tipeLabel;
18
 @property(nonatomic,strong)UILabel *tipeLabel;
19
+@property(nonatomic,strong)KDPBalanceModel *model;
19
 @end
20
 @end
20
 
21
 
21
 NS_ASSUME_NONNULL_END
22
 NS_ASSUME_NONNULL_END

+ 19 - 2
KuDianProject/Earning/View/KDPAccountListCell.m

38
         self.moneyLabel=[[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-155, self.iconImgV.top, 140, 25)];
38
         self.moneyLabel=[[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-155, self.iconImgV.top, 140, 25)];
39
         self.moneyLabel.textColor=[UIColor colorWithHexString:fontColor];
39
         self.moneyLabel.textColor=[UIColor colorWithHexString:fontColor];
40
         self.moneyLabel.font=[UIFont boldSystemFontOfSize:18];
40
         self.moneyLabel.font=[UIFont boldSystemFontOfSize:18];
41
-        self.moneyLabel.text=@"--";
41
+//        self.moneyLabel.text=@"--";
42
         self.moneyLabel.textAlignment=NSTextAlignmentRight;
42
         self.moneyLabel.textAlignment=NSTextAlignmentRight;
43
         [self addSubview:self.moneyLabel];
43
         [self addSubview:self.moneyLabel];
44
         
44
         
47
        
47
        
48
         self.tipeLabel.font=[UIFont systemFontOfSize:12];
48
         self.tipeLabel.font=[UIFont systemFontOfSize:12];
49
         self.tipeLabel.textAlignment=NSTextAlignmentRight;
49
         self.tipeLabel.textAlignment=NSTextAlignmentRight;
50
-        self.tipeLabel.text=@"申请中";
50
+        
51
         [self addSubview:self.tipeLabel];
51
         [self addSubview:self.tipeLabel];
52
         
52
         
53
         UIView *lineV=[[UIView alloc]initWithFrame:CGRectMake(self.iconImgV.right, 79, self.width-self.iconImgV.right-10, 1)];
53
         UIView *lineV=[[UIView alloc]initWithFrame:CGRectMake(self.iconImgV.right, 79, self.width-self.iconImgV.right-10, 1)];
57
     }
57
     }
58
     return self;
58
     return self;
59
 }
59
 }
60
+
61
+-(void)setModel:(KDPBalanceModel *)model
62
+{
63
+    _model=model;
64
+    [self.iconImgV sd_setImageWithURL:[NSURL URLWithString:model.img]];
65
+    self.titleLabel.text=model.title;
66
+    self.timeLabel.text=model.create_time;
67
+    self.tipeLabel.text=model.message;
68
+    if (model.mode.integerValue == 1) {//佣金收入
69
+        self.moneyLabel.textColor=[UIColor colorWithHexString:@"#FF8712"];
70
+        self.moneyLabel.text=[NSString stringWithFormat:@"%@",model.rebate];
71
+    }else if (model.mode.integerValue == 2){//提现
72
+        self.moneyLabel.textColor=[UIColor colorWithHexString:@"#343434"];
73
+        self.moneyLabel.text=[NSString stringWithFormat:@"%@",model.rebate];
74
+    }
75
+    
76
+}
60
 @end
77
 @end

+ 4 - 0
KuDianProject/Earning/View/KDPEarnTableHeadView.h

16
 
16
 
17
 @property(nonatomic,strong)SSWlineIncomeChartView *chartView;//图表
17
 @property(nonatomic,strong)SSWlineIncomeChartView *chartView;//图表
18
 
18
 
19
+@property(nonatomic,strong)UIButton *volumeButton;
20
+@property(nonatomic,strong)UIButton *incomeButton;
21
+@property(nonatomic,copy)NSString *chartcate;
22
+@property(nonatomic,copy)NSString *chartType;
19
 @property(nonatomic,copy)void(^accountBlock)(void);
23
 @property(nonatomic,copy)void(^accountBlock)(void);
20
 @end
24
 @end
21
 
25
 

+ 59 - 7
KuDianProject/Earning/View/KDPEarnTableHeadView.m

36
     backv.userInteractionEnabled=YES;
36
     backv.userInteractionEnabled=YES;
37
     [backv addSubview:self.chartView];
37
     [backv addSubview:self.chartView];
38
    
38
    
39
-    self.chartView.xValuesArr=[NSMutableArray arrayWithArray:@[@"13:00",@"13:00",@"13:00",@"13:00",@"13:00"]];
40
-    self.chartView.yValuesArr=[NSMutableArray arrayWithArray:@[@"0",@"50",@"100",@"200",@"300"]];
39
+    
41
     
40
     
42
 }
41
 }
43
 #pragma mark---添加切换按钮
42
 #pragma mark---添加切换按钮
45
 {
44
 {
46
     UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(10, 80, self.width-20, 60)];
45
     UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(10, 80, self.width-20, 60)];
47
     [self addSubview:backV];
46
     [self addSubview:backV];
48
-    
49
-    
47
+    self.chartType=@"0";
48
+    self.chartcate=@"0";
49
+    [self requestChartData];
50
     UIButton *volumeButton =[[UIButton alloc]initWithFrame:CGRectMake(14, 15, 70, 30)];
50
     UIButton *volumeButton =[[UIButton alloc]initWithFrame:CGRectMake(14, 15, 70, 30)];
51
     [volumeButton setTitle:@"销量走势" forState:UIControlStateNormal];
51
     [volumeButton setTitle:@"销量走势" forState:UIControlStateNormal];
52
+    self.volumeButton =volumeButton;
53
+    [volumeButton addTarget:self action:@selector(volumeClickButton) forControlEvents:UIControlEventTouchUpInside];
52
     [volumeButton setTitleColor:[UIColor colorWithHexString:@"#333333"] forState:UIControlStateNormal];
54
     [volumeButton setTitleColor:[UIColor colorWithHexString:@"#333333"] forState:UIControlStateNormal];
53
     volumeButton.titleLabel.font=[UIFont systemFontOfSize:16];
55
     volumeButton.titleLabel.font=[UIFont systemFontOfSize:16];
54
     [backV addSubview:volumeButton];
56
     [backV addSubview:volumeButton];
58
     [backV addSubview:LineV];
60
     [backV addSubview:LineV];
59
     
61
     
60
     UIButton *incomeButton =[[UIButton alloc]initWithFrame:CGRectMake(LineV.right+5, 15, 70, 30)];
62
     UIButton *incomeButton =[[UIButton alloc]initWithFrame:CGRectMake(LineV.right+5, 15, 70, 30)];
61
-    [incomeButton setTitle:@"销量走势" forState:UIControlStateNormal];
63
+    [incomeButton addTarget:self action:@selector(incomeClickButton) forControlEvents:UIControlEventTouchUpInside];
64
+    [incomeButton setTitle:@"收益走势" forState:UIControlStateNormal];
62
     [incomeButton setTitleColor:[UIColor colorWithHexString:@"#666666"] forState:UIControlStateNormal];
65
     [incomeButton setTitleColor:[UIColor colorWithHexString:@"#666666"] forState:UIControlStateNormal];
66
+    self.incomeButton=incomeButton;
63
     incomeButton.titleLabel.font=[UIFont systemFontOfSize:16];
67
     incomeButton.titleLabel.font=[UIFont systemFontOfSize:16];
64
     [backV addSubview:incomeButton];
68
     [backV addSubview:incomeButton];
65
     
69
     
73
         _chartView.unit=@"单";
77
         _chartView.unit=@"单";
74
         _chartView.yScaleValue=100;
78
         _chartView.yScaleValue=100;
75
         _chartView.showEachYValus=NO;
79
         _chartView.showEachYValus=NO;
76
-        
80
+        __weak KDPEarnTableHeadView *headview=self;
81
+        _chartView.changeMineBtn = ^(UIButton * _Nonnull button) {
82
+            if (button.tag == 1001) {//昨天
83
+                headview.chartType=@"1";
84
+            }else if (button.tag == 2001){//本月
85
+                headview.chartType=@"2";
86
+            }else{//今天
87
+                headview.chartType=@"0";
88
+            }
89
+            [headview requestChartData];
90
+        };
77
     }
91
     }
78
     return _chartView;
92
     return _chartView;
79
 }
93
 }
111
     lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
125
     lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
112
     [backv addSubview:lineV];
126
     [backv addSubview:lineV];
113
 }
127
 }
114
-
128
+#pragma makr---销量走势
129
+-(void)volumeClickButton
130
+{
131
+    [self.volumeButton setTitleColor:[UIColor colorWithHexString:fontColor] forState:UIControlStateNormal];
132
+    [self.incomeButton setTitleColor:[UIColor colorWithHexString:@"#666666"] forState:UIControlStateNormal];
133
+    self.chartcate=@"0";
134
+    [self requestChartData];
135
+}
136
+#pragma mark---收益走势
137
+-(void)incomeClickButton
138
+{
139
+    [self.incomeButton setTitleColor:[UIColor colorWithHexString:fontColor] forState:UIControlStateNormal];
140
+    [self.volumeButton setTitleColor:[UIColor colorWithHexString:@"#666666"] forState:UIControlStateNormal];
141
+    self.chartcate=@"1";
142
+    [self requestChartData];
143
+}
115
 
144
 
116
 #pragma mark---账号余额
145
 #pragma mark---账号余额
117
 -(void)balanclickBtn
146
 -(void)balanclickBtn
120
         self.accountBlock();
149
         self.accountBlock();
121
     }
150
     }
122
 }
151
 }
152
+
153
+
154
+-(void)requestChartData
155
+{
156
+    [LoadingView show];
157
+    NSDictionary *param=@{@"type":self.chartType,@"cate":self.chartcate};
158
+    [KDPNetworkRequestHTTP postURL:ChartAllMoneyURL params:param success:^(id  _Nonnull json) {
159
+        [LoadingView dismiss];
160
+        NSArray *arrya =json;
161
+        NSMutableArray *xArr=[NSMutableArray array];
162
+        NSMutableArray *yArr=[NSMutableArray array];
163
+        for (NSDictionary *dic in arrya) {
164
+            [yArr addObject:dic[@"num"]];
165
+            [xArr addObject:dic[@"time"]];
166
+        }
167
+        self.chartView.barWidth=SCREEN_WIDTH/xArr.count-80/xArr.count;
168
+        self.chartView.xValuesArr=xArr;
169
+        self.chartView.yValuesArr=yArr;
170
+        
171
+    } failure:^(NSError * _Nonnull error) {
172
+        [LoadingView dismiss];
173
+    }];
174
+}
123
 @end
175
 @end

+ 3 - 1
KuDianProject/Earning/View/KDPForecastListCell.h

7
 //
7
 //
8
 
8
 
9
 #import <UIKit/UIKit.h>
9
 #import <UIKit/UIKit.h>
10
-
10
+#import "KDPBalanceModel.h"
11
 NS_ASSUME_NONNULL_BEGIN
11
 NS_ASSUME_NONNULL_BEGIN
12
 
12
 
13
 @interface KDPForecastListCell : UITableViewCell
13
 @interface KDPForecastListCell : UITableViewCell
16
 @property(nonatomic,strong)UILabel *numberLabel;
16
 @property(nonatomic,strong)UILabel *numberLabel;
17
 @property(nonatomic,strong)UILabel *moneyLabel;
17
 @property(nonatomic,strong)UILabel *moneyLabel;
18
 
18
 
19
+@property(nonatomic,strong)KDPBalanceModel *model;
20
+
19
 @end
21
 @end
20
 
22
 
21
 NS_ASSUME_NONNULL_END
23
 NS_ASSUME_NONNULL_END

+ 12 - 0
KuDianProject/Earning/View/KDPForecastListCell.m

48
     return self;
48
     return self;
49
 }
49
 }
50
 
50
 
51
+-(void)setModel:(KDPBalanceModel *)model
52
+{
53
+    _model = model;
54
+    NSArray *array =[model.yearAndMonth componentsSeparatedByString:@"-"];
55
+    if (array.count > 1) {
56
+        self.timeMonthLabel.text=[NSString stringWithFormat:@"%@月",array[1]];
57
+        self.timeYearLabel.text=[NSString stringWithFormat:@"%@年",array[0]];
58
+    }
59
+    self.numberLabel.text=[NSString stringWithFormat:@"共%@单",model.totalOrder];
60
+    self.moneyLabel.text=[NSString stringWithFormat:@"¥%@",model.rebateMoney];
61
+}
62
+
51
 @end
63
 @end

+ 1 - 0
KuDianProject/Login/model/KDPAccountModel.h

19
 @property(nonatomic,strong)NSString *img;
19
 @property(nonatomic,strong)NSString *img;
20
 @property(nonatomic,strong)NSString *has_kwai;
20
 @property(nonatomic,strong)NSString *has_kwai;
21
 
21
 
22
+@property(nonatomic,strong)NSString *is_hidden;//判断金额是否显示
22
 
23
 
23
 @property (nonatomic, strong) NSString *name;
24
 @property (nonatomic, strong) NSString *name;
24
 
25
 

+ 2 - 2
KuDianProject/Login/model/KDPAccountModel.m

36
     [encoder encodeObject:self.name forKey:@"name"];
36
     [encoder encodeObject:self.name forKey:@"name"];
37
     [encoder encodeObject:self.phone forKey:@"phone"];
37
     [encoder encodeObject:self.phone forKey:@"phone"];
38
     [encoder encodeObject:self.has_kwai forKey:@"has_kwai"];
38
     [encoder encodeObject:self.has_kwai forKey:@"has_kwai"];
39
-    
39
+    [encoder encodeObject:self.is_hidden forKey:@"is_hidden"];
40
     //
40
     //
41
 }
41
 }
42
 
42
 
58
         self.phone=[decoder decodeObjectForKey:@"phone"];
58
         self.phone=[decoder decodeObjectForKey:@"phone"];
59
         self.sex=[decoder decodeObjectForKey:@"sex"];
59
         self.sex=[decoder decodeObjectForKey:@"sex"];
60
         self.has_kwai=[decoder decodeObjectForKey:@"has_kwai"];
60
         self.has_kwai=[decoder decodeObjectForKey:@"has_kwai"];
61
-        
61
+        self.is_hidden=[decoder decodeObjectForKey:@"is_hidden"];
62
     }
62
     }
63
     return self;
63
     return self;
64
 }
64
 }

+ 1 - 1
KuDianProject/MainTab/KDPNavBar.m

24
         }];
24
         }];
25
         
25
         
26
         [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
26
         [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
27
-            make.top.mas_equalTo(self.mas_bottom).offset(1);
27
+            make.top.mas_equalTo(self.mas_bottom).offset(-1);
28
             make.left.right.mas_equalTo(0);
28
             make.left.right.mas_equalTo(0);
29
             make.height.mas_equalTo(1);
29
             make.height.mas_equalTo(1);
30
         }];
30
         }];

+ 4 - 0
KuDianProject/PrefixHeader.pch

61
 #import "KDPGoodsModel.h"
61
 #import "KDPGoodsModel.h"
62
 #import "KDPWebInteractionVC.h"
62
 #import "KDPWebInteractionVC.h"
63
 #import "KDPProjectListVC.h"
63
 #import "KDPProjectListVC.h"
64
+#import "KDPCollectHistoryVC.h"
65
+#import "KDPRecommendGoodCell.h"
66
+#import "KDPAccountModel.h"
67
+#import "KDPBalanceModel.h"
64
 
68
 
65
 // 类别
69
 // 类别
66
 #import "UIView+Gradient.h"
70
 #import "UIView+Gradient.h"

+ 2 - 0
KuDianProject/Public/KDPublicMethod.h

22
 
22
 
23
 #pragma mark--计算高度
23
 #pragma mark--计算高度
24
 + (CGFloat)getHeightByWidth:(CGFloat)width title:(NSString *)title font:(UIFont*)font;
24
 + (CGFloat)getHeightByWidth:(CGFloat)width title:(NSString *)title font:(UIFont*)font;
25
+
26
++(BOOL)is_hiddenMoney;
25
 @end
27
 @end
26
 
28
 
27
 NS_ASSUME_NONNULL_END
29
 NS_ASSUME_NONNULL_END

+ 10 - 0
KuDianProject/Public/KDPublicMethod.m

143
     CGFloat height = label.frame.size.height;
143
     CGFloat height = label.frame.size.height;
144
     return ceil(height);
144
     return ceil(height);
145
 }
145
 }
146
+
147
++(BOOL)is_hiddenMoney
148
+{
149
+    KDPAccountModel *model =[KDPAccountTool account];
150
+    if (model.is_hidden.integerValue == 1) {
151
+        return YES;
152
+    }
153
+    return NO;
154
+    
155
+}
146
 @end
156
 @end

+ 34 - 0
KuDianProject/TOP/Controller/KDPBalanceModel.h

1
+//
2
+//  KDPBalanceModel.h
3
+//  KuDianProject
4
+//
5
+//  Created by 学丽 on 2019/7/10.
6
+//  Copyright © 2019 KDP. All rights reserved.
7
+//
8
+
9
+#import <Foundation/Foundation.h>
10
+
11
+NS_ASSUME_NONNULL_BEGIN
12
+
13
+@interface KDPBalanceModel : NSObject
14
+@property(nonatomic,copy) NSString *Id;
15
+@property(nonatomic,copy) NSString *message;
16
+@property(nonatomic,copy) NSString *create_time;
17
+@property(nonatomic,copy) NSString *type;//0 申请中  1 已通过  2未通过
18
+@property(nonatomic,copy) NSString *img;
19
+@property(nonatomic,copy) NSString *rebate;
20
+@property(nonatomic,copy) NSString *problem_url;//提现说明
21
+@property(nonatomic,copy) NSString *mode;//1佣金 2提现
22
+@property(nonatomic,copy) NSString *title;
23
+
24
+@property(nonatomic,copy)NSString*rebateMoney;
25
+@property(nonatomic,copy)NSString*yearAndMonth;
26
+@property(nonatomic,copy)NSString*totalOrder;
27
+
28
+
29
+
30
+
31
+
32
+@end
33
+
34
+NS_ASSUME_NONNULL_END

+ 19 - 0
KuDianProject/TOP/Controller/KDPBalanceModel.m

1
+//
2
+//  KDPBalanceModel.m
3
+//  KuDianProject
4
+//
5
+//  Created by 学丽 on 2019/7/10.
6
+//  Copyright © 2019 KDP. All rights reserved.
7
+//
8
+
9
+#import "KDPBalanceModel.h"
10
+
11
+@implementation KDPBalanceModel
12
++ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper {
13
+    return @{@"Id":@"id"};
14
+}
15
+-(void)setValue:(id)value forUndefinedKey:(NSString *)key
16
+{
17
+    
18
+}
19
+@end

+ 96 - 8
KuDianProject/TOP/Controller/KDPGoodDetailVC.m

20
     
20
     
21
     
21
     
22
 }
22
 }
23
-@property(nonatomic,strong)UIButton *collectButton;
23
+
24
 @property(nonatomic,strong)UIScrollView *detailBottonView;
24
 @property(nonatomic,strong)UIScrollView *detailBottonView;
25
 @property(nonatomic,strong)KDPDetailGoodInformationView *infoView;
25
 @property(nonatomic,strong)KDPDetailGoodInformationView *infoView;
26
 @property(nonatomic,strong)KDPSellingPointView *pointView;
26
 @property(nonatomic,strong)KDPSellingPointView *pointView;
62
     }
62
     }
63
     NSLog(@"释放了------------");
63
     NSLog(@"释放了------------");
64
 }
64
 }
65
-#pragma makr---商品详情
65
+#pragma mark---商品详情
66
 -(void)getGoodDetail
66
 -(void)getGoodDetail
67
 {
67
 {
68
     if (self.model.goods_id.length<=0) {
68
     if (self.model.goods_id.length<=0) {
78
         self.shopView.shopDic=self.detailModel.shop;
78
         self.shopView.shopDic=self.detailModel.shop;
79
         [self loadRequestWeb];
79
         [self loadRequestWeb];
80
         [LoadingView dismiss];
80
         [LoadingView dismiss];
81
-        
81
+        [self isCollect];
82
+        [self saveHistoryModel:self.detailModel];
82
     } failure:^(NSError * _Nonnull error) {
83
     } failure:^(NSError * _Nonnull error) {
83
         [LoadingView dismiss];
84
         [LoadingView dismiss];
84
     }];
85
     }];
107
     }
108
     }
108
 }
109
 }
109
 
110
 
110
-#pragma makr---赋值。卖点
111
+#pragma mark---赋值。卖点
111
 -(void)good_points
112
 -(void)good_points
112
 {
113
 {
113
     CGFloat height =[KDPublicMethod getHeightByWidth:SCREEN_WIDTH-40 title:self.detailModel.goods_point font:[UIFont systemFontOfSize:13]];
114
     CGFloat height =[KDPublicMethod getHeightByWidth:SCREEN_WIDTH-40 title:self.detailModel.goods_point font:[UIFont systemFontOfSize:13]];
262
     [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal];
263
     [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal];
263
     [returnBtn addTarget:self action:@selector(exitclickButton) forControlEvents:UIControlEventTouchUpInside];
264
     [returnBtn addTarget:self action:@selector(exitclickButton) forControlEvents:UIControlEventTouchUpInside];
264
     
265
     
265
-    self.collectButton=[[UIButton alloc]initWithFrame:CGRectMake(self.view.width-47, KDStatusHeight+10, 30, 30)];
266
-    [self.collectButton setImage:[UIImage imageNamed:@"detail_collection"] forState:UIControlStateNormal];
267
-    [self.view addSubview:self.collectButton];
266
+    UIButton * collectBtn=[[UIButton alloc]initWithFrame:CGRectMake(self.view.width-47, KDStatusHeight+10, 30, 30)];
267
+    [collectBtn setImage:[UIImage imageNamed:@"detail_collection"] forState:UIControlStateNormal];
268
+    [collectBtn addTarget:self action:@selector(collectPageClickSel) forControlEvents:UIControlEventTouchUpInside];
269
+    [self.view addSubview:collectBtn];
268
     
270
     
269
     
271
     
270
 }
272
 }
322
 }
324
 }
323
 
325
 
324
 
326
 
325
-#pragma makr----收藏
327
+#pragma mark----收藏
326
 -(void)detailCollectClickButton
328
 -(void)detailCollectClickButton
327
 {
329
 {
330
+    [LoadingView show];
331
+    NSString *collect=self.detailModel.is_collect;
332
+    if (collect.integerValue == 0) {//收藏
333
+        collect=@"1";
334
+    }else{
335
+        collect=@"0";
336
+    }
337
+    NSDictionary *param=@{@"is_add":collect,@"goods_id":self.detailModel.goods_id};
338
+    [KDPNetworkRequestHTTP postURL:collectURL params:param success:^(id  _Nonnull json) {
339
+        [LoadingView dismiss];
340
+        if ([json[@"flag"] integerValue] == 1) {
341
+            [MBProgressHUD showSuccess:@"收藏成功"];
342
+        }
343
+        self.detailModel.is_collect=collect;
344
+        [self isCollect];
345
+    } failure:^(NSError * _Nonnull error) {
346
+        [LoadingView dismiss];
347
+    }];
348
+}
349
+#pragma mark---判断是否收藏
350
+-(void)isCollect
351
+{
352
+    if (self.detailModel.is_collect.integerValue == 1) {
353
+        collectButton.selected = YES;
354
+    }else{
355
+        collectButton.selected=NO;
356
+    }
357
+}
358
+-(void)collectPageClickSel
359
+{
360
+    KDPCollectHistoryVC *histT=[[KDPCollectHistoryVC alloc]init];
361
+    [self.navigationController pushViewController:histT animated:YES];
362
+}
363
+
364
+#pragma mark---添加历史记录
365
+-(void)saveHistoryModel:(KDPGoodsModel *)model
366
+{
367
+    NSString *goods_id=@"";
368
+    if (model.goods_id.length>0) {
369
+        goods_id= model.goods_id;
370
+    }
371
+    NSString *price=@"";
372
+    if (model.price.length>0) {
373
+        price = model.price;
374
+    }
375
+    NSString *img=@"";
376
+    if (model.img.length>0) {
377
+        img =model.img;
378
+    }
379
+    
380
+    NSString *commission_rate=@"";
381
+    if (model.commission_rate.length>0) {
382
+        commission_rate = model.commission_rate;
383
+    }
384
+    NSString *commission_price=@"";
385
+    if (model.commission_price.length>0) {
386
+        commission_price = model.commission_price;
387
+    }
388
+    NSString *shop_title=@"";
389
+    if ([model.shop[@"title"] length]>0) {
390
+        shop_title = model.shop[@"title"];
391
+    }
392
+    NSString *title=@"";
393
+    if (model.title.length>0) {
394
+        title = model.title;
395
+    }
396
+    NSString *volume=@"";
397
+    if (model.volume.length>0) {
398
+        volume = model.volume;
399
+    }
400
+    
401
+    NSString *live_price=@"";
402
+    if (model.discount_price.length>0) {
403
+        live_price = model.discount_price;
404
+    }
405
+    
406
+    NSString *shop_type=@"";
407
+    if (model.shop_type.length>0) {
408
+        shop_type= model.shop_type;
409
+    }
328
     
410
     
411
+    NSDictionary *paramDic =@{@"title":title,@"img":img,@"goods_id":goods_id,@"volume":volume,@"shop_type":shop_type,@"shop_title":shop_title,@"price":price,@"commission_rate":commission_rate,@"discount_price":live_price,@"commission_price":commission_price};
412
+    [KDPNetworkRequestHTTP postURL:historyURL params:paramDic success:^(id  _Nonnull json) {
413
+        NSLog(@"%@",json);
414
+    } failure:^(NSError * _Nonnull error) {
415
+        
416
+    }];
329
 }
417
 }
330
 
418
 
331
 @end
419
 @end

+ 1 - 1
KuDianProject/TOP/Controller/KDPProjectListVC.h

12
 
12
 
13
 @interface KDPProjectListVC : KDPMainViewController
13
 @interface KDPProjectListVC : KDPMainViewController
14
 @property(nonatomic,strong)NSString *projectID;
14
 @property(nonatomic,strong)NSString *projectID;
15
-
15
+@property(nonatomic,strong)NSString *type;
16
 @end
16
 @end
17
 
17
 
18
 NS_ASSUME_NONNULL_END
18
 NS_ASSUME_NONNULL_END

+ 99 - 10
KuDianProject/TOP/Controller/KDPProjectListVC.m

8
 
8
 
9
 #import "KDPProjectListVC.h"
9
 #import "KDPProjectListVC.h"
10
 
10
 
11
-@interface KDPProjectListVC ()
12
-
11
+@interface KDPProjectListVC ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
12
+@property(nonatomic,strong)UICollectionView *listview;
13
+@property(nonatomic,assign)NSInteger pageNum;
14
+@property(nonatomic,strong)NSMutableArray *dataArray;
13
 @end
15
 @end
14
 
16
 
15
 @implementation KDPProjectListVC
17
 @implementation KDPProjectListVC
16
 
18
 
17
 - (void)viewDidLoad {
19
 - (void)viewDidLoad {
18
     [super viewDidLoad];
20
     [super viewDidLoad];
19
-    // Do any additional setup after loading the view.
21
+    self.pageNum=1;
22
+    [self.navBar addleftReturnButton:self selector:@selector(returnClickBtn)];
23
+    self.view.backgroundColor=[UIColor whiteColor];
24
+    [self.view addSubview:self.listview];
25
+    [self.listview mas_makeConstraints:^(MASConstraintMaker *make) {
26
+        make.left.mas_equalTo(0);
27
+        make.top.mas_equalTo(KDNavBarHeight);
28
+        make.height.mas_equalTo(SCREEN_HEIGHT-KDNavBarHeight);
29
+        make.width.mas_equalTo(SCREEN_WIDTH);
30
+    }];
31
+    [self goodListProject];
32
+    
33
+}
34
+-(void)goodListProject
35
+{
36
+    [LoadingView show];
37
+    NSDictionary *dics =@{@"page":@(self.pageNum),@"id":self.projectID,@"type":self.type,@"start_price":@"",@"end_price":@"",@"start_tk_rate":@""};
38
+    [KDPNetworkRequestHTTP postURL:projectGoodURL params:dics success:^(id  _Nonnull json) {
39
+        [LoadingView dismiss];
40
+        if (self.pageNum == 1) {
41
+            [self.dataArray removeAllObjects];
42
+        }
43
+        NSArray *array =[NSArray yy_modelArrayWithClass:[KDPGoodsModel class] json:json[@"data"]];
44
+        [self.dataArray addObjectsFromArray:array];
45
+        [self.listview reloadData];
46
+    } failure:^(NSError * _Nonnull error) {
47
+        [LoadingView dismiss];
48
+    }];
49
+}
50
+#pragma mark---CollectDelegate&&DataSource
51
+-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
52
+{
53
+    KDPRecommendGoodCell *recommC=[collectionView dequeueReusableCellWithReuseIdentifier:@"recomm" forIndexPath:indexPath];
54
+    recommC.model=self.dataArray[indexPath.row];
55
+    return recommC;
56
+}
57
+-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
58
+{
59
+    return self.dataArray.count;
60
+}
61
+-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
62
+{
63
+    return 1;
64
+}
65
+-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
66
+{
67
+    return CGSizeMake(SCREEN_WIDTH, 121);
68
+}
69
+-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
70
+{
71
+    KDPGoodDetailVC *goodDetail=[[KDPGoodDetailVC alloc]init];
72
+    goodDetail.model=self.dataArray[indexPath.row];
73
+    [self.navigationController pushViewController:goodDetail animated:YES];
20
 }
74
 }
21
 
75
 
22
-/*
23
-#pragma mark - Navigation
76
+-(void)returnClickBtn
77
+{
78
+    [self.navigationController popViewControllerAnimated:YES];
79
+}
80
+
81
+
82
+-(void)viewWillAppear:(BOOL)animated
83
+{
84
+    [super viewWillAppear:animated];
85
+    self.navigationController.navigationBar.hidden=YES;
86
+    self.tabBarController.tabBar.hidden=YES;
87
+}
88
+-(void)viewWillDisappear:(BOOL)animated
89
+{
90
+    [super viewWillDisappear:animated];
91
+    self.tabBarController.tabBar.hidden=NO;
92
+}
93
+
94
+-(UICollectionView *)listview
95
+{
96
+    if (!_listview) {
97
+        UICollectionViewFlowLayout *layout =[[UICollectionViewFlowLayout alloc]init];
98
+        layout.minimumLineSpacing=0;
99
+        layout.minimumInteritemSpacing=0;
100
+        
101
+        _listview=[[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) collectionViewLayout:layout];
102
+        _listview.showsVerticalScrollIndicator=NO;
103
+        _listview.backgroundColor=[UIColor whiteColor];
104
+        _listview.delegate=self;
105
+        _listview.dataSource=self;
106
+        [_listview registerClass:[KDPRecommendGoodCell class] forCellWithReuseIdentifier:@"recomm"];
107
+        
108
+    }
109
+    return _listview;
110
+}
24
 
111
 
25
-// In a storyboard-based application, you will often want to do a little preparation before navigation
26
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
27
-    // Get the new view controller using [segue destinationViewController].
28
-    // Pass the selected object to the new view controller.
112
+-(NSMutableArray *)dataArray
113
+{
114
+    if (!_dataArray) {
115
+        _dataArray=[NSMutableArray array];
116
+        
117
+    }
118
+    return _dataArray;
29
 }
119
 }
30
-*/
31
 
120
 
32
 @end
121
 @end

+ 9 - 1
KuDianProject/TOP/Controller/KDPTopViewController.m

68
     [KDPNetworkRequestHTTP postURL:topIncomeUrl params:nil success:^(id  _Nonnull json) {
68
     [KDPNetworkRequestHTTP postURL:topIncomeUrl params:nil success:^(id  _Nonnull json) {
69
         self.orderNumber =json[@"num"];//总数量;
69
         self.orderNumber =json[@"num"];//总数量;
70
         self.order_rebate_money = json[@"total_rebate"];
70
         self.order_rebate_money = json[@"total_rebate"];
71
+       
72
+        
71
         [self.dataCollectionView reloadData];
73
         [self.dataCollectionView reloadData];
72
         [LoadingView dismiss];
74
         [LoadingView dismiss];
73
     } failure:^(NSError * _Nonnull error) {
75
     } failure:^(NSError * _Nonnull error) {
173
             }else if (model.click_type.integerValue == 3)
175
             }else if (model.click_type.integerValue == 3)
174
             {//x专题列表
176
             {//x专题列表
175
                 KDPProjectListVC *listV=[[KDPProjectListVC alloc]init];
177
                 KDPProjectListVC *listV=[[KDPProjectListVC alloc]init];
178
+                listV.navBar.navTitleLabel.text=model.title;
176
                 listV.projectID=model.click_param;
179
                 listV.projectID=model.click_param;
180
+                if (model.type.length == 0) {
181
+                    listV.type = @"module";
182
+                }else{
183
+                    listV.type = model.type;
184
+                }
177
                 [self.navigationController pushViewController:listV animated:YES];
185
                 [self.navigationController pushViewController:listV animated:YES];
178
             }
186
             }
179
         };
187
         };
186
     }
194
     }
187
     KDPLiveEarningCell *earinCell =[collectionView dequeueReusableCellWithReuseIdentifier:liveEarningCell forIndexPath:indexPath];
195
     KDPLiveEarningCell *earinCell =[collectionView dequeueReusableCellWithReuseIdentifier:liveEarningCell forIndexPath:indexPath];
188
     earinCell.orderNumgL.text=self.orderNumber;
196
     earinCell.orderNumgL.text=self.orderNumber;
189
-    earinCell.Forecastlabel.text=self.order_rebate_money;
197
+    earinCell.rebet_money=self.order_rebate_money;
190
     earinCell.liveDataBlock = ^{
198
     earinCell.liveDataBlock = ^{
191
         self.tabBarController.selectedIndex=2;
199
         self.tabBarController.selectedIndex=2;
192
     };
200
     };

+ 1 - 1
KuDianProject/TOP/View/Detail/KDPDetailGoodInformationView.m

34
         [self addSubview:self.detailTitleL];
34
         [self addSubview:self.detailTitleL];
35
         
35
         
36
         
36
         
37
-        self.priceL=[[UILabel alloc]initWithFrame:CGRectMake(10, self.detailTitleL.bottom+8, 200, 36)];
37
+        self.priceL=[[UILabel alloc]initWithFrame:CGRectMake(10, self.detailTitleL.bottom+8, 300, 36)];
38
         self.priceL.textColor=[UIColor blackColor];
38
         self.priceL.textColor=[UIColor blackColor];
39
         self.priceL.font=[UIFont boldSystemFontOfSize:25];
39
         self.priceL.font=[UIFont boldSystemFontOfSize:25];
40
         self.priceL.text=@"¥--";
40
         self.priceL.text=@"¥--";

+ 1 - 0
KuDianProject/TOP/View/KDPLiveEarningCell.h

13
 @interface KDPLiveEarningCell : UICollectionViewCell
13
 @interface KDPLiveEarningCell : UICollectionViewCell
14
 @property(nonatomic,strong)UILabel *orderNumgL;//订单数量
14
 @property(nonatomic,strong)UILabel *orderNumgL;//订单数量
15
 @property(nonatomic,strong)UILabel *Forecastlabel;//预估收益
15
 @property(nonatomic,strong)UILabel *Forecastlabel;//预估收益
16
+@property(nonatomic,strong)NSString *rebet_money;
16
 @property(nonatomic,strong)UIImageView *backImgV;
17
 @property(nonatomic,strong)UIImageView *backImgV;
17
 
18
 
18
 @property(nonatomic,copy)void(^liveDataBlock)(void);
19
 @property(nonatomic,copy)void(^liveDataBlock)(void);

+ 33 - 3
KuDianProject/TOP/View/KDPLiveEarningCell.m

16
         self.backImgV=[[UIImageView alloc]init];
16
         self.backImgV=[[UIImageView alloc]init];
17
         self.backImgV.image=[UIImage imageNamed:@"top_icon-backnew"];
17
         self.backImgV.image=[UIImage imageNamed:@"top_icon-backnew"];
18
         [self addSubview:self.backImgV];
18
         [self addSubview:self.backImgV];
19
-        
19
+        self.backImgV.userInteractionEnabled=YES;
20
         
20
         
21
         [self.backImgV mas_makeConstraints:^(MASConstraintMaker *make) {
21
         [self.backImgV mas_makeConstraints:^(MASConstraintMaker *make) {
22
             make.left.top.right.mas_equalTo(0);
22
             make.left.top.right.mas_equalTo(0);
73
     
73
     
74
     UIView *oderV=[[UIView alloc]init];
74
     UIView *oderV=[[UIView alloc]init];
75
     oderV.backgroundColor=[UIColor clearColor];
75
     oderV.backgroundColor=[UIColor clearColor];
76
+    oderV.userInteractionEnabled=YES;
76
     [self.backImgV addSubview:oderV];
77
     [self.backImgV addSubview:oderV];
77
     [oderV mas_makeConstraints:^(MASConstraintMaker *make) {
78
     [oderV mas_makeConstraints:^(MASConstraintMaker *make) {
78
         make.width.mas_equalTo(114);
79
         make.width.mas_equalTo(114);
108
     
109
     
109
     UIButton *changeBtn =[[UIButton alloc]init];
110
     UIButton *changeBtn =[[UIButton alloc]init];
110
     [changeBtn setImage:[UIImage imageNamed:@"open_hidden_icon"] forState:UIControlStateNormal];
111
     [changeBtn setImage:[UIImage imageNamed:@"open_hidden_icon"] forState:UIControlStateNormal];
111
-    [changeBtn addTarget:self action:@selector(changeBtnclickBtn) forControlEvents:UIControlEventTouchUpInside];
112
+    [changeBtn setImage:[UIImage imageNamed:@"close_hidden_icon"] forState:UIControlStateSelected];
113
+    changeBtn.userInteractionEnabled=YES;
114
+    changeBtn.selected=[KDPublicMethod is_hiddenMoney];
115
+    [changeBtn addTarget:self action:@selector(changeBtnclickBtn:) forControlEvents:UIControlEventTouchUpInside];
112
     [oderV addSubview:changeBtn];
116
     [oderV addSubview:changeBtn];
117
+    
113
     [changeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
118
     [changeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
114
         make.left.mas_equalTo(ordertitleL.mas_right).offset(0);
119
         make.left.mas_equalTo(ordertitleL.mas_right).offset(0);
115
         make.top.mas_equalTo(0);
120
         make.top.mas_equalTo(0);
159
     }
164
     }
160
 }
165
 }
161
 #pragma mark---金额隐私切换
166
 #pragma mark---金额隐私切换
162
--(void)changeBtnclickBtn
167
+-(void)changeBtnclickBtn:(UIButton *)bnt
163
 {
168
 {
169
+    KDPAccountModel *model=[KDPAccountTool account];
164
     
170
     
171
+    if (model.is_hidden.integerValue == 0) {
172
+        model.is_hidden = @"1";
173
+        bnt.selected=YES;
174
+        
175
+    }else{
176
+        model.is_hidden = @"0";
177
+        bnt.selected=NO;
178
+        
179
+    }
180
+    [KDPAccountTool saveAccount:model];
181
+    [self ishidden_rebat];
182
+}
183
+-(void)setRebet_money:(NSString *)rebet_money
184
+{
185
+    _rebet_money  = rebet_money;
186
+    [self ishidden_rebat];
187
+}
188
+-(void)ishidden_rebat
189
+{
190
+    if ([KDPublicMethod is_hiddenMoney]) {
191
+        self.Forecastlabel.text = @"****";
192
+    }else{
193
+        self.Forecastlabel.text=_rebet_money;
194
+    }
165
 }
195
 }
166
 
196
 
167
 #pragma mark---
197
 #pragma mark---

+ 11 - 0
KuDianProject/TOP/View/KDPRecommendGoodCell.m

99
             make.left.mas_equalTo(20);
99
             make.left.mas_equalTo(20);
100
             make.top.right.bottom.mas_equalTo(0);
100
             make.top.right.bottom.mas_equalTo(0);
101
         }];
101
         }];
102
+        
103
+        
104
+        UIView *lineV=[[UIView alloc]init];
105
+        lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
106
+        [self addSubview:lineV];
107
+        [lineV mas_makeConstraints:^(MASConstraintMaker *make) {
108
+            make.left.mas_equalTo(10);
109
+            make.right.mas_equalTo(-10);
110
+            make.top.mas_equalTo(self.mas_bottom).offset(-1);
111
+            make.height.mas_equalTo(1);
112
+        }];
102
     }
113
     }
103
     return self;
114
     return self;
104
 }
115
 }