Commit 6f8b9b12 authored by Sandy's avatar Sandy

销售录入上传图片

parent 40d85842
This diff is collapsed.
...@@ -20,5 +20,6 @@ ...@@ -20,5 +20,6 @@
@returns color from rgbValue @returns color from rgbValue
*/ */
+ (UIColor *)colorFromHex:(int32_t)rgbValue; + (UIColor *)colorFromHex:(int32_t)rgbValue;
+ (UIColor *)colorWithHexString: (NSString *)color;
@end @end
...@@ -24,4 +24,47 @@ ...@@ -24,4 +24,47 @@
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]; blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0];
} }
+ (UIColor *)colorWithHexString: (NSString *)color
{
NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 characters
if ([cString length] < 6) {
return [UIColor clearColor];
}
// strip 0X if it appears
if ([cString hasPrefix:@"0X"])
cString = [cString substringFromIndex:2];
if ([cString hasPrefix:@"#"])
cString = [cString substringFromIndex:1];
if ([cString length] != 6)
return [UIColor clearColor];
// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
//r
NSString *rString = [cString substringWithRange:range];
//g
range.location = 2;
NSString *gString = [cString substringWithRange:range];
//b
range.location = 4;
NSString *bString = [cString substringWithRange:range];
// Scan values
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
//NSLog(@"%d,%d,%d",r,g,b);
return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:1.0f];
}
@end @end
...@@ -761,5 +761,39 @@ acceptTypeJson:YES ...@@ -761,5 +761,39 @@ acceptTypeJson:YES
} }
#pragma mark - 报表首页,数据罗盘
- (void)queryHomepageWith:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!data) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSDictionary *dict = data;
NSString *urlStr = [[self class] UrlForPluginHTTPAction:@"salesdata/query"];
[self POST:urlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
@end @end
...@@ -32,4 +32,30 @@ ...@@ -32,4 +32,30 @@
+ (IBTFileData *)saveImageToLocal:(UIImage *)imageToSave; + (IBTFileData *)saveImageToLocal:(UIImage *)imageToSave;
+ (NSDate *)convertToDateFrom:(NSString *)dateString;
+ (NSString *)stringFromDate:(NSDate*)aDate;
+ (NSString *)stringFromDateWithFormat:(NSDate*)aDate format:(NSString *)format;
+ (NSDate *)dateFromStringWithFormat:(NSString*)aStr format:(NSString *)format;
+ (NSString*)dictionaryToJson:(id)dic;
+ (NSString *)checkString:(NSString *)str;
+ (NSString *)checkNull: (id)data;
+ (BOOL)checkStringIsNilOrSpance: (NSString *)str;
+ (NSMutableAttributedString *)setTextViewFontOfString:(NSString *)string paragraphStyle:(NSInteger)lineHeight fontSize:(float)size color:(UIColor *)color;
+ (NSMutableAttributedString *)setTextViewBoldFontOfString:(NSString *)string paragraphStyle:(NSInteger)lineHeight fontSize:(float)size color:(UIColor *)color;
+ (NSString *)trimmingCharacters:(NSString *)str;
+ (int)compareDate:(NSString*)oneDate withDate:(NSString*)twoDate;
+(UILabel *)labelWithTitle:(NSString *)title frame:(CGRect)frame textFont:(UIFont *)titleFont;
+ (UIButton *)buttonWithTitle:(NSString *)title Image:(UIImage *)image frame:(CGRect)frame fontSize:(float)fontSize fontColor:(UIColor *)color;
+ (UIButton *)buttonWithImage:(UIImage *)image frame:(CGRect)frame;
+ (NSString *)getWeekFromDate;
+ (NSString *)getWeekFromDateWithDate: (NSDate *)date;
+ (NSInteger)getWeeks:(NSInteger)year;
+ (NSString*)weekdayStringFromDate:(NSDate*)inputDate;
+(NSString *)countNumAndChangeformat:(NSString *)num;
+ (NSString *)getWeekFromDateStr:(NSString *)dataStr;
+(NSString *)stringDisposeWithFloat:(float)floatValue;
@end @end
This diff is collapsed.
...@@ -23,5 +23,15 @@ ...@@ -23,5 +23,15 @@
color:(UIColor *)color color:(UIColor *)color
target:(id)target target:(id)target
action:(SEL)selector; action:(SEL)selector;
+ (UIButton *)creatButtonWithFrame:(CGRect)frame target:(id)target sel:(SEL)sel tag:(NSInteger)tag image:(NSString *)name title:(NSString *)title titleColor:(UIColor *)titleCorlor isCorner:(BOOL)isCornor corner:(CGFloat)corner bgColor:(UIColor *)bgcolor;
#pragma mark - border
- (void)addTopBorderWithHeight:(CGFloat)height color:(UIColor *)color;
- (void)addBottomBorderWithHeight:(CGFloat)height color:(UIColor *)color;
- (void)addLeftBorderWithWidth:(CGFloat)width color:(UIColor *)color;
- (void)addRightBorderWithWidth:(CGFloat)width color:(UIColor *)color;
@end @end
...@@ -65,4 +65,65 @@ ...@@ -65,4 +65,65 @@
return button; return button;
} }
+ (UIButton *)creatButtonWithFrame:(CGRect)frame target:(id)target sel:(SEL)sel tag:(NSInteger)tag image:(NSString *)name title:(NSString *)title titleColor:(UIColor *)titleCorlor isCorner:(BOOL)isCornor corner:(CGFloat)corner bgColor:(UIColor *)bgcolor{
UIButton *button = nil;
button = [UIButton buttonWithType:UIButtonTypeCustom];
if (name) {//创建图片按钮
[button setImage:[UIImage imageNamed:name] forState:UIControlStateNormal];
if (title) {
//创建 图片 和 标题按钮
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:titleCorlor forState:UIControlStateNormal];
}
}else if(title){//创建标题按钮
[button setBackgroundColor:bgcolor];
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:titleCorlor forState:UIControlStateNormal];
}
button.frame = frame;
button.tag = tag;
if (isCornor) {
button.layer.cornerRadius = corner;
button.layer.masksToBounds = YES;
}
[button addTarget:target action:sel forControlEvents:UIControlEventTouchUpInside];
return button;
}
#pragma mark - border
- (void)addTopBorderWithHeight:(CGFloat)height color:(UIColor *)color
{
CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(0, 0, self.frame.size.width, height);
layer.backgroundColor = color.CGColor;
[self.layer addSublayer:layer];
}
- (void)addBottomBorderWithHeight:(CGFloat)height color:(UIColor *)color
{
CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(0, self.frame.size.height - height, self.frame.size.width, height);
layer.backgroundColor = color.CGColor;
[self.layer addSublayer:layer];
}
- (void)addLeftBorderWithWidth:(CGFloat)width color:(UIColor *)color
{
CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(0, 0, width, self.frame.size.height);
layer.backgroundColor = color.CGColor;
[self.layer addSublayer:layer];
}
- (void)addRightBorderWithWidth:(CGFloat)width color:(UIColor *)color
{
CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(self.frame.size.width - width, 0, width, self.frame.size.height);
layer.backgroundColor = color.CGColor;
[self.layer addSublayer:layer];
}
@end @end
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sale_1@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "sale_1@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "salebg_1@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "salebg_1@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
//
// XFFruiteHeaders.h
// vanke
//
// Created by Z on 16/7/12.
// Copyright © 2016年 gomore. All rights reserved.
//
#ifndef OtherHeaders_h
#define OtherHeaders_h
#import "IBTCommon.h"
#import "UIColor+Helper.h"
#import "IBTCustomButtom.h"
#import "VankeCommonModel.h"
#import "ICRHTTPController.h"
#define KNOTIFICATION_GetNextDetailData @"KNOTIFICATION_GetNextDetailData"
#define KNOTIFICATION_GoReportDetail @"KNOTIFICATION_GoReportDetail"
#define HexColor(colorStr) [UIColor colorWithHexString:colorStr]
#define GXF_NAVIGAYION_COLOR HexColor(@"7ebf74")
#define GXF_SAVE_COLOR HexColor(@"50bd62")
#define GXF_COMMIT_COLOR HexColor(@"f69100")
#define GXF_PLACEHOLDER_COLOR HexColor(@"bbbbbb")
#define GXF_CONTENT_COLOR HexColor(@"444444")
#define GXF_CELL_COLOR HexColor(@"aaaaaa")
#define GXF_LINE_COLOR HexColor(@"e5e5e5")
#define GXF_DETAIL_COLOR HexColor(@"888888")
#define GXF_LEFTSIX_COLOR HexColor(@"666666")
//报表统一颜色
#define ReportColor GXF_NAVIGAYION_COLOR
#define ReportContentColor HexColor(@"f4422e")
#define ReportTitleColor GXF_PLACEHOLDER_COLOR
#define ReportBgColor RGBA(219,219,219,1)
#define ReportTwoColor HexColor(@"A3A3A3")
#define ReportChainSignPlus @"plus"
#define ReportChainSignMinus @"minus"
#define ReportChainPlusImage @"goSale"
#define ReportChainMinusImage @"downSale"
//销售
#define SaleDay @"日"
#define SaleWeek @"周"
#define SaleMonth @"月"
#define SaleEnDay @"day"
#define SaleEnWeek @"week"
#define SaleEnMonth @"month"
#define OrderLastWeak @"比上周同期"
#define OrderLastMonth @"比上月同期"
#define LastWeak @"比上周"
#define LastMonth @"比上月"
#define AvgLabelDay @"单店日均"
#define AvgLabelWeek @"单店周均"
#define AvgLabelMonth @"单店月均"
#define FontSize(num) [UIFont systemFontOfSize:num]
#define AppWindow [[UIApplication sharedApplication].delegate window]
#define GXF_ELEVTEEN_SIZE FontSize(11)
#define GXF_TWELVETEEN_SIZE FontSize(12)
#define GXF_THREETEENTH_SIZE FontSize(13)
#define GXF_FOURTEENTH_SIZE FontSize(14)
#define GXF_FIFTEENTEN_SIZE FontSize(15)
#define GXF_SIXTEENTEH_SIZE FontSize(16)
#define GXF_SEVENTEENTH_SIZE FontSize(17)
/*
* Clog
*/
#ifdef DEBUG
#define CLog(format, ...) NSLog((@"[Line %d] %s " format), __LINE__, __PRETTY_FUNCTION__, ## __VA_ARGS__)
#else
#define CLog(format, ...)
#endif
#endif /* OtherHeaders_h */
...@@ -84,7 +84,7 @@ extern NSString *const USER_POSITION_TENANT; // 用户职位: 商户用户 ...@@ -84,7 +84,7 @@ extern NSString *const USER_POSITION_TENANT; // 用户职位: 商户用户
//@property (nonatomic, strong) User *user; //@property (nonatomic, strong) User *user;
//// 所属企业 //// 所属企业
//@property (nonatomic, strong) Enterpirse *enterprise; //@property (nonatomic, strong) Enterpirse *enterprise;
@property (nonatomic, strong) NSString *org_uuid;
// 用户标识 // 用户标识
@property (nonatomic, strong) NSString *user_uuid; @property (nonatomic, strong) NSString *user_uuid;
// 用户代码 // 用户代码
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
// //
#ifdef __OBJC__ #ifdef __OBJC__
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "Bee.h" #import "Bee.h"
#import "OtherHeaders.h"
#endif #endif
\ No newline at end of file
//
// Compass.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/18.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface Compass : IBTModel
@property (nonatomic,strong)NSString *dataScopeType;
// 统计时间类型 否 String 100 day(日),week(周),month(月)
@property (nonatomic,strong)NSString *dataScope;
// 统计时间 否 String 100 日:2015-10-10周:37,表示今年第几周月:2015-10
@property (nonatomic,strong)NSString *orgUuid;
//组织标识 否 String
@property (nonatomic,strong)NSString *orgCode;
//组织代码 否 String
@property (nonatomic,strong)NSString *orgName;
//组织名称 否 Integer
@property (nonatomic,assign)NSInteger level;
//等级 否 String
@property (nonatomic,strong)NSString *upperUuid;
//上级组织uuid 否 String
@property (nonatomic,strong)NSNumber *sales;
// 销售额 是 String 100
@property (nonatomic,strong)NSString *salesChainSign;
// 销售环比增减标志 是 String 30 枚举值为:plus(增),minus(减)
@property (nonatomic,strong)NSNumber *salesChainRate;
//销售环比变化率 是 Double  30,表示30%
@property (nonatomic,strong)NSString *salesYoYSign;
//销售同比增减标志 是 String 30 枚举值为:plus(增),minus(减)
@property (nonatomic,strong)NSNumber *salesYoYRate;
//销售同比变化率 是 Double
@property (nonatomic,strong)NSNumber *salesTargetRate;
//销售目标达成率 是 Double
@property (nonatomic,strong)NSNumber *dailysalesPerStore;
//单店日均销售 是 String 100
@property (nonatomic,strong)NSString *passengerdate;
//客流统计时间 是 String 100
@property (nonatomic,strong)NSNumber *passenger;
// 客流数 是 String 100
@property (nonatomic,strong)NSString *passengerChainSign;
// 客流数环比增减标志 是 String 30 枚举值为:plus(增),minus(减)
@property (nonatomic,strong)NSNumber *passengerChainRate;
//客流数环比变化率 是 Double
@property (nonatomic,strong)NSString *passengerYoYSign;
//客流数同比增减标志 是 String 30 枚举值为:plus(增),minus(减)
@property (nonatomic,strong)NSNumber *passengerYoYRate;
// 客流数同比变化率 是 Double
@property (nonatomic,strong)NSString *persalesdate;
//客单价统计时间 是 String 100
@property (nonatomic,strong)NSNumber *persales;
//客单价 是 String 100
@property (nonatomic,strong)NSString *persalesChainSign;
//客单价环比增减标志 是 String 30 枚举值为:plus(增),minus(减)
@property (nonatomic,strong)NSNumber *persalesChainRate;
//客单价环比增减率 是 Double
@property (nonatomic,strong)NSString *persalesYoYSign;
//客单价同比增减标志 是 String 30 枚举值为:plus(增),minus(减)
@property (nonatomic,strong)NSNumber *persalesYoYRate;
//客单价同比增减率 是 Double
@property (nonatomic,strong)NSString *grossprofitdate;
//毛利率统计时间 是 String 100
@property (nonatomic,strong)NSNumber *grossprofit;
//毛利率 是 String 100
@property (nonatomic,strong)NSString *grossprofitChainSign;
//毛利率环比增减标志 是 String 30 枚举值为:plus(增),minus(减)
@property (nonatomic,strong)NSNumber *grossprofitChainRate;
//毛利率环比增减率 是 Double
@property (nonatomic,strong)NSString *grossprofitYoYSign;
//毛利率同比增减标志 是 String 30 枚举值为:plus(增),minus(减)
@property (nonatomic,strong)NSNumber *grossprofitYoYRate;
//毛利率同比增减率 是 Double
@property (nonatomic , assign) BOOL expand;//该节点是否处于展开状态
@property (nonatomic , assign) BOOL isLeaf;
@end
//
// Compass.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/18.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "Compass.h"
@implementation Compass
@end
// //
// ReportViewController.h // ReportViewController.h
// vanke // XFFruit
// //
// Created by Z on 16/7/11. // Created by 陈俊俊 on 15/11/6.
// Copyright © 2016年 gomore. All rights reserved. // Copyright © 2015年 Xummer. All rights reserved.
// //
#import <UIKit/UIKit.h>
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
@interface ReportViewController : ICRBaseViewController @interface ReportViewController : ICRBaseViewController
@end @end
//
// SaleViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/6.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Compass.h"
@interface SaleViewController : UIViewController
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,assign)NSInteger count;
@property (nonatomic,strong)NSString *typeStr;
- (void)setValueInSale:(Compass *)compass withType:(NSString *)type;
@end
//
// SaleViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/6.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "SaleViewController.h"
#import "SaleViewCell.h"
#import "SaleHeaderView.h"
//#import "ReportDetailViewController.h"
#import "RSaleView.h"
#import "Compass.h"
static NSString *saleCellIdentify = @"saleCellIdentify";
static NSString *saleHeaderIdentify = @"saleHeaderIdentify";
@interface SaleViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)RSaleView *rsaleView;
@property (nonatomic,strong)Compass *compass;
@property (nonatomic,strong)NSIndexPath *currentIndex;
@end
@implementation SaleViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self bulidLayout];
}
#pragma mark - 初始化数据
- (void)initData{
if(!self.dataArr){
self.dataArr = [NSMutableArray array];
}
}
#pragma mark - 布局
- (void)bulidLayout{
self.view .backgroundColor = [UIColor whiteColor];
CGRect rect = CGRectMake(0, 0, SCREEN_WIDTH, 145);
self.rsaleView = [[RSaleView alloc]initWithFrame:rect];
self.rsaleView.bgImage.image = [UIImage imageNamed:@"salebg_1"];
self.rsaleView.cenImage.image = [UIImage imageNamed:@"sale_1"];
[self.view addSubview:self.rsaleView];
NSLog(@"%f---------",self.view.height);
rect = CGRectMake(0, 0, self.view.width, self.view.height- 158);
self.tableView = [[UITableView alloc]initWithFrame:rect style:UITableViewStylePlain];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.tableView registerClass:[SaleViewCell class] forCellReuseIdentifier:saleCellIdentify];
[self.tableView registerClass:[SaleHeaderView class] forHeaderFooterViewReuseIdentifier:saleHeaderIdentify];
self.tableView.tableHeaderView = self.rsaleView;
[self.view addSubview:self.tableView];
}
- (void)setValueInSale:(Compass *)compass withType:(NSString *)type{
self.compass = compass;
self.rsaleView.weekLabelStr = type;
[self.rsaleView setValueInSaleView:compass];
}
#pragma mark - tableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
SaleViewCell *cell = (SaleViewCell *)[tableView dequeueReusableCellWithIdentifier:saleCellIdentify forIndexPath:indexPath];
if(cell == nil) {
cell = [[SaleViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:saleCellIdentify];
}
//没有选中风格
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//取消分割线
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Compass *test = _dataArr[indexPath.row];
if(test != nil) {
[cell updateCellWith:test index:indexPath];
}
cell.detailBtn.tag = indexPath.row;
[cell.detailBtn addTarget:self action:@selector(detailClick:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [SaleViewCell cellHeight];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[[NSNotificationCenter defaultCenter]postNotificationName:KNOTIFICATION_GetNextDetailData object:nil userInfo:@{@"indexPath":indexPath}];
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
SaleHeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:saleHeaderIdentify];
if (headerView == nil) {
headerView = [[SaleHeaderView alloc] initWithReuseIdentifier:saleHeaderIdentify];
}
[headerView buildLayout];
headerView.totalLabel.text = [NSString stringWithFormat:@"共%ld家",(long)self.count];
[headerView changeTypeName:self.typeStr];
return headerView;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return [SaleHeaderView viewHeight];
}
- (void)detailClick:(UIButton *)btn{
Compass *com = self.dataArr[btn.tag];
NSObject *comObj = [NSNull null];
if (com) {
comObj = com;
}
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_GoReportDetail object:nil userInfo:@{@"compass":comObj}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
//
// CustomSegView.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/6.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol CustomSegViewDelegate <NSObject>
- (void)customSegOneClick:(NSString *)title;
- (void)customSegTwoClick:(NSString *)title;
@end
@interface CustomSegView : UIView
@property (nonatomic,weak)id<CustomSegViewDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr;
@end
//
// CustomSegView.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/6.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "CustomSegView.h"
#define BeginBtnTag 2000000
@interface CustomSegView ()
{
UIView *_bgView;
NSInteger _currentBtnTag;
}
@property (nonatomic,copy)NSArray *segArr;
@end
@implementation CustomSegView
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr{
self = [super initWithFrame:frame];
if (self) {
self.segArr = arr;
[self bulidLayout];
}
return self;
}
- (void)bulidLayout{
_bgView = [[UIView alloc]initWithFrame:self.bounds];
_bgView.layer.borderWidth = 1;
_bgView.layer.borderColor = ReportColor.CGColor;
_bgView.layer.cornerRadius = 5;
_bgView.layer.masksToBounds = YES;
[self addSubview:_bgView];
_bgView.clipsToBounds = YES;
_currentBtnTag = 0;
CLog(@"%f",_bgView.width);
CGFloat width = _bgView.width/self.segArr.count;
for (NSInteger i = 0; i < self.segArr.count; i++) {
IBTCustomButtom *segBtn = [IBTCustomButtom buttonWithType:UIButtonTypeCustom];
segBtn.frame = CGRectMake(width*i, 0, width, _bgView.height);
segBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[segBtn setTitleColor:ReportColor forState:UIControlStateNormal];
segBtn.tag = BeginBtnTag + i;
[segBtn setTitle:self.segArr[i] forState:UIControlStateNormal];
[segBtn addTarget:self action:@selector(segClick:) forControlEvents:UIControlEventTouchUpInside];
[_bgView addSubview:segBtn];
if (i == 0) {
segBtn.backgroundColor = ReportColor;
[segBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_currentBtnTag = i+ BeginBtnTag;
}
if (i < self.segArr.count - 1) {
[segBtn addRightBorderWithWidth:1 color:ReportColor];
}
}
}
- (void)segClick:(UIButton *)btn{
if (btn.tag != _currentBtnTag) {
//获取上一个Btn
IBTCustomButtom *beforeBtn = (IBTCustomButtom *)[_bgView viewWithTag:_currentBtnTag];
if ([beforeBtn isKindOfClass:[UIButton class]] && beforeBtn) {
beforeBtn.backgroundColor = RGBA(1, 1, 1, 0);
[beforeBtn setTitleColor:ReportColor forState:UIControlStateNormal];
}
btn.backgroundColor = ReportColor;
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_currentBtnTag = btn.tag;
if ([self.delegate respondsToSelector:@selector(customSegOneClick:)]) {
[self.delegate customSegOneClick:btn.titleLabel.text];
}
}else{
if ([self.delegate respondsToSelector:@selector(customSegTwoClick:)]) {
[self.delegate customSegTwoClick:btn.titleLabel.text];
}
}
}
@end
//
// FinishTimeView.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/2.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol FinishTimeViewDelegate <NSObject>
- (void)cancelTimeView;
- (void)okTimeView:(NSString *)time withType:(NSString *)type;
@end
@interface FinishTimeView : UIView<UIPickerViewDataSource,UIPickerViewDelegate>
@property (nonatomic,weak)id<FinishTimeViewDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame withDate:(NSString *)dateStr;
- (instancetype)initWithFrame:(CGRect)frame withDate:(NSString *)dateStr type:(NSString *)type;
@end
This diff is collapsed.
//
// QueryOrder.h
// XFFruit
//
// Created by n22 on 15/8/20.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface QueryOrder : IBTModel
@property (nonatomic,strong)NSString *field;
@property (nonatomic,strong)NSString *direction;//升序
@end
//
// QueryOrder.m
// XFFruit
//
// Created by n22 on 15/8/20.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "QueryOrder.h"
@implementation QueryOrder
@end
//
// RSaleView.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/13.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Compass.h"
@interface RSaleView : UIView
- (instancetype)initWithFrame:(CGRect)frame withPage:(NSInteger)currentPage;
@property (nonatomic,strong)UIImageView *bgImage;
@property (nonatomic,strong)UIImageView *cenImage;
@property (nonatomic,strong)NSString *weekLabelStr;
@property (nonatomic,strong)UILabel *weekLabel;
@property (nonatomic,strong)UILabel *avgLabel;
- (void)setValueInSaleView:(Compass *)compass;
@end
//
// RSaleView.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/13.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "RSaleView.h"
//#import "SMPageControl.h"
#define LeftWidth 50
#define ImageSize 20
#define ContentHeight 25
#define CenImageSize 40
@interface RSaleView ()
@property (nonatomic,strong)UILabel *centerLabel;
@property (nonatomic,strong)UILabel *dateLabel;
@property (nonatomic,strong)UIButton *lastWeekLabel;
@property (nonatomic,strong)UIButton *lastYearLabel;
@property (nonatomic,strong)UILabel *rateLabel;
@property (nonatomic,strong)UILabel *averageLabel;
@property (nonatomic,strong)UIImageView *lastWeekImage;
@property (nonatomic,strong)UIImageView *lastYearImage;
//@property (nonatomic,strong)SMPageControl *pageControl;
@property (nonatomic,assign)NSInteger currentPage;
@end
@implementation RSaleView
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
[self bulidLayout];
self.currentPage = 0;
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame withPage:(NSInteger)currentPage{
self = [super initWithFrame:frame];
if (self) {
self.currentPage = currentPage;
[self bulidLayout];
}
return self;
}
- (void)bulidLayout{
CGRect rect = CGRectMake(0, 0, self.width, self.height);
self.bgImage = [[UIImageView alloc]initWithFrame:rect];
[self addSubview:self.bgImage];
rect = CGRectMake(self.width/4, 20, CenImageSize, CenImageSize);
self.cenImage = [[UIImageView alloc]initWithFrame:rect];
self.cenImage.contentMode = UIViewContentModeScaleAspectFit;
[self addSubview:self.cenImage];
rect = CGRectMake(self.cenImage.right+5, 20, SCREEN_WIDTH - self.cenImage.right, ContentHeight);
self.centerLabel = [[UILabel alloc]initWithFrame:rect];
self.centerLabel.textColor = ReportContentColor;
self.centerLabel.font = FontSize(28);
[self addSubview:self.centerLabel];
rect = CGRectMake(self.centerLabel.left, self.centerLabel.bottom,self.width-self.centerLabel.left, ContentHeight);
self.dateLabel = [[UILabel alloc]initWithFrame:rect];
self.dateLabel.textColor = [UIColor lightGrayColor];
self.dateLabel.font = GXF_THREETEENTH_SIZE;
self.dateLabel.textAlignment = NSTextAlignmentLeft;
[self addSubview:self.dateLabel];
CGFloat bottomWidth = (SCREEN_WIDTH - 20)/4;
rect = CGRectMake(10, self.dateLabel.bottom + 5,bottomWidth, ContentHeight);
self.lastWeekLabel = [IBTCommon buttonWithTitle:@"" Image:nil frame:rect fontSize:15 fontColor:[UIColor lightGrayColor]];
[self addSubview:self.lastWeekLabel];
rect = CGRectMake(self.lastWeekLabel.left, self.lastWeekLabel.bottom,bottomWidth,20);
UILabel *weekLabel = [[UILabel alloc]initWithFrame:rect];
weekLabel.textColor = [UIColor lightGrayColor];
weekLabel.text = @"比上周同期";
weekLabel.font = GXF_THREETEENTH_SIZE;
weekLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:weekLabel];
self.weekLabel = weekLabel;
rect = CGRectMake(self.lastWeekLabel.right, self.lastWeekLabel.top,bottomWidth, ContentHeight);
self.lastYearLabel = [IBTCommon buttonWithTitle:@"" Image:nil frame:rect fontSize:15 fontColor:[UIColor lightGrayColor]];
[self addSubview:self.lastYearLabel];
rect = CGRectMake(self.lastYearLabel.left, self.lastWeekLabel.bottom,bottomWidth,20);
UILabel *yearLabel = [[UILabel alloc]initWithFrame:rect];
yearLabel.textColor = [UIColor lightGrayColor];
yearLabel.text = @"比去年同期";
yearLabel.font = GXF_THREETEENTH_SIZE;
yearLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:yearLabel];
rect = CGRectMake(self.lastYearLabel.right,self.lastWeekLabel.top,bottomWidth, ContentHeight);
self.rateLabel = [[UILabel alloc]initWithFrame:rect];
self.rateLabel.textColor = GXF_COMMIT_COLOR;
self.rateLabel.font = GXF_FIFTEENTEN_SIZE;
self.rateLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.rateLabel];
rect = CGRectMake(self.rateLabel.left, self.lastWeekLabel.bottom,bottomWidth,20);
UILabel *raLabel = [[UILabel alloc]initWithFrame:rect];
raLabel.textColor = [UIColor lightGrayColor];
raLabel.text = @"销售达成率";
raLabel.font = GXF_THREETEENTH_SIZE;
raLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:raLabel];
rect = CGRectMake(self.rateLabel.right, self.lastWeekLabel.top,bottomWidth, ContentHeight);
self.averageLabel = [[UILabel alloc]initWithFrame:rect];
self.averageLabel.textColor = GXF_COMMIT_COLOR;
self.averageLabel.font = GXF_FIFTEENTEN_SIZE;
self.averageLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.averageLabel];
rect = CGRectMake(self.averageLabel.left, self.lastWeekLabel.bottom,bottomWidth,20);
UILabel *avLabel = [[UILabel alloc]initWithFrame:rect];
avLabel.textColor = [UIColor lightGrayColor];
avLabel.text = @"单店日均";
avLabel.font = GXF_THREETEENTH_SIZE;
avLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:avLabel];
self.avgLabel = avLabel;
// self.pageControl = [[SMPageControl alloc]initWithFrame:CGRectMake(0, avLabel.bottom+5, SCREEN_WIDTH, 10)];
// self.pageControl.numberOfPages = 4;
// self.pageControl.currentPage = self.currentPage;
// self.pageControl.pageIndicatorImage = [UIImage imageNamed:@"white_point"];
// self.pageControl.currentPageIndicatorImage = [UIImage imageNamed:@"yellow_point"];
// self.pageControl.indicatorMargin = 5.0f;
// self.pageControl.indicatorDiameter = 10.0f;
// [self addSubview:self.pageControl];
}
- (void)setWeekLabelStr:(NSString *)weekLabelStr{
NSString *typeStr = @"";
NSString *avStr = @"";
if ([weekLabelStr isEqualToString:SaleEnDay]) {
typeStr = OrderLastWeak;
avStr = AvgLabelDay;
}else if([weekLabelStr isEqualToString:SaleEnWeek]){
typeStr = OrderLastWeak;
avStr = AvgLabelWeek;
}else if([weekLabelStr isEqualToString:SaleEnMonth]){
typeStr = OrderLastMonth;
avStr = AvgLabelMonth;
}
self.weekLabel.text = typeStr;
self.avgLabel.text = avStr;
}
- (void)setValueInSaleView:(Compass *)compass{
//统计时间
NSString *weekday = @"";
if ([IBTCommon convertToDateFrom:compass.dataScope]) {
weekday = [IBTCommon weekdayStringFromDate:[IBTCommon convertToDateFrom:compass.dataScope]];
}
self.dateLabel.text = compass.dataScope?[NSString stringWithFormat:@"%@%@累计销售额",compass.dataScope,weekday]:@"无";
//销售额
self.centerLabel.text = compass.sales?[IBTCommon countNumAndChangeformat:[IBTCommon stringDisposeWithFloat:[compass.sales floatValue]]]:@"---" ;
//销售环比变化率
if ([compass.salesChainSign isEqualToString:ReportChainSignPlus]) {
[self.lastWeekLabel setImage:[UIImage imageNamed:ReportChainPlusImage] forState:UIControlStateNormal];
[self.lastWeekLabel setTitleColor:ReportContentColor forState:UIControlStateNormal];
}else if ([compass.salesChainSign isEqualToString:ReportChainSignMinus]){
[self.lastWeekLabel setImage:[UIImage imageNamed:ReportChainMinusImage] forState:UIControlStateNormal];
[self.lastWeekLabel setTitleColor:GXF_SAVE_COLOR forState:UIControlStateNormal];
}
NSString *salesChainRateStr = compass.salesChainRate?[NSString stringWithFormat:@"%@%%",[IBTCommon stringDisposeWithFloat:[compass.salesChainRate floatValue]]]:@"---";
[self.lastWeekLabel setTitle:salesChainRateStr forState:UIControlStateNormal];
//销售同比变化率
if ([compass.salesYoYSign isEqualToString:ReportChainSignPlus]) {
[self.lastYearLabel setImage:[UIImage imageNamed:ReportChainPlusImage] forState:UIControlStateNormal];
[self.lastYearLabel setTitleColor:ReportContentColor forState:UIControlStateNormal];
}else if ([compass.salesYoYSign isEqualToString:ReportChainSignMinus]){
[self.lastYearLabel setImage:[UIImage imageNamed:ReportChainMinusImage] forState:UIControlStateNormal];
[self.lastYearLabel setTitleColor:GXF_SAVE_COLOR forState:UIControlStateNormal];
}
NSString *salesYoStr = compass.salesYoYRate?[NSString stringWithFormat:@"%@%%",[IBTCommon stringDisposeWithFloat:[compass.salesYoYRate floatValue]]]:@"---";
[self.lastYearLabel setTitle:salesYoStr forState:UIControlStateNormal];
//销售目标达成率
NSString *salesTargetStr = compass.salesTargetRate?[NSString stringWithFormat:@"%@%%",[IBTCommon stringDisposeWithFloat:[compass.salesTargetRate floatValue]]]:@"---";
self.rateLabel.text = salesTargetStr;
//单店日均销售
NSString *dailysalesPerStr = compass.dailysalesPerStore?[NSString stringWithFormat:@"%@",[IBTCommon stringDisposeWithFloat:[compass.dailysalesPerStore floatValue]]]:@"---";
self.averageLabel.text = dailysalesPerStr;
}
@end
//
// SaleHeaderView.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SaleHeaderView : UITableViewHeaderFooterView
@property (nonatomic,strong)UILabel *totalLabel;
+ (CGFloat)viewHeight;
- (void)buildLayout;
- (void)changeTypeName:(NSString *)name;
@end
//
// SaleHeaderView.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "SaleHeaderView.h"
#define Sale_Header_Height 35
@interface SaleHeaderView ()
{
BOOL hasBuildLayout; // default, NO;
}
@property (nonatomic, strong) UILabel *label;
@property (nonatomic, strong) UIFont *textFont;
@property (nonatomic, strong) UILabel *bszLabel;
@end
@implementation SaleHeaderView
+ (CGFloat)viewHeight
{
return Sale_Header_Height;
}
- (void)buildLayout
{
if(hasBuildLayout) {
return;
}
if(self.textFont == nil) {
self.textFont = [UIFont systemFontOfSize:13];
}
hasBuildLayout = YES;
self.contentView.backgroundColor = [UIColor colorWithWhite:0.965 alpha:1.000];
CGRect rect = CGRectMake(0, 0, SCREEN_WIDTH, 1);
UILabel *lineLabel = [[UILabel alloc]initWithFrame:rect];
lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:lineLabel];
rect = CGRectMake(10, 0, 105, Sale_Header_Height);
UILabel *searLabel = [IBTCommon labelWithTitle:@"共280家" frame:rect textFont:self.textFont];
searLabel.textColor = ReportTitleColor;
[self.contentView addSubview:searLabel];
self.totalLabel = searLabel;
CGFloat width = (SCREEN_WIDTH - searLabel.right - 25)/3;
rect = CGRectMake(searLabel.right, 0, width + 20, Sale_Header_Height);
UILabel * xsBtn = [IBTCommon labelWithTitle:@"销售额" frame:rect textFont:self.textFont];
xsBtn.textColor = ReportTitleColor;
[self.contentView addSubview:xsBtn];
rect = CGRectMake(xsBtn.right , 0, width, Sale_Header_Height);
UILabel * bszLabel = [IBTCommon labelWithTitle:@"比上周" frame:rect textFont:self.textFont];
bszLabel.textColor = ReportTitleColor;
[self.contentView addSubview:bszLabel];
self.bszLabel = bszLabel;
rect = CGRectMake(bszLabel.right , 0, width-20, Sale_Header_Height);
UILabel * sclLabel = [IBTCommon labelWithTitle:@"达成率" frame:rect textFont:self.textFont];
sclLabel.textColor = ReportTitleColor;
[self.contentView addSubview:sclLabel];
rect = CGRectMake(0, Sale_Header_Height-1, SCREEN_WIDTH, 1);
UILabel *lineTLabel = [[UILabel alloc]initWithFrame:rect];
lineTLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:lineTLabel];
}
- (void)changeTypeName:(NSString *)name{
NSString *typeStr = @"";
if ([name isEqualToString:SaleEnMonth]) {
typeStr = LastMonth;
}else{
typeStr = LastWeak;
}
self.bszLabel.text = typeStr;
}
@end
//
// SaleViewCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Compass.h"
@interface SaleViewCell : UITableViewCell
@property (nonatomic,strong)UIButton *detailBtn;
@property (nonatomic, strong) UILabel *dqLabel;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *saleLabel;
@property (nonatomic, strong) UIButton *lastWeekLabel;
@property (nonatomic, strong) UILabel *rateLabel;
@property (nonatomic, strong) UILabel *lineLabel;
+ (CGFloat)cellHeight;
- (void)updateCellWith:(Compass *)obj index:(NSIndexPath *)indexPath;
- (void)setColorAndFont:(NSInteger)level;
@end
//
// SaleViewCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "SaleViewCell.h"
#define Sale_Cell_Height 50
#define Left_Width 110
#define Left_margin 5
@interface SaleViewCell ()
{
BOOL hasBuildLayout; // default, NO;
}
@property (nonatomic, strong) UIFont *textFont;
@property (nonatomic, strong) UIFont *titleFont;
@property (nonatomic, strong) NSIndexPath *indexPath;
@end
@implementation SaleViewCell
+ (CGFloat)cellHeight
{
return Sale_Cell_Height;
}
#pragma mark - build view
- (void)buildLayout
{
if(hasBuildLayout) {
return;
}
hasBuildLayout = YES;
if(self.textFont == nil) {
self.textFont = [UIFont systemFontOfSize:15];
}
if(self.titleFont == nil) {
self.titleFont = [UIFont systemFontOfSize:17];
}
//页面布局
[self createView];
}
//创建视图
- (void)createView
{
CGRect rect = CGRectMake(Left_margin,5, Left_Width, Sale_Cell_Height/2);
self.nameLabel = [IBTCommon labelWithTitle:@"第一片区" frame:rect textFont:self.textFont];
[self.contentView addSubview:self.nameLabel];
rect = CGRectMake(Left_margin,self.nameLabel.bottom, Left_Width, Sale_Cell_Height/2-10);
self.dqLabel = [IBTCommon labelWithTitle:@"0101" frame:rect textFont:self.textFont];
[self.contentView addSubview:self.dqLabel];
CGFloat width = (SCREEN_WIDTH - self.dqLabel.right - 25)/3;
rect = CGRectMake(self.dqLabel.right , 0, width+20, Sale_Cell_Height);
self.saleLabel = [IBTCommon labelWithTitle:@"56,080" frame:rect textFont:self.textFont];
[self.contentView addSubview:self.saleLabel];
rect = CGRectMake(self.saleLabel.right, 0, width, Sale_Cell_Height);
self.lastWeekLabel = [IBTCommon buttonWithTitle:@"" Image:nil frame:rect fontSize:15 fontColor:ReportContentColor];
self.lastWeekLabel.enabled = NO;
self.lastWeekLabel.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft ;
[self.contentView addSubview:self.lastWeekLabel];
rect = CGRectMake(self.lastWeekLabel.right, 0, width-20, Sale_Cell_Height);
self.rateLabel = [IBTCommon labelWithTitle:@"60%" frame:rect textFont:self.textFont];
self.rateLabel.textColor = GXF_COMMIT_COLOR;
[self.contentView addSubview:self.rateLabel];
rect = CGRectMake(self.rateLabel.right, 0, 25, Sale_Cell_Height);
self.detailBtn = [IBTCommon buttonWithTitle:@"" Image:[UIImage imageNamed:@"more_detail"] frame:rect fontSize:20 fontColor:ReportBgColor];
self.detailBtn.titleLabel.font = [UIFont boldSystemFontOfSize:15];
[self.contentView addSubview:self.detailBtn];
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0, Sale_Cell_Height - 1, SCREEN_WIDTH, 1))];
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:self.lineLabel];
}
#pragma mark - update view
- (void)updateCellWith:(Compass *)sale index:(NSIndexPath *)indexPath
{
self.indexPath = indexPath;
[self buildLayout];
//组织name
self.dqLabel.text = sale.orgCode;
self.nameLabel.text = sale.orgName;
//销售环比变化率
if ([sale.salesChainSign isEqualToString:ReportChainSignPlus]) {
[self.lastWeekLabel setImage:[UIImage imageNamed:ReportChainPlusImage] forState:UIControlStateDisabled];
[self.lastWeekLabel setTitleColor:ReportContentColor forState:UIControlStateNormal];
self.saleLabel.textColor = ReportContentColor;
}else{
[self.lastWeekLabel setImage:[UIImage imageNamed:ReportChainMinusImage] forState:UIControlStateDisabled];
[self.lastWeekLabel setTitleColor:GXF_NAVIGAYION_COLOR forState:UIControlStateNormal];
self.saleLabel.textColor = GXF_NAVIGAYION_COLOR;
}
//销售额
self.saleLabel.text = sale.sales?[IBTCommon countNumAndChangeformat:[IBTCommon stringDisposeWithFloat:[sale.sales floatValue]]] : @"0";
NSString *salesYoStr = [NSString stringWithFormat:@"%@%%",[IBTCommon stringDisposeWithFloat:[sale.salesChainRate floatValue]]];
[self.lastWeekLabel setTitle:salesYoStr forState:UIControlStateNormal];
//销售目标达成率
NSString *salesTargetRateStr = [NSString stringWithFormat:@"%@%%",[IBTCommon stringDisposeWithFloat:[sale.salesTargetRate floatValue]]];
self.rateLabel.text = salesTargetRateStr;
[self setColorAndFont:sale.level];
}
- (void)setColorAndFont:(NSInteger)level{
if (level == 0) {
self.dqLabel.textColor = GXF_CONTENT_COLOR;
self.nameLabel.textColor = GXF_CONTENT_COLOR;
self.lineLabel.hidden = NO;
[self setFontLabel:17];
[self setWidthDQ:0];
self.contentView.backgroundColor = [UIColor whiteColor];
}else if (level == 1) {
self.dqLabel.textColor = [UIColor blackColor];
self.nameLabel.textColor = [UIColor blackColor];
self.lineLabel.hidden = NO;
[self setFontLabel:15];
[self setWidthDQ:0];
self.contentView.backgroundColor = [UIColor whiteColor];
}else if(level == 2){
self.lineLabel.hidden = NO;
self.dqLabel.textColor = GXF_LEFTSIX_COLOR;
self.nameLabel.textColor = GXF_LEFTSIX_COLOR;
[self setWidthDQ:5];
[self setFontLabel:13];
self.contentView.backgroundColor = [UIColor whiteColor];
}else {
self.lineLabel.hidden = YES;
self.dqLabel.textColor = ReportTwoColor;
self.nameLabel.textColor = ReportTwoColor;
[self setFontLabel:12];
[self setWidthDQ:10];
self.contentView.backgroundColor = [UIColor colorWithWhite:0.965 alpha:1.000];
}
}
- (void)setFontLabel:(NSInteger)fontSize{
self.dqLabel.font = FontSize(fontSize-2);
self.nameLabel.font = FontSize(fontSize);
self.saleLabel.font = FontSize(fontSize);
self.lastWeekLabel.titleLabel.font = FontSize(fontSize);
self.rateLabel.font = FontSize(fontSize);
}
- (void)setWidthDQ:(NSInteger)width{
self.lineLabel.left = width;
self.lineLabel.width = SCREEN_WIDTH - width;
if (width > 0) {
self.nameLabel.left = width + 5;
self.nameLabel.width = SCREEN_WIDTH - width - 5;
self.dqLabel.left = width + 5;
self.dqLabel.width = SCREEN_WIDTH - width - 5;
}else{
self.nameLabel.left = 5;
self.nameLabel.width = SCREEN_WIDTH - 5;
self.dqLabel.left = 5;
self.dqLabel.width = SCREEN_WIDTH - 5;
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
...@@ -428,6 +428,7 @@ ON_WILL_APPEAR( signal ) ...@@ -428,6 +428,7 @@ ON_WILL_APPEAR( signal )
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController]; ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
NSString *string = [NSString stringWithFormat:@"attachment/upload_by_file?entity_type=%@&entity_uuid=%@",@"salesInput",@"860576037625827160708160529115460847"]; NSString *string = [NSString stringWithFormat:@"attachment/upload_by_file?entity_type=%@&entity_uuid=%@",@"salesInput",@"860576037625827160708160529115460847"];
WS(weakSelf); WS(weakSelf);
[self.arrPics removeLastObject];
[httpCtrl POST:string pictures:self.arrPics param:nil complete:^(id responseObject, NSError *error) { [httpCtrl POST:string pictures:self.arrPics param:nil complete:^(id responseObject, NSError *error) {
NSMutableArray *arrUuid = [NSMutableArray array]; NSMutableArray *arrUuid = [NSMutableArray array];
for (NSDictionary *data in responseObject[@"data"]) { for (NSDictionary *data in responseObject[@"data"]) {
...@@ -441,7 +442,10 @@ ON_WILL_APPEAR( signal ) ...@@ -441,7 +442,10 @@ ON_WILL_APPEAR( signal )
NSString *utf8String = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *utf8String = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
WS(weakSelf) WS(weakSelf)
[httpCtrl postUrl:utf8String params:params success:^(id data) { [httpCtrl postUrl:utf8String params:params success:^(id data) {
weakSelf.arrPics = nil;
[weakSelf.selectedAssets removeAllObjects];
[weakSelf.cellDataDic removeAllObjects];
[weakSelf.tableView reloadData];
[weakSelf goToHistory]; [weakSelf goToHistory];
} failure:^(id data) { } failure:^(id data) {
...@@ -482,6 +486,10 @@ ON_WILL_APPEAR( signal ) ...@@ -482,6 +486,10 @@ ON_WILL_APPEAR( signal )
_arrPics = [NSMutableArray array]; _arrPics = [NSMutableArray array];
[_arrPics addObject:[UIImage imageNamed:@"add-photo_icon"]]; [_arrPics addObject:[UIImage imageNamed:@"add-photo_icon"]];
} }
if (_arrPics.count == 0) {
[_arrPics addObject:[UIImage imageNamed:@"add-photo_icon"]];
}
return _arrPics; return _arrPics;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment