Commit cad7fd9f authored by 陈俊俊's avatar 陈俊俊

详情界面统一修改

parent a2586fdd
......@@ -102,7 +102,8 @@ typedef enum : NSUInteger {
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = XXFBgColor;
[self.view addSubview:_scrollView];
[self createBtn];
// [self createBtn];
[self showBtnByPermissions];
[self createBottomView];
[self createPurchaseView];
......@@ -116,54 +117,61 @@ typedef enum : NSUInteger {
[self.view addSubview:_secondBtn];
[self showBtnByPermissions];
}
- (void)createBtnWithArr:(NSArray *)arr{
CGFloat btnWidth = (ScreenSize.width - LeftMargin * (arr.count+1))/arr.count;
for (NSInteger i = 0; i < arr.count; i++) {
NSInteger btnTag = 0;
if ([arr[i] isEqualToString:@"拒绝"]) {
btnTag = RejectTag;
}else if ([arr[i] isEqualToString:@"审核通过"]) {
btnTag = PassTag;
}else if ([arr[i] isEqualToString:@"确认"]) {
btnTag = SureTag;
}else if ([arr[i] isEqualToString:@"结束"]) {
btnTag = EndTag;
}else if ([arr[i] isEqualToString:@"作废"]) {
btnTag = CancleTag;
}
CGRect btnFrame = CGRectMake(LeftMargin + (LeftMargin + btnWidth)*i, ScreenSize.height - 64 - BottomHeight +5, btnWidth, 40);
UIButton *perBtn = [IBTCustomButtom creatButtonWithFrame:btnFrame target:self sel:@selector(btnClick:) tag:btnTag image:nil title:arr[i] titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:perBtn];
}
}
//根据权限判断按钮显示
- (void)showBtnByPermissions{
//逻辑判断按钮显示不显示
if ([self.bill.state isEqualToString:PURCHASE_STATE_SUBMITTED]) {//状态已提交 未审批
if([self checkIsPermission:PURCHASE_PERMISSIONS_MANAGEAPPROVE]){
//显示拒绝和审批
[self changeBtnFrame:_firstBtn title:@"拒绝" originX:LeftMargin width:TwoWidth];
[self changeBtnFrame:_secondBtn title:@"审核通过" originX:CGRectGetMaxX(_firstBtn.frame) + LeftMargin width:TwoWidth];
_firstBtn.tag = RejectTag;
_secondBtn.tag = PassTag;
}else{
[self hiddenTwoBtn];
NSArray *arr = @[@"拒绝",@"审核通过"];
[self createBtnWithArr:arr];
}
}else if([self.bill.state isEqualToString:PURCHASE_STATE_SHIPPING]){//状态是发运中即已审批
NSMutableArray *arr = [NSMutableArray array];
if([self checkIsPermission:PURCHASE_PERMISSIONS_VENDORAPPROVE]){//供应商审批权
//显示确认按钮
_firstBtn.hidden = YES;
[self changeBtnFrame:_secondBtn title:@"确认" originX:LeftMargin width:OneWidth];
_secondBtn.tag = SureTag;
}else{
if ([self checkIsPermission:PURCHASE_PERMISSIONS_FINISH]&&[self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]) {
//显示结束和作废按钮
[self changeBtnFrame:_firstBtn title:@"结束" originX:LeftMargin width:TwoWidth];
[self changeBtnFrame:_secondBtn title:@"作废" originX:CGRectGetMaxX(_firstBtn.frame) + LeftMargin width:TwoWidth];
_firstBtn.tag = EndTag;
_secondBtn.tag = CancleTag;
}else{
if ([self checkIsPermission:PURCHASE_PERMISSIONS_FINISH]){//结束权
[arr addObject:@"确认"];
}
if ([self checkIsPermission:PURCHASE_PERMISSIONS_FINISH]){//结束权
//显示结束按钮
_firstBtn.hidden = YES;
[self changeBtnFrame:_secondBtn title:@"结束" originX:LeftMargin width:OneWidth];
_secondBtn.tag = EndTag;
}else if([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]){//作废权
[arr addObject:@"结束"];
}
if([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]){//作废权
//显示作废按钮
_firstBtn.hidden = YES;
[self changeBtnFrame:_secondBtn title:@"作废" originX:LeftMargin width:OneWidth];
_secondBtn.tag = CancleTag;
}else{
[self hiddenTwoBtn];
}
}
[arr addObject:@"作废"];
}
[self createBtnWithArr:arr];
if (arr.count == 0) {
[self hiddenTwoBtn];
}
}else if([self.bill.state isEqualToString:PURCHASE_STATE_FINISHED]){//完成
if ([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]) {//有作废权的
//显示作废按钮
_firstBtn.hidden = YES;
[self changeBtnFrame:_secondBtn title:@"作废" originX:LeftMargin width:OneWidth];
_secondBtn.tag = CancleTag;
NSArray *arr = @[@"作废"];
[self createBtnWithArr:arr];
}else{
[self hiddenTwoBtn];
......@@ -174,8 +182,6 @@ typedef enum : NSUInteger {
}
- (void)hiddenTwoBtn{
_firstBtn.hidden = YES;
_secondBtn.hidden = YES;
CGRect scrollViewFrame = _scrollView.frame;
scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame;
......@@ -194,7 +200,7 @@ typedef enum : NSUInteger {
return YES;
}
}
return NO;
return YES;
}
- (void)btnClick:(UIButton *)btn{
......
......@@ -173,73 +173,61 @@ typedef enum : NSUInteger {
[self createMingXiTableView];//自定义
}
- (void)hiddenBottomBtn{
_endBtn.hidden = YES;
_rejectBtn.hidden = YES;
CGRect scrollViewFrame = _scrollView.frame;
scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame;
}
- (void)createBtnWithArr:(NSArray *)arr{
CGFloat btnWidth = (ScreenSize.width - LeftMargin * (arr.count+1))/arr.count;
for (NSInteger i = 0; i < arr.count; i++) {
NSInteger btnTag = 0;
if ([arr[i] isEqualToString:@"结束"]) {
btnTag = EndTag;
}else if ([arr[i] isEqualToString:@"接受任务"]) {
btnTag = AcceptTag;
}else if ([arr[i] isEqualToString:@"新建采购单"]) {
btnTag = NewTag;
}
CGRect btnFrame = CGRectMake(LeftMargin + (LeftMargin + btnWidth)*i, ScreenSize.height - 64 - BottomHeight +5, btnWidth, 40);
UIButton *perBtn = [IBTCustomButtom creatButtonWithFrame:btnFrame target:self sel:@selector(btnClick:) tag:btnTag image:nil title:arr[i] titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:perBtn];
}
}
- (void)createBtn{
_rejectBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:0 image:nil title:@"" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[self.view addSubview:_rejectBtn];
_endBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(_rejectBtn.frame)+ LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:0 image:nil title:@"" titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:_endBtn];
if ([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_NOTACCEPTED]) {
if ([self checkIsPermission:NOTICE_PERMISSIONS_ACCEPTTASK]&& [self checkIsPermission:NOTICE_PERMISSIONS_FINISH]) {
_rejectBtn.tag = EndTag;
[_rejectBtn setTitle:@"结束" forState:UIControlStateNormal];
_endBtn.tag = AcceptTag;
[_endBtn setTitle:@"接受任务" forState:UIControlStateNormal];
}else{
if ([self checkIsPermission:NOTICE_PERMISSIONS_ACCEPTTASK]) {
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = AcceptTag;
[_endBtn setTitle:@"接受任务" forState:UIControlStateNormal];
}else if([self checkIsPermission:NOTICE_PERMISSIONS_FINISH]){
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = EndTag;
[_endBtn setTitle:@"结束" forState:UIControlStateNormal];
}else{
[self hiddenBottomBtn];
}
}
NSMutableArray *arr = [NSMutableArray array];
if([IBTCommon checkIsPermission:NOTICE_PERMISSIONS_FINISH]){
[arr addObject:@"结束"];
}
if ([IBTCommon checkIsPermission:NOTICE_PERMISSIONS_ACCEPTTASK]) {
[arr addObject:@"接受任务"];
}
if (arr.count == 0) {
[self hiddenBottomBtn];
}else{
[self createBtnWithArr:arr];
}
}else if([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_PURCHASEING]){
if ([self checkIsPermission:NOTICE_PERMISSIONS_FINISH] && [self checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]) {
_rejectBtn.tag = EndTag;
[_rejectBtn setTitle:@"结束" forState:UIControlStateNormal];
_endBtn.tag = NewTag;
[_endBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
NSMutableArray *arr = [NSMutableArray array];
if([IBTCommon checkIsPermission:NOTICE_PERMISSIONS_FINISH]){
[arr addObject:@"结束"];
}
if([IBTCommon checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]){
[arr addObject:@"新建采购单"];
}
if (arr.count == 0) {
[self hiddenBottomBtn];
}else{
if([self checkIsPermission:NOTICE_PERMISSIONS_FINISH]){
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = EndTag;
[_endBtn setTitle:@"结束" forState:UIControlStateNormal];
}else if([self checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]){
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = NewTag;
[_endBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
}else{
[self hiddenBottomBtn];
}
[self createBtnWithArr:arr];
}
}else if([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_FINISHED]) {
[self hiddenBottomBtn];
}
}
- (BOOL)checkIsPermission:(NSString *)permission{
for (NSString *per in [ICRUserUtil sharedInstance].permissions) {
if ([per isEqualToString:permission]) {
return YES;
}
}
return NO;
}
- (void)btnClick:(UIButton *)btn{
NSLog(@"%ld",(long)btn.tag);
switch (btn.tag) {
......@@ -277,15 +265,15 @@ typedef enum : NSUInteger {
NSString *message = data[@"message"];
if (success == 1) {
if ([action isEqualToString:@"accept"]) {
#warning 有点问
[ICRUserUtil sharedInstance].needFresh = YES;
if ([IBTCommon checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]) {
_stateLabel.text = @"发运中";
_endBtn.hidden = YES;
_rejectBtn.hidden = NO;
[_rejectBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
_rejectBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_rejectBtn.tag = NewTag;
_stateLabel.text = @"采购中";
for (UIView *subView in self.view.subviews) {
if ([subView isKindOfClass:[UIButton class]]) {
[subView removeFromSuperview];
}
}
[self createBtnWithArr:@[@"新建采购单"]];
}else{
[self PopViewControllerAnimated:YES];
}
......
......@@ -18,7 +18,8 @@
#define TopMargin 15
typedef enum : NSUInteger {
SaveTag = 20000,
ReceiveTag
ReceiveTag,
AbortTag
} BtnTag;
@interface NewReceiveViewController ()<UIAlertViewDelegate>
......@@ -154,6 +155,29 @@ typedef enum : NSUInteger {
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
}
- (void)createBtnWithArr:(NSArray *)arr{
CGFloat btnWidth = (ScreenSize.width - LeftMargin * (arr.count+1))/arr.count;
for (NSInteger i = 0; i < arr.count; i++) {
NSInteger btnTag = 0;
if ([arr[i] isEqualToString:@"保存"]) {
btnTag = SaveTag;
}else if ([arr[i] isEqualToString:@"收货"]) {
btnTag = ReceiveTag;
}else if([arr[i] isEqualToString:@"作废"]){
btnTag = AbortTag;
}
CGRect btnFrame = CGRectMake(LeftMargin + (LeftMargin + btnWidth)*i, ScreenSize.height - 64 - BottomHeight +5, btnWidth, 40);
UIButton *perBtn = [IBTCustomButtom creatButtonWithFrame:btnFrame target:self sel:@selector(btnClick:) tag:btnTag image:nil title:arr[i] titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:perBtn];
}
}
- (void)hiddenBottom{
CGRect scrollViewFrame = _scrollView.frame;
scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame;
}
#pragma mark - 视图初始化
- (void)bulifLayout{
self.defalutState = [NSMutableArray array];
......@@ -163,17 +187,18 @@ typedef enum : NSUInteger {
_scrollView.backgroundColor = XXFBgColor;
[self.view addSubview:_scrollView];
_firstBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width- LeftMargin *3)/2, 40) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[self.view addSubview:_firstBtn];
_secondBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(_firstBtn.frame)+ LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:ReceiveTag image:nil title:@"收货" titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:_secondBtn];
if ([self.transfer.state isEqualToString:TRANSFER_STATE_RECEIVED] || ![IBTCommon checkIsPermission:RECEIVE_ACTION_RECEIVE]) {
_firstBtn.hidden = YES;
_secondBtn.hidden = YES;
CGRect scrollViewFrame = _scrollView.frame;
scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame;
if ([self.transfer.state isEqualToString:TRANSFER_STATE_UNRECEIVED]) {
if ([IBTCommon checkIsPermission:RECEIVE_ACTION_RECEIVE]) {
[self createBtnWithArr:@[@"保存",@"收货"]];
}else{
[self hiddenBottom];
}
}else if ([self.transfer.state isEqualToString:TRANSFER_STATE_RECEIVED]) {
if ([IBTCommon checkIsPermission:TRANSFER_ACTION_ABORT]) {
[self createBtnWithArr:@[@"作废"]];
}else{
[self hiddenBottom];
}
}
NSArray *leftArr = @[@"单号:",@"来源单据:",@"状态:",@"发货仓库:",@"收货仓库:",@"车辆:",@"司机电话:",@"创建:",@"备注"];
......@@ -273,14 +298,52 @@ typedef enum : NSUInteger {
if ([self checkReceive]) {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"收货后不能重复收货,请确认是否要收货?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
alertView.tag = ReceiveTag;
[alertView show];
}
}
break;
case AbortTag:
{
CLog(@"作废");
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认作废" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
alertView.tag = AbortTag;
[alertView show];
}
break;
default:
break;
}
}
- (void)dealByAction:(NSString *)action{
//保存
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
[ICRUserUtil sharedInstance].needFresh = YES;
[self PopViewControllerAnimated:YES];
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@"操作异常"];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] abortTransferWithTransferUuid:self.transfer.uuid version:self.transfer.version success:succ failure:fail];
}
- (void)getDataFromServer:(NSString *)state msg:(NSString *)msg{
//保存
void(^succ)(id) = ^(id data) {
......@@ -353,10 +416,16 @@ typedef enum : NSUInteger {
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
//提交
self.state = RECEIVE_STATE_RECEIVE;
[self getDataFromServer:RECEIVE_STATE_RECEIVE msg:@"收货中..."];
if (alertView.tag == AbortTag) {
if (buttonIndex == 1) {
[self dealByAction:TRANSFER_STATE_ABORTED];//作废
}
}else if(alertView.tag == ReceiveTag){
if (buttonIndex == 1) {
//提交
self.state = RECEIVE_STATE_RECEIVE;
[self getDataFromServer:RECEIVE_STATE_RECEIVE msg:@"收货中..."];
}
}
}
......
......@@ -139,6 +139,23 @@ typedef enum : NSUInteger {
return purchseNumber;
}
- (void)createBtnWithArr:(NSArray *)arr{
CGFloat btnWidth = (ScreenSize.width - LeftMargin * (arr.count+1))/arr.count;
for (NSInteger i = 0; i < arr.count; i++) {
NSInteger btnTag = 0;
if ([arr[i] isEqualToString:@"结束"]) {
btnTag = EndTag;
}else if ([arr[i] isEqualToString:@"作废"]) {
btnTag = AbortTag;
}
CGRect btnFrame = CGRectMake(LeftMargin + (LeftMargin + btnWidth)*i, ScreenSize.height - 64 - BottomHeight +5, btnWidth, 40);
UIButton *perBtn = [IBTCustomButtom creatButtonWithFrame:btnFrame target:self sel:@selector(btnClick:) tag:btnTag image:nil title:arr[i] titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:perBtn];
}
}
#pragma mark - 视图初始化
- (void)bulifLayout{
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 64 - BottomHeight)];
......@@ -146,14 +163,9 @@ typedef enum : NSUInteger {
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = XXFBgColor;
[self.view addSubview:_scrollView];
_firstBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width- LeftMargin *2), 40) target:self sel:@selector(btnClick:) tag:AbortTag image:nil title:@"作废" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[self.view addSubview:_firstBtn];
// _secondBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(_firstBtn.frame)+ LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:EndTag image:nil title:@"结束" titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
// [self.view addSubview:_secondBtn];
if ([self.transfer.state isEqualToString:TRANSFER_STATE_RECEIVED] || [self.transfer.state isEqualToString:TRANSFER_STATE_UNRECEIVED]) {
if ([IBTCommon checkIsPermission:TRANSFER_ACTION_ABORT]) {
_firstBtn.hidden = NO;
[self createBtnWithArr:@[@"作废"]];
}else{
[self hiddenBottomView];
}
......@@ -208,7 +220,6 @@ typedef enum : NSUInteger {
[self createBottomView];
}
- (void)hiddenBottomView{
_firstBtn.hidden = YES;
CGRect scrollViewFrame = _scrollView.frame;
scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame;
......
......@@ -238,7 +238,8 @@ typedef enum : NSUInteger {
}
- (void)textChange:(UITextField *)textField{
if (_actualmoneyField.text.length > 0 && _paidmoneyField.text.length > 0 ) {
_leftmoneyField.text = [NSString stringWithFormat:@"%.4f",[_actualmoneyField.text floatValue] - [_paidmoneyField.text floatValue]];
_leftmoneyField.text = [NSString stringWithFormat:@"%.2f",[_actualmoneyField.text floatValue] - [_paidmoneyField.text floatValue]];
}
}
......
......@@ -204,13 +204,27 @@ typedef enum : NSUInteger {
}
}
- (void)hiddenAllBtn{
_firstBtn.hidden = YES;
_secondBtn.hidden = YES;
CGRect scrollViewFrame = _scrollView.frame;
scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame;
}
- (void)createBtnWithArr:(NSArray *)arr{
CGFloat btnWidth = (ScreenSize.width - LeftMargin * (arr.count+1))/arr.count;
for (NSInteger i = 0; i < arr.count; i++) {
NSInteger btnTag = 0;
if ([arr[i] isEqualToString:@"结束"]) {
btnTag = EndTag;
}else if ([arr[i] isEqualToString:@"作废"]) {
btnTag = AbortTag;
}
CGRect btnFrame = CGRectMake(LeftMargin + (LeftMargin + btnWidth)*i, ScreenSize.height - 64 - BottomHeight +5, btnWidth, 40);
UIButton *perBtn = [IBTCustomButtom creatButtonWithFrame:btnFrame target:self sel:@selector(btnClick:) tag:btnTag image:nil title:arr[i] titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:perBtn];
}
}
#pragma mark - 视图初始化
- (void)bulifLayout{
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 64 - BottomHeight)];
......@@ -218,40 +232,30 @@ typedef enum : NSUInteger {
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = XXFBgColor;
[self.view addSubview:_scrollView];
_firstBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:AbortTag image:nil title:@"作废" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[self.view addSubview:_firstBtn];
_secondBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(_firstBtn.frame)+ LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:EndTag image:nil title:@"结束" titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:_secondBtn];
if ([self.transport.state isEqualToString:TRANSPORT_STATE_ABORTED]) {
[self hiddenAllBtn];
}else if([self.transport.state isEqualToString:TRANSPORT_STATE_FINISHED]){
if ([IBTCommon checkIsPermission:TRANSPORT_ACTION_ABORT]) {
_secondBtn.hidden = YES;
_firstBtn.hidden = NO;
_firstBtn.width = ScreenSize.width - LeftMargin*2;
NSArray *arr = @[@"作废"];
[self createBtnWithArr:arr];
}else{
[self hiddenAllBtn];
}
}else{
if ([IBTCommon checkIsPermission:TRANSPORT_ACTION_ABORT] && [IBTCommon checkIsPermission:TRANSPORT_ACTION_FINISH]) {
_secondBtn.hidden = NO;
_firstBtn.hidden = NO;
}else if([self.transport.state isEqualToString:TRANSPORT_STATE_RECEIVED]){
NSMutableArray *arr = [NSMutableArray array];
if ([IBTCommon checkIsPermission:TRANSPORT_ACTION_ABORT]) {
[arr addObject:@"作废"];
}
if([IBTCommon checkIsPermission:TRANSPORT_ACTION_FINISH])
{
[arr addObject:@"结束"];
}
if (arr.count == 0) {
[self hiddenAllBtn];
}else{
if ([IBTCommon checkIsPermission:TRANSPORT_ACTION_ABORT]) {
_secondBtn.hidden = YES;
_firstBtn.hidden = NO;
_firstBtn.width = ScreenSize.width - LeftMargin*2;
}else if([IBTCommon checkIsPermission:TRANSPORT_ACTION_FINISH])
{
_secondBtn.hidden = NO;
_firstBtn.hidden = YES;
_secondBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin*2, 40);
}else{
[self hiddenAllBtn];
}
[self createBtnWithArr:arr];
}
}
NSArray *leftArr = @[@"单号:",@"采购单:",@"状态:",@"发货仓库:",@"收货仓库:",@"车辆:",@"司机电话:",@"创建:",@"预计到货时间:",@"备注:"];
......
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