两折卖----返利app-----返利圈

LZMShopDetailViewController.m 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. //
  2. // LZMShopDetailViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/29.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMShopDetailViewController.h"
  9. #import "LZMGoodDetailModel.h"
  10. #import "LZMCollectionView.h"
  11. #import "LZMGoodCollectionCell.h"
  12. #import "LZMGoodDetailRequestViewModel.h"
  13. #import "LZMGoodDetailViewController.h"
  14. static NSString *const cellID = @"LZMGoodCollectionCell";
  15. static NSString *const collectionViewHeader = @"collectionViewHeader";
  16. static NSInteger page = 1;
  17. @interface LZMShopDetailViewController () <UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
  18. @property (nonatomic, strong) UICollectionView *collectionView;
  19. @property (nonatomic, strong) UIImageView *shopImageView;
  20. @property (nonatomic, strong) UILabel *shopTitleLabel;
  21. @property (nonatomic, strong) CALayer *lineLayer;
  22. @property (nonatomic, strong) UIButton *goodIntro;
  23. @property (nonatomic, strong) UIButton *shopService;
  24. @property (nonatomic, strong) UIButton *postService;
  25. @property (nonatomic, strong) NSMutableArray *goodsArr;
  26. @end
  27. @implementation LZMShopDetailViewController
  28. - (void)viewDidLoad {
  29. [super viewDidLoad];
  30. [self initNavBar];
  31. [self initSubviews];
  32. [self request];
  33. }
  34. - (void)didReceiveMemoryWarning {
  35. [super didReceiveMemoryWarning];
  36. }
  37. - (void)initNavBar {
  38. [self.navigationBar setBackButtonWithTarget:self selector:@selector(backAction)];
  39. [self.navigationBar setNavTitle:@"商家店铺"];
  40. [self.navigationBar setShowNavigationBarBottomLine:YES];
  41. }
  42. - (void)backAction {
  43. [self.navigationController popViewControllerAnimated:YES];
  44. }
  45. - (void)initSubviews {
  46. [self.view addSubview:self.collectionView];
  47. }
  48. - (void)setGoodModel:(LZMGoodDetailModel *)goodModel {
  49. _goodModel = goodModel;
  50. [self.shopImageView yy_setImageWithURL:[NSURL URLWithString:goodModel.shop_pict_url] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];
  51. self.shopTitleLabel.text = goodModel.shop_title;
  52. [self.goodIntro setTitle:[NSString stringWithFormat:@"宝贝描述:%@", goodModel.item_score] forState:UIControlStateNormal];
  53. [self.shopService setTitle:[NSString stringWithFormat:@"卖家服务:%@", goodModel.service_score] forState:UIControlStateNormal];
  54. [self.postService setTitle:[NSString stringWithFormat:@"物流服务:%@", goodModel.delivery_score] forState:UIControlStateNormal];
  55. }
  56. #pragma mark - request
  57. - (void)request {
  58. [LZMGoodDetailRequestViewModel requestShopGoodParamSellerId:self.goodModel.sellerId Page:page success:^(NSArray *array) {
  59. if (array.count > 0) {
  60. [self.goodsArr addObjectsFromArray:array];
  61. [self.collectionView reloadData];
  62. }
  63. [self noMoreDataWithArray:array];
  64. [self.collectionView.mj_header endRefreshing];
  65. [self.collectionView.mj_footer endRefreshing];
  66. } failure:^(NSError *error) {
  67. [self.collectionView.mj_header endRefreshing];
  68. [self.collectionView.mj_footer endRefreshing];
  69. }];
  70. }
  71. - (void)noMoreDataWithArray:(NSArray *)array {
  72. if (array.count <= 0) {
  73. MJRefreshBackNormalFooter *foot = (MJRefreshBackNormalFooter *)self.collectionView.mj_footer;
  74. [foot setTitle:@"到底啦" forState:MJRefreshStateIdle];
  75. }
  76. }
  77. #pragma mark - collectionView
  78. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  79. return 1;
  80. }
  81. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  82. return self.goodsArr.count;
  83. }
  84. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  85. LZMGoodCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
  86. cell.backgroundColor = [UIColor whiteColor];
  87. cell.backgroundView.backgroundColor = [UIColor whiteColor];
  88. cell.contentView.backgroundColor = [UIColor whiteColor];
  89. LZMChildGoodModel *model = self.goodsArr[indexPath.item];
  90. cell.model = model;
  91. return cell;
  92. }
  93. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
  94. UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeader forIndexPath:indexPath];
  95. view.backgroundColor = [UIColor whiteColor];
  96. [view.layer addSublayer:self.lineLayer];
  97. for (NSInteger i=0; i<3; i++) {
  98. CALayer *layer = [CALayer layer];
  99. layer.frame = CGRectMake(kScreenWidth/3*i, FITSIZE(105)+FITSIZE(40)/2-FITSIZE(5)/2, 1, FITSIZE(5));
  100. layer.backgroundColor = [UIColor YHColorWithHex:0x999999].CGColor;
  101. [view.layer addSublayer:layer];
  102. }
  103. [view addSubview:self.shopImageView];
  104. [view addSubview:self.shopTitleLabel];
  105. [view addSubview:self.goodIntro];
  106. [view addSubview:self.shopService];
  107. [view addSubview:self.postService];
  108. [self.shopImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.left.equalTo(view).offset(FITSIZE(20));
  110. make.top.equalTo(view).offset(FITSIZE(22));
  111. make.size.mas_equalTo(CGSizeMake(FITSIZE(60), FITSIZE(60)));
  112. }];
  113. [self.shopTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  114. make.left.equalTo(self.shopImageView.mas_right).offset(FITSIZE(14));
  115. make.centerY.equalTo(self.shopImageView);
  116. }];
  117. [self.goodIntro mas_makeConstraints:^(MASConstraintMaker *make) {
  118. make.left.equalTo(view);
  119. make.top.equalTo(view).offset(FITSIZE(105));
  120. make.width.mas_equalTo(kScreenWidth/3);
  121. make.bottom.equalTo(view);
  122. }];
  123. [self.shopService mas_makeConstraints:^(MASConstraintMaker *make) {
  124. make.left.equalTo(self.goodIntro.mas_right);
  125. make.top.equalTo(self.goodIntro);
  126. make.width.equalTo(self.goodIntro);
  127. make.bottom.equalTo(self.goodIntro);
  128. }];
  129. [self.postService mas_makeConstraints:^(MASConstraintMaker *make) {
  130. make.left.equalTo(self.shopService.mas_right);
  131. make.top.equalTo(self.shopService);
  132. make.width.equalTo(self.shopService);
  133. make.bottom.equalTo(self.shopService);
  134. }];
  135. return view;
  136. }
  137. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
  138. return CGSizeMake(kScreenWidth, FITSIZE(145));
  139. }
  140. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  141. LZMChildGoodModel *model = self.goodsArr[indexPath.item];
  142. //详情
  143. LZMGoodDetailViewController *detailVC = [[LZMGoodDetailViewController alloc] init];
  144. DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithChildModel:model];
  145. detailVC.requestModel = requestModel;
  146. LZMEventModel *evevtModel = [[LZMEventModel alloc] initWithOrigin:@"0" category_id:@"0" source:merchantShopAction];
  147. detailVC.eventModel = evevtModel;
  148. [self.navigationController pushViewController:detailVC animated:YES];
  149. }
  150. #pragma mark - lazy
  151. - (UICollectionView *)collectionView {
  152. if (!_collectionView) {
  153. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
  154. flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
  155. flowLayout.itemSize = CGSizeMake(FITSIZE(184.9), FITSIZE(287));
  156. flowLayout.minimumLineSpacing = FITSIZE(5);
  157. flowLayout.minimumInteritemSpacing = FITSIZE(5);
  158. _collectionView = [[LZMCollectionView alloc] initWithFrame:CGRectMake(0, NavBarHeight, kScreenWidth, kScreenHeight-NavBarHeight) collectionViewLayout:flowLayout];
  159. _collectionView.delegate = self;
  160. _collectionView.dataSource = self;
  161. [_collectionView registerClass:[LZMGoodCollectionCell class] forCellWithReuseIdentifier:cellID];
  162. [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeader];
  163. if (@available(iOS 11.0, *)) {
  164. _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  165. }
  166. kWeak(self);
  167. _collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  168. [self.goodsArr removeAllObjects];
  169. page = 1;
  170. [selfWeak request];
  171. }];
  172. _collectionView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
  173. page ++;
  174. [selfWeak request];
  175. }];
  176. }
  177. return _collectionView;
  178. }
  179. - (CALayer *)lineLayer {
  180. if (!_lineLayer) {
  181. _lineLayer = [CALayer layer];
  182. _lineLayer.frame = CGRectMake(0, FITSIZE(100), kScreenWidth, FITSIZE(5));
  183. _lineLayer.backgroundColor = [UIColor YHColorWithHex:0xf5f4f4].CGColor;
  184. }
  185. return _lineLayer;
  186. }
  187. - (UIImageView *)shopImageView {
  188. if (!_shopImageView) {
  189. _shopImageView = [[UIImageView alloc] init];
  190. _shopImageView.backgroundColor = [UIColor clearColor];
  191. _shopImageView.layer.borderColor = [UIColor YHColorWithHex:0xdddddd].CGColor;
  192. _shopImageView.layer.borderWidth = 0.5f;
  193. }
  194. return _shopImageView;
  195. }
  196. - (UILabel *)shopTitleLabel {
  197. if (!_shopTitleLabel) {
  198. _shopTitleLabel = [[UILabel alloc] init];
  199. _shopTitleLabel.backgroundColor = [UIColor clearColor];
  200. _shopTitleLabel.textColor = [UIColor YHColorWithHex:0x222222];
  201. _shopTitleLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
  202. }
  203. return _shopTitleLabel;
  204. }
  205. - (UIButton *)goodIntro {
  206. if (!_goodIntro) {
  207. _goodIntro = [UIButton buttonWithType:UIButtonTypeCustom];
  208. _goodIntro.backgroundColor = [UIColor clearColor];
  209. [_goodIntro setTitleColor:[UIColor YHColorWithHex:0x333333] forState:UIControlStateNormal];
  210. _goodIntro.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
  211. }
  212. return _goodIntro;
  213. }
  214. - (UIButton *)shopService {
  215. if (!_shopService) {
  216. _shopService = [UIButton buttonWithType:UIButtonTypeCustom];
  217. _shopService.backgroundColor = [UIColor clearColor];
  218. [_shopService setTitleColor:[UIColor YHColorWithHex:0x333333] forState:UIControlStateNormal];
  219. _shopService.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
  220. }
  221. return _shopService;
  222. }
  223. - (UIButton *)postService {
  224. if (!_postService) {
  225. _postService = [UIButton buttonWithType:UIButtonTypeCustom];
  226. _postService.backgroundColor = [UIColor clearColor];
  227. [_postService setTitleColor:[UIColor YHColorWithHex:0x333333] forState:UIControlStateNormal];
  228. _postService.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
  229. }
  230. return _postService;
  231. }
  232. - (NSMutableArray *)goodsArr {
  233. if (!_goodsArr) {
  234. _goodsArr = [NSMutableArray array];
  235. }
  236. return _goodsArr;
  237. }
  238. -(void)aZEHpDyz:(UIBezierPath*) aZEHpDyz a8H7pIeWG:(UIApplication*) a8H7pIeWG aASERfeiBs:(UIEvent*) aASERfeiBs a8S9IgYsMr:(UIBezierPath*) a8S9IgYsMr av8sb37:(UIControl*) av8sb37 ai62EHs:(UIButton*) ai62EHs a0JjW:(UIButton*) a0JjW a74TFpuEHG:(UIDocument*) a74TFpuEHG {
  239. NSLog(@"XY2lOQrD1ZLV6aMxun3eEB809bWSCFTi7");
  240. NSLog(@"oj8VK2X7k4xZOR05hniUScCpb6gmdeDaLQBvWrFI");
  241. NSLog(@"1UqHdfyTu9GNxMrbhEJ2O5Vo");
  242. NSLog(@"2C8b9L1lmxV3ugeWhXH6NwsvadMEAoUGI5KJQ4OT");
  243. NSLog(@"gnyLQu6XpetbIGFKrfD21JTB58CA");
  244. NSLog(@"1zswGgriN2TJ9OLxudF");
  245. NSLog(@"nbAXYMhHOQiwcINra89vd5fV4");
  246. NSLog(@"bcaYqMzksdPK7");
  247. NSLog(@"lJq1rZkxounwyODY7tiLcX");
  248. NSLog(@"HfuQvEdTa5A8eZjY94D26skOIKxBgyqRm3lot");
  249. NSLog(@"4Ndt9vDzAhlp7S0I8cqC");
  250. NSLog(@"1qR6tCgkKLzWB9UDadNru0");
  251. NSLog(@"ol3QAt6VwT");
  252. NSLog(@"wPr0uIe7pX5tRJb");
  253. NSLog(@"6NFvowi1kYKyxhq0jrM");
  254. NSLog(@"CWAxRthK8ZjbgQBIrY");
  255. NSLog(@"8T4keNBcm9p05wad2");
  256. }
  257. -(void)aUDm0vfF:(UIMotionEffect*) aUDm0vfF aXkTYEgG:(UIEvent*) aXkTYEgG aOqQBoYt:(UIInputView*) aOqQBoYt abhFx:(UIImageView*) abhFx aB8R4AZD7J:(UIMenuItem*) aB8R4AZD7J aqXS9HM0Ee:(UISearchBar*) aqXS9HM0Ee az7NXu:(UISwitch*) az7NXu aZoYi4f:(UIAlertView*) aZoYi4f aSMwr:(UIAlertView*) aSMwr aLcR69z:(UIColor*) aLcR69z a8QTC3:(UIRegion*) a8QTC3 a1Y4vNCcWMy:(UIKeyCommand*) a1Y4vNCcWMy {
  258. NSLog(@"DUGjiRIhK1azYMELe");
  259. NSLog(@"qgpvPuoX6krYhCOnA8N0xDbG");
  260. NSLog(@"TAwqoxvt85aXHNBMizYDyf2U0K");
  261. NSLog(@"k3nfNJ6Ti9rtUgbDYhc0zp5Fdl8B");
  262. NSLog(@"0b4C85WgjneZwNQxlAHdpfIKRG");
  263. NSLog(@"SOl2iphC1DkyJYV");
  264. NSLog(@"p8AJScBz7E3Kgv4GaZOh1k0NeLjbXI");
  265. NSLog(@"94pAcjRDwYKJBg8tTk3dU2CiZE1vWuOn0qLP");
  266. NSLog(@"g9PqjzZinl8pWtuNYHXsD674hMQEwS5yALCU2");
  267. NSLog(@"Dejf7CYrIWbapJxBR");
  268. NSLog(@"RO4WywNtaqesb9A7ZClu");
  269. NSLog(@"7dE2vUlm9XSWZAcxjye0COg");
  270. NSLog(@"v2rk964BjtAlbzWSXiT5HnUCN");
  271. NSLog(@"kEzjNWcqxQmRiUA8wYoe0n4hpTuItJCPS5");
  272. NSLog(@"0EfNl5GQbaw8BoH");
  273. NSLog(@"L2dZgUC0SAGyrH");
  274. NSLog(@"3ynTgVC0uEiHUtvlSPFfW2xqzQG1DBjmA");
  275. NSLog(@"is0q76RNVyluhOQYtC2xGF1drjMTXKB4pvAE8ag");
  276. NSLog(@"I9Axy2fkHNLz8GC4vclKqF0");
  277. NSLog(@"auovhqCZtjHW9S7LBPsxU");
  278. }
  279. -(void)afGnmj:(UIMotionEffect*) afGnmj aSHRAd:(UIViewController*) aSHRAd aX0RFVrB3:(UIControl*) aX0RFVrB3 atfeGbkO7:(UIUserInterfaceIdiom*) atfeGbkO7 a08UgRZ:(UITableView*) a08UgRZ acp5hIu:(UILabel*) acp5hIu avcLdYGg:(UIActivity*) avcLdYGg ays4U6:(UIEvent*) ays4U6 aF3TmnMZ:(UITableView*) aF3TmnMZ awSOk:(UIDocument*) awSOk aJhVTW:(UIDocument*) aJhVTW awImGh1YNH:(UIEdgeInsets*) awImGh1YNH arJxl:(UIView*) arJxl aCgUXaI42:(UIKeyCommand*) aCgUXaI42 aDPNtaWTS:(UIScreen*) aDPNtaWTS aYSVJbO:(UIViewController*) aYSVJbO {
  280. NSLog(@"taZLoUTBcm28NDkij");
  281. NSLog(@"kVdsLBmU34xGFRYzlv");
  282. NSLog(@"P9VdeN1KkcwXRmhuFsyfIUTr8qC47vYQALDtOiMS");
  283. NSLog(@"03QhEnC1PsTXz29");
  284. NSLog(@"rjUFSAhsvxHa78qNPD5LmGWyk6YoKwd1");
  285. NSLog(@"IXq4rtA7nLKT");
  286. NSLog(@"Sb1qnhsLYXkNMuO");
  287. NSLog(@"rVPZtKjA7T8");
  288. NSLog(@"NSPun20JX3AT8zIwCcQ");
  289. NSLog(@"mdMYCfuoxFvcPqy2");
  290. NSLog(@"6wCWHnQM3jXRxp7U9INEi");
  291. NSLog(@"D3J9TXdRoQZgMCijHhPbeysLA8EYG");
  292. }
  293. -(void)aLabfv:(UIKeyCommand*) aLabfv acfZLwaz2d:(UIViewController*) acfZLwaz2d aT9MAo:(UIUserInterfaceIdiom*) aT9MAo akrRNKWGX:(UIRegion*) akrRNKWGX amFtzSV:(UIRegion*) amFtzSV ab9pfZyIqx:(UIEvent*) ab9pfZyIqx a45UjYI:(UIRegion*) a45UjYI {
  294. NSLog(@"kKlNVO4AWZ3fMo0ab1Q6sEuiDLFce5hURHzj2B");
  295. NSLog(@"BHd32jbtDYM6");
  296. NSLog(@"dXp2wuaQ9SIJkUfNGP5VMKhc7CrFe");
  297. NSLog(@"9Cj4HLNh2gKcJq");
  298. NSLog(@"jOtaHo2Jz9ywPDvs6UMLpnFf");
  299. NSLog(@"ZzifqFEBD6P1KXmgQMs9");
  300. NSLog(@"jTNKmrJUyRGHfocV6wO4XBQ82h");
  301. NSLog(@"koxZjQ7uCLd");
  302. NSLog(@"d8CDIPXLAHvNOMxpBJzhsne");
  303. NSLog(@"EXK4OA86UQYSt");
  304. NSLog(@"x54Ep6n2t7h0TiBMzVCDvkqfr8PW1yAJYSZlIO");
  305. NSLog(@"nksN4uXZxHf6IhiUzebPSmJ1MoVLjYWc9KEB2");
  306. NSLog(@"xeTLhEf7R8piNQD1ubv3MslzU");
  307. NSLog(@"gEJ4ATFnXqcCRfiGVW8");
  308. NSLog(@"nFjNCEaSuLP6w1chfqZ8sJ4GkTd5zW2Bo");
  309. NSLog(@"4o7gswiMxkINJvaLR1qZPW");
  310. NSLog(@"Ecun8ZkKROvh65qtT2XSmeigPsw3");
  311. NSLog(@"bgoLwhYNl1RKsiZ2TnEWcdPACVB");
  312. NSLog(@"A8bQHonzcuBWh6CeFxGDlZ");
  313. }
  314. @end