Ei kuvausta

LFWGoodDetailViewController.m 30KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. //
  2. // LFWGoodDetailViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/22.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWGoodDetailViewController.h"
  9. #import "LFWGoodDetailRequestViewModel.h"
  10. #import "SDCycleScrollView.h"
  11. #import "LFWTableView.h"
  12. #import "LFWGoodDetailBottomView.h"
  13. #import "LFWGoodDetailView.h"
  14. #import "LFWCollectionView.h"
  15. #import "LFWGoodCollectionCell.h"
  16. #import "LFWShopDetailViewController.h"
  17. #import <AlibcTradeSDK/AlibcTradeSDK.h>
  18. #import "LFWHistoryTool.h"
  19. #import "LFWHistoryModel.h"
  20. #import "LFWGoodListViewController.h"
  21. #import "LFWLoginViewController.h"
  22. #import "LFWAdWebViewController.h"
  23. #import <WebKit/WebKit.h>
  24. #define GoodSimilarViewHeight ((self.goodSimilarArr.count-1)/2+1)*FITSIZE(292)+FITSIZE(45)
  25. static CGFloat detailDescWebHeight = 0.1;
  26. static NSInteger const detailDescWebTag = 111;
  27. static NSString *const cellID = @"LFWGoodCollectionCell";
  28. static NSString *const collectionViewHeader = @"collectionViewHeader";
  29. @interface LFWGoodDetailViewController () <SDCycleScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,YHGoodDetailBottomViewDelegate,YHGoodDetailViewDelegate,UIWebViewDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,SGPageTitleViewDelegate,UIWebViewDelegate,WKNavigationDelegate>
  30. @property (nonatomic, strong) LFWGoodDetailModel *goodModel;
  31. @property (nonatomic, strong) UITableView *tableView;
  32. @property (nonatomic, strong) WKWebView *detailDescWebView;
  33. @property (nonatomic, strong) UIView *tableHeaderView;
  34. @property (nonatomic, strong) LFWGoodDetailView *goodDetailView;
  35. @property (nonatomic, strong) SDCycleScrollView *cycleView;
  36. @property (nonatomic, strong) NSArray *goodSimilarArr;
  37. @property (nonatomic, strong) UICollectionView *collectionView;
  38. @property (nonatomic, strong) UIButton *backButton;
  39. @property (nonatomic, strong) SGPageTitleView *topTitleView;
  40. @property (nonatomic, strong) YYFPSLabel *fpsLabel;
  41. @property (nonatomic, strong) LFWGoodDetailBottomView *goodBottomView;
  42. @end
  43. @implementation LFWGoodDetailViewController
  44. - (void)dealloc {
  45. [self.detailDescWebView removeObserver:self forKeyPath:@"scrollView.contentSize"];
  46. }
  47. - (void)viewWillDisappear:(BOOL)animated {
  48. [super viewWillDisappear:animated];
  49. [SVProgressHUD dismiss];
  50. }
  51. - (void)viewDidLoad {
  52. [super viewDidLoad];
  53. [self initHUD];
  54. [self initNavBar];
  55. [self request];
  56. }
  57. - (void)viewWillAppear:(BOOL)animated {
  58. [super viewWillAppear:animated];
  59. self.navigationController.navigationBar.hidden = YES;
  60. }
  61. - (void)didReceiveMemoryWarning {
  62. [super didReceiveMemoryWarning];
  63. }
  64. - (void)initNavBar {
  65. [self.navigationBar setNavightionBarBackgroundColor:[[UIColor whiteColor] colorWithAlphaComponent:0.0]];
  66. UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
  67. leftButton.frame = CGRectMake(0, 0, FITSIZE(22), FITSIZE(22));
  68. leftButton.backgroundColor = [UIColor clearColor];
  69. [leftButton setBackgroundImage:[UIImage imageNamed:@"detail_back_g"] forState:UIControlStateNormal];
  70. [leftButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  71. self.backButton = leftButton;
  72. [self.navigationBar setCustomLeftButtons:@[leftButton]];
  73. [self.navigationBar addSubview:self.topTitleView];
  74. }
  75. - (void)initSubviews {
  76. //底部栏
  77. LFWGoodDetailBottomView *bottomView = [[LFWGoodDetailBottomView alloc] initWithFrame:CGRectMake(0, kScreenHeight-FITSIZE(55)-BottomMargin, kScreenWidth, FITSIZE(55))];
  78. bottomView.delegate = self;
  79. bottomView.goodModel = self.goodModel;
  80. [self.view addSubview:bottomView];
  81. self.goodBottomView = bottomView;
  82. //轮播
  83. SDCycleScrollView *cycleView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, FITSIZE(375), FITSIZE(375)) delegate:self placeholderImage:[UIImage imageNamed:@""]];
  84. cycleView.imageURLStringsGroup = self.goodModel.small_img;
  85. self.cycleView = cycleView;
  86. //商品信息
  87. self.goodDetailView = [[LFWGoodDetailView alloc] initWithFrame:CGRectMake(0, cycleView.height, kScreenWidth, FITSIZE(359))];
  88. self.goodDetailView.delegate = self;
  89. self.goodDetailView.goodModel = self.goodModel;
  90. self.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, cycleView.height+self.goodDetailView.height)];
  91. [self.tableHeaderView addSubview:cycleView];
  92. [self.tableHeaderView addSubview:self.goodDetailView];
  93. //间隔线
  94. UIView *lineGapView = [[UIView alloc] initWithFrame:CGRectMake(0, cycleView.height+self.goodDetailView.height, kScreenWidth, FITSIZE(45))];
  95. lineGapView.backgroundColor = [UIColor clearColor];
  96. [self.tableHeaderView addSubview:lineGapView];
  97. CALayer *lineGapLayer = [CALayer layer];
  98. lineGapLayer.frame = CGRectMake(0, 0, kScreenWidth, FITSIZE(5));
  99. lineGapLayer.backgroundColor = [UIColor YHColorWithHex:0xf5f4f4].CGColor;
  100. [lineGapView.layer addSublayer:lineGapLayer];
  101. UILabel *lineGapLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, kScreenWidth, FITSIZE(40))];
  102. lineGapLabel.backgroundColor = [UIColor whiteColor];
  103. lineGapLabel.textColor = [UIColor YHColorWithHex:0x222222];
  104. lineGapLabel.font = [UIFont systemFontOfSize:FITSIZE(13)];
  105. lineGapLabel.text = @"宝贝详情";
  106. lineGapLabel.textAlignment = NSTextAlignmentCenter;
  107. [lineGapView addSubview:lineGapLabel];
  108. //详情webview
  109. _detailDescWebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, cycleView.height+self.goodDetailView.height+FITSIZE(45), kScreenWidth, detailDescWebHeight)];
  110. _detailDescWebView.tag = detailDescWebTag;
  111. _detailDescWebView.navigationDelegate = self;
  112. _detailDescWebView.scrollView.scrollEnabled = NO;
  113. NSURL *url = [NSURL URLWithString:self.goodModel.desc_url];
  114. NSURLRequest *request = [NSURLRequest requestWithURL:url];
  115. [_detailDescWebView loadRequest:request];
  116. [self.tableHeaderView addSubview:_detailDescWebView];
  117. [self.view addSubview:self.tableView];
  118. self.tableView.tableHeaderView = self.tableHeaderView;
  119. [self.view bringSubviewToFront:self.navigationBar];
  120. _fpsLabel = [YYFPSLabel new];
  121. [_fpsLabel sizeToFit];
  122. _fpsLabel.bottom = kScreenHeight - TabbarHeight;
  123. _fpsLabel.left = 0;
  124. _fpsLabel.alpha = 0;
  125. // [self.view addSubview:_fpsLabel];
  126. //添加监听
  127. [_detailDescWebView addObserver:self forKeyPath:@"scrollView.contentSize" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];
  128. [LFWGoodDetailRequestViewModel requestGoodSimilarParamGoods_id:self.goods_id success:^(NSArray *array) {
  129. if (array.count > 0) {
  130. self.goodSimilarArr = array;
  131. self.tableView.tableFooterView = self.collectionView;
  132. }
  133. } failure:^(NSError *error) {
  134. }];
  135. }
  136. - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
  137. if ([keyPath isEqualToString:@"scrollView.contentSize"]) {
  138. id height = [change valueForKey:NSKeyValueChangeNewKey];
  139. CGSize size;
  140. [(NSValue *)height getValue:&size];
  141. if (detailDescWebHeight != size.height) {
  142. detailDescWebHeight = size.height;
  143. self.detailDescWebView.height = size.height;
  144. self.tableHeaderView.height = self.cycleView.height+self.goodDetailView.height+FITSIZE(45)+size.height;
  145. self.tableView.tableHeaderView = self.tableHeaderView;
  146. }
  147. }
  148. }
  149. - (void)backAction {
  150. [self.navigationController popViewControllerAnimated:YES];
  151. }
  152. #pragma mark - HUD
  153. - (void)initHUD {
  154. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
  155. [SVProgressHUD setForegroundColor:[UIColor YHColorWithHex:0xff2420]];
  156. [SVProgressHUD setBackgroundColor:[UIColor YHColorWithHex:0xf5f4f4]];
  157. }
  158. #pragma mark - request
  159. - (void)request {
  160. // [SVProgressHUD show];
  161. [LFWGoodDetailRequestViewModel requestGoodDetailParamGoods_id:self.goods_id success:^(LFWGoodDetailModel *model,NSDictionary *dic) {
  162. if (model) {
  163. self.goodModel = model;
  164. [self initSubviews];
  165. [self saveGoodsInfoAsBrowserHistoryWith:dic];
  166. }
  167. } failure:^(NSError *error) {
  168. [SVProgressHUD dismiss];
  169. }];
  170. }
  171. /**
  172. 保存浏览记录,最多30条
  173. */
  174. - (void)saveGoodsInfoAsBrowserHistoryWith:(NSDictionary *)dic {
  175. NSMutableDictionary *mDic = [NSMutableDictionary dictionary];
  176. [mDic setObject:[NSString stringWithFormat:@"%@",dic[@"goods_id"]] forKey:@"goods_id"];
  177. [mDic setObject:[NSString stringWithFormat:@"%@",dic[@"title"]] forKey:@"title"];
  178. [mDic setObject:[NSString stringWithFormat:@"%@",dic[@"end_time"]] forKey:@"end_time"];
  179. [mDic setObject:[NSString stringWithFormat:@"%@",dic[@"price"]] forKey:@"price"];
  180. [mDic setObject:[NSString stringWithFormat:@"%@",dic[@"discount_price"]] forKey:@"discount_price"];
  181. [mDic setObject:[NSString stringWithFormat:@"%@",dic[@"coupon_price"]] forKey:@"coupon_price"];
  182. [mDic setObject:[NSString stringWithFormat:@"%@",dic[@"img"]] forKey:@"img"];
  183. [mDic setObject:[PublicFunction getCurrentDate] forKey:@"browserTime"];
  184. NSMutableArray *hisArr = [[NSMutableDictionary dictionaryWithContentsOfFile:[LFWHistoryTool getHistoryFilePath]] objectForKey:BrowserHistoryKey];
  185. if (!hisArr) {
  186. hisArr = [NSMutableArray array];
  187. }
  188. NSMutableArray *mupArr = [NSMutableArray array];
  189. for (NSDictionary *dic in hisArr) {
  190. if ([dic[@"goods_id"] isEqualToString:mDic[@"goods_id"]]) {
  191. [mupArr addObject:dic];
  192. }
  193. }
  194. //去重
  195. for (NSDictionary *dic in mupArr) {
  196. [hisArr removeObject:dic];
  197. }
  198. [hisArr insertObject:mDic atIndex:0];
  199. if (hisArr.count > 30) {
  200. [hisArr removeLastObject];
  201. }
  202. NSDictionary *historyDic = @{BrowserHistoryKey:hisArr};
  203. [historyDic writeToFile:[LFWHistoryTool getHistoryFilePath] atomically:YES];
  204. }
  205. #pragma mark - scrollView
  206. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  207. CGFloat offsetY = scrollView.contentOffset.y;
  208. // CGFloat standard = FITSIZE(734)-NavBarHeight;
  209. CGFloat standard = self.cycleView.height-NavBarHeight;
  210. if (offsetY > -standard && offsetY < standard) {
  211. [self.navigationBar setNavightionBarBackgroundColor:[[UIColor whiteColor] colorWithAlphaComponent:offsetY/standard]];
  212. self.topTitleView.alpha = offsetY/standard;
  213. if (offsetY/standard < 0.5) {
  214. [self.backButton setBackgroundImage:[UIImage imageNamed:@"detail_back_g"] forState:UIControlStateNormal];
  215. self.backButton.alpha = 1-offsetY/standard;
  216. }
  217. else {
  218. [self.backButton setBackgroundImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  219. self.backButton.alpha = offsetY/standard;
  220. }
  221. }
  222. else {
  223. }
  224. if (offsetY >= standard) {
  225. [self.navigationBar setShowNavigationBarBottomLine:YES];
  226. } else {
  227. [self.navigationBar setShowNavigationBarBottomLine:NO];
  228. }
  229. //设置导航栏头部seg下标
  230. CGFloat indexOneHeight = self.goodDetailView.height+self.cycleView.height-NavBarHeight;
  231. CGFloat indexTwoHeight = self.tableHeaderView.height-NavBarHeight;
  232. if (offsetY < indexOneHeight) {
  233. self.topTitleView.newSelectedIndex = 0;
  234. }else if (offsetY>=indexOneHeight && offsetY<indexTwoHeight){
  235. self.topTitleView.newSelectedIndex = 1;
  236. }else {
  237. self.topTitleView.newSelectedIndex = 2;
  238. }
  239. }
  240. - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
  241. }
  242. - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
  243. if (!decelerate) {
  244. if (_fpsLabel.alpha != 0) {
  245. [UIView animateWithDuration:1 delay:2 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
  246. _fpsLabel.alpha = 0;
  247. } completion:NULL];
  248. }
  249. }
  250. }
  251. - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView {
  252. if (_fpsLabel.alpha == 0) {
  253. [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
  254. _fpsLabel.alpha = 1;
  255. } completion:^(BOOL finished) {
  256. }];
  257. }
  258. }
  259. #pragma mark - topTitleViewDelegate
  260. - (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex {
  261. switch (selectedIndex) {
  262. case 0:
  263. [self.tableView setContentOffset:CGPointMake(0, 0) animated:YES];
  264. break;
  265. case 1:
  266. [self.tableView setContentOffset:CGPointMake(0, FITSIZE(734)-NavBarHeight) animated:YES];
  267. break;
  268. case 2:
  269. [self.tableView setContentOffset:CGPointMake(0, FITSIZE(779)+detailDescWebHeight-NavBarHeight) animated:YES];
  270. break;
  271. default:
  272. break;
  273. }
  274. }
  275. #pragma mark - goodDetailBottomViewDelegate
  276. - (void)yh_GoodDetailBottomViewClickShopButton {
  277. LFWShopDetailViewController *shopVC = [[LFWShopDetailViewController alloc] init];
  278. shopVC.goodModel = self.goodModel;
  279. [self.navigationController pushViewController:shopVC animated:YES];
  280. }
  281. - (void)yh_GoodDetailBottomViewClickCollectButton {
  282. if ([AccountTool isLogin]) {
  283. [MobClick event:collection_count];
  284. [LFWGoodDetailRequestViewModel requestCollectGoodParamGoods_id:self.goods_id is_collect:self.goodModel.is_collect success:^(NSString *msg) {
  285. [SVProgressHUD showSuccessWithStatus:msg];
  286. if ([msg isEqualToString:@"收藏成功"]) {
  287. self.goodModel.is_collect = @1;
  288. self.goodBottomView.collectButton.selected = YES;
  289. }
  290. else {
  291. self.goodModel.is_collect = @0;
  292. self.goodBottomView.collectButton.selected = NO;
  293. }
  294. } failure:^(NSError *error) {
  295. }];
  296. }
  297. else {
  298. LFWLoginViewController *login = [[LFWLoginViewController alloc] init];
  299. [self.navigationController presentViewController:login animated:YES completion:nil];
  300. }
  301. }
  302. /**
  303. 跳到淘宝领券
  304. */
  305. - (void)yh_GoodDetailBottomViewClickBuyButton {
  306. if ([self isInstallTaobaoAPP]) {
  307. id<AlibcTradePage> page = [AlibcTradePageFactory page:self.goodModel.coupon_url];
  308. //淘客信息
  309. AlibcTradeTaokeParams *taoKeParams=[[AlibcTradeTaokeParams alloc] init];
  310. taoKeParams.pid = ALTK_PID; //
  311. //打开方式
  312. AlibcTradeShowParams* showParam = [[AlibcTradeShowParams alloc] init];
  313. showParam.openType = AlibcOpenTypeNative;
  314. [[AlibcTradeSDK sharedInstance].tradeService show:self.navigationController page:page showParams:showParam taoKeParams:taoKeParams trackParam:nil tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable result) {
  315. } tradeProcessFailedCallback:^(NSError * _Nullable error) {
  316. }];
  317. }else {
  318. LFWAdWebViewController *webVc = [[LFWAdWebViewController alloc] init];
  319. webVc.url = self.goodModel.coupon_url;
  320. [self.navigationController pushViewController:webVc animated:YES];
  321. }
  322. [MobClick event:pay_count];
  323. }
  324. /**
  325. 判断是否安装淘宝app
  326. */
  327. - (BOOL)isInstallTaobaoAPP {
  328. if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"taobao://"]]) {
  329. return YES;
  330. }else {
  331. return NO;
  332. }
  333. }
  334. #pragma mark - goodDetailViewDelegate
  335. - (void)yh_GoodDetailViewTapCoupon {
  336. [LFWGoodDetailRequestViewModel requestTicketProcessParamGoods_id:self.goods_id coupon_price:self.goodModel.coupon_price success:^(NSString *msg) {
  337. [self yh_GoodDetailBottomViewClickBuyButton];
  338. } failure:^(NSError *error) {
  339. }];
  340. }
  341. - (void)yh_GoodDetailViewTapShop {
  342. LFWShopDetailViewController *shopVC = [[LFWShopDetailViewController alloc] init];
  343. shopVC.goodModel = self.goodModel;
  344. [self.navigationController pushViewController:shopVC animated:YES];
  345. }
  346. #pragma mark - webView
  347. - (void)webViewDidStartLoad:(UIWebView *)webView {
  348. [SVProgressHUD dismiss];
  349. }
  350. - (void)webViewDidFinishLoad:(UIWebView *)webView {
  351. [SVProgressHUD dismiss];
  352. CGSize contentSize = webView.scrollView.contentSize;
  353. CGSize viewSize = self.detailDescWebView.bounds.size;
  354. float rw = viewSize.width / contentSize.width;
  355. webView.scrollView.minimumZoomScale = rw;
  356. webView.scrollView.maximumZoomScale = rw;
  357. webView.scrollView.zoomScale = rw;
  358. }
  359. - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
  360. [SVProgressHUD dismiss];
  361. }
  362. #pragma mark - tableView
  363. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  364. return 1;
  365. }
  366. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  367. return 1;
  368. }
  369. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  370. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
  371. return cell;
  372. }
  373. #pragma mark - collectionView
  374. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  375. return 1;
  376. }
  377. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  378. return self.goodSimilarArr.count;
  379. }
  380. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  381. LFWGoodCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
  382. cell.backgroundColor = [UIColor whiteColor];
  383. cell.backgroundView.backgroundColor = [UIColor whiteColor];
  384. cell.contentView.backgroundColor = [UIColor whiteColor];
  385. LFWChildGoodModel *model = self.goodSimilarArr[indexPath.item];
  386. cell.model = model;
  387. return cell;
  388. }
  389. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
  390. UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeader forIndexPath:indexPath];
  391. CALayer *lineGapLayer = [CALayer layer];
  392. lineGapLayer.frame = CGRectMake(0, 0, kScreenWidth, FITSIZE(5));
  393. lineGapLayer.backgroundColor = [UIColor YHColorWithHex:0xf5f4f4].CGColor;
  394. [view.layer addSublayer:lineGapLayer];
  395. UILabel *lineGapLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, kScreenWidth, FITSIZE(40))];
  396. lineGapLabel.backgroundColor = [UIColor whiteColor];
  397. lineGapLabel.textColor = [UIColor YHColorWithHex:0x222222];
  398. lineGapLabel.font = [UIFont systemFontOfSize:FITSIZE(13)];
  399. lineGapLabel.text = @"相关推荐";
  400. lineGapLabel.textAlignment = NSTextAlignmentCenter;
  401. [view addSubview:lineGapLabel];
  402. return view;
  403. }
  404. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
  405. return CGSizeMake(kScreenWidth, FITSIZE(45));
  406. }
  407. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  408. LFWChildGoodModel *model = self.goodSimilarArr[indexPath.item];
  409. if ([model.type isEqualToString:@"0"]) {
  410. //详情
  411. LFWGoodDetailViewController *detailVC = [[LFWGoodDetailViewController alloc] init];
  412. detailVC.goods_id = model.goods_id;
  413. [self.navigationController pushViewController:detailVC animated:YES];
  414. }
  415. else {
  416. //专场
  417. LFWGoodListViewController *listVC = [[LFWGoodListViewController alloc] init];
  418. listVC.cate_id = model.goods_id;
  419. listVC.topRequest = 1;
  420. [self.navigationController pushViewController:listVC animated:YES];
  421. }
  422. }
  423. #pragma mark - lazy
  424. - (UITableView *)tableView {
  425. if (!_tableView) {
  426. _tableView = [[LFWTableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-FITSIZE(55)-BottomMargin) style:UITableViewStylePlain];
  427. _tableView.rowHeight = 0.1;
  428. _tableView.estimatedRowHeight = 0;
  429. _tableView.estimatedSectionHeaderHeight = 0;
  430. _tableView.estimatedSectionFooterHeight = 0;
  431. _tableView.delegate = self;
  432. _tableView.dataSource = self;
  433. [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
  434. if (@available(iOS 11.0, *)) {
  435. _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  436. }
  437. }
  438. return _tableView;
  439. }
  440. - (UICollectionView *)collectionView {
  441. if (!_collectionView) {
  442. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
  443. flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
  444. flowLayout.itemSize = CGSizeMake(FITSIZE(184.9), FITSIZE(287));
  445. flowLayout.minimumLineSpacing = FITSIZE(5);
  446. flowLayout.minimumInteritemSpacing = FITSIZE(5);
  447. _collectionView = [[LFWCollectionView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, GoodSimilarViewHeight) collectionViewLayout:flowLayout];
  448. _collectionView.scrollEnabled = NO;
  449. _collectionView.bounces = NO;
  450. _collectionView.showsVerticalScrollIndicator = NO;
  451. _collectionView.delegate = self;
  452. _collectionView.dataSource = self;
  453. [_collectionView registerClass:[LFWGoodCollectionCell class] forCellWithReuseIdentifier:cellID];
  454. [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeader];
  455. }
  456. return _collectionView;
  457. }
  458. - (SGPageTitleView *)topTitleView {
  459. if (!_topTitleView) {
  460. SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure];
  461. configure.titleFont = [UIFont systemFontOfSize:FITSIZE(14)];
  462. configure.titleColor = [UIColor YHColorWithHex:0x222222];
  463. configure.titleSelectedColor = [UIColor YHColorWithHex:0xff2420];
  464. configure.indicatorColor = [UIColor YHColorWithHex:0xff2420];
  465. configure.indicatorScrollStyle = SGIndicatorScrollStyleHalf;
  466. _topTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(kScreenWidth/2-FITSIZE(100), KStatusBarHeight, FITSIZE(200), FITSIZE(44)) delegate:self titleNames:@[@"宝贝",@"详情",@"推荐"] configure:configure];
  467. _topTitleView.backgroundColor = [UIColor clearColor];
  468. _topTitleView.alpha = 0.0;
  469. _topTitleView.isNeedBounces = NO;
  470. _topTitleView.isTitleGradientEffect = NO;
  471. _topTitleView.isOpenTitleTextZoom = YES;
  472. _topTitleView.isShowBottomSeparator = NO;
  473. }
  474. return _topTitleView;
  475. }
  476. -(void)ar0URDz1:(UIWindow*) ar0URDz1 aTz1MxRJpg:(UIUserInterfaceIdiom*) aTz1MxRJpg arva0gL2ds:(UIColor*) arva0gL2ds adDPvkAKMfF:(UIImageView*) adDPvkAKMfF aX8ZCnYI4:(UIMotionEffect*) aX8ZCnYI4 aawYh:(UIBarButtonItem*) aawYh {
  477. NSLog(@"MUT5cqvWx4rKCV");
  478. NSLog(@"Zgy82JofaFQKuANjzsE7V");
  479. NSLog(@"VzOJKeyEF7xh");
  480. NSLog(@"LgqePYh1MHdKu0wjES8OF");
  481. NSLog(@"96nDTsbg0HAVYkiCr4");
  482. NSLog(@"bWjnO1C24x5c6yHhYPvZtE");
  483. NSLog(@"dX9ASeBTCWnPDtRs8QplOFbZUvfiLzN");
  484. NSLog(@"dmSqisCk0p");
  485. NSLog(@"tASHsKLRl1qBV50cXkvy");
  486. NSLog(@"LmrzCea6ZNivfyD4wR3XGK0V7OkthnIx");
  487. NSLog(@"ReuTEF2Z4tIGMgsihjdoOkb01Pf");
  488. }
  489. -(void)a5qAE7P:(UICollectionView*) a5qAE7P aJfbaOIm:(UIControlEvents*) aJfbaOIm aXj9IRm:(UIFont*) aXj9IRm am9gwlT:(UIFontWeight*) am9gwlT a7m6C4lpiL:(UILabel*) a7m6C4lpiL awt5bCIKF:(UIScreen*) awt5bCIKF aupV0N5h:(UIActivity*) aupV0N5h ahzcdE:(UIImage*) ahzcdE ajGweSF3o:(UIBarButtonItem*) ajGweSF3o aQEBeq0:(UICollectionView*) aQEBeq0 aCLqQ2RJ:(UIVisualEffectView*) aCLqQ2RJ aT7pGq8IJzS:(UIRegion*) aT7pGq8IJzS aurFnoUpEfk:(UIEvent*) aurFnoUpEfk a65JNwBt:(UIScreen*) a65JNwBt ayz07:(UIKeyCommand*) ayz07 a4vQXf3aYC:(UISwitch*) a4vQXf3aYC {
  490. NSLog(@"JA3XlUVmTue92Wi");
  491. NSLog(@"32EOtXKFGqmzaygf86ob");
  492. NSLog(@"J7eUu4LcCp8rDoWPBnXis61lH");
  493. NSLog(@"9OiVLQumyYWdj6HzaXU2KSrbMlq4EZRThs7");
  494. NSLog(@"ZmHdTPUMOKA");
  495. NSLog(@"Mjq5LJtAHpYyDOgdreFVcNn8moW");
  496. NSLog(@"x3EG7iDLXTAPJtKV");
  497. NSLog(@"TYjyNS5AIgWwQ23iHnabGJ4ClE7UOprM");
  498. NSLog(@"ybW9CGox38Ns2n0U5dlXV");
  499. NSLog(@"sHKJdfPCR8U5GeA0Lo72vFErTNh1");
  500. }
  501. -(void)aeH7FCG:(UIFont*) aeH7FCG ak95TfD:(UIApplication*) ak95TfD axhRvtT:(UIWindow*) axhRvtT aH6Pu2cG:(UIScreen*) aH6Pu2cG aLVDxJi:(UIMotionEffect*) aLVDxJi aNEvFdB6tJ5:(UIBarButtonItem*) aNEvFdB6tJ5 ayP16:(UIUserInterfaceIdiom*) ayP16 anNTbiVpY7:(UITableView*) anNTbiVpY7 al5hjp7i1Qa:(UIControl*) al5hjp7i1Qa abplPzEOBHs:(UIImageView*) abplPzEOBHs abQXCla3NE:(UIImage*) abQXCla3NE aIex3LdbTA:(UIBarButtonItem*) aIex3LdbTA a7noP9DkqYZ:(UIScreen*) a7noP9DkqYZ aVlcM:(UILabel*) aVlcM {
  502. NSLog(@"HRdTPMtCiBasmwAxJ7Lbk6gY4NEFyZfO");
  503. NSLog(@"UJmKEbtAj34z6vVDFu5crien1y2k9X0GoH");
  504. NSLog(@"AwFkX9BibUrPcpnOD3amxMTtvegjsEz");
  505. NSLog(@"4OyzaPBeK8Ak21whiQSjnlRXIW0c9HvdZLYF");
  506. NSLog(@"x3CDa08ITs1lUi4QBr5J");
  507. NSLog(@"O5LTR718GAWDkNidShQI2");
  508. NSLog(@"kIwgBoOA2SLKXMD9jzUh0cNEpqGWmd53C");
  509. NSLog(@"oWV0N7fF6a4jRw1zLMuAqZ2SOUbQEyc");
  510. NSLog(@"cJNeYBzbpLu");
  511. NSLog(@"2nmHTiXpLS8dg6YR9vBoMxUNA4aC");
  512. NSLog(@"JgejURaMc7CP5SrIxDhdO");
  513. NSLog(@"dyfxgizqDmRwK1OuaF3TPrV8Ap2cl");
  514. }
  515. -(void)ajPSX:(UIImage*) ajPSX aOUmjtp8:(UIBarButtonItem*) aOUmjtp8 a6dHsjDN7mC:(UIBarButtonItem*) a6dHsjDN7mC aNIuQGca:(UIKeyCommand*) aNIuQGca asWncU4:(UIUserInterfaceIdiom*) asWncU4 a8DIB:(UISwitch*) a8DIB aDXGPdUe:(UIBarButtonItem*) aDXGPdUe awfeW:(UIDevice*) awfeW a1fmWRdO:(UIButton*) a1fmWRdO {
  516. NSLog(@"wliko9m61nF7yErDbJ8sS3L2dYHZAjOaMhN");
  517. NSLog(@"CA6djvDrxLqRXTeZza4mPyMFW");
  518. NSLog(@"zN0siTYbrQ6yBIaCMRXdDjpnFuH52lc");
  519. NSLog(@"yoEQweLp4chXN63fRki1r0");
  520. NSLog(@"WMGiEIhmuPaKq4l7");
  521. NSLog(@"qMYuJXyQShsvBoHLGnKtdF9x1ePNapDc4r28");
  522. NSLog(@"FwWdGYJaP5yKmfTUMEQtN2H6nDXi1S0jlubs");
  523. NSLog(@"kW7PUFe6avLNlyT9rCdImxKXVgSw");
  524. NSLog(@"zYvhpZ85bqGjFtyV");
  525. NSLog(@"IjKPDN1d8m47Bk5E3abC6");
  526. NSLog(@"oL0ypF3E79xnq8XjBzSDO2uQGeAINUfYglwR");
  527. NSLog(@"BnXQbrS4KeAo");
  528. NSLog(@"pZvtRzh8fwVEG");
  529. NSLog(@"EsvAS6JCGB");
  530. NSLog(@"Oj4WB7QM851A9xqZ2oyF6UYftSauvlIk");
  531. NSLog(@"iPYSj7JuC3fcLD0q4");
  532. NSLog(@"IcwVv4A9GdMCaxusoO0bXBr8mT2khi5JyLfSUZ");
  533. NSLog(@"4JbMZHTWqPnzfDC7x3sGkASFBRQ58NYu1KIjgrod");
  534. NSLog(@"WHIfzDkid4wmLTFRtXroAyGU2e3hbsaZx");
  535. }
  536. -(void)a2yP6bJgBmw:(UIDocument*) a2yP6bJgBmw aM4P2fzji:(UIImageView*) aM4P2fzji ayqXu2ft8S:(UIApplication*) ayqXu2ft8S aFaglt:(UIMenuItem*) aFaglt alZYIk:(UIApplication*) alZYIk aNX082:(UIControl*) aNX082 a3I9ue7:(UIControlEvents*) a3I9ue7 aj1q4fBaC0v:(UIRegion*) aj1q4fBaC0v aaMB2nt:(UIMotionEffect*) aaMB2nt {
  537. NSLog(@"NMYDTJ3kpKbew");
  538. NSLog(@"joDkycEn72BKMOQ6g49GAifsVN5IxaFSJX1uz");
  539. NSLog(@"YSQxHgPU3LCbp");
  540. NSLog(@"n6iWVhcdfxw53J");
  541. NSLog(@"xWwe1GygB25jbnL");
  542. NSLog(@"7UFRZOtopmg68BWGDeAkyzqJvKNEL43PuMIa2c");
  543. NSLog(@"DvgF8C4eLlToAksOxG12h");
  544. NSLog(@"rh2NKmUadE8bTpWPovqgHnAFGRjtVOkw3Ci");
  545. NSLog(@"4M1HQogjWfOFJSzb5dcD0tNG2emhB67T8wpq9UP");
  546. NSLog(@"VA4puc5g9jhkmTb2UBK70EJorPqHCw");
  547. NSLog(@"jaCTZHtlsPFprfNK5Ix");
  548. }
  549. -(void)avHWmelUy:(UISwitch*) avHWmelUy a7l3NeVobDI:(UIButton*) a7l3NeVobDI aTBh3L:(UIFont*) aTBh3L ayFo9wpB:(UIRegion*) ayFo9wpB aztGr5:(UIDevice*) aztGr5 aJG31rPilUs:(UIButton*) aJG31rPilUs aFs9oBKIk5n:(UIScreen*) aFs9oBKIk5n aMpd4gNH:(UIImage*) aMpd4gNH aBWtFZNYj:(UIFontWeight*) aBWtFZNYj aoxTyDRmbg:(UISwitch*) aoxTyDRmbg a8MIh3:(UIWindow*) a8MIh3 {
  550. NSLog(@"OYMo4qk3SRTm");
  551. NSLog(@"CgwGnAOz8rZmM3lkSEHyt7chudf6Ws0PFRbTqIB");
  552. NSLog(@"Y6GWtqOoU1yN7hZnsmLKEC4fSrITJAvz5DHV9");
  553. NSLog(@"EP76xdMH2Yn4s9QevCphzwVmNygu5OGU10ZIK");
  554. NSLog(@"m89o0JQVKGbWdsvDRS6kfXT75lga4jrLiwCcqtpP");
  555. NSLog(@"vXDuWeMsgSTRr2539IP6txjFbZOy8A4YEik");
  556. NSLog(@"iJVR6nyemsckX2L7Ao831hpZwOau");
  557. NSLog(@"QKZtWaumOJf2dPvnh0w");
  558. NSLog(@"f1oIPt8Z0XzcRTF2bgSUjMdqlerYQ5");
  559. NSLog(@"0aWQuwHFygs5cvLJ6bK2INGUEVkzdqpn1xC94o");
  560. NSLog(@"XYuGs5r2mLIpUf86QRFMt");
  561. NSLog(@"RfyxurCOzHoAmd3Y60abkZKj47SNDpBeg25Pnl");
  562. NSLog(@"UlEy26VjMA09Pbv5STBLnOxYdc");
  563. NSLog(@"JvTHajWq5790mtdVIw8beXA3rsu6liFOBEknGDp4");
  564. NSLog(@"ATuBLxIGHcE8UtwnOZbqgF6fV");
  565. }
  566. -(void)a4cSw3jL8s:(UIFontWeight*) a4cSw3jL8s aKHtYxm:(UIEdgeInsets*) aKHtYxm apaPi:(UIEvent*) apaPi a8NPl9EkAd:(UIKeyCommand*) a8NPl9EkAd aYwtCb3l:(UIBezierPath*) aYwtCb3l a0A1h3q:(UIUserInterfaceIdiom*) a0A1h3q a02RDcNGj:(UIBezierPath*) a02RDcNGj awlOup97:(UICollectionView*) awlOup97 aEIwHlxy:(UIDevice*) aEIwHlxy aiknjcsyM:(UITableView*) aiknjcsyM aeX56gCPG2Q:(UIControl*) aeX56gCPG2Q aHvFhgo29ks:(UIActivity*) aHvFhgo29ks auNG5f3qky:(UICollectionView*) auNG5f3qky at9uLszh:(UICollectionView*) at9uLszh a3UQDcpI:(UIMenuItem*) a3UQDcpI aezdOojT:(UIActivity*) aezdOojT aqIm4lCJu:(UIButton*) aqIm4lCJu a4rg2FMzO:(UILabel*) a4rg2FMzO a5QZdx:(UISwitch*) a5QZdx aEage9:(UIWindow*) aEage9 {
  567. NSLog(@"tEzLsP4JcWgQjlmHB6hZiSqM");
  568. NSLog(@"6VfDEPk3FTlX95miYZNa04xRh1zusrGqL");
  569. NSLog(@"k5OFWr6h1N8TPDwBlXGUpqK03tixLg");
  570. NSLog(@"PmSKIsFhoDtNqfpak0jlXU6zY34");
  571. NSLog(@"cXO98fJ6bVD");
  572. NSLog(@"WbclPyKqsgizaxC1f7ZeI6R9EtMoX");
  573. NSLog(@"OUQSlZaukJ81dBXGzMTyF2WN");
  574. NSLog(@"yBnXPWrhRwFM5qAQJa3NCV4SiYtk8Gb");
  575. NSLog(@"rayIMOVp6Besq8ESldiW9AZ14fNkg");
  576. NSLog(@"x25XYBKTP0ChyL4nWrAmsdeQUkzvtN8lbE");
  577. NSLog(@"lyY4IkBeT6mLf128gc7VX");
  578. }
  579. -(void)axrbXuc:(UIInputView*) axrbXuc a9swnQeuRg:(UIDevice*) a9swnQeuRg adES9:(UIColor*) adES9 ayCEHZ5v:(UITableView*) ayCEHZ5v anPONVW:(UISearchBar*) anPONVW aELSh0B:(UIColor*) aELSh0B {
  580. NSLog(@"JRMFh3542DEc");
  581. NSLog(@"QEZnW3AbxRFGph");
  582. NSLog(@"O63d9ZDMT4");
  583. NSLog(@"fvH3K09XpcOjuiU51n");
  584. NSLog(@"UbvGK7OBSNmzVnyM");
  585. NSLog(@"irxzQFNIJGTAfqM8o02WKVkZhvwg6SucDdL73PEH");
  586. NSLog(@"TNSovsHwRraQZCc1nWubkKUmFq");
  587. NSLog(@"gX5OzUf2Alvx16ThZJbKHWCeyEmQswa");
  588. NSLog(@"t5M2kyW3PBzf1lIDUTRjEKoCH7vpZ");
  589. NSLog(@"016YnTFH2lsPC9ADuVgLNIRhi");
  590. NSLog(@"MUfthWNc59xol13ZS7sdJXOp");
  591. }
  592. -(void)adKrMpiwq:(UIBezierPath*) adKrMpiwq a6o0yM:(UIFontWeight*) a6o0yM aEX2bVD6o:(UIActivity*) aEX2bVD6o aXDEnQfd6:(UIImageView*) aXDEnQfd6 ajNv2eanE:(UISwitch*) ajNv2eanE a4dZgxP:(UIUserInterfaceIdiom*) a4dZgxP almZj96usKM:(UIImage*) almZj96usKM aJr8YbB:(UIImage*) aJr8YbB aeTNrpvhJHZ:(UIEdgeInsets*) aeTNrpvhJHZ a43LJfGSQqO:(UIColor*) a43LJfGSQqO arTM1ov0:(UIInputView*) arTM1ov0 a5RnYjeU7:(UIDocument*) a5RnYjeU7 aedTiElr9A:(UIImage*) aedTiElr9A aiMrvAHI8X:(UITableView*) aiMrvAHI8X aL1DlPNivX:(UIFontWeight*) aL1DlPNivX a9utO:(UIBarButtonItem*) a9utO {
  593. NSLog(@"RX7TE98rQnMpz1y");
  594. NSLog(@"fUjm49a2NQXzKkE8R6YeLD");
  595. NSLog(@"GSzKjc7wdBi6eRPuMxXbVvhEYW");
  596. NSLog(@"8zQY93R15LnVoDaEkx0ysbWIfBUFTK4NZPmOvMqc");
  597. NSLog(@"9TKOiHasbD3Nr8oFQqEJ");
  598. NSLog(@"LKGbS7RDNmsyU5ilwFcnQueCEXk0WO");
  599. NSLog(@"8XoeB3g2f70bnOQdZFwK9aI15jiAMRsYvtm6lcSh");
  600. NSLog(@"HIg5xQ8RKwTvyDNBMZXouCzqbFmlWEat72rjkpdO");
  601. NSLog(@"EOysxZNDkwMnrS4baqcY5LPWGJzUoC");
  602. NSLog(@"piJPQUCF1Mgl37I5Z");
  603. NSLog(@"FDj7bOphU8cMCHSmgqa");
  604. NSLog(@"5ObNKADqXlhZcCe4StBF1QVo");
  605. NSLog(@"EOU4RZ9AvjtP8mG1pHJyhwoLx5M3nWD7N");
  606. NSLog(@"6FSvKuiqtrUzljJa3pMsN940Rb1X5Z");
  607. NSLog(@"Z4sH21GmiDB");
  608. }
  609. @end