| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- //
- // AveragePriceMonitorSearchCellTableViewCell.m
- // IBOSS
- //
- // Created by guan hong hou on 2017/9/7.
- // Copyright © 2017年 elongtian. All rights reserved.
- //
- // 功能描述:均价监控搜索cell
- #import "AveragePriceMonitorSearchCellTableViewCell.h"
- #import "BusinessDepartmentTreeViewController.h"
- #import "GoodsKindViewController.h"
- #import "DateFormat.h"
- #import "StatusInfo.h"
- #import "StatusInfoTextVC.h"
- @implementation AveragePriceMonitorSearchCellTableViewCell
- static AveragePriceMonitorSearchCellTableViewCell *searchCell;
- #pragma 公有函数
- /**
- 加载xib
- */
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- }
- /**
- 单据类型数据源
- */
- - (void)initStatus{
- _arrayStatus = [[NSMutableArray alloc]init];
- StatusInfo* s = [[StatusInfo alloc]init];
- s = [[StatusInfo alloc]init];
- s.statusId = @"1";
- s.name = @"订单";
- [_arrayStatus addObject:s];
- s = [[StatusInfo alloc]init];
- s.statusId = @"2";
- s.name = @"销售单";
- [_arrayStatus addObject:s];
- }
- #pragma 委托函数
- /**
- 单元格高度
- @return <#return value description#>
- */
- - (CGFloat)cellHeight {
- return 280.0f;
- }
- /**
- 加载tableviewcell
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
- AveragePriceMonitorSearchCellTableViewCell *cell = [[NSBundle mainBundle] loadNibNamed:@"AveragePriceMonitorSearchCellTableViewCell" owner:nil options:nil][0];
- searchCell = cell;
- return cell;
- }
- /**
- 初始化cell数据
- @param model <#model description#>
- @param indexPath <#indexPath description#>
- */
- - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model
- indexPath:(NSIndexPath *)indexPath {
- _slideModel = *model;
- _searchModel=[[AveragePriceMonitorSearchModel alloc]init];
- NSString *startDateStr= [DateFormat getDateBefore:31];
- NSString *endDataStr = [DateFormat getCurrentDate];
- [_btnStartDate setTitle:startDateStr forState:UIControlStateNormal];
- _startDate= _btnStartDate.titleLabel.text;
- [_btnEndDate setTitle:endDataStr forState:UIControlStateNormal];
- _endDate= _btnEndDate.titleLabel.text;
- _searchModel.startDate=_startDate;
- _searchModel.endDate=_endDate;
- UITapGestureRecognizer *labelTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(labelClick)];
- UITapGestureRecognizer *toSalesTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toSalesClick)];
-
- [self.lblIncludeGift addGestureRecognizer:labelTapGestureRecognizer];
- self.isIncludeGift =@"0";
- self.lblIncludeGift.text = @"不包含";
- self.lblIncludeGift.userInteractionEnabled = YES;
- self.lblIncludeGift.layer.borderColor = [UIColor lightGrayColor].CGColor;
- self.lblIncludeGift.layer.borderWidth =1;
- _searchModel.invoiceType=@"1";
- [self.lblOrderToSales addGestureRecognizer:toSalesTapGestureRecognizer];
- self.isIncludeOrderToSales =@"0";
- self.lblOrderToSales.text = @"不包含";
- self.lblOrderToSales.userInteractionEnabled = YES;
- self.lblOrderToSales.layer.borderColor = [UIColor lightGrayColor].CGColor;
- self.lblOrderToSales.layer.borderWidth =1;
- _searchModel.isIncludeOrderToSales=@"0";
- [self.btnInvoiceType setTitle:@"订单" forState:UIControlStateNormal];
- _searchModel.giftFlag=_isIncludeGift;
- _mutDict = [NSMutableDictionary dictionaryWithDictionary:_slideModel.customDict];
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
- _slideModel.customDict = _mutDict;
-
- }
- /**
- 重置按钮 事件
- */
- - (void)resetData {
-
- [_btnBusinessDepartment setTitle:@"请选择业务部门" forState:UIControlStateNormal];
- _searchModel.businessDepartmentCode=@"";
- [_btnGoodsType setTitle:@"请选择商品种类" forState:UIControlStateNormal];
- _searchModel.goodsType=@"";
- NSString *startDateStr= [DateFormat getDateBefore:31];
- NSString *endDataStr = [DateFormat getCurrentDate];
- [_btnStartDate setTitle:startDateStr forState:UIControlStateNormal];
- _startDate= _btnStartDate.titleLabel.text;
- [_btnEndDate setTitle:endDataStr forState:UIControlStateNormal];
- self.isIncludeGift =@"0";
- self.lblIncludeGift.text = @"不包含";
- self.lblIncludeGift.layer.borderColor = [UIColor lightGrayColor].CGColor;
- self.lblIncludeGift.layer.borderWidth =1;
- _searchModel.giftFlag=_isIncludeGift;
- _searchModel.invoiceType=@"1";
- [self.btnInvoiceType setTitle:@"订单" forState:UIControlStateNormal];
- self.isIncludeOrderToSales =@"0";
- self.lblOrderToSales.text = @"不包含";
- self.lblOrderToSales.userInteractionEnabled =YES;
- self.lblOrderToSales.layer.borderColor = [UIColor lightGrayColor].CGColor;
- self.lblOrderToSales.layer.borderWidth =1;
- _searchModel.isIncludeOrderToSales=@"0";
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
- _slideModel.customDict = _mutDict;
- }
- /**
- 返回tableviewcell标识
- @return <#return value description#>
- */
- + (NSString *)cellReuseIdentifier {
- return @"SearchTableViewCell";
- }
- /**
- 业务部门回调函数
- @param code <#code description#>
- @param name <#name description#>
- */
- -(void)achievementDataTreeResult:(NSString *)code name:(NSString*)name{
- [self.btnBusinessDepartment setTitle:name forState:UIControlStateNormal];
- _searchModel.businessDepartmentCode=code;
- _mutDict = [NSMutableDictionary dictionaryWithDictionary:_slideModel.customDict];
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
- _slideModel.customDict = _mutDict;
-
- }
- /**
- 产品种类回调函数
- @param id <#id description#>
- @param name <#name description#>
- */
- -(void)kindDataTreeResult:(NSString *)id name:(NSString*)name{
- [self.btnGoodsType setTitle:name forState:UIControlStateNormal];
- _searchModel.goodsType=id;
- _mutDict = [NSMutableDictionary dictionaryWithDictionary:_slideModel.customDict];
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
- _slideModel.customDict = _mutDict;
- }
- /**
- 单据类型回调
- @param s <#s description#>
- */
- - (void)showStatusValue:(StatusInfo *)s{
- NSString *statusId=s.statusId;
- [_btnInvoiceType setTitle:s.name forState:UIControlStateNormal];
- [_searchModel setInvoiceType:statusId];
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
- _slideModel.customDict =_mutDict;
- }
- #pragma 私有函数
- /**
- 是否包含赠品点击事件
- */
- -(void)labelClick{
- if ( [self.isIncludeGift isEqualToString:@"1"]) {
- self.lblIncludeGift.layer.borderColor = [UIColor lightGrayColor].CGColor;
- self.isIncludeGift =@"0";
- self.lblIncludeGift.text = @"不包含";
- self.lblIncludeGift.textColor = [UIColor lightGrayColor];
- }else{
- self.lblIncludeGift.layer.borderColor = [UIColor redColor].CGColor;
- self.isIncludeGift = @"1";
- self.lblIncludeGift.text = @"包含";
- self.lblIncludeGift.textColor = [UIColor redColor];
- }
-
- _searchModel.giftFlag=_isIncludeGift;
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
- _slideModel.customDict = _mutDict;
- }
- /**
- 是否包含转单的销售单点击事件
- */
- -(void)toSalesClick{
- if([_searchModel.invoiceType isEqualToString:@"2"]){
- if ( [self.isIncludeOrderToSales isEqualToString:@"1"]) {
- self.lblOrderToSales.layer.borderColor = [UIColor lightGrayColor].CGColor;
- self.isIncludeOrderToSales =@"0";
- self.lblOrderToSales.text = @"不包含";
- self.lblOrderToSales.textColor = [UIColor lightGrayColor];
- }else{
- self.lblOrderToSales.layer.borderColor = [UIColor redColor].CGColor;
- self.isIncludeOrderToSales = @"1";
- self.lblOrderToSales.text = @"包含";
- self.lblOrderToSales.textColor = [UIColor redColor];
- }
-
- _searchModel.isIncludeOrderToSales=_isIncludeOrderToSales;
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
- _slideModel.customDict = _mutDict;
- }
-
- }
- /**
- 业务部门点击事件
- @param sender <#sender description#>
- */
- - (IBAction)businessDepartmentAction:(id)sender {
- BusinessDepartmentTreeViewController*tc = [[ BusinessDepartmentTreeViewController alloc] init];
- tc.isPresentViewFlag=YES;
- tc.cDelegate=self;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
-
- }
- /**
- 产品种类点击事件
- @param sender <#sender description#>
- */
- - (IBAction)goodsTypeAction:(id)sender {
- GoodsKindViewController *gc= [[ GoodsKindViewController alloc] init];
- gc.isPresentViewFlag=YES;
- gc.cDelegate=self;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:gc animated:YES];
- }
- }
- /**
- 开始日期点击事件
- @param sender <#sender description#>
- */
- - (IBAction)startDateAction:(id)sender {
- _brDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [ _brDatePicker configureSelectionBlock:^(NSString *date){
- _startDate=date;
-
- } andCompletionBlock:^(void){
- [_searchModel setStartDate:_startDate];
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
-
- _slideModel.customDict =_mutDict;
- [_btnStartDate setTitle:_startDate forState:UIControlStateNormal];
- } andCancelBlock:^(void){
- _startDate=_btnStartDate.titleLabel.text;
-
- }];
- [_brDatePicker show];
- }
- /**
- 结束日期点击事件
- @param sender <#sender description#>
- */
- - (IBAction)endDateAction:(id)sender {
- _brDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_brDatePicker configureSelectionBlock:^(NSString *date){
- _endDate=date;
-
- } andCompletionBlock:^(void){
- [_searchModel setEndDate:_endDate];
- [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
- _slideModel.customDict = _mutDict;
- [_btnEndDate setTitle:_endDate forState:UIControlStateNormal];
- } andCancelBlock:^(void){
- _endDate=_btnEndDate.titleLabel.text;
-
- }];
- [_brDatePicker show];
- }
- /**
- 单据类型点击事件
- @param sender <#sender description#>
- */
- - (IBAction)invoiceTypeAction:(id)sender {
- [self initStatus];
- StatusInfoTextVC *tc = [[StatusInfoTextVC alloc] init];
- tc.sdelegate=self;
- tc.isPresentViewFlag=YES;
- [tc.arrFilter addObjectsFromArray: _arrayStatus];
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
-
- }
- @end
|