瀏覽代碼

Merge branch 'master' of http://101.200.220.49:8001/liuxueli/KDProject

jikaipeng 5 年之前
父節點
當前提交
c361144c2c
共有 27 個文件被更改,包括 792 次插入91 次删除
  1. 26 8
      KuDianProject.xcodeproj/project.pbxproj
  2. 7 0
      KuDianProject/APPKDURL.h
  3. 6 1
      KuDianProject/AppDelegate.m
  4. 7 0
      KuDianProject/PrefixHeader.pch
  5. 10 11
      KuDianProject/Public/KDPNetworkRequestHTTP.m
  6. 3 0
      KuDianProject/Public/KDPublicMethod.h
  7. 11 0
      KuDianProject/Public/KDPublicMethod.m
  8. 2 2
      KuDianProject/TOP/Controller/KDPGoodDetailVC.h
  9. 175 12
      KuDianProject/TOP/Controller/KDPGoodDetailVC.m
  10. 18 0
      KuDianProject/TOP/Controller/KDPProjectListVC.h
  11. 32 0
      KuDianProject/TOP/Controller/KDPProjectListVC.m
  12. 120 9
      KuDianProject/TOP/Controller/KDPTopViewController.m
  13. 27 21
      KuDianProject/TOP/Drawer/Control/KDPWebInteractionVC.m
  14. 21 0
      KuDianProject/TOP/Model/KDPBannerModel.h
  15. 16 0
      KuDianProject/TOP/Model/KDPBannerModel.m
  16. 43 0
      KuDianProject/TOP/Model/KDPGoodsModel.h
  17. 19 0
      KuDianProject/TOP/Model/KDPGoodsModel.m
  18. 4 2
      KuDianProject/TOP/View/Detail/KDPDetailGoodInformationView.h
  19. 94 12
      KuDianProject/TOP/View/Detail/KDPDetailGoodInformationView.m
  20. 1 0
      KuDianProject/TOP/View/Detail/KDPSellingPointView.h
  21. 18 3
      KuDianProject/TOP/View/Detail/KDPSellingPointView.m
  22. 2 1
      KuDianProject/TOP/View/Detail/KDPShopView.h
  23. 20 1
      KuDianProject/TOP/View/Detail/KDPShopView.m
  24. 5 1
      KuDianProject/TOP/View/KDPBannerCell.h
  25. 21 1
      KuDianProject/TOP/View/KDPBannerCell.m
  26. 4 1
      KuDianProject/TOP/View/KDPRecommendGoodCell.h
  27. 80 5
      KuDianProject/TOP/View/KDPRecommendGoodCell.m

+ 26 - 8
KuDianProject.xcodeproj/project.pbxproj

@@ -107,6 +107,9 @@
107 107
 		C5D5626B22CDD75B0035A714 /* KDPRecommendHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = C5D5626A22CDD75B0035A714 /* KDPRecommendHeadView.m */; };
108 108
 		C5D5626E22CDFDD20035A714 /* KDPEarningHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = C5D5626D22CDFDD20035A714 /* KDPEarningHeadView.m */; };
109 109
 		C5D5627122CDFDF00035A714 /* KDPEarnTableHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = C5D5627022CDFDF00035A714 /* KDPEarnTableHeadView.m */; };
110
+		C5DA002A22D4A8B50000DFA8 /* KDPBannerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DA002922D4A8B50000DFA8 /* KDPBannerModel.m */; };
111
+		C5DA002D22D4AACB0000DFA8 /* KDPGoodsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DA002C22D4AACB0000DFA8 /* KDPGoodsModel.m */; };
112
+		C5EB45D222D58B2A006A24F0 /* KDPProjectListVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C5EB45D122D58B2A006A24F0 /* KDPProjectListVC.m */; };
110 113
 		D5717435855D1EAB768416AB /* libPods-KuDianProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B9A054D75DA0898647035D54 /* libPods-KuDianProject.a */; };
111 114
 /* End PBXBuildFile section */
112 115
 
@@ -334,6 +337,12 @@
334 337
 		C5D5626D22CDFDD20035A714 /* KDPEarningHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPEarningHeadView.m; sourceTree = "<group>"; };
335 338
 		C5D5626F22CDFDF00035A714 /* KDPEarnTableHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KDPEarnTableHeadView.h; sourceTree = "<group>"; };
336 339
 		C5D5627022CDFDF00035A714 /* KDPEarnTableHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPEarnTableHeadView.m; sourceTree = "<group>"; };
340
+		C5DA002822D4A8B40000DFA8 /* KDPBannerModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KDPBannerModel.h; sourceTree = "<group>"; };
341
+		C5DA002922D4A8B50000DFA8 /* KDPBannerModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KDPBannerModel.m; sourceTree = "<group>"; };
342
+		C5DA002B22D4AACB0000DFA8 /* KDPGoodsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KDPGoodsModel.h; sourceTree = "<group>"; };
343
+		C5DA002C22D4AACB0000DFA8 /* KDPGoodsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPGoodsModel.m; sourceTree = "<group>"; };
344
+		C5EB45D022D58B2A006A24F0 /* KDPProjectListVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KDPProjectListVC.h; sourceTree = "<group>"; };
345
+		C5EB45D122D58B2A006A24F0 /* KDPProjectListVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KDPProjectListVC.m; sourceTree = "<group>"; };
337 346
 /* End PBXFileReference section */
338 347
 
339 348
 /* Begin PBXFrameworksBuildPhase section */
@@ -815,9 +824,9 @@
815 824
 		C5D5623B22CD9D300035A714 /* TOP */ = {
816 825
 			isa = PBXGroup;
817 826
 			children = (
827
+				C5DA002722D4A8850000DFA8 /* Model */,
818 828
 				C5BAD0AA22D42E2D0084663A /* Drawer */,
819 829
 				C5D5623C22CD9D300035A714 /* Controller */,
820
-				C5D5623D22CD9D300035A714 /* Model */,
821 830
 				C5D5623E22CD9D300035A714 /* View */,
822 831
 			);
823 832
 			path = TOP;
@@ -836,17 +845,12 @@
836 845
 				C5BAD0D922D47DD60084663A /* KDPTodayLiveDataVC.m */,
837 846
 				C5BAD0DB22D47DFD0084663A /* KDPTodayListViewController.h */,
838 847
 				C5BAD0DC22D47DFD0084663A /* KDPTodayListViewController.m */,
848
+				C5EB45D022D58B2A006A24F0 /* KDPProjectListVC.h */,
849
+				C5EB45D122D58B2A006A24F0 /* KDPProjectListVC.m */,
839 850
 			);
840 851
 			path = Controller;
841 852
 			sourceTree = "<group>";
842 853
 		};
843
-		C5D5623D22CD9D300035A714 /* Model */ = {
844
-			isa = PBXGroup;
845
-			children = (
846
-			);
847
-			path = Model;
848
-			sourceTree = "<group>";
849
-		};
850 854
 		C5D5623E22CD9D300035A714 /* View */ = {
851 855
 			isa = PBXGroup;
852 856
 			children = (
@@ -917,6 +921,17 @@
917 921
 			path = MainTab;
918 922
 			sourceTree = "<group>";
919 923
 		};
924
+		C5DA002722D4A8850000DFA8 /* Model */ = {
925
+			isa = PBXGroup;
926
+			children = (
927
+				C5DA002822D4A8B40000DFA8 /* KDPBannerModel.h */,
928
+				C5DA002922D4A8B50000DFA8 /* KDPBannerModel.m */,
929
+				C5DA002B22D4AACB0000DFA8 /* KDPGoodsModel.h */,
930
+				C5DA002C22D4AACB0000DFA8 /* KDPGoodsModel.m */,
931
+			);
932
+			path = Model;
933
+			sourceTree = "<group>";
934
+		};
920 935
 		EDAD9A798350EDEB3C0EA15C /* Pods */ = {
921 936
 			isa = PBXGroup;
922 937
 			children = (
@@ -1105,6 +1120,7 @@
1105 1120
 				C5BAD0C722D461420084663A /* WYWeakScriptMessageDelegate.m in Sources */,
1106 1121
 				C53FD3EF22D31C3300687706 /* KDPAccountVC.m in Sources */,
1107 1122
 				76D7943122CDD7D600C2ECFA /* KDPHeightTool.m in Sources */,
1123
+				C5EB45D222D58B2A006A24F0 /* KDPProjectListVC.m in Sources */,
1108 1124
 				C5BAD0D722D47A510084663A /* UIButton+ImageTitleStyle.m in Sources */,
1109 1125
 				C5BAD0AF22D42EBA0084663A /* KDPCollectHistoryVC.m in Sources */,
1110 1126
 				C5BAD0CA22D46D990084663A /* KDPGoodDetailVC.m in Sources */,
@@ -1180,9 +1196,11 @@
1180 1196
 				76D7944E22CDEBC000C2ECFA /* KDPSupplyContentReusableView.m in Sources */,
1181 1197
 				C5BAD0D322D46E300084663A /* KDPShopView.m in Sources */,
1182 1198
 				76D7942622CDD3CB00C2ECFA /* UINavigationController+FDFullscreenPopGesture.m in Sources */,
1199
+				C5DA002A22D4A8B50000DFA8 /* KDPBannerModel.m in Sources */,
1183 1200
 				764A24CB22D43DE4009B3891 /* LoadingView.m in Sources */,
1184 1201
 				C5BAD0E322D48C600084663A /* SSWLineChartView.m in Sources */,
1185 1202
 				76D7942722CDD3CB00C2ECFA /* UIImageView+CornerRadius.m in Sources */,
1203
+				C5DA002D22D4AACB0000DFA8 /* KDPGoodsModel.m in Sources */,
1186 1204
 				76D7945122CDF2AE00C2ECFA /* KDPSupplyGoodCollectionViewCell.m in Sources */,
1187 1205
 				764A24CC22D43DE4009B3891 /* ActivityIndicatorAnimation.m in Sources */,
1188 1206
 				76D7944B22CDE38400C2ECFA /* KDPSupplyCommentViewCell.m in Sources */,

+ 7 - 0
KuDianProject/APPKDURL.h

@@ -27,4 +27,11 @@
27 27
 
28 28
 #define custSerURL @"https://mapi.kuxuan-inc.com/cool_store/service/index.html"
29 29
 
30
+#define topIncomeUrl [NSString stringWithFormat:@"%@api/home/getHomeTopOrderInfo",KDURL]
31
+#define bannerURL [NSString stringWithFormat:@"%@api/adv/advByType",KDURL]
32
+
33
+#define topGoodRecommURL [NSString stringWithFormat:@"%@api/home/getHomeGoodsListV1",KDURL]
34
+
35
+
36
+#define goodDetailURL [NSString stringWithFormat:@"%@api/goods/detail",KDURL]
30 37
 #endif /* APPKDURL_h */

+ 6 - 1
KuDianProject/AppDelegate.m

@@ -8,6 +8,7 @@
8 8
 
9 9
 #import "AppDelegate.h"
10 10
 #import "KDPTabBarVC.h"
11
+#import "KDPAccountTool.h"
11 12
 #import "KDPWelcomePageViewController.h"
12 13
 @interface AppDelegate ()
13 14
 
@@ -21,7 +22,11 @@
21 22
     self.window.backgroundColor=[UIColor whiteColor];
22 23
     self.window.rootViewController=[[KDPTabBarVC alloc]init];
23 24
     [self.window makeKeyAndVisible];
24
-//    [self.window.rootViewController presentViewController:[[UINavigationController alloc]initWithRootViewController:[[KDPWelcomePageViewController alloc]init]] animated:YES completion:nil];
25
+    if (![KDPAccountTool isLogin]) {
26
+         [self.window.rootViewController presentViewController:[[UINavigationController alloc]initWithRootViewController:[[KDPWelcomePageViewController alloc]init]] animated:YES completion:nil];
27
+    }
28
+    
29
+
25 30
     return YES;
26 31
 }
27 32
 

+ 7 - 0
KuDianProject/PrefixHeader.pch

@@ -56,6 +56,11 @@
56 56
 #import "KDPTodayLiveDataVC.h"
57 57
 #import "KDPTodayListViewController.h"
58 58
 #import "KDPIDTipView.h"
59
+#import "KDPProjectListVC.h"
60
+#import "KDPBannerModel.h"
61
+#import "KDPGoodsModel.h"
62
+#import "KDPWebInteractionVC.h"
63
+#import "KDPProjectListVC.h"
59 64
 
60 65
 // 类别
61 66
 #import "UIView+Gradient.h"
@@ -66,4 +71,6 @@
66 71
 #import "UINavigationBar+handle.h"
67 72
 #import "UINavigationController+FDFullscreenPopGesture.h"
68 73
 #import "UICollectionViewCell+Extension.h"
74
+
75
+
69 76
 #endif /* PrefixHeader_pch */

+ 10 - 11
KuDianProject/Public/KDPNetworkRequestHTTP.m

@@ -22,11 +22,11 @@
22 22
     [manager.requestSerializer setValue:app_Version forHTTPHeaderField:@"version"];
23 23
     [manager.requestSerializer setValue:SOURCE_ID forHTTPHeaderField:@"source"];
24 24
     [manager.requestSerializer setValue:@"ios" forHTTPHeaderField:@"platform"];
25
-//    if ([AccountTool isLogin]) {
26
-//        NSString *token = [AccountTool account].token;
27
-//
28
-//        [manager.requestSerializer setValue:token forHTTPHeaderField:@"token"];
29
-//    }
25
+    if ([KDPAccountTool isLogin]) {
26
+        NSString *token = [KDPAccountTool account].token;
27
+
28
+        [manager.requestSerializer setValue:token forHTTPHeaderField:@"token"];
29
+    }
30 30
     
31 31
     NSString *deviceUUID = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
32 32
     NSString *uuid = [NSString stringWithFormat:@"I-%@",deviceUUID];
@@ -96,12 +96,11 @@
96 96
     [manager.requestSerializer setValue:app_Version forHTTPHeaderField:@"version"];
97 97
     [manager.requestSerializer setValue:SOURCE_ID forHTTPHeaderField:@"source"];
98 98
     [manager.requestSerializer setValue:@"ios" forHTTPHeaderField:@"platform"];
99
-    //    if ([AccountTool isLogin]) {
100
-    //        NSString *token = [AccountTool account].token;
101
-    //
102
-    //        [manager.requestSerializer setValue:token forHTTPHeaderField:@"token"];
103
-    //    }
104
-    
99
+    if ([KDPAccountTool isLogin]) {
100
+        NSString *token = [KDPAccountTool account].token;
101
+        
102
+        [manager.requestSerializer setValue:token forHTTPHeaderField:@"token"];
103
+    }
105 104
     NSString *deviceUUID = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
106 105
     NSString *uuid = [NSString stringWithFormat:@"I-%@",deviceUUID];
107 106
     [manager.requestSerializer setValue:uuid forHTTPHeaderField:@"idfa"];

+ 3 - 0
KuDianProject/Public/KDPublicMethod.h

@@ -19,6 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
19 19
 +(NSDictionary *)getMessage;
20 20
 + (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;
21 21
 + (NSString *)convertToJsonData:(NSDictionary *)dict;
22
+
23
+#pragma mark--计算高度
24
++ (CGFloat)getHeightByWidth:(CGFloat)width title:(NSString *)title font:(UIFont*)font;
22 25
 @end
23 26
 
24 27
 NS_ASSUME_NONNULL_END

+ 11 - 0
KuDianProject/Public/KDPublicMethod.m

@@ -132,4 +132,15 @@
132 132
     return mutStr;
133 133
     
134 134
 }
135
+
136
++ (CGFloat)getHeightByWidth:(CGFloat)width title:(NSString *)title font:(UIFont*)font
137
+{
138
+    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 0)];
139
+    label.text = title;
140
+    label.font = font;
141
+    label.numberOfLines = 0;
142
+    [label sizeToFit];
143
+    CGFloat height = label.frame.size.height;
144
+    return ceil(height);
145
+}
135 146
 @end

+ 2 - 2
KuDianProject/TOP/Controller/KDPGoodDetailVC.h

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

+ 175 - 12
KuDianProject/TOP/Controller/KDPGoodDetailVC.m

@@ -10,36 +10,121 @@
10 10
 #import "KDPDetailGoodInformationView.h"
11 11
 #import "KDPSellingPointView.h"
12 12
 #import "KDPShopView.h"
13
+#import <WebKit/WebKit.h>
13 14
 #define goodHeight 496+KDStatusHeight
14 15
 
15
-@interface KDPGoodDetailVC ()<UIScrollViewDelegate>
16
+@interface KDPGoodDetailVC ()<UIScrollViewDelegate,UIWebViewDelegate,WKNavigationDelegate>
16 17
 {
17 18
     UIView *bottomView;
18 19
     UIButton *collectButton;
19 20
     
21
+    
20 22
 }
23
+@property(nonatomic,strong)UIButton *collectButton;
21 24
 @property(nonatomic,strong)UIScrollView *detailBottonView;
22 25
 @property(nonatomic,strong)KDPDetailGoodInformationView *infoView;
23 26
 @property(nonatomic,strong)KDPSellingPointView *pointView;
24 27
 @property(nonatomic,strong)KDPShopView *shopView;
28
+
29
+@property(nonatomic,strong)KDPGoodsModel *detailModel;
30
+
31
+
32
+@property(nonatomic,strong)WKWebView *detaiWebV;
25 33
 @end
26 34
 
27 35
 @implementation KDPGoodDetailVC
28 36
 
29 37
 - (void)viewDidLoad {
30 38
     [super viewDidLoad];
31
-    self.view.backgroundColor=[UIColor whiteColor];
32
-    [self.view addSubview:self.detailBottonView];
33
-    [self.detailBottonView addSubview:self.infoView];
34
-    [self.detailBottonView addSubview:self.pointView];
35
-    [self.detailBottonView addSubview:self.shopView];
39
+    [self addDetailUI];
36 40
     [self addbottomView];
41
+    self.infoView.model=self.model;
42
+    @try {
43
+        [self.detaiWebV removeObserver:self forKeyPath:@"scrollView.contentSize"];
44
+    } @catch (NSException *exception) {
45
+        
46
+    }
37 47
     
48
+    [self.detaiWebV addObserver:self forKeyPath:@"scrollView.contentSize" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];
49
+    [self.detailBottonView addSubview:self.detaiWebV];
50
+    [self.detaiWebV mas_makeConstraints:^(MASConstraintMaker *make) {
51
+        make.top.mas_equalTo(self.shopView.mas_bottom).offset(40);
52
+        make.width.mas_equalTo(SCREEN_WIDTH);
53
+        make.left.mas_equalTo(0);
54
+    }];
55
+    [self getGoodDetail];
38 56
 }
57
+- (void)dealloc {
58
+    @try{
59
+        [self.detaiWebV removeObserver:self forKeyPath:@"scrollView.contentSize"];
60
+    }@catch (NSException *exception) {
61
+        
62
+    }
63
+    NSLog(@"释放了------------");
64
+}
65
+#pragma makr---商品详情
66
+-(void)getGoodDetail
67
+{
68
+    if (self.model.goods_id.length<=0) {
69
+        return;
70
+    }
71
+    [LoadingView show];
72
+    [KDPNetworkRequestHTTP postURL:goodDetailURL params:@{@"goods_id":self.model.goods_id} success:^(id  _Nonnull json) {
73
+        self.detailModel=[KDPGoodsModel yy_modelWithJSON:json[@"data"]];
74
+        if (self.detailModel.goods_point.length>0) {
75
+            [self good_points];
76
+        }
77
+        self.infoView.model=self.detailModel;
78
+        self.shopView.shopDic=self.detailModel.shop;
79
+        [self loadRequestWeb];
80
+        [LoadingView dismiss];
81
+        
82
+    } failure:^(NSError * _Nonnull error) {
83
+        [LoadingView dismiss];
84
+    }];
85
+}
86
+
87
+#pragma mark----Web详情
88
+-(void)loadRequestWeb
89
+{
90
+    
91
+    NSURL *url=[NSURL URLWithString:self.detailModel.detail_url];
92
+    NSURLRequest *requests=[NSURLRequest requestWithURL:url];
93
+    [self.detaiWebV loadRequest:requests];
94
+}
95
+-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
96
+{
97
+    CGFloat heights =[KDPublicMethod getHeightByWidth:SCREEN_WIDTH-40 title:self.detailModel.goods_point font:[UIFont systemFontOfSize:13]];
98
+    
99
+    if ([keyPath isEqualToString:@"scrollView.contentSize"]) {
100
+        id height =[change valueForKey:NSKeyValueChangeNewKey];
101
+        CGSize size;
102
+        [(NSValue *)height getValue:&size];
103
+        [self.detaiWebV mas_updateConstraints:^(MASConstraintMaker *make) {
104
+            make.height.mas_equalTo(size.height);
105
+        }];
106
+        self.detailBottonView.contentSize=CGSizeMake(0, size.height+goodHeight+115+heights);
107
+    }
108
+}
109
+
110
+#pragma makr---赋值。卖点
111
+-(void)good_points
112
+{
113
+    CGFloat height =[KDPublicMethod getHeightByWidth:SCREEN_WIDTH-40 title:self.detailModel.goods_point font:[UIFont systemFontOfSize:13]];
114
+    self.pointView.point_good =self.detailModel.goods_point;
115
+    [self.pointView mas_updateConstraints:^(MASConstraintMaker *make) {
116
+        make.top.mas_equalTo(goodHeight);
117
+        make.height.mas_equalTo(height+50);
39 118
 
119
+    }];
120
+    [self.shopView mas_updateConstraints:^(MASConstraintMaker *make) {
121
+        make.top.mas_equalTo(self.pointView.mas_bottom);
122
+    }];
123
+    
124
+}
40 125
 -(void)addbottomView
41 126
 {
42
-    bottomView =[[UIView alloc]initWithFrame:CGRectMake(0, self.detailBottonView.bottom, SCREEN_WIDTH, KDTabBarHeight)];
127
+    bottomView =[[UIView alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT-KDTabBarHeight, SCREEN_WIDTH, KDTabBarHeight)];
43 128
     bottomView.backgroundColor=[UIColor whiteColor];
44 129
     [self.view addSubview:bottomView];
45 130
     
@@ -110,7 +195,7 @@
110 195
 -(KDPDetailGoodInformationView *)infoView
111 196
 {
112 197
     if (!_infoView) {
113
-        _infoView=[[KDPDetailGoodInformationView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, goodHeight)];
198
+        _infoView=[[KDPDetailGoodInformationView alloc]init];
114 199
         __weak KDPGoodDetailVC *weakself=self;
115 200
         _infoView.returnBlock = ^{
116 201
             [weakself.navigationController popViewControllerAnimated:YES];
@@ -122,7 +207,7 @@
122 207
 -(KDPShopView *)shopView
123 208
 {
124 209
     if (!_shopView) {
125
-        _shopView=[[KDPShopView alloc]initWithFrame:CGRectMake(0, self.pointView.bottom, SCREEN_WIDTH, 70)];
210
+        _shopView=[[KDPShopView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 70)];
126 211
         
127 212
         
128 213
     }
@@ -132,17 +217,95 @@
132 217
 -(KDPSellingPointView *)pointView
133 218
 {
134 219
     if (!_pointView) {
135
-        _pointView=[[KDPSellingPointView alloc]initWithFrame:CGRectMake(0, self.infoView.bottom, SCREEN_WIDTH, 60)];
220
+        _pointView=[[KDPSellingPointView alloc]init];
136 221
         
137 222
     }
138 223
     return _pointView;
139 224
 }
140
-
225
+-(void)addDetailUI
226
+{
227
+    self.view.backgroundColor=[UIColor whiteColor];
228
+    [self.view addSubview:self.detailBottonView];
229
+    [self.detailBottonView addSubview:self.infoView];
230
+    [self.detailBottonView addSubview:self.pointView];
231
+    [self.detailBottonView addSubview:self.shopView];
232
+    [self.detailBottonView mas_makeConstraints:^(MASConstraintMaker *make) {
233
+        make.left.right.top.mas_equalTo(0);
234
+        make.bottom.mas_equalTo(self.view.mas_bottom).offset(-KDTabBarHeight);
235
+    }];
236
+    [self.infoView mas_makeConstraints:^(MASConstraintMaker *make) {
237
+        make.left.top.mas_equalTo(0);
238
+        make.width.mas_equalTo(SCREEN_WIDTH);
239
+        make.height.mas_equalTo(goodHeight);
240
+    }];
241
+    [self.pointView mas_makeConstraints:^(MASConstraintMaker *make) {
242
+        make.top.mas_equalTo(self.infoView.mas_bottom);
243
+        make.left.mas_equalTo(0);
244
+        make.width.mas_equalTo(SCREEN_WIDTH);
245
+        make.height.mas_equalTo(0);
246
+        
247
+    }];
248
+    [self.shopView mas_makeConstraints:^(MASConstraintMaker *make) {
249
+        make.left.mas_equalTo(0);
250
+        make.width.mas_equalTo(SCREEN_WIDTH);
251
+        make.height.mas_equalTo(75);
252
+        make.top.mas_equalTo(self.pointView.mas_bottom);
253
+    }];
254
+    [self addDetailTitle];
255
+    
256
+   
257
+    UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(15, KDStatusHeight+10, 30, 30)];
258
+    returnBtn.layer.cornerRadius=15;
259
+    returnBtn.layer.masksToBounds=YES;
260
+    [self.view addSubview:returnBtn];
261
+    returnBtn.backgroundColor=[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.4];
262
+    [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal];
263
+    [returnBtn addTarget:self action:@selector(exitclickButton) forControlEvents:UIControlEventTouchUpInside];
264
+    
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];
268
+    
269
+    
270
+}
271
+-(void)addDetailTitle
272
+{
273
+   
274
+    UILabel *titleL=[[UILabel alloc]init];
275
+    titleL.textColor=[UIColor colorWithHexString:fontColor];
276
+    titleL.text=@"————  商品详情  ————";
277
+    titleL.font=[UIFont systemFontOfSize:14];
278
+    titleL.textAlignment=NSTextAlignmentCenter;
279
+    [self.detailBottonView addSubview:titleL];
280
+    [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
281
+        make.top.mas_equalTo(self.shopView.mas_bottom);
282
+        make.height.mas_equalTo(40);
283
+        make.width.mas_equalTo(SCREEN_WIDTH);
284
+        make.left.mas_equalTo(0);
285
+    }];
286
+    
287
+    
288
+    
289
+    
290
+}
291
+-(void)exitclickButton
292
+{
293
+    [self.navigationController popViewControllerAnimated:YES];
294
+}
295
+-(WKWebView *)detaiWebV
296
+{
297
+    if (!_detaiWebV) {
298
+        _detaiWebV= [[WKWebView alloc]init];
299
+        _detaiWebV.navigationDelegate=self;
300
+        _detaiWebV.scrollView.scrollEnabled=NO;
301
+    }
302
+    return _detaiWebV;
303
+}
141 304
 
142 305
 -(UIScrollView *)detailBottonView
143 306
 {
144 307
     if (!_detailBottonView) {
145
-        _detailBottonView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-KDTabBarHeight)];
308
+        _detailBottonView=[[UIScrollView alloc]init];
146 309
         _detailBottonView.delegate=self;
147 310
         _detailBottonView.backgroundColor=[UIColor whiteColor];
148 311
         _detailBottonView.showsVerticalScrollIndicator=NO;

+ 18 - 0
KuDianProject/TOP/Controller/KDPProjectListVC.h

@@ -0,0 +1,18 @@
1
+//
2
+//  KDPProjectListVC.h
3
+//  KuDianProject
4
+//
5
+//  Created by 学丽 on 2019/7/10.
6
+//  Copyright © 2019 KDP. All rights reserved.
7
+//
8
+
9
+#import "KDPMainViewController.h"
10
+
11
+NS_ASSUME_NONNULL_BEGIN
12
+
13
+@interface KDPProjectListVC : KDPMainViewController
14
+@property(nonatomic,strong)NSString *projectID;
15
+
16
+@end
17
+
18
+NS_ASSUME_NONNULL_END

+ 32 - 0
KuDianProject/TOP/Controller/KDPProjectListVC.m

@@ -0,0 +1,32 @@
1
+//
2
+//  KDPProjectListVC.m
3
+//  KuDianProject
4
+//
5
+//  Created by 学丽 on 2019/7/10.
6
+//  Copyright © 2019 KDP. All rights reserved.
7
+//
8
+
9
+#import "KDPProjectListVC.h"
10
+
11
+@interface KDPProjectListVC ()
12
+
13
+@end
14
+
15
+@implementation KDPProjectListVC
16
+
17
+- (void)viewDidLoad {
18
+    [super viewDidLoad];
19
+    // Do any additional setup after loading the view.
20
+}
21
+
22
+/*
23
+#pragma mark - Navigation
24
+
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.
29
+}
30
+*/
31
+
32
+@end

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

@@ -12,26 +12,109 @@
12 12
 #define recommendCell @"recommendCell"
13 13
 #define recommendHead @"recommendHead"
14 14
 @interface KDPTopViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
15
+{
16
+    
17
+    
18
+}
19
+@property(nonatomic,strong)NSMutableArray *dataArray;
20
+@property(nonatomic,strong)NSArray *bannerArray;
21
+@property(nonatomic,copy)NSString *orderNumber;
22
+@property(nonatomic,copy)NSString *order_rebate_money;
15 23
 @property(nonatomic,strong)UIButton *headImgBtn;//左侧头像按钮
16 24
 @property(nonatomic,strong)UIButton *messageButton;//右侧消息按钮
17 25
 
18 26
 @property(nonatomic,strong)UICollectionView *dataCollectionView;
19 27
 
28
+
29
+//服务端传参
30
+@property(nonatomic,strong)NSString *pageNum;
31
+@property(nonatomic,strong)NSString *selection_page;
32
+@property(nonatomic,strong)NSString *selection_id;
33
+
34
+@property(nonatomic,strong)NSString *selection_id_count;
35
+
36
+@property(nonatomic,strong)NSString *selection_id_page;
37
+
20 38
 @end
21 39
 
22 40
 @implementation KDPTopViewController
23
-
41
+-(void)initialieValues
42
+{
43
+    self.pageNum=@"1";
44
+    self.selection_id=@"0";
45
+    self.selection_id_count=@"0";
46
+    self.selection_id_page=@"0";
47
+    self.selection_page=@"0";
48
+}
24 49
 - (void)viewDidLoad {
25 50
     [super viewDidLoad];
26
-   
51
+    [self initialieValues];
27 52
     [self initUI];
28 53
     
29
-    KDPIDTipView *piv=[[KDPIDTipView alloc]init];
30
-    [self.view addSubview:piv];
31
-    [piv mas_makeConstraints:^(MASConstraintMaker *make) {
32
-        make.left.top.right.bottom.mas_equalTo(0);
54
+//    KDPIDTipView *piv=[[KDPIDTipView alloc]init];
55
+//    [self.view addSubview:piv];
56
+//    [piv mas_makeConstraints:^(MASConstraintMaker *make) {
57
+//        make.left.top.right.bottom.mas_equalTo(0);
58
+//    }];
59
+    [self getUserTodayIncom];
60
+    [self getBanner];
61
+    [self getRecommendGood];
62
+}
63
+
64
+#pragma makr---首页收益
65
+-(void)getUserTodayIncom
66
+{
67
+    [LoadingView show];
68
+    [KDPNetworkRequestHTTP postURL:topIncomeUrl params:nil success:^(id  _Nonnull json) {
69
+        self.orderNumber =json[@"num"];//总数量;
70
+        self.order_rebate_money = json[@"total_rebate"];
71
+        [self.dataCollectionView reloadData];
72
+        [LoadingView dismiss];
73
+    } failure:^(NSError * _Nonnull error) {
74
+        [LoadingView dismiss];
75
+    }];
76
+}
77
+
78
+#pragma makr---首页banner
79
+-(void)getBanner
80
+{
81
+    [LoadingView show];
82
+    [KDPNetworkRequestHTTP getURL:bannerURL params:@{@"adv_type":@"1"} success:^(id  _Nonnull json) {
83
+        [LoadingView dismiss];
84
+        self.bannerArray=[NSArray yy_modelArrayWithClass:[KDPBannerModel class] json:json[@"data"]];
85
+        [self.dataCollectionView reloadData];
86
+        
87
+    } failure:^(NSError * _Nonnull error) {
88
+        [LoadingView dismiss];
89
+    }];
90
+}
91
+
92
+#pragma makr---获取首页数据
93
+-(void)getRecommendGood
94
+{
95
+    [LoadingView show];
96
+    NSDictionary *dic=@{@"page":self.pageNum,@"selection_page":self.selection_page,@"selection_id":self.selection_id,@"selection_id_page":self.selection_id_page,@"selection_id_count":self.selection_id_count};
97
+    [KDPNetworkRequestHTTP postURL:topGoodRecommURL params:dic success:^(id  _Nonnull json) {
98
+        [LoadingView dismiss];
99
+        self.selection_id_page = json[@"selection_id_count"];
100
+        self.selection_id = json[@"selection_id"];
101
+         self.selection_page = json[@"selection_page"];
102
+        self.selection_id_count = json[@"selection_id_count"];
103
+        if (self.pageNum.integerValue == 1) {
104
+            [self.dataArray removeAllObjects];
105
+            
106
+        }
107
+        NSArray *currentA=[NSArray yy_modelArrayWithClass:[KDPGoodsModel class] json:json[@"data"]];
108
+        [self.dataArray addObjectsFromArray:currentA];
109
+        
110
+        
111
+        [self.dataCollectionView reloadData];
112
+        
113
+    } failure:^(NSError * _Nonnull error) {
114
+        [LoadingView dismiss];
33 115
     }];
34 116
 }
117
+
35 118
 -(void)initUI
36 119
 {
37 120
     self.navBar.navTitleLabel.text=@"酷店";
@@ -75,14 +158,35 @@
75 158
 {
76 159
     if (indexPath.section == 1) {
77 160
         KDPBannerCell *bannerC=[collectionView dequeueReusableCellWithReuseIdentifier:bannerCell forIndexPath:indexPath];
161
+        bannerC.bannerArr  = self.bannerArray;
162
+        bannerC.bannerBlock = ^(KDPBannerModel * _Nonnull model) {
163
+            if (model.click_type.integerValue == 1) {//h5
164
+                KDPWebInteractionVC *web=[[KDPWebInteractionVC alloc]init];
165
+                web.url=model.click_param;
166
+                [self.navigationController pushViewController:web animated:YES];
167
+            }else if (model.click_type.integerValue == 2){//商品详情
168
+                KDPGoodDetailVC *goodD=[[KDPGoodDetailVC alloc]init];
169
+                KDPGoodsModel *models=[[KDPGoodsModel alloc]init];
170
+                models.goods_id=model.click_param;
171
+                goodD.model=models;
172
+                [self.navigationController pushViewController:goodD animated:YES];
173
+            }else if (model.click_type.integerValue == 3)
174
+            {//x专题列表
175
+                KDPProjectListVC *listV=[[KDPProjectListVC alloc]init];
176
+                listV.projectID=model.click_param;
177
+                [self.navigationController pushViewController:listV animated:YES];
178
+            }
179
+        };
78 180
         return bannerC;
79 181
     }
80 182
     if (indexPath.section == 2) {
81 183
         KDPRecommendGoodCell *goodC=[collectionView dequeueReusableCellWithReuseIdentifier:recommendCell forIndexPath:indexPath];
82
-        
184
+        goodC.model=self.dataArray[indexPath.row];
83 185
         return goodC;
84 186
     }
85 187
     KDPLiveEarningCell *earinCell =[collectionView dequeueReusableCellWithReuseIdentifier:liveEarningCell forIndexPath:indexPath];
188
+    earinCell.orderNumgL.text=self.orderNumber;
189
+    earinCell.Forecastlabel.text=self.order_rebate_money;
86 190
     earinCell.liveDataBlock = ^{
87 191
         self.tabBarController.selectedIndex=2;
88 192
     };
@@ -97,7 +201,7 @@
97 201
 -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
98 202
 {
99 203
     if (section == 2) {
100
-        return 5;
204
+        return self.dataArray.count;
101 205
     }
102 206
     return 1;
103 207
 }
@@ -119,6 +223,7 @@
119 223
     }
120 224
     if (indexPath.section == 2) {
121 225
         KDPGoodDetailVC *goodDetail=[[KDPGoodDetailVC alloc]init];
226
+        goodDetail.model=self.dataArray[indexPath.row];
122 227
         [self.navigationController pushViewController:goodDetail animated:YES];
123 228
     }
124 229
 }
@@ -141,7 +246,13 @@
141 246
     return nil;
142 247
 }
143 248
 
144
-
249
+-(NSMutableArray *)dataArray
250
+{
251
+    if (!_dataArray) {
252
+        _dataArray=[NSMutableArray array];
253
+    }
254
+    return _dataArray;
255
+}
145 256
 #pragma mark---页面布局
146 257
 -(UIButton *)headImgBtn
147 258
 {

+ 27 - 21
KuDianProject/TOP/Drawer/Control/KDPWebInteractionVC.m

@@ -102,17 +102,23 @@ static NSString *kd_h5_open_goodDetail=@"kd_h5_open_goodDetail";
102 102
 #pragma mark--跳转详情
103 103
 -(void)JumpGoodDetail:(WKScriptMessage *)message
104 104
 {
105
-//    NSDictionary *dict = [self dictionaryWithJsonString:message.body];
106
-//    KDGoodModel *model =[[KDGoodModel alloc]init];
107
-//    model.goods_id = [NSString stringWithFormat:@"%@",dict[@"goodsid"]];
108
-//    KDGoodDetailVC *detailVC = [[KDGoodDetailVC alloc] init];
109
-//    detailVC.model = model;
110
-//
111
-//    [self.navigationController pushViewController:detailVC animated:YES];
105
+    NSDictionary *dict = [KDPublicMethod dictionaryWithJsonString:message.body];
106
+    KDPGoodsModel *model =[[KDPGoodsModel alloc]init];
107
+    model.goods_id = [NSString stringWithFormat:@"%@",dict[@"goodsid"]];
108
+    KDPGoodDetailVC *detailVC = [[KDPGoodDetailVC alloc] init];
109
+    detailVC.model = model;
110
+
111
+    [self.navigationController pushViewController:detailVC animated:YES];
112 112
 }
113 113
 -(void)getGoodDetail:(WKScriptMessage *)message
114 114
 {
115
-   
115
+    NSDictionary *dict = [KDPublicMethod dictionaryWithJsonString:message.body];
116
+    KDPGoodsModel *model =[[KDPGoodsModel alloc]init];
117
+    model.goods_id = [NSString stringWithFormat:@"%@",dict[@"goodsId"]];
118
+    KDPGoodDetailVC *detailVC = [[KDPGoodDetailVC alloc] init];
119
+    detailVC.model = model;
120
+    
121
+    [self.navigationController pushViewController:detailVC animated:YES];
116 122
 }
117 123
 #pragma mark---保存本地
118 124
 -(void)saveLocal:(WKScriptMessage *)message
@@ -147,19 +153,19 @@ static NSString *kd_h5_open_goodDetail=@"kd_h5_open_goodDetail";
147 153
  */
148 154
 - (void)sendUserTokenToJS:(WKScriptMessage *)message {
149 155
     
150
-//    __block NSString *token = [AccountTool account].token;
151
-//
152
-//    NSDictionary *dict = [self dictionaryWithJsonString:message.body];
153
-//    NSString *jsMethod = dict[@"js_callback"];
154
-//    if (!token) {
155
-//        token = @"";
156
-//    }
157
-//    NSDictionary *tokenPara = @{@"token":token};
158
-//    NSString *jsonDict = [self convertToJsonData:tokenPara];
159
-//    NSString *callBacKMethod = [NSString stringWithFormat:@"%@('%@')",jsMethod,jsonDict];
160
-//    [self.webInterView evaluateJavaScript:callBacKMethod completionHandler:^(id _Nullable value, NSError * _Nullable error) {
161
-//
162
-//    }];
156
+    __block NSString *token = [KDPAccountTool account].token;
157
+
158
+    NSDictionary *dict = [KDPublicMethod dictionaryWithJsonString:message.body];
159
+    NSString *jsMethod = dict[@"js_callback"];
160
+    if (!token) {
161
+        token = @"";
162
+    }
163
+    NSDictionary *tokenPara = @{@"token":token};
164
+    NSString *jsonDict = [KDPublicMethod convertToJsonData:tokenPara];
165
+    NSString *callBacKMethod = [NSString stringWithFormat:@"%@('%@')",jsMethod,jsonDict];
166
+    [self.webInterView evaluateJavaScript:callBacKMethod completionHandler:^(id _Nullable value, NSError * _Nullable error) {
167
+
168
+    }];
163 169
     
164 170
 }
165 171
 - (void)loadRequest {

+ 21 - 0
KuDianProject/TOP/Model/KDPBannerModel.h

@@ -0,0 +1,21 @@
1
+//
2
+//  KDPBannerModel.h
3
+//  KuDianProject
4
+//
5
+//  Created by 学丽 on 2019/7/9.
6
+//  Copyright © 2019 KDP. All rights reserved.
7
+//
8
+
9
+#import <Foundation/Foundation.h>
10
+
11
+NS_ASSUME_NONNULL_BEGIN
12
+
13
+@interface KDPBannerModel : NSObject
14
+@property (nonatomic, strong) NSString *click_type;
15
+@property (nonatomic, strong) NSString *click_param;
16
+@property (nonatomic, strong) NSString *img;
17
+@property (nonatomic, strong) NSString *type;
18
+@property (nonatomic, strong) NSString *title;
19
+@end
20
+
21
+NS_ASSUME_NONNULL_END

+ 16 - 0
KuDianProject/TOP/Model/KDPBannerModel.m

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

+ 43 - 0
KuDianProject/TOP/Model/KDPGoodsModel.h

@@ -0,0 +1,43 @@
1
+//
2
+//  KDPGoodsModel.h
3
+//  KuDianProject
4
+//
5
+//  Created by 学丽 on 2019/7/9.
6
+//  Copyright © 2019 KDP. All rights reserved.
7
+//
8
+
9
+#import <Foundation/Foundation.h>
10
+
11
+NS_ASSUME_NONNULL_BEGIN
12
+
13
+@interface KDPGoodsModel : NSObject
14
+@property(nonatomic,copy)NSString *zk_final_price;//原价
15
+@property(nonatomic,copy)NSString *order_count;//原价
16
+@property(nonatomic,copy)NSString *commission_rate;
17
+
18
+@property(nonatomic,copy)NSString *shop_title;
19
+@property(nonatomic,copy)NSString *shop_type;
20
+@property(nonatomic,copy)NSString *Id;
21
+@property(nonatomic,copy)NSString *name;
22
+@property(nonatomic,copy)NSString *goods_id;
23
+@property(nonatomic,copy)NSString *title;
24
+@property(nonatomic,copy)NSString *img;
25
+@property(nonatomic,strong)NSDictionary *shop;
26
+@property(nonatomic,copy)NSString *origin;
27
+@property(nonatomic,copy)NSArray *small_img;
28
+@property(nonatomic,copy)NSString *price;
29
+@property(nonatomic,copy)NSString *is_collect;//是否收藏
30
+@property(nonatomic,copy)NSString *selection_tag;
31
+@property(nonatomic,copy)NSString *discount_price;
32
+@property(nonatomic,copy)NSString *coupon_price;
33
+@property(nonatomic,copy)NSString *is_coupon;
34
+@property(nonatomic,copy)NSString *volume;
35
+@property(nonatomic,copy)NSString *commisson_price;
36
+@property(nonatomic,copy)NSString *detail_url;
37
+@property(nonatomic,copy)NSString *commission_price;
38
+@property(nonatomic,copy)NSString *goods_point;//商品卖点
39
+
40
+
41
+@end
42
+
43
+NS_ASSUME_NONNULL_END

+ 19 - 0
KuDianProject/TOP/Model/KDPGoodsModel.m

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

+ 4 - 2
KuDianProject/TOP/View/Detail/KDPDetailGoodInformationView.h

@@ -7,7 +7,7 @@
7 7
 //
8 8
 
9 9
 #import <UIKit/UIKit.h>
10
-
10
+#import "KDPGoodsModel.h"
11 11
 NS_ASSUME_NONNULL_BEGIN
12 12
 
13 13
 @interface KDPDetailGoodInformationView : UIView<SDCycleScrollViewDelegate>
@@ -19,7 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
19 19
 @property(nonatomic,strong)UILabel *volumeL;
20 20
 @property(nonatomic,strong)UILabel *originalLabel;
21 21
 @property(nonatomic,copy)void(^returnBlock)(void);
22
-
22
+@property(nonatomic,strong)KDPGoodsModel *model;
23
+@property(nonatomic,strong)UIImageView *couponImgV;
24
+@property(nonatomic,strong)UILabel *couponPriceL;
23 25
 @end
24 26
 
25 27
 NS_ASSUME_NONNULL_END

+ 94 - 12
KuDianProject/TOP/View/Detail/KDPDetailGoodInformationView.m

@@ -19,19 +19,9 @@
19 19
         self.imgView.backgroundColor=[UIColor colorWithHexString:LineColor];
20 20
         [self addSubview:self.imgView];
21 21
         
22
-        self.collectButton=[[UIButton alloc]initWithFrame:CGRectMake(self.width-37, KDStatusHeight, 22, 22)];
23
-        [self.collectButton setImage:[UIImage imageNamed:@"detail_collection"] forState:UIControlStateNormal];
24
-        [self addSubview:self.collectButton];
22
+       
25 23
         
26 24
         
27
-        UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(15, KDStatusHeight, 30, 30)];
28
-        returnBtn.layer.cornerRadius=15;
29
-        returnBtn.layer.masksToBounds=YES;
30
-        [self addSubview:returnBtn];
31
-        returnBtn.backgroundColor=[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.4];
32
-        [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal];
33
-        [returnBtn addTarget:self action:@selector(exitclickButton) forControlEvents:UIControlEventTouchUpInside];
34
-        
35 25
         self.shopImgV=[[UIImageView alloc]initWithFrame:CGRectMake(10, self.imgView.bottom+14, 20, 20)];
36 26
         self.shopImgV.image=[UIImage imageNamed:@"taobao_icon"];
37 27
         [self addSubview:self.shopImgV];
@@ -63,19 +53,111 @@
63 53
         NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:textStr attributes:attribtDic];
64 54
         self.originalLabel.attributedText=attribtStr;
65 55
         
66
-        self.volumeL=[[UILabel alloc]initWithFrame:CGRectMake(self.width-150, self.priceL.bottom+5, 140, 14)];
56
+        self.volumeL=[[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-150, self.originalLabel.top, 140, 14)];
67 57
         self.volumeL.textAlignment=NSTextAlignmentRight;
68 58
         self.volumeL.text=@"月销:--";
69 59
         self.volumeL.textColor=[UIColor colorWithHexString:@"#a9a9a9"];
70 60
         self.volumeL.font=[UIFont systemFontOfSize:10];
71 61
         [self addSubview:self.volumeL];
72 62
         
63
+        [self addSubview:self.couponImgV];
64
+        [self.couponImgV addSubview:self.couponPriceL];
65
+
66
+        self.couponImgV.frame=CGRectMake(SCREEN_WIDTH-70, self.priceL.top, 60, 16);
67
+        self.couponPriceL.frame=CGRectMake(20, 0, 40, 16);
73 68
         
74 69
         
70
+        UIView *lineV=[[UIView alloc]init];
71
+        lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
72
+        [self addSubview:lineV];
73
+        [lineV mas_makeConstraints:^(MASConstraintMaker *make) {
74
+            make.left.mas_equalTo(10);
75
+            make.right.mas_equalTo(-10);
76
+            make.top.mas_equalTo(self.mas_bottom).offset(-5);
77
+            make.height.mas_equalTo(5);
78
+        }];
75 79
     }
76 80
     return self;
77 81
 }
78 82
 
83
+
84
+-(void)setModel:(KDPGoodsModel *)model
85
+{
86
+    _model=model;
87
+    self.detailTitleL.attributedText=[KDPublicMethod sethanggaoWithStr:[NSString stringWithFormat:@"        %@",model.title] linSpacing:5];
88
+    if (model.shop_type.integerValue == 1) {
89
+        self.shopImgV.image =[UIImage imageNamed:@"tm_icon"];
90
+    }else{
91
+        self.shopImgV.image =[UIImage imageNamed:@"taobao_icon"];
92
+        
93
+    }
94
+    
95
+    self.volumeL.text=[NSString stringWithFormat:@"月销 %@",model.volume];
96
+    
97
+    NSString *timetitle= [NSString stringWithFormat:@"¥%@/利润%@",model.discount_price,model.commission_rate];
98
+    NSString *prices =[NSString stringWithFormat:@"¥%@/",model.discount_price];
99
+    NSMutableAttributedString *timestr = [[NSMutableAttributedString alloc] initWithString:timetitle];
100
+    [timestr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"#333333"] range:NSMakeRange(0,prices.length)];
101
+    [timestr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(prices.length,2)]; //设置字体字号和字体类别
102
+    [timestr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:ThemeColor] range:NSMakeRange(prices.length,timetitle.length-prices.length)];
103
+    
104
+    self.priceL.attributedText=timestr;
105
+    //原价
106
+    NSString *textStr =[NSString stringWithFormat:@"¥%@",model.price];
107
+    
108
+    //中划线
109
+    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
110
+    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:textStr attributes:attribtDic];
111
+    self.originalLabel.attributedText=attribtStr;
112
+    
113
+    
114
+    NSMutableArray *array =[NSMutableArray array];
115
+    [array addObject:model.img];
116
+    [array addObjectsFromArray:model.small_img];
117
+    self.imgView.imageURLStringsGroup=array;
118
+
119
+    
120
+    if (model.coupon_price.floatValue>0) {
121
+        self.couponImgV.hidden=NO;
122
+        self.couponPriceL.text=model.coupon_price;
123
+    }else{
124
+        self.couponImgV.hidden=YES;
125
+    }
126
+    
127
+}
128
+
129
+
130
+-(UIImageView *)couponImgV
131
+{
132
+    if (!_couponImgV) {
133
+        _couponImgV=[[UIImageView alloc]init];
134
+        _couponImgV.image=[UIImage imageNamed:@"coupon_icon"];
135
+        
136
+        UILabel *quanL=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 20, 16)];
137
+        quanL.text=@"券";
138
+        quanL.font=[UIFont systemFontOfSize:12];
139
+        quanL.textColor=[UIColor whiteColor];
140
+        quanL.textAlignment=NSTextAlignmentCenter;
141
+        [_couponImgV addSubview:quanL];
142
+        
143
+    }
144
+    return _couponImgV;
145
+}
146
+-(UILabel *)couponPriceL
147
+{
148
+    if (!_couponPriceL) {
149
+        _couponPriceL=[[UILabel alloc]init];
150
+        _couponPriceL.text=@"---";
151
+        _couponPriceL.textColor=[UIColor colorWithHexString:ThemeColor];
152
+        _couponPriceL.font=[UIFont systemFontOfSize:12];
153
+        _couponPriceL.textAlignment=NSTextAlignmentCenter;
154
+        
155
+    }
156
+    return _couponPriceL;
157
+}
158
+
159
+
160
+
79 161
 -(void)exitclickButton
80 162
 {
81 163
     if (self.returnBlock) {

+ 1 - 0
KuDianProject/TOP/View/Detail/KDPSellingPointView.h

@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
13 13
 @interface KDPSellingPointView : UIView
14 14
 @property(nonatomic,strong)UILabel *pointLabel;
15 15
 @property(nonatomic,strong)UIView *hotView;
16
+@property(nonatomic,copy)NSString *point_good;
16 17
 @end
17 18
 
18 19
 NS_ASSUME_NONNULL_END

+ 18 - 3
KuDianProject/TOP/View/Detail/KDPSellingPointView.m

@@ -14,7 +14,7 @@
14 14
 {
15 15
     self =[super initWithFrame:frame];
16 16
     if (self) {
17
-        self.hotView=[[UIView alloc]initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 50)];
17
+        self.hotView=[[UIView alloc]initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 0)];
18 18
         self.hotView.layer.cornerRadius=5;
19 19
         self.hotView.layer.masksToBounds=YES;
20 20
         [self addSubview:self.hotView];
@@ -56,10 +56,25 @@
56 56
     return self;
57 57
 }
58 58
 
59
-
59
+-(void)setPoint_good:(NSString *)point_good
60
+{
61
+    _point_good  = point_good;
62
+    self.pointLabel.text=point_good;
63
+     CGFloat height =[KDPublicMethod getHeightByWidth:SCREEN_WIDTH-40 title:point_good font:[UIFont systemFontOfSize:13]];
64
+    self.hotView.frame=CGRectMake(10, 0, SCREEN_WIDTH-20, 45+height);
65
+    self.pointLabel.frame=CGRectMake(10,28, SCREEN_WIDTH-40, 10+height);
66
+    
67
+}
60 68
 #pragma mark---复制
61 69
 -(void)copyclickButton
62 70
 {
63
-    
71
+    UIPasteboard * pastboard = [UIPasteboard generalPasteboard];
72
+    if (self.point_good) {
73
+        pastboard.string =self.point_good;
74
+        [MBProgressHUD showMessage:@"复制成功"];
75
+        
76
+    }else {
77
+        [MBProgressHUD showMessage:@"复制失败"];
78
+    }
64 79
 }
65 80
 @end

+ 2 - 1
KuDianProject/TOP/View/Detail/KDPShopView.h

@@ -7,13 +7,14 @@
7 7
 //
8 8
 
9 9
 #import <UIKit/UIKit.h>
10
-
10
+#import "KDPGoodsModel.h"
11 11
 NS_ASSUME_NONNULL_BEGIN
12 12
 
13 13
 @interface KDPShopView : UIView
14 14
 @property(nonatomic,strong)UIImageView *shopimgV;
15 15
 @property(nonatomic,strong)UILabel *shopLabel;
16 16
 @property(nonatomic,strong)UILabel *desclabel;
17
+@property(nonatomic,strong)NSDictionary *shopDic;
17 18
 @end
18 19
 
19 20
 NS_ASSUME_NONNULL_END

+ 20 - 1
KuDianProject/TOP/View/Detail/KDPShopView.m

@@ -18,7 +18,7 @@
18 18
         self.shopimgV.backgroundColor=[UIColor colorWithHexString:LineColor];
19 19
         [self addSubview:self.shopimgV];
20 20
         
21
-        self.shopLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.shopimgV.right+10, 10, self.width-self.shopimgV.right-10, 20)];
21
+        self.shopLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.shopimgV.right+10, 15, self.width-self.shopimgV.right-10, 20)];
22 22
         self.shopLabel.textColor=[UIColor colorWithHexString:fontColor];
23 23
         self.shopLabel.font=[UIFont systemFontOfSize:14];
24 24
         [self addSubview:self.shopLabel];
@@ -28,7 +28,26 @@
28 28
         self.desclabel.textColor=[UIColor colorWithHexString:@"#999999"];
29 29
         [self addSubview:self.desclabel];
30 30
         
31
+        
32
+        UIView *lineV=[[UIView alloc]init];
33
+        lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
34
+        [self addSubview:lineV];
35
+        [lineV mas_makeConstraints:^(MASConstraintMaker *make) {
36
+            make.left.mas_equalTo(10);
37
+            make.right.mas_equalTo(-10);
38
+            make.top.mas_equalTo(self.mas_bottom).offset(-5);
39
+            make.height.mas_equalTo(5);
40
+        }];
31 41
     }
32 42
     return self;
33 43
 }
44
+
45
+-(void)setShopDic:(NSDictionary *)shopDic
46
+{
47
+    _shopDic = shopDic;
48
+    [self.shopimgV sd_setImageWithURL:[NSURL URLWithString:shopDic[@"pic_path"]]];
49
+    self.shopLabel.text=shopDic[@"title"];
50
+    
51
+    self.desclabel.text=[NSString stringWithFormat:@"商品描述:%@  服务态度:%@  发货速度:%@",shopDic[@"item_score"],shopDic[@"service_score"],shopDic[@"delivery_score"]];
52
+}
34 53
 @end

+ 5 - 1
KuDianProject/TOP/View/KDPBannerCell.h

@@ -8,10 +8,14 @@
8 8
 
9 9
 #import <UIKit/UIKit.h>
10 10
 #import <SDCycleScrollView.h>
11
+#import "KDPBannerModel.h"
11 12
 NS_ASSUME_NONNULL_BEGIN
12 13
 
13
-@interface KDPBannerCell : UICollectionViewCell
14
+@interface KDPBannerCell : UICollectionViewCell<SDCycleScrollViewDelegate>
14 15
 @property(nonatomic,strong)SDCycleScrollView *sdCycleView;
16
+@property(nonatomic,strong)NSArray *bannerArr;
17
+
18
+@property(nonatomic,copy)void(^bannerBlock)(KDPBannerModel *model);
15 19
 @end
16 20
 
17 21
 NS_ASSUME_NONNULL_END

+ 21 - 1
KuDianProject/TOP/View/KDPBannerCell.m

@@ -28,8 +28,28 @@
28 28
 {
29 29
     if (!_sdCycleView) {
30 30
         _sdCycleView =[[SDCycleScrollView alloc]init];
31
-        _sdCycleView.backgroundColor=[UIColor colorWithHexString:ThemeColor];
31
+        _sdCycleView.backgroundColor=[UIColor colorWithHexString:LineColor];
32
+        _sdCycleView.delegate=self;
32 33
     }
33 34
     return _sdCycleView;
34 35
 }
36
+
37
+-(void)setBannerArr:(NSArray *)bannerArr
38
+{
39
+    _bannerArr = bannerArr;
40
+    NSMutableArray  *array =[NSMutableArray array];
41
+    for (KDPBannerModel *model in bannerArr) {
42
+        [array addObject:model.img];
43
+    }
44
+    self.sdCycleView.imageURLStringsGroup=array;
45
+}
46
+
47
+
48
+
49
+-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
50
+{
51
+    if (self.bannerBlock) {
52
+        self.bannerBlock(self.bannerArr[index]);
53
+    }
54
+}
35 55
 @end

+ 4 - 1
KuDianProject/TOP/View/KDPRecommendGoodCell.h

@@ -7,7 +7,7 @@
7 7
 //
8 8
 
9 9
 #import <UIKit/UIKit.h>
10
-
10
+#import "KDPGoodsModel.h"
11 11
 NS_ASSUME_NONNULL_BEGIN
12 12
 
13 13
 @interface KDPRecommendGoodCell : UICollectionViewCell
@@ -18,7 +18,10 @@ NS_ASSUME_NONNULL_BEGIN
18 18
 @property(nonatomic,strong)UILabel *recomPriceL;
19 19
 @property(nonatomic,strong)UILabel *recomOriginL;
20 20
 @property(nonatomic,strong)UILabel *recomVolumeL;
21
+@property(nonatomic,strong)UIImageView *couponImgV;
22
+@property(nonatomic,strong)UILabel *couponPriceL;
21 23
 @property(nonatomic,strong)UILabel *recomprofitL;
24
+@property(nonatomic,strong)KDPGoodsModel *model;
22 25
 @end
23 26
 
24 27
 NS_ASSUME_NONNULL_END

+ 80 - 5
KuDianProject/TOP/View/KDPRecommendGoodCell.m

@@ -22,6 +22,8 @@
22 22
             make.top.mas_equalTo(0);
23 23
             make.bottom.mas_equalTo(-1);
24 24
         }];
25
+        [backV addSubview:self.couponImgV];
26
+        [self.couponImgV addSubview:self.couponPriceL];
25 27
         [backV addSubview:self.recomImgV];
26 28
         [backV addSubview:self.recomTitleL];
27 29
         [backV addSubview:self.recomShopL];
@@ -40,8 +42,8 @@
40 42
         [self.recomTitleL mas_makeConstraints:^(MASConstraintMaker *make) {
41 43
             make.left.mas_equalTo(self.recomImgV.mas_right).offset(10);
42 44
             make.top.mas_equalTo(self.recomImgV.mas_top);
43
-            make.height.mas_equalTo(41);
44
-            make.right.mas_equalTo(-10);
45
+            make.height.mas_equalTo(21);
46
+            make.right.mas_equalTo(0);
45 47
         }];
46 48
         [self.recomShopiconImg mas_makeConstraints:^(MASConstraintMaker *make) {
47 49
             make.left.mas_equalTo(self.recomTitleL.mas_left);
@@ -68,7 +70,7 @@
68 70
         
69 71
         [self.recomPriceL mas_makeConstraints:^(MASConstraintMaker *make) {
70 72
             make.left.mas_equalTo(self.recomTitleL.mas_left);
71
-            make.top.mas_equalTo(self.recomShopiconImg.mas_bottom).offset(13);
73
+            make.top.mas_equalTo(self.recomShopiconImg.mas_bottom).offset(11);
72 74
             make.height.mas_equalTo(25);
73 75
         }];
74 76
         
@@ -83,9 +85,20 @@
83 85
             make.right.mas_equalTo(-10);
84 86
             make.height.mas_equalTo(26);
85 87
             make.width.mas_equalTo(78);
86
-            make.top.mas_equalTo(self.recomVolumeL.mas_bottom).offset(8);
88
+            make.top.mas_equalTo(self.recomVolumeL.mas_bottom).offset(21);
89
+        }];
90
+        
91
+        [self.couponImgV mas_makeConstraints:^(MASConstraintMaker *make) {
92
+            make.top.mas_equalTo(self.recomPriceL.mas_bottom).offset(6);
93
+            make.height.mas_equalTo(16);
94
+            make.width.mas_equalTo(60);
95
+            make.left.mas_equalTo(self.recomPriceL.mas_left);
96
+        }];
97
+        
98
+        [self.couponPriceL mas_makeConstraints:^(MASConstraintMaker *make) {
99
+            make.left.mas_equalTo(20);
100
+            make.top.right.bottom.mas_equalTo(0);
87 101
         }];
88
-    
89 102
     }
90 103
     return self;
91 104
 }
@@ -186,4 +199,66 @@
186 199
     return _recomprofitL;
187 200
 }
188 201
 
202
+-(UIImageView *)couponImgV
203
+{
204
+    if (!_couponImgV) {
205
+        _couponImgV=[[UIImageView alloc]init];
206
+        _couponImgV.image=[UIImage imageNamed:@"coupon_icon"];
207
+        
208
+        UILabel *quanL=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 20, 16)];
209
+        quanL.text=@"券";
210
+        quanL.font=[UIFont systemFontOfSize:12];
211
+        quanL.textColor=[UIColor whiteColor];
212
+        quanL.textAlignment=NSTextAlignmentCenter;
213
+        [_couponImgV addSubview:quanL];
214
+        
215
+    }
216
+    return _couponImgV;
217
+}
218
+-(UILabel *)couponPriceL
219
+{
220
+    if (!_couponPriceL) {
221
+        _couponPriceL=[[UILabel alloc]init];
222
+        _couponPriceL.text=@"---";
223
+        _couponPriceL.textColor=[UIColor colorWithHexString:ThemeColor];
224
+        _couponPriceL.font=[UIFont systemFontOfSize:12];
225
+        _couponPriceL.textAlignment=NSTextAlignmentCenter;
226
+        
227
+    }
228
+    return _couponPriceL;
229
+}
230
+
231
+
232
+-(void)setModel:(KDPGoodsModel *)model
233
+{
234
+    _model = model;
235
+    //设置字体字号和字体类别
236
+    self.recomprofitL.text=[NSString stringWithFormat:@"利润%@",model.commission_rate];
237
+    [self.recomImgV sd_setImageWithURL:[NSURL URLWithString:model.img]];
238
+    self.recomShopL.text=model.shop_title;
239
+     self.recomTitleL.attributedText=[KDPublicMethod sethanggaoWithStr:model.title linSpacing:5];
240
+    if (model.shop_type.integerValue == 1) {
241
+        self.recomShopiconImg.image =[UIImage imageNamed:@"tm_icon"];
242
+    }else{
243
+        self.recomShopiconImg.image =[UIImage imageNamed:@"taobao_icon"];
244
+        
245
+    }
246
+    //原件
247
+    NSString *textStr =[NSString stringWithFormat:@"¥%@",model.price];
248
+    //中划线
249
+    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
250
+    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:textStr attributes:attribtDic];
251
+    // 赋值
252
+    self.recomOriginL.attributedText = attribtStr;
253
+     self.recomPriceL.text=[NSString stringWithFormat:@"¥%@",model.discount_price];
254
+    self.recomVolumeL.text=[NSString stringWithFormat:@"月销%@",model.volume];
255
+    
256
+    if (model.coupon_price.floatValue>0) {
257
+        self.couponImgV.hidden=NO;
258
+        self.couponPriceL.text=model.coupon_price;
259
+    }else{
260
+        self.couponImgV.hidden=YES;
261
+    }
262
+    
263
+}
189 264
 @end