NewSignVC.m 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  1. //
  2. // QianYueViewController.m
  3. // upAPP
  4. //
  5. // Created by 贺泌钦 on 2020/11/3.
  6. // Copyright © 2020 youke. All rights reserved.
  7. //
  8. #import "NewSignVC.h"
  9. #import "qianYueCustomerCell.h"
  10. #import "qianYuePopView.h"
  11. #import "managerModel.h"
  12. #import "ACMediaFrame.h"
  13. #import "UIView+ACMediaExt.h"
  14. #import "YDFlexoView.h"
  15. #import "RadioButton.h"
  16. #import "DatePickerView.h"
  17. #import "OSSImageUploader.h"
  18. #import "ProjectControlsVC.h"
  19. #import "signPopView.h"
  20. #import "NewSaleTableViewCell.h"
  21. @interface NewSignVC ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate,UITextFieldDelegate>{
  22. CGFloat _mediaH;
  23. ACSelectMediaView *_mediaView;
  24. }
  25. @property(nonatomic,strong)UILabel *titleLab;
  26. @property(nonatomic,strong)UITableView *tab;
  27. @property(nonatomic,strong)NSMutableArray *imageArr;
  28. @property(nonatomic,strong)UIButton *sendBtn;
  29. @property(nonatomic,strong)NSMutableArray *arrayRow;
  30. @property(nonatomic,strong)signPopView *popView;
  31. @property(nonatomic,strong)UILabel *ProjectLab;
  32. @property(nonatomic,strong)UITextField *SerialField;
  33. @property(nonatomic,strong)UILabel *dateLab;
  34. @property(nonatomic,strong)UITextField *typeField;
  35. @property(nonatomic,strong)UITextField *priceField;
  36. @property(nonatomic,strong)UITextField *dateField;
  37. @property(nonatomic,strong)UITextField *areaField;
  38. @property(nonatomic,strong)UIButton *dateBtn;
  39. @property(nonatomic,strong)UILabel *qianyueType;
  40. @property(nonatomic,strong)NSString *roomNo;
  41. @property(nonatomic,strong)NSString *houseMoneyTotal;
  42. @property (nonatomic,strong) DatePickerView *datePicker;
  43. @property (strong, nonatomic) HttpRequestManger *sessionManager;
  44. @property(nonatomic,strong)NSMutableArray *uploadImages;
  45. @property(nonatomic,strong)UITextView *describeText;
  46. @property(nonatomic,strong)UILabel *lbl;
  47. @property(nonatomic,strong)NSString *names;
  48. //@property(nonatomic,strong)NSString *phones;
  49. //@property(nonatomic,strong)NSString *cards;//职位
  50. //@property(nonatomic,strong)NSString *brand;//品牌
  51. @property(nonatomic,strong)NSString *area;//面积
  52. @end
  53. @implementation NewSignVC
  54. - (HttpRequestManger*) sessionManager{
  55. if (!_sessionManager) {
  56. _sessionManager = [[HttpRequestManger alloc]init];
  57. }
  58. return _sessionManager;
  59. }
  60. -(void)viewWillAppear:(BOOL)animated{
  61. [super viewWillAppear:YES];
  62. [self loadRenGouData];
  63. }
  64. -(void)loadRenGouData{
  65. [ProgressHUD show];
  66. self.arrayRow = [NSMutableArray array];
  67. NSMutableDictionary *dic =[[NSMutableDictionary alloc]init];
  68. dic[@"orderNo"] = self.orderNo;
  69. [self.sessionManager sendPostHttpRequestWithUrl:You_renGouData params:dic bodyBlock:nil progress:nil success:^(NSDictionary *response) {
  70. [ProgressHUD hide];
  71. NSLog(@"%@",response);
  72. customerModel *model= [[customerModel alloc]init];
  73. model.customerName = response[@"orderEntity"][@"customerName"];
  74. model.mobile = response[@"orderEntity"][@"mobile"];
  75. // model.identityCard = response[@"orderEntity"][@"identityCard"];
  76. model.customerType = @"1";
  77. model.customerPosition = response[@"orderEntity"][@"customerPosition"];
  78. model.brandName =response[@"orderEntity"][@"brandName"];
  79. self.area =response[@"orderEntity"][@"acreage"];
  80. self.roomNo = response[@"orderEntity"][@"roomNo"];
  81. self.houseMoneyTotal =response[@"orderEntity"][@"houseMoneyTotal"];
  82. // self.cards = response[@"orderEntity"][@"customerPosition"];
  83. // self.brand = response[@"orderEntity"][@"brandName"];
  84. [self.arrayRow addObject:model];
  85. [self.tab reloadData];
  86. _priceField.text = self.houseMoneyTotal;
  87. _SerialField.text = self.roomNo;
  88. _areaField.text = self.area;
  89. } failure:^(NSError *error) {
  90. [ProgressHUD hide];
  91. NSLog(@"%@",error);
  92. }];
  93. }
  94. - (void)viewDidLoad {
  95. [super viewDidLoad];
  96. [self.navigationView removeAllLeftButton];
  97. self.view.backgroundColor = [UIColor colorWithHexValue:0xF7F8FA];
  98. _titleLab = [[UILabel alloc]init];
  99. _titleLab.frame = CGRectMake(0,0, kGScreenWidth-60, 30);
  100. _titleLab.text = @"录签约";
  101. [self.navigationView addTitleView:_titleLab];
  102. kWeakSelf(self);
  103. [self.navigationView addLeftButtonWithImage:[UIImage imageNamed:@"btn_back"] clickCallBack:^(UIView *view) {
  104. [weakself.navigationController popViewControllerAnimated:YES];
  105. }];
  106. UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(15, kGScreenHeight -70, kGScreenWidth-30, 50)];
  107. bottomView.backgroundColor = [UIColor colorWithHexValue:0x64ABFF];
  108. [self.view addSubview:bottomView];
  109. _sendBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  110. _sendBtn.frame = CGRectMake(0, 0, kGScreenWidth-30, 50);
  111. [_sendBtn setTitle:@"提交" forState:UIControlStateNormal];
  112. _sendBtn.backgroundColor = [UIColor colorWithHexValue:0x64ABFF];
  113. [_sendBtn setTintColor:[UIColor whiteColor]];
  114. [_sendBtn addTarget:self action:@selector(buttonEvent:) forControlEvents:UIControlEventTouchUpInside];
  115. [bottomView addSubview:_sendBtn];
  116. _tab = [[UITableView alloc]initWithFrame:CGRectMake(0, NaviHeight, kGScreenWidth, kGScreenHeight -NaviHeight -70) style:UITableViewStylePlain];
  117. _tab.delegate = self;
  118. _tab.dataSource = self;
  119. _tab.backgroundColor = KRGB_COLOR(247, 249,251);
  120. // self.tab.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10);
  121. [self.view addSubview:_tab];
  122. if (@available(iOS 11.0, *)) {
  123. _tab.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  124. }else {
  125. self.automaticallyAdjustsScrollViewInsets = NO;
  126. }
  127. [self addFooterView];
  128. // Do any additional setup after loading the view.
  129. }
  130. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  131. {
  132. return 1;
  133. }
  134. //返回视图行数
  135. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  136. {
  137. return [_arrayRow count];
  138. }
  139. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  140. return 230;
  141. }
  142. -(void)setEditing:(BOOL)editing animated:(BOOL)animated{
  143. /*首先调用父类的方法*/
  144. [super setEditing:editing animated:animated];
  145. /*使tableView出于编辑状态*/
  146. [self.tab setEditing:editing animated:animated];
  147. }
  148. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
  149. {
  150. if (indexPath.section ==0) {
  151. if (0 == indexPath.row) {
  152. return NO; /*第一行不能进行编辑*/
  153. } else {
  154. return YES;
  155. }
  156. }else{
  157. return NO;
  158. }
  159. }
  160. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  161. {
  162. customerModel *model = self.arrayRow[indexPath.row];
  163. if (indexPath.row == 0) {
  164. NewSaleTableViewCell *cell = [NewSaleTableViewCell qianYueCustomerCell:model WithTableView:tableView];
  165. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  166. [cell.addBtn addTarget:self action:@selector(addClick) forControlEvents:UIControlEventTouchUpInside];
  167. cell.addImage.userInteractionEnabled = YES;
  168. UITapGestureRecognizer *addTap =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(addClick)];
  169. [cell.addImage addGestureRecognizer:addTap];
  170. tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  171. cell.background_View.userInteractionEnabled = YES;
  172. [cell.background_View addTapGestureWithBlock:^{
  173. _popView = [[signPopView alloc]initWithFrame:CGRectMake(0, 0, kGScreenWidth, kGScreenHeight) withCustomerModel:model];
  174. [self.popView showAlertView];
  175. kWeakSelf(self)
  176. _popView.popClick = ^{
  177. if ([weakself.popView.nameField.text length] == 0) {
  178. [ToastView showToast:@"请输入客户姓名"];
  179. return ;
  180. }else if ([_popView.phoneField.text length] == 0) {
  181. [ToastView showToast:@"请输入联系方式"];
  182. return ;
  183. }else if ([_popView.cardField.text length] == 0) {
  184. [ToastView showToast:@"请输入公司信息"];
  185. return ;
  186. }else if ([_popView.brandField.text length] == 0) {
  187. [ToastView showToast:@"请输入品牌名称"];
  188. return ;
  189. }
  190. customerModel *model = [[customerModel alloc]init];
  191. model.customerName = weakself.popView.nameField.text;
  192. model.mobile = weakself.popView.phoneField.text;
  193. model.customerPosition = weakself.popView.cardField.text;//职位
  194. model.brandName = weakself.popView.brandField.text;//品牌
  195. model.customerType = @"1";
  196. [weakself.arrayRow replaceObjectAtIndex:indexPath.row withObject:model];
  197. [tableView reloadRow:indexPath.row inSection:0 withRowAnimation:UITableViewRowAnimationAutomatic];
  198. [weakself.popView removeFromSuperview];
  199. };
  200. }];
  201. return cell;
  202. }else{
  203. NewSaleTableViewCell *cell = [NewSaleTableViewCell qianYueCustomerCell:model WithTableView:tableView];
  204. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  205. [cell.deleteBtn addTarget:self action:@selector(deleteClick:) forControlEvents:UIControlEventTouchUpInside];
  206. tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  207. cell.background_View.userInteractionEnabled = YES;
  208. [cell.background_View addTapGestureWithBlock:^{
  209. _popView = [[signPopView alloc]initWithFrame:CGRectMake(0, 0, kGScreenWidth, kGScreenHeight) withCustomerModel:model];
  210. [self.popView showAlertView];
  211. kWeakSelf(self)
  212. _popView.popClick = ^{
  213. if ([weakself.popView.nameField.text length] == 0) {
  214. [ToastView showToast:@"请输入客户姓名"];
  215. return ;
  216. }else if ([_popView.phoneField.text length] == 0) {
  217. [ToastView showToast:@"请输入联系方式"];
  218. return ;
  219. }else if ([_popView.cardField.text length] == 0) {
  220. [ToastView showToast:@"请输入公司信息"];
  221. return ;
  222. }else if ([_popView.brandField.text length] == 0) {
  223. [ToastView showToast:@"请输入品牌名称"];
  224. return ;
  225. }
  226. customerModel *model = [[customerModel alloc]init];
  227. model.customerName = weakself.popView.nameField.text;
  228. model.mobile = weakself.popView.phoneField.text;
  229. model.customerPosition = weakself.popView.cardField.text;
  230. model.brandName = weakself.popView.brandField.text;
  231. model.customerType = @"2";
  232. [weakself.arrayRow replaceObjectAtIndex:indexPath.row withObject:model];
  233. [tableView reloadRow:indexPath.row inSection:0 withRowAnimation:UITableViewRowAnimationAutomatic];
  234. // [weakself.tab beginUpdates];
  235. // [weakself.tab endUpdates];
  236. [weakself.popView removeFromSuperview];
  237. };
  238. }];
  239. return cell;
  240. }
  241. }
  242. -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  243. return 0.001;
  244. }
  245. -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  246. return 0.001;
  247. }
  248. -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  249. return nil;
  250. }
  251. -(void)addFooterView{
  252. UIView *infoView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, kGScreenWidth, 750)];
  253. infoView.backgroundColor = RGBColor(247, 248, 250);
  254. UILabel *title = [[UILabel alloc]init];
  255. title.textColor = [UIColor blackColor];
  256. title.font = TextFont(16.5);
  257. title.text = @"项目信息";
  258. [infoView addSubview:title];
  259. [title mas_makeConstraints:^(MASConstraintMaker *make) {
  260. make.size.mas_equalTo(CGSizeMake(120, 15));
  261. make.left.equalTo(infoView.mas_left).offset(15);
  262. make.top.equalTo(infoView.mas_top).offset(15);
  263. }];
  264. UIView *view2 =[[UIView alloc]init];
  265. view2.backgroundColor = [UIColor whiteColor];
  266. [infoView addSubview:view2];
  267. [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
  268. make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 88));
  269. make.left.equalTo(infoView.mas_left);
  270. make.top.equalTo(title.mas_bottom).offset(15);
  271. }];
  272. UIImageView *xingImage3 = [[UIImageView alloc]init];
  273. xingImage3.image = [UIImage imageNamed:@"redxing"];
  274. [view2 addSubview:xingImage3];
  275. [xingImage3 mas_makeConstraints:^(MASConstraintMaker *make) {
  276. make.left.equalTo(view2.mas_left).offset(15);
  277. make.top.equalTo(view2.mas_top).offset(18);
  278. make.size.mas_equalTo(CGSizeMake(8, 8));
  279. }];
  280. UILabel *titleLa6 = [[UILabel alloc]init];
  281. titleLa6.textColor = [UIColor blackColor];
  282. titleLa6.font = TextFont(15);
  283. titleLa6.textAlignment = NSTextAlignmentRight;
  284. [view2 addSubview:titleLa6];
  285. titleLa6.text = @"项目名称:";
  286. [titleLa6 mas_makeConstraints:^(MASConstraintMaker *make) {
  287. make.left.equalTo(xingImage3.mas_right).offset(3);
  288. make.top.equalTo(view2.mas_top).offset(15);
  289. make.size.mas_equalTo(CGSizeMake(70, 15));
  290. }];
  291. _ProjectLab = [[UILabel alloc]init];
  292. _ProjectLab.textColor = [UIColor blackColor];
  293. _ProjectLab.font = TextFont(15);
  294. _ProjectLab.textAlignment = NSTextAlignmentLeft;
  295. [view2 addSubview:_ProjectLab];
  296. _ProjectLab.text = _projectName;
  297. [_ProjectLab mas_makeConstraints:^(MASConstraintMaker *make) {
  298. make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 20));
  299. make.left.equalTo(titleLa6.mas_right).offset(18);
  300. make.top.equalTo(view2.mas_top).offset(13);
  301. }];
  302. UIView *line3 = [[UIView alloc]init];
  303. line3.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
  304. [view2 addSubview:line3];
  305. [line3 mas_makeConstraints:^(MASConstraintMaker *make) {
  306. make.left.equalTo(view2.mas_left);
  307. make.top.equalTo(titleLa6.mas_bottom).offset(15);
  308. make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
  309. }];
  310. UIImageView *xingImage4 = [[UIImageView alloc]init];
  311. xingImage4.image = [UIImage imageNamed:@"redxing"];
  312. [view2 addSubview:xingImage4];
  313. [xingImage4 mas_makeConstraints:^(MASConstraintMaker *make) {
  314. make.left.equalTo(view2.mas_left).offset(15);
  315. make.top.equalTo(line3.mas_top).offset(18);
  316. make.size.mas_equalTo(CGSizeMake(8, 8));
  317. }];
  318. UILabel *titleLa7 = [[UILabel alloc]init];
  319. titleLa7.textColor = [UIColor blackColor];
  320. titleLa7.font = TextFont(15);
  321. titleLa7.textAlignment = NSTextAlignmentRight;
  322. [view2 addSubview:titleLa7];
  323. titleLa7.text = @"签约房号:";
  324. [titleLa7 mas_makeConstraints:^(MASConstraintMaker *make) {
  325. make.left.equalTo(xingImage4.mas_right).offset(3);
  326. make.top.equalTo(line3.mas_top).offset(15);
  327. make.size.mas_equalTo(CGSizeMake(70, 15));
  328. }];
  329. _SerialField = [[UITextField alloc]init];
  330. _SerialField.placeholder =@"请输入签约房号";
  331. _SerialField.text = self.roomNo;
  332. _SerialField.textAlignment = NSTextAlignmentLeft;
  333. _SerialField.textColor = [UIColor blackColor];
  334. _SerialField.font = TextFont(15);
  335. [view2 addSubview:_SerialField];
  336. [_SerialField mas_makeConstraints:^(MASConstraintMaker *make) {
  337. make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 30));
  338. make.left.equalTo(titleLa7.mas_right).offset(18);
  339. make.top.equalTo(line3.mas_top).offset(8);
  340. }];
  341. UILabel *titleLa8 = [[UILabel alloc]init];
  342. titleLa8.textColor = [UIColor blackColor];
  343. titleLa8.font = TextFont(16.5);
  344. [infoView addSubview:titleLa8];
  345. titleLa8.text = @"其他签约信息";
  346. [titleLa8 mas_makeConstraints:^(MASConstraintMaker *make) {
  347. make.size.mas_equalTo(CGSizeMake(120, 15));
  348. make.left.equalTo(infoView.mas_left).offset(15);
  349. make.top.equalTo(view2.mas_bottom).offset(15);
  350. }];
  351. UIView *view3 =[[UIView alloc]init];
  352. view3.backgroundColor = [UIColor whiteColor];
  353. [infoView addSubview:view3];
  354. [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
  355. make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 176));
  356. make.left.equalTo(infoView.mas_left);
  357. make.top.equalTo(titleLa8.mas_bottom).offset(15);
  358. }];
  359. UIImageView *xingImage5 = [[UIImageView alloc]init];
  360. xingImage5.image = [UIImage imageNamed:@"redxing"];
  361. [view3 addSubview:xingImage5];
  362. [xingImage5 mas_makeConstraints:^(MASConstraintMaker *make) {
  363. make.left.equalTo(view3.mas_left).offset(15);
  364. make.top.equalTo(view3.mas_top).offset(18);
  365. make.size.mas_equalTo(CGSizeMake(8, 8));
  366. }];
  367. UILabel *titleLa9 = [[UILabel alloc]init];
  368. titleLa9.textColor = [UIColor blackColor];
  369. titleLa9.font = TextFont(15);
  370. titleLa9.textAlignment = NSTextAlignmentRight;
  371. [view3 addSubview:titleLa9];
  372. titleLa9.text = @"签约类型:";
  373. [titleLa9 mas_makeConstraints:^(MASConstraintMaker *make) {
  374. make.left.equalTo(xingImage5.mas_right).offset(3);
  375. make.top.equalTo(view3.mas_top).offset(15);
  376. make.size.mas_equalTo(CGSizeMake(70, 15));
  377. }];
  378. _qianyueType = [[UILabel alloc]init];
  379. _qianyueType.textColor = [UIColor blackColor];
  380. _qianyueType.font = TextFont(15);
  381. _qianyueType.textAlignment = NSTextAlignmentLeft;
  382. [view3 addSubview:_qianyueType];
  383. // if ([_projectType isEqualToString:@"1"]) {
  384. _qianyueType.text = self.projectType;
  385. // }else{
  386. //
  387. // _qianyueType.text = @"招商";
  388. // }
  389. [_qianyueType mas_makeConstraints:^(MASConstraintMaker *make) {
  390. make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 20));
  391. make.left.equalTo(titleLa9.mas_right).offset(18);
  392. make.top.equalTo(view3.mas_top).offset(13);
  393. }];
  394. UIView *line4 = [[UIView alloc]init];
  395. line4.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
  396. [view3 addSubview:line4];
  397. [line4 mas_makeConstraints:^(MASConstraintMaker *make) {
  398. make.left.equalTo(view3.mas_left);
  399. make.top.equalTo(titleLa9.mas_bottom).offset(15);
  400. make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
  401. }];
  402. UIImageView *xingImage6 = [[UIImageView alloc]init];
  403. xingImage6.image = [UIImage imageNamed:@"redxing"];
  404. [view3 addSubview:xingImage6];
  405. [xingImage6 mas_makeConstraints:^(MASConstraintMaker *make) {
  406. make.left.equalTo(view3.mas_left).offset(15);
  407. make.top.equalTo(line4.mas_top).offset(18);
  408. make.size.mas_equalTo(CGSizeMake(8, 8));
  409. }];
  410. UILabel *titleLa10 = [[UILabel alloc]init];
  411. titleLa10.textColor = [UIColor blackColor];
  412. titleLa10.font = TextFont(15);
  413. titleLa10.textAlignment = NSTextAlignmentRight;
  414. [view3 addSubview:titleLa10];
  415. titleLa10.text = @"签约价格:";
  416. [titleLa10 mas_makeConstraints:^(MASConstraintMaker *make) {
  417. make.left.equalTo(xingImage6.mas_right).offset(3);
  418. make.top.equalTo(line4.mas_top).offset(15);
  419. make.size.mas_equalTo(CGSizeMake(70, 15));
  420. }];
  421. _priceField = [[UITextField alloc]init];
  422. _priceField.placeholder =@"请输入房款总额";
  423. _priceField.text = self.houseMoneyTotal;
  424. _priceField.textAlignment = NSTextAlignmentLeft;
  425. _priceField.textColor = [UIColor blackColor];
  426. _priceField.font = TextFont(15);
  427. [view3 addSubview:_priceField];
  428. [_priceField mas_makeConstraints:^(MASConstraintMaker *make) {
  429. make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 30));
  430. make.left.equalTo(titleLa10.mas_right).offset(18);
  431. make.top.equalTo(line4.mas_top).offset(8);
  432. }];
  433. UIView *line5 = [[UIView alloc]init];
  434. line5.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
  435. [view3 addSubview:line5];
  436. [line5 mas_makeConstraints:^(MASConstraintMaker *make) {
  437. make.left.equalTo(view3.mas_left);
  438. make.top.equalTo(titleLa10.mas_bottom).offset(15);
  439. make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
  440. }];
  441. UIImageView *xingImage7 = [[UIImageView alloc]init];
  442. xingImage7.image = [UIImage imageNamed:@"redxing"];
  443. [view3 addSubview:xingImage7];
  444. [xingImage7 mas_makeConstraints:^(MASConstraintMaker *make) {
  445. make.left.equalTo(view3.mas_left).offset(15);
  446. make.top.equalTo(line5.mas_top).offset(18);
  447. make.size.mas_equalTo(CGSizeMake(8, 8));
  448. }];
  449. UILabel *titleLa11 = [[UILabel alloc]init];
  450. titleLa11.textColor = [UIColor blackColor];
  451. titleLa11.font = TextFont(15);
  452. titleLa11.textAlignment = NSTextAlignmentRight;
  453. [view3 addSubview:titleLa11];
  454. titleLa11.text = @"签约日期:";
  455. [titleLa11 mas_makeConstraints:^(MASConstraintMaker *make) {
  456. make.left.equalTo(xingImage7.mas_right).offset(3);
  457. make.top.equalTo(line5.mas_top).offset(15);
  458. make.size.mas_equalTo(CGSizeMake(70, 15));
  459. }];
  460. _dateLab = [[UILabel alloc]init];
  461. _dateLab.textColor = [UIColor colorWithHexValue:0x898989];
  462. _dateLab.font = TextFont(15);
  463. _dateLab.text = @"请选择";
  464. _dateLab.textAlignment = NSTextAlignmentLeft;
  465. [view3 addSubview:_dateLab];
  466. [_dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
  467. make.size.mas_equalTo(CGSizeMake(100, 30));
  468. make.left.equalTo(titleLa11.mas_right).offset(18);
  469. make.top.equalTo(line5.mas_top).offset(8);
  470. }];
  471. _dateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  472. [_dateBtn setBackgroundImage:[UIImage imageNamed:@"icon_date"] forState:UIControlStateNormal];
  473. [_dateBtn addTarget:self action:@selector(dateClick:) forControlEvents:UIControlEventTouchUpInside];
  474. [view3 addSubview:_dateBtn];
  475. [_dateBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  476. make.size.mas_equalTo(CGSizeMake(22, 22));
  477. make.left.equalTo(_dateLab.mas_right).offset(8);
  478. make.top.equalTo(line5.mas_top).offset(10);
  479. }];
  480. UIView *line6 = [[UIView alloc]init];
  481. line6.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
  482. [view3 addSubview:line6];
  483. [line6 mas_makeConstraints:^(MASConstraintMaker *make) {
  484. make.left.equalTo(view3.mas_left);
  485. make.top.equalTo(titleLa11.mas_bottom).offset(15);
  486. make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
  487. }];
  488. UIImageView *xingImage8 = [[UIImageView alloc]init];
  489. xingImage8.image = [UIImage imageNamed:@"redxing"];
  490. [view3 addSubview:xingImage8];
  491. [xingImage8 mas_makeConstraints:^(MASConstraintMaker *make) {
  492. make.left.equalTo(view3.mas_left).offset(15);
  493. make.top.equalTo(line6.mas_top).offset(18);
  494. make.size.mas_equalTo(CGSizeMake(8, 8));
  495. }];
  496. UILabel *titleLa12 = [[UILabel alloc]init];
  497. titleLa12.textColor = [UIColor blackColor];
  498. titleLa12.font = TextFont(15);
  499. titleLa12.textAlignment = NSTextAlignmentRight;
  500. [view3 addSubview:titleLa12];
  501. titleLa12.text = @"签约面积:";
  502. [titleLa12 mas_makeConstraints:^(MASConstraintMaker *make) {
  503. make.left.equalTo(xingImage8.mas_right).offset(3);
  504. make.top.equalTo(line6.mas_top).offset(15);
  505. make.size.mas_equalTo(CGSizeMake(70, 15));
  506. }];
  507. _areaField = [[UITextField alloc]init];
  508. _areaField.placeholder =@"请输入签约面积";
  509. _areaField.textAlignment = NSTextAlignmentLeft;
  510. _areaField.textColor = [UIColor blackColor];
  511. _areaField.font = TextFont(15);
  512. [view3 addSubview:_areaField];
  513. [_areaField mas_makeConstraints:^(MASConstraintMaker *make) {
  514. make.size.mas_equalTo(CGSizeMake(kGScreenWidth - 150, 30));
  515. make.left.equalTo(titleLa12.mas_right).offset(18);
  516. make.top.equalTo(line6.mas_top).offset(8);
  517. }];
  518. UIView *line7 = [[UIView alloc]init];
  519. line7.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
  520. [view3 addSubview:line7];
  521. [line7 mas_makeConstraints:^(MASConstraintMaker *make) {
  522. make.left.equalTo(view3.mas_left);
  523. make.top.equalTo(view3.mas_bottom).offset(-1);
  524. make.size.mas_equalTo(CGSizeMake(kGScreenWidth,1));
  525. }];
  526. UIView *view4 =[[UIView alloc]init];
  527. view4.backgroundColor = [UIColor whiteColor];
  528. [infoView addSubview:view4];
  529. [view4 mas_makeConstraints:^(MASConstraintMaker *make) {
  530. make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 188));
  531. make.left.equalTo(infoView.mas_left);
  532. make.top.equalTo(view3.mas_bottom);
  533. }];
  534. UIImageView *xingImage9 = [[UIImageView alloc]init];
  535. xingImage9.image = [UIImage imageNamed:@"redxing"];
  536. [view4 addSubview:xingImage9];
  537. [xingImage9 mas_makeConstraints:^(MASConstraintMaker *make) {
  538. make.left.equalTo(view4.mas_left).offset(15);
  539. make.top.equalTo(view4.mas_top).offset(12);
  540. make.size.mas_equalTo(CGSizeMake(8, 8));
  541. }];
  542. ACSelectMediaView *mediaView = [[ACSelectMediaView alloc] initWithFrame:CGRectMake(22, 0, [[UIScreen mainScreen] bounds].size.width -22, 1)];
  543. mediaView.type = ACMediaTypePhotoAndCamera;
  544. mediaView.maxImageSelected = 6;
  545. mediaView.uploadStr =@"上传凭证:";
  546. mediaView.backgroundColor = [UIColor whiteColor];
  547. mediaView.naviBarBgColor = [UIColor redColor];
  548. mediaView.rowImageCount = 3;
  549. mediaView.lineSpacing = 20;
  550. mediaView.interitemSpacing = 20;
  551. mediaView.sectionInset = UIEdgeInsetsMake(20, 20, 20, 20);
  552. [mediaView observeViewHeight:^(CGFloat mediaHeight) {
  553. [view4 mas_updateConstraints:^(MASConstraintMaker *make) {
  554. make.size.mas_equalTo(CGSizeMake(kGScreenWidth, mediaHeight));
  555. make.left.equalTo(infoView.mas_left);
  556. make.top.equalTo(view3.mas_bottom);
  557. }];
  558. }];
  559. [mediaView observeSelectedMediaArray:^(NSArray<ACMediaModel *> *list) {
  560. _imageArr = [NSMutableArray array];
  561. for (ACMediaModel *model in list) {
  562. UIImage *data = model.image;
  563. [_imageArr addObject:data];
  564. }
  565. }];
  566. _mediaView = mediaView;
  567. [view4 addSubview:_mediaView];
  568. UIView *view5 =[[UIView alloc]init];
  569. view5.backgroundColor = [UIColor whiteColor];
  570. [infoView addSubview:view5];
  571. [view5 mas_makeConstraints:^(MASConstraintMaker *make) {
  572. make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 155));
  573. make.left.equalTo(infoView.mas_left);
  574. make.top.equalTo(view4.mas_bottom).offset(1);
  575. }];
  576. UILabel *titleLa13 = [[UILabel alloc]initWithFrame:CGRectMake(15, 15, 60, 15)];
  577. titleLa13.textColor = [UIColor blackColor];
  578. titleLa13.font = TextFont(15);
  579. [view5 addSubview:titleLa13];
  580. titleLa13.text = @"备注:";
  581. _describeText =[[UITextView alloc]init];
  582. _describeText.textColor = [UIColor blackColor];
  583. _describeText.font = TextFont(15);
  584. _describeText.textAlignment = NSTextAlignmentLeft;
  585. _describeText.backgroundColor = [UIColor colorWithHexValue:0xF7F8FA];
  586. _describeText.textContainerInset = UIEdgeInsetsMake(20, 20, 20, 20);
  587. _describeText.editable = YES;
  588. [view5 addSubview:_describeText];
  589. [_describeText mas_makeConstraints:^(MASConstraintMaker *make) {
  590. make.size.mas_equalTo(CGSizeMake(kGScreenWidth-30, 100));
  591. make.left.equalTo(view5.mas_left).offset(15);
  592. make.top.equalTo(titleLa13.mas_bottom).offset(15);
  593. }];
  594. _lbl = [[UILabel alloc]initWithFrame:CGRectMake(20, 20, 200, 20)];
  595. _lbl.enabled = NO;
  596. _lbl.text = @"请填写备注...";
  597. _lbl.font = [UIFont systemFontOfSize:15];
  598. _lbl.textColor = [[UIColor colorWithHexValue:0xD3D6DD]colorWithAlphaComponent:0.5];
  599. [_describeText addSubview:_lbl];
  600. _describeText.delegate = self;
  601. _tab.tableFooterView = infoView;
  602. }
  603. -(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
  604. return nil;
  605. // Do any additional setup after loading the view.
  606. }
  607. -(void)dateClick:(UIButton *)sender{
  608. __weak NewSignVC * weakself=self;
  609. if (!self.datePicker) {
  610. self.datePicker =[[[NSBundle mainBundle] loadNibNamed:@"DatePickerView" owner:self options:0] lastObject];
  611. self.datePicker.frame =CGRectMake(0, self.view.frame.size.height-260, self.view.frame.size.width, 260);
  612. self.datePicker.Datetitle =@"日期选择";
  613. self.datePicker.cancelBlock = ^{
  614. [UIView animateWithDuration:5 animations:^{
  615. [weakself.datePicker removeFromSuperview];
  616. weakself.datePicker = nil;
  617. }];
  618. };
  619. self.datePicker.sureBlock = ^(NSString *selectDateStr) {
  620. [weakself.dateLab setText:selectDateStr];
  621. [UIView animateWithDuration:5 animations:^{
  622. [weakself.datePicker removeFromSuperview];
  623. weakself.datePicker = nil;
  624. }];
  625. };
  626. [self.view addSubview:self.datePicker];
  627. }
  628. }
  629. #pragma mark - UITextView的代理方法
  630. - (void)textViewDidChange:(UITextView *)textView
  631. {
  632. if ([textView.text length] == 0) {
  633. [_lbl setHidden:NO];
  634. }else{
  635. [_lbl setHidden:YES];
  636. }
  637. }
  638. -(void)addClick{
  639. customerModel *model =[[customerModel alloc]init];
  640. _popView = [[signPopView alloc]initWithFrame:CGRectMake(0, 0, kGScreenWidth, kGScreenHeight) withCustomerModel:model];
  641. [self.popView showAlertView];
  642. kWeakSelf(self)
  643. _popView.popClick = ^{
  644. if ([_popView.nameField.text length] == 0) {
  645. [ToastView showToast:@"请输入客户姓名"];
  646. return ;
  647. }else if ([_popView.phoneField.text length] == 0) {
  648. [ToastView showToast:@"请输入联系方式"];
  649. return ;
  650. }else if ([_popView.cardField.text length] == 0) {
  651. [ToastView showToast:@"请输入公司职位"];
  652. return ;
  653. }else if ([_popView.brandField.text length] == 0) {
  654. [ToastView showToast:@"请输入品牌信息"];
  655. return ;
  656. }
  657. customerModel *model = [[customerModel alloc]init];
  658. model.customerName = weakself.popView.nameField.text;
  659. model.mobile = weakself.popView.phoneField.text;
  660. model.customerPosition = weakself.popView.cardField.text;
  661. model.brandName = weakself.popView.brandField.text;
  662. model.customerType = @"2";
  663. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:weakself.arrayRow.count inSection:0];
  664. [weakself.arrayRow insertObject:model atIndex:weakself.arrayRow.count];
  665. [weakself.tab insertRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  666. [weakself.tab beginUpdates];
  667. [weakself.tab endUpdates];
  668. [weakself.popView removeFromSuperview];
  669. };
  670. }
  671. -(void)deleteClick:(UIButton *)sender{
  672. NewSaleTableViewCell *cell = (NewSaleTableViewCell *)sender.superview ;
  673. NSIndexPath *cellIndexPath = [self.tab indexPathForCell:cell];
  674. [self.arrayRow removeObjectAtIndex:cellIndexPath.row];
  675. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:cellIndexPath.row inSection:0];
  676. [self.tab deleteRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationBottom];
  677. [self.tab beginUpdates];
  678. [self.tab endUpdates];
  679. }
  680. -(void)buttonEvent:(UIButton *)sender{
  681. NSMutableArray *arrname =[NSMutableArray array];
  682. NSMutableArray *arrphone = [NSMutableArray array];
  683. NSMutableArray *arrCard = [NSMutableArray array];
  684. NSMutableArray *arrBrand = [NSMutableArray array];
  685. for (int i = 0; i<self.arrayRow.count; i++) {
  686. customerModel *model =self.arrayRow[i];
  687. self.names = [NSString stringWithFormat:@"%@,%@",self.names,model.customerName];
  688. [arrname addObject:model.customerName];
  689. [arrphone addObject:model.mobile];
  690. [arrCard addObject:model.customerPosition];
  691. [arrBrand addObject:model.brandName];
  692. }
  693. _uploadImages = [NSMutableArray array];
  694. if ([_SerialField.text length] == 0){
  695. [ToastView showToast:@"请输入签约房号"];
  696. return;
  697. }else if ([_priceField.text length] == 0){
  698. [ToastView showToast:@"请输入签约价格"];
  699. return;
  700. }else if ([_dateLab.text length] < 4){
  701. [ToastView showToast:@"请选择签约日期"];
  702. return;
  703. }else if ([_areaField.text length] == 0){
  704. [ToastView showToast:@"请输入签约面积"];
  705. return;
  706. }else if ([_imageArr count] == 0){
  707. [ToastView showToast:@"请至少上传一张凭证"];
  708. return;
  709. }
  710. _sendBtn.backgroundColor = [UIColor lightGrayColor];
  711. _sendBtn.userInteractionEnabled = NO;
  712. [OSSImageUploader asyncUploadImages:_imageArr complete:^(NSArray<NSString *> *names, UploadImageState state) {
  713. if (state ==1) {
  714. for (NSString *name in names) {
  715. NSString *imageName =[NSString stringWithFormat:@"/%@",name];
  716. [_uploadImages addObject:imageName];
  717. }
  718. NSLog(@"上传成功");
  719. NSLog(@"%@",_uploadImages);
  720. NSMutableDictionary *dic =[NSMutableDictionary dictionary];
  721. dic[@"orderNo"] = self.orderNo;;
  722. dic[@"orderStatus"] = @"5";
  723. dic[@"roomNo"] = _SerialField.text;
  724. dic[@"houseMoneyTotal"] = _priceField.text;
  725. dic[@"picPath"] =[_uploadImages componentsJoinedByString:@","];
  726. dic[@"signTime"] =_dateLab.text;
  727. dic[@"acreage"] = _areaField.text;
  728. dic[@"description"] = _describeText.text;
  729. dic[@"customerName"] = [arrname componentsJoinedByString:@","];
  730. dic[@"mobile"] = [arrphone componentsJoinedByString:@","];
  731. dic[@"brandName"] =[arrBrand componentsJoinedByString:@","];
  732. dic[@"customerPosition"] =[arrCard componentsJoinedByString:@","];//职位
  733. [ProgressHUD show];
  734. kWeakSelf(self);
  735. [self.sessionManager sendPostHttpRequestWithUrl:sendApproveInfo params:dic bodyBlock:^(id<AFMultipartFormData> formData) {
  736. } progress:^(NSProgress *progressValue) {
  737. } success:^(NSDictionary *response) {
  738. [ProgressHUD hide];
  739. NSLog(@"%@",response);
  740. for (UIViewController *controller in weakself.navigationController.viewControllers) {
  741. if ([controller isKindOfClass:[ProjectControlsVC class]]) {
  742. [DKGlobal sharedInstance].typeName =@"5";
  743. [[NSNotificationCenter defaultCenter]postNotificationName:@"changeIndex4" object:nil];
  744. [DKGlobal sharedInstance].tagString = @"";
  745. if ([self.isSearch isEqualToString:@"1"]) {
  746. ProjectControlsVC *projectVC = [[ProjectControlsVC alloc]init];
  747. projectVC.projectID = self.projectID;
  748. projectVC.projectType = self.projectType;
  749. projectVC.projectName = self.projectName;
  750. projectVC.isSearch = weakself.isSearch;
  751. [weakself.navigationController pushViewController:projectVC animated:YES];
  752. }else{
  753. [weakself.navigationController popToViewController:controller animated:YES];
  754. }
  755. return;
  756. }
  757. }
  758. } failure:^(NSError *error) {
  759. _sendBtn.backgroundColor = [UIColor colorWithHexValue:0x64ABFF];
  760. _sendBtn.userInteractionEnabled = YES;
  761. NSLog(@"%@",error);
  762. [ProgressHUD hide];
  763. }];
  764. }else{
  765. NSLog(@"上传失败");
  766. }
  767. }];
  768. }
  769. - (void)dealloc {
  770. if (_sessionManager) {
  771. [_sessionManager cancelAllTask];
  772. }
  773. [[NSNotificationCenter defaultCenter] removeObserver:self];
  774. DebugLog(@"%@没有造成循环引用", [self class]);
  775. }
  776. @end