// // SubmitOrderVCViewController.m // IBOSSmini // // Created by guan hong hou on 2017/5/19. // Copyright © 2017年 elongtian. All rights reserved. // #import "SubmitOrderVC.h" #import "ShopCartCellDelegate.h" #import "SubmitOrderFrame.h" #import "SubmitOrderTableViewCell.h" #import "CustomerCodeSearchVC.h" #import "CustomerTypeSearchVC.h" #import "SBJsonWriter.h" #import "SalesManSearchVC.h" #import "ChannelSearchVC.h" #import "DepartmentSearchVC.h" #define txtReadOnlyColor [UIColor colorWithRed:82/255.0 green:53/255.0 blue:46/255.0 alpha:1.0] #define selectReadOnlyColor [UIColor colorWithRed:243/255.0 green:242/255.0 blue:226/255.0 alpha:1.0] @interface SubmitOrderVC (){ MBProgressHUD *HUD; } @end @implementation SubmitOrderVC @synthesize vCustomTableView; #pragma mark - 公共函数 /** viewDidLoad函数 */ - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title=@"提交订单"; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setBackgroundImage:[UIImage imageNamed:@"icon_back.png"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; button.frame = CGRectMake(0, 0, 15, 18); UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button]; self.navigationItem.leftBarButtonItem = menuButton; _departmentIdStr=@""; _departmentCodeStr=@""; _salesmanStr=@""; _channelStr=@""; _customerTypeStr=@""; _customerIDStr=@""; _strTelephone=@""; _strFilingID = @""; _strCustomerCode=@""; _strRemarks=@""; _strCustomerName=@""; _strAddress=@""; _cartItemArr=[NSMutableArray new]; [self initUI]; [self initNotification]; [self refreshTotalAmount]; } /** 修改:2017-9-25 适配机型 安全区视图发生变化 */ -(void)viewSafeAreaInsetsDidChange{ self.view.backgroundColor = [UIColor whiteColor]; _footerView.backgroundColor = [UIColor whiteColor]; vCustomTableView.frame = CGRectMake(0, 0, SCREENWIDTH, self.view.safeAreaLayoutGuide.layoutFrame.size.height - 64); _footerView.frame=CGRectMake(0, self.view.safeAreaLayoutGuide.layoutFrame.size.height - 64, self.view.frame.size.width, 64); [super viewSafeAreaInsetsDidChange]; } #pragma mark -委托函数 //产品价格加载成功接口 - (void)onSalesPriceLoadFinish:(ASIDownManager *)sender { NSDictionary *dic = [sender.mWebStr JSONValue]; [self cancel]; if (dic && [dic isKindOfClass:[NSDictionary class]]) { int iStatus = [[dic objectForKey:@"Status"] intValue]; NSString *message=[dic objectForKey:@"Message"]; if (iStatus == 0) { NSArray * approvArr=[dic objectForKey:@"Result"]; if(approvArr!=nil&&approvArr.count>0) { [_cartModel updateGoodsSalePrice:approvArr]; [self loadData]; //接着更新商品标价 double delayInSeconds = 0.5; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ [self updateGoodsMarkePrice]; }); } } else if(iStatus==ActionResultStatusAuthError ||iStatus==ActionResultStatusNoLogin ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){ [self showReLoginDialog:message]; return; } else { [self showAlertViewText:message]; } } } //产品价格加载失败接口 - (void)onSalesPriceLoadFail:(ASIDownManager *)sender { [self cancel]; [self readOnly:NO]; [self showAlertViewText:@"加载失败"]; } //客户编码查询成功接口 - (void)onLoadFinish:(ASIDownManager *)sender { NSDictionary *dic = [sender.mWebStr JSONValue]; [self cancel]; if (dic && [dic isKindOfClass:[NSDictionary class]]) { int iStatus = [[dic objectForKey:@"Status"] intValue]; NSString *message=[dic objectForKey:@"Message"]; if (iStatus == 0) { NSArray * approvArr=[dic objectForKey:@"Result"]; if(approvArr!=nil&&approvArr.count>0) { NSDictionary *dic=approvArr[0]; NSString *fillingid=[dic objectForKey:@"FilingID"]; NSString *CustomerID=[dic objectForKey:@"CustomerID"]; NSString *CustomerCode=[dic objectForKey:@"CustomerCode"]; NSString *CustomerName=[dic objectForKey:@"CustomerName"]; NSString *ChannelName=[dic objectForKey:@"ChannelName"]; NSString *ChannelID=[dic objectForKey:@"ChannelID"]; NSString *Telephone=[dic objectForKey:@"Telephone"]; NSString *Address=[dic objectForKey:@"Address"]; NSString *StaffName=[dic objectForKey:@"StaffName"]; NSString *StaffID=[dic objectForKey:@"StaffID"]; NSString *CustomerType=[dic objectForKey:@"CustomerType"]; NSString *CustomerTypeName=[dic objectForKey:@"CustomerTypeName"]; NSString *OrganizationID=[dic objectForKey:@"OrganizationID"]; NSString *OrganizationName=[dic objectForKey:@"OrganizationName"]; NSString *OrganizationCode=[dic objectForKey:@"OrganizationCode"]; if (CustomerID==nil) { CustomerID= @""; } if (fillingid==nil) { fillingid= @"0"; } _customerIDStr=CustomerID; if(![Telephone isEqualToString:@"-"]){ _txtTelephone.text=Telephone; } _strFilingID = fillingid; _txtCustomerCode.text = CustomerCode == nil ? Telephone : CustomerCode; _txtCustomerName.text=CustomerName; _txtCustomerAddress.text=Address; _channelStr=ChannelID; [_btnChannel setTitle:ChannelName forState:UIControlStateNormal]; _customerTypeStr=CustomerType; [_btnCustomerType setTitle:CustomerTypeName forState:UIControlStateNormal]; _departmentIdStr=OrganizationID; _departmentCodeStr=OrganizationCode; [_btnDepartment setTitle:OrganizationName forState:UIControlStateNormal]; _salesmanStr=StaffID; [_btnSalesMan setTitle:StaffName forState:UIControlStateNormal]; [self readOnly:YES]; //接着更新商品售价 double delayInSeconds = 0.5; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ [self updateGoodsSalePrice]; }); } else { [self readOnly:NO]; } } else if(iStatus==ActionResultStatusAuthError ||iStatus==ActionResultStatusNoLogin ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){ [self showReLoginDialog:message]; return; } else { [self showAlertViewText:message]; [self readOnly:NO]; } } } //客户编码查询失败接口 - (void)onLoadFail:(ASIDownManager *)sender { [self cancel]; [self readOnly:NO]; [self showAlertViewText:@"加载失败"]; } //文本编辑回調 -(void)textValueChange:(SubmitOrderTableViewCell *)cell txtField:(UITextField*)txtfield { [_cartModel updateCellSaleText:txtfield checkeId:cell.lblCartId.text]; [self refreshTotalAmount]; } //tableview的分区数 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } //tableview cell的高度 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSArray *checkArr=[_cartModel checkedArr]; SubmitOrderFrame *frame= checkArr[indexPath.row]; return frame.cellHeight; } //tableview的行数 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [_cartModel checkedArr].count; } //加载tableviewcell - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"SubmitOrderCell"; SubmitOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; cell=[[SubmitOrderTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; cell.selectionStyle=UITableViewCellSelectionStyleNone; SubmitOrderFrame *orderFrame=[_cartModel checkedArr][indexPath.row]; cell.delegate=self; [cell parseOrderInfo:orderFrame]; return cell; } //scrollview回调函数 - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{ [self.view endEditing:YES]; } //提交订单成功 - (void)onSubmitLoadFinish:(ASIDownManager *)sender { NSDictionary *dic = [sender.mWebStr JSONValue]; [self cancelHUD]; if (dic && [dic isKindOfClass:[NSDictionary class]]) { int iStatus = [[dic objectForKey:@"Status"] intValue]; NSString *message=[dic objectForKey:@"Message"]; if (iStatus == 0) { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:@"订单提交成功" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [self goBack]; }]; //[alertController addAction:cancelAction]; [alertController addAction:otherAction]; [self presentViewController:alertController animated:YES completion:nil]; } else if(iStatus==ActionResultStatusAuthError ||iStatus==ActionResultStatusNoLogin ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){ [self showReLoginDialog:message]; return; } else { [self showAlertViewText:message]; } } } //提交订单失败 - (void)onSubmitLoadFail:(ASIDownManager *)sender { [self cancelHUD]; [self showAlertViewText:@"请求失败"]; } //更新商品标价成功 - (void)onMarkedPriceLoadFinish:(ASIDownManager *)sender { NSDictionary *dic = [sender.mWebStr JSONValue]; [self cancel]; if (dic && [dic isKindOfClass:[NSDictionary class]]) { int iStatus = [[dic objectForKey:@"Status"] intValue]; NSString *message=[dic objectForKey:@"Message"]; if (iStatus == 0) { NSArray * approvArr=[dic objectForKey:@"Result"]; if(approvArr!=nil&&approvArr.count>0) { [_cartModel updateGoodsMarkedPrice:approvArr]; [self loadData]; } } else if(iStatus==ActionResultStatusAuthError ||iStatus==ActionResultStatusNoLogin ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){ [self showReLoginDialog:message]; return; } else { [self showAlertViewText:message]; } } } //提交订单失败 - (void)onMarkedPriceLoadFail:(ASIDownManager *)sender { [self cancel]; [self showAlertViewText:@"请求失败"]; } //弹出消息回调 -(void)alertMessage:(NSString *) message{ [self showAlertViewText:@"请手动输入商品数量"]; return; } //文本回调 -(void)textEnd:(id)sender customerCode:(NSString *)code { UIButton *btn=(UIButton *)sender; if(code!=nil){ _txtCustomerCode.text=code; } if(btn.tag==1301) //客户编码 { if(_txtCustomerCode.text.length==0){ return; } [self searchCustomerInfo:_txtCustomerCode.text]; } else if (btn.tag==1302){//联系电话 if(_txtTelephone.text.length==0)return; if(_txtCustomerCode.text.length>0)return; [self searchCustomerInfo:_txtTelephone.text]; } } -(void)customerType:(NSString *)customerTypeId customerTypeName:(NSString *)customerTypeName{ [_btnCustomerType setTitle:customerTypeName forState:UIControlStateNormal]; _customerTypeStr=customerTypeId; [_btnCustomerType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; } -(void)department:(NSString *)organizationId organizationCode:(NSString *)code organizationName:(NSString *)name{ [_btnDepartment setTitle:name forState:UIControlStateNormal]; [_btnDepartment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _departmentIdStr=organizationId; _departmentCodeStr=code; [self updatePrice]; } -(void)salesman:(NSString *)salesmanId salesmanName:(NSString *)salesmanName{ [_btnSalesMan setTitle:salesmanName forState:UIControlStateNormal]; [_btnSalesMan setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _salesmanStr=salesmanId; } -(void)channel:(NSString *)channelId channelName:(NSString *)channelName{ [_btnChannel setTitle:channelName forState:UIControlStateNormal]; [_btnChannel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _channelStr=channelId; [self updatePrice]; } #pragma mark -私有函数 //初始化UI -(void)initUI{ [self initTableView]; [self initHeaderView]; } //取消加载 - (void)cancelHUD { [HUD hide:YES]; } /** initNotification */ -(void)initNotification{ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFocusEditingChanged:) name:@"UITextFieldTextDidChangeNotification" object:self.txtCustomerCode ]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFocusEditingChanged:) name:@"UITextFieldTextDidChangeNotification" object:self.txtCustomerName ]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFocusEditingChanged:) name:@"UITextFieldTextDidChangeNotification" object:self.txtCustomerAddress]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFocusEditingChanged:) name:@"UITextFieldTextDidChangeNotification" object:self.txtTelephone]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFocusEditingChanged:) name:@"UITextFieldTextDidChangeNotification" object:self.txtRemarks]; } /** 文本框的长度限制 实现监听方法 @param sender <#sender description#> */ - (void)onFocusEditingChanged:(NSNotification *)sender { UITextField *textField = (UITextField *)sender.object; NSString *toBeString = textField.text; NSString *lang = [[UIApplication sharedApplication] textInputMode].primaryLanguage; // 长度 int kMaxLength=10; if ([textField isEqual:self.txtCustomerCode]) { kMaxLength=100; } else if ([textField isEqual:self.txtCustomerName]) { kMaxLength=50; } else if ([textField isEqual:self.txtCustomerAddress]) { kMaxLength=100; } else if ([textField isEqual:self.txtTelephone]) { kMaxLength=12; } else if ([textField isEqual:self.txtRemarks]) { kMaxLength=100; } if ([lang isEqualToString:@"zh-Hans"]) { UITextRange *selectedRange = [textField markedTextRange]; UITextPosition *position = [textField positionFromPosition:selectedRange.start offset:0]; if (!position) { if (toBeString.length > kMaxLength) { textField.text = [toBeString substringToIndex:kMaxLength]; } } }else{ if (toBeString.length > kMaxLength) { textField.text = [toBeString substringToIndex:kMaxLength]; } } } //更新商品标价 -(void)updateGoodsMarkePrice { [self startLoading]; NSString *urlStr = ServerURL; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"GetMarkedPrice" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; [dict setObject: _departmentCodeStr forKey:@"OrganizationCode"]; [dict setObject:_channelStr forKey:@"ChannelID"]; NSString * orderDetail=[_cartModel checkedSalePriceJSON]; [dict setObject:orderDetail forKey:@"OrderDetail"]; SBJsonWriter *write = [[SBJsonWriter alloc] init]; NSString *value = [write stringWithObject:dict]; NSLog(@"value=%@",value); self.mDownManager = [[ASIDownManager alloc] init]; _mDownManager.delegate = self; _mDownManager.OnImageDown = @selector(onMarkedPriceLoadFinish:); _mDownManager.OnImageFail = @selector(onMarkedPriceLoadFail:); [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil]; } //初始化tableview -(void)initTableView { vCustomTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-60)]; vCustomTableView.backgroundColor=[UIColor redColor]; vCustomTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight; vCustomTableView.backgroundColor = [UIColor whiteColor]; vCustomTableView.separatorStyle=UITableViewCellSeparatorStyleNone; vCustomTableView.delegate = self; vCustomTableView.dataSource=self; [self.view addSubview:vCustomTableView]; } //返回函数 -(void)goBack{ [self.navigationController popViewControllerAnimated:YES]; if([self.refreshDelegate respondsToSelector:@selector(refreshData)]){ [self.refreshDelegate refreshData]; } } /** 初始化headerview */ - (void)initHeaderView { _headerView = [UIView new]; _headerView.frame=CGRectZero; UIView *v1 = [UIView new]; v1.frame=CGRectMake(0, 0,Screen_Width, 51); [_headerView addSubview:v1]; UILabel *lblCustomerCode = [UILabel new]; lblCustomerCode.frame=CGRectMake(15, 16, 100, 25); lblCustomerCode.text = @"客户编码"; lblCustomerCode.font=orderTextFont; [v1 addSubview:lblCustomerCode]; _txtCustomerCode = [UITextField new]; _txtCustomerCode.frame=CGRectMake(CGRectGetMaxX(lblCustomerCode.frame)+10, 16, 150, 25); _txtCustomerCode.font=orderTextFont; _txtCustomerCode.placeholder = @"请输入客户编码"; [_txtCustomerCode addTarget:self action:@selector(textEnd:customerCode:) forControlEvents:UIControlEventEditingDidEnd]; _txtCustomerCode.tag=1301; [v1 addSubview:_txtCustomerCode]; _btnCustomerCode = [UIButton buttonWithType:UIButtonTypeCustom]; _btnCustomerCode.frame=CGRectMake(Screen_Width-50,10,32,30); UIImageView *customerCodeImg = [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)]; [customerCodeImg setImage:[UIImage imageNamed:@"rightarrow"]]; [ _btnCustomerCode addSubview:customerCodeImg]; customerCodeImg.userInteractionEnabled=NO; [v1 addSubview:_btnCustomerCode]; [_btnCustomerCode addTarget:self action:@selector(searchCustomerCode) forControlEvents:UIControlEventTouchUpInside]; UIView *separator = [UIView new]; separator.backgroundColor=LineBackgroundColor; separator.frame=CGRectMake(CGRectGetMaxX(lblCustomerCode.frame)+10,CGRectGetMaxY(_txtCustomerCode.frame)+10,Screen_Width-CGRectGetMaxX(lblCustomerCode.frame)+10, 1); [v1 addSubview:separator]; //客户名称 UIView *v2 = [UIView new]; v2.frame=CGRectMake(0,CGRectGetMaxY(v1.frame),Screen_Width, 51); [_headerView addSubview:v2]; UILabel *lblCustomerName = [UILabel new]; lblCustomerName.frame=CGRectMake(15, 16, 100, 25); lblCustomerName.text = @"客户名称"; lblCustomerName.font=orderTextFont; [v2 addSubview: lblCustomerName]; _txtCustomerName = [UITextField new]; _txtCustomerName.frame=CGRectMake(CGRectGetMaxX(lblCustomerName.frame)+10, 16, SCREENWIDTH - CGRectGetMaxX(lblCustomerName.frame)-20, 25); _txtCustomerName.placeholder = @"请输入客户名称"; _txtCustomerName.tag=1303; _txtCustomerName.font=orderTextFont; [v2 addSubview:_txtCustomerName]; UIView *separator1 = [UIView new]; separator1.backgroundColor=LineBackgroundColor; separator1.frame=CGRectMake(CGRectGetMaxX(lblCustomerName.frame)+10,CGRectGetMaxY(_txtCustomerName.frame)+10,Screen_Width-CGRectGetMaxX( lblCustomerName.frame)+10, 1); [v2 addSubview:separator1]; UIView *v3 = [UIView new]; v3.frame=CGRectMake(0,CGRectGetMaxY(v2.frame),Screen_Width, 51); [_headerView addSubview:v3]; UILabel *lblCustomerAddress = [UILabel new]; lblCustomerAddress.frame=CGRectMake(15, 16, 100, 25); lblCustomerAddress.text = @"客户地址"; lblCustomerAddress.font=orderTextFont; [v3 addSubview: lblCustomerAddress]; _txtCustomerAddress = [UITextField new]; _txtCustomerAddress.frame=CGRectMake(CGRectGetMaxX(lblCustomerAddress.frame)+10, 16, SCREENWIDTH - CGRectGetMaxX(lblCustomerAddress.frame)-20, 25); _txtCustomerAddress.placeholder = @"请输入客户地址"; _txtCustomerAddress.font=orderTextFont; _txtCustomerAddress.tag=1304; [v3 addSubview:_txtCustomerAddress]; UIView *separator2 = [UIView new]; separator2.backgroundColor=LineBackgroundColor; separator2.frame=CGRectMake(CGRectGetMaxX(lblCustomerAddress.frame)+10,CGRectGetMaxY(_txtCustomerAddress.frame)+10,Screen_Width-CGRectGetMaxX( lblCustomerAddress.frame)+10, 1); [v3 addSubview:separator2]; UIView *v4 = [UIView new]; v4.frame=CGRectMake(0,CGRectGetMaxY(v3.frame),Screen_Width, 51); [_headerView addSubview:v4]; UILabel *lblTelephone = [UILabel new]; lblTelephone.frame=CGRectMake(15, 16, 100, 25); lblTelephone.text = @"联系电话"; lblTelephone.font=orderTextFont; [v4 addSubview: lblTelephone]; _txtTelephone = [UITextField new]; _txtTelephone.tag=1302; _txtTelephone.keyboardType = UIKeyboardTypeNumberPad; _txtTelephone.frame=CGRectMake(CGRectGetMaxX(lblTelephone.frame)+10, 16, 150, 25); _txtTelephone.placeholder = @"请输入联系电话"; _txtTelephone.font=orderTextFont; [v4 addSubview:_txtTelephone]; UIView *separator3 = [UIView new]; separator3.backgroundColor=LineBackgroundColor; separator3.frame=CGRectMake(CGRectGetMaxX(lblTelephone.frame)+10,CGRectGetMaxY(_txtTelephone.frame)+10,Screen_Width-CGRectGetMaxX(lblTelephone.frame)+10, 1); [v4 addSubview:separator3]; UIView *v5 = [UIView new]; v5.frame=CGRectMake(0,CGRectGetMaxY(v4.frame),Screen_Width, 51); [_headerView addSubview:v5]; UILabel *lblCustomerType = [UILabel new]; lblCustomerType.frame=CGRectMake(15, 16, 100, 25); lblCustomerType.text = @"客户性质"; lblCustomerType.font=orderTextFont; [v5 addSubview: lblCustomerType]; _btnCustomerType = [UIButton buttonWithType:UIButtonTypeCustom]; _btnCustomerType.frame=CGRectMake(CGRectGetMaxX(lblCustomerType.frame)+10, 16, 150, 25); _btnCustomerType.titleLabel.font=orderTextFont; _btnCustomerType.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; [_btnCustomerType setTitle:@"请选择客户性质" forState:UIControlStateNormal]; [_btnCustomerType setTitleColor:ButtonTitleColor forState:UIControlStateNormal]; [v5 addSubview:_btnCustomerType]; [_btnCustomerType addTarget:self action:@selector(showCustomerTypeAlert) forControlEvents:UIControlEventTouchUpInside]; UIImageView *customerTypeImg = [[UIImageView alloc] initWithFrame:CGRectMake(Screen_Width-25, 20,7,12)]; [customerTypeImg setImage:[UIImage imageNamed:@"rightarrow"] ]; [v5 addSubview:customerTypeImg]; UIView *separator4 = [UIView new]; separator4.backgroundColor=LineBackgroundColor; separator4.frame=CGRectMake(CGRectGetMaxX( lblCustomerType.frame)+10,CGRectGetMaxY(_btnCustomerType.frame)+10,Screen_Width-CGRectGetMaxX( lblCustomerType.frame)+10, 1); [v5 addSubview:separator4]; UIView *v6 = [UIView new]; v6.frame=CGRectMake(0,CGRectGetMaxY(v5.frame),Screen_Width, 51); [_headerView addSubview:v6]; UILabel *lblChannel = [UILabel new]; lblChannel.frame=CGRectMake(15, 16, 100, 25); lblChannel.text = @"渠 道"; lblChannel.font=orderTextFont; [v6 addSubview: lblChannel]; _btnChannel = [UIButton buttonWithType:UIButtonTypeCustom]; _btnChannel.frame=CGRectMake(CGRectGetMaxX(lblChannel.frame)+10, 16, 150, 25); [_btnChannel setTitle:@"请选择渠道" forState:UIControlStateNormal]; [_btnChannel setTitleColor:ButtonTitleColor forState:UIControlStateNormal]; [v6 addSubview:_btnChannel]; _btnChannel.titleLabel.font=orderTextFont; _btnChannel.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; [_btnChannel addTarget:self action:@selector(showChannelAlert) forControlEvents:UIControlEventTouchUpInside]; UIImageView *channelImg = [[UIImageView alloc] initWithFrame:CGRectMake(Screen_Width-25, 20,7,12)]; [channelImg setImage:[UIImage imageNamed:@"rightarrow"] ]; [v6 addSubview:channelImg]; UIView *separator5 = [UIView new]; separator5.backgroundColor=LineBackgroundColor; separator5.frame=CGRectMake(CGRectGetMaxX( lblChannel.frame)+10,CGRectGetMaxY(_btnChannel.frame)+10,Screen_Width-CGRectGetMaxX( lblChannel.frame)+10, 1); [v6 addSubview:separator5]; UIView *v7 = [UIView new]; v7.frame=CGRectMake(0,CGRectGetMaxY(v6.frame),Screen_Width, 51); [_headerView addSubview:v7]; UILabel *lblDepartment = [UILabel new]; lblDepartment.frame=CGRectMake(15, 16, 100, 25); lblDepartment.text = @"业务部门"; lblDepartment.font=orderTextFont; [v7 addSubview: lblDepartment]; _btnDepartment = [UIButton buttonWithType:UIButtonTypeCustom]; _btnDepartment.frame=CGRectMake(CGRectGetMaxX(lblDepartment.frame)+10, 16, 250, 25); [_btnDepartment setTitle:@"请选择业务部门" forState:UIControlStateNormal]; [_btnDepartment setTitleColor:ButtonTitleColor forState:UIControlStateNormal]; [v7 addSubview:_btnDepartment]; [_btnDepartment addTarget:self action:@selector(showDepartmentAlert) forControlEvents:UIControlEventTouchUpInside]; _btnDepartment.titleLabel.font=orderTextFont; _btnDepartment.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; UIImageView *departmentImg = [[UIImageView alloc] initWithFrame:CGRectMake(Screen_Width-25, 20,7,12)]; [departmentImg setImage:[UIImage imageNamed:@"rightarrow"] ]; [v7 addSubview:departmentImg]; UIView *separator6 = [UIView new]; separator6.backgroundColor=LineBackgroundColor; separator6.frame=CGRectMake(CGRectGetMaxX( lblDepartment.frame)+10,CGRectGetMaxY(_btnDepartment.frame)+10,Screen_Width-CGRectGetMaxX(lblDepartment.frame)+10, 1); [v7 addSubview:separator6]; UIView *v8 = [UIView new]; v8.frame=CGRectMake(0,CGRectGetMaxY(v7.frame),Screen_Width, 51); [_headerView addSubview:v8]; UILabel *lblSalesMan = [UILabel new]; lblSalesMan.frame=CGRectMake(15, 16, 100, 25); lblSalesMan.text = @"业 务 员"; lblSalesMan.font=orderTextFont; [v8 addSubview: lblSalesMan]; _btnSalesMan = [UIButton buttonWithType:UIButtonTypeCustom]; _btnSalesMan.frame=CGRectMake(CGRectGetMaxX(lblSalesMan.frame)+10, 16, 150, 25); [_btnSalesMan setTitle:@"请选择业务员" forState:UIControlStateNormal]; [_btnSalesMan setTitleColor:ButtonTitleColor forState:UIControlStateNormal]; [v8 addSubview:_btnSalesMan]; _btnSalesMan.titleLabel.font=orderTextFont; _btnSalesMan.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; [_btnSalesMan addTarget:self action:@selector(showSalesManAlert) forControlEvents:UIControlEventTouchUpInside]; UIImageView *salesmanImg = [[UIImageView alloc] initWithFrame:CGRectMake(Screen_Width-25, 20,7,12)]; [salesmanImg setImage:[UIImage imageNamed:@"rightarrow"] ]; [v8 addSubview:salesmanImg]; UIView *separator7 = [UIView new]; separator7.backgroundColor=LineBackgroundColor; separator7.frame=CGRectMake(CGRectGetMaxX(lblSalesMan.frame)+10,CGRectGetMaxY(_btnSalesMan.frame)+10,Screen_Width-CGRectGetMaxX(lblSalesMan.frame)+10, 1); [v8 addSubview:separator7]; UIView *v9 = [UIView new]; v9.frame=CGRectMake(0,CGRectGetMaxY(v8.frame),Screen_Width, 51); [_headerView addSubview:v9]; UILabel *lblRemarks = [UILabel new]; lblRemarks.frame=CGRectMake(15, 16, 100, 25); lblRemarks.text = @"备 注"; lblRemarks.font=orderTextFont; [v9 addSubview: lblRemarks]; _txtRemarks = [UITextField new]; _txtRemarks.frame=CGRectMake(CGRectGetMaxX(lblRemarks.frame)+10, 16,Screen_Width-CGRectGetMaxX(lblRemarks.frame)-10, 25); _txtRemarks.placeholder = @"请输入备注"; _txtRemarks.tag=1305; _txtRemarks.font=orderTextFont; [v9 addSubview:_txtRemarks]; UIView *separator8 = [UIView new]; separator8.backgroundColor=LineBackgroundColor; separator8.frame=CGRectMake(0,CGRectGetMaxY(v9.frame)+10,Screen_Width, 10); [_headerView addSubview:separator8]; _headerView.frame=CGRectMake(0,0, Screen_Width, CGRectGetMaxY(separator8.frame)); vCustomTableView.tableHeaderView=_headerView; _footerView = [UIView new]; _footerView.frame=CGRectMake(0, Screen_Height-64-rectStatusHeight-rectNavHeight, self.view.frame.size.width,64); _footerView.backgroundColor = [UIColor whiteColor]; [self.view addSubview: _footerView]; [self.view setBackgroundColor:[UIColor whiteColor]]; //总计 UILabel *lblamountname = [UILabel new]; lblamountname.font = [UIFont systemFontOfSize:15]; lblamountname.text = @"合计金额:"; lblamountname.frame=CGRectMake(10,20,70, 23); [_footerView addSubview:lblamountname]; UILabel *lblYuan = [UILabel new]; lblYuan.text = @"¥"; lblYuan.font=orderTextFont; lblYuan.frame=CGRectMake(CGRectGetMaxX(lblamountname.frame),20,15, 23); [_footerView addSubview:lblYuan]; //价格 _lblTotalAmount = [UILabel new]; _lblTotalAmount.font=orderTextFont; _lblTotalAmount.frame=CGRectMake(CGRectGetMaxX(lblYuan.frame),20, 150, 23); [_footerView addSubview:_lblTotalAmount]; //提交订单 UIButton *btnBalance = [UIButton buttonWithType:UIButtonTypeCustom]; btnBalance.frame=CGRectMake(Screen_Width-114,0, 114, 64); [btnBalance setBackgroundImage:[UIImage imageNamed:@"bt_submit"] forState:UIControlStateNormal]; [btnBalance addTarget:self action:@selector(reallySubmitOrder) forControlEvents:UIControlEventTouchUpInside]; [_footerView addSubview:btnBalance]; } //进度条取消函数 - (void)cancel { [self stopLoading]; } //提交订单 -(void)reallySubmitOrder { [self.view endEditing:YES]; if(_txtCustomerCode.text.length==0){ [self showAlertViewText:@"客户编码不能为空"]; return; } if(_txtCustomerName.text.length==0){ [self showAlertViewText:@"客户名称不能为空"]; return; } if(_txtTelephone.text.length==0) { [self showAlertViewText:@"联系电话不能为空"]; return; } if(_customerTypeStr==nil||[NSString stringWithFormat:@"%@",_customerTypeStr].length==0){ [self showAlertViewText:@"客户性质不能为空"]; return; } if(_channelStr==nil|| [NSString stringWithFormat:@"%@", _channelStr].length==0){ [self showAlertViewText:@"渠道不能为空"]; return; } if(_departmentIdStr==nil||[NSString stringWithFormat:@"%@",_departmentIdStr].length==0){ [self showAlertViewText:@"业务部门不能为空"]; return; } if(_salesmanStr==nil||[NSString stringWithFormat:@"%@",_salesmanStr ].length==0){ [self showAlertViewText:@"业务员不能为空"]; return; } if(!_cartModel){ return; } if(![_cartModel isSelectAtLeastOne]) { [self showAlertViewText:@"至少选择一种商品"]; return; } if(![_cartModel checkFormat]) { [self showAlertViewText:@"每件商品的数量不能为0"]; return; } NSString *totalAmount= _lblTotalAmount.text; if(totalAmount!=nil){ if(totalAmount.doubleValue>MAXIMUM_QUANTITY){ [self showAlertViewText:@"合计金额不能大于9999999999.999999"]; return; } } _cartItemArr=[_cartModel checkedArr]; //其他参数 _strCustomerCode=_txtCustomerCode.text; _strOrganizationID=_departmentIdStr; _strTelephone=_txtTelephone.text; _strCustomerName=_txtCustomerName.text; _strAddress=_txtCustomerAddress.text; _strRemarks=_txtRemarks.text; [self submitOrder]; } -(void)submitOrder { self.mDownManager = [[ASIDownManager alloc] init]; _mDownManager.delegate = self; _mDownManager.OnImageDown = @selector(onSubmitLoadFinish:); _mDownManager.OnImageFail = @selector(onSubmitLoadFail:); HUD = [[MBProgressHUD alloc] initWithView:self.view]; [self.view addSubview:HUD]; HUD.dimBackground = YES; HUD.labelText = @"正在提交订单"; [HUD show:YES]; NSString *urlStr = ServerURL; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"SaveIOrderIphone" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; if (kkLicenseCode !=nil) { [dict setObject:kkLicenseCode forKey:@"LicenseCode"]; } [dict setObject:[NSString stringWithFormat:@"%@", _strFilingID ] forKey:@"FilingID"]; [dict setObject:[NSString stringWithFormat:@"%@", _customerIDStr ] forKey:@"CustomerID"]; //客户编码ID,如果是新客户,为0 [dict setObject:[NSString stringWithFormat:@"%@", _strCustomerCode] forKey:@"CustomerCode"];// 客户编码 [dict setObject:[NSString stringWithFormat:@"%@", _strCustomerName] forKey:@"CustomerName"]; // [dict setObject:@"15840356984" forKey:@"Telephone"]; [dict setObject:[NSString stringWithFormat:@"%@", _strTelephone] forKey:@"Telephone"]; [dict setObject:[NSString stringWithFormat:@"%@", _channelStr] forKey:@"ChannelID"]; [dict setObject:[NSString stringWithFormat:@"%@", _customerTypeStr] forKey:@"CustomerType"]; [dict setObject:[NSString stringWithFormat:@"%@",_departmentIdStr] forKey:@"OrganizationID"]; [dict setObject:[NSString stringWithFormat:@"%@",_salesmanStr] forKey:@"StaffID"]; [dict setObject:_strAddress forKey:@"Address"]; [dict setObject:_strRemarks forKey:@"Remarks"]; NSMutableArray *cartItemArr2=[NSMutableArray new]; for(int i=0;i<_cartItemArr.count;i++) { SubmitOrderFrame *frame= _cartItemArr[i]; ShopCartItemModel *model=frame.cartModel; NSDictionary *dic=[NSDictionary new]; NSString *cartId=[NSString stringWithFormat:@"%@", model.cartId]; NSString *code=[NSString stringWithFormat:@"%@", model.code]; NSString *onlyCode=[NSString stringWithFormat:@"%@", model.onlyCode]; NSString *brandName=[NSString stringWithFormat:@"%@", model.brandName]; NSString *gradeName=[NSString stringWithFormat:@"%@", model.gradeName]; NSString *specification=[NSString stringWithFormat:@"%@", model.specification]; NSString *colorNumber=[NSString stringWithFormat:@"%@", model.colorNumber]; NSString *warehouseName=[NSString stringWithFormat:@"%@", model.warehouseName]; NSString *positionNumber=[NSString stringWithFormat:@"%@", model.positionNumber]; NSString *balanceQuantity=[NSString stringWithFormat:@"%@", model.balanceQuantity]; NSString *inventoryId=[NSString stringWithFormat:@"%@", model.inventoryId]; NSString *salesQuantity=[NSString stringWithFormat:@"%@", model.salesQuantity]; NSString *salesPrice=[NSString stringWithFormat:@"%@", model.salesPrice]; NSString *remarks=[NSString stringWithFormat:@"%@", model.remarks]; NSString *acreage=[NSString stringWithFormat:@"%@", model.acreage]; NSString *volume=[NSString stringWithFormat:@"%@", model.volume]; NSString *codeId=[NSString stringWithFormat:@"%@", model.codeId]; NSString *gradeId=[NSString stringWithFormat:@"%@", model.gradeId]; NSString *warehouseId=[NSString stringWithFormat:@"%@", model.warehouseId]; NSString *brandId=[NSString stringWithFormat:@"%@", model.brandId]; NSString *kindId=[NSString stringWithFormat:@"%@", model.kindId]; NSString *kindName=[NSString stringWithFormat:@"%@", model.kindName]; NSString *varietyId=[NSString stringWithFormat:@"%@", model.varietyId]; NSString *varietyName=[NSString stringWithFormat:@"%@", model.varietyName]; NSString *seriesId=[NSString stringWithFormat:@"%@", model.seriesId]; NSString *seriesName=[NSString stringWithFormat:@"%@", model.seriesName]; NSString *unitId=[NSString stringWithFormat:@"%@", model.unitId]; NSString *unitName=[NSString stringWithFormat:@"%@", model.unitName]; NSString *markedPrice=[NSString stringWithFormat:@"%@", model.markedPrice]; NSString *weight=[NSString stringWithFormat:@"%@", model.weight]; NSString *package=[NSString stringWithFormat:@"%@", model.package]; // Weight,MarkedPrice,SalesQuantity,BalanceQuantity,SalesPrice //标价 if([markedPrice isEqualToString:@""]||[markedPrice isEqualToString:@"(null)"]||markedPrice==nil){ markedPrice=@"0"; } NSNumber *markedPriceNum=[NSNumber numberWithFloat:[markedPrice floatValue]]; if([weight isEqualToString:@""]||[weight isEqualToString:@"(null)"]||weight==nil){ weight=@"0"; } NSNumber *weightNum=[NSNumber numberWithFloat:[weight floatValue]]; if([salesQuantity isEqualToString:@""]||[salesQuantity isEqualToString:@"(null)"]||salesQuantity==nil){ salesQuantity=@"0"; } NSNumber *salesQuantityNum=[NSNumber numberWithFloat:[salesQuantity floatValue]]; if([balanceQuantity isEqualToString:@""]||[balanceQuantity isEqualToString:@"(null)"]||balanceQuantity==nil){ balanceQuantity=@"0"; } NSNumber *balanceQuantityNum=[NSNumber numberWithFloat:[balanceQuantity floatValue]]; if([salesPrice isEqualToString:@""]||[salesPrice isEqualToString:@"(null)"]||salesPrice==nil){ salesPrice=@"0"; } NSNumber *salesPriceNum=[NSNumber numberWithFloat:[salesPrice floatValue]]; if([package isEqualToString:@""]||[package isEqualToString:@"(null)"]||package==nil){ package=@"0"; } NSNumber *packageNum=[NSNumber numberWithInt:[salesPrice intValue]]; dic=@{@"CartID":cartId,@"Code":code,@"OnlyCode":onlyCode,@"BrandName":brandName,@"GradeName":gradeName,@"Specification":specification,@"ColorNumber":colorNumber,@"WarehouseName":warehouseName,@"PositionNumber":positionNumber,@"BalanceQuantity":balanceQuantityNum,@"InventoryID":inventoryId,@"SalesQuantity":salesQuantityNum,@"SalesPrice":salesPriceNum,@"Remarks":remarks, @"Acreage":acreage,@"Volume":volume,@"CodeID":codeId,@"GradeID":gradeId,@"WarehouseID":warehouseId,@"BrandID":brandId, @"KindID":kindId,@"KindName":kindName,@"VarietyID":varietyId,@"VarietyName":varietyName,@"SeriesID":seriesId, @"SeriesName":seriesName,@"UnitID":unitId,@"UnitName":unitName,@"MarkedPrice": markedPriceNum ,@"Weight":weightNum,@"Package":packageNum }; [cartItemArr2 addObject:dic]; } SBJsonWriter *write = [[SBJsonWriter alloc] init]; NSString *value = [write stringWithObject:cartItemArr2]; [dict setObject:value forKey:@"ShoppingCartData"]; [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil]; } //显示客户性质 -(void)showCustomerTypeAlert{ CustomerTypeSearchVC *customerType=[[CustomerTypeSearchVC alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:customerType]; navigationController.modalPresentationStyle = UIModalPresentationFormSheet; customerType.orderDelegate=self; [self presentViewController:navigationController animated:YES completion:nil]; } //更新合计金额 -(void)refreshTotalAmount { double price=[_cartModel calculatePrice]; if(price>MAXIMUM_QUANTITY){ price=MAXIMUM_QUANTITY; } _lblTotalAmount.text=[NSString stringWithFormat:@"%.2lf",price ]; } //更新商品售价 -(void)updatePrice { //接着更新商品售价 double delayInSeconds = 0.5; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ [self updateGoodsSalePrice]; }); } //业务部门查询 -(void)showDepartmentAlert { DepartmentSearchVC *department=[[DepartmentSearchVC alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:department]; navigationController.modalPresentationStyle = UIModalPresentationFormSheet; department.departmentDelegate=self; [self presentViewController:navigationController animated:YES completion:nil]; } //业务员查询 -(void)showSalesManAlert{ SalesManSearchVC *salesman=[[SalesManSearchVC alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:salesman]; navigationController.modalPresentationStyle = UIModalPresentationFormSheet; salesman.salesmanDelegate=self; [self presentViewController:navigationController animated:YES completion:nil]; } //渠道查询 -(void)showChannelAlert{ ChannelSearchVC *channel=[[ChannelSearchVC alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:channel]; navigationController.modalPresentationStyle = UIModalPresentationFormSheet; channel.channelDelegate=self; [self presentViewController:navigationController animated:YES completion:nil]; } //更新商品售价 -(void)updateGoodsSalePrice { [self startLoading]; NSString *urlStr = ServerURL; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"GetOrderPriceIphone" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; [dict setObject:_customerIDStr forKey:@"CustomerID"]; NSString * OrderDetail=[_cartModel checkedSalePriceJSON]; [dict setObject:OrderDetail forKey:@"OrderDetail"]; self.mDownManager = [[ASIDownManager alloc] init]; _mDownManager.delegate = self; _mDownManager.OnImageDown = @selector(onSalesPriceLoadFinish:); _mDownManager.OnImageFail = @selector(onSalesPriceLoadFail:); [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil]; } //tableview刷新数据 -(void) loadData { [self.vCustomTableView reloadData]; [self refreshTotalAmount]; } /** 键盘弹出 @param note <#note description#> */ -(void)keyboardWillShow:(NSNotification *)note { CGRect keyBoardRect=[note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; vCustomTableView.contentInset = UIEdgeInsetsMake(0, 0, keyBoardRect.size.height, 0); } /** 键盘隐藏 @param note <#note description#> */ -(void)keyboardWillHide:(NSNotification *)note { vCustomTableView.contentInset = UIEdgeInsetsZero; } //只读设置 -(void)readOnly:(BOOL)end { if(end){ // 客户名称、渠道、客户性质都是只读 // 客户编码、联系电话、联系人、客户地址、备注、业务部门、业务员为可编辑 _txtCustomerName.enabled=NO; _btnChannel.enabled=NO; _btnCustomerType.enabled=NO; _btnSalesMan.enabled=YES; [_btnSalesMan setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnDepartment.enabled=YES; [_btnDepartment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _txtCustomerName.textColor=LabelGrayTextColor; [_btnChannel setTitleColor:LabelGrayTextColor forState:UIControlStateNormal]; [_btnCustomerType setTitleColor:LabelGrayTextColor forState:UIControlStateNormal]; _btnSalesMan.backgroundColor=[UIColor clearColor]; _btnDepartment.backgroundColor=[UIColor clearColor]; _txtCustomerCode.enabled=YES; _txtTelephone.enabled=YES; _txtCustomerAddress.enabled=YES; _txtRemarks.enabled=YES; } else { _txtCustomerName.enabled=YES; _btnChannel.enabled=YES; [_btnChannel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnCustomerType.enabled=YES; [_btnCustomerType setTitleColor:[UIColor blackColor ] forState:UIControlStateNormal]; _btnSalesMan.enabled=YES; [_btnSalesMan setTitleColor:[UIColor blackColor ] forState:UIControlStateNormal]; _btnDepartment.enabled=YES; [_btnDepartment setTitleColor:[UIColor blackColor ] forState:UIControlStateNormal]; _txtCustomerName.textColor=[UIColor blackColor]; _btnChannel.backgroundColor=[UIColor clearColor]; _btnCustomerType.backgroundColor=[UIColor clearColor]; _btnSalesMan.backgroundColor=[UIColor clearColor]; _btnDepartment.backgroundColor=[UIColor clearColor]; _txtCustomerCode.enabled=YES; _txtTelephone.enabled=YES; _txtCustomerAddress.enabled=YES; _txtRemarks.enabled=YES; } } //获取客户基本信息 -(void)searchCustomerInfo:(NSString *)codeOrPhone { NSString *urlStr = ServerURL; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"GetCutomersDataSourceIphone" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; [dict setObject:codeOrPhone forKey:@"CustomerCode"]; [dict setObject:@"" forKey:@"CustomerName"]; [dict setObject:@"" forKey:@"ChannelID"]; [dict setObject:@"" forKey:@"CustomerType"]; self.mDownManager = [[ASIDownManager alloc] init]; _mDownManager.delegate = self; _mDownManager.OnImageDown = @selector(onLoadFinish:); _mDownManager.OnImageFail = @selector(onLoadFail:); [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil]; } //客户编码列表查询 -(void)searchCustomerCode{ CustomerCodeSearchVC *customerCodeVC=[[ CustomerCodeSearchVC alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:customerCodeVC]; navigationController.modalPresentationStyle = UIModalPresentationFormSheet; navigationController.preferredContentSize = CGSizeMake(frameSize.x, frameSize.y); customerCodeVC.orderDelegate=self; [self presentViewController:navigationController animated:YES completion:nil]; } @end