Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a53b626

Browse filesBrowse files
committed
修复订单展示bug
1 parent c2eed97 commit a53b626
Copy full SHA for a53b626

File tree

Expand file treeCollapse file tree

5 files changed

+51
-36
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+51
-36
lines changed
Open diff view settings
Collapse file

‎Coding_iOS/Controllers/Shop/ShopOrderViewController.m‎

Copy file name to clipboardExpand all lines: Coding_iOS/Controllers/Shop/ShopOrderViewController.m
+16-15Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ - (void)viewDidLoad
3636
_myOrder = [[ShopOrderModel alloc] init];
3737
_myOrder.orderType = ShopOrderAll;
3838

39-
[self loadData];
40-
4139
[self setUpView];
42-
40+
[self loadData];
4341
}
4442

4543
- (void)loadData
@@ -49,6 +47,7 @@ - (void)loadData
4947
[[Coding_NetAPIManager sharedManager] request_shop_OrderListWithOrder:_myOrder andBlock:^(id data, NSError *error) {
5048
[weakSelf.view endLoading];
5149
if (data) {
50+
weakSelf.myOrder.orderType = ShopOrderAll;
5251
ShopOrderListView *listView = (ShopOrderListView *)[weakSelf.myCarousel itemViewAtIndex:weakSelf.myOrder.orderType];
5352
[listView reloadData];
5453
}
@@ -78,11 +77,7 @@ - (void)setUpView
7877
});
7978
__weak typeof(self) weakSelf = self;
8079
self.mySegmentControl = [[XTSegmentControl alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kMySegmentControl_Height) Items:self.titlesArray selectedBlock:^(NSInteger index) {
81-
82-
ShopOrderListView *listView = (ShopOrderListView *)[weakSelf.myCarousel itemViewAtIndex:index];
83-
weakSelf.myOrder.orderType = index;
84-
listView.myOrder = weakSelf.myOrder;
85-
[listView reloadData];
80+
[weakSelf.myCarousel scrollToItemAtIndex:index animated:NO];
8681
}];
8782
[self.view addSubview:self.mySegmentControl];
8883
}
@@ -108,7 +103,6 @@ - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
108103
}else{
109104
listView = [[ShopOrderListView alloc] initWithFrame:carousel.bounds withOder:_myOrder];
110105
}
111-
112106
[listView reloadData];
113107
[listView setSubScrollsToTop:(index == carousel.currentItemIndex)];
114108
return listView;
@@ -124,12 +118,19 @@ - (void)carouselDidScroll:(iCarousel *)carousel{
124118
}
125119

126120
- (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel{
127-
if (_mySegmentControl) {
128-
_mySegmentControl.currentIndex = carousel.currentItemIndex;
129-
}
130-
[carousel.visibleItemViews enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) {
131-
[obj setSubScrollsToTop:(obj == carousel.currentItemView)];
132-
}];
121+
122+
123+
ShopOrderListView *listView = (ShopOrderListView *)carousel.currentItemView;
124+
_myOrder.orderType = carousel.currentItemIndex;
125+
listView.myOrder = _myOrder;
126+
[listView reloadData];
127+
128+
// if (_mySegmentControl) {
129+
// _mySegmentControl.currentIndex = carousel.currentItemIndex;
130+
// }
131+
// [carousel.visibleItemViews enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) {
132+
// [obj setSubScrollsToTop:(obj == carousel.currentItemView)];
133+
// }];
133134
}
134135

135136
- (void)dealloc
Collapse file

‎Coding_iOS/Controllers/Shop/ShopViewController.m‎

Copy file name to clipboardExpand all lines: Coding_iOS/Controllers/Shop/ShopViewController.m
+6-12Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ - (void)setUpSegmentControl
173173
NSArray *_segmentItems = @[@"全部商品",@"可兑换商品"];
174174
__weak typeof(self) weakSelf = self;
175175
_shopSegmentControl = [[XTSegmentControl alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(_collectionHeaderView.frame)- kMySegmentControl_Height - 5, kScreen_Width, kMySegmentControl_Height) Items:_segmentItems selectedBlock:^(NSInteger index) {
176+
176177
[weakSelf segmentControlSelecteIndex:index];
177178
}];
178179
_shopSegmentControl.backgroundColor = [UIColor whiteColor];
@@ -188,9 +189,6 @@ - (void)segmentControlSelecteIndex:(NSInteger)index
188189
_oldSelectedIndex = index;
189190
_shopObject.shopType = index;
190191
[_collectionView reloadData];
191-
if (_collectionView.contentOffset.y > CGRectGetHeight(_collectionHeaderView.frame) ) {
192-
[_collectionView setContentOffset:CGPointMake(0, CGRectGetHeight(_collectionHeaderView.frame)) animated:NO];
193-
}
194192
}
195193

196194

@@ -220,11 +218,6 @@ - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UIColl
220218
_shopBannerView = [[ShopBannerView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, bannerHeight)];
221219
_shopBannerView.curBannerList = shopBannerArray;
222220
[_collectionHeaderView addSubview:_shopBannerView];
223-
__weak typeof(self) weakSelf = self;
224-
// _shopBannerView.tapActionBlock = ^(ShopBanner *banner){
225-
// [NSObject showHudTipStr:banner.title];
226-
// [weakSelf bannerClicked:banner.title];
227-
// };
228221
[_shopBannerView reloadData];
229222
_shopSegmentControl.frame = CGRectMake(0, bannerHeight, kScreen_Width, kMySegmentControl_Height);
230223
height = kMySegmentControl_Height + bannerHeight ;
@@ -255,16 +248,17 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
255248
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
256249
{
257250
CGFloat offsetY = scrollView.contentOffset.y + scrollView.contentInset.top;
251+
CGFloat bannerHeight = kScreen_Width * (270.0/640);
258252

259-
CGFloat _shopSegmentControlY = CGRectGetHeight(_collectionHeaderView.frame) - kMySegmentControl_Height - 5;
260-
261-
if (offsetY > CGRectGetHeight(_collectionHeaderView.frame)) {
253+
NSLog(@"%f%f",offsetY,CGRectGetHeight(_collectionHeaderView.frame));
254+
255+
if (offsetY >= CGRectGetHeight(_collectionHeaderView.frame) -kMySegmentControl_Height ) {
262256

263257
_shopSegmentControl.frame = CGRectMake(0, 0, kScreen_Width, kMySegmentControl_Height);
264258
[self.view addSubview:_shopSegmentControl];
265259
}else
266260
{
267-
_shopSegmentControl.frame = CGRectMake(0, _shopSegmentControlY +5 , kScreen_Width, kMySegmentControl_Height);
261+
_shopSegmentControl.frame = CGRectMake(0,bannerHeight, kScreen_Width, kMySegmentControl_Height);
268262
[_collectionHeaderView addSubview:_shopSegmentControl];
269263
}
270264
}
Collapse file

‎Coding_iOS/Util/OC_Category/UIView+Common.h‎

Copy file name to clipboardExpand all lines: Coding_iOS/Util/OC_Category/UIView+Common.h
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ typedef NS_ENUM(NSInteger, EaseBlankPageType)
3333
EaseBlankPageTypeFileTypeCannotSupport,
3434
EaseBlankPageTypeViewTips,
3535
EaseBlankPageTypeShopOrders,
36+
EaseBlankPageTypeShopSendOrders,
37+
EaseBlankPageTypeShopUnSendOrders,
38+
3639
};
3740

3841
typedef NS_ENUM(NSInteger, BadgePositionType) {
Collapse file

‎Coding_iOS/Util/OC_Category/UIView+Common.m‎

Copy file name to clipboardExpand all lines: Coding_iOS/Util/OC_Category/UIView+Common.m
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,17 @@ - (void)configWithType:(EaseBlankPageType)blankPageType hasData:(BOOL)hasData ha
638638
break;
639639
case EaseBlankPageTypeShopOrders:{
640640
imageName = @"blankpage_image_Sleep";
641-
tipStr = @"您还木有订单呢\n努力推代码,把猴带回家~";
641+
tipStr = @"您还木有订单呢\n努力推代码,把洋葱猴带回家~";
642+
}
643+
break;
644+
case EaseBlankPageTypeShopSendOrders:{
645+
imageName = @"blankpage_image_Sleep";
646+
tipStr = @"您还木有已发货的订单呢~";
647+
}
648+
break;
649+
case EaseBlankPageTypeShopUnSendOrders:{
650+
imageName = @"blankpage_image_Sleep";
651+
tipStr = @"您还木有未发货的订单呢~";
642652
}
643653
break;
644654
default://其它页面(这里没有提到的页面,都属于其它)
Collapse file

‎Coding_iOS/Views/TableListView/ShopOrderListView.m‎

Copy file name to clipboardExpand all lines: Coding_iOS/Views/TableListView/ShopOrderListView.m
+15-8Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
@interface ShopOrderListView ()<UITableViewDataSource,UITableViewDelegate>
1616
{
17-
NSMutableArray *_dataSource;
17+
NSArray *_dataSource;
1818
}
1919
@property (nonatomic, strong) UITableView *myTableView;
2020
@property (nonatomic, strong) ShopOderCell *currentOrderCell;
@@ -47,7 +47,7 @@ - (instancetype)initWithFrame:(CGRect)frame withOder:(ShopOrderModel *)order
4747
});
4848

4949
_currentOrderCell = [[ShopOderCell alloc] initWithFrame:CGRectZero];
50-
50+
5151
_myRefreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView];
5252
[_myRefreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
5353
}
@@ -56,11 +56,8 @@ - (instancetype)initWithFrame:(CGRect)frame withOder:(ShopOrderModel *)order
5656

5757
- (void)reloadData
5858
{
59-
[_dataSource removeAllObjects];
60-
[_myTableView reloadData];
59+
_dataSource = [_myOrder getDataSourceByOrderType];
6160

62-
_dataSource = [NSMutableArray arrayWithArray:[_myOrder getDataSourceByOrderType]];
63-
6461
if (_dataSource.count > 0) {
6562

6663
[_myTableView.tableFooterView removeFromSuperview];
@@ -84,8 +81,18 @@ - (void)reloadData
8481
}else
8582
_myTableView.tableFooterView = nil;
8683

87-
//
88-
[self configBlankPage:EaseBlankPageTypeShopOrders hasData:(_dataSource.count > 0) hasError:NO reloadButtonBlock:^(id sender) {
84+
85+
EaseBlankPageType _orderEmptyType;
86+
if (_myOrder.orderType == ShopOrderSend) {
87+
88+
_orderEmptyType = EaseBlankPageTypeShopSendOrders;
89+
}else if (_myOrder.orderType == ShopOrderUnSend)
90+
{
91+
_orderEmptyType = EaseBlankPageTypeShopUnSendOrders;
92+
}else
93+
_orderEmptyType = EaseBlankPageTypeShopOrders;
94+
95+
[self configBlankPage:_orderEmptyType hasData:(_dataSource.count > 0) hasError:NO reloadButtonBlock:^(id sender) {
8996
}];
9097

9198
[self.myTableView reloadData];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.