// // DRTodayViewController.m // YouHuiProject // // Created by 小花 on 2018/1/17. // Copyright © 2018年 kuxuan. All rights reserved. // #import "DRTodayViewController.h" #import "SDCycleScrollView.h" #import "DROnePicCell.h" #import "DRCountHeaderView.h" #import "DRMorePicCell.h" #import "DRTodayBannerModel.h" #import "DRChildGoodModel.h" #import "DRMorePicModel.h" #import "DRGoodsInfo.h" #import "DRAdversementCell.h" #import "DRGoodDetailViewController.h" #import "DRGoodListCidViewController.h" #import "DRAdWebViewController.h" #import "DRGoodListViewController.h" #import "DRNineNineMainViewController.h" #import "DRMorePicCollectionCell.h" #import "DRMorePicCollectionModel.h" #import "DRGoodCollectionCell.h" #import "DRShareGoodsModel.h" #import "DRShareGoodsViewController.h" #import "DRPrivilegeReferralViewController.h" #import "NSNumber+YHExpanded.h" #import "DRTodayModelCollectionCell.h" #import "DRRankListViewController.h" #import "DRTodayMudleModel.h" #import #import #import #import "DRGetMoneyViewController.h" #import "DRBuyLimitMainController.h" #import "DRTodayReatCollectionCell.h" static NSString *KYHMorePicCollectionCell = @"KYHMorePicCollectionCell"; static NSString *KYHMorePicCell = @"KYHMorePicCell"; static NSString *KYHGoodCollectionCell = @"KYHGoodCollectionCell"; static NSString *KModelCollecionCell = @"modelCollecionCell"; static NSString *KReactCollecionCell = @"ReactCollecionCell"; static NSString *KSectionOne = @"KSectionOne"; static NSString *KSectionTwo = @"KSectionTwo"; static NSString *KSectionThree = @"KSectionThree"; static CGFloat bannerHeight = 150; @interface DRTodayViewController () < UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, SDCycleScrollViewDelegate, YHMorePicCellDelegate, YHMorePicCollectionCellDelegate, LDTodayModelCollectionCellDelegate, YHCountDownViewDelegate > { NSInteger _page; } @property (nonatomic, strong) UICollectionView *collectionView; @property (nonatomic, strong) SDCycleScrollView *cycleScrollView; @property (nonatomic, strong) NSArray *bannerList; @property (nonatomic, strong) NSMutableArray *goodsArr; @property (nonatomic, strong) DRMorePicCell *morePicCell; @property (nonatomic, strong) DRMorePicCollectionCell *morePicCollectionCell; @property (nonatomic, strong) NSArray *morePicArr; @property (nonatomic, strong) NSArray *morePicCollectionArr; @property (nonatomic, strong) NSMutableArray *moduleDataArr; @property (nonatomic, strong) DRGoodsInfo *goodsInfo; //商品信息,包括刷新事件 /**组头*/ @property (nonatomic, strong) UICollectionReusableView *sectionOne; @property (nonatomic, strong) UICollectionReusableView *sectionThree; @end @implementation DRTodayViewController - (void)viewDidLoad { [super viewDidLoad]; [self configCollectionView]; [self request]; [self.collectionView reloadData]; } - (void)request { [self loadBannerData]; [self loadHotRecomPicCollectionData]; [self loadHotRecomPicData]; [self loadModelCellData]; [self loadCategoryGoodsList]; } - (void)configCollectionView { _page = 1; UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init]; self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ChildTableViewHeight+40) collectionViewLayout:flowLayout]; flowLayout.minimumLineSpacing = 5; flowLayout.minimumInteritemSpacing = 0; [self.collectionView registerClass:[DRMorePicCollectionCell class] forCellWithReuseIdentifier:KYHMorePicCollectionCell]; [self.collectionView registerClass:[DRMorePicCell class] forCellWithReuseIdentifier:KYHMorePicCell]; [self.collectionView registerClass:[DRGoodCollectionCell class] forCellWithReuseIdentifier:KYHGoodCollectionCell]; [self.collectionView registerClass:[DRTodayModelCollectionCell class] forCellWithReuseIdentifier:KModelCollecionCell]; [self.collectionView registerClass:[DRTodayReatCollectionCell class] forCellWithReuseIdentifier:KReactCollecionCell]; [self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KSectionOne]; [self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KSectionTwo]; [self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KSectionThree]; // self.collectionView.backgroundColor = [UIColor YHColorWithHex:0xf6f6f6]; self.collectionView.backgroundColor = [UIColor yhGrayColor]; self.collectionView.showsVerticalScrollIndicator = NO; self.collectionView.delegate = self; self.collectionView.dataSource = self; MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ [self refreshData]; }]; // header.lastUpdatedTimeLabel.hidden = YES; // header.stateLabel.hidden = YES; //正在刷新的图片 // NSArray *imgArr = @[[UIImage imageNamed:@"ant1"],[UIImage imageNamed:@"ant2"]]; // [header setImages:imgArr duration:0.3 forState:MJRefreshStateRefreshing]; // [header setImages:@[[UIImage imageNamed:@"ant1"]] duration:1 forState:MJRefreshStateWillRefresh]; // [header setImages:@[[UIImage imageNamed:@"ant1"]] duration:1 forState:MJRefreshStatePulling]; self.collectionView.mj_header = header; self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{ [self loadMoreData]; }]; [self.collectionView.mj_footer beginRefreshing]; if (@available(iOS 11.0, *)) { self.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;//UIScrollView也适用 }else { self.automaticallyAdjustsScrollViewInsets = NO; } [self.view addSubview:self.collectionView]; CGFloat height = (bannerHeight/375.f)*SCREEN_WIDTH; CGRect rect = CGRectMake(0, 0, SCREEN_WIDTH, height); self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:rect delegate:self placeholderImage:nil]; self.cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"page_sel"]; self.cycleScrollView.pageDotImage = [UIImage imageNamed:@"page_nor"]; self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleToFill; } - (void)loadBannerData { [DRCacheHttp get:Banner_list params:nil success:^(id json, BOOL isCache) { self.bannerList = [NSArray yy_modelArrayWithClass:[DRTodayBannerModel class] json:json[@"data"]]; [self creatCycleScrollView]; } failure:^(NSError *error) { }]; } - (void)creatCycleScrollView { NSMutableArray *imgArr = [NSMutableArray array]; for (DRTodayBannerModel *model in self.bannerList) { [imgArr addObject:model.photo]; } self.cycleScrollView.imageURLStringsGroup = imgArr; } /** 加载下部商品列表 */ - (void)loadCategoryGoodsList { NSDictionary *para = @{@"sort":@"1", @"page":@(_page), @"category_id":self.model.Id, @"stype":@"0"}; [DRCacheHttp post:StocklistByCategoryId params:para success:^(id json, BOOL isCache) { if ([self.collectionView.mj_header isRefreshing]) [self.goodsArr removeAllObjects]; //清空缓存数据,展示真正的数据(如果page是1,且不是缓存数据,说明是真正的数据) if (_page == 1 && !isCache) [self.goodsArr removeAllObjects]; self.goodsInfo = [DRGoodsInfo yy_modelWithJSON:json]; NSArray *list = [NSArray yy_modelArrayWithClass:[DRChildGoodModel class] json:json[@"data"]]; [self noMoreDataWithArray:list]; [self.goodsArr addObjectsFromArray:list]; [self.collectionView reloadData]; } failure:^(NSError *error) { [self endRefreshing]; [self.collectionView.mj_footer endRefreshing]; }]; } - (void)noMoreDataWithArray:(NSArray *)array { if (array.count <= 0) { [self.collectionView.mj_footer endRefreshingWithNoMoreData]; }else { [self.collectionView.mj_footer endRefreshing]; } } - (void)endRefreshing { [self.collectionView.mj_header endRefreshing]; } - (void)refreshData { _page = 1; [self loadBannerData]; [self loadModelCellData]; [self loadHotRecomPicData]; [self loadHotRecomPicCollectionData]; [self loadCategoryGoodsList]; } /** 上拉加载 */ - (void)loadMoreData { _page++; [self loadCategoryGoodsList]; } /** 多图推荐 */ - (void)loadHotRecomPicData { [DRCacheHttp get:Goldgroups params:nil success:^(id json, BOOL isCache) { self.morePicArr = [NSArray yy_modelArrayWithClass:[DRMorePicModel class] json:json[@"data"]]; if (self.morePicArr.count==0) { [self.collectionView reloadData]; } // [self.morePicCell setModelDatas:self.morePicArr]; [self.collectionView reloadData]; } failure:^(NSError *error) { }]; } /** 加载菜单栏目 */ - (void)loadHotRecomPicCollectionData { [DRCacheHttp get:GoldCollectiongroups params:nil success:^(id json, BOOL isCache) { self.morePicCollectionArr = [NSArray yy_modelArrayWithClass:[DRMorePicCollectionModel class] json:json[@"data"]]; [self.morePicCollectionCell setModelDatas:self.morePicCollectionArr]; [self.collectionView reloadData]; } failure:^(NSError *error) { }]; } /** 加载分类模块数据 */ - (void)loadModelCellData { NSString *url = [NSString stringWithFormat:@"%@/api/v2/channel/advFourList",BaseURL]; [DRCacheHttp post:url params:@{@"platform":@"2"} success:^(id json, BOOL isCache) { NSArray *list = [NSArray yy_modelArrayWithClass:[DRTodayMudleModel class] json:json[@"list"]]; if (list.count > 0) { [self countDownViewSetCount:list.firstObject]; } [self.moduleDataArr removeAllObjects]; [self.moduleDataArr addObjectsFromArray:list]; [self.collectionView reloadData]; [self endRefreshing]; } failure:^(NSError *error) { [self endRefreshing]; }]; } - (void)countDownViewSetCount:(DRTodayMudleModel *)model { NSString *endTime = [NSString stringWithFormat:@"%@000",model.remainTime]; [[DRCountDownView shareInstace] setEndTimer:endTime]; } #pragma mark ------ YHCountDownViewDelegate ------- - (void)countViewTimeOutAction { [self.collectionView.mj_header beginRefreshing]; [self refreshData]; } #pragma mark ====================== YHMorePicCellDelegate========== /** 点击推荐位多图 */ - (void)YHMorePicCellDidSelectedItem:(NSInteger)index { DRMorePicModel *model = self.morePicArr[index]; if (model.url.length > 0) { //活动页 //type为2直接打开淘宝,无需访问中间网页 if ([model.jump_type isEqualToString:@"2"]) { [self jumpToTaobaoWithUrl:model.url]; }else{ DRAdWebViewController *adWeb = [[DRAdWebViewController alloc] init]; adWeb.url = model.url; [self.navigationController pushViewController:adWeb animated:YES]; } }else { //列表页 DRGoodListViewController *list = [[DRGoodListViewController alloc] init]; list.cate_id = model.Id; list.name = model.name; list.topRequest = 2; [self.navigationController pushViewController:list animated:YES]; } [MobClick event:home_recommend label:model.name]; } #pragma mark ====================== YHMorePicCollectionCellDelegate========== - (void)YHMorePicCollectionCellDidSelectedItem:(NSInteger)index{ DRMorePicCollectionModel *model = self.morePicCollectionArr[index]; if (model.url.length > 0) { //活动页 //type为2直接打开淘宝,无需访问中间网页 if ([model.jump_type isEqualToString:@"2"]) { [self jumpToTaobaoWithUrl:model.url]; }else{ DRAdWebViewController *adWeb = [[DRAdWebViewController alloc] init]; adWeb.url = model.url; [self.navigationController pushViewController:adWeb animated:YES]; } }else { DRGoodListViewController *list = [[DRGoodListViewController alloc] init]; list.cate_id = model.Id; list.name = model.name; list.topRequest = 2; [self.navigationController pushViewController:list animated:YES]; } [MobClick event:Home_Items label:model.name]; } #pragma mark ============ SDCycleScrollViewDelegate ========== - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { DRTodayBannerModel *model = self.bannerList[index]; if (model.url.length > 0) { //活动页 //type为2直接打开淘宝,无需访问中间网页 if ([model.type isEqualToString:@"2"]) { [self jumpToTaobaoWithUrl:model.url]; }else{ DRAdWebViewController *adWeb = [[DRAdWebViewController alloc] init]; adWeb.url = model.url; [self.navigationController pushViewController:adWeb animated:YES]; } }else { //列表页 DRGoodListViewController *list = [[DRGoodListViewController alloc] init]; list.cate_id = model.group_id; list.name = model.note; list.topRequest = 2; [self.navigationController pushViewController:list animated:YES]; } [MobClick event:home_banner label:model.photo]; } #pragma mark ------- LDTodayModelCollectionCellDelegate ----- - (void)modelCollectionCellMoreButtonClick:(DRTodayModelCollectionCell *)cell{ DRTodayMudleModel *model = cell.model; if ([model.type isEqualToString:@"1"]) { DRBuyLimitMainController *buyLimit = [[DRBuyLimitMainController alloc] init]; [self.navigationController pushViewController:buyLimit animated:YES]; }else if ([model.type isEqualToString:@"2"]){ DRRankListViewController *rankList = [[DRRankListViewController alloc] init]; rankList.name = model.name; [self.navigationController pushViewController:rankList animated:YES]; }else { //列表页 DRGoodListViewController *list = [[DRGoodListViewController alloc] init]; list.cate_id = model.Id; list.name = model.name; list.topRequest = 2; [self.navigationController pushViewController:list animated:YES]; } [MobClick event:TodayClickTop label:model.name]; } #pragma mark ============ UICollectionView Delegate && DataSource ========== - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { if (section == 0 ) { return 1; }else if (section == 1){ return self.morePicArr.count; }else if (section == 2){ return self.moduleDataArr.count; }else if(section == 3){ return self.goodsArr.count; } return 0; } - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 4; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { if (self.morePicCollectionArr==nil||self.morePicCollectionArr.count==0) { return CGSizeMake(SCREEN_WIDTH, .1); } NSInteger offHeight=0; if (iPhone5) { offHeight=10; } NSInteger Crow=1; NSInteger Coff=-1; NSInteger CrowItemSum=5; Coff=self.morePicCollectionArr.count%CrowItemSum; if (Coff!=0) { CrowItemSum=4; Coff=self.morePicCollectionArr.count%CrowItemSum; if (Coff!=0) { CrowItemSum=3; Coff=self.morePicCollectionArr.count%CrowItemSum; if (Coff!=0) { CrowItemSum=5; Crow++; } } } Crow=self.morePicCollectionArr.count/CrowItemSum; if (Coff!=0) { Crow++; } CGFloat totalHeight = (SCREEN_WIDTH/4+offHeight)*Crow; return CGSizeMake(SCREEN_WIDTH, totalHeight); } if (indexPath.section == 1) { if (!self.morePicArr.count||self.morePicArr.count==0) { return CGSizeMake(SCREEN_WIDTH, .1); } // CGFloat leftWidth = SCREEN_WIDTH*0.37; // CGFloat leftHeight = leftWidth*19/14; // return CGSizeMake(SCREEN_WIDTH, leftHeight); CGFloat width = (SCREEN_WIDTH-13)/2; CGSize size = CGSizeMake(width, width*83/170); return size; }else if (indexPath.section == 2){ return CGSizeMake(SCREEN_WIDTH, Fitsize(218)); } else if (indexPath.section == 3) { CGFloat width = (SCREEN_WIDTH-5)/2; CGFloat height = width + 102; return CGSizeMake(width, height); } return CGSizeZero; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { if (section == 0) { CGFloat height = (bannerHeight/375.f)*SCREEN_WIDTH; return CGSizeMake(SCREEN_WIDTH, height); }else if (section == 1 || section == 2){ return CGSizeMake(SCREEN_WIDTH, 5); }else { return CGSizeMake(SCREEN_WIDTH, FITSIZE(40)); } } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { return CGSizeMake(0, 0); } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section==0) { self.morePicCollectionCell = [collectionView dequeueReusableCellWithReuseIdentifier:KYHMorePicCollectionCell forIndexPath:indexPath]; self.morePicCollectionCell.delegate = self; [self.morePicCollectionCell setModelDatas:self.morePicCollectionArr]; return self.morePicCollectionCell; } if (indexPath.section == 1) { // self.morePicCell = [collectionView dequeueReusableCellWithReuseIdentifier:KYHMorePicCell forIndexPath:indexPath]; // self.morePicCell.delegate = self; // [self.morePicCell setModelDatas:self.morePicArr]; // return self.morePicCell; DRTodayReatCollectionCell *reactCell = [self.collectionView dequeueReusableCellWithReuseIdentifier:KReactCollecionCell forIndexPath:indexPath]; DRMorePicModel *model = self.morePicArr[indexPath.row]; reactCell.model = model; return reactCell; }else if (indexPath.section == 2){ DRTodayModelCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:KModelCollecionCell forIndexPath:indexPath]; cell.delegate = self; cell.indexPath = indexPath; DRTodayMudleModel *model = self.moduleDataArr[indexPath.row]; cell.model = model; if (indexPath.row == 0) { DRCountDownView *countdown = [DRCountDownView shareInstace]; countdown.y = Fitsize(15); countdown.x = Fitsize(132); countdown.delegate = self; [cell addSubview:countdown]; cell.desLabel.hidden = YES; }else { cell.desLabel.hidden = NO; } return cell; } else if(indexPath.section == 3){ DRChildGoodModel *model = self.goodsArr[indexPath.item]; DRGoodCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:KYHGoodCollectionCell forIndexPath:indexPath]; cell.model = model; return cell; } return nil; } - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 0) { if (self.sectionOne) return self.sectionOne; self.sectionOne = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KSectionOne forIndexPath:indexPath]; [self.sectionOne addSubview:self.cycleScrollView]; return self.sectionOne; } if (indexPath.section == 1 || indexPath.section == 2) { UICollectionReusableView *sectionTwo = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KSectionTwo forIndexPath:indexPath]; return sectionTwo; } if (indexPath.section == 3) { self.sectionThree = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KSectionThree forIndexPath:indexPath]; UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, Fitsize(40))]; title.text = @"精选好物"; title.textColor = [UIColor gradientWidthFromColor:[UIColor YHColorWithHex:0x47FFDA] toColor:[UIColor YHColorWithHex:0x38D4FB] withWidth:SCREEN_WIDTH]; title.font = [UIFont systemFontOfSize:Fitsize(19)]; [title sizeToFit]; title.centerX = SCREEN_WIDTH/2+Fitsize(10); title.centerY = Fitsize(20); [self.sectionThree addSubview:title]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(title.x-Fitsize(25), 0, Fitsize(23), FITSIZE(21))]; imageView.centerY = Fitsize(20); imageView.image = [UIImage imageNamed:@"good_gs"]; [self.sectionThree addSubview:imageView]; return self.sectionThree; } return nil; } - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { if (section == 1) { return UIEdgeInsetsMake(0, 5, 0, 5); }else { return UIEdgeInsetsMake(0, 0, 0, 0); } } - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { if (section == 1) { return 3; }else { return 5; } } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 1) { DRMorePicModel *model = self.morePicArr[indexPath.row]; if (model.url.length > 0) { //活动页 //type为2直接打开淘宝,无需访问中间网页 if ([model.jump_type isEqualToString:@"2"]) { [self jumpToTaobaoWithUrl:model.url]; }else{ DRAdWebViewController *adWeb = [[DRAdWebViewController alloc] init]; adWeb.url = model.url; [self.navigationController pushViewController:adWeb animated:YES]; } }else { //列表页 DRGoodListViewController *list = [[DRGoodListViewController alloc] init]; list.cate_id = model.Id; list.name = model.name; list.topRequest = 2; [self.navigationController pushViewController:list animated:YES]; } [MobClick event:home_recommend label:model.name]; } if (indexPath.section == 3) { DRChildGoodModel *model = self.goodsArr[indexPath.row]; DREventModel *evevtModel = [[DREventModel alloc] initWithOrigin:model.origin category_id:self.model.Id source:homeAction]; DRGoodDetailViewController *detail = [[DRGoodDetailViewController alloc] init]; detail.eventModel = evevtModel; DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithChildModel:model]; detail.requestModel = requestModel; [self.navigationController pushViewController:detail animated:YES]; [MobClick event:home_hot]; } } #pragma mark ------ #pragma mark - scrollView - (void)scrollViewDidScroll:(UIScrollView *)scrollView { //scrollView已经有拖拽手势,直接拿到scrollView的拖拽手势 UIPanGestureRecognizer *pan = scrollView.panGestureRecognizer; //获取到拖拽的速度 >0 向下拖动 <0 向上拖动 CGFloat velocity = [pan velocityInView:scrollView].y; if (velocity <- 10) { //向上拖动,隐藏导航栏 self.collectionView.height = ChildTableViewHeight+NavBarHeight-KStatusBarHeight; }else if (velocity > 10) { //向下拖动,显示导航栏 self.collectionView.height = ChildTableViewHeight; }else if(velocity == 0){ //停止拖拽 } NSNotification *noti = [[NSNotification alloc] initWithName:ScrollDirectorNoti object:nil userInfo:@{@"director":@(velocity)}]; [[NSNotificationCenter defaultCenter] postNotification:noti]; } #pragma mark ------ - (void)jumpToTaobaoWithUrl:(NSString *)url { id page = [AlibcTradePageFactory page:url]; //淘客信息 AlibcTradeTaokeParams *taoKeParams=[[AlibcTradeTaokeParams alloc] init]; taoKeParams.pid= ALTK_PID; //打开方式 AlibcTradeShowParams* showParam = [[AlibcTradeShowParams alloc] init]; showParam.openType = AlibcOpenTypeAuto; [[AlibcTradeSDK sharedInstance].tradeService show:self.parentViewController page:page showParams:showParam taoKeParams:taoKeParams trackParam:nil tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable result) { } tradeProcessFailedCallback:^(NSError * _Nullable error) { }]; } #pragma mark ===================== layezer ============== - (NSArray *)goodsArr { if (!_goodsArr) { _goodsArr = [NSMutableArray array]; } return _goodsArr; } - (NSMutableArray *)moduleDataArr { if (!_moduleDataArr) { _moduleDataArr = [NSMutableArray array]; } return _moduleDataArr; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end