Skip to content

Commit 27a94b8

Browse files
committed
商城界面初始化
1 parent cde85f1 commit 27a94b8

36 files changed

Lines changed: 1401 additions & 12 deletions

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 126 additions & 4 deletions
Large diffs are not rendered by default.

Coding_iOS/.DS_Store

2 KB
Binary file not shown.

Coding_iOS/Controllers/PointRecordsViewController.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#import "PointRecordsViewController.h"
1010
#import "WebViewController.h"
11+
#import "ShopViewController.h"
1112
#import "Coding_NetAPIManager.h"
1213

1314
#import "SVPullToRefresh.h"
@@ -153,8 +154,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
153154
[tableView deselectRowAtIndexPath:indexPath animated:YES];
154155
if (indexPath.section == 0 && indexPath.row == 1) {
155156
//商城入口
156-
WebViewController *vc = [WebViewController webVCWithUrlStr:@"/shop/"];
157-
[self.navigationController pushViewController:vc animated:YES];
157+
// WebViewController *vc = [WebViewController webVCWithUrlStr:@"/shop/"];
158+
// [self.navigationController pushViewController:vc animated:YES];
159+
160+
ShopViewController *shopvc = [[ShopViewController alloc] init];
161+
[self.navigationController pushViewController:shopvc animated:YES];
162+
158163
}
159164
}
160165

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// ExchangeGoodsViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by liaoyp on 15/11/20.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
11+
@interface ExchangeGoodsViewController : BaseViewController
12+
13+
@end
Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
2+
// Created by liaoyp on 15/11/20.
3+
// Copyright © 2015年 Coding. All rights reserved.
4+
//
5+
6+
#import "ExchangeGoodsViewController.h"
7+
8+
#import "ResetLabelViewController.h"
9+
#import "TPKeyboardAvoidingTableView.h"
10+
#import "Coding_NetAPIManager.h"
11+
#import "ProjectTag.h"
12+
#import "MBProgressHUD+Add.h"
13+
#import "ShopOrderTextFieldCell.h"
14+
15+
#define kCellIdentifier_ShopOrderTextFieldCell @"ShopOrderTextFieldCell.h"
16+
17+
@interface ExchangeGoodsViewController () <UITableViewDataSource, UITableViewDelegate, UITextFieldDelegate>
18+
19+
{
20+
}
21+
22+
@property (strong, nonatomic) NSString *tagNameToAdd;
23+
@property (strong, nonatomic) NSMutableArray *tagList, *selectedTags;
24+
@property (strong, nonatomic) TPKeyboardAvoidingTableView *myTableView;
25+
@property (strong, nonatomic) UIButton *shopOrderBtn;
26+
27+
@end
28+
29+
@implementation ExchangeGoodsViewController
30+
31+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
32+
{
33+
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
34+
if (self) {
35+
// Custom initialization
36+
}
37+
return self;
38+
}
39+
40+
41+
- (void)orderCommitAction:(UIButton *)button
42+
{
43+
44+
}
45+
46+
#pragma mark-
47+
#pragma mark---------------------- ControllerLife ---------------------------
48+
49+
- (void)viewDidLoad {
50+
[super viewDidLoad];
51+
// Do any additional setup after loading the view.
52+
self.title = @"提交订单";
53+
54+
self.view.backgroundColor = kColorTableSectionBg;
55+
_myTableView = ({
56+
TPKeyboardAvoidingTableView *tableView = [[TPKeyboardAvoidingTableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
57+
tableView.backgroundColor = kColorTableSectionBg;
58+
tableView.delegate = self;
59+
tableView.dataSource = self;
60+
[tableView registerClass:[ShopOrderTextFieldCell class] forCellReuseIdentifier:kCellIdentifier_ShopOrderTextFieldCell];
61+
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
62+
tableView.separatorColor = [UIColor colorWithHexString:@"0xFFDDDDDD"];
63+
tableView.separatorInset = UIEdgeInsetsMake(0, 12, 0, 12);
64+
[self.view addSubview:tableView];
65+
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
66+
make.edges.equalTo(self.view);
67+
}];
68+
tableView;
69+
});
70+
71+
UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(_myTableView.frame), 303/2.0)];
72+
headView.backgroundColor = [UIColor whiteColor];
73+
_myTableView.tableHeaderView = headView;
74+
75+
UIView *footView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(_myTableView.frame), 136/2)];
76+
_shopOrderBtn = ({
77+
UIButton *orderBtn = [UIButton buttonWithType:UIButtonTypeCustom];
78+
[orderBtn setBackgroundImage:[UIImage imageWithColor:[UIColor colorWithHexString:@"0xFF3BBD79"]] forState:UIControlStateNormal];
79+
[orderBtn addTarget:self action:@selector(orderCommitAction:) forControlEvents:UIControlEventTouchUpInside];
80+
[orderBtn setTitle:@"提交订单" forState:UIControlStateNormal];
81+
[orderBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
82+
orderBtn.layer.masksToBounds = YES;
83+
orderBtn.layer.cornerRadius = 44/2;
84+
[footView addSubview:orderBtn];
85+
[orderBtn mas_makeConstraints:^(MASConstraintMaker *make) {
86+
make.width.equalTo(@288);
87+
make.height.equalTo(@44);
88+
make.centerX.centerY.equalTo(footView);
89+
}];
90+
orderBtn;
91+
});
92+
_shopOrderBtn.enabled = NO;
93+
_myTableView.tableFooterView = footView;
94+
}
95+
96+
- (void)viewWillAppear:(BOOL)animated
97+
{
98+
[super viewWillAppear:animated];
99+
[self sendRequest];
100+
}
101+
102+
- (void)sendRequest
103+
{
104+
// [self.view beginLoading];
105+
// __weak typeof(self) weakSelf = self;
106+
// [[Coding_NetAPIManager sharedManager] request_TagListInProject:_curProject type:ProjectTagTypeTopic andBlock:^(id data, NSError *error) {
107+
// [weakSelf.view endLoading];
108+
// if (data) {
109+
// weakSelf.tagList = data;
110+
// [weakSelf.myTableView reloadData];
111+
// }
112+
// }];
113+
}
114+
115+
#pragma mark - click
116+
//- (void)okBtnClick
117+
//{
118+
// if (self.tagsChangedBlock) {
119+
// self.tagsChangedBlock(self, _selectedTags);
120+
// }
121+
//}
122+
//
123+
//- (void)addBtnClick:(UIButton *)sender
124+
//{
125+
// [self.view endEditing:YES];
126+
// if (_tagNameToAdd.length > 0) {
127+
// __weak typeof(self) weakSelf = self;
128+
// ProjectTag *curTag = [ProjectTag tagWithName:_tagNameToAdd];
129+
// [[Coding_NetAPIManager sharedManager] request_AddTag:curTag toProject:_curProject andBlock:^(id data, NSError *error) {
130+
// if (data) {
131+
// curTag.id = data;
132+
// [weakSelf.tagList addObject:curTag];
133+
// weakSelf.tagNameToAdd = @"";
134+
// [weakSelf.myTableView reloadData];
135+
// sender.enabled = FALSE;
136+
//
137+
// [NSObject showHudTipStr:@"添加标签成功^^"];
138+
// }
139+
// }];
140+
// }
141+
//}
142+
//
143+
#pragma mark - UITableViewDataSource
144+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
145+
{
146+
return 1;
147+
}
148+
149+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
150+
{
151+
NSInteger row = 4;
152+
return row;
153+
}
154+
155+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
156+
{
157+
158+
ShopOrderTextFieldCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_ShopOrderTextFieldCell forIndexPath:indexPath];
159+
160+
switch (indexPath.row) {
161+
case 0:
162+
{
163+
cell.nameLabel.text = @"收货人 *";
164+
cell.textField.placeholder = @"小王";
165+
break;
166+
}
167+
case 1:
168+
{
169+
cell.nameLabel.text = @"详细地址 *";
170+
cell.textField.placeholder = @"省,市,县(镇),街道";
171+
break;
172+
}
173+
case 2:
174+
{
175+
cell.nameLabel.text = @"联系电话 *";
176+
cell.textField.placeholder = @"电话";
177+
break;
178+
}
179+
case 3:
180+
{
181+
cell.nameLabel.text = @"备注";
182+
cell.textField.placeholder = @"备注信息如:衣服码数XXL";
183+
break;
184+
}
185+
default:
186+
break;
187+
}
188+
return cell;
189+
}
190+
191+
#pragma mark - UITableViewDelegate
192+
193+
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
194+
{
195+
return @"填写并核对订单信息";
196+
}
197+
198+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
199+
{
200+
return [ShopOrderTextFieldCell cellHeight];
201+
}
202+
203+
- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath
204+
{
205+
if (indexPath.section > 0) {
206+
return YES;
207+
}
208+
return NO;
209+
}
210+
211+
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
212+
{
213+
return 52;
214+
}
215+
216+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
217+
{
218+
[self.view endEditing:YES];
219+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
220+
221+
// if (indexPath.section > 0) {
222+
// EditLabelCell *cell = (EditLabelCell *)[tableView cellForRowAtIndexPath:indexPath];
223+
// cell.selectBtn.selected = !cell.selectBtn.selected;
224+
//
225+
// ProjectTag *tagInSelected = [ProjectTag tags:_selectedTags hasTag:_tagList[indexPath.row]];
226+
// if (cell.selectBtn.selected && !tagInSelected) {
227+
// [_selectedTags addObject:_tagList[indexPath.row]];
228+
// }else if (!cell.selectBtn.selected && tagInSelected){
229+
// [_selectedTags removeObject:tagInSelected];
230+
// }
231+
// self.navigationItem.rightBarButtonItem.enabled = ![ProjectTag tags:_selectedTags isEqualTo:_orignalTags];
232+
// }
233+
}
234+
235+
#pragma mark - UITextFieldDelegate
236+
237+
- (void)textFieldDidChange:(UITextField *)textField
238+
{
239+
_tagNameToAdd = [textField.text trimWhitespace];
240+
BOOL enabled = _tagNameToAdd.length > 0 ? TRUE : FALSE;
241+
if (enabled) {
242+
for (ProjectTag *lbl in _tagList) {
243+
if ([lbl.name isEqualToString:_tagNameToAdd]) {
244+
enabled = FALSE;
245+
break;
246+
}
247+
}
248+
}
249+
250+
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
251+
ShopOrderTextFieldCell *cell = (ShopOrderTextFieldCell *)[_myTableView cellForRowAtIndexPath:indexPath];
252+
}
253+
254+
- (BOOL)textFieldShouldReturn:(UITextField *)textField
255+
{
256+
[textField resignFirstResponder];
257+
return YES;
258+
}
259+
260+
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
261+
{
262+
[super touchesBegan:touches withEvent:event];
263+
[self.view endEditing:YES];
264+
}
265+
266+
@end
267+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// ShopViewController.h
3+
// Coding_iOS 商城界面
4+
//
5+
// Created by liaoyp on 15/11/20.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
11+
@interface ShopViewController : BaseViewController
12+
13+
@end
14+

0 commit comments

Comments
 (0)