Commit 27ec3fbb by lee

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

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