Commit 41e71846 authored by 曹云霄's avatar 曹云霄

修改项说明:优化转盘界面,转盘旋转后,未结束之前,禁止退出

parent bbac9510
...@@ -280,6 +280,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息"; ...@@ -280,6 +280,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
goods.name = oldPromotion.goodsName; goods.name = oldPromotion.goodsName;
goodsModel.goods = goods; goodsModel.goods = goods;
goodsModel.isSelected = YES; goodsModel.isSelected = YES;
goodsModel.priority = oldPromotion.prority;
[weakSelf.promotionInformationArray addObject:goodsModel]; [weakSelf.promotionInformationArray addObject:goodsModel];
} else if (![BaseViewController isBlankString:[oldPromotion.promotionMoney stringValue]]) { } else if (![BaseViewController isBlankString:[oldPromotion.promotionMoney stringValue]]) {
...@@ -291,32 +292,37 @@ NSString *const PROMOTIONALSTRING = @"促销信息"; ...@@ -291,32 +292,37 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
deductionModel.total = [oldPromotion.promotionMoney integerValue]; deductionModel.total = [oldPromotion.promotionMoney integerValue];
deductionModel.isSelected = YES; deductionModel.isSelected = YES;
deductionModel.type = @"deductionAction"; deductionModel.type = @"deductionAction";
deductionModel.priority = oldPromotion.prority;
[weakSelf.promotionInformationArray addObject:deductionModel]; [weakSelf.promotionInformationArray addObject:deductionModel];
} else if (![BaseViewController isBlankString:[oldPromotion.jdecardDenomation stringValue]]) { } else if (![BaseViewController isBlankString:[oldPromotion.jdecardDenomation stringValue]]) {
// 京东E卡 // 京东E卡
PromotionJDECardModel *model = [[PromotionJDECardModel alloc]init]; PromotionJDECardModel *jdECardModel = [[PromotionJDECardModel alloc]init];
model.total = [oldPromotion.jdecardDenomation integerValue]; jdECardModel.total = [oldPromotion.jdecardDenomation integerValue];
model.body = GUIDE; jdECardModel.body = GUIDE;
model.type = JDECardAction; jdECardModel.type = JDECardAction;
[weakSelf.guidePromotionArray addObject:model]; jdECardModel.priority = oldPromotion.prority;
[weakSelf.guidePromotionArray addObject:jdECardModel];
} else if (![BaseViewController isBlankString:[oldPromotion.redPackageCount stringValue]]) { } else if (![BaseViewController isBlankString:[oldPromotion.redPackageCount stringValue]]) {
// 导购抽奖数 // 导购抽奖数
PromotionLuckyDrawModel *model = [[PromotionLuckyDrawModel alloc]init]; PromotionLuckyDrawModel *guideDrawModel = [[PromotionLuckyDrawModel alloc]init];
model.body = GUIDE; guideDrawModel.body = GUIDE;
[weakSelf.guidePromotionArray addObject:model]; guideDrawModel.priority = oldPromotion.prority;
[weakSelf.guidePromotionArray addObject:guideDrawModel];
} else if (![BaseViewController isBlankString:[oldPromotion.discountRate stringValue]]) { } else if (![BaseViewController isBlankString:[oldPromotion.discountRate stringValue]]) {
// 抽奖折扣 // 抽奖折扣
PromotionLuckyDrawModel *model = [[PromotionLuckyDrawModel alloc]init]; PromotionLuckyDrawModel *drawResultModel = [[PromotionLuckyDrawModel alloc]init];
model.descriptionString = [oldPromotion.discountRate stringValue]; drawResultModel.descriptionString = [oldPromotion.discountRate stringValue];
model.body = CONSUMER; drawResultModel.body = CONSUMER;
[weakSelf.promotionInformationArray addObject:model]; drawResultModel.priority = oldPromotion.prority;
[weakSelf.promotionInformationArray addObject:drawResultModel];
} else if (![BaseViewController isBlankString:oldPromotion.wxcardNumber]) { } else if (![BaseViewController isBlankString:oldPromotion.wxcardNumber]) {
// 微信卡劵 // 微信卡劵
PromotionWeChatCardModel *model = [[PromotionWeChatCardModel alloc]init]; PromotionWeChatCardModel *weChatModel = [[PromotionWeChatCardModel alloc]init];
model.total = [oldPromotion.wxcardDenomation integerValue]; weChatModel.total = [oldPromotion.wxcardDenomation integerValue];
[weakSelf.promotionInformationArray addObject:model]; weChatModel.priority = oldPromotion.prority;
[weakSelf.promotionInformationArray addObject:weChatModel];
self.weChatModel.wxcardNumber = oldPromotion.wxcardNumber; self.weChatModel.wxcardNumber = oldPromotion.wxcardNumber;
self.weChatModel.wxcardDenomation = [oldPromotion.wxcardDenomation integerValue]; self.weChatModel.wxcardDenomation = [oldPromotion.wxcardDenomation integerValue];
} }
...@@ -523,7 +529,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息"; ...@@ -523,7 +529,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
[weakSelf.promotionInformationArray removeObject:model];break; [weakSelf.promotionInformationArray removeObject:model];break;
} }
} }
[weakSelf.orderDetailsTableview reloadData]; [weakSelf promotionInformationExecutionOrder];
}]; }];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf presentViewController:scanVC animated:YES completion:nil]; [weakSelf presentViewController:scanVC animated:YES completion:nil];
...@@ -538,16 +544,20 @@ NSString *const PROMOTIONALSTRING = @"促销信息"; ...@@ -538,16 +544,20 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:USEWECHATCARD,number,orderNumber,orderTotal] WithCallClass:weakSelf WithRequestType:ZERO WithParameter:nil WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:USEWECHATCARD,number,orderNumber,orderTotal] WithCallClass:weakSelf WithRequestType:ZERO WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding]; [weakSelf RemoveMBProgressHUDLoding];
NSLog(@"%@",returnValue);
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
weakSelf.weChatModel.wxcardDenomation = [returnValue[@"data"][@"denomation"] integerValue]; weakSelf.weChatModel.wxcardDenomation = [returnValue[@"data"][@"denomation"] integerValue];
weakSelf.weChatModel.payNo = returnValue[@"data"][@"payNo"]; weakSelf.weChatModel.payNo = returnValue[@"data"][@"payNo"];
[weakSelf SHOWPrompttext:@"微信卡劵使用成功" ComcpleteBlock:^{ for (JSONModel *model in weakSelf.promotionInformationArray) {
[weakSelf promotionInformationExecutionOrder]; if ([model isMemberOfClass:[PromotionWeChatCardModel class]]) {
}]; PromotionWeChatCardModel *weChatModel = (PromotionWeChatCardModel *)model;
weChatModel.total = weakSelf.weChatModel.wxcardDenomation;break;
}
}
[weakSelf SHOWPrompttext:@"微信卡劵使用成功" ComcpleteBlock:nil];
}else{ }else{
[weakSelf ErrorMBProgressView:returnValue[@"msg"]]; [weakSelf ErrorMBProgressView:returnValue[@"msg"]];
} }
[weakSelf promotionInformationExecutionOrder];
} WithErrorCodeBlock:^(id errorCodeValue) { } WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding]; [weakSelf RemoveMBProgressHUDLoding];
...@@ -689,17 +699,11 @@ NSString *const PROMOTIONALSTRING = @"促销信息"; ...@@ -689,17 +699,11 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
}else { }else {
[self promptCustomerTitle:@"马上参与" withMessage:@"恭喜您获得一次大转盘抽奖机会!" finish:^{ [self promptCustomerTitle:@"马上参与" withMessage:@"恭喜您获得一次大转盘抽奖机会!" finish:^{
[weakSelf showLuckyDrawControl:model.lottery.uuid andOrderNumber:weakSelf.orderCode luckyDrawFinish:^(NSDictionary *dict) { [weakSelf showLuckyDrawControl:model.lottery.uuid andOrderNumber:weakSelf.orderCode luckyDrawFinish:^(NSDictionary *dict) {
id json = [NSJSONSerialization JSONObjectWithData:[dict[@"body"] dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:nil]; weakSelf.customerDrawModel = [[PromotionLuckDrawResultModel alloc]initWithDictionary:dict error:nil];
if (json) { if ([BaseViewController isBlankString:weakSelf.customerDrawModel.awardId]) {
if ([json isKindOfClass:[NSDictionary class]]) { [weakSelf SHOWPrompttext:@"未中奖"];
}else {
weakSelf.customerDrawModel = [[PromotionLuckDrawResultModel alloc]initWithDictionary:json error:nil]; [weakSelf SHOWPrompttext:[NSString stringWithFormat:@"恭喜你获得了 %@",weakSelf.customerDrawModel.descriptionString]];
if ([BaseViewController isBlankString:weakSelf.customerDrawModel.awardId]) {
[weakSelf SHOWPrompttext:@"未中奖"];
}else {
[weakSelf SHOWPrompttext:[NSString stringWithFormat:@"恭喜你获得了 %@",weakSelf.customerDrawModel.descriptionString]];
}
}
} }
}]; }];
}]; }];
......
...@@ -28,4 +28,6 @@ ...@@ -28,4 +28,6 @@
*/ */
@property (nonatomic,copy) PromotionLuckDrawResultModel *model; @property (nonatomic,copy) PromotionLuckDrawResultModel *model;
@end @end
...@@ -367,36 +367,7 @@ ...@@ -367,36 +367,7 @@
order.orderNumber = self.orderCode; order.orderNumber = self.orderCode;
order.fnewstate = PAYSUCCESS; order.fnewstate = PAYSUCCESS;
order.oldstate = NOTPAY; order.oldstate = NOTPAY;
// 查询是否有赠送商品促销
order.realAmount = [NSNumber numberWithFloat:[[self.goodsAllPrice.text substringFromIndex:1] floatValue]]; order.realAmount = [NSNumber numberWithFloat:[[self.goodsAllPrice.text substringFromIndex:1] floatValue]];
NSMutableArray *goodsArray = [NSMutableArray array];
for (id object in self.consumerPromotionalArray) {
if ([object isKindOfClass:[PromotionalGoodsModel class]]) {
PromotionalGoodsModel *model = (PromotionalGoodsModel *)object;
if (model.isSelected) {
PromotionGoods *goods = [[PromotionGoods alloc]init];
UCN *goodDetails = [[UCN alloc]init];
goodDetails.code = model.goods.code;
goodDetails.uuid = model.goods.uuid;
goodDetails.name = model.goods.name;
goods.goods = goodDetails;
goods.promotionNumber = [NSNumber numberWithInteger:model.count];
[goodsArray addObject:goods];
}
}
}
order.promotionGoods = (NSArray<PromotionGoods> *)goodsArray;
// 抵扣金额
CGFloat promotionMoney = 0;
for (id object in self.consumerPromotionalArray) {
if ([object isKindOfClass:[PromotionalDeductionModel class]]) {
PromotionalDeductionModel *model = (PromotionalDeductionModel *)object;
if (model.isSelected) {
promotionMoney += model.total;
}
}
}
order.promotionMoney = @(promotionMoney);
// 查询是否有京东E卡促销、是否有导购抽奖 // 查询是否有京东E卡促销、是否有导购抽奖
NSInteger totalNumber = 0; NSInteger totalNumber = 0;
for (id object in self.guidePromotionArray) { for (id object in self.guidePromotionArray) {
...@@ -414,20 +385,55 @@ ...@@ -414,20 +385,55 @@
} }
} }
order.jdCardDenomation = totalNumber; order.jdCardDenomation = totalNumber;
// 查询是否有消费者抽奖 // 查询是否有消费者抽奖促销、微信卡劵促销、抵扣金额、商品促销
CGFloat promotionMoney = 0;
NSInteger deductionPrority = 0;//抵扣优先级
NSInteger goodsPrority = 0;//商品促销优先级
NSMutableArray *goodsArray = [NSMutableArray array];
for (id object in self.consumerPromotionalArray) { for (id object in self.consumerPromotionalArray) {
if ([object isKindOfClass:[PromotionLuckyDrawModel class]]) { if ([object isKindOfClass:[PromotionLuckyDrawModel class]]) {
PromotionLuckyDrawModel *model = (PromotionLuckyDrawModel *)object; PromotionLuckyDrawModel *model = (PromotionLuckyDrawModel *)object;
if ([model.body isEqualToString:CONSUMER]) { if ([model.body isEqualToString:CONSUMER]) {
order.drawId = self.resultModel.drawId; order.drawId = self.resultModel.drawId;
order.drawPrority = model.priority;
} }
} }
if ([object isKindOfClass:[PromotionWeChatCardModel class]]) {
PromotionWeChatCardModel *model = (PromotionWeChatCardModel *)object;
if ([model.body isEqualToString:CONSUMER]) {
if (![[self class] isBlankString:self.weChatModel.wxcardNumber]) {
order.wxcardNumber = self.weChatModel.wxcardNumber;
order.wxcardDenomation = [NSNumber numberWithInteger:self.weChatModel.wxcardDenomation];
order.wxCardPrority = model.priority;
}
}
}
if ([object isKindOfClass:[PromotionalDeductionModel class]]) {
PromotionalDeductionModel *model = (PromotionalDeductionModel *)object;
if (model.isSelected) {
promotionMoney += model.total;
deductionPrority = model.priority;
}
}
if ([object isKindOfClass:[PromotionalGoodsModel class]]) {
PromotionalGoodsModel *model = (PromotionalGoodsModel *)object;
if (model.isSelected) {
PromotionGoods *goods = [[PromotionGoods alloc]init];
UCN *goodDetails = [[UCN alloc]init];
goodDetails.code = model.goods.code;
goodDetails.uuid = model.goods.uuid;
goodDetails.name = model.goods.name;
goods.goods = goodDetails;
goods.promotionNumber = [NSNumber numberWithInteger:model.count];
[goodsArray addObject:goods];
}
goodsPrority = model.priority;
}
} }
// 查询是否有微信卡劵促销 order.promotionMoney = @(promotionMoney);
if (![[self class] isBlankString:self.weChatModel.wxcardNumber]) { order.deductionPrority = deductionPrority;
order.wxcardNumber = self.weChatModel.wxcardNumber; order.promotionGoods = (NSArray<PromotionGoods> *)goodsArray;
order.wxcardDenomation = [NSNumber numberWithInteger:self.weChatModel.wxcardDenomation]; order.goodsPrority = goodsPrority;
}
//支付类型 //支付类型
if (self.payTreasureButton.selected) { if (self.payTreasureButton.selected) {
order.payType = @"005"; order.payType = @"005";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
@property (nonatomic,strong) WKWebView *webView; @property (nonatomic,strong) WKWebView *webView;
@property (nonatomic,strong) WKWebViewConfiguration *config; @property (nonatomic,strong) WKWebViewConfiguration *config;
@property (nonatomic,strong) UIButton *dismissButton;
@end @end
...@@ -56,15 +57,15 @@ ...@@ -56,15 +57,15 @@
#pragma mark - 添加删除按钮 #pragma mark - 添加删除按钮
- (void)addDismissButton - (void)addDismissButton
{ {
UIButton *dismissButton = [UIButton buttonWithType:UIButtonTypeCustom]; self.dismissButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.view addSubview:dismissButton]; [self.view addSubview:self.dismissButton];
[dismissButton mas_makeConstraints:^(MASConstraintMaker *make) { [self.dismissButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(40); make.left.mas_equalTo(40);
make.top.mas_equalTo(40); make.top.mas_equalTo(40);
make.size.mas_equalTo(CGSizeMake(50, 50)); make.size.mas_equalTo(CGSizeMake(50, 50));
}]; }];
[dismissButton setBackgroundImage:TCImage(@"1") forState:UIControlStateNormal]; [self.dismissButton setBackgroundImage:TCImage(@"1") forState:UIControlStateNormal];
[dismissButton addTarget:self action:@selector(dismissButtonClick) forControlEvents:UIControlEventTouchUpInside]; [self.dismissButton addTarget:self action:@selector(dismissButtonClick) forControlEvents:UIControlEventTouchUpInside];
} }
#pragma mark - WKScriptMessageHandler #pragma mark - WKScriptMessageHandler
...@@ -73,8 +74,19 @@ ...@@ -73,8 +74,19 @@
if ([message.name isEqualToString:@"AppModel"]) { if ([message.name isEqualToString:@"AppModel"]) {
// 打印所传过来的参数,只支持NSNumber, NSString, NSDate, NSArray, // 打印所传过来的参数,只支持NSNumber, NSString, NSDate, NSArray,
// NSDictionary, and NSNull类型 // NSDictionary, and NSNull类型
if (self.luckyDrawFinishBlock) { id json = [NSJSONSerialization JSONObjectWithData:[message.body[@"body"] dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:nil];
self.luckyDrawFinishBlock(message.body); if (json) {
if ([json isKindOfClass:[NSDictionary class]]) {
NSDictionary *resultDict = (NSDictionary *)json;
if ([[resultDict allKeys] containsObject:@"click"]) {
self.dismissButton.enabled = NO;
}else {
self.dismissButton.enabled = YES;
if (self.luckyDrawFinishBlock) {
self.luckyDrawFinishBlock(resultDict);
}
}
}
} }
} }
} }
......
...@@ -117,10 +117,12 @@ ...@@ -117,10 +117,12 @@
- (void)pop:(UIButton *)button { - (void)pop:(UIButton *)button {
if (self.cancelScanBlock) {
self.cancelScanBlock(); [self dismissViewControllerAnimated:YES completion:^{
} if (self.cancelScanBlock) {
[self dismissViewControllerAnimated:YES completion:nil]; self.cancelScanBlock();
}
}];
} }
#pragma mark - Public Method #pragma mark - Public Method
......
...@@ -812,6 +812,43 @@ extern NSString * const SORTDIRECTION_DESC; ...@@ -812,6 +812,43 @@ extern NSString * const SORTDIRECTION_DESC;
*/ */
@property (nonatomic, strong) NSNumber *wxcardDenomation; @property (nonatomic, strong) NSNumber *wxcardDenomation;
/**
* 抵扣优先级
*
*
*/
@property (nonatomic, assign) NSInteger deductionPrority;
/**
* 赠送商品优��级
*
*
*/
@property (nonatomic, assign) NSInteger goodsPrority;
/**
* 京东E卡优先级
*
*
*/
@property (nonatomic, assign) NSInteger JDEcardsPrority;
/**
* 消费者抽奖结果优先级
*
*
*/
@property (nonatomic, assign) NSInteger drawPrority;
/**
* 导购抽奖主题优先级
*
*
*/
@property (nonatomic, assign) NSInteger lotteryPrority;
/**
* 微信卡券优先级
*
*
*/
@property (nonatomic, assign) NSInteger wxCardPrority;
@end /* interface OrderPayRequest */ @end /* interface OrderPayRequest */
...@@ -2197,6 +2234,13 @@ extern NSString * const SORTDIRECTION_DESC; ...@@ -2197,6 +2234,13 @@ extern NSString * const SORTDIRECTION_DESC;
红包数 红包数
*/ */
@property (nonatomic,strong) NSNumber *redPackageCount; @property (nonatomic,strong) NSNumber *redPackageCount;
/**
* 方法: 取得优先级
*
*
*/
@property (nonatomic, assign) NSInteger prority;
@end /* interface TOOrderPromotionEntity */ @end /* interface TOOrderPromotionEntity */
......
...@@ -269,6 +269,11 @@ ...@@ -269,6 +269,11 @@
@synthesize promotionMoney; @synthesize promotionMoney;
@synthesize wxcardNumber; @synthesize wxcardNumber;
@synthesize wxcardDenomation; @synthesize wxcardDenomation;
@synthesize deductionPrority;
@synthesize goodsPrority;
@synthesize JDEcardsPrority;
@synthesize drawPrority;
@synthesize lotteryPrority;
+(BOOL)propertyIsOptional:(NSString*)propertyName +(BOOL)propertyIsOptional:(NSString*)propertyName
{ {
...@@ -822,6 +827,7 @@ NSString * const SORTDIRECTION_DESC = @"desc"; ...@@ -822,6 +827,7 @@ NSString * const SORTDIRECTION_DESC = @"desc";
@synthesize wxcardRealDeduction; @synthesize wxcardRealDeduction;
@synthesize jdecardDenomation; @synthesize jdecardDenomation;
@synthesize redPackageCount; @synthesize redPackageCount;
@synthesize prority;
+(BOOL)propertyIsOptional:(NSString*)propertyName +(BOOL)propertyIsOptional:(NSString*)propertyName
{ {
......
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