Commit 9454d75b authored by 陈俊俊's avatar 陈俊俊

部分细节修改

parent 5fe58fc7
This diff is collapsed.
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#import "NewSurveyViewController.h" #import "NewSurveyViewController.h"
#import "SurveyViewController.h" #import "SurveyViewController.h"
#import "AddWorkSheetViewController.h"
#import "ICRFunctionBaseView.h" #import "ICRFunctionBaseView.h"
#import "ICRFunctionEntity.h" #import "ICRFunctionEntity.h"
......
...@@ -32,9 +32,10 @@ ...@@ -32,9 +32,10 @@
CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (self.arr.count -1))/self.arr.count; CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (self.arr.count -1))/self.arr.count;
for (NSInteger i = 0; i < self.arr.count; i++) { for (NSInteger i = 0; i < self.arr.count; i++) {
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i, 0, headWidth, self.frame.size.height)]; UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i, 0, headWidth, self.frame.size.height)];
label.font = GXF_FIFTEENTEN_SIZE; label.font = GXF_FOURTEENTH_SIZE;
label.textAlignment = NSTextAlignmentLeft; label.textAlignment = NSTextAlignmentCenter;
label.textColor = GXF_PLACEHOLDER_COLOR; label.textColor = GXF_PLACEHOLDER_COLOR;
// label.backgroundColor = [UIColor redColor];
label.text = self.arr[i]; label.text = self.arr[i];
[self addSubview:label]; [self addSubview:label];
} }
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#import "NewSurveyViewController.h" #import "NewSurveyViewController.h"
#import "SurveyViewController.h" #import "SurveyViewController.h"
#import "AddWorkSheetViewController.h"
#import "NewPurchaseViewController.h" #import "NewPurchaseViewController.h"
#import "NewPurchaseNoticeViewController.h" #import "NewPurchaseNoticeViewController.h"
#import "SeePurchaseNoticeViewController.h" #import "SeePurchaseNoticeViewController.h"
......
...@@ -45,19 +45,19 @@ ...@@ -45,19 +45,19 @@
self.seqLabel.font = GXF_SIXTEENTEH_SIZE; self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))]; self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
self.titleLabel.textAlignment = NSTextAlignmentLeft; self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.textColor = GXF_CONTENT_COLOR; self.titleLabel.textColor = GXF_CONTENT_COLOR;
self.titleLabel.text = @"苹果桃子"; self.titleLabel.text = @"苹果桃子";
self.titleLabel.font = GXF_SIXTEENTEH_SIZE; self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))]; self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.priceLabel.textAlignment = NSTextAlignmentLeft; self.priceLabel.textAlignment = NSTextAlignmentCenter;
self.priceLabel.textColor = GXF_CONTENT_COLOR; self.priceLabel.textColor = GXF_CONTENT_COLOR;
self.priceLabel.text = @"80"; self.priceLabel.text = @"80";
self.priceLabel.font = GXF_SIXTEENTEH_SIZE; self.priceLabel.font = GXF_SIXTEENTEH_SIZE;
self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))]; self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.countLabel.textAlignment = NSTextAlignmentLeft; self.countLabel.textAlignment = NSTextAlignmentCenter;
self.countLabel.text = @"200"; self.countLabel.text = @"200";
self.countLabel.textColor = GXF_CONTENT_COLOR; self.countLabel.textColor = GXF_CONTENT_COLOR;
self.countLabel.font = GXF_SIXTEENTEH_SIZE; self.countLabel.font = GXF_SIXTEENTEH_SIZE;
...@@ -142,11 +142,11 @@ ...@@ -142,11 +142,11 @@
{ {
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)]; self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.titleLabel.text = billProduct.product_name; self.titleLabel.text = billProduct.product_name;
self.priceLabel.text = [billProduct.price stringValue]; self.priceLabel.text = [NSString stringWithFormat:@"%@元",billProduct.price];
self.countLabel.text = [billProduct.qty stringValue]; self.countLabel.text = [NSString stringWithFormat:@"%@%@",billProduct.qty,billProduct.unit];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@",billProduct.qpc]; self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@",billProduct.qpc];
self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",billProduct.baseQty,billProduct.unit]; self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",billProduct.qty,billProduct.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",billProduct.qty,@"斤"]; self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",billProduct.baseQty,@"斤"];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",billProduct.price]; self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",billProduct.price];
self.showBasePriceLabel.text = [NSString stringWithFormat:@"基础单价:%@元",billProduct.basePrice]; self.showBasePriceLabel.text = [NSString stringWithFormat:@"基础单价:%@元",billProduct.basePrice];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",billProduct.total]; self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",billProduct.total];
......
...@@ -412,12 +412,12 @@ typedef enum : NSUInteger { ...@@ -412,12 +412,12 @@ typedef enum : NSUInteger {
NoticeProduct *noticeProduct=[_shopeArr objectAtIndex:indexPath.row]; NoticeProduct *noticeProduct=[_shopeArr objectAtIndex:indexPath.row];
Cell.SpLabel.text=noticeProduct.productName;//商品 Cell.SpLabel.text=noticeProduct.productName;//商品
Cell.BzggLabel.text=[noticeProduct.qpc stringValue];//包装规格 Cell.BzggLabel.text= [NSString stringWithFormat:@"1*%@%@",noticeProduct.qpc,@"斤"];//包装规格
Cell.packageUnit.text=noticeProduct.packUnit;//包装单位 Cell.packageUnit.text=noticeProduct.packUnit;//包装单位
Cell.BzslLabel.text=[noticeProduct.qpcQuantity stringValue];//包装数量 Cell.BzslLabel.text=[NSString stringWithFormat:@"%@%@",noticeProduct.qpcQuantity,noticeProduct.packUnit];//包装数量
Cell.packageQuantity.text=[noticeProduct.qpcQuantity stringValue]; Cell.packageQuantity.text=[NSString stringWithFormat:@"%@%@",noticeProduct.qpcQuantity,noticeProduct.packUnit];
Cell.packageSpecification.text=[noticeProduct.qpc stringValue];//包装规格 Cell.packageSpecification.text=[NSString stringWithFormat:@"1*%@%@",noticeProduct.qpc,@"斤"];//包装规格
Cell.foundationQuantity.text=[noticeProduct.quantity stringValue];//基础数量 Cell.foundationQuantity.text= [NSString stringWithFormat:@"%@%@",noticeProduct.quantity,@"斤"];//基础数量
Cell.remark.text=noticeProduct.remark;//备注 Cell.remark.text=noticeProduct.remark;//备注
} }
......
...@@ -493,14 +493,22 @@ typedef enum : NSUInteger { ...@@ -493,14 +493,22 @@ typedef enum : NSUInteger {
NoticeProduct *noticeProduct=[_shopeArr objectAtIndex:indexPath.row]; NoticeProduct *noticeProduct=[_shopeArr objectAtIndex:indexPath.row];
Cell.SpLabel.text=noticeProduct.productName;//商品 Cell.SpLabel.text=noticeProduct.productName;//商品
Cell.BzggLabel.text=[noticeProduct.qpc stringValue];//包装规格 Cell.BzggLabel.text= [NSString stringWithFormat:@"1*%@%@",noticeProduct.qpc,@"斤"];//包装规格
Cell.BzslLabel.text=[noticeProduct.qpcQuantity stringValue];//包装数量 Cell.packageUnit.text=noticeProduct.packUnit;//包装单位
Cell.packageSpecification.text=[noticeProduct.qpc stringValue];//包装规格 Cell.BzslLabel.text=[NSString stringWithFormat:@"%@%@",noticeProduct.qpcQuantity,noticeProduct.packUnit];//包装数量
Cell.packageQuantity.text=[NSString stringWithFormat:@"%@%@",noticeProduct.qpcQuantity,noticeProduct.packUnit];
Cell.packageSpecification.text=[NSString stringWithFormat:@"1*%@%@",noticeProduct.qpc,@"斤"];//包装规格
Cell.foundationQuantity.text= [NSString stringWithFormat:@"%@%@",noticeProduct.quantity,@"斤"];//基础数量
Cell.BzggLabel.text=[NSString stringWithFormat:@"1*%@%@",noticeProduct.qpc,@"斤"];//包装规格
Cell.BzslLabel.text=[NSString stringWithFormat:@"%@%@",noticeProduct.qpcQuantity,noticeProduct.packUnit];//包装数量
Cell.packageSpecification.text=[NSString stringWithFormat:@"1*%@%@",noticeProduct.qpc,@"斤"];//包装规格
Cell.YcgslLabel.text=[noticeProduct.purchasedQuantity stringValue];//已采购数量 Cell.YcgslLabel.text=[noticeProduct.purchasedQuantity stringValue];//已采购数量
Cell.packageUnit.text=noticeProduct.packUnit;//包装单位 Cell.packageUnit.text=noticeProduct.packUnit;//包装单位
Cell.packageQuantity.text=[noticeProduct.qpcQuantity stringValue];//包装数量 Cell.packageQuantity.text=[NSString stringWithFormat:@"%@%@",noticeProduct.qpcQuantity,noticeProduct.packUnit];//包装数量
Cell.YcgslLabel.text=[noticeProduct.purchasedQuantity stringValue];//已采购数量 Cell.YcgslLabel.text=[noticeProduct.purchasedQuantity stringValue];//已采购数量
Cell.foundationQuantity.text=[noticeProduct.quantity stringValue];//基础数量 Cell.foundationQuantity.text=[NSString stringWithFormat:@"%@%@",noticeProduct.quantity,@"斤"];//基础数量
Cell.remark.text=noticeProduct.remark;//备注 Cell.remark.text=noticeProduct.remark;//备注
if (Cell.YcgslLabel.text==nil) { if (Cell.YcgslLabel.text==nil) {
Cell.YcgslLabel.text=@"暂无";//已采购数量 Cell.YcgslLabel.text=@"暂无";//已采购数量
......
...@@ -33,11 +33,16 @@ typedef enum : NSUInteger { ...@@ -33,11 +33,16 @@ typedef enum : NSUInteger {
UITextField *_qpcField; UITextField *_qpcField;
UITextField *_qpcQuantityField; UITextField *_qpcQuantityField;
UITextField *_quantityField; UITextField *_quantityField;
UILabel *_packCountLabel;
UILabel *_qpcLabel;
UILabel *_baseCountLabel;
HPGrowingTextView *_noteTextView; HPGrowingTextView *_noteTextView;
} }
@property (nonatomic,strong)NSString *productNameStr; @property (nonatomic,strong)NSString *productNameStr;
@property (nonatomic,strong)NSString *productCodeStr; @property (nonatomic,strong)NSString *productCodeStr;
@property (nonatomic,strong)NSString *productUuidStr; @property (nonatomic,strong)NSString *productUuidStr;
@property (nonatomic,strong)NSString *productQpcStr;//商品规格描述
@end @end
@implementation NoticeProductViewController @implementation NoticeProductViewController
...@@ -87,14 +92,12 @@ typedef enum : NSUInteger { ...@@ -87,14 +92,12 @@ typedef enum : NSUInteger {
switch (btn.tag) { switch (btn.tag) {
case deleteTag://删除 case deleteTag://删除
{ {
if ([self checkCost]) {
if (self.indexPath) { if (self.indexPath) {
self.deleteNoticeProduct(self.noticeProduct,self.indexPath); self.deleteNoticeProduct(self.noticeProduct,self.indexPath);
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
}else{ }else{
[self clearInfomation]; [self clearInfomation];
} }
}
} }
break; break;
case SaveTag: case SaveTag:
...@@ -117,13 +120,18 @@ typedef enum : NSUInteger { ...@@ -117,13 +120,18 @@ typedef enum : NSUInteger {
_qpcField.text = @""; _qpcField.text = @"";
_qpcQuantityField.text = @""; _qpcQuantityField.text = @"";
_quantityField.text = @""; _quantityField.text = @"";
_noteTextView.text = @"";
} }
- (BOOL)checkCost{ - (BOOL)checkCost{
if (_chooseCostLabel.text.length == 0 ) { if (_chooseCostLabel.text.length == 0 || [_chooseCostLabel.text isEqualToString:@"选择商品"] ) {
ShowMessage(@"商品不能为空"); ShowMessage(@"商品不能为空");
return NO; return NO;
} }
if (_choosePackUnitLabel.text.length == 0 || [_choosePackUnitLabel.text isEqualToString:@"选择包装单位"] ) {
ShowMessage(@"包装单位不能为空");
return NO;
}
if (_qpcField.text.length == 0 ) { if (_qpcField.text.length == 0 ) {
ShowMessage(@"包装规格不能为空"); ShowMessage(@"包装规格不能为空");
return NO; return NO;
...@@ -202,7 +210,7 @@ typedef enum : NSUInteger { ...@@ -202,7 +210,7 @@ typedef enum : NSUInteger {
_noteTextView.placeholder = @"输入备注内容"; _noteTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:_noteTextView]; [cell.contentView addSubview:_noteTextView];
}else{ }else{
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableRowHeight)]; UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableRowHeight)];
textField.textAlignment = NSTextAlignmentRight; textField.textAlignment = NSTextAlignmentRight;
textField.textColor = GXF_CONTENT_COLOR; textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE; textField.font = GXF_FIFTEENTEN_SIZE;
...@@ -210,13 +218,22 @@ typedef enum : NSUInteger { ...@@ -210,13 +218,22 @@ typedef enum : NSUInteger {
textField.keyboardType = UIKeyboardTypeDecimalPad; textField.keyboardType = UIKeyboardTypeDecimalPad;
textField.delegate = self; textField.delegate = self;
[cell.contentView addSubview:textField]; [cell.contentView addSubview:textField];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame)+ 5, 0, 20, TableRowHeight)];
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
if (indexPath.row == 2) { if (indexPath.row == 2) {
_qpcLabel = label;
textField.placeholder = @"输入包装规格"; textField.placeholder = @"输入包装规格";
_qpcField = textField; _qpcField = textField;
}else if(indexPath.row == 3){ }else if(indexPath.row == 3){
_packCountLabel = label;
textField.placeholder = @"输入包装数量"; textField.placeholder = @"输入包装数量";
_qpcQuantityField = textField; _qpcQuantityField = textField;
}else{ }else{
_baseCountLabel = label;
textField.placeholder = @"输入基础数量"; textField.placeholder = @"输入基础数量";
_quantityField = textField; _quantityField = textField;
} }
...@@ -253,6 +270,8 @@ typedef enum : NSUInteger { ...@@ -253,6 +270,8 @@ typedef enum : NSUInteger {
self.productNameStr = product.name; self.productNameStr = product.name;
self.productUuidStr = product.uuid; self.productUuidStr = product.uuid;
self.productCodeStr = product.code; self.productCodeStr = product.code;
_qpcLabel.text = product.measureUnit ? product.measureUnit : @"斤";
_baseCountLabel.text = _qpcLabel.text;
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES]; [self PushViewController:cvc animated:YES];
...@@ -263,6 +282,7 @@ typedef enum : NSUInteger { ...@@ -263,6 +282,7 @@ typedef enum : NSUInteger {
GXFProductUnit *productUnit=products [0]; GXFProductUnit *productUnit=products [0];
_choosePackUnitLabel.text = [NSString stringWithFormat:@"%@",productUnit.name]; _choosePackUnitLabel.text = [NSString stringWithFormat:@"%@",productUnit.name];
_choosePackUnitLabel.textColor = GXF_CONTENT_COLOR; _choosePackUnitLabel.textColor = GXF_CONTENT_COLOR;
_packCountLabel.text = productUnit.name;
} }
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
......
...@@ -176,17 +176,17 @@ typedef enum : NSUInteger { ...@@ -176,17 +176,17 @@ typedef enum : NSUInteger {
} }
- (void)clearShopDetail - (void)clearShopDetail
{ {
_productLabel.text=@"选择商品";//商品 _productLabel.text = @"选择商品";//商品
_PackagingLable.text=@"选择包装单位";//包装单位 _PackagingLable.text = @"选择包装单位";//包装单位
packageSpecification.text=@"";//包装规格 packageSpecification.text = @"";//包装规格
packageQuantity.text=@""; //包装数量 packageQuantity.text = @""; //包装数量
foundationQuantity.text=@""; //基础数量 foundationQuantity.text = @"0"; //基础数量
foundationUnitPrice.text=@""; //基础单价 foundationUnitPrice.text = @""; //基础单价
packageUnitPrice.text=@""; //包装单价 packageUnitPrice.text = @"0"; //包装单价
totalMoney.text=@"0"; //总金额 totalMoney.text = @"0"; //总金额
remark.text=@""; remark.text = @"";
_productLabel.textColor=GXF_PLACEHOLDER_COLOR; _productLabel.textColor=GXF_PLACEHOLDER_COLOR;
_PackagingLable.textColor=GXF_PLACEHOLDER_COLOR; _PackagingLable.textColor=GXF_PLACEHOLDER_COLOR;
} }
...@@ -306,6 +306,7 @@ typedef enum : NSUInteger { ...@@ -306,6 +306,7 @@ typedef enum : NSUInteger {
textField.textColor = GXF_CONTENT_COLOR; textField.textColor = GXF_CONTENT_COLOR;
textField.font = FontSize(15); textField.font = FontSize(15);
textField.returnKeyType = UIReturnKeyDone; textField.returnKeyType = UIReturnKeyDone;
textField.keyboardType = UIKeyboardTypeDecimalPad;
textField.delegate = self; textField.delegate = self;
[cell.contentView addSubview:textField]; [cell.contentView addSubview:textField];
......
...@@ -82,14 +82,12 @@ typedef enum : NSUInteger { ...@@ -82,14 +82,12 @@ typedef enum : NSUInteger {
switch (btn.tag) { switch (btn.tag) {
case deleteTag://删除 case deleteTag://删除
{ {
if ([self checkCost]) {
if (self.indexPath) { if (self.indexPath) {
self.deleteTransportCost(self.accountDetail,self.indexPath); self.deleteTransportCost(self.accountDetail,self.indexPath);
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
}else{ }else{
[self clearInfomation]; [self clearInfomation];
} }
}
} }
break; break;
case SaveTag: case SaveTag:
...@@ -109,11 +107,12 @@ typedef enum : NSUInteger { ...@@ -109,11 +107,12 @@ typedef enum : NSUInteger {
_chooseCostLabel.textColor = GXF_PLACEHOLDER_COLOR; _chooseCostLabel.textColor = GXF_PLACEHOLDER_COLOR;
_actualmoneyField.text = @""; _actualmoneyField.text = @"";
_paidmoneyField.text = @""; _paidmoneyField.text = @"";
_leftmoneyField.text = @""; _leftmoneyField.text = @"0";
_noteTextView.text = @"";
} }
- (BOOL)checkCost{ - (BOOL)checkCost{
if (_chooseCostLabel.text.length == 0 ) { if (_chooseCostLabel.text.length == 0 || [_chooseCostLabel.text isEqualToString:@"选择费用类型"] ) {
ShowMessage(@"费用类型不能为空"); ShowMessage(@"费用类型不能为空");
return NO; return NO;
} }
...@@ -125,10 +124,14 @@ typedef enum : NSUInteger { ...@@ -125,10 +124,14 @@ typedef enum : NSUInteger {
ShowMessage(@"已付金额不能为空"); ShowMessage(@"已付金额不能为空");
return NO; return NO;
} }
if (_leftmoneyField.text.length == 0) { if (_leftmoneyField.text.length == 0 ) {
ShowMessage(@"尾款不能为空"); ShowMessage(@"尾款不能为空");
return NO; return NO;
} }
if ([_leftmoneyField.text floatValue] <= 0) {
ShowMessage(@"检查应付金额和已付金额是否正确");
return NO;
}
if (!self.accountDetail) { if (!self.accountDetail) {
self.accountDetail = [[FeeAcountDetail alloc]init]; self.accountDetail = [[FeeAcountDetail alloc]init];
} }
...@@ -187,7 +190,7 @@ typedef enum : NSUInteger { ...@@ -187,7 +190,7 @@ typedef enum : NSUInteger {
_noteTextView.placeholder = @"输入备注内容"; _noteTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:_noteTextView]; [cell.contentView addSubview:_noteTextView];
}else{ }else{
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableRowHeight)]; UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableRowHeight)];
textField.textAlignment = NSTextAlignmentRight; textField.textAlignment = NSTextAlignmentRight;
textField.textColor = GXF_CONTENT_COLOR; textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE; textField.font = GXF_FIFTEENTEN_SIZE;
...@@ -195,14 +198,25 @@ typedef enum : NSUInteger { ...@@ -195,14 +198,25 @@ typedef enum : NSUInteger {
textField.keyboardType = UIKeyboardTypeDecimalPad; textField.keyboardType = UIKeyboardTypeDecimalPad;
textField.delegate = self; textField.delegate = self;
[cell.contentView addSubview:textField]; [cell.contentView addSubview:textField];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame)+ 5, 0, 20, TableRowHeight)];
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
label.text = @"元";
[cell.contentView addSubview:label];
if (indexPath.row == 1) { if (indexPath.row == 1) {
textField.placeholder = @"输入应付金额"; textField.placeholder = @"输入应付金额";
[textField addTarget:self action:@selector(textChange:) forControlEvents:UIControlEventAllEditingEvents];
_actualmoneyField = textField; _actualmoneyField = textField;
}else if(indexPath.row == 2){ }else if(indexPath.row == 2){
[textField addTarget:self action:@selector(textChange:) forControlEvents:UIControlEventAllEditingEvents];
textField.placeholder = @"输入已付金额"; textField.placeholder = @"输入已付金额";
_paidmoneyField = textField; _paidmoneyField = textField;
}else{ }else{
textField.placeholder = @"输入尾款"; [textField setEnabled:NO];
textField.text = @"0";
textField.textColor = [UIColor redColor];
_leftmoneyField = textField; _leftmoneyField = textField;
} }
} }
...@@ -220,6 +234,13 @@ typedef enum : NSUInteger { ...@@ -220,6 +234,13 @@ typedef enum : NSUInteger {
_noteTextView.text = self.accountDetail.note; _noteTextView.text = self.accountDetail.note;
} }
- (void)textChange:(UITextField *)textField{
if (_actualmoneyField.text.length > 0 && _paidmoneyField.text.length > 0 ) {
_leftmoneyField.text = [NSString stringWithFormat:@"%.1f",[_actualmoneyField.text floatValue] - [_paidmoneyField.text floatValue]];
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableRowHeight; return TableRowHeight;
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
- (void)bulidLayout - (void)bulidLayout
{ {
CGFloat headWidth = (ScreenSize.width - LeftWidth - RightWidth - SpaceMargin* (4 -1))/4; CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (4 -1))/4;
self.smallImageView = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)]; self.smallImageView = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)];
self.smallImageView.image = [UIImage imageNamed:@"arrowright"]; self.smallImageView.image = [UIImage imageNamed:@"arrowright"];
...@@ -38,25 +38,25 @@ ...@@ -38,25 +38,25 @@
self.seqLabel.font = GXF_SIXTEENTEH_SIZE; self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
self.typeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))]; self.typeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
self.typeLabel.textAlignment = NSTextAlignmentLeft; self.typeLabel.textAlignment = NSTextAlignmentCenter;
self.typeLabel.textColor = GXF_CONTENT_COLOR; self.typeLabel.textColor = GXF_CONTENT_COLOR;
self.typeLabel.text = @"苹果桃子"; self.typeLabel.text = @"苹果桃子";
self.typeLabel.font = GXF_SIXTEENTEH_SIZE; self.typeLabel.font = GXF_SIXTEENTEH_SIZE;
self.actualLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.typeLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))]; self.actualLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.typeLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.actualLabel.textAlignment = NSTextAlignmentLeft; self.actualLabel.textAlignment = NSTextAlignmentCenter;
self.actualLabel.textColor = GXF_CONTENT_COLOR; self.actualLabel.textColor = GXF_CONTENT_COLOR;
self.actualLabel.text = @"30000"; self.actualLabel.text = @"30000";
self.actualLabel.font = GXF_SIXTEENTEH_SIZE; self.actualLabel.font = GXF_SIXTEENTEH_SIZE;
self.paidLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.actualLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))]; self.paidLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.actualLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.paidLabel.textAlignment = NSTextAlignmentLeft; self.paidLabel.textAlignment = NSTextAlignmentCenter;
self.paidLabel.text = @"2015-04-05"; self.paidLabel.text = @"2015-04-05";
self.paidLabel.textColor = GXF_CONTENT_COLOR; self.paidLabel.textColor = GXF_CONTENT_COLOR;
self.paidLabel.font = GXF_SIXTEENTEH_SIZE; self.paidLabel.font = GXF_SIXTEENTEH_SIZE;
self.leftLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.paidLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))]; self.leftLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.paidLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.leftLabel.textAlignment = NSTextAlignmentLeft; self.leftLabel.textAlignment = NSTextAlignmentCenter;
self.leftLabel.text = @"2015-04-05"; self.leftLabel.text = @"2015-04-05";
self.leftLabel.textColor = GXF_CONTENT_COLOR; self.leftLabel.textColor = GXF_CONTENT_COLOR;
self.leftLabel.font = GXF_SIXTEENTEH_SIZE; self.leftLabel.font = GXF_SIXTEENTEH_SIZE;
...@@ -83,9 +83,9 @@ ...@@ -83,9 +83,9 @@
{ {
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)]; self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.typeLabel.text = fee.accounttitle; self.typeLabel.text = fee.accounttitle;
self.actualLabel.text = [fee.actualmoney stringValue]; self.actualLabel.text = [NSString stringWithFormat:@"%@元",[fee.actualmoney stringValue]];
self.paidLabel.text = [fee.paidmoney stringValue]; self.paidLabel.text = [NSString stringWithFormat:@"%@元",[fee.paidmoney stringValue]];
self.leftLabel.text = [fee.leftmoney stringValue]; self.leftLabel.text = [NSString stringWithFormat:@"%@元",[fee.leftmoney stringValue]];
} }
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
...@@ -46,19 +46,19 @@ ...@@ -46,19 +46,19 @@
self.seqLabel.font = GXF_SIXTEENTEH_SIZE; self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))]; self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
self.titleLabel.textAlignment = NSTextAlignmentLeft; self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.textColor = GXF_CONTENT_COLOR; self.titleLabel.textColor = GXF_CONTENT_COLOR;
self.titleLabel.text = @"苹果桃子"; self.titleLabel.text = @"苹果桃子";
self.titleLabel.font = GXF_SIXTEENTEH_SIZE; self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))]; self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.priceLabel.textAlignment = NSTextAlignmentLeft; self.priceLabel.textAlignment = NSTextAlignmentCenter;
self.priceLabel.textColor = GXF_CONTENT_COLOR; self.priceLabel.textColor = GXF_CONTENT_COLOR;
self.priceLabel.text = @"80"; self.priceLabel.text = @"80";
self.priceLabel.font = GXF_SIXTEENTEH_SIZE; self.priceLabel.font = GXF_SIXTEENTEH_SIZE;
self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))]; self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.countLabel.textAlignment = NSTextAlignmentLeft; self.countLabel.textAlignment = NSTextAlignmentCenter;
self.countLabel.text = @"200"; self.countLabel.text = @"200";
self.countLabel.textColor = GXF_CONTENT_COLOR; self.countLabel.textColor = GXF_CONTENT_COLOR;
self.countLabel.font = GXF_SIXTEENTEH_SIZE; self.countLabel.font = GXF_SIXTEENTEH_SIZE;
...@@ -143,11 +143,11 @@ ...@@ -143,11 +143,11 @@
- (void)setPdtDetail:(TransportPdtDetail *)pdtDetail row:(NSInteger)row{ - (void)setPdtDetail:(TransportPdtDetail *)pdtDetail row:(NSInteger)row{
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)]; self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.titleLabel.text = pdtDetail.productName; self.titleLabel.text = pdtDetail.productName;
self.priceLabel.text = [pdtDetail.price stringValue]; self.priceLabel.text = [NSString stringWithFormat:@"%@元",[pdtDetail.price stringValue]];
self.countLabel.text = [pdtDetail.qty stringValue]; self.countLabel.text = [NSString stringWithFormat:@"%@%@",pdtDetail.qty,pdtDetail.unit];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@",pdtDetail.qpc]; self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@",pdtDetail.qpc];
self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",pdtDetail.baseQty,pdtDetail.unit]; self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",pdtDetail.qty,pdtDetail.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",pdtDetail.qty,@"斤"]; self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",pdtDetail.baseQty,@"斤"];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",pdtDetail.price]; self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",pdtDetail.price];
self.showPurchaseLabel.text = [NSString stringWithFormat:@"采购单号:%@",pdtDetail.purchasebillnumber.length > 0 ? pdtDetail.purchasebillnumber: @"无"]; self.showPurchaseLabel.text = [NSString stringWithFormat:@"采购单号:%@",pdtDetail.purchasebillnumber.length > 0 ? pdtDetail.purchasebillnumber: @"无"];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",pdtDetail.total]; self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",pdtDetail.total];
......
//
// AddWorkSheetViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/12.
// Copyright (c) 2015年 Xummer. All rights reserved.
// 新建加工单
#import "ICRBaseViewController.h"
@interface AddWorkSheetViewController : ICRBaseViewController
@end
//
// AddWorkSheetViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/12.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "AddWorkSheetViewController.h"
#import "TopSheetView.h"
#import "BottomSheetView.h"
#define TopHeight 284
#define BottomHeight 300
#define SpaceHeight 20
#define BottomViewHeight 60
typedef enum : NSUInteger {
SaveTag = 7000,
CommitTag,
} BtnTag;
@interface AddWorkSheetViewController ()<TopSheetViewDelegate,UIScrollViewDelegate>
{
UIScrollView *_scrollView;
TopSheetView *_sheetView;
BottomSheetView *_bottomView;
}
@end
@implementation AddWorkSheetViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"加工单";
//布局
[self bulidLayout];
}
- (void)bulidLayout{
self.view.backgroundColor = XXFBgColor;
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0, ScreenSize.width, ScreenSize.height- 64 - BottomViewHeight )];
_scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, TopHeight+ BottomHeight + SpaceHeight*2);
[self.view addSubview:_scrollView];
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, ScreenSize.height - BottomViewHeight - 64, ScreenSize.width, BottomViewHeight)];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[footView addSubview:saveBtn];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(saveBtn.frame) + 15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[footView addSubview:commitBtn];
[self.view addSubview:footView];
_sheetView = [[TopSheetView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TopHeight)];
_sheetView.delegate = self;
[_scrollView addSubview:_sheetView];
_bottomView = [[BottomSheetView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_sheetView.frame) + 20, ScreenSize.width,BottomHeight)];
_bottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_bottomView];
}
- (void)btnClick:(UIButton *)btn{
}
#pragma mark - 协议方法
- (void)hiddenKeyBoard{
[self keyboardHidden];
}
- (void)keyboardHidden{
[_sheetView.titleTextFiled resignFirstResponder];
[_sheetView.peopleTextFiled resignFirstResponder];
[_sheetView.peopleTextFiled resignFirstResponder];
[_sheetView.phoneTextFiled resignFirstResponder];
[_sheetView.remarkTextView resignFirstResponder];
}
- (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
//
// GoodsViewController.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface GoodsViewController : ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *goodsArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame;
@end
//
// GoodsViewController.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GoodsViewController.h"
#import "HeaderCell.h"
#import "FooterCell.h"
@interface GoodsViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
{
CGRect _tableFrame;
}
@end
@implementation GoodsViewController
- (void)viewDidLoad {
self.view.backgroundColor = XXFBgColor;
[super viewDidLoad];
_goodsArr = [NSMutableArray array];
[self createView];
}
- (void)setViewFrame:(CGRect)viewFrame{
_tableFrame = viewFrame;
}
- (void)createView{
self.tableView = [[UITableView alloc]initWithFrame:_tableFrame style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
NSArray *arr = @[@"原料",@"基础数量",@"出库时间"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
[self.view addSubview:headCell];
self.tableView.tableHeaderView = headCell;
FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加原料明细" isTwo:@""];
[self.view addSubview:footCell];
footCell.delegate = self;
self.tableView.tableFooterView = footCell;
}
- (void)addClick{
[self.goodsArr addObject:@"dddd"];
[self.tableView reloadData];
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.goodsArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"cellID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
cell.textLabel.text = @"3333333";
return cell;
}
/*
#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
//
// MaterialVIewController.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface MaterialVIewController : ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *meterialArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame;
@end
//
// MaterialVIewController.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "MaterialVIewController.h"
#import "HeaderCell.h"
#import "FooterCell.h"
#import "MaterialCell.h"
#define TableHeight 44
@interface MaterialVIewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
{
CGRect _tableFrame;
NSInteger _currentRow;
BOOL isFirst;
}
@end
@implementation MaterialVIewController
- (void)viewDidLoad {
self.view.backgroundColor = XXFBgColor;
[super viewDidLoad];
isFirst = YES;
_meterialArr = [NSMutableArray array];
[self createView];
}
- (void)setViewFrame:(CGRect)viewFrame{
_tableFrame = viewFrame;
}
- (void)createView{
self.tableView = [[UITableView alloc]initWithFrame:_tableFrame style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
NSArray *arr = @[@"原料",@"基础数量",@"入库时间"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
[self.view addSubview:headCell];
self.tableView.tableHeaderView = headCell;
//
// FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加原料明细" ];
// [self.view addSubview:footCell];
// footCell.delegate = self;
// self.tableView.tableFooterView = footCell;
}
- (void)addClick{
[self.meterialArr addObject:@"dddd"];
[self.tableView reloadData];
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.meterialArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaterialCell";
MaterialCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[MaterialCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (indexPath.row != _currentRow) {
CGRect Linefrmame = cell.lineLabel.frame;
Linefrmame.origin.y = TableHeight-1;
cell.lineLabel.frame = Linefrmame;
CGRect showfrmame = cell.showView.frame;
showfrmame.size.height = 0;
cell.showView.frame = showfrmame;
cell.showView.hidden = YES;
cell.backgroundColor = [UIColor whiteColor];
}else if (indexPath.row == _currentRow && !isFirst)
{
CGRect Linefrmame = cell.lineLabel.frame;
Linefrmame.origin.y = 200-1;
cell.lineLabel.frame = Linefrmame;
CGRect showfrmame = cell.showView.frame;
showfrmame.size.height = 150;
cell.showView.frame = showfrmame;
cell.showView.hidden = NO;
cell.backgroundColor = XXFBgColor;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MaterialCell *cell = (MaterialCell *)[tableView cellForRowAtIndexPath:indexPath];
CGRect Linefrmame = cell.lineLabel.frame;
CGRect showfrmame = cell.showView.frame;
if (Linefrmame.origin.y == TableHeight - 1) {
Linefrmame.origin.y = 200-1;
showfrmame.size.height = 150;
cell.showView.hidden = NO;
isFirst = NO;
cell.backgroundColor = [UIColor whiteColor];
}else{
isFirst = YES;
Linefrmame.origin.y = TableHeight -1;
showfrmame.size.height = 0;
cell.showView.hidden = YES;
cell.backgroundColor = [UIColor whiteColor];
}
cell.lineLabel.frame = Linefrmame;
cell.showView.frame = showfrmame;
_currentRow = indexPath.row;
[self.tableView reloadData];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == _currentRow && !isFirst) {
return 200;
}
return TableHeight;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
//
// BottomSheetView.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BottomSheetView : UIView
@end
//
// BottomSheetView.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "BottomSheetView.h"
#import "MaterialVIewController.h"
#import "GoodsViewController.h"
#import "CostViewController.h"
#define ContentHeight 44
#define BtnWidth (ScreenSize.width - 20*4)/3
#define BeginTag 8000
#define SpaceWidth 20
@interface BottomSheetView ()<UIScrollViewDelegate>
{
UIScrollView *_bottomSV;
UIImageView *_moveImageView;
UIButton *_currentBtn;
UIButton *_addBtn;
MaterialVIewController *_materialVC;
GoodsViewController *_goodsVC;
CostViewController *_costVC;
}
@end
@implementation BottomSheetView
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
//界面
[self bulidLayout];
}
return self;
}
#pragma mark - 布局
- (void)bulidLayout
{
[self addChildView];
[self createBottomView];
}
- (void)createBottomView{
NSArray *arr = @[@"原料明细",@"成品明细",@"费用明细"];
_bottomSV = [[UIScrollView alloc]initWithFrame:CGRectMake(0,ContentHeight + 4, ScreenSize.width, CGRectGetHeight(self.frame) - ContentHeight-2)];
_bottomSV.showsHorizontalScrollIndicator = NO;
_bottomSV.showsVerticalScrollIndicator = NO;
_bottomSV.pagingEnabled = YES;
_bottomSV.delegate = self;
_bottomSV.backgroundColor = [UIColor yellowColor];
_bottomSV.contentSize = CGSizeMake(ScreenSize.width * arr.count, CGRectGetHeight(_bottomSV.frame));
[self addSubview:_bottomSV];
for (NSInteger i = 0; i < arr.count; i++) {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:arr[i] forState:UIControlStateNormal];
btn.frame = CGRectMake(SpaceWidth + (BtnWidth+SpaceWidth) * i, 0, BtnWidth, ContentHeight);
[btn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
[btn setTitleColor:GXF_SAVE_COLOR forState:UIControlStateDisabled];
btn.titleLabel.font = GXF_SIXTEENTEH_SIZE;
btn.tag = i + BeginTag;
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:btn];
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetWidth(_bottomSV.frame) * i, 0, CGRectGetWidth(_bottomSV.frame), CGRectGetHeight(_bottomSV.frame))];
if (i == 0) {
view.backgroundColor = [UIColor redColor];
_materialVC.viewFrame = view.bounds;
[view addSubview:_materialVC.view];
}else if(i == 1){
view.backgroundColor = [UIColor blackColor];
_goodsVC.viewFrame = view.bounds;
[view addSubview:_goodsVC.view];
}else if(i == 2){
_costVC.viewFrame = view.bounds;
[view addSubview:_costVC.view];
view.backgroundColor = [UIColor blueColor];
}
[_bottomSV addSubview:view];
}
_moveImageView = [[UIImageView alloc]initWithFrame:CGRectMake(SpaceWidth, ContentHeight, BtnWidth,4)];
_moveImageView.image = [UIImage imageNamed:@"tab_line"];
[self addSubview:_moveImageView];
}
- (void)addChildView{
_materialVC = [[MaterialVIewController alloc]init];
_goodsVC = [[GoodsViewController alloc]init];
_costVC = [[CostViewController alloc]init];
}
- (void)btnClick:(UIButton *)btn{
NSInteger index = btn.tag - BeginTag;
_currentBtn.enabled = YES;
btn.enabled = NO;
_currentBtn = btn;
[UIView animateWithDuration:0.5 animations:^{
CGRect moveFrame = _moveImageView.frame;
moveFrame.origin.x = SpaceWidth + (BtnWidth+SpaceWidth) * index;
_moveImageView.frame = moveFrame;
_bottomSV.contentOffset=CGPointMake(index * self.frame.size.width, 0);
}];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
CGFloat offsetX = scrollView.contentOffset.x / self.frame.size.width;
[UIView animateWithDuration:0.5 animations:^{
CGRect moveFrame = _moveImageView.frame;
moveFrame.origin.x = SpaceWidth + (BtnWidth+SpaceWidth) * offsetX;
_moveImageView.frame = moveFrame;
}];
_currentBtn.enabled = YES;
UIButton *btn = (UIButton *) [self viewWithTag:offsetX + BeginTag];
btn.enabled = NO;
_currentBtn = btn;
}
@end
//
// MaterialCell.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MaterialCell : UITableViewCell
@property (nonatomic,strong)UIImageView *smallImageView;
@property (nonatomic,strong)UIButton *editBtn;
@property (nonatomic,strong)UILabel *seqLabel;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *baseCountLabel;
@property (nonatomic,strong)UILabel *dateLabel;
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIView *showView;
@property (nonatomic,strong)UILabel *showTitleLabel;
@property (nonatomic,strong)UILabel *showBaseCountLabel;
@property (nonatomic,strong)UILabel *showDateLabel;
@property (nonatomic,strong)UILabel *basePriceLabel;
@property (nonatomic,strong)UILabel *totalPriceLabel;
@property (nonatomic,strong)UILabel *placeLabel;
@property (nonatomic,strong)UILabel *qualityLabel;
@property (nonatomic,strong)UILabel *remarkLabel;
@end
//
// MaterialCell.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "MaterialCell.h"
#define LeftMargin 13
#define TableHeight 44
#define SmallSize 15
#define SmallWidth 20
#define SpaceMargin 1
#define LeftWidth 45
#define RightWidth 30
#define ShowColor @"bbbbbb"
#define ShowSize 13
#define ShowWidth 150
#define ShowHeight 20
@implementation MaterialCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self bulidLayout];
}
return self;
}
- (void)bulidLayout
{
CGFloat headWidth = (ScreenSize.width - LeftWidth - RightWidth - SpaceMargin* (3 -1))/3;
self.smallImageView = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)];
self.smallImageView.image = [UIImage imageNamed:@"delete"];
self.seqLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.smallImageView.frame), 0, SmallWidth, TableHeight))];
self.seqLabel.textColor = GXF_CONTENT_COLOR;
self.seqLabel.text = @"13";
self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
self.titleLabel.textAlignment = NSTextAlignmentLeft;
self.titleLabel.textColor = GXF_CONTENT_COLOR;
self.titleLabel.text = @"苹果桃子";
self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
self.baseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.baseCountLabel.textAlignment = NSTextAlignmentLeft;
self.baseCountLabel.textColor = GXF_CONTENT_COLOR;
self.baseCountLabel.text = @"30000";
self.baseCountLabel.font = GXF_SIXTEENTEH_SIZE;
self.dateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.baseCountLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.dateLabel.textAlignment = NSTextAlignmentLeft;
self.dateLabel.text = @"2015-04-05";
self.dateLabel.textColor = GXF_CONTENT_COLOR;
self.dateLabel.font = GXF_SIXTEENTEH_SIZE;
self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
self.showView.hidden = YES;
self.showTitleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin + SmallSize, 0, ShowWidth, ShowHeight))];
self.showTitleLabel.textAlignment = NSTextAlignmentLeft;
self.showTitleLabel.textColor = HexColor(ShowColor);
self.showTitleLabel.text = @"原料:苹果桃子";
self.showTitleLabel.font = FontSize(ShowSize);
self.showBaseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.showTitleLabel.frame), 0, ShowWidth, ShowHeight))];
self.showBaseCountLabel.textAlignment = NSTextAlignmentLeft;
self.showBaseCountLabel.textColor = HexColor(ShowColor);
self.showBaseCountLabel.text = @"基础数量:10000";
self.showBaseCountLabel.font = FontSize(ShowSize);
self.showDateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.showTitleLabel.frame), ShowWidth, ShowHeight))];
self.showDateLabel.textAlignment = NSTextAlignmentLeft;
self.showDateLabel.textColor = HexColor(ShowColor);
self.showDateLabel.text = @"入库时间:2015-02-04";
self.showDateLabel.font = FontSize(ShowSize);
self.basePriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showBaseCountLabel.frame), CGRectGetMaxY(self.showTitleLabel.frame), ShowWidth, ShowHeight))];
self.basePriceLabel.textAlignment = NSTextAlignmentLeft;
self.basePriceLabel.textColor = HexColor(ShowColor);
self.basePriceLabel.text = @"基础单价:11元";
self.basePriceLabel.font = FontSize(ShowSize);
self.totalPriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.showDateLabel.frame), ShowWidth, ShowHeight))];
self.totalPriceLabel.textAlignment = NSTextAlignmentLeft;
self.totalPriceLabel.textColor = HexColor(ShowColor);
self.totalPriceLabel.text = @"总金额:1000";
self.totalPriceLabel.font = FontSize(ShowSize);
self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showBaseCountLabel.frame), CGRectGetMaxY(self.showDateLabel.frame), ShowWidth, ShowHeight))];
self.placeLabel.textAlignment = NSTextAlignmentLeft;
self.placeLabel.textColor = HexColor(ShowColor);
self.placeLabel.text = @"产地:河南省";
self.placeLabel.font = FontSize(ShowSize);
self.qualityLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.totalPriceLabel.frame), ShowWidth, ShowHeight))];
self.qualityLabel.textAlignment = NSTextAlignmentLeft;
self.qualityLabel.textColor = HexColor(ShowColor);
self.qualityLabel.text = @"质量:1000";
self.qualityLabel.font = FontSize(ShowSize);
self.remarkLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.qualityLabel.frame), ShowWidth, ShowHeight))];
self.remarkLabel.textAlignment = NSTextAlignmentLeft;
self.remarkLabel.textColor = HexColor(ShowColor);
self.remarkLabel.text = @"描述:河南省";
self.remarkLabel.font = FontSize(ShowSize);
self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.editBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth, TableHeight);
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin * 2, 1))];;
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:self.smallImageView];
[self.contentView addSubview:self.seqLabel];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.baseCountLabel];
[self.contentView addSubview:self.dateLabel];
[self.contentView addSubview:self.editBtn];
[self.contentView addSubview:self.showView];
[self.showView addSubview:self.showTitleLabel];
[self.showView addSubview:self.showBaseCountLabel];
[self.showView addSubview:self.showDateLabel];
[self.showView addSubview:self.basePriceLabel];
[self.showView addSubview:self.totalPriceLabel];
[self.showView addSubview:self.placeLabel];
[self.showView addSubview:self.qualityLabel];
[self.showView addSubview:self.remarkLabel];
[self.contentView addSubview:self.lineLabel];
}
- (void)awakeFromNib {
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@end
//
// TopSheetView.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/12.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "HPGrowingTextView.h"
@protocol TopSheetViewDelegate <NSObject>
- (void)hiddenKeyBoard;
@end
@interface TopSheetView : UIView
@property (nonatomic,strong)UITextField *titleTextFiled;//标题
@property (nonatomic,strong)NSString *supplier;//供应商
@property (nonatomic,strong)UITextField *peopleTextFiled;//联系人
@property (nonatomic,strong)UITextField *phoneTextFiled;//电话
@property (nonatomic,strong)NSString *factory;//加工工厂
@property (nonatomic,strong)HPGrowingTextView *remarkTextView;//标题
@property (nonatomic,strong)UIButton *factoryBtn;
@property (nonatomic,strong)UIButton *supplierBtn;
@property (nonatomic,strong)UILabel *factoryLabel;
@property (nonatomic,strong)UILabel *supplierLabel;
@property (nonatomic,weak)id <TopSheetViewDelegate>delegate;
@end
//
// TopSheetView.m
// XFFruit
//
// Created by 陈俊俊 on 15/8/12.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "TopSheetView.h"
#import "SurveyCell.h"
#define LeftMargin 15
#define TopMargin 20
#define LeftWidth 80
#define TableHeight 44
#define SpaceHeight 10
@interface TopSheetView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
{
UITableView *_tableView;
NSMutableArray *_dataArr;
}
@end
@implementation TopSheetView
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
//界面
[self bulidLayout];
}
return self;
}
#pragma mark - 布局
- (void)bulidLayout
{
self.backgroundColor = XXFBgColor;
_dataArr = [NSMutableArray array];
NSArray *arr = @[@"标题:",@"供应商:",@"联系人:",@"联系电话:",@"加工工厂:",@"备注:"];
[_dataArr addObjectsFromArray:arr];
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,self.frame.size.width, self.frame.size.height - TopMargin)) style:(UITableViewStylePlain)];
_tableView.backgroundColor = [UIColor whiteColor];
_tableView.bounces = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
[self addSubview:_tableView];
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return _dataArr.count;
}
- (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 ==1 || indexPath.row == 4) {
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 == 2 || indexPath.row == 3) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
textField.textAlignment = NSTextAlignmentRight;
textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE;
textField.returnKeyType = UIReturnKeyDone;
textField.delegate = self;
[cell.contentView addSubview:textField];
if (indexPath.row == 0) {
self.titleTextFiled = textField;
self.titleTextFiled.placeholder = @"请输入标题";
}else if(indexPath.row == 2){
self.peopleTextFiled = textField;
self.peopleTextFiled.placeholder = @"请输入联系人";
}else if(indexPath.row == 3){
self.phoneTextFiled = textField;
self.phoneTextFiled.placeholder = @"请输入联系人手机";
}
}else if (indexPath.row == _dataArr.count -1){
self.remarkTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1;
self.remarkTextView.maxNumberOfLines = 2;
self.remarkTextView.font = GXF_FIFTEENTEN_SIZE;
self.remarkTextView.textAlignment = NSTextAlignmentRight;
self.remarkTextView.delegate = self;
self.remarkTextView.returnKeyType = UIReturnKeyDone;
self.remarkTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:self.remarkTextView];
}else{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:contentLabel];
if (indexPath.row == 1) {
contentLabel.text = @"选择供应商";
self.supplierLabel = contentLabel;
}else if(indexPath.row == 4){
contentLabel.text = @"选择加工工厂";
self.factoryLabel = contentLabel;
}
}
}
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[self.remarkTextView resignFirstResponder];
return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[self.delegate hiddenKeyBoard];
return YES;
}
@end
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