| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- //
- // CustomerCurrentAccountSummarySearchCell.m
- // IBOSS
- //
- // Created by 关宏厚 on 2021/2/24.
- // Copyright © 2021 elongtian. All rights reserved.
- //
- #import "CustomerCurrentAccountSummarySearchCell.h"
- @implementation CustomerCurrentAccountSummarySearchCell
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- }
- /**
- 高度
-
- @return return value description
- */
- - (CGFloat)cellHeight {
- return 782.0f;
- }
- /**
- Identifier
-
- @return <#return value description#>
- */
- + (NSString *)cellReuseIdentifier {
-
- return @"CustomerCurrentAccountSummarySearchCell";
- }
- /**
- 更新model
-
- @param model <#model description#>
- @param indexPath <#indexPath description#>
- */
- - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model indexPath:(NSIndexPath *)indexPath{
- self.regionModel = *model;
- // 1. 创建一个点击事件,点击时触发labelClick方法
- UITapGestureRecognizer *labelTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(labelClick)];
-
- // 2. 将点击事件添加到label上
- [self.lblFilterZeroAmount addGestureRecognizer:labelTapGestureRecognizer];
- self.lblFilterZeroAmount.userInteractionEnabled = YES; // 可以理解为设置label可被点击
- self.lblFilterZeroAmount.layer.borderWidth = 1;
- self.lblFilterZeroAmount.layer.borderColor = [UIColor redColor].CGColor;
- self.isFilterZeroAmount = YES;
- self.lblFilterZeroAmount.text = @"已过滤";
- self.lblFilterZeroAmount.textColor = [UIColor redColor];
-
- NSString *startDateStr = [DateFormat getCurrentDate];
-
- NSString *endDateStr = [DateFormat getCurrentDate];
-
- [_btnStartDate setTitle:startDateStr forState:UIControlStateNormal];
- _sAccountStartDate= _btnStartDate.titleLabel.text;
- [_btnEndDate setTitle:endDateStr forState:UIControlStateNormal];
- _sAccountEndDate =_btnEndDate.titleLabel.text;
-
- [self updateModel];
- }
- /**
- 零库存过滤
- */
- - (void)labelClick{
- if (self.isFilterZeroAmount) {
- self.lblFilterZeroAmount.layer.borderColor = [UIColor lightGrayColor].CGColor;
- self.isFilterZeroAmount = NO;
- self.lblFilterZeroAmount.text = @"未过滤";
- self.lblFilterZeroAmount.textColor = [UIColor lightGrayColor];
- }else{
- self.lblFilterZeroAmount.layer.borderColor = [UIColor redColor].CGColor;
- self.isFilterZeroAmount = YES;
- self.lblFilterZeroAmount.text = @"已过滤";
- self.lblFilterZeroAmount.textColor = [UIColor redColor];
- }
- [self updateModel];
- }
- - (void)customerReportTextDoneDatas:(CustomerReportTextInfoModel *)model CustomerReport:(CustomerReport)cr{
-
-
- //渠道返回值
- if(cr == ReportCumstomerChannel){
- self.sChannelId=model.idCode;
- [self.btnChannel setTitle:model.name forState:UIControlStateNormal];
- [self.btnChannel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- }
- [self updateModel];
- }
- /**
- cell
-
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
- CustomerCurrentAccountSummarySearchCell *cell = [[NSBundle mainBundle] loadNibNamed:@"CustomerCurrentAccountSummarySearchCell" owner:nil options:nil][0];
- cell.txtCustomerCode.delegate = cell;
- cell.txtCustomerName.delegate = cell;
- cell.txtTelephone.delegate = cell;
- cell.txtCustomerAddress.delegate=cell;
-
- [cell configureKeyboard];
- return cell;
- }
- /**
- 键盘配置
- */
- - (void)configureKeyboard {
- UIView *keyBoardAccessoryView = [self createKeyBoardAccessoryView];
- _txtCustomerCode.inputAccessoryView = keyBoardAccessoryView;
- _txtCustomerName.inputAccessoryView = keyBoardAccessoryView;
- _txtTelephone.inputAccessoryView = keyBoardAccessoryView;
- _txtCustomerAddress.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;
- }
- /**
- 长度
-
- @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;
- }
- /**
- * 隐藏键盘
- */
- - (void)hideKey
- {
- [self.contentView endEditing:YES];
- }
- /**
- 文本编辑结束事件
-
- @param textField <#textField description#>
- */
- - (void)textFieldDidEndEditing:(UITextField *)textField {
- [self updateModel];
- }
- /**
- 触摸事件
-
- @param touches <#touches description#>
- @param event <#event description#>
- */
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
- [self hideKey];
- [_txtCustomerCode resignFirstResponder];
- [_txtCustomerName resignFirstResponder];
- [_txtTelephone resignFirstResponder];
- [_txtCustomerAddress resignFirstResponder];
-
- }
- /**
- 取消文本
- */
- - (void)accessoryButtonBack {
- [self hideKey];}
- /**
- 确定文本
- */
- - (void)accessoryButtonDone {
- [_txtCustomerCode resignFirstResponder];
- [_txtCustomerName resignFirstResponder];
- [_txtTelephone resignFirstResponder];
- [_txtCustomerAddress resignFirstResponder];
- [self hideKey];
- }
- - (IBAction)clickDepartmentAction:(id)sender {
-
- CustomerAchievementTextVC *tc = [[CustomerAchievementTextVC alloc ]init];
- tc.cDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.flag = YES;
- tc.showDialogViewTag=ReportAchiementDepartmt;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- /**
- 业务员 业务部门
-
- @param Amodel <#Amodel description#>
- @param cr <#cr description#>
- */
- - (void)achiementData:(AchiementDepartmentInfoModel *)Amodel CustomerReport:(CustomerReport)cr{
-
- //返回值
- if(cr == ReportAchiementDepartmt){
- _organizationCode = Amodel.organizationCode;
- [self.btnDepartment setTitle:Amodel.organizationName forState:UIControlStateNormal];
- }
-
- [self updateModel];
- }
- - (IBAction)clickChannelAction:(id)sender {
- CustomerReportTextVC *tc = [[CustomerReportTextVC alloc] init];
- tc.delegate=self;
- tc.isPresentViewFlag=YES;
- tc.dataSourceCode = @"T_MST_Channel";
- tc.showDialogViewTag=ReportCumstomerChannel;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- - (IBAction)clickStartDateAction:(id)sender {
- __weak typeof(self) weakself=self;
- _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_dealDatePicker configureSelectionBlock:^(NSString *date){
- self->_tempAccountStartDate=date;
- } andCompletionBlock:^(void){
- weakself.sAccountStartDate = self->_tempAccountStartDate;
- [weakself.btnStartDate setTitle: weakself.sAccountStartDate forState:UIControlStateNormal];
- [self updateModel];
- } andCancelBlock:^(void){
-
- }];
- [_dealDatePicker show];
- }
- - (IBAction)clickEndDateAction:(id)sender {
-
- __weak typeof(self) weakself=self;
- _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_dealDatePicker configureSelectionBlock:^(NSString *date){
- self->_tempAccountEndDate=date;
- } andCompletionBlock:^(void){
- weakself.sAccountEndDate = self->_tempAccountEndDate;
- [weakself.btnEndDate setTitle:weakself.sAccountEndDate forState:UIControlStateNormal];
- [self updateModel];
- }
- andCancelBlock:^(void){
-
- }];
- [_dealDatePicker show];
- }
- -(void)updateModel
- {
- CustomerCurrentSummarySearchModel *searchModel=[CustomerCurrentSummarySearchModel new];
-
- searchModel.organizationCode=_organizationCode;
- searchModel.channelId=_sChannelId;
- searchModel.startDate=_sAccountStartDate;
- searchModel.endDate=_sAccountEndDate;
- searchModel.customerCode=[_txtCustomerCode.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- searchModel.customerName=[_txtCustomerName.text stringByReplacingOccurrencesOfString:@" " withString:@""];
-
- searchModel.customerTelephone=[_txtTelephone.text stringByReplacingOccurrencesOfString:@" " withString:@""];
-
- searchModel.customerAddress=[_txtCustomerAddress.text stringByReplacingOccurrencesOfString:@" " withString:@""];
-
- searchModel.isFilterZeroAmount=_isFilterZeroAmount;
-
- NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_regionModel.customDict];
- [mutDict setValue:searchModel forKey:CUSTOMER_CURRENT_SUMMARY_SEARCH_MODEL];
- _regionModel.customDict = [mutDict copy];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- @end
|