Commit 27ec3fbb by lee

Merge branch 'master' of git.oschina.net:kollway-kollway/newcemarose

parents 16106979 84515bb6
...@@ -423,24 +423,30 @@ ...@@ -423,24 +423,30 @@
[self showToast:@"未成功创建订单"]; [self showToast:@"未成功创建订单"];
return; return;
} }
if([KWMStringUtil isBlank:self.tfDiscount.text]){ NSString *code = self.tfDiscount.text;
[self showToast:@"优惠码不能为空"]; // if([KWMStringUtil isBlank:code]){
return; // [self showToast:@"优惠码不能为空"];
} // return;
// }
BUYDiscount *discount = [self.client.modelManager discountWithCode:code];
self.checkout.discount = discount;
[self.tfDiscount resignFirstResponder]; [self.tfDiscount resignFirstResponder];
[self showLoading]; [self showLoading];
__weak typeof(self) this = self; __weak typeof(self) this = self;
[self.client updateCheckout:self.checkout completion:^(NSDictionary *dictionary, BUYCheckout *checkout, NSError *error) { [self.client updateCheckout:self.checkout completion:^(NSDictionary *dictionary, BUYCheckout *checkout, NSError *error) {
[this hideLoading]; [this hideLoading];
if (error == nil && checkout && checkout.discount) { if(checkout){
this.checkout = checkout; this.checkout = checkout;
[this showToast:@"添加优惠码成功"];
[this flushCheckout:dictionary]; [this flushCheckout:dictionary];
this.isEditingDiscount = NO; this.isEditingDiscount = NO;
[this initData]; [this initData];
}else { }
[this showToast:@"添加优惠码失败"]; if (!error && checkout && ![KWMStringUtil isBlank:code] && checkout.discount) {
[this showError:error]; [this showToast:@"添加优惠码成功"];
}else if(!error && checkout && [KWMStringUtil isBlank:code] && !checkout.discount){
[this showToast:@"清空优惠码成功"];
}else{
[this showToast:@"设置优惠码失败"];
} }
}]; }];
} }
......
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