// // HistoryOrderTableViewCell.m // IBOSSmini // // Created by guan hong hou on 2017/5/24. // Copyright © 2017年 elongtian. All rights reserved. // #import "HistoryOrderTableViewCell.h" #define orderTextFont [UIFont systemFontOfSize:14] @implementation HistoryOrderTableViewCell #pragma mark - 公共函数 /** 加载自定义cell函数 */ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { } return self; } #pragma mark - 私有函数 /** 初始化cell UI和数据 */ -(void)parseCartInfo:(HistoryOrderFrame *)orderFrame{ _orderModel= orderFrame.orderItemModel; _lblOrderNo=[[UILabel alloc]init]; _lblOrderNo.frame=orderFrame.lblOrderNoF; _lblOrderNo.font=orderTextFont; _lblOrderNo.text=_orderModel.orderNo; [self.contentView addSubview:_lblOrderNo]; _btnDelete=[UIButton buttonWithType:UIButtonTypeCustom]; _btnDelete.frame=orderFrame.btnDeleteOrderF; [self.contentView addSubview:_btnDelete]; [_btnDelete addTarget:self action:@selector(deleteOrder) forControlEvents:UIControlEventTouchUpInside]; UIImageView *deleteImg=[[UIImageView alloc]init]; deleteImg.frame=CGRectMake(0,4,15,15); [deleteImg setImage:[UIImage imageNamed:@"icon_delete"]]; deleteImg.userInteractionEnabled=NO; [_btnDelete addSubview:deleteImg]; UILabel *deleteTitle=[[UILabel alloc]init]; deleteTitle.frame=CGRectMake(CGRectGetMaxX(deleteImg.frame)+3,0,40, 25); deleteTitle.text=@"删除"; deleteTitle.font=orderTextFont; [_btnDelete addSubview:deleteTitle]; UIView *topSeparator=[[UIView alloc]init]; topSeparator.frame=[orderFrame topSeparatorF]; topSeparator.backgroundColor=LineBackgroundColor; [self.contentView addSubview:topSeparator]; UILabel *lblTitleCustomerName=[[UILabel alloc]init]; NSString *titleCustomerName=@"客户名称:"; lblTitleCustomerName.frame=orderFrame.lblTitleCustomerNameF; lblTitleCustomerName.font=orderTextFont; lblTitleCustomerName.textColor=LabelGrayTextColor; lblTitleCustomerName.text=titleCustomerName; [self.contentView addSubview:lblTitleCustomerName]; NSString *customerName=_orderModel.customerName; if(customerName!=nil){ _lblCustomerName=[[UILabel alloc]init]; _lblCustomerName.frame=orderFrame.lblCustomerNameF; _lblCustomerName.font=orderTextFont; _lblCustomerName.text=customerName; [self.contentView addSubview:_lblCustomerName]; } UILabel *lblTitleCreateDate=[[UILabel alloc]init]; NSString *titleCreateDate=@"创建日期:"; lblTitleCreateDate.frame=orderFrame.lblTitleCreateDateF; lblTitleCreateDate.font=orderTextFont; lblTitleCreateDate.textColor=LabelGrayTextColor; lblTitleCreateDate.text=titleCreateDate; [self.contentView addSubview:lblTitleCreateDate]; NSString *createDate=_orderModel.createDate; if(createDate!=nil){ _lblCreateDate=[[UILabel alloc]init]; _lblCreateDate.frame=orderFrame.lblCreateDateF; _lblCreateDate.font=orderTextFont; _lblCreateDate.text=createDate; [self.contentView addSubview:_lblCreateDate]; } UILabel *lblTitleMarkedPriceAmount=[[UILabel alloc]init]; NSString *titleMarkedPriceAmount=@"标价总额:"; lblTitleMarkedPriceAmount.frame=orderFrame.lblTitleMarkedPriceAmountF; lblTitleMarkedPriceAmount.font=orderTextFont; lblTitleMarkedPriceAmount.textColor=LabelGrayTextColor; lblTitleMarkedPriceAmount.text=titleMarkedPriceAmount; [self.contentView addSubview:lblTitleMarkedPriceAmount]; NSString *markedPriceAmount=_orderModel.markedPriceAmount; if(markedPriceAmount!=nil){ _lblMarkedPriceAmount=[[UILabel alloc]init]; _lblMarkedPriceAmount.frame=orderFrame.lblMarkedPriceAmountF; _lblMarkedPriceAmount.font=orderTextFont; _lblMarkedPriceAmount.text=markedPriceAmount; [self.contentView addSubview:_lblMarkedPriceAmount]; } UILabel *lblTitleGoodsAmount=[[UILabel alloc]init]; NSString *titleGoodsAmount=@"货物总额:"; lblTitleGoodsAmount.frame=orderFrame.lblTitleGoodsAmountF; lblTitleGoodsAmount.font=orderTextFont; lblTitleGoodsAmount.textColor=LabelGrayTextColor; lblTitleGoodsAmount.text=titleGoodsAmount; [self.contentView addSubview:lblTitleGoodsAmount]; NSString *goodsAmount=_orderModel.goodsAmount; if(goodsAmount!=nil){ _lblGoodsAmount=[[UILabel alloc]init]; _lblGoodsAmount.frame=orderFrame.lblGoodsAmountF; _lblGoodsAmount.font=orderTextFont; _lblGoodsAmount.text=goodsAmount; [self.contentView addSubview: _lblGoodsAmount]; } UILabel *lblTitleSalesMan=[[UILabel alloc]init]; NSString *titleSalesMan=@"业务员:"; lblTitleSalesMan.frame=orderFrame.lblTitleSalesManF; lblTitleSalesMan.font=orderTextFont; lblTitleSalesMan.textColor=LabelGrayTextColor; lblTitleSalesMan.text=titleSalesMan; [self.contentView addSubview:lblTitleSalesMan]; NSString *staffName=_orderModel.staffName; if(staffName!=nil){ _lblSalesMan=[[UILabel alloc]init]; _lblSalesMan.frame=orderFrame.lblSalesManF; _lblSalesMan.font=orderTextFont; _lblSalesMan.text=staffName; [self.contentView addSubview: _lblSalesMan]; } UILabel *lblTitleChannel=[[UILabel alloc]init]; NSString *titleChannel=@"渠道:"; lblTitleChannel.frame=orderFrame.lblTitleChannelF; lblTitleChannel.font=orderTextFont; lblTitleChannel.textColor=LabelGrayTextColor; lblTitleChannel.text=titleChannel; [self.contentView addSubview:lblTitleChannel]; NSString *channelName=_orderModel.channelName; if(channelName!=nil){ _lblChannel=[[UILabel alloc]init]; _lblChannel.frame=orderFrame.lblChannelF; _lblChannel.font=orderTextFont; _lblChannel.text=channelName; [self.contentView addSubview: _lblChannel]; } UILabel *lblTitleDepartment=[[UILabel alloc]init]; NSString *titleDepartment=@"业务部门:"; lblTitleDepartment.frame=orderFrame.lblTitleDepartmentF; lblTitleDepartment.font=orderTextFont; lblTitleDepartment.textColor=LabelGrayTextColor; lblTitleDepartment.text=titleDepartment; [self.contentView addSubview:lblTitleDepartment]; NSString *departmentName=_orderModel.organizationName; if(departmentName!=nil){ _lblDepartment=[[UILabel alloc]init]; _lblDepartment.frame=orderFrame.lblDepartmentF; _lblDepartment.font=orderTextFont; _lblDepartment.text=departmentName; [self.contentView addSubview:_lblDepartment]; } UILabel *lblTitleAddress=[[UILabel alloc]init]; NSString *titleAddress=@"客户地址:"; lblTitleAddress.frame=orderFrame.lblTitleAddressF; lblTitleAddress.font=orderTextFont; lblTitleAddress.textColor=LabelGrayTextColor; lblTitleAddress.text=titleAddress; [self.contentView addSubview:lblTitleAddress]; NSString *address=_orderModel.address; if(address!=nil){ _lblAddress=[[UILabel alloc]init]; _lblAddress.frame=orderFrame.lblAddressF; _lblAddress.font=orderTextFont; _lblAddress.text=address; [self.contentView addSubview:_lblAddress]; } UIView *bottomSeparator=[[UIView alloc]init]; bottomSeparator.frame=[orderFrame bottomSeparatorF]; bottomSeparator.backgroundColor=LineBackgroundColor; [self.contentView addSubview:bottomSeparator]; } //删除订单函数 -(void)deleteOrder{ if([self.delegate respondsToSelector:@selector(deleteHistoryOrderItem:)]) { [self.delegate deleteHistoryOrderItem:_orderModel]; } } @end