// // NewDispatchRequirementInvoiceInfoController.m // IBOSS-HJ // // Created by 关宏厚 on 2021/1/28. // Copyright © 2021 elongtian. All rights reserved. // #import "NewDispatchRequirementInvoiceInfoController.h" @interface NewDispatchRequirementInvoiceInfoController () { UIScrollView *scroll; UIView *contentView; } @end @implementation NewDispatchRequirementInvoiceInfoController - (void)viewDidLoad { [super viewDidLoad]; [self initUI]; } -(void)initUI { scroll = [UIScrollView new]; scroll.delegate = self; scroll.frame=self.view.bounds; scroll.tag=1000; [self.view addSubview:scroll]; if(Screen_Height2 <= 480){ scroll.contentSize=CGSizeMake(self.view.frame.size.width, self.view.frame.size.height + 80); } int topMargin=10; int leftMargin=20; int titleWidth=70; int titleHeight=25; contentView = [[UIView alloc]init]; contentView.frame=CGRectZero; contentView.backgroundColor = [UIColor whiteColor]; UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)]; //设置成NO表示当前控件响应后会传播到其他控件上,默认为YES。 tapGestureRecognizer.cancelsTouchesInView = NO; // //将触摸事件添加到当前view [scroll addGestureRecognizer:tapGestureRecognizer]; [scroll addSubview:contentView]; UILabel *lblTitleDeliveryDate = [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,topMargin,titleWidth, 25)]; lblTitleDeliveryDate.font = kTextFont; lblTitleDeliveryDate.text = @"送货日期:"; [contentView addSubview: lblTitleDeliveryDate]; _lblDeliveryDate=[UILabel new]; _lblDeliveryDate.font=kTextFont; _lblDeliveryDate.frame=CGRectMake(CGRectGetMaxX(lblTitleDeliveryDate.frame), topMargin,Screen_Width-CGRectGetMaxX(lblTitleDeliveryDate.frame),25); [contentView addSubview: _lblDeliveryDate]; UILabel *lblTitleReceivables = [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,CGRectGetMaxY(lblTitleDeliveryDate.frame)+topMargin,titleWidth, 25)]; lblTitleReceivables.font = kTextFont; lblTitleReceivables.text = @"应收金额:"; [contentView addSubview: lblTitleReceivables]; _lblReceivables=[UILabel new]; _lblReceivables.font=kTextFont; _lblReceivables.frame=CGRectMake(CGRectGetMaxX(lblTitleReceivables.frame), CGRectGetMaxY(lblTitleDeliveryDate.frame)+topMargin,Screen_Width-CGRectGetMaxX(lblTitleReceivables.frame),25); [contentView addSubview: _lblReceivables]; UILabel *lblTitleRemainingReceivables = [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,CGRectGetMaxY(lblTitleReceivables.frame)+topMargin,titleWidth, 25)]; lblTitleRemainingReceivables.font = kTextFont; lblTitleRemainingReceivables.text = @"剩余应收:"; [contentView addSubview: lblTitleRemainingReceivables]; _lblRemainingReceivables=[UILabel new]; _lblRemainingReceivables.font=kTextFont; _lblRemainingReceivables.frame=CGRectMake(CGRectGetMaxX(lblTitleRemainingReceivables.frame), CGRectGetMaxY(lblTitleReceivables.frame)+topMargin,Screen_Width-CGRectGetMaxX(lblTitleRemainingReceivables.frame),25); [contentView addSubview: _lblRemainingReceivables]; UILabel *lblTitleReceivablesType = [UILabel new]; lblTitleReceivablesType.frame = CGRectMake(leftMargin,CGRectGetMaxY(lblTitleRemainingReceivables.frame)+topMargin,titleWidth, 25); lblTitleReceivablesType.text = @"收款方式:"; lblTitleReceivablesType.font = kTextFont; [contentView addSubview:lblTitleReceivablesType]; _btnReceivablesType = [UIButton buttonWithType:UIButtonTypeCustom]; _btnReceivablesType.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; _btnReceivablesType.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0); _btnReceivablesType.frame = CGRectMake(CGRectGetMaxX(lblTitleReceivablesType.frame),CGRectGetMaxY(lblTitleRemainingReceivables.frame)+topMargin, Screen_Width -CGRectGetMaxX(lblTitleReceivablesType.frame) - 30, 25); _btnReceivablesType.titleLabel.font = kTextFont; [_btnReceivablesType setTitle:@"请选择收款方式" forState:UIControlStateNormal]; [_btnReceivablesType setTitleColor:[UIColor colorWithWhite:0.5 alpha:0.5] forState:UIControlStateNormal]; [_btnReceivablesType addTarget:self action:@selector(showReceivablesType) forControlEvents:UIControlEventTouchUpInside]; [contentView addSubview:_btnReceivablesType]; UIButton *btnArrow = [UIButton buttonWithType:UIButtonTypeCustom]; btnArrow.frame = CGRectMake(Screen_Width - 17,CGRectGetMaxY(lblTitleRemainingReceivables.frame)+topMargin,7,12); [ btnArrow setImage:[UIImage imageNamed:@"rightarrow"] forState:UIControlStateNormal]; [contentView addSubview:btnArrow]; UILabel *lblTxtReceiptAmount = [UILabel new]; lblTxtReceiptAmount.frame = CGRectMake(leftMargin,CGRectGetMaxY(lblTitleReceivablesType.frame)+topMargin,titleWidth, 25); lblTxtReceiptAmount.text = @"回执金额:"; lblTxtReceiptAmount.font = kTextFont; [contentView addSubview:lblTxtReceiptAmount]; _txtReceiptAmount = [UITextField new]; _txtReceiptAmount.frame = CGRectMake(CGRectGetMaxX(lblTxtReceiptAmount.frame),CGRectGetMaxY(lblTitleReceivablesType.frame)+topMargin, Screen_Width -CGRectGetMaxX(lblTxtReceiptAmount.frame) - 30, 25); _txtReceiptAmount.font = kTextFont; _txtReceiptAmount.enabled=NO; _txtReceiptAmount.placeholder = @"请输入回执金额"; _txtReceiptAmount.delegate = self; _txtReceiptAmount.keyboardType = UIKeyboardTypeDecimalPad; [contentView addSubview:_txtReceiptAmount]; UILabel *lblTxtunit = [UILabel new]; lblTxtunit.frame = CGRectMake(Screen_Width - 40, CGRectGetMaxY(lblTitleReceivablesType.frame)+topMargin, 30, 25); lblTxtunit.text = @"元"; lblTxtunit.font = kTextFont; lblTxtunit.textAlignment = NSTextAlignmentRight; [contentView addSubview:lblTxtunit]; UILabel *lblTitleRemarks = [UILabel new]; lblTitleRemarks.frame = CGRectMake(leftMargin,CGRectGetMaxY(lblTxtReceiptAmount.frame)+topMargin,titleWidth, 25); lblTitleRemarks.text = @"备注信息:"; lblTitleRemarks.font = kTextFont; [contentView addSubview:lblTitleRemarks]; _txtRemarks= [UITextField new]; _txtRemarks.frame = CGRectMake(CGRectGetMaxX(lblTitleRemarks.frame),CGRectGetMaxY(lblTxtReceiptAmount.frame)+topMargin, Screen_Width -CGRectGetMaxX(lblTitleRemarks.frame) - 30, 25); _txtRemarks.font = kTextFont; _txtRemarks.placeholder = @"请输入备注"; _txtRemarks.delegate = self; [contentView addSubview:_txtRemarks]; contentView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(_txtRemarks.frame)); scroll.contentSize = CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(contentView.frame)+rectStatusHeight+rectNavHeight+120); } /** 收款方式 */ - (void)showReceivablesType{ [self.view endEditing:YES]; PaymentMethodVC *pay = [[PaymentMethodVC alloc] init]; pay.paymentMethodDelegate = self; pay.receivableList=_receivableArray; [self.cNav pushViewController:pay animated:YES]; self.hidesBottomBarWhenPushed = NO; } -(void)callbackPaymentMethod:(NSMutableArray *) arry { _receivableArray=arry; _paymentMethodFilterArray=[[NSMutableArray alloc]init]; NSMutableArray *receivableMethodNameArray=[[NSMutableArray alloc]init]; double sum=0; for(int i=0;i0) { sum+=feeItemSumValue; [_paymentMethodFilterArray addObject:payTypeModel]; [receivableMethodNameArray addObject:payTypeModel.settlementTypeName]; } } } NSString *settlementTypeStr=[receivableMethodNameArray componentsJoinedByString:@","]; [_btnReceivablesType setTitle:settlementTypeStr forState:UIControlStateNormal]; _receivableSum=[NSString stringWithFormat:@"%.2f",sum]; [_txtReceiptAmount setText:_receivableSum]; } /** 收款方式回调函数 @param model <#model description#> */ //- (void)setPayTypeModel:(PayTypeModel *)model{ // [ _btnReceivablesType setTitle:model.settlementTypeName forState:UIControlStateNormal]; // _settlementTypeName = model.settlementTypeName; // _settlementType = model.settlementType; // _receivableSum = model.receivableSum; // _earnestFee = model.earnestFee; // _remarks = model.remarks; //} /** 键盘隐藏函数 @param tap <#tap description#> */ - (void)keyboardHide:(UITapGestureRecognizer*)tap{ [self.view endEditing:YES]; } @end