Commit caf061a8 authored by 曹云霄's avatar 曹云霄

修改项说明:微信卡劵扫描错误处理、支付框增加价格计算方式

parent a3e5a2ea
......@@ -84,6 +84,11 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
*/
@property (nonatomic,strong) WeChatCardModel *weChatModel;
/**
扫描微信卡劵(重试)
*/
@property (nonatomic,strong) PromotionWeChatCardModel *tempWeChatModel;
......@@ -517,6 +522,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
- (void)scanWeChatCardNumber:(PromotionWeChatCardModel *)weChatModel
{
WS(weakSelf);
self.tempWeChatModel = weChatModel;
QRViewController *scanVC = [[QRViewController alloc] initWithScanCompleteHandler:^(NSString *url) {
[weakSelf dismissViewControllerAnimated:YES completion:^{
weakSelf.weChatModel.wxcardNumber = url;
......@@ -529,6 +535,11 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
[weakSelf.promotionInformationArray removeObject:model];break;
}
}
if (!weakSelf.promotionInformationArray.count) {
if ([weakSelf.sectionTitle containsObject:@"促销信息"]) {
[weakSelf.sectionTitle removeLastObject];
}
}
[weakSelf promotionInformationExecutionOrder];
}];
dispatch_async(dispatch_get_main_queue(), ^{
......@@ -553,11 +564,16 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
weChatModel.total = weakSelf.weChatModel.wxcardDenomation;break;
}
}
[weakSelf SHOWPrompttext:@"微信卡劵使用成功" ComcpleteBlock:nil];
[weakSelf SHOWPrompttext:[NSString stringWithFormat:@"微信卡劵(%ld元)使用成功",weakSelf.weChatModel.wxcardDenomation] ComcpleteBlock:^{
[weakSelf promotionInformationExecutionOrder];
}];
}else{
[weakSelf ErrorMBProgressView:returnValue[@"msg"]];
[weakSelf promptBoxWithMessage:[NSString stringWithFormat:@"微信卡劵使用失败:(%@),是否重试?",returnValue[@"msg"]] cancelBlock:^{
[weakSelf promotionInformationExecutionOrder];
} sureBlock:^{
[weakSelf scanWeChatCardNumber:weakSelf.tempWeChatModel];
}];
}
[weakSelf promotionInformationExecutionOrder];
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
......
......@@ -122,7 +122,12 @@
#pragma mark - 退出促销条件选择
- (IBAction)dismissPromotionChooseNavigation:(UIBarButtonItem *)sender {
[self dismissViewControllerAnimated:YES completion:nil];
WS(weakSelf);
[self promptBoxWithMessage:@"退出后此单将不在享受促销" cancelBlock:^{
} sureBlock:^{
[weakSelf dismissViewControllerAnimated:YES completion:nil];
}];
}
#pragma mark - 确认促销条件选择
......
......@@ -31,6 +31,11 @@
*/
@property (nonatomic,strong) PayViewController *payController;
/**
总金额来源
*/
@property (nonatomic,copy) NSString *totalAmountSource;
@end
......@@ -50,7 +55,7 @@
[super viewDidLoad];
[self uiConfigAction];
[self setGoodsArray];
[self calculateGoodsTotalAmountAndTotalNumber];
[self getPayQrCode];
}
......@@ -84,7 +89,7 @@
#pragma mark -支付总金额,商品总数量
- (void)setGoodsArray
- (void)calculateGoodsTotalAmountAndTotalNumber
{
NSInteger goodsAllNumber = 0;//总数量
for (TOOrderdetailEntity *model in _goodsArray) {
......@@ -149,18 +154,22 @@
}];
//计算促销后的价格
CGFloat newPrice = allPrice;
NSMutableString *priceString = [NSMutableString stringWithFormat:@"原价 %.2f元",allPrice];
for (NSDictionary *dict in chooseArray) {
if ([dict isEqual:deductionPrice]) {
CGFloat deduction = [dict[@"price"] floatValue];
newPrice = newPrice - deduction;
[priceString appendString:[NSString stringWithFormat:@" - 抵扣促销 %.2f元",deduction]];
}else if ([dict isEqual:weChatPrice]){
CGFloat weChat = [dict[@"price"] floatValue];
newPrice = newPrice - weChat;
[priceString appendString:[NSString stringWithFormat:@" - 微信卡劵 %.2f元",weChat]];
}else if ([dict isEqual:drawPrice]){
CGFloat draw = [self.resultModel.number floatValue]/100.0;
newPrice = newPrice * draw;
[priceString appendString:[NSString stringWithFormat:@" X 转盘抽奖 %@",self.resultModel.descriptionString]];
}
}
//判断促销是否为空
......@@ -168,7 +177,9 @@
if (newPrice < 0) {
newPrice = 0;
}
[priceString appendString:[NSString stringWithFormat:@" = %.2f元",newPrice]];
}
self.totalAmountSource = priceString;
return newPrice;
}
......@@ -527,10 +538,12 @@
self.myScrollView.contentOffset = CGPointMake(0, 0);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
#pragma mark - 价格疑问
- (IBAction)priceQuestionButtonClickAction:(UIButton *)sender {
[self promptCustomerTitle:@"我知道了" withMessage:self.totalAmountSource finish:nil];
}
@end
This diff is collapsed.
{
"images" : [
{
"idiom" : "universal",
"filename" : "question.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "question@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "question@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@
<key>CFBundleName</key>
<string>欧立方</string>
<key>CFBundleShortVersionString</key>
<string>1.2.5</string>
<string>1.2.6</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
......
......@@ -143,5 +143,15 @@
*/
+ (BOOL)isBlankString:(NSString *)string;
/**
选择框
@param message 文本
@param cancel 取消
@param sure 确认
*/
- (void)promptBoxWithMessage:(NSString *)message cancelBlock:(void(^)())cancel sureBlock:(void(^)())sure;
@end
......@@ -531,6 +531,29 @@
return NO;
}
/**
选择框
@param message 文本
@param cancel 取消
@param sure 确认
*/
- (void)promptBoxWithMessage:(NSString *)message cancelBlock:(void(^)())cancel sureBlock:(void(^)())sure
{
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:message preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
if (cancel) {
cancel();
}
}]];
[alertVC addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
if (sure) {
sure();
}
}]];
[self presentViewController:alertVC animated:YES completion:nil];
}
- (void)dealloc
{
......
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