| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- //
- // 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
|