| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- //
- // InventoryFreezeOrderSearchCell.m
- // IBOSS
- //
- // Created by 关宏厚 on 2020/5/11.
- // Copyright © 2020 elongtian. All rights reserved.
- //
- #import "InventoryFreezeOrderSearchCell.h"
- @implementation InventoryFreezeOrderSearchCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- }
- #pragma mark - 委托函数
- /**
- 高度
- @return return value description
- */
- - (CGFloat)cellHeight {
- return 449.0f;
- }
- /**
- cell
-
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
- InventoryFreezeOrderSearchCell *cell = [[NSBundle mainBundle]
- loadNibNamed:@"InventoryFreezeOrderSearchCell"
- owner:nil
- options:nil][0];
-
- cell.txtCustomerCode.delegate = cell;
- cell.txtContacts.delegate = cell;
- cell.txtTelephone.delegate=cell;
- [cell configureKeyboard];
- return cell;
- }
- - (void)configureKeyboard {
- UIView *keyBoardAccessoryView = [self createKeyBoardAccessoryView];
- _txtCustomerCode.inputAccessoryView=keyBoardAccessoryView;
- _txtContacts.inputAccessoryView=keyBoardAccessoryView;
- _txtTelephone.inputAccessoryView=keyBoardAccessoryView;
-
-
- }
- /**
- 文本编辑时候 弹出取消完成按钮
-
- @return <#return value description#>
- */
- - (UIView *)createKeyBoardAccessoryView {
- UIView *keyBoardAccessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, ACCESSORY_VIEW_HEIGHT)];
- [keyBoardAccessoryView setBackgroundColor:[UIColor hexColor:@"e1e1e1"]];
- UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(ACCESSORY_BUTTON_LEADING_TRAILING, 0, ACCESSORY_BUTTON_WIDTH, ACCESSORY_VIEW_HEIGHT)];
- [backButton setTitle:@"取消" forState:UIControlStateNormal];
- [backButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
- [backButton.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- [backButton addTarget:self action:@selector(accessoryButtonBack) forControlEvents:UIControlEventTouchUpInside];
- UIButton *doneButton = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width - ACCESSORY_BUTTON_LEADING_TRAILING - ACCESSORY_BUTTON_WIDTH, 0, ACCESSORY_BUTTON_WIDTH, ACCESSORY_VIEW_HEIGHT)];
- [doneButton setTitle:@"完成" forState:UIControlStateNormal];
- [doneButton setTitleColor:[UIColor hexColor:FILTER_RED_STRING] forState:UIControlStateNormal];
- [doneButton.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- [doneButton addTarget:self action:@selector(accessoryButtonDone) forControlEvents:UIControlEventTouchUpInside];
- [keyBoardAccessoryView addSubview:backButton];
- [keyBoardAccessoryView addSubview:doneButton];
- return keyBoardAccessoryView;
- }
- /**
- 取消文本
- */
- - (void)accessoryButtonBack {
- [self hideKey];}
- /**
- 确定文本
- */
- - (void)accessoryButtonDone {
- [_txtCustomerCode resignFirstResponder];
- [_txtContacts resignFirstResponder];
- [_txtTelephone resignFirstResponder];
- [self hideKey];
- }
- /**
- * 隐藏键盘
- */
- - (void)hideKey
- {
- [self.contentView endEditing:YES];
- }
- /**
- 文本编辑结束事件
-
- @param textField <#textField description#>
- */
- - (void)textFieldDidEndEditing:(UITextField *)textField {
- [self updateModel];
- }
- /**
- 重置按钮 事件
- */
- - (void)resetData {
-
- [_txtCustomerCode setText:@""];
-
- [_txtContacts setText:@""];
-
- [_txtTelephone setText:@""];
-
- [self.btnStaff setTitle:@"请选择业务员" forState:UIControlStateNormal];
- _staffName=@"";
- [self.btnFreezeReason setTitle:@"请选择冻结原因" forState:UIControlStateNormal];
- _freezeReasonName=@"";
-
- }
- /**
- 更新model
-
- @param model <#model description#>
- @param indexPath <#indexPath description#>
- */
- - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model
- indexPath:(NSIndexPath *)indexPath{
- self.regionModel = *model;
-
- [self updateModel];
- }
- /**
- 业务员
-
- @param Amodel <#Amodel description#>
- @param cr <#cr description#>
- */
- - (void)achiementData:(AchiementDepartmentInfoModel *)Amodel CustomerReport:(CustomerReport)cr{
-
- // 业务员
- if(cr == ReportAchiementmn){
- _staffName = Amodel.staffName;
- [self.btnStaff setTitle:Amodel.staffName forState:UIControlStateNormal];
- [self.btnStaff setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- }
-
- [self updateModel];
- }
- /**
- 长度
-
- @param textField <#textField description#>
- @param range <#range description#>
- @param string <#string description#>
- @return <#return value description#>
- */
- - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
-
- return YES;
- }
- /**
- Identifier
-
- @return <#return value description#>
- */
- + (NSString *)cellReuseIdentifier {
-
- return @"InventoryFreezeOrderSearchCell";
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- - (IBAction)clickStaffAction:(id)sender {
-
- CustomerAchievementTextVC *tc = [[CustomerAchievementTextVC alloc ]init];
- tc.cDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.showDialogViewTag=ReportAchiementmn;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- - (IBAction)clickFreezeReasonAction:(id)sender {
-
- FreezeReasonViewController *tc = [[FreezeReasonViewController alloc ]init];
-
- tc.inventoryDelegate = self;
- tc.isPresentVc = YES;
-
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- -(void)getFreezeReason:(NSString*)reasonId name:(NSString*)reasonName
- {
- _freezeReasonName=reasonName;
- [_btnFreezeReason setTitle:_freezeReasonName forState:UIControlStateNormal];
- [_btnFreezeReason setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- [self updateModel];
- }
- -(void)updateModel
- {
- InventoryFreezeOrderSearchModel *searchModel=[[InventoryFreezeOrderSearchModel alloc]init];
-
- searchModel.customerCode = [_txtCustomerCode.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- searchModel.contacts=[_txtContacts.text stringByReplacingOccurrencesOfString:@" " withString:@""];
-
- searchModel.telephone=[_txtTelephone.text stringByReplacingOccurrencesOfString:@" " withString:@""];
-
- searchModel.staffName=_staffName;
-
- searchModel.freezeReasonName=_freezeReasonName;
- NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_regionModel.customDict];
- [mutDict setValue:searchModel forKey:INVENTORY_FREEZE_ORDER_SEARCH_MODEL];
- _regionModel.customDict = [mutDict copy];
- }
- @end
|