Commit c530ab32 authored by zhu's avatar zhu

no message

parent d1e107d3
......@@ -12,6 +12,7 @@
0406BFE51B80A19D00DD65A7 /* NewPurchaseNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0406BFE41B80A19D00DD65A7 /* NewPurchaseNoticeViewController.m */; };
0406BFE81B80A1BA00DD65A7 /* SeePurchaseNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0406BFE71B80A1BA00DD65A7 /* SeePurchaseNoticeViewController.m */; };
0406BFEE1B82C72200DD65A7 /* PurchaseNoticeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0406BFED1B82C72200DD65A7 /* PurchaseNoticeCell.m */; };
04703FA41B8461AB00C72846 /* ShopDetaileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04703FA31B8461AB00C72846 /* ShopDetaileViewController.m */; };
300DD94A1B184B450080EE12 /* ICRPatrolPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD9491B184B450080EE12 /* ICRPatrolPlan.m */; };
300DD94B1B184B450080EE12 /* ICRPatrolPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD9491B184B450080EE12 /* ICRPatrolPlan.m */; };
300DD94E1B184EA70080EE12 /* ICRQuestion.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD94D1B184EA70080EE12 /* ICRQuestion.m */; };
......@@ -381,6 +382,8 @@
0406BFE71B80A1BA00DD65A7 /* SeePurchaseNoticeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SeePurchaseNoticeViewController.m; sourceTree = "<group>"; };
0406BFEC1B82C72200DD65A7 /* PurchaseNoticeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseNoticeCell.h; sourceTree = "<group>"; };
0406BFED1B82C72200DD65A7 /* PurchaseNoticeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseNoticeCell.m; sourceTree = "<group>"; };
04703FA21B8461AB00C72846 /* ShopDetaileViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopDetaileViewController.h; sourceTree = "<group>"; };
04703FA31B8461AB00C72846 /* ShopDetaileViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopDetaileViewController.m; sourceTree = "<group>"; };
1B0B22845F5CD40B5CF655F2 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
300DD9481B184B450080EE12 /* ICRPatrolPlan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICRPatrolPlan.h; sourceTree = "<group>"; };
300DD9491B184B450080EE12 /* ICRPatrolPlan.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ICRPatrolPlan.m; sourceTree = "<group>"; };
......@@ -837,6 +840,8 @@
children = (
0406BFEC1B82C72200DD65A7 /* PurchaseNoticeCell.h */,
0406BFED1B82C72200DD65A7 /* PurchaseNoticeCell.m */,
04703FA21B8461AB00C72846 /* ShopDetaileViewController.h */,
04703FA31B8461AB00C72846 /* ShopDetaileViewController.m */,
);
name = Views;
sourceTree = "<group>";
......@@ -2034,6 +2039,7 @@
72C803521B7B897B00990363 /* DataManager.m in Sources */,
C1C5643E1AD62BD8006A1050 /* ICRPlaceholderTextView.m in Sources */,
307059D21AF2211300E9DB8E /* ICRSyncCellContentView.m in Sources */,
04703FA41B8461AB00C72846 /* ShopDetaileViewController.m in Sources */,
0406BFD91B7C97E700DD65A7 /* BusinessViewController.m in Sources */,
C1374F581B33C40D00594D19 /* IBTWebViewController.m in Sources */,
C159186B1AC1A03B0013B391 /* ICRSyncViewController.m in Sources */,
......
......@@ -15,6 +15,7 @@
#import "SurveyUser.h"
#import "Survey.h"
#import "PurchaseNoticeCell.h"
#import "ShopDetaileViewController.h"
......@@ -28,6 +29,7 @@
#define TotalHeight 432
#define KeyboardHeight 258
#define DateViewHeight 300
#define FootOfsetHeight 140
@interface NewPurchaseNoticeViewController()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,HPGrowingTextViewDelegate>
{
UITableView *_tableView;
......@@ -38,7 +40,7 @@
UILabel *_endDateLabel;
UILabel *_personLabel;
HPGrowingTextView *_noteTextView;
NSIndexPath *selectedCellIndexPath;
BOOL _isClickStart;
......@@ -57,6 +59,10 @@
@property (nonatomic,strong)NSString *remarkStr;
@property (nonatomic,strong)NSMutableArray *users;
@property (nonatomic,strong)Survey *survey;
@property (nonatomic,strong)UILabel *HeardLabel;
@property (nonatomic,strong)UILabel *FootLabel;
@property (nonatomic,strong)UIButton *addDetailedButton;
@end
......@@ -73,55 +79,53 @@
_dataArr=[[NSMutableArray alloc]initWithObjects:@"标题:",@"采购员:",@"备注:", nil];
self.view.backgroundColor = XXFBgColor;
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, LeftMargin,ScreenSize.width, ScreenSize.height/2 - 64 - LeftMargin)) style:(UITableViewStylePlain)];
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, LeftMargin,ScreenSize.width, ScreenSize.height/2 - FootOfsetHeight - LeftMargin)) style:(UITableViewStylePlain)];
_tableView.backgroundColor = [UIColor whiteColor];
_tableView.tag=1001;
_tableView.bounces = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
[self.view addSubview:footView];
_tableView.tableFooterView = footView;
[self.view addSubview:_tableView];
mingXiTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 2*LeftMargin+_tableView.frame.size.height, ScreenSize.width, ScreenSize.height-_tableView.height-64-LeftMargin)];
mingXiTableView.backgroundColor = [UIColor whiteColor];
mingXiTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 2*LeftMargin+_tableView.frame.size.height, ScreenSize.width, ScreenSize.height-_tableView.height-TableHeight-LeftMargin)];
mingXiTableView.backgroundColor = [UIColor whiteColor];
mingXiTableView.tag=1002;
mingXiTableView.bounces=YES;
mingXiTableView.bounces=NO;
mingXiTableView.delegate=self;
mingXiTableView.dataSource=self;
UIView *footView2 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
footView2.backgroundColor=[UIColor whiteColor];
UIButton *button=[UIButton buttonWithType: UIButtonTypeCustom];
[button setFrame:CGRectMake(50, 5, 200, 30)];
[button setTitle:@"点击添加商品行情" forState:UIControlStateNormal];
[button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
// button.alpha=0;
[footView2 addSubview:button];
UIView *footView3=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
footView3.backgroundColor=[UIColor whiteColor];
UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
lable.text=@" 商品 价格 包装规格 包装数量";
[footView3 addSubview:lable];
UIView *footView2=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
footView2.backgroundColor=[UIColor clearColor];
UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
lable.text=@" 商品 价格 包装规格 包装数量";
lable.textColor=HexColor(@"444444");
[footView2 addSubview:lable];
UIView *footView3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
footView3.backgroundColor=[UIColor clearColor];
self.addDetailedButton=[UIButton buttonWithType: UIButtonTypeCustom];
[self.addDetailedButton setFrame:CGRectMake(90, 0, 200, TableHeight)];
[self.addDetailedButton setTitle:@"+ 点击添加商品明细" forState:UIControlStateNormal];
[self.addDetailedButton addTarget:self action:@selector(addShopeDetailed) forControlEvents:UIControlEventTouchUpInside];
[self.addDetailedButton setTitleColor:HexColor(@"444444") forState:UIControlStateNormal];
self.FootLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, footView3.size.height-1, footView3.size.width-2*LeftMargin, 1))];
self.FootLabel.backgroundColor = HexColor(@"e5e5e5");
self.FootLabel.font = FontSize(TitleSize);
self.HeardLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, footView3.size.width-2*LeftMargin, 1))];
self.HeardLabel.backgroundColor = HexColor(@"e5e5e5");
self.HeardLabel.font = FontSize(TitleSize);
//HexColor(@"e5e5e5")
[footView3 addSubview:self.addDetailedButton];
[footView3 addSubview:self.HeardLabel];
[footView3 addSubview:self.FootLabel];
[self.view addSubview:footView2];
[self.view addSubview:footView3];
mingXiTableView.tableFooterView = footView2;
mingXiTableView.tableHeaderView=footView3;
mingXiTableView.tableFooterView = footView3;
mingXiTableView.tableHeaderView=footView2;
[self.view addSubview:_tableView];
[self.view addSubview:mingXiTableView];
// for (int i=0; i<3; i++) {
// UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(10, 10+i*(30+30), 80, 30)];
// lable.font=FontSize(17);
// [lable setText:[array objectAtIndex:i]];
// [lable setTextColor:[UIColor blueColor] ];
// [self.view addSubview:lable];
// }
}
#pragma mark - 协议方法
......@@ -149,6 +153,7 @@
static NSString *cellID = @"cellID";
SurveyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
......@@ -169,11 +174,19 @@
Cell = [[PurchaseNoticeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Cell.selectionStyle = UITableViewCellSelectionStyleNone;
// if (indexPath.row >0 && indexPath.row < _dataArr.count - 1) {
// cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// }
// [self createViewInCell:cell indexPath:indexPath];
// Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;向左箭头
}
if(selectedCellIndexPath != nil&[selectedCellIndexPath compare:indexPath] == NSOrderedSame){
Cell.backgroundColor=XXFBgColor;
Cell.subSview.hidden=NO;
}else
{
Cell.subSview.hidden=YES;
Cell.backgroundColor=[UIColor whiteColor];
}
[Cell.button addTarget:self action:@selector(didtoucher) forControlEvents:UIControlEventTouchUpInside];
// [cell setTitleStr:_dataArr[indexPath.row]];
return Cell;
......@@ -190,6 +203,15 @@
}else if ([tableView isEqual:mingXiTableView])
{
if(selectedCellIndexPath != nil&[selectedCellIndexPath compare:indexPath] == NSOrderedSame){
return TableHeight*3;
}
return TableHeight;
}
return TableHeight;
......@@ -227,6 +249,16 @@
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
}
}else if ([tableView isEqual:mingXiTableView])
{
PurchaseNoticeCell *Cell=(PurchaseNoticeCell*)[mingXiTableView cellForRowAtIndexPath:indexPath ];
Cell.isSelected=YES;
selectedCellIndexPath = indexPath;
// [Cell setTitleStr:@"selected"];
// [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
[mingXiTableView reloadData];
}
}
......@@ -298,7 +330,24 @@
}
}
}
//添加商品明细
-(void)addShopeDetailed
{
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
svc.title = [IBTCommon localizableString:@"AddShopDetail"];
[self PushViewController:svc animated:YES];
NSLog(@"1111111111");
}
//编辑
- (void)didtoucher
{
// EditorShopDetail
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
svc.title = [IBTCommon localizableString:@"EditorShopDetail"];
[self PushViewController:svc animated:YES];
//
NSLog(@"123213232332323223");
}
#pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[_noteTextView resignFirstResponder];
......
......@@ -9,10 +9,15 @@
#import <UIKit/UIKit.h>
@interface PurchaseNoticeCell : UITableViewCell
@property (nonatomic,strong)UILabel *HeardLabel;
@property (nonatomic,strong)UILabel *FootLabel;
@property (nonatomic,strong)UILabel *SpLabel;
@property (nonatomic,strong)UILabel *DjLabel;
@property (nonatomic,strong)UILabel *BzggLabel;
@property (nonatomic,strong)UILabel *BzslLabel;
@property (nonatomic,strong)UIView *subSview;
@property (nonatomic, assign) BOOL isSelected;
@property (nonatomic,strong)UIButton *button;
- (void)setTitleStr:(NSString *)str;
......
......@@ -7,14 +7,19 @@
//
#import "PurchaseNoticeCell.h"
#define TitleSize 15
#define TitleSize 17
#define LeftMargin 15
#define TableHeight 46
#define TableWidth 60
@implementation PurchaseNoticeCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.isSelected=NO;
[self bulidLayout];
}
return self;
......@@ -22,31 +27,82 @@
- (void)bulidLayout
{
self.HeardLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin * 2, 1))];
self.HeardLabel.backgroundColor = HexColor(@"e5e5e5");
self.HeardLabel.font = FontSize(TitleSize);
self.FootLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, self.size.height-1, ScreenSize.width - LeftMargin * 2, 1))];
self.HeardLabel.backgroundColor = HexColor(@"e5e5e5");
self.HeardLabel.font = FontSize(TitleSize);
self.SpLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, 50, 44))];
self.SpLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin+20, 0, TableWidth, TableHeight))];
self.SpLabel.textAlignment= NSTextAlignmentLeft;
self.SpLabel.textColor = HexColor(@"666666");
self.SpLabel.font = FontSize(TitleSize);
self.DjLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin+80, 0, 60, 44))];
self.DjLabel.backgroundColor = HexColor(@"e5e5e5");
self.DjLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin+80, 0, TableWidth,TableHeight ))];
self.DjLabel.textAlignment= NSTextAlignmentLeft;
self.DjLabel.textColor = HexColor(@"666666");
self.DjLabel.font = FontSize(TitleSize);
self.BzggLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+150, 0, 80, 44)];
self.BzslLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+260, 0, 60, 44)];
self.SpLabel.text=@"shangp";
self.DjLabel.text=@"asda";
self.BzggLabel.text=@"nnjj";
self.BzslLabel.text=@"sdad";
self.BzggLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+150, 0, TableWidth, TableHeight)];
self.BzggLabel.textAlignment= NSTextAlignmentLeft;
self.BzggLabel.textColor = HexColor(@"666666");
self.BzggLabel.font = FontSize(TitleSize);
self.BzslLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+240, 0, TableWidth, TableHeight)];
self.BzslLabel.textAlignment= NSTextAlignmentLeft;
self.BzslLabel.textColor = HexColor(@"666666");
self.BzslLabel.font = FontSize(TitleSize);
self.SpLabel.text=@"1 西瓜";
self.DjLabel.text=@"0.8";
self.BzggLabel.text=@"1*12";
self.BzslLabel.text=@"100框";
self.subSview=[[UIView alloc]initWithFrame:CGRectMake(0, 50, ScreenSize.width, TableHeight*3)];
NSArray*array=[NSArray arrayWithObjects:@"包装规格",@"基础数量" ,@"包装单价",@"备注",nil];
NSArray*array1=[NSArray arrayWithObjects:@"包装数量",@"基础单价" ,@"总金额",nil];
for (int i=0; i<array.count; i++) {
UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(TableWidth-10, i*(10+10), 100, 10)];
lable.text=[array objectAtIndex:i];
lable.font=FontSize(TitleSize-2);
[lable setTextColor:HexColor(@"444444")];
[self.subSview addSubview:lable];
}
for (int i=0; i<array1.count; i++) {
UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(TableWidth+150, i*(10+10), 100, 10)];
lable.text=[array objectAtIndex:i];
lable.font=FontSize(TitleSize-2);
[lable setTextColor:HexColor(@"444444")];
[self.subSview addSubview:lable];
}
self.subSview.hidden=YES;
self.button=[UIButton buttonWithType:UIButtonTypeCustom];
[self.button setFrame:CGRectMake(310, 0, 50, 50)];
[self.button setImage:[UIImage imageNamed:@"AttachHide"] forState:UIControlStateNormal];
// [self.button setTitle:@"编辑" forState:UIControlStateNormal];
// [self.button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[self.contentView addSubview:self.button];
[self.contentView addSubview:self.subSview];
[self.contentView addSubview:self.SpLabel];
[self.contentView addSubview:self.DjLabel];
[self.contentView addSubview:self.BzslLabel];
[self.contentView addSubview:self.BzggLabel];
[self.contentView addSubview:self.HeardLabel];
// [self.contentView addSubview:self.FootLabel];
}
- (void)setTitleStr:(NSString *)str
{
self.SpLabel.text = str;
}
}
- (void)awakeFromNib {
// Initialization code
}
......
//
// ShopDetaileViewController.h
// XFFruit
//
// Created by mac on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "Survey.h"
@interface ShopDetaileViewController : ICRBaseViewController
@property (nonatomic,strong)Survey *survey;
@property (nonatomic,strong)NSString *navTitle;
@end
//
// ShopDetaileViewController.m
// XFFruit
//
// Created by mac on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ShopDetaileViewController.h"
#import "SurveyCell.h"
#import "HPGrowingTextView.h"
#import "StartTimeView.h"
#import "ChosePersonViewController.h"
#import "ChooseProductViewController.h"
#import "SurveyUser.h"
#import "Survey.h"
#import "Product.h"
#define LeftMargin 15
#define BtnHeight 44
#define TableHeight 46
#define CornerRadius 5
#define TitleSize 15
#define BtnSize 19
#define TotalHeight 432
#define KeyboardHeight 258
#define DateViewHeight 300
typedef enum : NSUInteger {
SaveTag = 2000,
CommitTag,
} BtnTag;
@interface ShopDetaileViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate,StartTimeViewDelegate>
{
UITableView *_tableView;
NSMutableArray *_dataArr;
UITextField *_titleField;
UILabel *_productLabel;
UILabel *_startDateLabel;
UILabel *_endDateLabel;
UILabel *_personLabel;
HPGrowingTextView *_noteTextView;
UIDatePicker *_timePicker;
BOOL _isClickStart;
StartTimeView *_startTimeView;
}
@property (nonatomic,strong)NSString *titleStr;
@property (nonatomic,strong)NSString *productCodeStr;
@property (nonatomic,strong)NSString *productNameStr;
@property (nonatomic,strong)NSString *productUuidStr;
@property (nonatomic,strong)NSString *beginDateStr;
@property (nonatomic,strong)NSString *endDateStr;
@property (nonatomic,strong)NSString *remarkStr;
@property (nonatomic,strong)NSMutableArray *users;
@end
@implementation ShopDetaileViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = self.navTitle;
[self initData];
// [self createTableView];
[self setupSubviews];
// Do any additional setup after loading the view.
}
- (void)initData{
_dataArr = [NSMutableArray array];
self.users = [NSMutableArray array];
[_dataArr addObject:@"商品"];
[_dataArr addObject:@"包装规格"];
[_dataArr addObject:@"包装数量"];
[_dataArr addObject:@"包装单位"];
[_dataArr addObject:@"基础数量"];
[_dataArr addObject:@"基础单价"];
[_dataArr addObject:@"包装单位"];
[_dataArr addObject:@"总金额"];
[_dataArr addObject:@"备注"];
}
-(void)setupSubviews
{
// self.view.backgroundColor = XXFBgColor;
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, 0,ScreenSize.width, ScreenSize.height - 64 - LeftMargin)) style:(UITableViewStylePlain)];
_tableView.backgroundColor = [UIColor whiteColor];
_tableView.bounces = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:HexColor(@"50bd62")];
[footView addSubview:saveBtn];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(saveBtn.frame.origin.x + saveBtn.frame.size.width + LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:HexColor(@"f69100")];
[footView addSubview:commitBtn];
// [self.view addSubview:footView];
_tableView.tableFooterView = footView;
[self.view addSubview:_tableView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - 按钮点击事件
- (void)btnClick:(UIButton *)btn{
switch (btn.tag) {
case SaveTag:
{
// if ([self checkSurvey]) {
// [self saveSurvey:@"initial" message:@"正在保存..."];
// }
}
break;
case CommitTag:
{
// if ([self checkSurvey]) {
// [self saveSurvey:@"submitted" message:@"正在提交..."];
// }
}
break;
default:
break;
}
}
- (BOOL)checkSurvey{
self.titleStr = _titleField.text;
self.remarkStr = _noteTextView.text;
if (self.titleStr.length == 0 || self.productUuidStr.length == 0 || self.productNameStr.length == 0|| self.productCodeStr.length == 0 || self.users.count <=0 || self.beginDateStr.length == 0 || self.endDateStr.length == 0) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示信息" message:@"信息不完整" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
return NO;
}
return YES;
}
#pragma mark - 保存
- (void)saveSurvey:(NSString *)state message:(NSString *)msg
{
//保存
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
[IBTLoadingView showTips:@"操作成功"];
[self clearAllInformation];
if (self.survey) {
[ICRUserUtil sharedInstance].needFresh = YES;
[self.navigationController popViewControllerAnimated:YES];
}
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
id uuidObject = [NSNull null];
if(self.survey.uuid.length > 0){
uuidObject = self.survey.uuid;
}
id billNumberObject = [NSNull null];
if (self.survey.billNumber > 0) {
billNumberObject = self.survey.billNumber;
}
NSNumber *version = [NSNumber numberWithLong:0];
if (self.survey) {
version = self.survey.version;
}
NSDictionary *dict = @{@"uuid":uuidObject,
@"version":version,
@"billnumber":billNumberObject,
@"title":[IBTCommon checkString:self.titleStr],
@"state":state,
@"productUuid":[IBTCommon checkString:self.productUuidStr],
@"productCode":[IBTCommon checkString:self.productCodeStr],
@"productName":[IBTCommon checkString:self.productNameStr],
@"beginDate":[IBTCommon checkString:self.beginDateStr],
@"endDate":[IBTCommon checkString:self.endDateStr],
@"remark":[IBTCommon checkString:self.remarkStr],
@"users":self.users};
[IBTLoadingView showProgressLabel:msg];
[[ICRHTTPController sharedController] saveSurveyWithAuthenticode:dict success:succ failure:fail];
}
- (void)clearAllInformation{
_titleField.text = @"";
_productLabel.text = @"请输入商品";
_productLabel.textColor = HexColor(@"bbbbbb");
_startDateLabel.text = @"选择日期";
_startDateLabel.textColor = HexColor(@"bbbbbb");
_endDateLabel.text = @"选择日期";
_endDateLabel.textColor = HexColor(@"bbbbbb");
_personLabel.text = @"选择调研人员";
_personLabel.textColor = HexColor(@"bbbbbb");
_noteTextView.text = @"";
//清空数据
self.titleStr = @"";
self.productCodeStr = @"";
self.productNameStr = @"";
self.productUuidStr = @"";
self.beginDateStr = @"";
self.endDateStr = @"";
[self.users removeAllObjects];
self.remarkStr = @"";
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return _dataArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
// if (indexPath.row == 0){
// return TableHeight*2;
// }else{
return TableHeight;
// }
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"cellID";
SurveyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.row==0||indexPath.row==3) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
[self createViewInCell:cell indexPath:indexPath];
}
[cell setTitleStr:_dataArr[indexPath.row]];
return cell;
}
- (void)createViewInCell:(SurveyCell *)cell indexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0||indexPath.row==3) {
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb");
contentLabel.font = FontSize(TitleSize);
[cell.contentView addSubview:contentLabel];
if (indexPath.row==0) {
contentLabel.text = @"选择商品";
_productLabel = contentLabel;
[self preferDataInProductLabel];
}else if (indexPath.row==3)
{
contentLabel.text = @"选择包装单位";
_productLabel = contentLabel;
[self preferDataInProductLabel];
}
}else
{
_titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
_titleField.textAlignment = NSTextAlignmentRight;
_titleField.textColor = HexColor(@"444444");
_titleField.placeholder = @"输入调研标题";
_titleField.font = FontSize(15);
_titleField.returnKeyType = UIReturnKeyDone;
_titleField.delegate = self;
[cell.contentView addSubview:_titleField];
if (indexPath.row==1) {
_titleField.placeholder = @"输入包装规格";
}else if (indexPath.row==2)
{
_titleField.placeholder = @"输入包装数量";
}else if (indexPath.row==4)
{
_titleField.placeholder = @"输入基础数量";
}else if (indexPath.row==5)
{
_titleField.placeholder = @"输入基础单价";
}else if (indexPath.row==6)
{
_titleField.placeholder = @"输入包装单价";
}else if (indexPath.row==7)
{
_titleField.placeholder = @"输入总金额";
}else if (indexPath.row==8)
{
_titleField.placeholder = @"输入备注内容";
}
// if (self.survey) {
// _titleField.text = [IBTCommon checkString:self.survey.title];
// self.titleStr = [IBTCommon checkString:self.survey.title];
// }
}
// _titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
// _titleField.textAlignment = NSTextAlignmentRight;
// _titleField.textColor = HexColor(@"444444");
// _titleField.placeholder = @"输入调研标题";
// _titleField.font = FontSize(15);
// _titleField.returnKeyType = UIReturnKeyDone;
// _titleField.delegate = self;
// [cell.contentView addSubview:_titleField];
// if (self.survey) {
// _titleField.text = [IBTCommon checkString:self.survey.title];
// self.titleStr = [IBTCommon checkString:self.survey.title];
// }
// }else if (indexPath.row == _dataArr.count -1){
// _noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
// _noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
// _noteTextView.minNumberOfLines = 1;
// _noteTextView.maxNumberOfLines = 4;
// _noteTextView.font = FontSize(15);
// _noteTextView.textAlignment = NSTextAlignmentRight;
// _noteTextView.delegate = self;
// _noteTextView.returnKeyType = UIReturnKeyDone;
// _noteTextView.placeholder = @"输入备注内容";
// [cell.contentView addSubview:_noteTextView];
// if (self.survey) {
// _noteTextView.text = [IBTCommon checkString:self.survey.remark];
// self.remarkStr = [IBTCommon checkString:self.survey.remark];
// }
// CGRect lineFrame = cell.lineLabel.frame;
// lineFrame.origin.y = TableHeight*2-1;
// cell.lineLabel.frame = lineFrame;
// }else{
// UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
// contentLabel.textAlignment= NSTextAlignmentRight;
// contentLabel.textColor = HexColor(@"bbbbbb");
// contentLabel.font = FontSize(TitleSize);
// [cell.contentView addSubview:contentLabel];
// if (indexPath.row == 1) {
// contentLabel.text = @"选择商品";
// _productLabel = contentLabel;
// [self preferDataInProductLabel];
// }else if(indexPath.row == 2){
// contentLabel.text = @"选择日期";
// _startDateLabel = contentLabel;
// if (self.survey) {
// if (self.survey.beginDate.length > 9) {
// _startDateLabel.text = [[IBTCommon checkString:self.survey.beginDate]substringToIndex:10];
// }
// _startDateLabel.textColor = HexColor(@"444444");
// self.beginDateStr =[IBTCommon checkString:self.survey.beginDate];
//
// }
// }else if(indexPath.row == 3){
// contentLabel.text = @"选择日期";
// _endDateLabel = contentLabel;
// if (self.survey) {
// if (self.survey.endDate.length > 9) {
// _endDateLabel.text = [[IBTCommon checkString:self.survey.endDate]substringToIndex:10];
// }
// _endDateLabel.textColor = HexColor(@"444444");
// self.endDateStr = [IBTCommon checkString:self.survey.endDate];
// }
// }else if(indexPath.row == 4){
// contentLabel.text = @"选择调研人员";
// _personLabel = contentLabel;
// [self preferDataInPersonLabel];
// }
// }
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 2 || indexPath.row == 3) {
[self keyboardHidden];
if (indexPath.row == 2) {
_isClickStart = YES;
}else{
_isClickStart = NO;
}
[self startDatePickView];
}else if(indexPath.row == 4){
ChosePersonViewController *cvc = [ChosePersonViewController new];
cvc.chosePerson = ^(NSArray *users){
NSString *textStr = @"";
if (self.users.count <=0) {
[self.users removeAllObjects];
}
for (SurveyUser *user in users) {
if (textStr.length == 0) {
textStr = [textStr stringByAppendingFormat:@"%@",user.userName];
}else {
textStr = [textStr stringByAppendingFormat:@"、%@",user.userName];
}
[self.users addObject:[user dictForCommit]];
}
_personLabel.text = textStr;
_personLabel.textColor = HexColor(@"444444");
};
cvc.isMoreChose = YES;
[self PushViewController:cvc animated:YES];
}else if(indexPath.row == 1){
ChooseProductViewController *cvc = [ChooseProductViewController new];
cvc.choseProduct = ^(Product *product){
_productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_productLabel.textColor = HexColor(@"444444");
self.productNameStr = product.name;
self.productUuidStr = product.uuid;
self.productCodeStr = product.code;
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
}
}
- (void)preferDataInPersonLabel{
if (self.survey) {
if (self.survey.users.count > 0) {
NSString *personStr = @"";
for (SurveyUser * surveyUser in self.survey.users) {
if (personStr.length == 0) {
personStr = [personStr stringByAppendingFormat:@"%@",surveyUser.userName];
}else {
personStr = [personStr stringByAppendingFormat:@"、%@",surveyUser.userName];
}
}
_personLabel.text = personStr;
_personLabel.textColor = HexColor(@"444444");
}
if (self.users > 0) {
[self.users addObjectsFromArray:self.survey.users];
}
}
}
- (void)preferDataInProductLabel{
if (self.survey) {
_productLabel.text = [IBTCommon checkString:self.survey.productName];
_productLabel.textColor = HexColor(@"444444");
self.productCodeStr = [IBTCommon checkString:self.survey.productCode];
self.productNameStr = [IBTCommon checkString:self.survey.productName];
self.productUuidStr = [IBTCommon checkString:self.survey.productUuid];
}
}
- (void)startDatePickView{
if (!_startTimeView) {
_startTimeView = [[StartTimeView alloc] initWithFrame:CGRectMake(0, ScreenSize.height, ScreenSize.width, ScreenSize.height - 64)];
_startTimeView.delegate = self;
_startTimeView.backgroundColor = RGBA(0, 0, 0 ,0.5);
[self.view addSubview:_startTimeView];
[UIView animateWithDuration:0.15 animations:^{
CGRect startFrame = _startTimeView.frame;
startFrame.origin.y = 0;
_startTimeView.frame = startFrame;
} completion:^(BOOL finished) {
}];
}
}
- (void)cancelTimeView{
[self clearDatePickView];
}
- (void)okTimeView:(NSDate *)time{
if (_isClickStart) {
_startDateLabel.textColor = HexColor(@"444444");
_startDateLabel.text = [IBTCommon stringFromDate:time];
self.beginDateStr = [time httpParameterString];
}else{
_endDateLabel.textColor = HexColor(@"444444");
_endDateLabel.text = [IBTCommon stringFromDate:time];
self.endDateStr = [time httpParameterString];
}
// 关闭选择器
[self clearDatePickView];
}
#pragma mark - 取消
- (void)clearDatePickView{
[UIView animateWithDuration:0.15 animations:^{
CGRect startFrame = _startTimeView.frame;
startFrame.origin.y = ScreenSize.height;
_startTimeView.frame = startFrame;
} completion:^(BOOL finished) {
[_startTimeView removeFromSuperview];
_startTimeView = nil;
}];
}
#pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[_noteTextView resignFirstResponder];
[self setTableFrame:LeftMargin];
return YES;
}
- (void)growingTextViewDidBeginEditing:(HPGrowingTextView *)growingTextView{
CGFloat offset = ScreenSize.height - TotalHeight - KeyboardHeight;
if (offset < 0) {//上移
[self setTableFrame:LeftMargin+offset];
}
}
- (void)setTableFrame:(CGFloat)tabelH{
[UIView animateWithDuration:0.25 animations:^{
CGRect tableFrame = _tableView.frame;
tableFrame.origin.y = tabelH;
_tableView.frame = tableFrame;
}];
}
- (void)keyboardHidden{
[_titleField resignFirstResponder];
[_noteTextView resignFirstResponder];
[self setTableFrame:LeftMargin];
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
}
/*
#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
......@@ -50,6 +50,8 @@
"Survey7" = "新建发运单";
"Survey8" = "查看发运单";
"Survey9" = "新建加工单";
"EditorShopDetail" ="编辑商品明细";
"AddShopDetail" ="添加商品明细";
// Store
"Store" = "门店";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment