Commit 30e9f987 authored by 曹云霄's avatar 曹云霄

现金红包增加已拒绝状态、修改“更改成交价接口”、“实时计算促销接口”

parent 137766f3
......@@ -53,7 +53,7 @@
[self setUpiCarouselView];
[self getDatasAction];
[self setUpCollectionView];
// [self perfectDepartInformation];
[self perfectDepartInformation];
}
#pragma mark -获取滚动视图数据
......@@ -166,7 +166,7 @@
{
if (view == nil)
{
view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth*0.8, ScreenHeight*0.35-20)];
view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth*0.7, ScreenHeight*0.35-20)];
UIImageView *imageView = (UIImageView *)view;
TOBannerEntity *entity = self.homeResponse.list[index];
[imageView sd_setImageWithURL:[NSURL URLWithString:entity.attachment] placeholderImage:REPLACEIMAGE];
......
......@@ -42,7 +42,7 @@
{
_replyEntity = replyEntity;
self.bestView.replyId = _replyEntity.fid;
[self.issuerImageView sd_setImageWithURL:[NSURL URLWithString:_replyEntity.replyerPicture] placeholderImage:CoustomerReplaceImage];
[self.issuerImageView sd_setImageWithURL:[NSURL URLWithString:_replyEntity.replyerPicture] placeholderImage:ReplaceImage];
self.issuerNameLabel.text = [NSString stringWithFormat:@"%@: %@",_replyEntity.replyerPosition,_replyEntity.replyerRealName];
self.issuerDateLabel.text = [BaseViewController formateDate:_replyEntity.replyTime];
self.commentContentLabel.text = _replyEntity.replyContent;
......
......@@ -111,15 +111,12 @@
- (IBAction)LoginButtonClick:(UIButton *)sender {
if ([[self class] isBlankString:self.userName.text]) {
[XBLoadingView showHUDViewWithText:@"用户名不能为空"];
return;
[XBLoadingView showHUDViewWithText:@"用户名不能为空"];return;
}else if ([[self class] isBlankString:self.passWord.text])
{
[XBLoadingView showHUDViewWithText:@"密码不能为空"];
return;
[XBLoadingView showHUDViewWithText:@"密码不能为空"];return;
}
[self judgeUserNameAndPassword];
}
#pragma mark -设置根视图控制器
......@@ -163,6 +160,8 @@
LoginInfo *login = [[LoginInfo alloc]init];
login.username = self.userName.text;
login.password = self.passWord.text;
login.username = [login.username formatString];
login.password = [login.password formatString];
WS(weakSelf);
[HTTP networkRequestWithURL:SERVERREQUESTURL(LOGIN) withRequestType:ZERO withParameter:login withReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
......@@ -413,6 +412,7 @@
#pragma mark - 检测更新
- (void)detectionUpdateVersion
{
[XBLoadingView hideHUDViewWithDefault];
NSString *path = [[NSBundle mainBundle]pathForResource:@"Info" ofType:@"plist"];
NSDictionary* content =[NSDictionary dictionaryWithContentsOfFile:path];
NSString *version = [content valueForKey:@"CFBundleShortVersionString"];
......@@ -429,7 +429,6 @@
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:[NSString stringWithFormat:@"发现新版本%@,快去更新吧!",dict[@"version"]] preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:dict[@"url"]]];
// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-services://?action=download-manifest&url=http://www.pgyer.com/app/plist/95fcb4e47cf3d6c7309a2760ccccde66"]];
}]];
//是否强制更新
if (![dict[@"forceupdate"] isEqualToString:@"1"]) {
......
......@@ -739,7 +739,7 @@
self.nameString = model.name;
self.companyString = model.company;
[self.locationButton setTitle:[NSString stringWithFormat:@"%@-%@-%@",model.province,model.city,model.country] forState:UIControlStateNormal];
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:model.picture] placeholderImage:CoustomerReplaceImage];
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:model.picture] placeholderImage:ReplaceImage];
}
#pragma mark -友好界面
......
......@@ -58,7 +58,7 @@
self.shoppingBagButton.backgroundColor = [UIColor whiteColor];
//赋值
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:self.model.picture] placeholderImage:CoustomerReplaceImage];
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:self.model.picture] placeholderImage:ReplaceImage];
self.customerName.text = self.model.name;
self.customerPhoneNumber.text = self.model.mobile;
self.companyName.text = self.model.company;
......
......@@ -25,7 +25,7 @@
- (void)setModel:(TOConsumerEntity *)model
{
_model = model;
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:_model.picture] placeholderImage:CoustomerReplaceImage];
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:_model.picture] placeholderImage:ReplaceImage];
self.customerName.text = _model.name;
self.companyName.text = _model.company;
self.customerPhoneNumber.text = _model.mobile;
......
......@@ -20,7 +20,7 @@
- (void)setModel:(MyclientEntityModel *)model
{
_model = model;
[self.personHeader sd_setImageWithURL:[NSURL URLWithString:_model.picture] placeholderImage:CoustomerReplaceImage];
[self.personHeader sd_setImageWithURL:[NSURL URLWithString:_model.picture] placeholderImage:ReplaceImage];
self.personName.text = _model.name;
self.personPhoneNumber.text = _model.mobile;
self.recentTime.text = _model.lastVisitedTime;
......
......@@ -19,7 +19,7 @@
- (void)setModel:(MyclientEntityModel *)model
{
_model = model;
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:_model.picture] placeholderImage:CoustomerReplaceImage];
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:_model.picture] placeholderImage:ReplaceImage];
self.customerName.text = _model.name;
self.customerPhoneName.text = _model.mobile;
self.serviceName.text = _model.createName;
......
......@@ -43,7 +43,7 @@
self.orderSerialNumber.text = _model.order.orderNumber;
self.shoppersName.text = _model.employee.realName;
self.customerName.text = _model.consumer.name;
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:_model.consumer.picture] placeholderImage:CoustomerReplaceImage];
[self.customerHeader sd_setImageWithURL:[NSURL URLWithString:_model.consumer.picture] placeholderImage:ReplaceImage];
self.orderStatus.text = _model.order.orderState;
self.consigneeName.text = _model.order.receiverName;
self.consigneePhoneNumber.text = _model.order.receiverMobile;
......
......@@ -489,8 +489,8 @@
[goodsArray enumerateObjectsUsingBlock:^(ShopcarModel * _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) {
dispatch_group_enter(group);
NSLog(@"%@",[NSString stringWithFormat:@"%@%@/%@/%@/%ld",SERVERREQUESTURL(CHANGESHOPPINGBAGNUMBERPRICE),model.fid,model.goodsId,[model.costPrice stringValue],model.goodsNum]);
[HTTP networkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@/%@/%@/%ld",SERVERREQUESTURL(CHANGESHOPPINGBAGNUMBERPRICE),model.fid,model.goodsId,[model.costPrice stringValue],model.goodsNum] withRequestType:ONE withParameter:nil withReturnValueBlock:^(id returnValue) {
NSString *urlString = [NSString stringWithFormat:SERVERREQUESTURL(CHANGESHOPPINGBAGNUMBERPRICE),model.fid,[model.costPrice stringValue],model.goodsId,model.goodsNum];
[HTTP networkWithDictionaryRequestWithURL:urlString withRequestType:ZERO withParameter:nil withReturnValueBlock:^(id returnValue) {
dispatch_group_leave(group);
if (RESULT(returnValue)) {
......
......@@ -156,24 +156,12 @@
cell.orderNumberLabel.text = drawEntity.draw.orderNumber;
cell.drawButton.tag = indexPath.row;
[cell.drawButton addTarget:self action:@selector(drawButtonClickAction:) forControlEvents:UIControlEventTouchUpInside];
if (self.drawValue == 0) {
cell.orderNumberTitle.font = [UIFont systemFontOfSize:12];
cell.drawButton.titleLabel.font = [UIFont systemFontOfSize:12];
cell.orderNumberLabel.font = [UIFont systemFontOfSize:12];
}
return cell;
}
UsedDrawTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UsedDrawTableViewCell" forIndexPath:indexPath];
cell.orderNumber.text = drawEntity.draw.orderNumber;
cell.drawTimeLabel.text = drawEntity.draw.drawDate;
cell.trophyLabel.text = drawEntity.draw.awardDescription;
if (self.drawValue == 0) {
cell.drawTimeLabel.hidden = YES;
cell.drawTimeTitle.hidden = YES;
cell.orderNumberTitle.font = [UIFont systemFontOfSize:12];
cell.trophyLabel.font = [UIFont systemFontOfSize:12];
cell.orderNumber.font = [UIFont systemFontOfSize:12];
}
return cell;
}
......@@ -216,28 +204,20 @@
#pragma mark -友好界面
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
{
if (self.drawValue) {
return kNoDataImage;
}
return nil;
return [[NSAttributedString alloc]initWithString:@"暂无抽奖记录~" attributes:nil];
}
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
{
return YES;
return kNoDataImage;
}
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
{
return [[NSAttributedString alloc]initWithString:@"暂无抽奖记录~" attributes:nil];
return 64;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
//
// LuckyDrawMainViewController.h
// Lighting
//
// Created by 曹云霄 on 2017/3/28.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface LuckyDrawMainViewController : BaseViewController
@property (weak, nonatomic) IBOutlet UITableView *luckyDrawMainTableView;
@end
//
// LuckyDrawMainViewController.m
// Lighting
//
// Created by 曹云霄 on 2017/3/28.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "LuckyDrawMainViewController.h"
#import "NotDrawTableViewCell.h"
#import "UsedDrawTableViewCell.h"
#import "CustomWKWebViewController.h"
@interface LuckyDrawMainViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource,DZNEmptyDataSetDelegate>
/**
* 数据源
*/
@property (nonatomic,strong) NSMutableArray *datasArray;
/**
查询抽奖
*/
@property (nonatomic,strong) RsLotteryRequest *drawModel;
@end
@implementation LuckyDrawMainViewController
#pragma mark - lazy
- (NSMutableArray *)datasArray
{
if (!_datasArray) {
_datasArray = [NSMutableArray array];
}
return _datasArray;
}
- (RsLotteryRequest *)drawModel
{
if (!_drawModel) {
_drawModel = [[RsLotteryRequest alloc]init];
_drawModel.winnerIdEquals = [Shoppersmanager manager].shoppers.employee.fid;
DataPage *page = [[DataPage alloc]init];
page.rows = KROWS;
page.page = ONE;
page.order = SORTDIRECTION_DESC;
_drawModel.page = page;
}
return _drawModel;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self getDrawDatas];
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.luckyDrawMainTableView.tableFooterView = [[UIView alloc] init];
}
#pragma mark - 抽奖数据
- (void)getDrawDatas
{
WS(weakSelf);
[XBLoadingView showHUDViewWithDefaultWithView:self.view];
[HTTP networkRequestWithURL:SERVERREQUESTURL(LOTTERYED) withRequestType:ZERO withParameter:self.drawModel withReturnValueBlock:^(id returnValue) {
weakSelf.luckyDrawMainTableView.emptyDataSetSource = weakSelf;
weakSelf.luckyDrawMainTableView.emptyDataSetDelegate = weakSelf;
[XBLoadingView hideHUDViewWithDefaultWithView:weakSelf.view];
if (RESULT(returnValue)) {
RsLotteryResponse *drawRecord = [[RsLotteryResponse alloc]initWithDictionary:RESPONSE(returnValue) error:nil];
[weakSelf.datasArray addObjectsFromArray:drawRecord.list];
[weakSelf.luckyDrawMainTableView reloadData];
}else {
[XBLoadingView showHUDViewWithText:MESSAGE(returnValue)];
}
} withFailureBlock:^(NSError *error) {
[weakSelf endRefreshingForTableView:weakSelf.luckyDrawMainTableView];
[XBLoadingView hideHUDViewWithDefaultWithView:weakSelf.view];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
RsAwardDraw *drawEntity = self.datasArray[indexPath.row];
if ([drawEntity.draw.state isEqualToString:@"initial"]) {
NotDrawTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NotDrawTableViewCell" forIndexPath:indexPath];
cell.orderNumberLabel.text = drawEntity.draw.orderNumber;
cell.drawButton.tag = indexPath.row;
[cell.drawButton addTarget:self action:@selector(drawButtonClickAction:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
UsedDrawTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UsedDrawTableViewCell" forIndexPath:indexPath];
cell.orderNumber.text = drawEntity.draw.orderNumber;
cell.drawTimeLabel.text = drawEntity.draw.drawDate;
cell.trophyLabel.text = drawEntity.draw.awardDescription;
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.datasArray.count;
}
#pragma mark - 去抽奖
- (void)drawButtonClickAction:(UIButton *)sender
{
RsAwardDraw *drawEntity = self.datasArray[sender.tag];
[self showLuckyDrawControl:drawEntity.draw.lotteryId andOrderNumber:drawEntity.draw.orderNumber andDrawid:drawEntity.draw.fid luckyDrawFinish:^(NSDictionary *dict) {
if ([dict isKindOfClass:[NSDictionary class]]) {
if ([BaseViewController isBlankString:dict[@"awardId"]]) {
[XBLoadingView showHUDViewWithText:@"未中奖"];
}else {
[XBLoadingView showHUDViewWithText:[NSString stringWithFormat:@"恭喜你获得了 %@",dict[@"description"]]];
}
}
}];
}
#pragma mark - 抽奖界面
- (void)showLuckyDrawControl:(NSString *)lotteryId andOrderNumber:(NSString *)orderNumber andDrawid:(NSString *)drawid luckyDrawFinish:(void(^)(NSDictionary *dict))complete
{
CustomWKWebViewController *wkWebView = [[CustomWKWebViewController alloc]init];
NSString *server = [NSString stringWithFormat:SERVERREQUESTURL(DRAW),lotteryId,drawid,orderNumber];
NSString *newServer = [server stringByReplacingOccurrencesOfString:@"/app" withString:@""];
wkWebView.urlString = newServer;
[wkWebView setLuckyDrawFinishBlock:^(NSDictionary *result) {
complete(result);
}];
[wkWebView setDismissLuckyDrawController:^{
}];
[self presentViewController:wkWebView animated:YES completion:nil];
}
#pragma mark -友好界面
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
{
return [[NSAttributedString alloc]initWithString:@"暂无抽奖记录~" attributes:nil];
}
@end
//
// ReadPacketMainViewController.h
// Lighting
//
// Created by 曹云霄 on 2017/3/28.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface ReadPacketMainViewController : BaseViewController
@property (weak, nonatomic) IBOutlet UICollectionView *readPacketMainCollectionView;
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *readPacketMainFlowLayout;
@end
//
// ReadPacketMainViewController.m
// Lighting
//
// Created by 曹云霄 on 2017/3/28.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "ReadPacketMainViewController.h"
#import "ReadPacketCollectionViewCell.h"
#import "CardOrderInformationReusableView.h"
#import "DeviceDirectionManager.h"
@interface ReadPacketMainViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,DZNEmptyDataSetSource,DZNEmptyDataSetDelegate,UploadReceiptsDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
/**
查询红包
*/
@property (nonatomic,strong) RsRedPackageConditions *queryReadPacket;
/**
红包数据
*/
@property (nonatomic,strong) RedPackageResponse *readPacketResult;
/**
数据源
*/
@property (nonatomic,strong) NSMutableArray *readPacketArray;
/**
选中订单号
*/
@property (nonatomic,strong) NSString *orderNumber;
@end
@implementation ReadPacketMainViewController
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self getReadPacketAction];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self setupCollectionView];
}
#pragma mark - 获取红包信息
- (void)getReadPacketAction
{
WS(weakSelf);
[XBLoadingView showHUDViewWithDefault];
[HTTP networkRequestWithURL:SERVERREQUESTURL(QUERY_REDPACKAGE) withRequestType:ZERO withParameter:self.queryReadPacket withReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
weakSelf.readPacketMainCollectionView.emptyDataSetSource = weakSelf;
weakSelf.readPacketMainCollectionView.emptyDataSetDelegate = weakSelf;
[weakSelf endRefreshingForTableView:weakSelf.readPacketMainCollectionView];
if (RESULT(returnValue)) {
weakSelf.readPacketResult = [[RedPackageResponse alloc]initWithDictionary:RESPONSE(returnValue) error:nil];
[weakSelf.readPacketArray addObjectsFromArray:[NSMutableArray arrayWithArray:weakSelf.readPacketResult.list]];
[weakSelf.readPacketMainCollectionView reloadData];
}else{
[XBLoadingView showHUDViewWithText:MESSAGE(returnValue)];
}
}withFailureBlock:^(NSError *error) {
[weakSelf endRefreshingForTableView:weakSelf.readPacketMainCollectionView];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
#pragma mark - UICollectionView
- (void)setupCollectionView
{
CGFloat width = (ScreenWidth-6*20)/5.0;
self.readPacketMainFlowLayout.itemSize = CGSizeMake(width, width*0.6+width);
self.readPacketMainFlowLayout.sectionInset = UIEdgeInsetsMake(20, 20, 20, 20);
self.readPacketMainFlowLayout.minimumLineSpacing = 20;
self.readPacketMainFlowLayout.minimumInteritemSpacing = 20;
[self.readPacketMainCollectionView registerNib:[UINib nibWithNibName:@"CardOrderInformationReusableView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"CardOrderInformationReusableView"];
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
ReadPacketCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ReadPacketCollectionViewCell" forIndexPath:indexPath];
RedPackageGroupbyOrderNumber *order = self.readPacketArray[indexPath.section];
cell.readPacket = order.draws[indexPath.item];
return cell;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
RedPackageGroupbyOrderNumber *order = self.readPacketArray[section];
return order.draws.count;
}
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
CardOrderInformationReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"CardOrderInformationReusableView" forIndexPath:indexPath];
[headerView refreshHeaderView:self withEntity:self.readPacketArray[indexPath.section] withSectionIndex:indexPath.section];
return headerView;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
{
return CGSizeMake(0, 65);
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return self.readPacketArray.count;
}
#pragma mark - <UploadReceiptsDelegate>
- (void)startUploadReceipts:(NSInteger)sectionIndex
{
WS(weakSelf);
self.orderNumber = [self.readPacketArray[sectionIndex] orderNumber];
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleAlert];
UIImagePickerController *PcCamera = [[UIImagePickerController alloc]init];
PcCamera.delegate = self;
[DeviceDirectionManager instance].isHorizontal=YES;
[alertView addAction:[UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//拍照
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
[PcCamera setSourceType:UIImagePickerControllerSourceTypeCamera];
PcCamera.allowsEditing = YES;
[weakSelf presentViewController:PcCamera animated:YES completion:nil];
}
else
{
[DeviceDirectionManager instance].isHorizontal=NO;
[XBLoadingView showHUDViewWithText:@"相机无法使用"];
}
}]];
[alertView addAction:[UIAlertAction actionWithTitle:@"从相册选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//从相册中选择
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
[PcCamera setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
PcCamera.allowsEditing = YES;
[weakSelf presentViewController:PcCamera animated:YES completion:nil];
}
else
{
[DeviceDirectionManager instance].isHorizontal=NO;
[XBLoadingView showHUDViewWithText:@"相册无法打开"];
}
}]];
[alertView addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[DeviceDirectionManager instance].isHorizontal=NO;
[alertView dismissViewControllerAnimated:YES completion:nil];
}]];
[self presentViewController:alertView animated:YES completion:nil];
}
#pragma mark -拍照、从相册选择
#pragma -mark -UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
[DeviceDirectionManager instance].isHorizontal=NO;
[self dismissViewControllerAnimated:YES completion:nil];
UIImage *Headimage = [info objectForKey:UIImagePickerControllerOriginalImage];
[self uploadReceipts:Headimage];
}
#pragma mark -上传小票
- (void)uploadReceipts:(UIImage *)image
{
WS(weakSelf);
NSData *data = UIImageJPEGRepresentation(image, 0.5);
XBLoadingView *progressView = [XBLoadingView showHUDViewProgressLabel:@"上传小票中"];
[HTTP uploadImageWithURL:SERVERREQUESTURL(UPLOADHEADER) withRequestType:ONE withImageDatas:data withParameter:nil withReturnValueBlock:^(id returnValue) {
if (RESULT(returnValue)) {
[weakSelf activationReadPacket:RESPONSE(returnValue)];
}else
{
[XBLoadingView showHUDViewWithText:MESSAGE(returnValue)];
}
} withprogressBlock:^(double progress) {
if (progress >= 1) {
dispatch_async(dispatch_get_main_queue(), ^{
progressView.labelText = @"上传小票成功";
[progressView hide:YES];
});
}else {
progressView.progress = progress;
}
} withFailureBlock:^(NSError *error) {
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
#pragma mark - 激活红包
- (void)activationReadPacket:(NSString *)imagePath
{
WS(weakSelf);
[XBLoadingView showHUDViewWithDefault];
[HTTP networkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(READPACKETPATH),self.orderNumber,imagePath] withRequestType:POST withParameter:nil withReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if (RESULT(returnValue)) {
[XBLoadingView showHUDViewWithSuccessText:@"激活成功" completeBlock:^{
[weakSelf.readPacketMainCollectionView.mj_header beginRefreshing];
}];
}else{
[XBLoadingView showHUDViewWithText:MESSAGE(returnValue)];
}
} withFailureBlock:^(NSError *error) {
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
#pragma mark -友好界面
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
{
return [[NSAttributedString alloc]initWithString:@"暂无红包记录~" attributes:nil];
}
#pragma mark -lazy
- (RsRedPackageConditions *)queryReadPacket
{
if (!_queryReadPacket) {
_queryReadPacket = [[RsRedPackageConditions alloc] init];
_queryReadPacket.guideIdEquals = [Shoppersmanager manager].shoppers.employee.fid;
DataPage *page = [[DataPage alloc] init];
page.page = ZERO;
page.rows = KROWS;
_queryReadPacket.page = page;
}
return _queryReadPacket;
}
- (NSMutableArray *)readPacketArray
{
if (!_readPacketArray) {
_readPacketArray = [NSMutableArray array];
}
return _readPacketArray;
}
@end
......@@ -27,6 +27,11 @@
*/
@property (weak, nonatomic) IBOutlet UIButton *unauditedButton;
/**
已拒绝
*/
@property (weak, nonatomic) IBOutlet UIButton *refusedButton;
/**
已审核
*/
......
......@@ -33,6 +33,10 @@
[self addChildViewController:unauditedVc];
unauditedVc.readPacketState = STUDYTASKSTATE_INITIAL;
[self.controllerBackgroundView addSubview:unauditedVc.view];
/// 已拒绝
ReadPacketViewController *refuseVc = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"ReadPacketViewController"];
refuseVc.readPacketState = STUDYTASKSTATE_REFUSE;
[self addChildViewController:refuseVc];
/// 已审核
ReadPacketViewController *auditedVc = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"ReadPacketViewController"];
auditedVc.readPacketState = STUDYTASKSTATE_USED;
......@@ -46,12 +50,15 @@
ReadPacketViewController *unauditedVc = self.childViewControllers[0];
unauditedVc.view.frame = CGRectMake(0, 0, self.controllerBackgroundView.mj_w, self.controllerBackgroundView.mj_h);
ReadPacketViewController *auditedVc = self.childViewControllers[1];
ReadPacketViewController *refuseVc = self.childViewControllers[1];
refuseVc.view.frame = CGRectMake(0, 0, self.controllerBackgroundView.mj_w, self.controllerBackgroundView.mj_h);
ReadPacketViewController *auditedVc = self.childViewControllers[2];
auditedVc.view.frame = CGRectMake(0, 0, self.controllerBackgroundView.mj_w, self.controllerBackgroundView.mj_h);
}
#pragma mark - 切换已使用卡劵、未使用卡劵
#pragma mark - 切换
- (void)switchPaymentsVCAndWithdrawalVC:(UIViewController *)newViewController
{
[self transitionFromViewController:self.currentVC toViewController:newViewController duration:0.5 options:UIViewAnimationOptionTransitionNone animations:nil completion:^(BOOL finished) {
......@@ -73,7 +80,7 @@
#pragma mark - 切换ContentController
#pragma mark -红包状态 tag 100表示未审核,101表示已审核
#pragma mark -红包状态 tag 100表示未审核,101表示已拒绝,102表示已审核
- (IBAction)readPacketStateClickAction:(UIButton *)sender {
for (id object in self.view.subviews) {
......
......@@ -251,19 +251,19 @@
#pragma mark -友好界面
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
{
return kNoDataImage;
return [[NSAttributedString alloc]initWithString:@"暂无数据" attributes:nil];
}
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
{
return YES;
return kNoDataImage;
}
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
{
return [[NSAttributedString alloc]initWithString:@"暂无数据" attributes:nil];
return 64;
}
......@@ -291,20 +291,4 @@
return _readPacketArray;
}
@end
......@@ -17,6 +17,8 @@
#import "BindingBankCARDViewController.h"
#import "ReadPacketViewController.h"
#import "ReadPacketStateViewController.h"
#import "LuckyDrawMainViewController.h"
#import "ReadPacketMainViewController.h"
@interface RebateViewController ()
......@@ -145,9 +147,8 @@
}];
// 我的抽奖
LuckyDrawDetailsViewController *draw = [[[self class] getMainStoryboardClass]instantiateViewControllerWithIdentifier:@"LuckyDrawDetailsViewController"];
LuckyDrawMainViewController *draw = [[[self class] getMainStoryboardClass]instantiateViewControllerWithIdentifier:@"LuckyDrawMainViewController"];
[self addChildViewController:draw];
draw.drawValue = ALLDRAW;
[self.drawBackgroundView addSubview:draw.view];
[draw.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.drawBackgroundView.mas_left).offset(10);
......@@ -157,7 +158,7 @@
}];
// 红包
ReadPacketViewController *readPacket = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"ReadPacketViewController"];
ReadPacketMainViewController *readPacket = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"ReadPacketMainViewController"];
[self addChildViewController:readPacket];
[self.readPacketBackgroundView addSubview:readPacket.view];
[readPacket.view mas_makeConstraints:^(MASConstraintMaker *make) {
......
......@@ -163,6 +163,11 @@
return kNoDataImage;
}
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
{
return 64;
}
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView
{
return YES;
......@@ -173,10 +178,5 @@
return [[NSAttributedString alloc]initWithString:@"暂无数据" attributes:nil];
}
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
{
return 64;
}
@end
This diff is collapsed.
......@@ -25,7 +25,7 @@
[Bugly startWithAppId:@"900033734"];
[self setUMShare];
[self detectionNetwork];
[self SetIQKeyboardManager];
[self setIQKeyboardManager];
[self RootViewcontroller];
[self setUpJPush:launchOptions];
return YES;
......@@ -85,7 +85,7 @@
}
#pragma mark - 键盘
- (void)SetIQKeyboardManager
- (void)setIQKeyboardManager
{
IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
[[IQKeyboardManager sharedManager]setKeyboardDistanceFromTextField:0];
......
This diff is collapsed.
This diff is collapsed.
......@@ -15,7 +15,7 @@
<key>CFBundleName</key>
<string>欧立方</string>
<key>CFBundleShortVersionString</key>
<string>2.0.8</string>
<string>2.0.7</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
......
......@@ -94,14 +94,13 @@ typedef NS_ENUM(NSInteger,COMMENT_PRAISE) {
/**
* 服务器开发地址
*///http://139.196.195.30:8090
//#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://139.196.195.30:8090/opple-web/app%@",URL]
//192.168.199.197:8080
*/
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://gomoredev:8082/opple-web/app%@",URL]
/**
* 服务器测试地址
*/
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg-dev.opple.com/opple-web/app%@",URL]
//#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg-dev.opple.com/opple-web/app%@",URL]
//**
// * 服务器正式地址
......
......@@ -89,7 +89,7 @@ NSString *const REMOVESHOPPINGBAG = @"/shopcart/delete";
/**
* 更改购物车商品数量、价格
*/
NSString *const CHANGESHOPPINGBAGNUMBERPRICE = @"/shopcart/updateCostPrice/";
NSString *const CHANGESHOPPINGBAGNUMBERPRICE = @"/shopcart/updateCostPrice/?cartId=%@&costPrice=%@&goodsId=%@&goodsNum=%ld";
/**
* 添加到购物车
......@@ -99,7 +99,7 @@ NSString *const ADDSHOPPINGBAG = @"/shopcart/save";
/**
* 查询购物车数量
*/
NSString *const QUERYSHOPPINGBAGNUMBER = @"/shopcart/get/";
NSString *const QUERYSHOPPINGBAGNUMBER = @"/shopcart/get?consumerId=%@";
/**
* 查询所有订单
......@@ -237,7 +237,7 @@ NSString *const WITHDRAWALPROGRESSDETAILS = @"/applybill/getDetailState";
/**
* 查询实时促销信息
*/
NSString *const PROMOTIONAL = @"/promotion/calc/%@";
NSString *const PROMOTIONAL = @"/promotion/calc?orderNumber=%@";
/**
* 查询历史促销信息
......
......@@ -31,4 +31,10 @@
- (CGFloat)widthWithFontSize:(CGFloat)fontSize height:(CGFloat)height;
/**
格式化字符串
@param string 去掉前后空格
*/
- (NSString *)formatString;
@end
......@@ -23,4 +23,15 @@
return [self boundingRectWithSize:CGSizeMake(0, height) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attrs context:nil].size.width;
}
/**
去掉前后空格
*/
- (NSString *)formatString
{
NSCharacterSet *set = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSString *string = [self stringByTrimmingCharactersInSet:set];
return string;
}
@end
......@@ -89,6 +89,8 @@ extern NSString * const STUDYTASKSTATE_INITIAL;
extern NSString * const STUDYTASKSTATE_SUBMITTED;
extern NSString * const STUDYTASKSTATE_USED;
extern NSString * const STUDYTASKSTATE_REFUSE;
......
......@@ -1565,6 +1565,7 @@ NSString * const SORTDIRECTION_DESC = @"desc";
NSString * const STUDYTASKSTATE_INITIAL = @"initial";
NSString * const STUDYTASKSTATE_SUBMITTED = @"submitted";
NSString * const STUDYTASKSTATE_USED = @"used";
NSString * const STUDYTASKSTATE_REFUSE = @"refuse";
......
......@@ -15,6 +15,7 @@
static NetworkRequestClassManager *manager = nil;
/**
* 网络请求单例
*
......@@ -48,7 +49,7 @@ static NetworkRequestClassManager *manager = nil;
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.requestSerializer.timeoutInterval = 300.0f;
manager.requestSerializer.timeoutInterval = 30.0f;
[manager.requestSerializer setValue:@"application/json;charset=utf-8" forHTTPHeaderField: @"Content-Type"];
[manager.requestSerializer setValue:[[[NSBundle mainBundle] infoDictionary]
objectForKey:@"CFBundleShortVersionString"] forHTTPHeaderField: @"version"];
......@@ -77,12 +78,22 @@ static NetworkRequestClassManager *manager = nil;
NSLog(@"%@",[[jastorobject toDictionary] JSONString]);
[manager POST:requestURLString parameters:[jastorobject toDictionary] progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
@try {
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[Notification postNotificationName:LOGINTIMEOUT object:nil];
// [XBLoadingView hideHUDViewWithDefault];
// [Notification postNotificationName:LOGINTIMEOUT object:nil];
//调用自动登录
[self automaticLoginWithReturnValueBlock:^(id returnValue) {
[self networkRequestWithURL:requestURLString withRequestType:requestType withParameter:jastorobject withReturnValueBlock:^(id returnValue) {
successBlock(returnValue);
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
}else{
successBlock(responseObject);
}
......@@ -92,9 +103,7 @@ static NetworkRequestClassManager *manager = nil;
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
failureBlock(error);
}];
}else if (requestType == 1){
......@@ -105,8 +114,19 @@ static NetworkRequestClassManager *manager = nil;
@try {
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[Notification postNotificationName:LOGINTIMEOUT object:nil];
// [XBLoadingView hideHUDViewWithDefault];
// [Notification postNotificationName:LOGINTIMEOUT object:nil];
//调用自动登录
[self automaticLoginWithReturnValueBlock:^(id returnValue) {
[self networkRequestWithURL:requestURLString withRequestType:requestType withParameter:jastorobject withReturnValueBlock:^(id returnValue) {
successBlock(returnValue);
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
}else{
successBlock(responseObject);
}
......@@ -116,9 +136,7 @@ static NetworkRequestClassManager *manager = nil;
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
failureBlock(error);
}];
}
}
......@@ -147,8 +165,19 @@ static NetworkRequestClassManager *manager = nil;
@try {
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[Notification postNotificationName:LOGINTIMEOUT object:nil];
// [XBLoadingView hideHUDViewWithDefault];
// [Notification postNotificationName:LOGINTIMEOUT object:nil];
//自动登录
[self automaticLoginWithReturnValueBlock:^(id returnValue) {
[self networkWithDictionaryRequestWithURL:requestURLString withRequestType:requestType withParameter:parameter withReturnValueBlock:^(id returnValue) {
successBlock(returnValue);
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
}else{
successBlock(responseObject);
}
......@@ -166,8 +195,19 @@ static NetworkRequestClassManager *manager = nil;
@try {
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[Notification postNotificationName:LOGINTIMEOUT object:nil];
// [XBLoadingView hideHUDViewWithDefault];
// [Notification postNotificationName:LOGINTIMEOUT object:nil];
//自动登录
[self automaticLoginWithReturnValueBlock:^(id returnValue) {
[self networkWithDictionaryRequestWithURL:requestURLString withRequestType:requestType withParameter:parameter withReturnValueBlock:^(id returnValue) {
successBlock(returnValue);
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
}else{
successBlock(responseObject);
}
......@@ -185,8 +225,19 @@ static NetworkRequestClassManager *manager = nil;
@try {
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[Notification postNotificationName:LOGINTIMEOUT object:nil];
// [XBLoadingView hideHUDViewWithDefault];
// [Notification postNotificationName:LOGINTIMEOUT object:nil];
//自动登录
[self automaticLoginWithReturnValueBlock:^(id returnValue) {
[self networkWithDictionaryRequestWithURL:requestURLString withRequestType:requestType withParameter:parameter withReturnValueBlock:^(id returnValue) {
successBlock(returnValue);
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
} withFailureBlock:^(NSError *error) {
failureBlock(error);
}];
}else{
successBlock(responseObject);
}
......@@ -202,7 +253,6 @@ static NetworkRequestClassManager *manager = nil;
/**
* 下载PDF
*
......@@ -288,6 +338,35 @@ static NetworkRequestClassManager *manager = nil;
}
/**
自动登录
@param successBlock 登录成功
@param failureBlock 登录失败
*/
- (void)automaticLoginWithReturnValueBlock:(ReturnValueBlock)successBlock
withFailureBlock:(FailureBlock)failureBlock
{
LoginInfo *login = [[LoginInfo alloc]init];
login.username = [Shoppersmanager manager].userNameString;
login.password = [Shoppersmanager manager].passWordString;
[XBLoadingView showHUDViewWithDefault];
[self networkRequestWithURL:SERVERREQUESTURL(LOGIN) withRequestType:ZERO withParameter:login withReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if (RESULT(returnValue)) {
LoginResult *result = [[LoginResult alloc]initWithDictionary:RESPONSE(returnValue) error:nil];
[Shoppersmanager manager].shoppers = result;
successBlock(result);
}else
{
[XBLoadingView showHUDViewWithText:MESSAGE(returnValue)];
}
}withFailureBlock:^(NSError *error) {
[XBLoadingView showHUDViewWithText:error.localizedDescription];
failureBlock(error);
}];
}
......
......@@ -442,7 +442,8 @@
#pragma mark -查询购物车数量
- (void)queryShoppingCarNumber
{
[HTTP networkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@",SERVERREQUESTURL(QUERYSHOPPINGBAGNUMBER),[Customermanager manager].model.fid] withRequestType:ONE withParameter:nil withReturnValueBlock:^(id returnValue) {
NSString *urlString = [NSString stringWithFormat:SERVERREQUESTURL(QUERYSHOPPINGBAGNUMBER),[Customermanager manager].model.fid];
[HTTP networkWithDictionaryRequestWithURL:urlString withRequestType:ONE withParameter:nil withReturnValueBlock:^(id returnValue) {
if (RESULT(returnValue)) {
NSLog(@"更新购物车数量成功");
......
......@@ -123,10 +123,16 @@
#define GuideReplaceImage [UIImage imageNamed:@"manager"]
/**
* 客户默认显示头像
* 论坛客户默认显示头像
*/
#define CoustomerReplaceImage [UIImage imageNamed:@"user"]
/**
* 客户默认显示头像
*/
#define ReplaceImage [UIImage imageNamed:@"矢量智能对象"]
/**
* 弱引用
*/
......
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