Skip to content

Commit e6c9c35

Browse files
committed
商城 - app 端要增加对商品型号的支持
1 parent d8c43ec commit e6c9c35

File tree

8 files changed

+86
-45
lines changed

8 files changed

+86
-45
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@
527527
4ED558321B4FA68400FC10CB /* dismissBtn_Nav@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4ED558311B4FA68400FC10CB /* dismissBtn_Nav@2x.png */; };
528528
4ED618151C3A6B4B0017946C /* LocationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ED618141C3A6B4B0017946C /* LocationViewController.m */; };
529529
4ED618181C3A6CA50017946C /* LocationCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ED618171C3A6CA50017946C /* LocationCell.m */; };
530-
4ED6181B1C3A72AE0017946C /* ShopAddressCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ED6181A1C3A72AE0017946C /* ShopAddressCell.m */; };
531-
4ED6181D1C3A72CF0017946C /* ShopAddressCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4ED6181C1C3A72CF0017946C /* ShopAddressCell.xib */; };
530+
4ED6181B1C3A72AE0017946C /* ShopMutileValueCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ED6181A1C3A72AE0017946C /* ShopMutileValueCell.m */; };
531+
4ED6181D1C3A72CF0017946C /* ShopMutileValueCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4ED6181C1C3A72CF0017946C /* ShopMutileValueCell.xib */; };
532532
4ED6181F1C3A732F0017946C /* button_arrow_left@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4ED6181E1C3A732F0017946C /* button_arrow_left@2x.png */; };
533533
4ED618211C3BD79B0017946C /* task_activity_icon_remove_watcher@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4ED618201C3BD79B0017946C /* task_activity_icon_remove_watcher@2x.png */; };
534534
4ED618241C3CB1AF0017946C /* taskWatchers@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4ED618221C3CB1AF0017946C /* taskWatchers@2x.png */; };
@@ -1857,9 +1857,9 @@
18571857
4ED618141C3A6B4B0017946C /* LocationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocationViewController.m; sourceTree = "<group>"; };
18581858
4ED618161C3A6CA50017946C /* LocationCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocationCell.h; sourceTree = "<group>"; };
18591859
4ED618171C3A6CA50017946C /* LocationCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocationCell.m; sourceTree = "<group>"; };
1860-
4ED618191C3A72AE0017946C /* ShopAddressCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopAddressCell.h; sourceTree = "<group>"; };
1861-
4ED6181A1C3A72AE0017946C /* ShopAddressCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopAddressCell.m; sourceTree = "<group>"; };
1862-
4ED6181C1C3A72CF0017946C /* ShopAddressCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShopAddressCell.xib; sourceTree = "<group>"; };
1860+
4ED618191C3A72AE0017946C /* ShopMutileValueCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopMutileValueCell.h; sourceTree = "<group>"; };
1861+
4ED6181A1C3A72AE0017946C /* ShopMutileValueCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopMutileValueCell.m; sourceTree = "<group>"; };
1862+
4ED6181C1C3A72CF0017946C /* ShopMutileValueCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShopMutileValueCell.xib; sourceTree = "<group>"; };
18631863
4ED6181E1C3A732F0017946C /* button_arrow_left@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button_arrow_left@2x.png"; sourceTree = "<group>"; };
18641864
4ED618201C3BD79B0017946C /* task_activity_icon_remove_watcher@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "task_activity_icon_remove_watcher@2x.png"; sourceTree = "<group>"; };
18651865
4ED618221C3CB1AF0017946C /* taskWatchers@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "taskWatchers@2x.png"; sourceTree = "<group>"; };
@@ -5153,9 +5153,9 @@
51535153
D02BE0AE1C0434DB008374C0 /* PRMRSearchCell.m */,
51545154
4ED618161C3A6CA50017946C /* LocationCell.h */,
51555155
4ED618171C3A6CA50017946C /* LocationCell.m */,
5156-
4ED618191C3A72AE0017946C /* ShopAddressCell.h */,
5157-
4ED6181A1C3A72AE0017946C /* ShopAddressCell.m */,
5158-
4ED6181C1C3A72CF0017946C /* ShopAddressCell.xib */,
5156+
4ED618191C3A72AE0017946C /* ShopMutileValueCell.h */,
5157+
4ED6181A1C3A72AE0017946C /* ShopMutileValueCell.m */,
5158+
4ED6181C1C3A72CF0017946C /* ShopMutileValueCell.xib */,
51595159
);
51605160
path = Cell;
51615161
sourceTree = "<group>";
@@ -5560,7 +5560,7 @@
55605560
4EA7F12D1A6D0C4D00A046BD /* icon_project_private_old@2x.png in Resources */,
55615561
D0C447FC1C02DCA200DC1C4B /* timeBtn_Nav@2x.png in Resources */,
55625562
7E8E59821B6F91C40083CA02 /* bubble_right_play_0@2x.png in Resources */,
5563-
4ED6181D1C3A72CF0017946C /* ShopAddressCell.xib in Resources */,
5563+
4ED6181D1C3A72CF0017946C /* ShopMutileValueCell.xib in Resources */,
55645564
4E96E7DD1A1B537E0037C098 /* icon_file_movie@2x.png in Resources */,
55655565
4E93F23D1B84356500017916 /* file_menu_icon_open@2x.png in Resources */,
55665566
D0C447F41C02DCA200DC1C4B /* addBtn_Nav@2x.png in Resources */,
@@ -6153,7 +6153,7 @@
61536153
8EA6D13219E240C40076D59C /* RegisterViewController.m in Sources */,
61546154
923399661C00441700F29E04 /* ShopBanner.m in Sources */,
61556155
8EF643C519FF7E2900F7EEB0 /* TitleRImageMoreCell.m in Sources */,
6156-
4ED6181B1C3A72AE0017946C /* ShopAddressCell.m in Sources */,
6156+
4ED6181B1C3A72AE0017946C /* ShopMutileValueCell.m in Sources */,
61576157
4E217F151A70EDC700F6DF88 /* SVWebViewControllerActivitySafari.m in Sources */,
61586158
4E8D5D5A1B45295D00B70936 /* HOTPGenerator.m in Sources */,
61596159
8EA6D14519E240C40076D59C /* TweetDetailViewController.m in Sources */,

Coding_iOS/Controllers/Shop/ExchangeGoodsViewController.m

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
#import "ShopGoodsInfoView.h"
1414
#import "UIView+Common.h"
1515
#import "LocationViewController.h"
16-
#import "ShopAddressCell.h"
16+
#import "ShopMutileValueCell.h"
17+
#import "ActionSheetStringPicker.h"
1718

1819
#define kCellIdentifier_ShopOrderTextFieldCell @"ShopOrderTextFieldCell.h"
1920

@@ -26,6 +27,7 @@ @interface ExchangeGoodsViewController () <UITableViewDataSource, UITableViewDel
2627

2728
@property (strong, nonatomic) NSString *receiverName, *receiverAddress, *receiverPhone, *remark;
2829
@property (strong, nonatomic) NSArray *locations;
30+
@property (strong, nonatomic) ShopGoodsOption *option;
2931
@end
3032

3133
@implementation ExchangeGoodsViewController
@@ -78,7 +80,7 @@ - (void)viewDidLoad {
7880
tableView.delegate = self;
7981
tableView.dataSource = self;
8082
[tableView registerClass:[ShopOrderTextFieldCell class] forCellReuseIdentifier:kCellIdentifier_ShopOrderTextFieldCell];
81-
[tableView registerNib:[UINib nibWithNibName:kCellIdentifier_ShopAddressCell bundle:nil] forCellReuseIdentifier:kCellIdentifier_ShopAddressCell];
83+
[tableView registerNib:[UINib nibWithNibName:kCellIdentifier_ShopMutileValueCell bundle:nil] forCellReuseIdentifier:kCellIdentifier_ShopMutileValueCell];
8284
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
8385
tableView.separatorColor = [UIColor colorWithHexString:@"0xFFDDDDDD"];
8486
tableView.separatorInset = UIEdgeInsetsMake(0, 12, 0, 12);
@@ -129,17 +131,24 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
129131

130132
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
131133
{
132-
NSInteger row = 5;
134+
NSInteger row = self.shopGoods.options.count > 0? 6: 5;
133135
return row;
134136
}
135137

136138
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
137139
{
138-
if (indexPath.row == 1) {
139-
ShopAddressCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_ShopAddressCell forIndexPath:indexPath];
140-
cell.locationF.text = [[self.locations valueForKey:@"name"] componentsJoinedByString:@" - "];
140+
if (indexPath.row == 1 || indexPath.row == 5) {
141+
ShopMutileValueCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_ShopMutileValueCell forIndexPath:indexPath];
142+
if (indexPath.row == 1) {
143+
cell.titleL.text = @"所在地 *";
144+
cell.valueF.text = [[self.locations valueForKey:@"name"] componentsJoinedByString:@" - "];
145+
}else{
146+
cell.titleL.text = @"选项";
147+
cell.valueF.text = self.option.name;
148+
}
141149
return cell;
142-
}else{
150+
}
151+
else{
143152
ShopOrderTextFieldCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_ShopOrderTextFieldCell forIndexPath:indexPath];
144153

145154
switch (indexPath.row) {
@@ -191,8 +200,8 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte
191200

192201
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
193202
{
194-
if (indexPath.row == 1) {
195-
return [ShopAddressCell cellHeight];
203+
if (indexPath.row == 1 || indexPath.row == 5) {
204+
return [ShopMutileValueCell cellHeight];
196205
}else{
197206
return [ShopOrderTextFieldCell cellHeight];
198207
}
@@ -208,6 +217,17 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
208217
[tableView deselectRowAtIndexPath:indexPath animated:YES];
209218
if (indexPath.row == 1) {
210219
[self goToLocationVC];
220+
}else if (indexPath.row == 5){
221+
NSArray *rows = [self.shopGoods.options valueForKey:@"name"];
222+
NSInteger index = self.option? [self.shopGoods.options indexOfObject:self.option]: 0;
223+
__weak typeof(self) weakSelf = self;
224+
[ActionSheetStringPicker showPickerWithTitle:nil rows:@[rows] initialSelection:@[@(index)] doneBlock:^(ActionSheetStringPicker *picker, NSArray *selectedIndex, NSArray *selectedValue) {
225+
NSInteger newIndex = [(NSNumber *)selectedIndex.firstObject integerValue];
226+
if (weakSelf.shopGoods.options.count > newIndex) {
227+
weakSelf.option = weakSelf.shopGoods.options[newIndex];
228+
[weakSelf.myTableView reloadData];
229+
}
230+
} cancelBlock:nil origin:self.view];
211231
}
212232
}
213233

@@ -261,9 +281,7 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
261281
[NSObject showHudTipStr:@"密码不能为空"];
262282
return;
263283
}
264-
265284
[self exchangeActionRquest:field.text];
266-
267285
}
268286
}
269287

@@ -284,6 +302,9 @@ - (void)exchangeActionRquest:(NSString *)pwd
284302
mparms[@"city"] =
285303
mparms[@"district"] = nil;
286304
}
305+
if (self.option.id) {
306+
mparms[@"option_id"] = self.option.id;
307+
}
287308

288309
mparms[@"receiverAddress"] = _receiverAddress;
289310
mparms[@"receiverPhone"] = _receiverPhone;

Coding_iOS/Models/ShopGoods.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
@property (strong, nonatomic) NSString *image ,*name ,*giftId;
1616
@property (assign, nonatomic) BOOL exchangeable; //能否兑换的
1717
@property (strong, nonatomic) NSString *description_mine;
18-
18+
@property (strong, nonatomic) NSArray *options;
19+
@property (strong, nonatomic) NSDictionary *propertyArrayMap;
1920

2021
@end
22+
23+
@interface ShopGoodsOption : BaseModel
24+
@property (strong, nonatomic) NSNumber *id, *gift_id, *status, *size;
25+
@property (strong, nonatomic) NSString *name;
26+
@end

Coding_iOS/Models/ShopGoods.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,17 @@
99
#import "ShopGoods.h"
1010

1111
@implementation ShopGoods
12-
12+
- (instancetype)init
13+
{
14+
self = [super init];
15+
if (self) {
16+
_propertyArrayMap = [NSDictionary dictionaryWithObjectsAndKeys:
17+
@"ShopGoodsOption", @"options", nil];
18+
}
19+
return self;
20+
}
1321
@end
22+
23+
@implementation ShopGoodsOption
24+
25+
@end

Coding_iOS/Views/Cell/ShopAddressCell.h

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// ShopMutileValueCell.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 16/1/4.
6+
// Copyright © 2016年 Coding. All rights reserved.
7+
//
8+
9+
#define kCellIdentifier_ShopMutileValueCell @"ShopMutileValueCell"
10+
11+
#import <UIKit/UIKit.h>
12+
13+
@interface ShopMutileValueCell : UITableViewCell
14+
@property (weak, nonatomic) IBOutlet UITextField *valueF;
15+
@property (weak, nonatomic) IBOutlet UILabel *titleL;
16+
17+
+ (CGFloat)cellHeight;
18+
@end

Coding_iOS/Views/Cell/ShopAddressCell.m renamed to Coding_iOS/Views/Cell/ShopMutileValueCell.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//
2-
// ShopAddressCell.m
2+
// ShopMutileValueCell.m
33
// Coding_iOS
44
//
55
// Created by Ease on 16/1/4.
66
// Copyright © 2016年 Coding. All rights reserved.
77
//
88

9-
#import "ShopAddressCell.h"
9+
#import "ShopMutileValueCell.h"
1010

11-
@implementation ShopAddressCell
11+
@implementation ShopMutileValueCell
1212
+ (CGFloat)cellHeight{
1313
return 100;
1414
}

Coding_iOS/Views/Cell/ShopAddressCell.xib renamed to Coding_iOS/Views/Cell/ShopMutileValueCell.xib

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<objects>
99
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
1010
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
11-
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ShopAddressCell" rowHeight="100" id="nqW-9T-8Qd" customClass="ShopAddressCell">
11+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ShopMutileValueCell" rowHeight="100" id="nqW-9T-8Qd" customClass="ShopMutileValueCell">
1212
<rect key="frame" x="0.0" y="0.0" width="320" height="100"/>
1313
<autoresizingMask key="autoresizingMask"/>
1414
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="nqW-9T-8Qd" id="aUs-Fo-8GQ">
@@ -76,7 +76,8 @@
7676
</constraints>
7777
</tableViewCellContentView>
7878
<connections>
79-
<outlet property="locationF" destination="XXX-Xd-G2g" id="zTs-bp-6c4"/>
79+
<outlet property="titleL" destination="yZm-gB-sVo" id="Bqe-7T-wxs"/>
80+
<outlet property="valueF" destination="XXX-Xd-G2g" id="DqK-cu-KKU"/>
8081
</connections>
8182
</tableViewCell>
8283
</objects>

0 commit comments

Comments
 (0)