|
@@ -0,0 +1,400 @@
|
|
|
+//
|
|
|
+// writeReportController.m
|
|
|
+// upAPP
|
|
|
+//
|
|
|
+// Created by youke on 2018/9/10.
|
|
|
+// Copyright © 2018年 youke. All rights reserved.
|
|
|
+//
|
|
|
+
|
|
|
+#import "SaleWriteReportVC.h"
|
|
|
+#import "DatePickerView.h"
|
|
|
+#import "salesController.h"
|
|
|
+#import "investmentVController.h"
|
|
|
+#import "OrderAirportPayCancelView.h"
|
|
|
+#import "SalesDetailController.h"
|
|
|
+#import "CXDatePickerView.h"
|
|
|
+@interface SaleWriteReportVC ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate>
|
|
|
+@property(nonatomic,strong)UILabel *titleLab;
|
|
|
+@property(nonatomic,strong)UITableView *tabView;
|
|
|
+@property(nonatomic,strong)UIButton *senderBtn;
|
|
|
+@property(nonatomic,strong)UIButton *cancleBtn;
|
|
|
+@property(nonatomic,strong)UITextField *brandFeild;
|
|
|
+@property(nonatomic,strong)UILabel *dateLab;
|
|
|
+@property(nonatomic,strong)UITextView *describeText;
|
|
|
+@property(nonatomic,strong)UILabel *lbl;
|
|
|
+@property (nonatomic,strong) CXDatePickerView *datePicker;
|
|
|
+@property(nonatomic,strong)HttpRequestManger *sessionManager;
|
|
|
+@property(nonatomic,strong)OrderAirportPayCancelView *cancelView;
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation SaleWriteReportVC
|
|
|
+
|
|
|
+- (HttpRequestManger*)sessionManager{
|
|
|
+ if (!_sessionManager) {
|
|
|
+ _sessionManager = [[HttpRequestManger alloc]init];
|
|
|
+ }
|
|
|
+ return _sessionManager;
|
|
|
+}
|
|
|
+- (void)viewDidLoad {
|
|
|
+
|
|
|
+ [super viewDidLoad];
|
|
|
+
|
|
|
+ [self.navigationView removeAllLeftButton];
|
|
|
+
|
|
|
+ _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];
|
|
|
+// UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
|
|
|
+// [window addSubview: weakself.cancelView];
|
|
|
+
|
|
|
+ }];
|
|
|
+// [self.navigationView addRightButtonWithImage:[UIImage imageNamed:@"icon_search"] clickCallBack:^(UIView *view) {
|
|
|
+// NSLog(@"搜索");
|
|
|
+// }];
|
|
|
+ _tabView = [[UITableView alloc] initWithFrame:CGRectMake(0,NaviHeight, kGScreenWidth, kGScreenHeight-NaviHeight-50) style:UITableViewStyleGrouped];
|
|
|
+ _tabView.delegate = self;
|
|
|
+ _tabView.dataSource = self;
|
|
|
+ _tabView.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
|
|
|
+
|
|
|
+ // self.tabView.separatorInset = UIEdgeInsetsMake(0, 15, 0, 15);//cell不对齐
|
|
|
+ [self.view addSubview:_tabView];
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
+ _tabView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
+ }else {
|
|
|
+ self.automaticallyAdjustsScrollViewInsets = NO;
|
|
|
+ }
|
|
|
+
|
|
|
+ UIView *headView =[[UIView alloc]initWithFrame:CGRectMake(0, 0,kGScreenWidth, 100)];
|
|
|
+ headView.backgroundColor = [UIColor colorWithHexValue:0xf7f8fa];
|
|
|
+ UIImageView *headImageView = [[UIImageView alloc]init];
|
|
|
+ headImageView.image = [UIImage imageNamed:@"writeReport"];
|
|
|
+ [headView addSubview:headImageView];
|
|
|
+ [headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.equalTo(headView.mas_left);
|
|
|
+ make.top.equalTo(headView.mas_top);
|
|
|
+ make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 100));
|
|
|
+
|
|
|
+ }];
|
|
|
+ self.tabView.tableHeaderView = headView;
|
|
|
+ UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, kGScreenHeight -50, kGScreenWidth, 50)];
|
|
|
+ bottomView.backgroundColor = [UIColor colorWithHexValue:0x64ABFF];
|
|
|
+ [self.view addSubview:bottomView];
|
|
|
+ _senderBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ _senderBtn.frame = CGRectMake(kGScreenWidth/2, 0, kGScreenWidth/2, 50);
|
|
|
+ [_senderBtn setTitle:@"提交" forState:UIControlStateNormal];
|
|
|
+ _senderBtn.backgroundColor = [UIColor colorWithHexValue:0x64ABFF];
|
|
|
+ [_senderBtn setTintColor:[UIColor whiteColor]];
|
|
|
+ [_senderBtn addTarget:self action:@selector(buttonEvent:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [bottomView addSubview:_senderBtn];
|
|
|
+
|
|
|
+ _cancleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ _cancleBtn.frame = CGRectMake(0, 0, kGScreenWidth/2, 50);
|
|
|
+ [_cancleBtn setTitle:@"取消预约" forState:UIControlStateNormal];
|
|
|
+ _cancleBtn.backgroundColor = [UIColor colorWithHexValue:0xE9E9E9];
|
|
|
+ [_cancleBtn setTitleColor:[UIColor colorWithHexValue:0x898989] forState:UIControlStateNormal];
|
|
|
+ [_cancleBtn addTarget:self action:@selector(cancleEvent:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [bottomView addSubview:_cancleBtn];
|
|
|
+
|
|
|
+ // Do any additional setup after loading the view.
|
|
|
+}
|
|
|
+
|
|
|
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
|
|
+{
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
|
|
+{
|
|
|
+
|
|
|
+ return 2;
|
|
|
+
|
|
|
+}
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
+{
|
|
|
+ if (indexPath.row == 1) {
|
|
|
+
|
|
|
+ return 160;
|
|
|
+ }else{
|
|
|
+
|
|
|
+ return 50;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
+{
|
|
|
+ UITableViewCell *cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
|
|
+ reuseIdentifier:@"cell13"];
|
|
|
+ if (cell ==nil) {
|
|
|
+ cell =
|
|
|
+ [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
|
|
+ reuseIdentifier:@"cell13"];
|
|
|
+ }
|
|
|
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
+ tableView.separatorColor = [UIColor colorWithHexValue:0xEAEAEA];
|
|
|
+ tableView.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10);
|
|
|
+ tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
|
|
|
+ if (indexPath.row == 0) {
|
|
|
+
|
|
|
+ UILabel *titleLa = [[UILabel alloc]initWithFrame:CGRectMake(16, 20, 100, 14)];
|
|
|
+ titleLa.textColor = [UIColor blackColor];
|
|
|
+ titleLa.font = TextFont(15);
|
|
|
+ [cell addSubview:titleLa];
|
|
|
+ titleLa.text = @"预计到访时间";
|
|
|
+
|
|
|
+ _dateLab = [[UILabel alloc]init];
|
|
|
+ _dateLab.textColor = [UIColor blackColor];
|
|
|
+ _dateLab.font = TextFont(15);
|
|
|
+ _dateLab.text = @"请选择";
|
|
|
+ _dateLab.textAlignment = NSTextAlignmentRight;
|
|
|
+ [cell addSubview:_dateLab];
|
|
|
+ [_dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.size.mas_equalTo(CGSizeMake(150,18));
|
|
|
+ make.right.equalTo(cell.mas_right).offset(-35);
|
|
|
+ make.top.equalTo(cell.mas_top).offset(16);
|
|
|
+ }];
|
|
|
+ cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
|
|
+
|
|
|
+ }else{
|
|
|
+ UILabel *titleLa = [[UILabel alloc]initWithFrame:CGRectMake(16, 20, 45, 14)];
|
|
|
+ titleLa.textColor = [UIColor blackColor];
|
|
|
+ titleLa.font = TextFont(15);
|
|
|
+ [cell addSubview:titleLa];
|
|
|
+ titleLa.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;
|
|
|
+
|
|
|
+ [cell addSubview:_describeText];
|
|
|
+
|
|
|
+ [_describeText mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.size.mas_equalTo(CGSizeMake(kGScreenWidth-90, 120));
|
|
|
+ make.left.equalTo(titleLa.mas_right).offset(10);
|
|
|
+ make.top.equalTo(cell.mas_top).offset(15);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _lbl = [[UILabel alloc]initWithFrame:CGRectMake(20, 20, 60, 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;
|
|
|
+ }
|
|
|
+ return cell;
|
|
|
+}
|
|
|
+-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
|
|
+ return 0.0001;
|
|
|
+}
|
|
|
+-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
|
|
+
|
|
|
+ return 0.0001;
|
|
|
+}
|
|
|
+-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
|
|
+
|
|
|
+ return nil;
|
|
|
+}
|
|
|
+-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
|
|
+ return nil;
|
|
|
+}
|
|
|
+
|
|
|
+-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
+
|
|
|
+ if (indexPath.row == 0) {
|
|
|
+ [self creatDatePicker];
|
|
|
+ }
|
|
|
+}
|
|
|
+-(void)creatDatePicker
|
|
|
+{
|
|
|
+ __weak SaleWriteReportVC * 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;
|
|
|
+// }];
|
|
|
+// };
|
|
|
+
|
|
|
+ _datePicker = [[CXDatePickerView alloc] initWithDateStyle:CXDateStyleShowYearMonthDayHourMinute CompleteBlock:^(NSDate *selectDate) {
|
|
|
+
|
|
|
+ NSString *dateString = [selectDate stringWithFormat:@"yyyy-MM-dd HH:mm"];
|
|
|
+ [weakself.dateLab setText:dateString];
|
|
|
+ [UIView animateWithDuration:5 animations:^{
|
|
|
+ [weakself.datePicker removeFromSuperview];
|
|
|
+ weakself.datePicker = nil;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }];
|
|
|
+ _datePicker.dateLabelColor = [UIColor lightGrayColor];//年-月-日-时-分 颜色
|
|
|
+ _datePicker.datePickerColor = [UIColor blackColor];//滚轮日期颜色
|
|
|
+ _datePicker.headerViewColor = [UIColor colorWithHexValue:0xf7f8fa]; // 顶部视图背景颜色
|
|
|
+ _datePicker.doneButtonColor = [UIColor blackColor]; // 确认按钮字体颜色
|
|
|
+ _datePicker.cancelButtonColor = [UIColor blackColor]; // 取消按钮颜色
|
|
|
+ _datePicker.shadeViewAlphaWhenShow = 0.3;
|
|
|
+ _datePicker.showAnimationTime = 0.4;
|
|
|
+ [_datePicker show];
|
|
|
+
|
|
|
+// [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)buttonEvent:(UIButton *)sender{
|
|
|
+
|
|
|
+// if ([self.projectType isEqualToString:@"2"] && [self.brandFeild.text length] == 0) {
|
|
|
+//
|
|
|
+// [ToastView showToast:@"请输入品牌名称"];
|
|
|
+// return;
|
|
|
+// }else
|
|
|
+
|
|
|
+ if ([_dateLab.text isEqualToString:@"请选择"]){
|
|
|
+
|
|
|
+ [ToastView showToast:@"请选择预约时间"];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _senderBtn.backgroundColor = [UIColor lightGrayColor];
|
|
|
+ _senderBtn.userInteractionEnabled = NO;
|
|
|
+ NSMutableDictionary *dic =[NSMutableDictionary dictionary];
|
|
|
+ dic[@"projectId"] = _projectId;
|
|
|
+ dic[@"customerId"] = _customerId;
|
|
|
+ dic[@"appointmentTime"] = _dateLab.text;
|
|
|
+ dic[@"brandName"] = @"";
|
|
|
+// dic[@"brandName"] = _brandFeild.text;
|
|
|
+
|
|
|
+ kWeakSelf(self);
|
|
|
+ [ProgressHUD show];
|
|
|
+ [self.sessionManager sendPostHttpRequestWithUrl:sendCustomerInfo params:dic bodyBlock:nil progress:nil success:^(NSDictionary *response) {
|
|
|
+ [ProgressHUD hide];
|
|
|
+ NSLog(@"%@",response);
|
|
|
+// if ([self.projectType isEqualToString:@"1"]) {
|
|
|
+// [MBProgressHUD showSuccess:@"客户报备成功"];
|
|
|
+// [self.navigationController popViewControllerAnimated:YES];
|
|
|
+// }else{
|
|
|
+// [MBProgressHUD showSuccess:@"客户报备成功"];
|
|
|
+// [self.navigationController popViewControllerAnimated:YES];
|
|
|
+// }
|
|
|
+ if([self.signStr isEqualToString:@"1"]){
|
|
|
+ [MBProgressHUD showSuccess:@"客户报备成功"];
|
|
|
+ for (UIViewController *controller in weakself.navigationController.viewControllers) {
|
|
|
+ if ([controller isKindOfClass:[SalesDetailController class]]) {
|
|
|
+ [weakself.navigationController popToViewController:controller animated:YES];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ [MBProgressHUD showSuccess:@"客户报备成功"];
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSError *error) {
|
|
|
+ [ProgressHUD hide];
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (OrderAirportPayCancelView*)cancelView{
|
|
|
+ if (!_cancelView) {
|
|
|
+ _cancelView = [[NSBundle mainBundle]loadNibNamed:@"OrderAirportPayCancelView" owner:self options:nil].firstObject;
|
|
|
+ _cancelView.frame = self.view.bounds;
|
|
|
+ // _cancelView.isFromOrder = self.isFromOrder;
|
|
|
+ _cancelView.titleLabel.text = @"确定要取消报备吗";
|
|
|
+ [_cancelView.rightBtn setTitle:@"继续报备" forState:UIControlStateNormal];
|
|
|
+ _cancelView.tipLabel.hidden = YES;
|
|
|
+ _cancelView.contentLabel.hidden = YES;
|
|
|
+ _cancelView.titleLabelTop.constant = 35;
|
|
|
+ kWeakSelf(self);
|
|
|
+ _cancelView.leftBtnCallback = ^{
|
|
|
+ for (UIViewController *controller in weakself.navigationController.viewControllers) {
|
|
|
+ if ([controller isKindOfClass:[SalesDetailController class]]) {
|
|
|
+ [weakself.navigationController popToViewController:controller animated:YES];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return _cancelView;
|
|
|
+}
|
|
|
+
|
|
|
+-(void)cancleEvent:(UIButton *)sender{
|
|
|
+
|
|
|
+ UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
|
|
|
+
|
|
|
+ [window addSubview: self.cancelView];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)dealloc {
|
|
|
+ if (_sessionManager) {
|
|
|
+ [_sessionManager cancelAllTask];
|
|
|
+ }
|
|
|
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
|
+ DebugLog(@"%@没有造成循环引用", [self class]);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (void)didReceiveMemoryWarning {
|
|
|
+ [super didReceiveMemoryWarning];
|
|
|
+ // Dispose of any resources that can be recreated.
|
|
|
+}
|
|
|
+
|
|
|
+/*
|
|
|
+#pragma mark - Navigation
|
|
|
+
|
|
|
+// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
|
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
|
+ // Get the new view controller using [segue destinationViewController].
|
|
|
+ // Pass the selected object to the new view controller.
|
|
|
+}
|
|
|
+*/
|
|
|
+
|
|
|
+@end
|