TransportPurductCell.m 7.84 KB
Newer Older
陈俊俊's avatar
陈俊俊 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
//
//  TransportPurductCell.m
//  XFFruit
//
//  Created by 陈俊俊 on 15/9/6.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "TransportPurductCell.h"
#define LeftMargin 13
#define TableHeight 44
#define SmallSize 10
#define SmallWidth 20
#define SpaceMargin 1
#define LeftWidth 45
#define RightWidth 30

#define ShowWidth 150
#define ShowHeight 20

@implementation TransportPurductCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier withImageName:(NSString *)imageName{
    
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.rightImageName = imageName;
        [self bulidLayout];
    }
    return self;
}

- (void)bulidLayout
{
    CGFloat headWidth = (ScreenSize.width - LeftWidth*2 - SpaceMargin* (3 -1))/3;
    
    self.smallImageView = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)];
    self.smallImageView.image = [UIImage imageNamed:@"arrowright"];
    self.smallImageView.contentMode = UIViewContentModeScaleAspectFit;
    
    self.seqLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.smallImageView.frame), 0, SmallWidth, TableHeight))];
    self.seqLabel.textColor = GXF_CONTENT_COLOR;
    self.seqLabel.text = @"13";
    self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
    
    self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
陈俊俊's avatar
陈俊俊 committed
49
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
陈俊俊's avatar
陈俊俊 committed
50 51 52 53 54
    self.titleLabel.textColor = GXF_CONTENT_COLOR;
    self.titleLabel.text = @"苹果桃子";
    self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
    
    self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
陈俊俊's avatar
陈俊俊 committed
55
    self.priceLabel.textAlignment = NSTextAlignmentCenter;
陈俊俊's avatar
陈俊俊 committed
56 57 58 59 60
    self.priceLabel.textColor = GXF_CONTENT_COLOR;
    self.priceLabel.text = @"80";
    self.priceLabel.font = GXF_SIXTEENTEH_SIZE;
    
    self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
陈俊俊's avatar
陈俊俊 committed
61
    self.countLabel.textAlignment = NSTextAlignmentCenter;
陈俊俊's avatar
陈俊俊 committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
    self.countLabel.text = @"200";
    self.countLabel.textColor = GXF_CONTENT_COLOR;
    self.countLabel.font = GXF_SIXTEENTEH_SIZE;
    
    
    self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
    self.showView.clipsToBounds = YES;
    
    self.showStandLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.seqLabel.frame), 0, ShowWidth, ShowHeight))];
    self.showStandLabel.textAlignment = NSTextAlignmentLeft;
    self.showStandLabel.textColor = GXF_PLACEHOLDER_COLOR;
    self.showStandLabel.text = @"包装规格:1*12斤";
    self.showStandLabel.font = GXF_THREETEENTH_SIZE;
    
    self.showCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.showStandLabel.frame), 0, ShowWidth, ShowHeight))];
    self.showCountLabel.textAlignment = NSTextAlignmentLeft;
    self.showCountLabel.textColor = GXF_PLACEHOLDER_COLOR;
    self.showCountLabel.text = @"包装数量:10000";
    self.showCountLabel.font = GXF_THREETEENTH_SIZE;
    
    self.showBaseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showStandLabel.frame), ShowWidth, ShowHeight))];
    self.showBaseCountLabel.textAlignment = NSTextAlignmentLeft;
    self.showBaseCountLabel.textColor = GXF_PLACEHOLDER_COLOR;
    self.showBaseCountLabel.text = @"基础数量:300";
    self.showBaseCountLabel.font = GXF_THREETEENTH_SIZE;
    
    self.showPriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showCountLabel.frame), CGRectGetMaxY(self.showStandLabel.frame), ShowWidth, ShowHeight))];
    self.showPriceLabel.textAlignment = NSTextAlignmentLeft;
    self.showPriceLabel.textColor = GXF_PLACEHOLDER_COLOR;
    self.showPriceLabel.text = @"包装单价:11元";
    self.showPriceLabel.font = GXF_THREETEENTH_SIZE;
    
    
    
    self.showTotalLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showBaseCountLabel.frame), ShowWidth, ShowHeight))];
    self.showTotalLabel.textAlignment = NSTextAlignmentLeft;
    self.showTotalLabel.textColor = GXF_PLACEHOLDER_COLOR;
    self.showTotalLabel.text = @"总金额:100";
    self.showTotalLabel.font = GXF_THREETEENTH_SIZE;
    
    self.showNoteLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showCountLabel.frame), CGRectGetMaxY(self.showBaseCountLabel.frame), ShowWidth, ShowHeight))];
    self.showNoteLabel.textAlignment = NSTextAlignmentLeft;
    self.showNoteLabel.textColor = GXF_PLACEHOLDER_COLOR;
    self.showNoteLabel.text = @"备注:1000";
    self.showNoteLabel.font = GXF_THREETEENTH_SIZE;
    
    self.showPurchaseLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showTotalLabel.frame), ShowWidth+ 100, ShowHeight))];
    self.showPurchaseLabel.textAlignment = NSTextAlignmentLeft;
    self.showPurchaseLabel.textColor = GXF_PLACEHOLDER_COLOR;
    self.showPurchaseLabel.text = @"采购单号:1000";
    self.showPurchaseLabel.font = GXF_THREETEENTH_SIZE;
    
    
    self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.editBtn setImage:[UIImage imageNamed:self.rightImageName] forState:UIControlStateNormal];
    self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth , TableHeight);
    self.editBtn.contentMode = UIViewContentModeScaleAspectFit;
    
    self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width  - LeftMargin * 2, 1))];;
    self.lineLabel.backgroundColor = GXF_LINE_COLOR;
    
    [self.contentView addSubview:self.smallImageView];
    [self.contentView addSubview:self.seqLabel];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.priceLabel];
    [self.contentView addSubview:self.countLabel];
    [self.contentView addSubview:self.editBtn];
    [self.contentView addSubview:self.showView];
    
    [self.showView addSubview:self.showStandLabel];
    [self.showView addSubview:self.showCountLabel];
    [self.showView addSubview:self.showBaseCountLabel];
    [self.showView addSubview:self.showPriceLabel];
    [self.showView addSubview:self.showPurchaseLabel];
    [self.showView addSubview:self.showTotalLabel];
    
    [self.showView addSubview:self.showNoteLabel];
    [self.contentView addSubview:self.lineLabel];
    
}

- (void)setPdtDetail:(TransportPdtDetail *)pdtDetail row:(NSInteger)row{
    self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
    self.titleLabel.text = pdtDetail.productName;
陈俊俊's avatar
陈俊俊 committed
146 147
    self.priceLabel.text =  [NSString stringWithFormat:@"%@元",[pdtDetail.price stringValue]];
    self.countLabel.text = [NSString stringWithFormat:@"%@%@",pdtDetail.qty,pdtDetail.unit];
陈俊俊's avatar
陈俊俊 committed
148
    self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@",pdtDetail.qpc];
陈俊俊's avatar
陈俊俊 committed
149 150
    self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",pdtDetail.qty,pdtDetail.unit];
    self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",pdtDetail.baseQty,@"斤"];
陈俊俊's avatar
陈俊俊 committed
151
    self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",pdtDetail.price];
陈俊俊's avatar
陈俊俊 committed
152
    self.showPurchaseLabel.text = [NSString stringWithFormat:@"采购单号:%@",pdtDetail.purchasebillnumber.length > 0 ? pdtDetail.purchasebillnumber: @"无"];
陈俊俊's avatar
陈俊俊 committed
153
    self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",pdtDetail.total];
陈俊俊's avatar
陈俊俊 committed
154 155 156 157 158 159 160 161 162 163 164

    self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",pdtDetail.note];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end