123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996 |
- //
- // QianYueViewController.m
- // upAPP
- //
- // Created by 贺泌钦 on 2020/11/3.
- // Copyright © 2020 youke. All rights reserved.
- //
- #import "NewSignVC.h"
- #import "qianYueCustomerCell.h"
- #import "qianYuePopView.h"
- #import "managerModel.h"
- #import "ACMediaFrame.h"
- #import "UIView+ACMediaExt.h"
- #import "YDFlexoView.h"
- #import "RadioButton.h"
- #import "DatePickerView.h"
- #import "OSSImageUploader.h"
- #import "ProjectControlsVC.h"
- #import "signPopView.h"
- #import "NewSaleTableViewCell.h"
- @interface NewSignVC ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate,UITextFieldDelegate>{
-
-
- CGFloat _mediaH;
- ACSelectMediaView *_mediaView;
-
- }
- @property(nonatomic,strong)UILabel *titleLab;
- @property(nonatomic,strong)UITableView *tab;
- @property(nonatomic,strong)NSMutableArray *imageArr;
- @property(nonatomic,strong)UIButton *sendBtn;
- @property(nonatomic,strong)NSMutableArray *arrayRow;
- @property(nonatomic,strong)signPopView *popView;
- @property(nonatomic,strong)UILabel *ProjectLab;
- @property(nonatomic,strong)UITextField *SerialField;
- @property(nonatomic,strong)UILabel *dateLab;
- @property(nonatomic,strong)UITextField *typeField;
- @property(nonatomic,strong)UITextField *priceField;
- @property(nonatomic,strong)UITextField *dateField;
- @property(nonatomic,strong)UITextField *areaField;
- @property(nonatomic,strong)UIButton *dateBtn;
- @property(nonatomic,strong)UILabel *qianyueType;
- @property(nonatomic,strong)NSString *roomNo;
- @property(nonatomic,strong)NSString *houseMoneyTotal;
- @property (nonatomic,strong) DatePickerView *datePicker;
- @property (strong, nonatomic) HttpRequestManger *sessionManager;
- @property(nonatomic,strong)NSMutableArray *uploadImages;
- @property(nonatomic,strong)UITextView *describeText;
- @property(nonatomic,strong)UILabel *lbl;
- @property(nonatomic,strong)NSString *names;
- //@property(nonatomic,strong)NSString *phones;
- //@property(nonatomic,strong)NSString *cards;//职位
- //@property(nonatomic,strong)NSString *brand;//品牌
- @property(nonatomic,strong)NSString *area;//面积
- @end
- @implementation NewSignVC
- - (HttpRequestManger*) sessionManager{
- if (!_sessionManager) {
- _sessionManager = [[HttpRequestManger alloc]init];
- }
- return _sessionManager;
- }
- -(void)viewWillAppear:(BOOL)animated{
-
- [super viewWillAppear:YES];
- [self loadRenGouData];
-
- }
- -(void)loadRenGouData{
-
- [ProgressHUD show];
- self.arrayRow = [NSMutableArray array];
- NSMutableDictionary *dic =[[NSMutableDictionary alloc]init];
- dic[@"orderNo"] = self.orderNo;
-
- [self.sessionManager sendPostHttpRequestWithUrl:You_renGouData params:dic bodyBlock:nil progress:nil success:^(NSDictionary *response) {
- [ProgressHUD hide];
- NSLog(@"%@",response);
- customerModel *model= [[customerModel alloc]init];
- model.customerName = response[@"orderEntity"][@"customerName"];
- model.mobile = response[@"orderEntity"][@"mobile"];
- // model.identityCard = response[@"orderEntity"][@"identityCard"];
- model.customerType = @"1";
- model.customerPosition = response[@"orderEntity"][@"customerPosition"];
- model.brandName =response[@"orderEntity"][@"brandName"];
- self.area =response[@"orderEntity"][@"acreage"];
- self.roomNo = response[@"orderEntity"][@"roomNo"];
- self.houseMoneyTotal =response[@"orderEntity"][@"houseMoneyTotal"];
- // self.cards = response[@"orderEntity"][@"customerPosition"];
- // self.brand = response[@"orderEntity"][@"brandName"];
-
- [self.arrayRow addObject:model];
- [self.tab reloadData];
- _priceField.text = self.houseMoneyTotal;
- _SerialField.text = self.roomNo;
- _areaField.text = self.area;
-
-
- } failure:^(NSError *error) {
- [ProgressHUD hide];
- NSLog(@"%@",error);
- }];
-
-
-
-
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self.navigationView removeAllLeftButton];
- self.view.backgroundColor = [UIColor colorWithHexValue:0xF7F8FA];
- _titleLab = [[UILabel alloc]init];
- _titleLab.frame = CGRectMake(0,0, kGScreenWidth-60, 30);
- _titleLab.text = @"录签约";
- [self.navigationView addTitleView:_titleLab];
- kWeakSelf(self);
- [self.navigationView addLeftButtonWithImage:[UIImage imageNamed:@"btn_back"] clickCallBack:^(UIView *view) {
-
- [weakself.navigationController popViewControllerAnimated:YES];
-
- }];
- UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(15, kGScreenHeight -70, kGScreenWidth-30, 50)];
- bottomView.backgroundColor = [UIColor colorWithHexValue:0x64ABFF];
- [self.view addSubview:bottomView];
- _sendBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _sendBtn.frame = CGRectMake(0, 0, kGScreenWidth-30, 50);
- [_sendBtn setTitle:@"提交" forState:UIControlStateNormal];
- _sendBtn.backgroundColor = [UIColor colorWithHexValue:0x64ABFF];
- [_sendBtn setTintColor:[UIColor whiteColor]];
- [_sendBtn addTarget:self action:@selector(buttonEvent:) forControlEvents:UIControlEventTouchUpInside];
- [bottomView addSubview:_sendBtn];
- _tab = [[UITableView alloc]initWithFrame:CGRectMake(0, NaviHeight, kGScreenWidth, kGScreenHeight -NaviHeight -70) style:UITableViewStylePlain];
- _tab.delegate = self;
- _tab.dataSource = self;
- _tab.backgroundColor = KRGB_COLOR(247, 249,251);
- // self.tab.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10);
- [self.view addSubview:_tab];
- if (@available(iOS 11.0, *)) {
- _tab.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- }else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
-
- [self addFooterView];
-
-
-
- // Do any additional setup after loading the view.
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- //返回视图行数
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [_arrayRow count];
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 230;
- }
- -(void)setEditing:(BOOL)editing animated:(BOOL)animated{
-
- /*首先调用父类的方法*/
- [super setEditing:editing animated:animated];
- /*使tableView出于编辑状态*/
- [self.tab setEditing:editing animated:animated];
- }
- - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (indexPath.section ==0) {
-
- if (0 == indexPath.row) {
- return NO; /*第一行不能进行编辑*/
- } else {
- return YES;
- }
-
- }else{
-
- return NO;
- }
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- customerModel *model = self.arrayRow[indexPath.row];
- if (indexPath.row == 0) {
- NewSaleTableViewCell *cell = [NewSaleTableViewCell qianYueCustomerCell:model WithTableView:tableView];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- [cell.addBtn addTarget:self action:@selector(addClick) forControlEvents:UIControlEventTouchUpInside];
- cell.addImage.userInteractionEnabled = YES;
- UITapGestureRecognizer *addTap =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(addClick)];
- [cell.addImage addGestureRecognizer:addTap];
- tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- cell.background_View.userInteractionEnabled = YES;
- [cell.background_View addTapGestureWithBlock:^{
- _popView = [[signPopView alloc]initWithFrame:CGRectMake(0, 0, kGScreenWidth, kGScreenHeight) withCustomerModel:model];
- [self.popView showAlertView];
- kWeakSelf(self)
- _popView.popClick = ^{
-
- if ([weakself.popView.nameField.text length] == 0) {
-
- [ToastView showToast:@"请输入客户姓名"];
-
- return ;
-
- }else if ([_popView.phoneField.text length] == 0) {
-
- [ToastView showToast:@"请输入联系方式"];
-
- return ;
- }else if ([_popView.cardField.text length] == 0) {
-
- [ToastView showToast:@"请输入公司信息"];
-
- return ;
- }else if ([_popView.brandField.text length] == 0) {
-
- [ToastView showToast:@"请输入品牌名称"];
-
- return ;
- }
- customerModel *model = [[customerModel alloc]init];
- model.customerName = weakself.popView.nameField.text;
- model.mobile = weakself.popView.phoneField.text;
- model.customerPosition = weakself.popView.cardField.text;//职位
- model.brandName = weakself.popView.brandField.text;//品牌
-
- model.customerType = @"1";
- [weakself.arrayRow replaceObjectAtIndex:indexPath.row withObject:model];
- [tableView reloadRow:indexPath.row inSection:0 withRowAnimation:UITableViewRowAnimationAutomatic];
-
- [weakself.popView removeFromSuperview];
- };
-
-
- }];
-
-
- return cell;
-
- }else{
- NewSaleTableViewCell *cell = [NewSaleTableViewCell qianYueCustomerCell:model WithTableView:tableView];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- [cell.deleteBtn addTarget:self action:@selector(deleteClick:) forControlEvents:UIControlEventTouchUpInside];
- tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- cell.background_View.userInteractionEnabled = YES;
- [cell.background_View addTapGestureWithBlock:^{
- _popView = [[signPopView alloc]initWithFrame:CGRectMake(0, 0, kGScreenWidth, kGScreenHeight) withCustomerModel:model];
- [self.popView showAlertView];
- kWeakSelf(self)
- _popView.popClick = ^{
-
- if ([weakself.popView.nameField.text length] == 0) {
-
- [ToastView showToast:@"请输入客户姓名"];
-
- return ;
-
- }else if ([_popView.phoneField.text length] == 0) {
-
- [ToastView showToast:@"请输入联系方式"];
-
- return ;
- }else if ([_popView.cardField.text length] == 0) {
-
- [ToastView showToast:@"请输入公司信息"];
-
- return ;
- }else if ([_popView.brandField.text length] == 0) {
-
- [ToastView showToast:@"请输入品牌名称"];
-
- return ;
- }
- customerModel *model = [[customerModel alloc]init];
- model.customerName = weakself.popView.nameField.text;
- model.mobile = weakself.popView.phoneField.text;
- model.customerPosition = weakself.popView.cardField.text;
- model.brandName = weakself.popView.brandField.text;
- model.customerType = @"2";
- [weakself.arrayRow replaceObjectAtIndex:indexPath.row withObject:model];
- [tableView reloadRow:indexPath.row inSection:0 withRowAnimation:UITableViewRowAnimationAutomatic];
- // [weakself.tab beginUpdates];
- // [weakself.tab endUpdates];
- [weakself.popView removeFromSuperview];
- };
-
-
- }];
-
- return cell;
- }
-
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
-
- return 0.001;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
-
- return 0.001;
- }
- -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
-
- return nil;
-
- }
- -(void)addFooterView{
-
- UIView *infoView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, kGScreenWidth, 750)];
- infoView.backgroundColor = RGBColor(247, 248, 250);
- UILabel *title = [[UILabel alloc]init];
- title.textColor = [UIColor blackColor];
- title.font = TextFont(16.5);
- title.text = @"项目信息";
- [infoView addSubview:title];
- [title mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(120, 15));
- make.left.equalTo(infoView.mas_left).offset(15);
- make.top.equalTo(infoView.mas_top).offset(15);
- }];
-
- UIView *view2 =[[UIView alloc]init];
-
- view2.backgroundColor = [UIColor whiteColor];
-
- [infoView addSubview:view2];
-
- [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 88));
- make.left.equalTo(infoView.mas_left);
- make.top.equalTo(title.mas_bottom).offset(15);
- }];
-
- UIImageView *xingImage3 = [[UIImageView alloc]init];
- xingImage3.image = [UIImage imageNamed:@"redxing"];
- [view2 addSubview:xingImage3];
- [xingImage3 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view2.mas_left).offset(15);
- make.top.equalTo(view2.mas_top).offset(18);
- make.size.mas_equalTo(CGSizeMake(8, 8));
-
- }];
- UILabel *titleLa6 = [[UILabel alloc]init];
- titleLa6.textColor = [UIColor blackColor];
- titleLa6.font = TextFont(15);
- titleLa6.textAlignment = NSTextAlignmentRight;
- [view2 addSubview:titleLa6];
- titleLa6.text = @"项目名称:";
-
- [titleLa6 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(xingImage3.mas_right).offset(3);
- make.top.equalTo(view2.mas_top).offset(15);
- make.size.mas_equalTo(CGSizeMake(70, 15));
- }];
- _ProjectLab = [[UILabel alloc]init];
- _ProjectLab.textColor = [UIColor blackColor];
- _ProjectLab.font = TextFont(15);
- _ProjectLab.textAlignment = NSTextAlignmentLeft;
- [view2 addSubview:_ProjectLab];
- _ProjectLab.text = _projectName;
-
- [_ProjectLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 20));
- make.left.equalTo(titleLa6.mas_right).offset(18);
- make.top.equalTo(view2.mas_top).offset(13);
- }];
-
- UIView *line3 = [[UIView alloc]init];
- line3.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
- [view2 addSubview:line3];
- [line3 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view2.mas_left);
- make.top.equalTo(titleLa6.mas_bottom).offset(15);
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
-
- }];
- UIImageView *xingImage4 = [[UIImageView alloc]init];
- xingImage4.image = [UIImage imageNamed:@"redxing"];
- [view2 addSubview:xingImage4];
- [xingImage4 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view2.mas_left).offset(15);
- make.top.equalTo(line3.mas_top).offset(18);
- make.size.mas_equalTo(CGSizeMake(8, 8));
-
- }];
- UILabel *titleLa7 = [[UILabel alloc]init];
- titleLa7.textColor = [UIColor blackColor];
- titleLa7.font = TextFont(15);
- titleLa7.textAlignment = NSTextAlignmentRight;
- [view2 addSubview:titleLa7];
- titleLa7.text = @"签约房号:";
-
- [titleLa7 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(xingImage4.mas_right).offset(3);
- make.top.equalTo(line3.mas_top).offset(15);
- make.size.mas_equalTo(CGSizeMake(70, 15));
- }];
-
- _SerialField = [[UITextField alloc]init];
- _SerialField.placeholder =@"请输入签约房号";
- _SerialField.text = self.roomNo;
- _SerialField.textAlignment = NSTextAlignmentLeft;
- _SerialField.textColor = [UIColor blackColor];
- _SerialField.font = TextFont(15);
- [view2 addSubview:_SerialField];
- [_SerialField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 30));
- make.left.equalTo(titleLa7.mas_right).offset(18);
- make.top.equalTo(line3.mas_top).offset(8);
- }];
-
- UILabel *titleLa8 = [[UILabel alloc]init];
- titleLa8.textColor = [UIColor blackColor];
- titleLa8.font = TextFont(16.5);
- [infoView addSubview:titleLa8];
- titleLa8.text = @"其他签约信息";
-
- [titleLa8 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(120, 15));
- make.left.equalTo(infoView.mas_left).offset(15);
- make.top.equalTo(view2.mas_bottom).offset(15);
- }];
-
- UIView *view3 =[[UIView alloc]init];
-
- view3.backgroundColor = [UIColor whiteColor];
-
- [infoView addSubview:view3];
-
- [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 176));
- make.left.equalTo(infoView.mas_left);
- make.top.equalTo(titleLa8.mas_bottom).offset(15);
-
- }];
-
- UIImageView *xingImage5 = [[UIImageView alloc]init];
- xingImage5.image = [UIImage imageNamed:@"redxing"];
- [view3 addSubview:xingImage5];
- [xingImage5 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view3.mas_left).offset(15);
- make.top.equalTo(view3.mas_top).offset(18);
- make.size.mas_equalTo(CGSizeMake(8, 8));
-
- }];
- UILabel *titleLa9 = [[UILabel alloc]init];
- titleLa9.textColor = [UIColor blackColor];
- titleLa9.font = TextFont(15);
- titleLa9.textAlignment = NSTextAlignmentRight;
- [view3 addSubview:titleLa9];
- titleLa9.text = @"签约类型:";
-
- [titleLa9 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(xingImage5.mas_right).offset(3);
- make.top.equalTo(view3.mas_top).offset(15);
- make.size.mas_equalTo(CGSizeMake(70, 15));
- }];
- _qianyueType = [[UILabel alloc]init];
- _qianyueType.textColor = [UIColor blackColor];
- _qianyueType.font = TextFont(15);
- _qianyueType.textAlignment = NSTextAlignmentLeft;
- [view3 addSubview:_qianyueType];
- // if ([_projectType isEqualToString:@"1"]) {
-
- _qianyueType.text = self.projectType;
- // }else{
- //
- // _qianyueType.text = @"招商";
- // }
- [_qianyueType mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 20));
- make.left.equalTo(titleLa9.mas_right).offset(18);
- make.top.equalTo(view3.mas_top).offset(13);
- }];
-
- UIView *line4 = [[UIView alloc]init];
- line4.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
- [view3 addSubview:line4];
- [line4 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view3.mas_left);
- make.top.equalTo(titleLa9.mas_bottom).offset(15);
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
-
- }];
-
- UIImageView *xingImage6 = [[UIImageView alloc]init];
- xingImage6.image = [UIImage imageNamed:@"redxing"];
- [view3 addSubview:xingImage6];
- [xingImage6 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view3.mas_left).offset(15);
- make.top.equalTo(line4.mas_top).offset(18);
- make.size.mas_equalTo(CGSizeMake(8, 8));
-
- }];
- UILabel *titleLa10 = [[UILabel alloc]init];
- titleLa10.textColor = [UIColor blackColor];
- titleLa10.font = TextFont(15);
- titleLa10.textAlignment = NSTextAlignmentRight;
- [view3 addSubview:titleLa10];
- titleLa10.text = @"签约价格:";
- [titleLa10 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(xingImage6.mas_right).offset(3);
- make.top.equalTo(line4.mas_top).offset(15);
- make.size.mas_equalTo(CGSizeMake(70, 15));
- }];
-
- _priceField = [[UITextField alloc]init];
- _priceField.placeholder =@"请输入房款总额";
- _priceField.text = self.houseMoneyTotal;
- _priceField.textAlignment = NSTextAlignmentLeft;
- _priceField.textColor = [UIColor blackColor];
- _priceField.font = TextFont(15);
- [view3 addSubview:_priceField];
- [_priceField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 30));
- make.left.equalTo(titleLa10.mas_right).offset(18);
- make.top.equalTo(line4.mas_top).offset(8);
- }];
-
- UIView *line5 = [[UIView alloc]init];
- line5.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
- [view3 addSubview:line5];
- [line5 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view3.mas_left);
- make.top.equalTo(titleLa10.mas_bottom).offset(15);
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
-
- }];
-
- UIImageView *xingImage7 = [[UIImageView alloc]init];
- xingImage7.image = [UIImage imageNamed:@"redxing"];
- [view3 addSubview:xingImage7];
- [xingImage7 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view3.mas_left).offset(15);
- make.top.equalTo(line5.mas_top).offset(18);
- make.size.mas_equalTo(CGSizeMake(8, 8));
-
- }];
-
- UILabel *titleLa11 = [[UILabel alloc]init];
- titleLa11.textColor = [UIColor blackColor];
- titleLa11.font = TextFont(15);
- titleLa11.textAlignment = NSTextAlignmentRight;
- [view3 addSubview:titleLa11];
- titleLa11.text = @"签约日期:";
- [titleLa11 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(xingImage7.mas_right).offset(3);
- make.top.equalTo(line5.mas_top).offset(15);
- make.size.mas_equalTo(CGSizeMake(70, 15));
- }];
-
- _dateLab = [[UILabel alloc]init];
- _dateLab.textColor = [UIColor colorWithHexValue:0x898989];
- _dateLab.font = TextFont(15);
- _dateLab.text = @"请选择";
- _dateLab.textAlignment = NSTextAlignmentLeft;
- [view3 addSubview:_dateLab];
- [_dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.size.mas_equalTo(CGSizeMake(100, 30));
- make.left.equalTo(titleLa11.mas_right).offset(18);
- make.top.equalTo(line5.mas_top).offset(8);
- }];
- _dateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_dateBtn setBackgroundImage:[UIImage imageNamed:@"icon_date"] forState:UIControlStateNormal];
- [_dateBtn addTarget:self action:@selector(dateClick:) forControlEvents:UIControlEventTouchUpInside];
- [view3 addSubview:_dateBtn];
- [_dateBtn mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.size.mas_equalTo(CGSizeMake(22, 22));
- make.left.equalTo(_dateLab.mas_right).offset(8);
- make.top.equalTo(line5.mas_top).offset(10);
-
- }];
- UIView *line6 = [[UIView alloc]init];
- line6.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
- [view3 addSubview:line6];
- [line6 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view3.mas_left);
- make.top.equalTo(titleLa11.mas_bottom).offset(15);
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
-
- }];
-
- UIImageView *xingImage8 = [[UIImageView alloc]init];
- xingImage8.image = [UIImage imageNamed:@"redxing"];
- [view3 addSubview:xingImage8];
- [xingImage8 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view3.mas_left).offset(15);
- make.top.equalTo(line6.mas_top).offset(18);
- make.size.mas_equalTo(CGSizeMake(8, 8));
-
- }];
-
- UILabel *titleLa12 = [[UILabel alloc]init];
- titleLa12.textColor = [UIColor blackColor];
- titleLa12.font = TextFont(15);
- titleLa12.textAlignment = NSTextAlignmentRight;
- [view3 addSubview:titleLa12];
- titleLa12.text = @"签约面积:";
- [titleLa12 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(xingImage8.mas_right).offset(3);
- make.top.equalTo(line6.mas_top).offset(15);
- make.size.mas_equalTo(CGSizeMake(70, 15));
- }];
-
- _areaField = [[UITextField alloc]init];
- _areaField.placeholder =@"请输入签约面积";
- _areaField.textAlignment = NSTextAlignmentLeft;
- _areaField.textColor = [UIColor blackColor];
- _areaField.font = TextFont(15);
- [view3 addSubview:_areaField];
- [_areaField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 30));
- make.left.equalTo(titleLa12.mas_right).offset(18);
- make.top.equalTo(line6.mas_top).offset(8);
- }];
-
- UIView *line7 = [[UIView alloc]init];
- line7.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
- [view3 addSubview:line7];
- [line7 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view3.mas_left);
- make.top.equalTo(view3.mas_bottom).offset(-1);
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
-
- }];
- UIView *view4 =[[UIView alloc]init];
-
- view4.backgroundColor = [UIColor whiteColor];
-
- [infoView addSubview:view4];
-
- [view4 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 188));
- make.left.equalTo(infoView.mas_left);
- make.top.equalTo(view3.mas_bottom);
-
- }];
-
- UIImageView *xingImage9 = [[UIImageView alloc]init];
- xingImage9.image = [UIImage imageNamed:@"redxing"];
- [view4 addSubview:xingImage9];
- [xingImage9 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(view4.mas_left).offset(15);
- make.top.equalTo(view4.mas_top).offset(12);
- make.size.mas_equalTo(CGSizeMake(8, 8));
-
- }];
-
-
- ACSelectMediaView *mediaView = [[ACSelectMediaView alloc] initWithFrame:CGRectMake(22, 0, [[UIScreen mainScreen] bounds].size.width -22, 1)];
- mediaView.type = ACMediaTypePhotoAndCamera;
- mediaView.maxImageSelected = 6;
- mediaView.uploadStr =@"上传凭证:";
- mediaView.backgroundColor = [UIColor whiteColor];
- mediaView.naviBarBgColor = [UIColor redColor];
- mediaView.rowImageCount = 3;
- mediaView.lineSpacing = 20;
- mediaView.interitemSpacing = 20;
- mediaView.sectionInset = UIEdgeInsetsMake(20, 20, 20, 20);
- [mediaView observeViewHeight:^(CGFloat mediaHeight) {
- [view4 mas_updateConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth, mediaHeight));
- make.left.equalTo(infoView.mas_left);
- make.top.equalTo(view3.mas_bottom);
- }];
- }];
- [mediaView observeSelectedMediaArray:^(NSArray<ACMediaModel *> *list) {
- _imageArr = [NSMutableArray array];
- for (ACMediaModel *model in list) {
- UIImage *data = model.image;
- [_imageArr addObject:data];
- }
-
- }];
-
- _mediaView = mediaView;
-
- [view4 addSubview:_mediaView];
-
- UIView *view5 =[[UIView alloc]init];
-
- view5.backgroundColor = [UIColor whiteColor];
-
- [infoView addSubview:view5];
-
- [view5 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 155));
- make.left.equalTo(infoView.mas_left);
- make.top.equalTo(view4.mas_bottom).offset(1);
-
- }];
-
- UILabel *titleLa13 = [[UILabel alloc]initWithFrame:CGRectMake(15, 15, 60, 15)];
-
- titleLa13.textColor = [UIColor blackColor];
-
- titleLa13.font = TextFont(15);
- [view5 addSubview:titleLa13];
- titleLa13.text = @"备注:";
- _describeText =[[UITextView alloc]init];
-
- _describeText.textColor = [UIColor blackColor];
-
- _describeText.font = TextFont(15);
-
- _describeText.textAlignment = NSTextAlignmentLeft;
-
- _describeText.backgroundColor = [UIColor colorWithHexValue:0xF7F8FA];
- _describeText.textContainerInset = UIEdgeInsetsMake(20, 20, 20, 20);
- _describeText.editable = YES;
- [view5 addSubview:_describeText];
- [_describeText mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth-30, 100));
- make.left.equalTo(view5.mas_left).offset(15);
- make.top.equalTo(titleLa13.mas_bottom).offset(15);
-
- }];
- _lbl = [[UILabel alloc]initWithFrame:CGRectMake(20, 20, 200, 20)];
- _lbl.enabled = NO;
- _lbl.text = @"请填写备注...";
- _lbl.font = [UIFont systemFontOfSize:15];
- _lbl.textColor = [[UIColor colorWithHexValue:0xD3D6DD]colorWithAlphaComponent:0.5];
- [_describeText addSubview:_lbl];
-
- _describeText.delegate = self;
-
- _tab.tableFooterView = infoView;
-
- }
- -(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
- return nil;
- // Do any additional setup after loading the view.
- }
- -(void)dateClick:(UIButton *)sender{
- __weak NewSignVC * weakself=self;
-
- if (!self.datePicker) {
-
- self.datePicker =[[[NSBundle mainBundle] loadNibNamed:@"DatePickerView" owner:self options:0] lastObject];
- self.datePicker.frame =CGRectMake(0, self.view.frame.size.height-260, self.view.frame.size.width, 260);
- self.datePicker.Datetitle =@"日期选择";
- self.datePicker.cancelBlock = ^{
- [UIView animateWithDuration:5 animations:^{
- [weakself.datePicker removeFromSuperview];
- weakself.datePicker = nil;
- }];
- };
- self.datePicker.sureBlock = ^(NSString *selectDateStr) {
- [weakself.dateLab setText:selectDateStr];
- [UIView animateWithDuration:5 animations:^{
- [weakself.datePicker removeFromSuperview];
- weakself.datePicker = nil;
- }];
- };
- [self.view addSubview:self.datePicker];
-
- }
-
- }
- #pragma mark - UITextView的代理方法
- - (void)textViewDidChange:(UITextView *)textView
- {
- if ([textView.text length] == 0) {
- [_lbl setHidden:NO];
- }else{
- [_lbl setHidden:YES];
- }
- }
- -(void)addClick{
-
- customerModel *model =[[customerModel alloc]init];
- _popView = [[signPopView alloc]initWithFrame:CGRectMake(0, 0, kGScreenWidth, kGScreenHeight) withCustomerModel:model];
- [self.popView showAlertView];
- kWeakSelf(self)
- _popView.popClick = ^{
-
- if ([_popView.nameField.text length] == 0) {
-
- [ToastView showToast:@"请输入客户姓名"];
-
- return ;
-
- }else if ([_popView.phoneField.text length] == 0) {
-
- [ToastView showToast:@"请输入联系方式"];
-
- return ;
- }else if ([_popView.cardField.text length] == 0) {
-
- [ToastView showToast:@"请输入公司职位"];
-
- return ;
- }else if ([_popView.brandField.text length] == 0) {
-
- [ToastView showToast:@"请输入品牌信息"];
-
- return ;
- }
-
- customerModel *model = [[customerModel alloc]init];
- model.customerName = weakself.popView.nameField.text;
- model.mobile = weakself.popView.phoneField.text;
- model.customerPosition = weakself.popView.cardField.text;
- model.brandName = weakself.popView.brandField.text;
- model.customerType = @"2";
-
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:weakself.arrayRow.count inSection:0];
- [weakself.arrayRow insertObject:model atIndex:weakself.arrayRow.count];
- [weakself.tab insertRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- [weakself.tab beginUpdates];
- [weakself.tab endUpdates];
-
- [weakself.popView removeFromSuperview];
- };
-
-
- }
- -(void)deleteClick:(UIButton *)sender{
-
- NewSaleTableViewCell *cell = (NewSaleTableViewCell *)sender.superview ;
- NSIndexPath *cellIndexPath = [self.tab indexPathForCell:cell];
- [self.arrayRow removeObjectAtIndex:cellIndexPath.row];
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:cellIndexPath.row inSection:0];
- [self.tab deleteRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationBottom];
- [self.tab beginUpdates];
- [self.tab endUpdates];
- }
- -(void)buttonEvent:(UIButton *)sender{
- NSMutableArray *arrname =[NSMutableArray array];
- NSMutableArray *arrphone = [NSMutableArray array];
- NSMutableArray *arrCard = [NSMutableArray array];
- NSMutableArray *arrBrand = [NSMutableArray array];
-
- for (int i = 0; i<self.arrayRow.count; i++) {
- customerModel *model =self.arrayRow[i];
- self.names = [NSString stringWithFormat:@"%@,%@",self.names,model.customerName];
- [arrname addObject:model.customerName];
- [arrphone addObject:model.mobile];
- [arrCard addObject:model.customerPosition];
- [arrBrand addObject:model.brandName];
- }
-
-
-
- _uploadImages = [NSMutableArray array];
- if ([_SerialField.text length] == 0){
- [ToastView showToast:@"请输入签约房号"];
- return;
- }else if ([_priceField.text length] == 0){
- [ToastView showToast:@"请输入签约价格"];
- return;
- }else if ([_dateLab.text length] < 4){
- [ToastView showToast:@"请选择签约日期"];
- return;
- }else if ([_areaField.text length] == 0){
- [ToastView showToast:@"请输入签约面积"];
- return;
- }else if ([_imageArr count] == 0){
- [ToastView showToast:@"请至少上传一张凭证"];
- return;
- }
- _sendBtn.backgroundColor = [UIColor lightGrayColor];
- _sendBtn.userInteractionEnabled = NO;
- [OSSImageUploader asyncUploadImages:_imageArr complete:^(NSArray<NSString *> *names, UploadImageState state) {
- if (state ==1) {
- for (NSString *name in names) {
- NSString *imageName =[NSString stringWithFormat:@"/%@",name];
- [_uploadImages addObject:imageName];
- }
- NSLog(@"上传成功");
- NSLog(@"%@",_uploadImages);
- NSMutableDictionary *dic =[NSMutableDictionary dictionary];
- dic[@"orderNo"] = self.orderNo;;
- dic[@"orderStatus"] = @"5";
- dic[@"roomNo"] = _SerialField.text;
- dic[@"houseMoneyTotal"] = _priceField.text;
- dic[@"picPath"] =[_uploadImages componentsJoinedByString:@","];
- dic[@"signTime"] =_dateLab.text;
- dic[@"acreage"] = _areaField.text;
- dic[@"description"] = _describeText.text;
- dic[@"customerName"] = [arrname componentsJoinedByString:@","];
- dic[@"mobile"] = [arrphone componentsJoinedByString:@","];
- dic[@"brandName"] =[arrBrand componentsJoinedByString:@","];
- dic[@"customerPosition"] =[arrCard componentsJoinedByString:@","];//职位
-
-
- [ProgressHUD show];
- kWeakSelf(self);
- [self.sessionManager sendPostHttpRequestWithUrl:sendApproveInfo params:dic bodyBlock:^(id<AFMultipartFormData> formData) {
-
- } progress:^(NSProgress *progressValue) {
-
- } success:^(NSDictionary *response) {
- [ProgressHUD hide];
- NSLog(@"%@",response);
- for (UIViewController *controller in weakself.navigationController.viewControllers) {
- if ([controller isKindOfClass:[ProjectControlsVC class]]) {
-
- [DKGlobal sharedInstance].typeName =@"5";
-
- [[NSNotificationCenter defaultCenter]postNotificationName:@"changeIndex4" object:nil];
-
- [DKGlobal sharedInstance].tagString = @"";
-
- if ([self.isSearch isEqualToString:@"1"]) {
-
- ProjectControlsVC *projectVC = [[ProjectControlsVC alloc]init];
-
- projectVC.projectID = self.projectID;
-
- projectVC.projectType = self.projectType;
-
- projectVC.projectName = self.projectName;
-
- projectVC.isSearch = weakself.isSearch;
-
- [weakself.navigationController pushViewController:projectVC animated:YES];
- }else{
-
- [weakself.navigationController popToViewController:controller animated:YES];
- }
- return;
- }
- }
-
- } failure:^(NSError *error) {
- _sendBtn.backgroundColor = [UIColor colorWithHexValue:0x64ABFF];
- _sendBtn.userInteractionEnabled = YES;
- NSLog(@"%@",error);
- [ProgressHUD hide];
- }];
-
- }else{
- NSLog(@"上传失败");
- }
-
- }];
- }
- - (void)dealloc {
- if (_sessionManager) {
- [_sessionManager cancelAllTask];
- }
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- DebugLog(@"%@没有造成循环引用", [self class]);
- }
- @end
|