Commit 4da09d93 authored by 曹云霄's avatar 曹云霄

修改项说明:修改促销机制,统一选择

parent 4504075d
......@@ -159,7 +159,7 @@
for (int j=0; j<order.eCards.count; j++) {
TOJingdongEcardEntity *ecard = order.eCards[j];
if ([eCardNumber isEqualToString:ecard.cardNumber]) {
ecard.state = @"used";
ecard.state = USED;
[self.beenUseCardCollectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:j inSection:i]]];
}
}
......
//
// CustomPromotionModel.h
// Lighting
//
// Created by 曹云霄 on 2016/11/15.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <JSONModel/JSONModel.h>
#import <Foundation/Foundation.h>
@interface CustomPromotionModel : JSONModel
// 奖品描述
@property (nonatomic,copy) NSString *descriptionString;
// 是否选中
@property (nonatomic,assign) BOOL isSelected;
// 优先级
@property (nonatomic,assign) NSInteger priority;
// 冲突列表
@property (nonatomic,strong) NSArray *conflicts;
// 促销对象
@property (nonatomic, copy) NSString *body;
// 类型
@property (nonatomic, copy) NSString *type;
- (instancetype)initCustomPromotionModel:(JSONModel *)model;
@end
//
// CustomPromotionModel.m
// Lighting
//
// Created by 曹云霄 on 2016/11/15.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "CustomPromotionModel.h"
#import "PromotionLuckyDrawModel.h"
#import "PromotionalGoodsModel.h"
#import "PromotionalDeductionModel.h"
#import "PromotionWeChatCardModel.h"
@implementation CustomPromotionModel
- (instancetype)initCustomPromotionModel:(JSONModel *)model
{
if (self = [super init]) {
//微信卡劵
if ([model isMemberOfClass:[PromotionWeChatCardModel class]]) {
PromotionWeChatCardModel *weChatModel = (PromotionWeChatCardModel *)model;
self.descriptionString = weChatModel.descriptionString;
self.type = weChatModel.type;
self.body = weChatModel.body;
self.conflicts = weChatModel.conflicts;
self.priority = weChatModel.priority;
}else if ([model isMemberOfClass:[PromotionalDeductionModel class]]) {
//抵扣
PromotionalDeductionModel *deductionModel = (PromotionalDeductionModel *)model;
self.descriptionString = deductionModel.descriptionString;
self.type = deductionModel.type;
self.body = deductionModel.body;
self.conflicts = deductionModel.conflicts;
self.priority = deductionModel.priority;
}else if ([model isMemberOfClass:[PromotionLuckyDrawModel class]]) {
//抽奖
PromotionLuckyDrawModel *drawModel = (PromotionLuckyDrawModel *)model;
self.descriptionString = drawModel.descriptionString;
self.type = drawModel.type;
self.body = drawModel.body;
self.conflicts = drawModel.conflicts;
self.priority = drawModel.priority;
}else if ([model isMemberOfClass:[PromotionalGoodsModel class]]) {
//送商品
PromotionalGoodsModel *goodsModel = (PromotionalGoodsModel *)model;
self.descriptionString = goodsModel.descriptionString;
self.type = goodsModel.type;
self.body = goodsModel.body;
self.conflicts = goodsModel.conflicts;
self.priority = goodsModel.priority;
}
}
return self;
}
@end
......@@ -68,11 +68,29 @@
return _model;
}
#pragma mark -渲染完成
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}
#pragma mark -视图即将消失
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = YES;
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self uiConfigAction];
}
......@@ -96,10 +114,10 @@
//经销商代码
self.model.resellerCodeEquals = [[Shoppersmanager manager].Shoppers.employee.currentDepart orgCode];
//下拉刷新
__weak typeof(self) weakSelf = self;
WS(weakSelf);
MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
self.indexPage = 1;
self.indexPage = ONE;
DataPage *page = [[DataPage alloc]init];
page.page = weakSelf.indexPage;
page.rows = KROWS;
......
......@@ -8,6 +8,20 @@
#import "BaseViewController.h"
/**
抽奖状态
- ALLDRAW: 所有状态
- NOTDRAW: 未抽奖
- USEDDRAW: 已抽奖
*/
typedef NS_ENUM(NSInteger, DRAWSTATE) {
ALLDRAW = 0,
NOTDRAW,
USEDDRAW
};
@interface LuckyDrawDetailsViewController : BaseViewController
......
......@@ -44,22 +44,21 @@
page.order = SORTDIRECTION_DESC;
_drawModel.page = page;
switch (self.drawValue) {
case 0:
case ALLDRAW:
{
_drawModel.stateEquals = nil;
}
break;
case 1:
case NOTDRAW:
{
_drawModel.stateEquals = INITIAL;
}
break;
case 2:
case USEDDRAW:
{
_drawModel.stateEquals = ACCOMPLISHED;
}
break;
default:
break;
}
......@@ -129,7 +128,6 @@
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
NSLog(@"%@",[self.drawModel toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(LOTTERYED) WithCallClass:weakSelf WithRequestType:ZERO WithParameter:self.drawModel WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
......
......@@ -30,13 +30,15 @@
#import <WebKit/WebKit.h>
#import "PromotionJDECardModel.h"
#import "PromotionWeChatCardModel.h"
#import "PromotionChooseViewController.h"
#import "PromotionChooseNavigationController.h"
NSString *const PROMOTIONALSTRING = @"促销信息";
@interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource,QLPreviewControllerDataSource,WKNavigationDelegate>
@interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource,QLPreviewControllerDataSource,WKNavigationDelegate,confirmPromotionDelegate>
@property (nonatomic,strong) WKWebView *webView;
/**
......@@ -49,15 +51,15 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
*/
@property (nonatomic,copy) NSString *PDFpath;
/**
* 促销信息<商品、折扣>
*/
@property (nonatomic,strong) NSMutableArray *promotionalArray;
///**
// * 促销信息<商品、折扣>
// */
//@property (nonatomic,strong) NSMutableArray *promotionalArray;
/**
* 促销信息<转盘抽奖、京东E卡>
* 已享受促销信息
*/
@property (nonatomic,strong) NSMutableArray *luckyDrawAndJDECardArray;
@property (nonatomic,strong) NSMutableArray *promotionInformationArray;
/**
* 京东E卡
......@@ -70,22 +72,28 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
@property (nonatomic,strong) PromotionLuckDrawResultModel *customerDrawModel;
/**
消费者促销列表
消费者促销列表<自定义>
*/
@property (nonatomic,strong) NSMutableArray *customerPromotionArray;
/**
消费者促销列表<原始>
*/
@property (nonatomic,strong) NSMutableArray *originalCustomerPromotionArray;
@end
@implementation OrderdetailsViewController
#pragma mark - lazy
- (NSMutableArray *)promotionalArray
- (NSMutableArray *)originalCustomerPromotionArray
{
if (!_promotionalArray) {
_promotionalArray = [NSMutableArray array];
if (!_originalCustomerPromotionArray) {
_originalCustomerPromotionArray = [NSMutableArray array];
}
return _promotionalArray;
return _originalCustomerPromotionArray;
}
- (NSMutableArray *)sectionTitle
......@@ -96,12 +104,12 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
return _sectionTitle;
}
- (NSMutableArray *)luckyDrawAndJDECardArray
- (NSMutableArray *)promotionInformationArray
{
if (!_luckyDrawAndJDECardArray) {
_luckyDrawAndJDECardArray = [NSMutableArray array];
if (!_promotionInformationArray) {
_promotionInformationArray = [NSMutableArray array];
}
return _luckyDrawAndJDECardArray;
return _promotionInformationArray;
}
- (NSMutableArray *)customerPromotionArray
......@@ -194,42 +202,32 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSArray *promotionalArray = returnValue[@"data"][@"actions"];
[weakSelf.promotionalArray removeAllObjects];
[weakSelf.luckyDrawAndJDECardArray removeAllObjects];
for (NSDictionary *dict in promotionalArray) {
NSString *type = dict[@"type"];
// 折扣金额
if ([type isEqualToString:deductionAction]) {
PromotionalDeductionModel *deductionModel = [[PromotionalDeductionModel alloc]initWithDictionary:dict error:nil];
deductionModel.isSelected = YES;
if (promotionalArray.count && ![weakSelf.sectionTitle containsObject:PROMOTIONALSTRING]) {
[weakSelf.sectionTitle addObject:PROMOTIONALSTRING];
}
[weakSelf.promotionalArray addObject:deductionModel];
[weakSelf.originalCustomerPromotionArray addObject:deductionModel];
[weakSelf getConsumerAllPromotion:deductionModel withBody:deductionModel.body];
// 赠送商品
}else if ([type isEqualToString:goodsAction]){
PromotionalGoodsModel *goodsModel = [[PromotionalGoodsModel alloc]initWithDictionary:dict error:nil];
goodsModel.isSelected = YES;
if (promotionalArray.count && ![weakSelf.sectionTitle containsObject:PROMOTIONALSTRING]) {
[weakSelf.sectionTitle addObject:PROMOTIONALSTRING];
}
[weakSelf.promotionalArray addObject:goodsModel];
[weakSelf.originalCustomerPromotionArray addObject:goodsModel];
[weakSelf getConsumerAllPromotion:goodsModel withBody:goodsModel.body];
// 京东E卡
}else if ([type isEqualToString:JDECardAction]){
PromotionJDECardModel *deductionModel = [[PromotionJDECardModel alloc]initWithDictionary:dict error:nil];
[weakSelf.luckyDrawAndJDECardArray addObject:deductionModel];
[weakSelf getConsumerAllPromotion:deductionModel withBody:deductionModel.body];
PromotionJDECardModel *JDECardModel = [[PromotionJDECardModel alloc]initWithDictionary:dict error:nil];
[weakSelf.originalCustomerPromotionArray addObject:JDECardModel];
[weakSelf getConsumerAllPromotion:JDECardModel withBody:JDECardModel.body];
// 转盘抽奖
}else if ([type isEqualToString:lotteryAction]){
PromotionLuckyDrawModel *drawModel = [[PromotionLuckyDrawModel alloc]initWithDictionary:dict error:nil];
[weakSelf.luckyDrawAndJDECardArray addObject:drawModel];
[weakSelf.originalCustomerPromotionArray addObject:drawModel];
[weakSelf getConsumerAllPromotion:drawModel withBody:drawModel.body];
}else if ([type isEqualToString:WeChatCard]){
// 微信卡劵
PromotionWeChatCardModel *weChatModel = [[PromotionWeChatCardModel alloc]initWithDictionary:dict error:nil];
NSLog(@"%@",weChatModel);
[weakSelf.originalCustomerPromotionArray addObject:weChatModel];
[weakSelf getConsumerAllPromotion:weChatModel withBody:weChatModel.body];
}
}
......@@ -255,9 +253,9 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
dispatch_group_leave(group);
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[weakSelf.promotionInformationArray removeAllObjects];
[weakSelf.originalCustomerPromotionArray removeAllObjects];
NSArray *promotion = returnValue[@"data"];
[weakSelf.promotionalArray removeAllObjects];
[weakSelf.luckyDrawAndJDECardArray removeAllObjects];
for (NSDictionary *dict in promotion) {
TOOrderPromotionEntity *oldPromotion = [[TOOrderPromotionEntity alloc]initWithDictionary:dict error:nil];
// 赠送商品
......@@ -271,10 +269,10 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
goods.name = oldPromotion.goodsName;
goodsModel.goods = goods;
goodsModel.isSelected = YES;
[weakSelf.promotionalArray addObject:goodsModel];
[weakSelf.promotionInformationArray addObject:goodsModel];
} else if (![BaseViewController isBlankString:[oldPromotion.promotionMoney stringValue]]) {
// 促销金额
// 抵扣金额
if (![weakSelf.sectionTitle containsObject:PROMOTIONALSTRING]) {
[weakSelf.sectionTitle addObject:PROMOTIONALSTRING];
}
......@@ -282,7 +280,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
deductionModel.total = [oldPromotion.promotionMoney integerValue];
deductionModel.isSelected = YES;
deductionModel.type = @"deductionAction";
[weakSelf.promotionalArray addObject:deductionModel];
[weakSelf.promotionInformationArray addObject:deductionModel];
} else if (![BaseViewController isBlankString:[oldPromotion.jdecardDenomation stringValue]]) {
// 京东E卡
......@@ -290,13 +288,18 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
model.total = [oldPromotion.jdecardDenomation integerValue];
model.body = GUIDE;
model.type = JDECardAction;
[weakSelf.luckyDrawAndJDECardArray addObject:model];
[weakSelf.promotionInformationArray addObject:model];
} else if (![BaseViewController isBlankString:[oldPromotion.redPackageCount stringValue]]) {
// 导购抽奖数
PromotionLuckyDrawModel *model = [[PromotionLuckyDrawModel alloc]init];
model.body = GUIDE;
[weakSelf.luckyDrawAndJDECardArray addObject:model];
[weakSelf.promotionInformationArray addObject:model];
} else if (![BaseViewController isBlankString:[oldPromotion.discountRate stringValue]]) {
// 抽奖折扣
PromotionLuckDrawResultModel *model = [[PromotionLuckDrawResultModel alloc]init];
model.number = [oldPromotion.discountRate stringValue];
[weakSelf.promotionInformationArray addObject:model];
}
}
}
......@@ -344,43 +347,123 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
// 完成后回调
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
// 消费者抽奖成功后若没有支付,后面支付时可以继续享受奖品折扣
if ([resultModel.draw.state isEqualToString:ACCOMPLISHED]) {
// 有促销未支付情况
if (weakSelf.isShowPayButton && [weakSelf.orderDetails.order.orderState isEqualToString:NOTPAY] && weakSelf.customerPromotionArray.count) {
PromotionChooseNavigationController *promotionChooseNav = [[weakSelf getStoryboardWithName] instantiateViewControllerWithIdentifier:@"PromotionChooseNavigationController"];
PromotionChooseViewController *promotionChoose = (PromotionChooseViewController *)promotionChooseNav.visibleViewController;
promotionChoose.promotionDelegate = self;
promotionChoose.promotionDatasArray = weakSelf.customerPromotionArray;
promotionChooseNav.preferredContentSize = CGSizeMake(ScreenHeight-300, ScreenHeight-300);
promotionChooseNav.modalPresentationStyle = UIModalPresentationFormSheet;
UIPopoverPresentationController *pop = promotionChooseNav.popoverPresentationController;
pop.permittedArrowDirections = UIPopoverArrowDirectionAny;
pop.sourceView = promotionChooseNav.view;
[self presentViewController:promotionChooseNav animated:YES completion:nil];
}else if ([weakSelf.orderDetails.order.orderState isEqualToString:NOTPAY] && weakSelf.isShowPayButton && !weakSelf.customerPromotionArray.count) {
// 无促销未支付情况
[weakSelf payButtonClickAction];
}else if (![weakSelf.orderDetails.order.orderState isEqualToString:NOTPAY] && resultModel.award) {
// 订单状态不为未支付,且有抽奖结果
weakSelf.customerDrawModel = [PromotionLuckDrawResultModel initializeWith:resultModel];
}
// 支付完成后
if (self.isShowPrintButton && resultModel.award) {
weakSelf.customerDrawModel = [PromotionLuckDrawResultModel initializeWith:resultModel];
// // 消费者抽奖成功后若没有支付,后面支付时可以继续享受奖品折扣
// if ([resultModel.draw.state isEqualToString:ACCOMPLISHED]) {
// weakSelf.customerDrawModel = [PromotionLuckDrawResultModel initializeWith:resultModel];
// }
// // 支付完成后
// if (self.isShowPrintButton && resultModel.award) {
// weakSelf.customerDrawModel = [PromotionLuckDrawResultModel initializeWith:resultModel];
// }
// // 默认弹出支付框
// if (weakSelf.isShowPayButton && [weakSelf.orderDetails.order.orderState isEqualToString:NOTPAY]) {
// // 找出客户抽奖
// for (int i=0;i<weakSelf.luckyDrawAndJDECardArray.count;i++) {
// id object = weakSelf.luckyDrawAndJDECardArray[i];
// if ([object isKindOfClass:[PromotionLuckyDrawModel class]] && !resultModel) {
// PromotionLuckyDrawModel *model = (PromotionLuckyDrawModel *)object;
// if ([model.body isEqualToString:CONSUMER]) {
// [weakSelf queryConsumerLuckyDrawChance:model];
// break;
// }
// }
// // 有促销无抽奖情况
// if (i == weakSelf.luckyDrawAndJDECardArray.count-1) {
// [weakSelf payButtonClickAction];
// }
// }
// // 无促销情况
// if (!weakSelf.luckyDrawAndJDECardArray.count) {
// [weakSelf payButtonClickAction];
// }
// }
if (finish) {
finish();
}
// 默认弹出支付框
if (weakSelf.isShowPayButton && [weakSelf.orderDetails.order.orderState isEqualToString:NOTPAY]) {
// 找出客户抽奖
for (int i=0;i<weakSelf.luckyDrawAndJDECardArray.count;i++) {
id object = weakSelf.luckyDrawAndJDECardArray[i];
if ([object isKindOfClass:[PromotionLuckyDrawModel class]] && !resultModel) {
PromotionLuckyDrawModel *model = (PromotionLuckyDrawModel *)object;
if ([model.body isEqualToString:CONSUMER]) {
[weakSelf queryConsumerLuckyDrawChance:model];
break;
[weakSelf.orderDetailsTableview reloadData];
});
}
#pragma mark - 选择消费者促销项回调
- (void)confirmChoosePromotion:(NSArray<CustomPromotionModel *> *)promotionArray
{
for (CustomPromotionModel *promotionModel in promotionArray) {
for (JSONModel *originalModel in self.originalCustomerPromotionArray) {
//微信卡劵
if ([originalModel isMemberOfClass:[PromotionWeChatCardModel class]]) {
PromotionWeChatCardModel *weChatModel = (PromotionWeChatCardModel *)originalModel;
if ([weChatModel.body isEqualToString:promotionModel.body] && [weChatModel.type isEqualToString:promotionModel.type] && [weChatModel.descriptionString isEqualToString:promotionModel.descriptionString] && weChatModel.priority == promotionModel.priority && [weChatModel.conflicts isEqualToArray:promotionModel.conflicts]) {
weChatModel.isSelected = YES;
[self.promotionInformationArray addObject:weChatModel];
}
}else if ([originalModel isMemberOfClass:[PromotionalDeductionModel class]]) {
//抵扣
PromotionalDeductionModel *deductionModel = (PromotionalDeductionModel *)originalModel;
if ([deductionModel.body isEqualToString:promotionModel.body] && [deductionModel.type isEqualToString:promotionModel.type] && [deductionModel.descriptionString isEqualToString:promotionModel.descriptionString] && deductionModel.priority == promotionModel.priority && [deductionModel.conflicts isEqualToArray:promotionModel.conflicts]) {
deductionModel.isSelected = YES;
[self.promotionInformationArray addObject:deductionModel];
}
}else if ([originalModel isMemberOfClass:[PromotionLuckyDrawModel class]]) {
//抽奖
PromotionLuckyDrawModel *drawModel = (PromotionLuckyDrawModel *)originalModel;
if ([drawModel.body isEqualToString:promotionModel.body] && [drawModel.type isEqualToString:promotionModel.type] && [drawModel.descriptionString isEqualToString:promotionModel.descriptionString] && drawModel.priority == promotionModel.priority && [drawModel.conflicts isEqualToArray:promotionModel.conflicts]) {
drawModel.isSelected = YES;
[self.promotionInformationArray addObject:drawModel];
}
}else if ([originalModel isMemberOfClass:[PromotionalGoodsModel class]]) {
//送商品
PromotionalGoodsModel *goodsModel = (PromotionalGoodsModel *)originalModel;
if ([goodsModel.body isEqualToString:promotionModel.body] && [goodsModel.type isEqualToString:promotionModel.type] && [goodsModel.descriptionString isEqualToString:promotionModel.descriptionString] && goodsModel.priority == promotionModel.priority && [goodsModel.conflicts isEqualToArray:promotionModel.conflicts]) {
goodsModel.isSelected = YES;
[self.promotionInformationArray addObject:goodsModel];
}
}
// 有促销无抽奖情况
if (i == weakSelf.luckyDrawAndJDECardArray.count-1) {
[weakSelf payButtonClickAction];
}
}
// 无促销情况
if (!weakSelf.luckyDrawAndJDECardArray.count) {
[weakSelf payButtonClickAction];
if (self.promotionInformationArray.count) {
[self.sectionTitle addObject:@"促销信息"];
}
// 如果已选中的促销中有抽奖,优先实行
for (int i=0;i<self.promotionInformationArray.count;i++) {
JSONModel *model = self.promotionInformationArray[i];
if ([model isMemberOfClass:[PromotionLuckyDrawModel class]]) {
[self queryConsumerLuckyDrawChance:(PromotionLuckyDrawModel *)model];break;
}
if (finish) {
finish();
// 微信卡劵支付
if ([model isMemberOfClass:[PromotionWeChatCardModel class]]) {
}
[weakSelf.orderDetailsTableview reloadData];
});
// 直接支付
if (i == self.promotionInformationArray.count - 1) {
[self payButtonClickAction];
}
}
[self.orderDetailsTableview reloadData];
}
#pragma mark - 获取关于消费者的所有促销
- (void)getConsumerAllPromotion:(JSONModel *)model withBody:(NSString *)body
{
......@@ -487,7 +570,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
UIButton *payButton = [UIButton buttonWithType:UIButtonTypeSystem];
payButton.frame = CGRectMake((ScreenWidth-150)/2, 30, 150, 40);
[payButton setTitle:@"支付" forState:UIControlStateNormal];
payButton.titleLabel.font = [UIFont systemFontOfSize:12];
payButton.titleLabel.font = [UIFont systemFontOfSize:15];
[payButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[payButton addTarget:self action:@selector(payButtonClickAction) forControlEvents:UIControlEventTouchUpInside];
payButton.backgroundColor = kMainBlueColor;
......@@ -522,11 +605,12 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
- (void)queryGuideLuckyDrawChanceisTrue:(void(^)())finish
{
// 查询是否有导购抽奖机会
for (id object in self.luckyDrawAndJDECardArray) {
for (id object in self.promotionInformationArray) {
if ([object isKindOfClass:[PromotionLuckyDrawModel class]]) {
PromotionLuckyDrawModel *model = (PromotionLuckyDrawModel *)object;
if ([model.body isEqualToString:GUIDE]) {
finish();
[self.promotionInformationArray removeObject:object];
break;
}
}
......@@ -539,8 +623,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
SettlementViewController *settlement = [[SettlementViewController alloc]init];
settlement.preferredContentSize = CGSizeMake(380, 500);
settlement.goodsArray = self.orderDetails.orderdetailList;
settlement.promotionalArray = self.promotionalArray;
settlement.luckyDrawAndJDECardArray = self.luckyDrawAndJDECardArray;
settlement.promotionalArray = self.promotionInformationArray;
settlement.orderCode = self.orderCode;
settlement.resultModel = self.customerDrawModel;
settlement.modalPresentationStyle = UIModalPresentationFormSheet;
......@@ -565,7 +648,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
// 刷新数据成功
[weakSelf getOrderDetailsData:^{
// 先判断促销中有无京东E卡,有则认为发放成功
for (id object in weakSelf.luckyDrawAndJDECardArray) {
for (id object in weakSelf.promotionInformationArray) {
if ([object isKindOfClass:[PromotionJDECardModel class]]) {
PromotionJDECardModel *model = (PromotionJDECardModel *)object;
if ([model.body isEqualToString:GUIDE] && [model.type isEqualToString:JDECardAction]) {
......@@ -607,7 +690,6 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
......@@ -625,7 +707,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
break;
case 5:
{
return self.promotionalArray.count;
return self.promotionInformationArray.count;
}
break;
default:
......@@ -666,7 +748,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
//商品总计
AllpriceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"sixthcell" forIndexPath:indexPath];
cell.model = self.customerDrawModel;
cell.promotionalArray = self.promotionalArray;
cell.promotionalArray = self.promotionInformationArray;
cell.goodsArray = self.orderDetails.orderdetailList;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
......@@ -691,19 +773,8 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
case 5://促销信息
{
PromotionalTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PromotionalTableViewCell" forIndexPath:indexPath];
NSString *describe = nil;
cell.userInteractionEnabled = self.isUserInteractionEnabled;
id object = self.promotionalArray[indexPath.row];
if ([object isKindOfClass:[PromotionalGoodsModel class]]) {
PromotionalGoodsModel *goodsModel = object;
cell.accessoryType = goodsModel.isSelected?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
describe = [NSString stringWithFormat:@"赠送商品:%@%ld",goodsModel.goods.name,goodsModel.count];
}else if ([object isKindOfClass:[PromotionalDeductionModel class]]){
PromotionalDeductionModel *deductionModel = self.promotionalArray[indexPath.row];
cell.accessoryType = deductionModel.isSelected?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
describe = [NSString stringWithFormat:@"抵扣金额:%ld",deductionModel.total];
}
cell.promotionalTitleLabel.text = describe;
cell.promotionModel = self.promotionInformationArray[indexPath.row];
return cell;
}
break;
......@@ -779,21 +850,21 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 5 && self.isUserInteractionEnabled) {
PromotionalTableViewCell *promotionalCell = [tableView cellForRowAtIndexPath:indexPath];
id object = self.promotionalArray[indexPath.row];
if ([object isKindOfClass:[PromotionalGoodsModel class]]) {
PromotionalGoodsModel *goodsModel = object;
goodsModel.isSelected = !goodsModel.isSelected;
promotionalCell.accessoryType = goodsModel.isSelected?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
}else if ([object isKindOfClass:[PromotionalDeductionModel class]]){
PromotionalDeductionModel *deductionModel = object;
deductionModel.isSelected = !deductionModel.isSelected;
promotionalCell.accessoryType = deductionModel.isSelected?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
// 刷新总金额
[self.orderDetailsTableview reloadData];
}
}
// if (indexPath.section == 5 && self.isUserInteractionEnabled) {
// PromotionalTableViewCell *promotionalCell = [tableView cellForRowAtIndexPath:indexPath];
// id object = self.promotionInformationArray[indexPath.row];
// if ([object isKindOfClass:[PromotionalGoodsModel class]]) {
// PromotionalGoodsModel *goodsModel = object;
// goodsModel.isSelected = !goodsModel.isSelected;
// promotionalCell.accessoryType = goodsModel.isSelected?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
// }else if ([object isKindOfClass:[PromotionalDeductionModel class]]){
// PromotionalDeductionModel *deductionModel = object;
// deductionModel.isSelected = !deductionModel.isSelected;
// promotionalCell.accessoryType = deductionModel.isSelected?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
// // 刷新总金额
// [self.orderDetailsTableview reloadData];
// }
// }
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
......
//
// PromotionChooseNavigationController.h
// Lighting
//
// Created by 曹云霄 on 2016/11/14.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PromotionChooseNavigationController : UINavigationController
@end
//
// PromotionChooseNavigationController.m
// Lighting
//
// Created by 曹云霄 on 2016/11/14.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "PromotionChooseNavigationController.h"
@interface PromotionChooseNavigationController ()
@end
@implementation PromotionChooseNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.navigationBar.translucent = NO;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// PromotionChooseTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 2016/11/14.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CustomPromotionModel.h"
@interface PromotionChooseTableViewCell : UITableViewCell
/**
促销模型
*/
@property (nonatomic,strong) CustomPromotionModel *promotionModel;
@end
//
// PromotionChooseTableViewCell.m
// Lighting
//
// Created by 曹云霄 on 2016/11/14.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "PromotionChooseTableViewCell.h"
#import "PromotionWeChatCardModel.h"
#import "PromotionalGoodsModel.h"
#import "PromotionalDeductionModel.h"
#import "PromotionLuckyDrawModel.h"
@implementation PromotionChooseTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
self.textLabel.font = [UIFont systemFontOfSize:12];
}
- (void)setPromotionModel:(CustomPromotionModel *)promotionModel
{
self.textLabel.text = promotionModel.descriptionString;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@end
......@@ -7,7 +7,32 @@
//
#import "BaseViewController.h"
#import "CustomPromotionModel.h"
/**
确认选择促销条件后
*/
@protocol confirmPromotionDelegate <NSObject>
@optional
- (void)confirmChoosePromotion:(NSArray<CustomPromotionModel *>*)promotionArray;
@end
@interface PromotionChooseViewController : BaseViewController
@property (nonatomic,weak) id<confirmPromotionDelegate>promotionDelegate;
/**
选择促销
*/
@property (weak, nonatomic) IBOutlet UITableView *promotionChooseTableView;
/**
消费者促销列表
*/
@property (nonatomic,copy) NSArray <JSONModel*>*promotionDatasArray;
@end
......@@ -7,31 +7,131 @@
//
#import "PromotionChooseViewController.h"
#import "PromotionChooseTableViewCell.h"
#import "PromotionWeChatCardModel.h"
#import "PromotionalGoodsModel.h"
#import "PromotionalDeductionModel.h"
#import "PromotionLuckyDrawModel.h"
@interface PromotionChooseViewController ()
@interface PromotionChooseViewController ()<UITableViewDelegate,UITableViewDataSource>
/**
自定义促销列表
*/
@property (nonatomic,strong) NSMutableArray *customPromotionDatas;
@end
@implementation PromotionChooseViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setUpTableView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
#pragma mark - 数据源
- (void)setPromotionDatasArray:(NSArray<JSONModel *> *)promotionDatasArray
{
_promotionDatasArray = promotionDatasArray;
NSMutableArray *promotionArray = [NSMutableArray array];
[_promotionDatasArray enumerateObjectsUsingBlock:^(JSONModel * _Nonnull model, NSUInteger index, BOOL * _Nonnull stop) {
CustomPromotionModel *promotionModel = [[CustomPromotionModel alloc]initCustomPromotionModel:model];
[promotionArray addObject:promotionModel];
}];
//促销列表按降序排列
self.customPromotionDatas = [NSMutableArray arrayWithArray:[promotionArray sortedArrayUsingComparator:^NSComparisonResult(CustomPromotionModel *obj1, CustomPromotionModel *obj2) {
if (obj1.priority < obj2.priority) {
return NSOrderedAscending;
}
if (obj1.priority < obj2.priority) {
return NSOrderedDescending;
}
return NSOrderedSame;
}]];
[self calculatedPromotionConflicts:0];
}
#pragma mark - 选择促销后计算是否存在冲突
- (void)calculatedPromotionConflicts:(NSInteger)cellIndex
{
WS(weakSelf);
//默认选中最高级别促销及衍生促销
CustomPromotionModel *promotionModel = self.customPromotionDatas[cellIndex];
if (promotionModel.isSelected) {
return;
}else {
for (CustomPromotionModel *model in self.customPromotionDatas) {
model.isSelected = NO;
}
promotionModel.isSelected = YES;
}
[self.customPromotionDatas enumerateObjectsUsingBlock:^(CustomPromotionModel *model1, NSUInteger index, BOOL * _Nonnull stop) {
if (![promotionModel.conflicts containsObject:model1.type] && ![model1.conflicts containsObject:promotionModel.type]) {
for (int i=0;i<weakSelf.customPromotionDatas.count;i++) {
CustomPromotionModel *model2 = weakSelf.customPromotionDatas[i];
if (![model2.conflicts containsObject:model1.type] && ![model1.conflicts containsObject:model2.type] && ![model2 isEqual:promotionModel]) {
model1.isSelected = YES;
}
}
}else {
model1.isSelected = NO;
}
}];
[self.promotionChooseTableView reloadData];
}
#pragma mark - UITableview
- (void)setUpTableView
{
self.promotionChooseTableView.tableFooterView = [UIView new];
}
#pragma mark - <UITableViewDelegate,UITableViewDataSource>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
PromotionChooseTableViewCell *chooseCell = [tableView dequeueReusableCellWithIdentifier:@"PromotionChooseTableViewCell" forIndexPath:indexPath];
CustomPromotionModel *model = self.customPromotionDatas[indexPath.row];
chooseCell.promotionModel = model;
chooseCell.accessoryType = model.isSelected?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
chooseCell.selectionStyle = UITableViewCellSelectionStyleNone;
return chooseCell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.customPromotionDatas.count;
}
/*
#pragma mark - Navigation
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self calculatedPromotionConflicts:indexPath.row];
}
#pragma mark - 退出促销条件选择
- (IBAction)dismissPromotionChooseNavigation:(UIBarButtonItem *)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
#pragma mark - 确认促销条件选择
- (IBAction)confirmPromotionChoose:(UIBarButtonItem *)sender {
[self dismissViewControllerAnimated:YES completion:nil];
if ([self.promotionDelegate respondsToSelector:@selector(confirmChoosePromotion:)]) {
NSMutableArray *chooseArray = [NSMutableArray array];
for (CustomPromotionModel *model in self.customPromotionDatas) {
if (model.isSelected) {
[chooseArray addObject:model];
}
}
[self.promotionDelegate confirmChoosePromotion:chooseArray];
}
}
*/
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
......@@ -10,4 +10,15 @@
@implementation PromotionJDECardModel
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
return YES;
}
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc]initWithDictionary:@{@"description":@"descriptionString"}];
}
@end
......@@ -32,6 +32,8 @@
// 冲突列表
@property (nonatomic,strong) NSArray *conflicts;
// 是否选中
@property (nonatomic,assign) BOOL isSelected;
@end
......
......@@ -22,7 +22,7 @@
//** 描述 */
@property (nonatomic, copy) NSString *descriptionString;
//** 是否选中 */
// 是否选中
@property (nonatomic,assign) BOOL isSelected;
// 优先级
......
......@@ -10,4 +10,14 @@
@implementation PromotionWeChatCardModel
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
return YES;
}
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc]initWithDictionary:@{@"description":@"descriptionString"}];
}
@end
......@@ -16,4 +16,10 @@
*/
@property (weak, nonatomic) IBOutlet UILabel *promotionalTitleLabel;
/**
促销信息
*/
@property (nonatomic,copy) JSONModel *promotionModel;
@end
......@@ -7,6 +7,10 @@
//
#import "PromotionalTableViewCell.h"
#import "PromotionLuckyDrawModel.h"
#import "PromotionalGoodsModel.h"
#import "PromotionalDeductionModel.h"
#import "PromotionWeChatCardModel.h"
@implementation PromotionalTableViewCell
......@@ -15,10 +19,31 @@
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
- (void)setPromotionModel:(JSONModel *)promotionModel
{
_promotionModel = promotionModel;
//微信卡劵
if ([promotionModel isMemberOfClass:[PromotionWeChatCardModel class]]) {
PromotionWeChatCardModel *weChatModel = (PromotionWeChatCardModel *)promotionModel;
self.promotionalTitleLabel.text = [NSString stringWithFormat:@"使用微信卡劵: %@",weChatModel.descriptionString];
}else if ([promotionModel isMemberOfClass:[PromotionalDeductionModel class]]) {
//抵扣
PromotionalDeductionModel *deductionModel = (PromotionalDeductionModel *)promotionModel;
self.promotionalTitleLabel.text = [NSString stringWithFormat:@"抵扣: %@",deductionModel.descriptionString];
}else if ([promotionModel isMemberOfClass:[PromotionLuckyDrawModel class]]) {
//抽奖
PromotionLuckyDrawModel *drawModel = (PromotionLuckyDrawModel *)promotionModel;
self.promotionalTitleLabel.text = [NSString stringWithFormat:@"转盘抽奖: %@",drawModel.descriptionString];
}else if ([promotionModel isMemberOfClass:[PromotionalGoodsModel class]]) {
//送商品
PromotionalGoodsModel *goodsModel = (PromotionalGoodsModel *)promotionModel;
self.promotionalTitleLabel.text = [NSString stringWithFormat:@"赠送商品: %@",goodsModel.descriptionString];
}
self.accessoryType = UITableViewCellAccessoryCheckmark;
}
@end
......@@ -123,7 +123,7 @@
//下拉刷新
MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
//默认数据
self.indexPage = 1;
self.indexPage = ONE;
DataPage *page = [[DataPage alloc]init];
page.page = self.indexPage;
page.rows = KROWS;
......@@ -159,7 +159,7 @@
- (void)getdatasAction
{
WS(weakSelf);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(SCENESCREENING) WithCallClass:weakSelf WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(SCENESCREENING) WithCallClass:weakSelf WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
......@@ -184,7 +184,7 @@
{
[self CreateMBProgressHUDLoding];
WS(weakSelf);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(SCENELIST) WithCallClass:weakSelf WithRequestType:0 WithParameter:condition WithReturnValueBlock:^(id returnValue) {
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(SCENELIST) WithCallClass:weakSelf WithRequestType:ZERO WithParameter:condition WithReturnValueBlock:^(id returnValue) {
weakSelf.seceneLibararyCollectionView.emptyDataSetSource = weakSelf;
weakSelf.seceneLibararyCollectionView.emptyDataSetDelegate = weakSelf;
......@@ -252,7 +252,6 @@
#pragma mark -筛选风格
- (void)screeningStyleButtonClick:(UIButton *)sender {
NSMutableArray *styleArray = [NSMutableArray arrayWithArray:self.filter.styles];
DataDict *style = [[DataDict alloc]init];
style.typeName = @"全部";
......
......@@ -20,14 +20,14 @@
@property (nonatomic,strong) NSArray *goodsArray;
/**
* 促销信息(赠送商品、抵扣)
* 促销信息
*/
@property (nonatomic,strong) NSArray *promotionalArray;
/**
* 促销信息(京东E卡、抽奖)
*/
@property (nonatomic,strong) NSArray *luckyDrawAndJDECardArray;
///**
// * 促销信息(京东E卡、抽奖)
// */
//@property (nonatomic,strong) NSArray *luckyDrawAndJDECardArray;
/**
* 商品总数量
......@@ -74,56 +74,46 @@
*/
@property (weak, nonatomic) IBOutlet UIButton *ISinvoiceButton;
/**
* 发票类型
*/
@property (weak, nonatomic) IBOutlet UIButton *invoiceType;
/**
* 发票抬头
*/
@property (weak, nonatomic) IBOutlet UITextField *invoiceHeader;
/**
* 发票抬头背景
*/
@property (weak, nonatomic) IBOutlet UIView *invoiceBackView;
/**
* 取消
*/
@property (weak, nonatomic) IBOutlet UIButton *cancelButton;
/**
* 确认
*/
@property (weak, nonatomic) IBOutlet UIButton *sureButton;
/**
* 订单编号
*/
@property (nonatomic,copy) NSString *orderCode;
/**
* 京东E卡总额度
*/
@property (nonatomic,assign) NSInteger jdCardDenomation;
/**
* 支付成功回调
*/
@property (nonatomic,copy) void(^PaySuccessReturnBlock)();
/**
* 背景Scrollview
*/
......
......@@ -342,7 +342,7 @@
order.promotionMoney = @(promotionMoney);
// 查询是否有京东E卡促销
NSInteger totalNumber = 0;
for (id object in self.luckyDrawAndJDECardArray) {
for (id object in self.promotionalArray) {
if ([object isKindOfClass:[PromotionJDECardModel class]]) {
PromotionJDECardModel *model = (PromotionJDECardModel *)object;
if ([model.type isEqualToString:JDECardAction] && [model.body isEqualToString:GUIDE]) {
......@@ -352,7 +352,7 @@
}
order.jdCardDenomation = totalNumber;
// 查询是否有导购抽奖机会
for (id object in self.luckyDrawAndJDECardArray) {
for (id object in self.promotionalArray) {
if ([object isKindOfClass:[PromotionLuckyDrawModel class]]) {
PromotionLuckyDrawModel *model = (PromotionLuckyDrawModel *)object;
if ([model.body isEqualToString:GUIDE]) {
......
......@@ -22,7 +22,6 @@
#import "QRViewController.h"
#import "ExperienceCentreViewController.h"
#import "RebateViewController.h"
#import <AVFoundation/AVFoundation.h>
@interface CustomTabbarController ()<TabbarButtonClickdelegate,ChangpasswordDelegate,CancelButtondelegate,UITextFieldDelegate>
......@@ -252,22 +251,16 @@
- (void)QrcodeButtonClick
{
WS(weakSelf);
//判断权限
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(status !=AVAuthorizationStatusAuthorized) {
// 判断应用是否有使用相机的权限
if(![BaseViewController determineCameraPermissions]){
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:@"请在iPad的“设置-隐私-相机”选项中,允许欧立方访问你的相机" preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"去设置" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
NSURL * url = [NSURL URLWithString:@"prefs:root=com.gomore.opple"];
dispatch_after(0.2, dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication]openURL:url];
});
}]];
[alertVC addAction:[UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[weakSelf dismissViewControllerAnimated:YES completion:nil];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}]];
[self presentViewController:alertVC animated:YES completion:nil];
}else {
QRViewController *qrVC = [[QRViewController alloc] initWithScanCompleteHandler:^(NSString *url) {
[weakSelf dismissViewControllerAnimated:YES completion:^{
......
......@@ -154,11 +154,14 @@
29D0DCE11DD9B04A00729692 /* PromotionChooseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D0DCE01DD9B04A00729692 /* PromotionChooseViewController.m */; };
29D0DCE41DD9B78500729692 /* PromotionJDECardModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D0DCE31DD9B78500729692 /* PromotionJDECardModel.m */; };
29D0DCEA1DD9B80700729692 /* PromotionWeChatCardModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D0DCE91DD9B80700729692 /* PromotionWeChatCardModel.m */; };
29D0DCED1DD9C59900729692 /* PromotionChooseTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D0DCEC1DD9C59900729692 /* PromotionChooseTableViewCell.m */; };
29D0DCF01DD9CABB00729692 /* PromotionChooseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D0DCEF1DD9CABB00729692 /* PromotionChooseNavigationController.m */; };
29D260F51CEEAE2800A9787D /* FullScreenViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D260F41CEEAE2800A9787D /* FullScreenViewController.m */; };
29D260F81CEEAF2D00A9787D /* FullScreenViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D260F71CEEAF2D00A9787D /* FullScreenViewCell.m */; };
29D260FB1CEECDFF00A9787D /* goodsDetailsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D260FA1CEECDFF00A9787D /* goodsDetailsTableViewCell.m */; };
29D260FD1CEED53400A9787D /* goodsDetailsTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 29D260FC1CEED53400A9787D /* goodsDetailsTableViewCell.xib */; };
29D261001CEEF16D00A9787D /* MjRefreshHeaderCustom.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D260FF1CEEF16D00A9787D /* MjRefreshHeaderCustom.m */; };
29D39E4E1DDAAD2B0009FF89 /* CustomPromotionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D39E4D1DDAAD2B0009FF89 /* CustomPromotionModel.m */; };
29D991DF1DCAE5B700840776 /* PromotionLuckyDrawModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D991DE1DCAE5B700840776 /* PromotionLuckyDrawModel.m */; };
29E28CE81CE0B91B00812A55 /* HENLENSONG.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E28CE71CE0B91B00812A55 /* HENLENSONG.m */; };
29E2D3201DB8737000443170 /* CardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E2D31F1DB8737000443170 /* CardViewController.m */; };
......@@ -474,6 +477,10 @@
29D0DCE31DD9B78500729692 /* PromotionJDECardModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PromotionJDECardModel.m; sourceTree = "<group>"; };
29D0DCE81DD9B80700729692 /* PromotionWeChatCardModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PromotionWeChatCardModel.h; sourceTree = "<group>"; };
29D0DCE91DD9B80700729692 /* PromotionWeChatCardModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PromotionWeChatCardModel.m; sourceTree = "<group>"; };
29D0DCEB1DD9C59900729692 /* PromotionChooseTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PromotionChooseTableViewCell.h; sourceTree = "<group>"; };
29D0DCEC1DD9C59900729692 /* PromotionChooseTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PromotionChooseTableViewCell.m; sourceTree = "<group>"; };
29D0DCEE1DD9CABB00729692 /* PromotionChooseNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PromotionChooseNavigationController.h; sourceTree = "<group>"; };
29D0DCEF1DD9CABB00729692 /* PromotionChooseNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PromotionChooseNavigationController.m; sourceTree = "<group>"; };
29D260F31CEEAE2800A9787D /* FullScreenViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FullScreenViewController.h; sourceTree = "<group>"; };
29D260F41CEEAE2800A9787D /* FullScreenViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FullScreenViewController.m; sourceTree = "<group>"; };
29D260F61CEEAF2D00A9787D /* FullScreenViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FullScreenViewCell.h; sourceTree = "<group>"; };
......@@ -483,6 +490,8 @@
29D260FC1CEED53400A9787D /* goodsDetailsTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = goodsDetailsTableViewCell.xib; sourceTree = "<group>"; };
29D260FE1CEEF16D00A9787D /* MjRefreshHeaderCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MjRefreshHeaderCustom.h; sourceTree = "<group>"; };
29D260FF1CEEF16D00A9787D /* MjRefreshHeaderCustom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MjRefreshHeaderCustom.m; sourceTree = "<group>"; };
29D39E4C1DDAAD2B0009FF89 /* CustomPromotionModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomPromotionModel.h; sourceTree = "<group>"; };
29D39E4D1DDAAD2B0009FF89 /* CustomPromotionModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomPromotionModel.m; sourceTree = "<group>"; };
29D991DD1DCAE5B700840776 /* PromotionLuckyDrawModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PromotionLuckyDrawModel.h; sourceTree = "<group>"; };
29D991DE1DCAE5B700840776 /* PromotionLuckyDrawModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PromotionLuckyDrawModel.m; sourceTree = "<group>"; };
29E28CE61CE0B91B00812A55 /* HENLENSONG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HENLENSONG.h; sourceTree = "<group>"; };
......@@ -754,6 +763,8 @@
29D991DE1DCAE5B700840776 /* PromotionLuckyDrawModel.m */,
29B3EE6B1DCE0B390065FCCF /* PromotionLuckDrawResultModel.h */,
29B3EE6C1DCE0B390065FCCF /* PromotionLuckDrawResultModel.m */,
29D39E4C1DDAAD2B0009FF89 /* CustomPromotionModel.h */,
29D39E4D1DDAAD2B0009FF89 /* CustomPromotionModel.m */,
);
name = model;
sourceTree = "<group>";
......@@ -1319,6 +1330,8 @@
2903F93C1DBE57F4003CC6B1 /* JDEcardViewController.m */,
29D0DCDF1DD9B04A00729692 /* PromotionChooseViewController.h */,
29D0DCE01DD9B04A00729692 /* PromotionChooseViewController.m */,
29D0DCEE1DD9CABB00729692 /* PromotionChooseNavigationController.h */,
29D0DCEF1DD9CABB00729692 /* PromotionChooseNavigationController.m */,
29A8D3951CD85A3C004D558F /* Clientdetails */,
);
name = controller;
......@@ -1344,6 +1357,8 @@
2921F2F71DB5C7E400D6439B /* OrderDetailsSectionHeaderView.m */,
2921F3041DB5F27A00D6439B /* PromotionalTableViewCell.h */,
2921F3051DB5F27A00D6439B /* PromotionalTableViewCell.m */,
29D0DCEB1DD9C59900729692 /* PromotionChooseTableViewCell.h */,
29D0DCEC1DD9C59900729692 /* PromotionChooseTableViewCell.m */,
);
name = view;
sourceTree = "<group>";
......@@ -1911,10 +1926,13 @@
2908870B1CE5A308000B7097 /* DateSelectedViewController.m in Sources */,
299876271CD9837C00C90D0A /* OrderTableViewCell.m in Sources */,
295DEA9F1DB71EFC006ED4A6 /* RightControlSectionView.m in Sources */,
29D0DCED1DD9C59900729692 /* PromotionChooseTableViewCell.m in Sources */,
2998763C1CD9983A00C90D0A /* CommodityListTableViewCell.m in Sources */,
2962D0791CD1CBC60058829D /* NetworkRequestClassManager.m in Sources */,
29E2D32F1DB8AFD500443170 /* MDMatrix.m in Sources */,
29D39E4E1DDAAD2B0009FF89 /* CustomPromotionModel.m in Sources */,
29F725FB1CE17B0D0072FE0E /* Shoppersmanager.m in Sources */,
29D0DCF01DD9CABB00729692 /* PromotionChooseNavigationController.m in Sources */,
2921F3061DB5F27A00D6439B /* PromotionalTableViewCell.m in Sources */,
2973C33B1DBEF2EC00FAC995 /* ClientShoppingCarViewController.m in Sources */,
293164001DCE3F6D0075129D /* NotDrawTableViewCell.m in Sources */,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -41,14 +41,15 @@
*/
- (UIStoryboard *)getStoryboardWithName;
/**
* 调用打印机
*/
- (void)callAirprintWithdata:(NSString *)PDFpath SuccessBlock:(void(^)())success ErrorBlock:(void(^)())failed;
/**
* 判断是否有相机权限
*/
+ (BOOL)determineCameraPermissions;
/**
* 成功等待视图
......@@ -60,7 +61,6 @@
*/
- (void)ErrorMBProgressView:(NSString *)errorString;
/**
* 纯文本提示框
*/
......
......@@ -9,6 +9,7 @@
#import "BaseViewController.h"
#import "LoginViewController.h"
#import <WebKit/WebKit.h>
#import <AVFoundation/AVFoundation.h>
@interface BaseViewController ()<UIPrintInteractionControllerDelegate,UIWebViewDelegate,WKNavigationDelegate>
......@@ -235,6 +236,18 @@
return storyboard;
}
#pragma mark - 判断相机权限
+ (BOOL)determineCameraPermissions
{
NSString *mediaType = AVMediaTypeVideo;//读取媒体类型
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];//读取设备授权状态
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied){
return NO;
}else {
return YES;
}
}
#pragma mark 调用airPrint无线打印机
- (void)callAirprintWithdata:(NSString *)PDFpath SuccessBlock:(void(^)())success ErrorBlock:(void(^)())failed
{
......
......@@ -152,13 +152,9 @@
{
[_session addOutput:self.output];
}
AVCaptureConnection *outputConnection = [_output connectionWithMediaType:AVMediaTypeVideo];
outputConnection.videoOrientation = [QRUtil videoOrientationFromCurrentDeviceOrientation];
// 条码类型 AVMetadataObjectTypeQRCode
// _output.metadataObjectTypes =@[AVMetadataObjectTypeQRCode];
_output.metadataObjectTypes = @[AVMetadataObjectTypeEAN13Code,
AVMetadataObjectTypeEAN8Code,
AVMetadataObjectTypeCode128Code,
......@@ -169,9 +165,7 @@
_preview.videoGravity =AVLayerVideoGravityResize;
_preview.frame =[QRUtil screenBounds];
[self.view.layer insertSublayer:_preview atIndex:0];
_preview.connection.videoOrientation = [QRUtil videoOrientationFromCurrentDeviceOrientation];
[_session startRunning];
}
......
......@@ -474,7 +474,7 @@
#pragma mark -获取商品列表数据
- (void)getGoodsListDatasisRemove:(BOOL)remove Withobject:(GoodsCondition *)conditon
{
__weak typeof(self)weakSelf = self;
WS(weakSelf);
[self getGoodsListdatas:conditon returnResponse:^(GoodsResponse *response) {
weakSelf.sceneOrProductClollectionView.emptyDataSetSource = weakSelf;
......@@ -524,7 +524,7 @@
newModel.pictures = model.pictures;
newModel.barcode = model.barcode;
newModel.isSelectedState = NO;
newModel.goodsNumber = 1;
newModel.goodsNumber = ONE;
[weakSelf.productDatasArray addObject:newModel];
}
for (TOGoodsEntityModel *model in SHARED_APPDELEGATE.productArray) {
......@@ -542,7 +542,7 @@
- (void)getGoodsListdatas:(GoodsCondition *)conditon returnResponse:(void(^)(GoodsResponse *))finish
{
WS(weakSelf);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(PRODUCTLIST) WithCallClass:weakSelf WithRequestType:0 WithParameter:conditon WithReturnValueBlock:^(id returnValue) {
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(PRODUCTLIST) WithCallClass:weakSelf WithRequestType:ZERO WithParameter:conditon WithReturnValueBlock:^(id returnValue) {
[weakSelf endRefreshingForTableView:weakSelf.sceneOrProductClollectionView];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
......
......@@ -105,7 +105,7 @@
cell.clinchTextfield.userInteractionEnabled = NO;
cell.ClinchPriceBackView.backgroundColor = cell.backgroundColor;
//cell选中回调
__weak typeof(self) weakSelf = self;
WS(weakSelf);
[cell setReturnCellblock:^(NSInteger index) {
[weakSelf setSelectedButton:index];
......
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