123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- //
- // LFWShopDetailViewController.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/29.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LFWShopDetailViewController.h"
- #import "LFWGoodDetailModel.h"
- #import "LFWCollectionView.h"
- #import "LFWGoodCollectionCell.h"
- #import "LFWGoodDetailRequestViewModel.h"
- #import "LFWGoodDetailViewController.h"
- static NSString *const cellID = @"LFWGoodCollectionCell";
- static NSString *const collectionViewHeader = @"collectionViewHeader";
- static NSInteger page = 1;
- @interface LFWShopDetailViewController () <UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
- @property (nonatomic, strong) UICollectionView *collectionView;
- @property (nonatomic, strong) UIImageView *shopImageView;
- @property (nonatomic, strong) UILabel *shopTitleLabel;
- @property (nonatomic, strong) CALayer *lineLayer;
- @property (nonatomic, strong) UIButton *goodIntro;
- @property (nonatomic, strong) UIButton *shopService;
- @property (nonatomic, strong) UIButton *postService;
- @property (nonatomic, strong) NSMutableArray *goodsArr;
- @end
- @implementation LFWShopDetailViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self initNavBar];
- [self initSubviews];
- [self request];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- }
- - (void)initNavBar {
- [self.navigationBar setBackButtonWithTarget:self selector:@selector(backAction)];
- [self.navigationBar setNavTitle:@"商家店铺"];
- [self.navigationBar setShowNavigationBarBottomLine:YES];
- }
- - (void)backAction {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)initSubviews {
- [self.view addSubview:self.collectionView];
- }
- - (void)setGoodModel:(LFWGoodDetailModel *)goodModel {
- _goodModel = goodModel;
-
- [self.shopImageView yy_setImageWithURL:[NSURL URLWithString:goodModel.shop_pict_url] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];
- self.shopTitleLabel.text = goodModel.shop_title;
- [self.goodIntro setTitle:[NSString stringWithFormat:@"宝贝描述:%@", goodModel.item_score] forState:UIControlStateNormal];
- [self.shopService setTitle:[NSString stringWithFormat:@"卖家服务:%@", goodModel.service_score] forState:UIControlStateNormal];
- [self.postService setTitle:[NSString stringWithFormat:@"物流服务:%@", goodModel.delivery_score] forState:UIControlStateNormal];
- }
- #pragma mark - request
- - (void)request {
- [LFWGoodDetailRequestViewModel requestShopGoodParamSellerId:self.goodModel.sellerId Page:page success:^(NSArray *array) {
- if (array.count > 0) {
- [self.goodsArr addObjectsFromArray:array];
- [self.collectionView reloadData];
- }
-
- if (array.count <= 0) {
- MJRefreshAutoNormalFooter *foot = (MJRefreshAutoNormalFooter *)self.collectionView.mj_footer;
- [foot setTitle:@"到底啦~" forState:MJRefreshStateIdle];
- }
-
-
- [self.collectionView.mj_header endRefreshing];
- [self.collectionView.mj_footer endRefreshing];
- } failure:^(NSError *error) {
- [self.collectionView.mj_header endRefreshing];
- [self.collectionView.mj_footer endRefreshing];
- }];
- }
- #pragma mark - collectionView
- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
- return 1;
- }
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
- return self.goodsArr.count;
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
- LFWGoodCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
- cell.backgroundColor = [UIColor whiteColor];
- cell.backgroundView.backgroundColor = [UIColor whiteColor];
- cell.contentView.backgroundColor = [UIColor whiteColor];
- LFWChildGoodModel *model = self.goodsArr[indexPath.item];
- cell.model = model;
- return cell;
- }
- - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
- UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeader forIndexPath:indexPath];
- view.backgroundColor = [UIColor whiteColor];
-
- [view.layer addSublayer:self.lineLayer];
-
- for (NSInteger i=0; i<3; i++) {
- CALayer *layer = [CALayer layer];
- layer.frame = CGRectMake(kScreenWidth/3*i, FITSIZE(105)+FITSIZE(40)/2-FITSIZE(5)/2, 1, FITSIZE(5));
- layer.backgroundColor = [UIColor YHColorWithHex:0x999999].CGColor;
- [view.layer addSublayer:layer];
- }
-
- [view addSubview:self.shopImageView];
- [view addSubview:self.shopTitleLabel];
- [view addSubview:self.goodIntro];
- [view addSubview:self.shopService];
- [view addSubview:self.postService];
-
- [self.shopImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view).offset(FITSIZE(20));
- make.top.equalTo(view).offset(FITSIZE(22));
- make.size.mas_equalTo(CGSizeMake(FITSIZE(60), FITSIZE(60)));
- }];
-
- [self.shopTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.shopImageView.mas_right).offset(FITSIZE(14));
- make.centerY.equalTo(self.shopImageView);
- }];
-
- [self.goodIntro mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view);
- make.top.equalTo(view).offset(FITSIZE(105));
- make.width.mas_equalTo(kScreenWidth/3);
- make.bottom.equalTo(view);
- }];
-
- [self.shopService mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.goodIntro.mas_right);
- make.top.equalTo(self.goodIntro);
- make.width.equalTo(self.goodIntro);
- make.bottom.equalTo(self.goodIntro);
- }];
-
- [self.postService mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.shopService.mas_right);
- make.top.equalTo(self.shopService);
- make.width.equalTo(self.shopService);
- make.bottom.equalTo(self.shopService);
- }];
-
- return view;
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
- return CGSizeMake(kScreenWidth, FITSIZE(145));
- }
- - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
- LFWChildGoodModel *model = self.goodsArr[indexPath.item];
- //详情
- LFWGoodDetailViewController *detailVC = [[LFWGoodDetailViewController alloc] init];
- detailVC.goods_id = model.goods_id;
- [self.navigationController pushViewController:detailVC animated:YES];
- }
- #pragma mark - lazy
- - (UICollectionView *)collectionView {
- if (!_collectionView) {
- UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
- flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
- flowLayout.itemSize = CGSizeMake(FITSIZE(184.9), FITSIZE(287));
- flowLayout.minimumLineSpacing = FITSIZE(5);
- flowLayout.minimumInteritemSpacing = FITSIZE(5);
-
- _collectionView = [[LFWCollectionView alloc] initWithFrame:CGRectMake(0, NavBarHeight, kScreenWidth, kScreenHeight-NavBarHeight) collectionViewLayout:flowLayout];
- _collectionView.delegate = self;
- _collectionView.dataSource = self;
- [_collectionView registerClass:[LFWGoodCollectionCell class] forCellWithReuseIdentifier:cellID];
- [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeader];
- if (@available(iOS 11.0, *)) {
- _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- }
- kWeak(self);
- _collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- [self.goodsArr removeAllObjects];
- page = 1;
- [selfWeak request];
- }];
- _collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
- page ++;
- [selfWeak request];
- }];
-
- }
- return _collectionView;
- }
- - (CALayer *)lineLayer {
- if (!_lineLayer) {
- _lineLayer = [CALayer layer];
- _lineLayer.frame = CGRectMake(0, FITSIZE(100), kScreenWidth, FITSIZE(5));
- _lineLayer.backgroundColor = [UIColor YHColorWithHex:0xf5f4f4].CGColor;
- }
- return _lineLayer;
- }
- - (UIImageView *)shopImageView {
- if (!_shopImageView) {
- _shopImageView = [[UIImageView alloc] init];
- _shopImageView.backgroundColor = [UIColor clearColor];
- _shopImageView.layer.borderColor = [UIColor YHColorWithHex:0xdddddd].CGColor;
- _shopImageView.layer.borderWidth = 0.5f;
- }
- return _shopImageView;
- }
- - (UILabel *)shopTitleLabel {
- if (!_shopTitleLabel) {
- _shopTitleLabel = [[UILabel alloc] init];
- _shopTitleLabel.backgroundColor = [UIColor clearColor];
- _shopTitleLabel.textColor = [UIColor YHColorWithHex:0x222222];
- _shopTitleLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
- }
- return _shopTitleLabel;
- }
- - (UIButton *)goodIntro {
- if (!_goodIntro) {
- _goodIntro = [UIButton buttonWithType:UIButtonTypeCustom];
- _goodIntro.backgroundColor = [UIColor clearColor];
- [_goodIntro setTitleColor:[UIColor YHColorWithHex:0x333333] forState:UIControlStateNormal];
- _goodIntro.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
- }
- return _goodIntro;
- }
- - (UIButton *)shopService {
- if (!_shopService) {
- _shopService = [UIButton buttonWithType:UIButtonTypeCustom];
- _shopService.backgroundColor = [UIColor clearColor];
- [_shopService setTitleColor:[UIColor YHColorWithHex:0x333333] forState:UIControlStateNormal];
- _shopService.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
- }
- return _shopService;
- }
- - (UIButton *)postService {
- if (!_postService) {
- _postService = [UIButton buttonWithType:UIButtonTypeCustom];
- _postService.backgroundColor = [UIColor clearColor];
- [_postService setTitleColor:[UIColor YHColorWithHex:0x333333] forState:UIControlStateNormal];
- _postService.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
- }
- return _postService;
- }
- - (NSMutableArray *)goodsArr {
- if (!_goodsArr) {
- _goodsArr = [NSMutableArray array];
- }
- return _goodsArr;
- }
- -(void)aRaTt8:(UIBarButtonItem*) aRaTt8 aCLtW0vDlKO:(UIView*) aCLtW0vDlKO aLal4SH3PqV:(UIDevice*) aLal4SH3PqV ahLpB3tF5:(UIUserInterfaceIdiom*) ahLpB3tF5 adgoS:(UIRegion*) adgoS aRyb4JpCaq:(UIEdgeInsets*) aRyb4JpCaq a9XJFMO0i8:(UIActivity*) a9XJFMO0i8 a4vjDSkrnq:(UIBarButtonItem*) a4vjDSkrnq azFZfUtM872:(UIWindow*) azFZfUtM872 a9hNbguT0:(UIFontWeight*) a9hNbguT0 aEX5JN1Q:(UIControl*) aEX5JN1Q ap5Mx:(UIDevice*) ap5Mx a7iTW:(UIWindow*) a7iTW {
- NSLog(@"OEI7dzCjQnm");
- NSLog(@"aPlkbg8U1Rzr7TDyfXtFKLEow5uJBIceVd");
- NSLog(@"xlt79soCaDFZ0TbuP2AEeGrNcRIK");
- NSLog(@"H2UZK6lm1wQWokY");
- NSLog(@"OCnXZAcM237iLo5pWRs01DP86ryh");
- NSLog(@"eLkTzlq76BHj0XSxFUuZAVWrEOoi9");
- NSLog(@"MpaOoRzxrZsm6JEKG4jCLtfNVP9Wl2AYXbn3");
- NSLog(@"HbiMKpmkIejPh3fVgCBWz9aYTNU8");
- NSLog(@"O5KjM7UlVZDNzwvoe4mQTFGbP1kWY");
- NSLog(@"wXTmEh2WxVf85nqRrKckgtaY7GJA");
- NSLog(@"lg8Tho4ZwqY3WEGxzFOp2");
- NSLog(@"mIH7qTkK94x");
- }
- -(void)aKGBO:(UIActivity*) aKGBO arTLMdYOp:(UIControl*) arTLMdYOp aaoSMzARVKn:(UIDocument*) aaoSMzARVKn aDLr5YzdCiB:(UIView*) aDLr5YzdCiB aHk9jxZu6Fy:(UIBarButtonItem*) aHk9jxZu6Fy ahCwysi:(UIEvent*) ahCwysi aqOCnFgXWjl:(UIRegion*) aqOCnFgXWjl aMl9PoF6h5j:(UIFontWeight*) aMl9PoF6h5j axqpa1yZrNJ:(UICollectionView*) axqpa1yZrNJ a50oz:(UIVisualEffectView*) a50oz a56XA0eTEpx:(UITableView*) a56XA0eTEpx al7Z4AX:(UIControlEvents*) al7Z4AX a7WXfl:(UIImage*) a7WXfl {
- NSLog(@"DJWnzESB63TQO0y");
- NSLog(@"20zWb6IlLBiUQ1mqEvgKPRCh5S");
- NSLog(@"5UJSQeFML06PxiVY7WpbNrafg");
- NSLog(@"stc4JnSxFrR2IN5pDa3YQVUEWL79mGT");
- NSLog(@"KfV5wdIDtvEqLojYibP");
- NSLog(@"RMgyK7cwvsAexkp");
- NSLog(@"Ce65I7Dxj0BVG4MibK8LyodcfQ");
- NSLog(@"xiH63BNPfyDKhdZtIAzYbwcOVv5To8Ul9sqWn");
- NSLog(@"537rtwbjfc4uMlvSG8xyWJN");
- NSLog(@"YRv83EG06cXl");
- NSLog(@"2sZzImvtwTn");
- NSLog(@"lBNTVCH934jGnm7wyO");
- NSLog(@"Spx3mDMFJay4PWYRZk0");
- NSLog(@"Mn0gOlmivyIVfQexSGJuC");
- NSLog(@"3DK2sbrl5RkJ8WYUoV0uFycM");
- NSLog(@"NhQkaBfn9o6u7Sj1CFPKHVqY8G342");
- NSLog(@"SkzauNOxDTd");
- NSLog(@"WYf6uKclrMSH3pq5ZiREbtvJezCyGkLU0w749I");
- NSLog(@"Pxby2WArdih79QXzYV5p8tknfZU0");
- }
- -(void)al4hX:(UIEvent*) al4hX aA05iQzXUs:(UIInputView*) aA05iQzXUs a6CFk2mNUZ1:(UICollectionView*) a6CFk2mNUZ1 aEhnjR3ONP:(UIBezierPath*) aEhnjR3ONP aMPhCKaVsbf:(UIBarButtonItem*) aMPhCKaVsbf {
- NSLog(@"lw4f9BbrYSmOxQpZd0Ei6qDTz");
- NSLog(@"WBkMqNzgsA6XIdJ1Q8CifOE");
- NSLog(@"yeHh6zSguC");
- NSLog(@"IU7EaNryJbPmOo0VFWCnDz2B5x6TtQK");
- NSLog(@"pTxzb1vhkiE5jMLQrwP");
- NSLog(@"xZPYG9MNSncHFpa60jig3Alo");
- NSLog(@"bCF05aQ2DYWOlu4f");
- NSLog(@"DkJPURQOc3hr7yqa");
- NSLog(@"4yjGSwv7lQcJ6I");
- NSLog(@"LZjY4hfbOuarq5vxH3FTlRX2DVPeGBp78cU1");
- NSLog(@"YW4umrep2Hc6gKnLA8Q");
- NSLog(@"2XFk5NcMlrKz7L3IPVTEb1QJpw8gfvi");
- NSLog(@"GbhwtkdMq3j8nms0ug9aDTFixKSHl15A");
- }
- -(void)aUFrs3i:(UIView*) aUFrs3i adJjSZhOV:(UISwitch*) adJjSZhOV ahDw1:(UIBarButtonItem*) ahDw1 amZJeMKf:(UIUserInterfaceIdiom*) amZJeMKf aJRHNx:(UIView*) aJRHNx aKSfyU3Je:(UIActivity*) aKSfyU3Je aS3Rxq:(UIImageView*) aS3Rxq aEmFAbcS9R3:(UITableView*) aEmFAbcS9R3 aGJXtbpk:(UISwitch*) aGJXtbpk a6ImR4rLnqG:(UIMotionEffect*) a6ImR4rLnqG aGLz3UYCaT:(UIFont*) aGLz3UYCaT a6vAn0:(UIBezierPath*) a6vAn0 {
- NSLog(@"Cr2WwR6gyvXZEtcML");
- NSLog(@"z1QUXYl4rf");
- NSLog(@"N7MsQ3vRmUEPZG8i");
- NSLog(@"vhq2Fg7yZaU8Lurm1XRjVBPAsbKcWwY");
- NSLog(@"M6INE5iRl8m2sjS3zxCuQyaT");
- NSLog(@"7LjuwM8GkPBmUxR2b");
- NSLog(@"rXBxnpIy7icEgSMLV4lwKQ6HoD5F");
- NSLog(@"1GiruoHv4SsKdkyWQNOIqMgLzPcU");
- NSLog(@"cvbLf3IJqQk5VXpumKgWtiY1GBxHNA8hn");
- NSLog(@"7Kmdapzc86VDSGh20sC4qQuEfL1y5IBxHeZJ");
- NSLog(@"dbagvxQsIeO4A3MKpRHZyXou6BwfFVtzWjPc1i");
- NSLog(@"xuPa7iseBmSDkM0hpqUHVZztWrT");
- NSLog(@"qLwjXryBc28kvJHZYhsDp0Vlb14eITtQRK");
- NSLog(@"Fo6DqVwNuCxm7R1");
- NSLog(@"lRfyzoZPJcYS5nubgjqVBvEH");
- NSLog(@"L6HT42XmOJBKMuyS9AqbEd0");
- }
- @end
|