jikaipeng %!s(int64=5) %!d(string=před) roky
rodič
revize
617dd00261
22 změnil soubory, kde provedl 599 přidání a 58 odebrání
  1. 18 0
      KuDianProject.xcodeproj/project.pbxproj
  2. 1 1
      KuDianProject.xcodeproj/xcuserdata/kaipeng.xcuserdatad/xcschemes/xcschememanagement.plist
  3. binární
      KuDianProject.xcworkspace/xcuserdata/kaipeng.xcuserdatad/UserInterfaceState.xcuserstate
  4. binární
      KuDianProject/Assets.xcassets/.DS_Store
  5. 11 1
      KuDianProject/LiveData/Controller/KDPLiveLeftTableViewCell.m
  6. 50 5
      KuDianProject/LiveData/Controller/KDPLiveLeftViewController.m
  7. 14 10
      KuDianProject/LiveData/Controller/KDPOrderDetailTableViewCell.m
  8. 2 0
      KuDianProject/LiveData/Controller/KDPOrderDetailViewController.h
  9. 48 1
      KuDianProject/LiveData/Controller/KDPOrderDetailViewController.m
  10. 163 1
      KuDianProject/Search/Controller/KDPSearchResultViewController.m
  11. 2 1
      KuDianProject/Search/Controller/KDPSearchViewController.m
  12. 23 0
      KuDianProject/Search/Controller/View/KDPClassModel.h
  13. 17 0
      KuDianProject/Search/Controller/View/KDPClassModel.m
  14. 25 0
      KuDianProject/Search/Controller/View/KDPLiveDetailModel.h
  15. 13 0
      KuDianProject/Search/Controller/View/KDPLiveDetailModel.m
  16. 25 0
      KuDianProject/Search/Controller/View/KDPLiveListModel.h
  17. 13 0
      KuDianProject/Search/Controller/View/KDPLiveListModel.m
  18. 3 1
      KuDianProject/SupplyGood/Controller/KDPSupplyContentViewController.h
  19. 85 3
      KuDianProject/SupplyGood/Controller/KDPSupplyContentViewController.m
  20. 39 7
      KuDianProject/SupplyGood/Controller/KDPSupplyGoodViewController.m
  21. 27 7
      KuDianProject/SupplyGood/View/KDPSupplyGoodCollectionViewCell.m
  22. 20 20
      Pods/Pods.xcodeproj/xcuserdata/kaipeng.xcuserdatad/xcschemes/xcschememanagement.plist

+ 18 - 0
KuDianProject.xcodeproj/project.pbxproj

@@ -40,6 +40,9 @@
40 40
 		76D6EE8E22D5885600E7AC1C /* MSSAutoresizeLabelFlowConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D6EE8A22D5885600E7AC1C /* MSSAutoresizeLabelFlowConfig.m */; };
41 41
 		76D6EE9122D5996100E7AC1C /* KDPSearchResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D6EE9022D5996100E7AC1C /* KDPSearchResultViewController.m */; };
42 42
 		76D6EE9622D5BBB100E7AC1C /* KDPSearchResuCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D6EE9522D5BBB100E7AC1C /* KDPSearchResuCollectionViewCell.m */; };
43
+		76D6EE9922D5D02300E7AC1C /* KDPLiveListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D6EE9822D5D02300E7AC1C /* KDPLiveListModel.m */; };
44
+		76D6EE9C22D5D53B00E7AC1C /* KDPLiveDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D6EE9B22D5D53B00E7AC1C /* KDPLiveDetailModel.m */; };
45
+		76D6EE9F22D5DAFF00E7AC1C /* KDPClassModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D6EE9E22D5DAFF00E7AC1C /* KDPClassModel.m */; };
43 46
 		76D7941322CDCC9C00C2ECFA /* KDPLiveDataViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D7941222CDCC9C00C2ECFA /* KDPLiveDataViewController.m */; };
44 47
 		76D7941622CDCCB900C2ECFA /* KDPSupplyGoodViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D7941522CDCCB900C2ECFA /* KDPSupplyGoodViewController.m */; };
45 48
 		76D7942522CDD3CB00C2ECFA /* UINavigationBar+handle.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D7941922CDD3C900C2ECFA /* UINavigationBar+handle.m */; };
@@ -198,6 +201,12 @@
198 201
 		76D6EE9022D5996100E7AC1C /* KDPSearchResultViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPSearchResultViewController.m; sourceTree = "<group>"; };
199 202
 		76D6EE9422D5BBB100E7AC1C /* KDPSearchResuCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KDPSearchResuCollectionViewCell.h; sourceTree = "<group>"; };
200 203
 		76D6EE9522D5BBB100E7AC1C /* KDPSearchResuCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPSearchResuCollectionViewCell.m; sourceTree = "<group>"; };
204
+		76D6EE9722D5D02300E7AC1C /* KDPLiveListModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KDPLiveListModel.h; path = KuDianProject/Search/Controller/View/KDPLiveListModel.h; sourceTree = SOURCE_ROOT; };
205
+		76D6EE9822D5D02300E7AC1C /* KDPLiveListModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = KDPLiveListModel.m; path = KuDianProject/Search/Controller/View/KDPLiveListModel.m; sourceTree = SOURCE_ROOT; };
206
+		76D6EE9A22D5D53B00E7AC1C /* KDPLiveDetailModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KDPLiveDetailModel.h; path = KuDianProject/Search/Controller/View/KDPLiveDetailModel.h; sourceTree = SOURCE_ROOT; };
207
+		76D6EE9B22D5D53B00E7AC1C /* KDPLiveDetailModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = KDPLiveDetailModel.m; path = KuDianProject/Search/Controller/View/KDPLiveDetailModel.m; sourceTree = SOURCE_ROOT; };
208
+		76D6EE9D22D5DAFF00E7AC1C /* KDPClassModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KDPClassModel.h; path = KuDianProject/Search/Controller/View/KDPClassModel.h; sourceTree = SOURCE_ROOT; };
209
+		76D6EE9E22D5DAFF00E7AC1C /* KDPClassModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = KDPClassModel.m; path = KuDianProject/Search/Controller/View/KDPClassModel.m; sourceTree = SOURCE_ROOT; };
201 210
 		76D7941122CDCC9C00C2ECFA /* KDPLiveDataViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KDPLiveDataViewController.h; sourceTree = "<group>"; };
202 211
 		76D7941222CDCC9C00C2ECFA /* KDPLiveDataViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPLiveDataViewController.m; sourceTree = "<group>"; };
203 212
 		76D7941422CDCCB900C2ECFA /* KDPSupplyGoodViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KDPSupplyGoodViewController.h; sourceTree = "<group>"; };
@@ -578,6 +587,10 @@
578 587
 		76D7940D22CDCB9400C2ECFA /* Model */ = {
579 588
 			isa = PBXGroup;
580 589
 			children = (
590
+				76D6EE9722D5D02300E7AC1C /* KDPLiveListModel.h */,
591
+				76D6EE9822D5D02300E7AC1C /* KDPLiveListModel.m */,
592
+				76D6EE9A22D5D53B00E7AC1C /* KDPLiveDetailModel.h */,
593
+				76D6EE9B22D5D53B00E7AC1C /* KDPLiveDetailModel.m */,
581 594
 			);
582 595
 			path = Model;
583 596
 			sourceTree = "<group>";
@@ -600,6 +613,8 @@
600 613
 		76D7940F22CDCBA500C2ECFA /* Model */ = {
601 614
 			isa = PBXGroup;
602 615
 			children = (
616
+				76D6EE9D22D5DAFF00E7AC1C /* KDPClassModel.h */,
617
+				76D6EE9E22D5DAFF00E7AC1C /* KDPClassModel.m */,
603 618
 			);
604 619
 			path = Model;
605 620
 			sourceTree = "<group>";
@@ -1166,6 +1181,7 @@
1166 1181
 				764A24D622D44220009B3891 /* KDPUserInfo.m in Sources */,
1167 1182
 				76D6EE7122D4A7A100E7AC1C /* KDPTabBarVC.m in Sources */,
1168 1183
 				C5BAD0BE22D441A70084663A /* KDPWebInteractionVC.m in Sources */,
1184
+				76D6EE9C22D5D53B00E7AC1C /* KDPLiveDetailModel.m in Sources */,
1169 1185
 				76D7942A22CDD3CB00C2ECFA /* UITableViewCell+Extension.m in Sources */,
1170 1186
 				C5BAD0E622D49AC80084663A /* KDPIDTipView.m in Sources */,
1171 1187
 				C53FD3F222D31C5500687706 /* KDPAccountListCell.m in Sources */,
@@ -1211,6 +1227,8 @@
1211 1227
 				C5D5624D22CD9FBC0035A714 /* UIColor+KDPColor.m in Sources */,
1212 1228
 				C53FD40422D34DBD00687706 /* KDPDrawerListCell.m in Sources */,
1213 1229
 				C5BAD0E022D4845B0084663A /* KDPTodayListCell.m in Sources */,
1230
+				76D6EE9F22D5DAFF00E7AC1C /* KDPClassModel.m in Sources */,
1231
+				76D6EE9922D5D02300E7AC1C /* KDPLiveListModel.m in Sources */,
1214 1232
 				C5D5625922CDC9870035A714 /* MBProgressHUD+KDPCategory.m in Sources */,
1215 1233
 				76D6EE8C22D5885600E7AC1C /* MSSAutoresizeLabelFlowLayout.m in Sources */,
1216 1234
 				C5D5626E22CDFDD20035A714 /* KDPEarningHeadView.m in Sources */,

+ 1 - 1
KuDianProject.xcodeproj/xcuserdata/kaipeng.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
7 7
 		<key>KuDianProject.xcscheme_^#shared#^_</key>
8 8
 		<dict>
9 9
 			<key>orderHint</key>
10
-			<integer>0</integer>
10
+			<integer>20</integer>
11 11
 		</dict>
12 12
 	</dict>
13 13
 </dict>

binární
KuDianProject.xcworkspace/xcuserdata/kaipeng.xcuserdatad/UserInterfaceState.xcuserstate


binární
KuDianProject/Assets.xcassets/.DS_Store


+ 11 - 1
KuDianProject/LiveData/Controller/KDPLiveLeftTableViewCell.m

@@ -7,7 +7,7 @@
7 7
 //
8 8
 
9 9
 #import "KDPLiveLeftTableViewCell.h"
10
-
10
+#import "KDPLiveListModel.h"
11 11
 @implementation KDPLiveLeftTableViewCell
12 12
 {
13 13
     UILabel *_timeLabel;
@@ -167,6 +167,16 @@
167 167
     
168 168
 }
169 169
 
170
+- (void)configWithViewModel:(id)viewModel indexpath:(NSIndexPath *)indexPath{
171
+    KDPLiveListModel *model = (KDPLiveListModel*)viewModel;
172
+    _timeLabel.text = [NSString stringWithFormat:@"直播时间:%@",model.show_time];
173
+    _goodCountLabel.text = model.goods_num;
174
+    _orderLabel.text = model.order_num;
175
+    [_iconImageView sd_setImageWithURL:[NSURL URLWithString:model.show_img]];
176
+    _investLabel.text = model.pre_rebate;
177
+    
178
+}
179
+
170 180
 - (void)checkOrderAction:(UIButton *)sender{
171 181
     if (self.orderClickBlock) {
172 182
         self.orderClickBlock(sender);

+ 50 - 5
KuDianProject/LiveData/Controller/KDPLiveLeftViewController.m

@@ -9,10 +9,15 @@
9 9
 #import "KDPLiveLeftViewController.h"
10 10
 #import "KDPLiveLeftTableViewCell.h"
11 11
 #import "KDPOrderDetailViewController.h"
12
+#import "KDPLiveListModel.h"
12 13
 @interface KDPLiveLeftViewController ()<UITableViewDelegate,UITableViewDataSource>
13 14
 
14 15
 @property (nonatomic, strong) UITableView *tableView;
15 16
 
17
+@property (nonatomic, assign) NSInteger page;
18
+
19
+@property (nonatomic, strong) NSMutableArray *dataSource;
20
+
16 21
 @end
17 22
 
18 23
 @implementation KDPLiveLeftViewController
@@ -24,6 +29,31 @@
24 29
     [self setUpUI];
25 30
 }
26 31
 
32
+- (void)requestData{
33
+    NSDictionary *params = @{@"page":@(self.page)};
34
+    NSString *liveListUrl = [NSString stringWithFormat:@"%@api/onlive/liveList",KDURL];
35
+    [LoadingView showInView:self.view];
36
+    [KDPNetworkRequestHTTP postURL:liveListUrl params:params success:^(id  _Nonnull json) {
37
+        [LoadingView dismiss];
38
+        NSArray *liveDataArr = [NSArray yy_modelArrayWithClass:[KDPLiveListModel class] json:json[@"data"]];
39
+        if (self.page == 1) {
40
+            [self.dataSource removeAllObjects];
41
+        }
42
+        if (liveDataArr.count > 0) {
43
+            [self.dataSource addObjectsFromArray:liveDataArr];
44
+        } else{
45
+            [self.tableView.mj_footer endRefreshingWithNoMoreData];
46
+        }
47
+        [self.tableView.mj_footer endRefreshing];
48
+        [self.tableView.mj_header endRefreshing];
49
+        [self.tableView reloadData];
50
+    } failure:^(NSError * _Nonnull error) {
51
+        [LoadingView dismiss];
52
+        [self.tableView.mj_footer endRefreshing];
53
+        [self.tableView.mj_header endRefreshing];
54
+    }];
55
+}
56
+
27 57
 - (void)setUpUI{
28 58
     // tip view
29 59
     UILabel *tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,8, 223, 21)];
@@ -50,17 +80,36 @@
50 80
         _tableView.backgroundColor = [UIColor clearColor];
51 81
         [_tableView registerClass:[KDPLiveLeftTableViewCell class] forCellReuseIdentifier:NSStringFromClass([KDPLiveLeftTableViewCell class])];
52 82
         _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
83
+        _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
84
+            self.page = 1;
85
+            [self requestData];
86
+        }];
87
+        _tableView.mj_footer = [MJRefreshBackFooter footerWithRefreshingBlock:^{
88
+            self.page ++;
89
+            [self requestData];
90
+        }];
91
+        [_tableView.mj_header beginRefreshing];
53 92
     }
54 93
     return _tableView;
55 94
 }
56 95
 
96
+- (NSMutableArray *)dataSource{
97
+    if (!_dataSource) {
98
+        _dataSource = [NSMutableArray array];
99
+    }
100
+    return _dataSource;
101
+}
102
+
57 103
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
58 104
     KDPLiveLeftTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([KDPLiveLeftTableViewCell class])];
59 105
         cell.orderClickBlock = ^(UIButton * _Nonnull btn) {
60 106
         KDPOrderDetailViewController *detailVC = [[KDPOrderDetailViewController alloc] init];
107
+        KDPLiveListModel *model = self.dataSource[indexPath.row];
108
+        detailVC.live_stream_id = model.live_stream_id;
61 109
         WeakSelf(weakSelf);
62 110
         [weakSelf.navigationController pushViewController:detailVC animated:YES];
63 111
     };
112
+    [cell configWithViewModel:self.dataSource[indexPath.row] indexpath:indexPath];
64 113
     cell.selectionStyle = UITableViewCellSelectionStyleNone;
65 114
     return cell;
66 115
 }
@@ -70,11 +119,7 @@
70 119
 }
71 120
 
72 121
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
73
-    return 10;
74
-}
75
-
76
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
77
-    
122
+    return self.dataSource.count;
78 123
 }
79 124
 
80 125
 @end

+ 14 - 10
KuDianProject/LiveData/Controller/KDPOrderDetailTableViewCell.m

@@ -7,7 +7,7 @@
7 7
 //
8 8
 
9 9
 #import "KDPOrderDetailTableViewCell.h"
10
-
10
+#import "KDPLiveDetailModel.h"
11 11
 @interface KDPOrderDetailTableViewCell ()
12 12
 
13 13
 @property (nonatomic, strong) UILabel *timeLabel;
@@ -46,38 +46,29 @@
46 46
     self.timeLabel = [[UILabel alloc] init];
47 47
     self.timeLabel.textColor = [UIColor colorWithHex:0x333333];
48 48
     self.timeLabel.font = FONT_SYS(12);
49
-    self.timeLabel.text = @"直播时间:2019-07-03 20:00:00";
50 49
     [self.contentView addSubview:self.timeLabel];
51 50
     
52 51
     self.goodTitleLabel = [[UILabel alloc] init];
53 52
     self.goodTitleLabel.textColor = [UIColor colorWithHex:0x333333];
54 53
     self.goodTitleLabel.font = FONT_SYS(15);
55
-    self.goodTitleLabel.text = @"这是一个商品名这是一个商品名这是";
56 54
     [self.contentView addSubview:self.goodTitleLabel];
57 55
     
58 56
     self.createTimeLabel = [[UILabel alloc] init];
59 57
     self.createTimeLabel.textColor = [UIColor colorWithHex:0x999999];
60 58
     self.createTimeLabel.font = FONT_SYS(12);
61
-    self.createTimeLabel.text = @"创建日:04-04 12:00";
62 59
     [self.contentView addSubview:self.createTimeLabel];
63 60
     
64 61
     self.endTimeLabel = [[UILabel alloc] init];
65 62
     self.endTimeLabel.textColor = [UIColor colorWithHex:0x999999];
66 63
     self.endTimeLabel.font = FONT_SYS(12);
67
-    self.endTimeLabel.text = @"结算日:05-05 12:12";
68 64
     [self.contentView addSubview:self.endTimeLabel];
69 65
     
70 66
     self.payMonny = [[UILabel alloc] init];
71 67
     self.payMonny.textColor = [UIColor colorWithHex:0x666666];
72 68
     self.payMonny.font = FONT_SYS(12);
73
-    self.payMonny.text = @"付款金额¥29.8";
74 69
     [self.contentView addSubview:self.payMonny];
75 70
     
76 71
     self.commMonny = [[UILabel alloc] init];
77
-    NSString *string = @"结算佣金¥5.00";
78
-    NSMutableAttributedString *commAtt = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSForegroundColorAttributeName:[UIColor baseColor],NSFontAttributeName:FONT_SYS(12)}];
79
-    [commAtt addAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:0x666666]} range:[string rangeOfString:@"结算佣金"]];
80
-    [self.commMonny setAttributedText:commAtt];
81 72
     [self.contentView addSubview:self.commMonny];
82 73
     
83 74
 }
@@ -140,4 +131,17 @@
140 131
     
141 132
 }
142 133
 
134
+- (void)configWithViewModel:(id)viewModel indexpath:(NSIndexPath *)indexPath{
135
+    KDPLiveDetailModel *detailModel = (KDPLiveDetailModel *)viewModel;
136
+    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:detailModel.img]];
137
+    self.goodTitleLabel.text = detailModel.name;
138
+    self.createTimeLabel.text = [NSString stringWithFormat:@"创建日:%@",detailModel.order_create_at];
139
+    self.endTimeLabel.text = [NSString stringWithFormat:@"结算日:%@",detailModel.order_balance_at];
140
+    self.payMonny.text = [NSString stringWithFormat:@"付款金额:¥%@",detailModel.money];
141
+    NSString *string = [NSString stringWithFormat:@"结算佣金:¥%@",detailModel.rebate];
142
+    NSMutableAttributedString *commAtt = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSForegroundColorAttributeName:[UIColor baseColor],NSFontAttributeName:FONT_SYS(12)}];
143
+    [commAtt addAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:0x666666]} range:[string rangeOfString:@"结算佣金:"]];
144
+    [self.commMonny setAttributedText:commAtt];
145
+}
146
+
143 147
 @end

+ 2 - 0
KuDianProject/LiveData/Controller/KDPOrderDetailViewController.h

@@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
12 12
 
13 13
 @interface KDPOrderDetailViewController : KDPMainViewController
14 14
 
15
+@property (nonatomic, copy) NSString *live_stream_id;
16
+
15 17
 @end
16 18
 
17 19
 NS_ASSUME_NONNULL_END

+ 48 - 1
KuDianProject/LiveData/Controller/KDPOrderDetailViewController.m

@@ -8,10 +8,15 @@
8 8
 
9 9
 #import "KDPOrderDetailViewController.h"
10 10
 #import "KDPOrderDetailTableViewCell.h"
11
+#import "KDPLiveDetailModel.h"
11 12
 @interface KDPOrderDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
12 13
 
13 14
 @property (nonatomic, strong) UITableView *tableview;
14 15
 
16
+@property (nonatomic, assign) NSInteger page;
17
+
18
+@property (nonatomic, strong) NSMutableArray *dataSource;
19
+
15 20
 @end
16 21
 
17 22
 @implementation KDPOrderDetailViewController
@@ -25,6 +30,31 @@
25 30
     [self.navBar addleftReturnButton:self selector:@selector(popAction)];
26 31
 }
27 32
 
33
+- (void)requestDetailDataWithPage:(NSInteger )page{
34
+    NSString *detailUrl = [NSString stringWithFormat:@"%@api/onlive/liveDetail",KDURL];
35
+    self.live_stream_id = self.live_stream_id.length ? self.live_stream_id : @"";
36
+    [LoadingView show];
37
+    [KDPNetworkRequestHTTP postURL:detailUrl params:@{@"page":@(self.page),@"live_stream_id":self.live_stream_id} success:^(id  _Nonnull json) {
38
+        [LoadingView dismiss];
39
+        NSArray *liveDataArr = [NSArray yy_modelArrayWithClass:[KDPLiveDetailModel class] json:json[@"data"]];
40
+        if (self.page == 1) {
41
+            [self.dataSource removeAllObjects];
42
+        }
43
+        if (liveDataArr.count > 0) {
44
+            [self.dataSource addObjectsFromArray:liveDataArr];
45
+        } else{
46
+            [self.tableview.mj_footer endRefreshingWithNoMoreData];
47
+        }
48
+        [self.tableview.mj_footer endRefreshing];
49
+        [self.tableview.mj_header endRefreshing];
50
+        [self.tableview reloadData];
51
+    } failure:^(NSError * _Nonnull error) {
52
+        [LoadingView dismiss];
53
+        [self.tableview.mj_footer endRefreshing];
54
+        [self.tableview.mj_header endRefreshing];
55
+    }];
56
+}
57
+
28 58
 - (void)popAction{
29 59
     [self.navigationController popViewControllerAnimated:YES];
30 60
 }
@@ -40,13 +70,30 @@
40 70
         [_tableview registerClass:[KDPOrderDetailTableViewCell class] forCellReuseIdentifier:NSStringFromClass([KDPOrderDetailTableViewCell class])];
41 71
         _tableview.showsVerticalScrollIndicator = NO;
42 72
         _tableview.showsHorizontalScrollIndicator = NO;
73
+        _tableview.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
74
+            self.page = 1;
75
+            [self requestDetailDataWithPage:self.page];
76
+        }];
77
+        _tableview.mj_footer = [MJRefreshBackFooter footerWithRefreshingBlock:^{
78
+            self.page ++;
79
+            [self requestDetailDataWithPage:self.page];
80
+        }];
81
+        [_tableview.mj_header beginRefreshing];
43 82
     }
44 83
     return _tableview;
45 84
 }
46 85
 
86
+- (NSMutableArray *)dataSource{
87
+    if (!_dataSource) {
88
+        _dataSource = [NSMutableArray array];
89
+    }
90
+    return _dataSource;
91
+}
92
+
47 93
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
48 94
     KDPOrderDetailTableViewCell *detailCell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([KDPOrderDetailTableViewCell class])];
49 95
     detailCell.selectionStyle = UITableViewCellSelectionStyleNone;
96
+    [detailCell configWithViewModel:self.dataSource[indexPath.row] indexpath:indexPath];
50 97
     return detailCell;
51 98
 }
52 99
 
@@ -55,7 +102,7 @@
55 102
 }
56 103
 
57 104
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
58
-    return 10;
105
+    return self.dataSource.count;
59 106
 }
60 107
 
61 108
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

+ 163 - 1
KuDianProject/Search/Controller/KDPSearchResultViewController.m

@@ -8,12 +8,18 @@
8 8
 
9 9
 #import "KDPSearchResultViewController.h"
10 10
 #import "KDPSupplyContentReusableView.h"
11
-@interface KDPSearchResultViewController ()
11
+#import "KDPRecommendGoodCell.h"
12
+#import "KDPScreenViewController.h"
13
+@interface KDPSearchResultViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
12 14
 
13 15
 @property (nonatomic, strong) UICollectionView *collectionView;
14 16
 
15 17
 @property (nonatomic, strong) NSMutableArray *dataSource;
16 18
 
19
+@property (nonatomic, assign) NSInteger page;
20
+
21
+@property (nonatomic, strong) NSMutableDictionary *params;
22
+
17 23
 @end
18 24
 
19 25
 @implementation KDPSearchResultViewController
@@ -21,13 +27,83 @@
21 27
 - (void)viewDidLoad {
22 28
     [super viewDidLoad];
23 29
     // Do any additional setup after loading the view.
30
+    [self setupNav];
31
+    [self.view addSubview:self.collectionView];
32
+    [self requestGoodData];
24 33
 }
25 34
 
26 35
 - (void)setupNav{
27 36
     self.navBar.hidden = YES;
37
+    UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, KDNavBarHeight)];
38
+    navView.backgroundColor = [UIColor whiteColor];
39
+    [self.view addSubview:navView];
40
+    self.view.backgroundColor = [UIColor colorWithHex:0xf4f4f4];
41
+
42
+    UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(15, KDNavBarHeight - 13-18, 11, 18)];
43
+    [returnBtn addTarget:self action:@selector(returnClickBtn) forControlEvents:UIControlEventTouchUpInside];
44
+    [returnBtn setImage:[UIImage imageNamed:@"return_black"] forState:UIControlStateNormal];
45
+    returnBtn.adjustsImageWhenHighlighted = NO;
46
+    [navView addSubview:returnBtn];
47
+    
48
+    UIButton *searchBtn =[[UIButton alloc]initWithFrame:CGRectMake(41, KDStatusHeight+5, SCREEN_WIDTH-55, 31)];
49
+    searchBtn.layer.cornerRadius=15.5;
50
+    searchBtn.backgroundColor=[UIColor colorWithHex:0xEEEEEE];
51
+    [searchBtn addTarget:self action:@selector(returnClickBtn) forControlEvents:UIControlEventTouchUpInside];
52
+    [navView addSubview:searchBtn];
53
+    
54
+    UIImageView *iconimg=[[UIImageView alloc]initWithFrame:CGRectMake(12, 8, 15, 15)];
55
+    iconimg.image=[UIImage imageNamed:@"search_icon"];
56
+    [searchBtn addSubview:iconimg];
57
+    
58
+    UITextField *textField=[[UITextField alloc]init];
59
+    textField.textColor=[UIColor whiteColor];
60
+    textField.backgroundColor=[UIColor colorWithHex:0x929292];
61
+    textField.font=[UIFont systemFontOfSize:14];
62
+    textField.userInteractionEnabled=NO;
63
+    [searchBtn addSubview:textField];
64
+    textField.layer.cornerRadius=2;
65
+    textField.layer.masksToBounds=YES;
66
+    [textField mas_makeConstraints:^(MASConstraintMaker *make) {
67
+        make.left.mas_equalTo(iconimg.right+5);
68
+        make.top.mas_equalTo(3);
69
+        make.height.mas_equalTo(24);
70
+    }];
71
+    
72
+    textField.text = [NSString stringWithFormat:@"  %@ ×  ",self.keyWordStr];
28 73
     
29 74
 }
30 75
 
76
+- (void)requestGoodData{
77
+    if (![KDPAccountTool isLogin]) {
78
+        return;
79
+    }
80
+    [self.params setValue:[NSString stringWithFormat:@"%ld",(long)self.page] forKey:@"page"];
81
+    [LoadingView showInView:self.view];
82
+    NSString *getGoodUrl = [NSString stringWithFormat:@"%@api/goods/search",KDURL];
83
+    [KDPNetworkRequestHTTP postURL:getGoodUrl params:self.params success:^(id  _Nonnull json) {
84
+        [LoadingView dismiss];
85
+        NSArray *dataArr = [NSArray yy_modelArrayWithClass:[KDPGoodsModel class] json:json[@"data"]];
86
+        if (self.page == 1) {
87
+            [self.dataSource removeAllObjects];
88
+        }
89
+        if (dataArr.count > 0) {
90
+            [self.dataSource addObjectsFromArray:dataArr];
91
+        } else{
92
+            [self.collectionView.mj_footer endRefreshingWithNoMoreData];
93
+        }
94
+        [self.collectionView.mj_footer endRefreshing];
95
+        [self.collectionView.mj_header endRefreshing];
96
+        [self.collectionView reloadData];
97
+
98
+    } failure:^(NSError * _Nonnull error) {
99
+        [LoadingView dismiss];
100
+    }];
101
+}
102
+
103
+- (void)returnClickBtn{
104
+    [self.navigationController popViewControllerAnimated:NO];
105
+}
106
+
31 107
 - (void)viewWillAppear:(BOOL)animated{
32 108
     [super viewWillAppear:animated];
33 109
     [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
@@ -38,5 +114,91 @@
38 114
     [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
39 115
 }
40 116
 
117
+- (UICollectionView *)collectionView{
118
+    if (!_collectionView) {
119
+        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
120
+        flowLayout.itemSize = CGSizeMake(SCREEN_WIDTH, 130);
121
+        flowLayout.minimumLineSpacing = 0;
122
+        flowLayout.minimumInteritemSpacing = 0;
123
+        flowLayout.sectionHeadersPinToVisibleBounds = YES;
124
+        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, KDNavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-KDNavBarHeight) collectionViewLayout:flowLayout];
125
+        _collectionView.showsVerticalScrollIndicator = NO;
126
+        _collectionView.showsHorizontalScrollIndicator = NO;
127
+        [_collectionView registerClass:[KDPRecommendGoodCell class] forCellWithReuseIdentifier:NSStringFromClass([KDPRecommendGoodCell class])];
128
+        [_collectionView registerClass:[KDPSupplyContentReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:NSStringFromClass([KDPSupplyContentReusableView class])];
129
+        _collectionView.backgroundColor = [UIColor whiteColor];
130
+        _collectionView.delegate = self;
131
+        _collectionView.dataSource = self;
132
+        _collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
133
+            self.page = 1;
134
+            [self requestGoodData];
135
+        }];
136
+        
137
+        _collectionView.mj_footer = [MJRefreshBackNormalFooter  footerWithRefreshingBlock:^{
138
+            self.page ++;
139
+            [self requestGoodData];
140
+        }];
141
+    }
142
+    return _collectionView;
143
+}
144
+
145
+- (NSMutableArray *)dataSource{
146
+    if (!_dataSource) {
147
+        _dataSource = [NSMutableArray array];
148
+    }
149
+    return _dataSource;
150
+}
151
+
152
+- (NSMutableDictionary *)params{
153
+    if (!_params) {
154
+        _params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"",@"page",@"",@"sort",self.keyWordStr,@"keyword",@"",@"start_price",@"",@"end_price",@"",@"start_tk_rate",@"0",@"is_has_coupon", nil];
155
+    }
156
+    return _params;
157
+}
158
+
159
+- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
160
+    KDPSupplyContentReusableView *reusAbleView;
161
+    if (kind == UICollectionElementKindSectionHeader) {
162
+            reusAbleView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:NSStringFromClass([KDPSupplyContentReusableView class]) forIndexPath:indexPath];
163
+        reusAbleView.layer.borderWidth = 0.3;
164
+        reusAbleView.layer.borderColor = [UIColor colorWithHex:0xf4f4f4].CGColor;
165
+            reusAbleView.changeBlock = ^(BOOL isPrice) {
166
+                KDPScreenViewController *screenVC = [[KDPScreenViewController alloc] initWithPrice:isPrice];
167
+                screenVC.view.frame = CGRectMake(91, 0, SCREEN_WIDTH-91, SCREEN_HEIGHT);
168
+                CWLateralSlideConfiguration *conf = [CWLateralSlideConfiguration configurationWithDistance:0 maskAlpha:0.7 scaleY:1 direction:CWDrawerTransitionFromRight backImage:nil];
169
+                [self cw_showDrawerViewController:screenVC animationType:0 configuration:conf];
170
+            };
171
+            return reusAbleView;
172
+    }
173
+    return reusAbleView;
174
+}
175
+
176
+- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
177
+    if (section == 0) {
178
+        return CGSizeMake(SCREEN_WIDTH, 33);
179
+    }
180
+    return CGSizeZero;
181
+}
182
+
183
+- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
184
+    return 1;
185
+}
186
+
187
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
188
+    return self.dataSource.count;
189
+}
190
+
191
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
192
+    KDPRecommendGoodCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KDPRecommendGoodCell class]) forIndexPath:indexPath];
193
+    cell.model = self.dataSource[indexPath.row];
194
+    return cell;
195
+}
196
+
197
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
198
+    KDPGoodDetailVC *detailVC = [[KDPGoodDetailVC alloc] init];
199
+    detailVC.model = self.dataSource[indexPath.row];
200
+    [self.navigationController pushViewController:detailVC animated:YES];
201
+}
202
+
41 203
 
42 204
 @end

+ 2 - 1
KuDianProject/Search/Controller/KDPSearchViewController.m

@@ -197,6 +197,7 @@
197 197
 
198 198
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
199 199
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"searchList"];
200
+    cell.selectionStyle = UITableViewCellSelectionStyleNone;
200 201
     if (!cell) {
201 202
         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"searchList"];
202 203
         cell.selectionStyle = UITableViewCellSelectionStyleNone;
@@ -217,7 +218,7 @@
217 218
 }
218 219
 
219 220
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
220
-    [self requestSearchData:self.searchArray[indexPath.row]];
221
+    [self skipToResultWithString:self.searchArray[indexPath.row]];
221 222
 }
222 223
 
223 224
 #pragma mark - 懒加载

+ 23 - 0
KuDianProject/Search/Controller/View/KDPClassModel.h

@@ -0,0 +1,23 @@
1
+//
2
+//  KDPClassModel.h
3
+//  KuDianProject
4
+//
5
+//  Created by admin 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 KDPClassModel : NSObject
14
+
15
+@property(nonatomic,copy)NSString*name;
16
+@property(nonatomic,copy)NSString*icon;
17
+@property(nonatomic,copy)NSString*Id;
18
+@property(nonatomic,copy)NSString*type;
19
+@property(nonatomic,copy)NSString*backimg;
20
+
21
+@end
22
+
23
+NS_ASSUME_NONNULL_END

+ 17 - 0
KuDianProject/Search/Controller/View/KDPClassModel.m

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

+ 25 - 0
KuDianProject/Search/Controller/View/KDPLiveDetailModel.h

@@ -0,0 +1,25 @@
1
+//
2
+//  KDPLiveDetailModel.h
3
+//  KuDianProject
4
+//
5
+//  Created by admin 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 KDPLiveDetailModel : NSObject
14
+
15
+@property (nonatomic, copy) NSString *money;
16
+@property (nonatomic, copy) NSString *rebate;
17
+@property (nonatomic, copy) NSString *name;
18
+@property (nonatomic, copy) NSString *img;
19
+@property (nonatomic, copy) NSString *order_create_at;
20
+@property (nonatomic, copy) NSString *order_balance_at;
21
+
22
+
23
+@end
24
+
25
+NS_ASSUME_NONNULL_END

+ 13 - 0
KuDianProject/Search/Controller/View/KDPLiveDetailModel.m

@@ -0,0 +1,13 @@
1
+//
2
+//  KDPLiveDetailModel.m
3
+//  KuDianProject
4
+//
5
+//  Created by admin on 2019/7/10.
6
+//  Copyright © 2019 KDP. All rights reserved.
7
+//
8
+
9
+#import "KDPLiveDetailModel.h"
10
+
11
+@implementation KDPLiveDetailModel
12
+
13
+@end

+ 25 - 0
KuDianProject/Search/Controller/View/KDPLiveListModel.h

@@ -0,0 +1,25 @@
1
+//
2
+//  KDPLiveListModel.h
3
+//  KuDianProject
4
+//
5
+//  Created by admin 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 KDPLiveListModel : NSObject
14
+
15
+@property (nonatomic, copy) NSString *show_img;
16
+@property (nonatomic, copy) NSString *show_time;
17
+@property (nonatomic, copy) NSString *live_stream_id;
18
+@property (nonatomic, copy) NSString *goods_num;
19
+@property (nonatomic, copy) NSString *pre_rebate;
20
+@property (nonatomic, copy) NSString *order_num;
21
+
22
+
23
+@end
24
+
25
+NS_ASSUME_NONNULL_END

+ 13 - 0
KuDianProject/Search/Controller/View/KDPLiveListModel.m

@@ -0,0 +1,13 @@
1
+//
2
+//  KDPLiveListModel.m
3
+//  KuDianProject
4
+//
5
+//  Created by admin on 2019/7/10.
6
+//  Copyright © 2019 KDP. All rights reserved.
7
+//
8
+
9
+#import "KDPLiveListModel.h"
10
+
11
+@implementation KDPLiveListModel
12
+
13
+@end

+ 3 - 1
KuDianProject/SupplyGood/Controller/KDPSupplyContentViewController.h

@@ -7,11 +7,13 @@
7 7
 //
8 8
 
9 9
 #import "KDPMainViewController.h"
10
-
10
+#import "KDPClassModel.h"
11 11
 NS_ASSUME_NONNULL_BEGIN
12 12
 
13 13
 @interface KDPSupplyContentViewController : KDPMainViewController
14 14
 
15
+@property (nonatomic, strong) KDPClassModel *classModel;
16
+
15 17
 @end
16 18
 
17 19
 NS_ASSUME_NONNULL_END

+ 85 - 3
KuDianProject/SupplyGood/Controller/KDPSupplyContentViewController.m

@@ -16,6 +16,14 @@
16 16
 
17 17
 @property (nonatomic, strong) UICollectionView *collectionView;
18 18
 
19
+@property (nonatomic, assign) NSInteger page;
20
+
21
+@property (nonatomic, strong) NSMutableDictionary *mutabParams;
22
+
23
+@property (nonatomic, strong) NSMutableArray *dataSource;
24
+
25
+@property (nonatomic, strong) NSMutableArray *topGoodList;
26
+
19 27
 @end
20 28
 
21 29
 @implementation KDPSupplyContentViewController
@@ -24,6 +32,9 @@
24 32
     [super viewDidLoad];
25 33
     // Do any additional setup after loading the view.
26 34
     [self setUpUI];
35
+//    if ([self.classModel.type isEqualToString:@"cate"]) {
36
+//        [self requestTopListWithGoodId:self.classModel.Id];
37
+//    }
27 38
 }
28 39
 
29 40
 - (void)setUpUI{
@@ -32,6 +43,47 @@
32 43
     [self.view addSubview:self.collectionView];
33 44
 }
34 45
 
46
+#pragma mark 网络请求
47
+
48
+- (void)requestGoodlistData{
49
+    NSString *goodlistUrl = [NSString stringWithFormat:@"%@api/goods/listGoods",KDURL];
50
+    [self.mutabParams setValue:@(self.page) forKey:@"page"];
51
+    [KDPNetworkRequestHTTP postURL:goodlistUrl params:self.mutabParams success:^(id  _Nonnull json) {
52
+        [LoadingView dismiss];
53
+        NSArray *array =[NSArray yy_modelArrayWithClass:[KDPClassModel class] json:json[@"data"]];
54
+        [self.collectionView.mj_footer endRefreshing];
55
+        [self.collectionView.mj_header endRefreshing];
56
+        if (self.page == 1) {
57
+            [self.dataSource removeAllObjects];
58
+        }
59
+        if (array.count > 0) {
60
+            [self.dataSource addObjectsFromArray:array];
61
+        }
62
+        if (array.count == 0) {
63
+            [self.collectionView.mj_footer endRefreshingWithNoMoreData];
64
+        }
65
+        [self.collectionView reloadData];
66
+    } failure:^(NSError * _Nonnull error) {
67
+        [self.collectionView.mj_footer endRefreshing];
68
+        [self.collectionView.mj_header endRefreshing];
69
+        [LoadingView dismiss];
70
+    }];
71
+}
72
+
73
+- (void)requestTopListWithGoodId:(NSString *)Id{
74
+    [LoadingView showInView:self.view];
75
+    NSString *childListUrl = [NSString stringWithFormat:@"%@api/goods/childList",KDURL];
76
+    [KDPNetworkRequestHTTP postURL:childListUrl params:@{@"pid":Id} success:^(id  _Nonnull json) {
77
+        [self.topGoodList removeAllObjects];
78
+        NSArray *array =[NSArray yy_modelArrayWithClass:[KDPClassModel class] json:json[@"list"]];
79
+        [self.topGoodList addObjectsFromArray:array];
80
+        [LoadingView dismiss];
81
+        [self.collectionView reloadData];
82
+    } failure:^(NSError * _Nonnull error) {
83
+        [LoadingView dismiss];
84
+    }];
85
+}
86
+
35 87
 #pragma mark - lazy load
36 88
 
37 89
 - (UICollectionView *)collectionView{
@@ -48,19 +100,49 @@
48 100
         [_collectionView registerClass:[KDPSupplyCommentViewCell class] forCellWithReuseIdentifier:NSStringFromClass([KDPSupplyCommentViewCell class])];
49 101
         [_collectionView registerClass:[KDPSupplyGoodCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([KDPSupplyGoodCollectionViewCell class])];
50 102
         [_collectionView registerClass:[KDPSupplyContentReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:NSStringFromClass([KDPSupplyContentReusableView class])];
103
+        _collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
104
+            self.page = 1;
105
+            [self requestGoodlistData];
106
+        }];
107
+        _collectionView.mj_footer = [MJRefreshBackFooter footerWithRefreshingBlock:^{
108
+            self.page ++;
109
+            [self requestGoodlistData];
110
+        }];
111
+        [_collectionView.mj_header beginRefreshing];
51 112
     }
52 113
     return _collectionView;
53 114
 }
54 115
 
116
+- (NSMutableDictionary *)mutabParams{
117
+    if (!_mutabParams) {
118
+        _mutabParams = [NSMutableDictionary dictionaryWithDictionary:@{@"page":@(self.page),@"id":self.classModel.Id,@"type":self.classModel.type,@"start_price":@"",@"end_price":@"",@"start_tk_rate":@""}];
119
+    }
120
+    return _mutabParams;
121
+}
122
+
123
+- (NSMutableArray *)dataSource{
124
+    if (!_dataSource) {
125
+        _dataSource = [NSMutableArray array];
126
+    }
127
+    return _dataSource;
128
+}
129
+
130
+- (NSMutableArray *)topGoodList{
131
+    if (!_topGoodList) {
132
+        _topGoodList = [NSMutableArray array];
133
+    }
134
+    return _topGoodList;
135
+}
136
+
55 137
 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
56
-    UICollectionViewCell *cell;
57 138
     if (indexPath.section == 0) {
58
-        cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KDPSupplyCommentViewCell class]) forIndexPath:indexPath];
139
+        KDPSupplyCommentViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KDPSupplyCommentViewCell class]) forIndexPath:indexPath];
59 140
         return cell;
60 141
     }
61 142
     
62 143
     if (indexPath.section == 1) {
63
-         cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KDPSupplyGoodCollectionViewCell class]) forIndexPath:indexPath];
144
+         KDPSupplyGoodCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KDPSupplyGoodCollectionViewCell class]) forIndexPath:indexPath];
145
+        [cell configCellWithModel:self.dataSource[indexPath.row] indexPath:indexPath];
64 146
         return cell;
65 147
     }
66 148
     return nil;

+ 39 - 7
KuDianProject/SupplyGood/Controller/KDPSupplyGoodViewController.m

@@ -11,10 +11,15 @@
11 11
 #import "XLPageViewControllerConfig.h"
12 12
 #import "KDPSupplyContentViewController.h"
13 13
 #import "KDPSearchViewController.h"
14
+#import "KDPClassModel.h"
14 15
 @interface KDPSupplyGoodViewController ()<XLPageViewControllerDelegate,XLPageViewControllerDataSrouce>
15 16
 
16 17
 @property (nonatomic, strong) XLPageViewController *pageVC;
17 18
 
19
+@property (nonatomic, strong) NSMutableArray *classArray;
20
+
21
+@property (nonatomic, strong) UIImageView *topBackImageView;
22
+
18 23
 @end
19 24
 
20 25
 @implementation KDPSupplyGoodViewController
@@ -25,12 +30,22 @@
25 30
     [self setUpTopView];
26 31
     [self setUpPageVc];
27 32
     self.view.backgroundColor = [UIColor colorWithRGB:0xf4f4f4];
33
+    [self requestTopListData];
28 34
 }
29 35
 
30 36
 #pragma event handle
31 37
 
32 38
 - (void)requestTopListData{
33
-    
39
+    NSString *classUrl = [NSString stringWithFormat:@"%@api/goods/listTopBar",KDURL];
40
+    [LoadingView showInView:self.view];
41
+    [KDPNetworkRequestHTTP postURL:classUrl params:nil success:^(id  _Nonnull json) {
42
+        [LoadingView dismiss];
43
+        NSArray *classArr = [NSArray yy_modelArrayWithClass:[KDPClassModel class] json:json[@"list"]];
44
+        [self.classArray addObjectsFromArray:classArr];
45
+        [self.pageVC reloadData];
46
+    } failure:^(NSError * _Nonnull error) {
47
+        [LoadingView dismiss];
48
+    }];
34 49
 }
35 50
 
36 51
 - (void)setUpPageVc{
@@ -68,8 +83,6 @@
68 83
     [self.view addSubview:self.pageVC.view];
69 84
 }
70 85
 
71
-
72
-
73 86
 - (void)searchBtnClick:(UIButton *)sender{
74 87
     KDPSearchViewController *searchVC = [[KDPSearchViewController alloc] init];
75 88
     [self.navigationController pushViewController:searchVC animated:NO];
@@ -82,6 +95,11 @@
82 95
     [topBackView setGradientBackgroundWithColors:@[[UIColor colorWithRGB:0xFF235F],[UIColor colorWithRGB:0xFF7676]] locations:@[@0,@1] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
83 96
     [self.view addSubview:topBackView];
84 97
     
98
+    UIImageView *imageView = [[UIImageView alloc] initWithFrame:topBackView.bounds];
99
+    [self.view addSubview:imageView];
100
+    imageView.hidden = YES;
101
+    self.topBackImageView = imageView;
102
+    
85 103
     // search
86 104
     UIButton *searchBtn = [UIButton buttonWithType:UIButtonTypeCustom];
87 105
     searchBtn.frame = CGRectMake(15, KDStatusHeight + 7, SCREEN_WIDTH - 30, 31);
@@ -100,24 +118,38 @@
100 118
     
101 119
 }
102 120
 
121
+- (NSMutableArray *)classArray{
122
+    if (!_classArray) {
123
+        _classArray = [NSMutableArray array];
124
+    }
125
+    return _classArray;
126
+}
127
+
103 128
 #pragma mark - XLPageViewController datasource and delegate
104 129
 
105 130
 - (NSInteger)pageViewControllerNumberOfPage{
106
-    NSArray *array = @[@"测试一",@"测试2",@"测试3",@"测试4",@"测试5",@"测试6",@"测试7",@"测试8"];
107
-    return array.count;
131
+    return self.classArray.count;
108 132
 }
109 133
 
110 134
 - (NSString *)pageViewController:(XLPageViewController *)pageViewController titleForIndex:(NSInteger)index{
111
-    NSArray *array = @[@"测试一",@"测试2",@"测试3",@"测试4",@"测试5",@"测试6",@"测试7",@"测试8"];
112
-    return array[index];
135
+    KDPClassModel *model = self.classArray[index];
136
+    return model.name;
113 137
 }
114 138
 
115 139
 - (void)pageViewController:(XLPageViewController *)pageViewController didSelectedAtIndex:(NSInteger)index{
140
+    KDPClassModel *classModel = self.classArray[index];
141
+    if (classModel.backimg.length) {
142
+        self.topBackImageView.hidden = NO;
143
+        [self.topBackImageView sd_setImageWithURL:[NSURL URLWithString:classModel.backimg]];
144
+    } else{
145
+        self.topBackImageView.hidden = YES;
146
+    }
116 147
     NSLog(@"%ld",index);
117 148
 }
118 149
 
119 150
 - (UIViewController *)pageViewController:(XLPageViewController *)pageViewController viewControllerForIndex:(NSInteger)index{
120 151
     KDPSupplyContentViewController *contentVC = [[KDPSupplyContentViewController alloc] init];
152
+    contentVC.classModel = self.classArray[index];
121 153
     return contentVC;
122 154
 }
123 155
 

+ 27 - 7
KuDianProject/SupplyGood/View/KDPSupplyGoodCollectionViewCell.m

@@ -16,6 +16,14 @@
16 16
 
17 17
 @property (nonatomic, strong) UILabel *priceLabel;
18 18
 
19
+@property (nonatomic, strong) UILabel *disCountPriceLabel;
20
+
21
+@property (nonatomic, strong) UIImageView *quanImageView;
22
+
23
+@property (nonatomic, strong) UILabel *quanLabel;
24
+
25
+@property (nonatomic, strong) UIView *profitView;
26
+
19 27
 @property (nonatomic, strong) UILabel *profitLabel;
20 28
 
21 29
 @end
@@ -37,19 +45,20 @@
37 45
     [self.contentView addSubview:self.iconImageView];
38 46
     
39 47
     self.goodLabel = [[UILabel alloc] init];
40
-    self.goodLabel.font = FONT_SYS(14);
41
-    self.goodLabel.textColor = [UIColor colorWithRGB:0x000000];
42
-    self.goodLabel.numberOfLines = 2;
48
+    self.goodLabel.font = FONT_SYS(15);
49
+    self.goodLabel.textColor = [UIColor colorWithHex:0x333333];
50
+    self.goodLabel.numberOfLines = 1;
43 51
     [self.goodLabel sizeToFit];
44
-    self.goodLabel.textAlignment = NSTextAlignmentCenter;
52
+    self.goodLabel.textAlignment = NSTextAlignmentLeft;
45 53
     [self.contentView addSubview:self.goodLabel];
46 54
     
47 55
     self.priceLabel = [[UILabel alloc] init];
48
-    self.priceLabel.font = FONT_SYS(16);
49
-    self.priceLabel.textColor = [UIColor colorWithRGB:0xFF7D00];
50
-    self.priceLabel.text = @"¥398";
51 56
     [self.contentView addSubview:self.priceLabel];
52 57
     
58
+    self.disCountPriceLabel = [[UILabel alloc] init];
59
+    [self.contentView addSubview:self.disCountPriceLabel];
60
+    
61
+    
53 62
     self.profitLabel = [[UILabel alloc] init];
54 63
     self.profitLabel.layer.cornerRadius = 10;
55 64
     self.profitLabel.layer.masksToBounds = YES;
@@ -85,7 +94,18 @@
85 94
 }
86 95
 
87 96
 - (void)configCellWithModel:(id)model indexPath:(NSIndexPath *)indexpath{
97
+    KDPGoodsModel *goodModel = (KDPGoodsModel *)model;
98
+    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:goodModel.img]];
99
+    self.goodLabel.text = goodModel.title;
88 100
     
89 101
 }
90 102
 
103
+- (UIImageView *)quanImageView{
104
+    if (!_quanImageView) {
105
+        _quanImageView = [[UIImageView alloc] init];
106
+        _quanImageView.image = [UIImage imageNamed:@"coupon_icon"];
107
+    }
108
+    return _quanImageView;
109
+}
110
+
91 111
 @end

+ 20 - 20
Pods/Pods.xcodeproj/xcuserdata/kaipeng.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,102 +7,102 @@
7 7
 		<key>AFNetworking.xcscheme_^#shared#^_</key>
8 8
 		<dict>
9 9
 			<key>orderHint</key>
10
-			<integer>1</integer>
10
+			<integer>0</integer>
11 11
 		</dict>
12 12
 		<key>Bugly.xcscheme_^#shared#^_</key>
13 13
 		<dict>
14 14
 			<key>orderHint</key>
15
-			<integer>2</integer>
15
+			<integer>1</integer>
16 16
 		</dict>
17 17
 		<key>CWLateralSlide.xcscheme_^#shared#^_</key>
18 18
 		<dict>
19 19
 			<key>orderHint</key>
20
-			<integer>3</integer>
20
+			<integer>2</integer>
21 21
 		</dict>
22 22
 		<key>MBProgressHUD.xcscheme_^#shared#^_</key>
23 23
 		<dict>
24 24
 			<key>orderHint</key>
25
-			<integer>5</integer>
25
+			<integer>4</integer>
26 26
 		</dict>
27 27
 		<key>MJExtension.xcscheme_^#shared#^_</key>
28 28
 		<dict>
29 29
 			<key>orderHint</key>
30
-			<integer>7</integer>
30
+			<integer>6</integer>
31 31
 		</dict>
32 32
 		<key>MJRefresh.xcscheme_^#shared#^_</key>
33 33
 		<dict>
34 34
 			<key>orderHint</key>
35
-			<integer>8</integer>
35
+			<integer>7</integer>
36 36
 		</dict>
37 37
 		<key>Masonry.xcscheme_^#shared#^_</key>
38 38
 		<dict>
39 39
 			<key>orderHint</key>
40
-			<integer>4</integer>
40
+			<integer>3</integer>
41 41
 		</dict>
42 42
 		<key>MiPushSDK.xcscheme_^#shared#^_</key>
43 43
 		<dict>
44 44
 			<key>orderHint</key>
45
-			<integer>6</integer>
45
+			<integer>5</integer>
46 46
 		</dict>
47 47
 		<key>PYSearch.xcscheme_^#shared#^_</key>
48 48
 		<dict>
49 49
 			<key>orderHint</key>
50
-			<integer>10</integer>
50
+			<integer>9</integer>
51 51
 		</dict>
52 52
 		<key>Pods-KuDianProject.xcscheme_^#shared#^_</key>
53 53
 		<dict>
54 54
 			<key>orderHint</key>
55
-			<integer>9</integer>
55
+			<integer>8</integer>
56 56
 		</dict>
57 57
 		<key>SDCycleScrollView.xcscheme_^#shared#^_</key>
58 58
 		<dict>
59 59
 			<key>orderHint</key>
60
-			<integer>11</integer>
60
+			<integer>10</integer>
61 61
 		</dict>
62 62
 		<key>SDWebImage.xcscheme_^#shared#^_</key>
63 63
 		<dict>
64 64
 			<key>orderHint</key>
65
-			<integer>12</integer>
65
+			<integer>11</integer>
66 66
 		</dict>
67 67
 		<key>SVProgressHUD.xcscheme_^#shared#^_</key>
68 68
 		<dict>
69 69
 			<key>orderHint</key>
70
-			<integer>13</integer>
70
+			<integer>12</integer>
71 71
 		</dict>
72 72
 		<key>UMengAnalytics.xcscheme_^#shared#^_</key>
73 73
 		<dict>
74 74
 			<key>orderHint</key>
75
-			<integer>14</integer>
75
+			<integer>13</integer>
76 76
 		</dict>
77 77
 		<key>YYCache.xcscheme_^#shared#^_</key>
78 78
 		<dict>
79 79
 			<key>orderHint</key>
80
-			<integer>15</integer>
80
+			<integer>14</integer>
81 81
 		</dict>
82 82
 		<key>YYCategories.xcscheme_^#shared#^_</key>
83 83
 		<dict>
84 84
 			<key>orderHint</key>
85
-			<integer>16</integer>
85
+			<integer>15</integer>
86 86
 		</dict>
87 87
 		<key>YYImage.xcscheme_^#shared#^_</key>
88 88
 		<dict>
89 89
 			<key>orderHint</key>
90
-			<integer>17</integer>
90
+			<integer>16</integer>
91 91
 		</dict>
92 92
 		<key>YYModel.xcscheme_^#shared#^_</key>
93 93
 		<dict>
94 94
 			<key>orderHint</key>
95
-			<integer>18</integer>
95
+			<integer>17</integer>
96 96
 		</dict>
97 97
 		<key>YYText.xcscheme_^#shared#^_</key>
98 98
 		<dict>
99 99
 			<key>orderHint</key>
100
-			<integer>19</integer>
100
+			<integer>18</integer>
101 101
 		</dict>
102 102
 		<key>YYWebImage.xcscheme_^#shared#^_</key>
103 103
 		<dict>
104 104
 			<key>orderHint</key>
105
-			<integer>20</integer>
105
+			<integer>19</integer>
106 106
 		</dict>
107 107
 	</dict>
108 108
 </dict>