diff --git a/YHB_Prj/YHB_Prj.xcodeproj/project.pbxproj b/YHB_Prj/YHB_Prj.xcodeproj/project.pbxproj index fc7f60d..7042008 100644 --- a/YHB_Prj/YHB_Prj.xcodeproj/project.pbxproj +++ b/YHB_Prj/YHB_Prj.xcodeproj/project.pbxproj @@ -88,6 +88,11 @@ ABAAFB6F1B996B250012D1C6 /* DJYDCXRows.m in Sources */ = {isa = PBXBuildFile; fileRef = ABAAFB6C1B996B250012D1C6 /* DJYDCXRows.m */; }; ABAE34A11BA0109C00221980 /* ScanVC.m in Sources */ = {isa = PBXBuildFile; fileRef = ABAE34A01BA0109C00221980 /* ScanVC.m */; }; ABDDB3711BA2CF4000DCD659 /* JHLSViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABDDB3701BA2CF4000DCD659 /* JHLSViewController.m */; }; + ABDDB3751BA3B1ED00DCD659 /* JHLSTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = ABDDB3731BA3B1ED00DCD659 /* JHLSTableViewCell.m */; }; + ABDDB3761BA3B1ED00DCD659 /* JHLSTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABDDB3741BA3B1ED00DCD659 /* JHLSTableViewCell.xib */; }; + ABDDB3791BA3BCDA00DCD659 /* UploadImgViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABDDB3781BA3BCDA00DCD659 /* UploadImgViewController.m */; }; + ABDDB3801BA3C2E300DCD659 /* XSLSTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = ABDDB37E1BA3C2E300DCD659 /* XSLSTableViewCell.m */; }; + ABDDB3811BA3C2E300DCD659 /* XSLSTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABDDB37F1BA3C2E300DCD659 /* XSLSTableViewCell.xib */; }; ABE71E241B9C32E2000651A9 /* FBViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABE71E231B9C32E2000651A9 /* FBViewController.m */; }; ABEF1DA71B929D5400C1C2EA /* SupplierDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABEF1DA61B929D5400C1C2EA /* SupplierDetailViewController.m */; }; ABEF1DAB1B92A18E00C1C2EA /* ClerkDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABEF1DAA1B92A18E00C1C2EA /* ClerkDetailViewController.m */; }; @@ -422,6 +427,14 @@ ABAE34A01BA0109C00221980 /* ScanVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanVC.m; sourceTree = ""; }; ABDDB36F1BA2CF4000DCD659 /* JHLSViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JHLSViewController.h; sourceTree = ""; }; ABDDB3701BA2CF4000DCD659 /* JHLSViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JHLSViewController.m; sourceTree = ""; }; + ABDDB3721BA3B1ED00DCD659 /* JHLSTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JHLSTableViewCell.h; sourceTree = ""; }; + ABDDB3731BA3B1ED00DCD659 /* JHLSTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JHLSTableViewCell.m; sourceTree = ""; }; + ABDDB3741BA3B1ED00DCD659 /* JHLSTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = JHLSTableViewCell.xib; sourceTree = ""; }; + ABDDB3771BA3BCDA00DCD659 /* UploadImgViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UploadImgViewController.h; sourceTree = ""; }; + ABDDB3781BA3BCDA00DCD659 /* UploadImgViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UploadImgViewController.m; sourceTree = ""; }; + ABDDB37D1BA3C2E300DCD659 /* XSLSTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSLSTableViewCell.h; sourceTree = ""; }; + ABDDB37E1BA3C2E300DCD659 /* XSLSTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XSLSTableViewCell.m; sourceTree = ""; }; + ABDDB37F1BA3C2E300DCD659 /* XSLSTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = XSLSTableViewCell.xib; sourceTree = ""; }; ABE71E221B9C32E2000651A9 /* FBViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBViewController.h; sourceTree = ""; }; ABE71E231B9C32E2000651A9 /* FBViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBViewController.m; sourceTree = ""; }; ABEF1DA51B929D5400C1C2EA /* SupplierDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SupplierDetailViewController.h; sourceTree = ""; }; @@ -1165,6 +1178,14 @@ ABFAB0EE1BA29CF9009D8654 /* SPManager.m */, ABDDB36F1BA2CF4000DCD659 /* JHLSViewController.h */, ABDDB3701BA2CF4000DCD659 /* JHLSViewController.m */, + ABDDB3721BA3B1ED00DCD659 /* JHLSTableViewCell.h */, + ABDDB3731BA3B1ED00DCD659 /* JHLSTableViewCell.m */, + ABDDB3741BA3B1ED00DCD659 /* JHLSTableViewCell.xib */, + ABDDB3771BA3BCDA00DCD659 /* UploadImgViewController.h */, + ABDDB3781BA3BCDA00DCD659 /* UploadImgViewController.m */, + ABDDB37D1BA3C2E300DCD659 /* XSLSTableViewCell.h */, + ABDDB37E1BA3C2E300DCD659 /* XSLSTableViewCell.m */, + ABDDB37F1BA3C2E300DCD659 /* XSLSTableViewCell.xib */, ); path = EditSPVC; sourceTree = ""; @@ -1924,6 +1945,7 @@ FF5CC7031B93EE5300F55713 /* RuKushenpinVC.xib in Resources */, FFD26CF01B8C3F940003F491 /* ZXBJCell.xib in Resources */, FF012FAA1B8EB92C00AE563C /* HYXFJLListViewController.xib in Resources */, + ABDDB3811BA3C2E300DCD659 /* XSLSTableViewCell.xib in Resources */, FF012FB41B8EB92C00AE563C /* HYCell.xib in Resources */, FF5C872E1B83279600F79EC1 /* FirstViewController.xib in Resources */, FF012FAE1B8EB92C00AE563C /* HYGLViewController.xib in Resources */, @@ -1947,6 +1969,7 @@ FF5C87091B82FE5200F79EC1 /* LoginViewController.xib in Resources */, FF012FAC1B8EB92C00AE563C /* HYLSXFCell.xib in Resources */, FF357CAB1BA1974800DFCAC0 /* WYDHViewController.xib in Resources */, + ABDDB3761BA3B1ED00DCD659 /* JHLSTableViewCell.xib in Resources */, FFD26CEB1B8C1B3B0003F491 /* KCYJViewController.xib in Resources */, FF357CC01BA2C30900DFCAC0 /* WYJHDetailVC.xib in Resources */, FF357C951BA052F500DFCAC0 /* SPGLSearchCell.xib in Resources */, @@ -1994,6 +2017,7 @@ FF2A6C9C1A0F3D30001607AC /* FourthViewController.m in Sources */, 5B1F7F9C1B90A52300763059 /* DJProductCheckListVC.m in Sources */, FF2A6C871A0F3B8A001607AC /* DataOC.mm in Sources */, + ABDDB3751BA3B1ED00DCD659 /* JHLSTableViewCell.m in Sources */, FF2A6C861A0F3B8A001607AC /* DataCenterDeal.mm in Sources */, 5B1F7FA61B91C8A600763059 /* DJProductCheckManager.m in Sources */, AB9F43EC1B92E58400914C85 /* SetTableViewCell.m in Sources */, @@ -2092,6 +2116,7 @@ FFF3919E1B846F58007DC652 /* NetManager.m in Sources */, FF357CA01BA1310300DFCAC0 /* SBPageFlowView.m in Sources */, 5B54BA3F1B92F9C0002098A4 /* DJCheckCartSubmitRequest.m in Sources */, + ABDDB3801BA3C2E300DCD659 /* XSLSTableViewCell.m in Sources */, FF2A6C7A1A0F3B7B001607AC /* UIView+WebCacheOperation.m in Sources */, AB25793E1B8F02010015039A /* IQTitleBarButtonItem.m in Sources */, AB40EAC51B8C021800DE5ED7 /* SupplierTableViewCell.m in Sources */, @@ -2116,6 +2141,7 @@ FF5C87241B83025600F79EC1 /* YTKKeyValueStore.m in Sources */, FF2A6C3E1A0F3B66001607AC /* UIViewAdditions.m in Sources */, 5B54BA1D1B9213A9002098A4 /* DJProductSearchBar.m in Sources */, + ABDDB3791BA3BCDA00DCD659 /* UploadImgViewController.m in Sources */, FF3C20011A2EE6D30081D3C7 /* LSNavigationController.m in Sources */, 5B54BA2B1B922676002098A4 /* DJCheckCartItemComponent.m in Sources */, FF5C871B1B83024C00F79EC1 /* README.markdown in Sources */, diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.h b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.h new file mode 100644 index 0000000..faeb8d7 --- /dev/null +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.h @@ -0,0 +1,20 @@ +// +// JHLSTableViewCell.h +// YHB_Prj +// +// Created by Johnny's on 15/9/12. +// Copyright (c) 2015年 striveliu. All rights reserved. +// + +#import + +@interface JHLSTableViewCell : UITableViewCell +@property (strong, nonatomic) IBOutlet UILabel *laTime; +@property (strong, nonatomic) IBOutlet UILabel *laName; +@property (strong, nonatomic) IBOutlet UILabel *laPrice; +@property (strong, nonatomic) IBOutlet UILabel *laNum; +@property (strong, nonatomic) IBOutlet UILabel *laSum; + + ++ (CGFloat)heightForCell; +@end diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.m b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.m new file mode 100644 index 0000000..833a778 --- /dev/null +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.m @@ -0,0 +1,37 @@ +// +// JHLSTableViewCell.m +// YHB_Prj +// +// Created by Johnny's on 15/9/12. +// Copyright (c) 2015年 striveliu. All rights reserved. +// + +#import "JHLSTableViewCell.h" + +@implementation JHLSTableViewCell + +- (void)awakeFromNib { + // Initialization code +} + ++ (CGFloat)heightForCell +{ + return 108; +} + +- (void)resetCell +{ + _laName.text = @""; + _laNum.text = @""; + _laPrice.text = @""; + _laSum.text = @""; + _laTime.text = @""; +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.xib b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.xib new file mode 100644 index 0000000..1cab2e7 --- /dev/null +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSTableViewCell.xib @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSViewController.h b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSViewController.h index e975043..a7af934 100644 --- a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSViewController.h +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSViewController.h @@ -10,4 +10,6 @@ @interface JHLSViewController : BaseViewController +- (instancetype)initWithProductId:(NSString *)aId; + @end diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSViewController.m b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSViewController.m index 0f82e1f..b0bd588 100644 --- a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSViewController.m +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/JHLSViewController.m @@ -7,14 +7,29 @@ // #import "JHLSViewController.h" +#import "JHLSTableViewCell.h" +#import "SPManager.h" +#import "SVPullToRefresh.h" @interface JHLSViewController () - +{ + NSString *productId; +} @property(nonatomic,strong) UITableView *myTableView; +@property(nonatomic,strong) JHLSManager *manager; +@property(nonatomic,strong) NSMutableArray *arrData; @end @implementation JHLSViewController +- (instancetype)initWithProductId:(NSString *)aId +{ + if (self=[super init]) { + productId = aId; + } + return self; +} + - (void)viewDidLoad { [super viewDidLoad]; self.title = @"全部门店"; @@ -23,22 +38,75 @@ - (void)viewDidLoad { _myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kMainScreenWidth, kMainScreenHeight-64)]; _myTableView.delegate = self; _myTableView.dataSource = self; + _myTableView.separatorStyle = UITableViewCellSeparatorStyleNone; [self.view addSubview:_myTableView]; + + _arrData = [NSMutableArray arrayWithCapacity:0]; + _manager = [[JHLSManager alloc] init]; + [self addTableViewTrag]; + [_myTableView triggerPullToRefresh]; +} + +#pragma mark 增加上拉下拉 +- (void)addTableViewTrag +{ + __weak JHLSViewController *weakself = self; + [weakself.myTableView addPullToRefreshWithActionHandler:^{ + [_manager appGetProductStockDetail:productId finishBlock:^(NSArray *resultArr) { + if (resultArr && resultArr.count>0) + { + _arrData = [resultArr mutableCopy]; + [_myTableView reloadData]; + } + else [SVProgressHUD showErrorWithStatus:@"无数据" cover:YES offsetY:kMainScreenHeight/2.0]; + [weakself.myTableView.pullToRefreshView stopAnimating]; + } isRefresh:YES]; + }]; + + + [weakself.myTableView addInfiniteScrollingWithActionHandler:^{ + if (_arrData.count%20==0 && _arrData.count!=0) + { + [_manager appGetProductStockDetail:productId finishBlock:^(NSArray *resultArr) { + if (resultArr && resultArr.count>0) + { + [_arrData addObjectsFromArray:resultArr]; + [_myTableView reloadData]; + } + else [SVProgressHUD showErrorWithStatus:@"无数据" cover:YES offsetY:kMainScreenHeight/2.0]; + [weakself.myTableView.infiniteScrollingView stopAnimating]; + } isRefresh:NO]; + } + else [weakself.myTableView.infiniteScrollingView stopAnimating]; + }]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 5; + return _arrData.count; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 40; + return [JHLSTableViewCell heightForCell]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - return [UITableViewCell new]; + static NSString *cellId = @"JHLSCell"; + JHLSTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + if (!cell) + { + [tableView registerNib:[UINib nibWithNibName:@"JHLSTableViewCell" bundle:nil] forCellReuseIdentifier:cellId]; + cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + } + + return cell; +} + +- (void)tableView:(UITableView *)tableView willDisplayCell:(JHLSTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath +{ + } - (void)didReceiveMemoryWarning { diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/SPManager.h b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/SPManager.h index b342202..b24b338 100644 --- a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/SPManager.h +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/SPManager.h @@ -13,3 +13,9 @@ - (void)saveOrUpdateDict:(NSDictionary *)aDict finishBlock:(void (^)(NSString *))FBlock; @end + +@interface JHLSManager : NSObject + +- (void)appGetProductStockDetail:(NSString *)aProductId finishBlock:(void (^)(NSArray *))FBlock isRefresh:(BOOL)aBool; + +@end diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/SPManager.m b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/SPManager.m index 35a8a50..5314ff1 100644 --- a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/SPManager.m +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/SPManager.m @@ -23,3 +23,36 @@ - (void)saveOrUpdateDict:(NSDictionary *)aDict finishBlock:(void (^)(NSString *) } @end + +@interface JHLSManager() +{ + int currentPage; +} +@end + +@implementation JHLSManager + +- (void)appGetProductStockDetail:(NSString *)aProductId finishBlock:(void (^)(NSArray *))FBlock isRefresh:(BOOL)aBool +{ + if (aBool) currentPage=0; + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:0]; + [dict setObject:aProductId forKey:@"productId"]; + [dict setObject:@0 forKey:@"status"]; + [dict setObject:@-1 forKey:@"orderFrom"]; + [dict setObject:[NSString stringWithFormat:@"%d",currentPage] forKey:@"pageNo"]; + [dict setObject:@20 forKey:@"pageSize"]; + [dict setObject:@"true" forKey:@"needPage"]; + [NetManager requestWith:dict apiName:@"appGetProductStockDetail" method:@"post" succ:^(NSDictionary *successDict) { + MLOG(@"%@", successDict); + NSString *code = successDict[@"msg"]; + if ([code isEqualToString:@"success"] && code) + { + NSDictionary *dictResult = successDict[@"result"]; + } + else FBlock(nil); + } failure:^(NSDictionary *failDict, NSError *error) { + FBlock(nil); + }]; +} + +@end diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/UploadImgViewController.h b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/UploadImgViewController.h new file mode 100644 index 0000000..7c1d13d --- /dev/null +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/UploadImgViewController.h @@ -0,0 +1,15 @@ +// +// UploadImgViewController.h +// YHB_Prj +// +// Created by Johnny's on 15/9/12. +// Copyright (c) 2015年 striveliu. All rights reserved. +// + +#import "BaseViewController.h" + +@interface UploadImgViewController : BaseViewController + +- (instancetype)initWithUploadImgCount:(int)aCount; + +@end diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/UploadImgViewController.m b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/UploadImgViewController.m new file mode 100644 index 0000000..9beaeb0 --- /dev/null +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/UploadImgViewController.m @@ -0,0 +1,230 @@ +// +// UploadImgViewController.m +// YHB_Prj +// +// Created by Johnny's on 15/9/12. +// Copyright (c) 2015年 striveliu. All rights reserved. +// + +#import "UploadImgViewController.h" + +@interface UploadImgViewController () +{ + int countNeedToUpload; + CGFloat imgWidth; + CGFloat interval; + int deleteIndex; +} +@property(nonatomic,strong) UIView *bgView; +@property(nonatomic,strong) NSMutableArray *photoArr; +@property(nonatomic,strong) UIButton *btnOk; +@end + +@implementation UploadImgViewController + +- (instancetype)initWithUploadImgCount:(int)aCount +{ + if (self=[super init]) + { + countNeedToUpload = aCount; + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.title = @"上传图片"; + self.view.backgroundColor = [UIColor whiteColor]; + + interval = 15; + imgWidth = (kMainScreenWidth-interval*4)/3.0; + + _photoArr = [NSMutableArray arrayWithCapacity:0]; + + _bgView = [[UIView alloc] initWithFrame:CGRectMake(0, interval, kMainScreenWidth, imgWidth)]; + [self.view addSubview:_bgView]; + [self reloadView]; + + CGFloat btnWidth = 240; + _btnOk = [[UIButton alloc] initWithFrame:CGRectMake(kMainScreenWidth/2.0-btnWidth/2.0, kMainScreenHeight-64-60, btnWidth, 30)]; + [_btnOk setTitle:@"确定上传" forState:UIControlStateNormal]; + _btnOk.backgroundColor = KColor; + _btnOk.titleLabel.font = kFont12; + [_btnOk addTarget:self action:@selector(touchOk) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:_btnOk]; +} + +//上传按钮事件 +- (void)touchOk +{ + MLOG(@"%s", __func__); +} + +- (void)reloadView +{ + [self removeSubviews:_bgView]; + CGFloat endWidth=0; + for (int i=0; i<_photoArr.count; i++) + { + UIImage *img = _photoArr[i]; + UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(endWidth+interval, 0, imgWidth, imgWidth)]; + btn.tag = 100+i; + [btn addTarget:self action:@selector(touchPhoto:) forControlEvents:UIControlEventTouchUpInside]; + [btn setImage:img forState:UIControlStateNormal]; + [_bgView addSubview:btn]; + endWidth += interval+imgWidth; + } + if (_photoArr.count7) { + picker.navigationBar.barTintColor = self.navigationController.navigationBar.barTintColor; + } + // 设置导航默认标题的颜色及字体大小 + picker.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor], + NSFontAttributeName : [UIFont boldSystemFontOfSize:18]}; + [self presentViewController:picker animated:YES completion:nil]; + } else if (buttonIndex == UIImagePickerControllerSourceTypeCamera) { // 拍照 + UIImagePickerController *picker = [[UIImagePickerController alloc] init]; + picker.delegate = self; + picker.allowsEditing = YES; + picker.sourceType = UIImagePickerControllerSourceTypeCamera; + + picker.delegate = self; + if (kSystemVersion>7) { + picker.navigationBar.barTintColor = self.navigationController.navigationBar.barTintColor; + } + // 设置导航默认标题的颜色及字体大小 + picker.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor], + NSFontAttributeName : [UIFont boldSystemFontOfSize:18]}; + [self presentViewController:picker animated:YES completion:nil]; + } + } + +} + +#pragma mark - image picker delegte +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info +{ + UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage]; + [_photoArr addObject:image]; + [self reloadView]; + if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) { + UIImage * oriImage = [info objectForKey:UIImagePickerControllerOriginalImage]; + // 保存图片到相册中 + SEL selectorToCall = @selector(imageWasSavedSuccessfully:didFinishSavingWithError:contextInfo:); + UIImageWriteToSavedPhotosAlbum(oriImage, self,selectorToCall, NULL); + } + [picker dismissViewControllerAnimated:YES completion:nil]; +} + +- (void) imageWasSavedSuccessfully:(UIImage *)paramImage didFinishSavingWithError:(NSError *)paramError contextInfo:(void *)paramContextInfo{ + if (paramError == nil){ + NSLog(@"Image was saved successfully."); + paramImage = nil; + } else { + NSLog(@"An error happened while saving the image."); + NSLog(@"Error = %@", paramError); + } +} + +- (void)touchPhoto:(UIButton *)sender +{ + deleteIndex = (int)sender.tag-100; + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"是否要删除这张图片" message:nil delegate:self cancelButtonTitle:@"否" otherButtonTitles:@"是", nil]; + [alertView show]; +} + +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex +{ + if (buttonIndex==1) + { + [_photoArr removeObjectAtIndex:deleteIndex]; + [self reloadView]; + } +} + +- (void)removeSubviews:(UIView *)aView +{ + while (aView.subviews.count) + { + UIView* child = aView.subviews.lastObject; + [child removeFromSuperview]; + } +} + +- (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 diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.h b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.h new file mode 100644 index 0000000..e16ad8c --- /dev/null +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.h @@ -0,0 +1,18 @@ +// +// XSLSTableViewCell.h +// YHB_Prj +// +// Created by Johnny's on 15/9/12. +// Copyright (c) 2015年 striveliu. All rights reserved. +// + +#import + +@interface XSLSTableViewCell : UITableViewCell +@property (strong, nonatomic) IBOutlet UILabel *laTime; +@property (strong, nonatomic) IBOutlet UILabel *laPrice; +@property (strong, nonatomic) IBOutlet UILabel *laNum; +@property (strong, nonatomic) IBOutlet UILabel *laPro; +@property (strong, nonatomic) IBOutlet UILabel *laSum; ++ (CGFloat)heightForCell; +@end diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.m b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.m new file mode 100644 index 0000000..66f3b92 --- /dev/null +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.m @@ -0,0 +1,37 @@ +// +// XSLSTableViewCell.m +// YHB_Prj +// +// Created by Johnny's on 15/9/12. +// Copyright (c) 2015年 striveliu. All rights reserved. +// + +#import "XSLSTableViewCell.h" + +@implementation XSLSTableViewCell + +- (void)awakeFromNib { + // Initialization code +} + ++(CGFloat)heightForCell +{ + return 82; +} + +- (void)resetCell +{ + _laNum.text = @""; + _laPrice.text = @""; + _laPro.text = @""; + _laSum.text = @""; + _laTime.text = @""; +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.xib b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.xib new file mode 100644 index 0000000..91a1090 --- /dev/null +++ b/YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/XSLSTableViewCell.xib @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YHB_Prj/YHB_Prj/shangpinguanli/SPGLProductDetail.m b/YHB_Prj/YHB_Prj/shangpinguanli/SPGLProductDetail.m index 5ec06b7..6e9c77f 100644 --- a/YHB_Prj/YHB_Prj/shangpinguanli/SPGLProductDetail.m +++ b/YHB_Prj/YHB_Prj/shangpinguanli/SPGLProductDetail.m @@ -10,6 +10,9 @@ #import "SPGLManager.h" #import "SPGLProductMode.h" #import "UIImageView+WebCache.h" +#import "SPEditViewController.h" +#import "JHLSViewController.h" +#import "UploadImgViewController.h" @interface SPGLProductDetail () { SBPageFlowView *flowView; @@ -59,6 +62,54 @@ - (void)viewDidLoad { self.kucunLabel.text = self.productMode.strStayQty; self.shoujiaLabel.text = self.productMode.strSalePrice; self.dianmingAndKuncunLabel.text = [NSString stringWithFormat:@" %@:库存 %@",self.productMode.strClsName,self.productMode.strStockQty]; + + [self.xiugaishangpinBT addTarget:self action:@selector(touchXiugai) forControlEvents:UIControlEventTouchUpInside]; + [self.shangchuantupianBT addTarget:self action:@selector(touchShangchuan) forControlEvents:UIControlEventTouchUpInside]; + [self.ypdmBT addTarget:self action:@selector(touchYPDM) forControlEvents:UIControlEventTouchUpInside]; + [self.jhlsBT addTarget:self action:@selector(touchJHLS) forControlEvents:UIControlEventTouchUpInside]; + [self.pdspBT addTarget:self action:@selector(touchPDSP) forControlEvents:UIControlEventTouchUpInside]; + [self.xslsBT addTarget:self action:@selector(touchXSLS) forControlEvents:UIControlEventTouchUpInside]; +} + +- (void)touchXiugai +{ + SPEditViewController *vc = [[SPEditViewController alloc] initWithMode:_productMode]; + [self.navigationController pushViewController:vc animated:YES]; +} + +- (void)touchShangchuan +{ + int count = 3-(int)_productMode.picList.count; + if (count==0) + { + [SVProgressHUD showErrorWithStatus:@"商品图片已满3张" cover:YES offsetY:kMainScreenHeight/2.0]; + } + else + { + UploadImgViewController *vc = [[UploadImgViewController alloc] initWithUploadImgCount:count]; + [self.navigationController pushViewController:vc animated:YES]; + } +} + +- (void)touchYPDM +{ + +} + +- (void)touchPDSP +{ + +} + +- (void)touchJHLS +{ + JHLSViewController *vc = [[JHLSViewController alloc] initWithProductId:_productMode.strProductCode]; + [self.navigationController pushViewController:vc animated:YES]; +} + +- (void)touchXSLS +{ + } #pragma mark 设置初始化数据