Commit ddae4359 by lee

修正价格显示问题

parent b142b254
...@@ -12,6 +12,12 @@ ...@@ -12,6 +12,12 @@
#import "KWMStringUtil.h" #import "KWMStringUtil.h"
#import "BUYProductVariant+Currency.h" #import "BUYProductVariant+Currency.h"
@interface KWMCollectionCell ()
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *priceSpace;
@end
@implementation KWMCollectionCell @implementation KWMCollectionCell
- (void)awakeFromNib { - (void)awakeFromNib {
...@@ -34,9 +40,10 @@ ...@@ -34,9 +40,10 @@
return; return;
} }
self.lbPrice.hidden = NO; self.lbPrice.hidden = NO;
self.discountLeft.constant = 5; self.priceSpace.constant = 4;
self.lbPrice.textAlignment = NSTextAlignmentRight; // self.discountLeft.constant = 5;
self.lbDiscount.textAlignment = NSTextAlignmentLeft; // self.lbPrice.textAlignment = NSTextAlignmentRight;
// self.lbDiscount.textAlignment = NSTextAlignmentLeft;
NSString *priceString,*discountStr; NSString *priceString,*discountStr;
if (productVariant.compareAtPrice) { if (productVariant.compareAtPrice) {
...@@ -47,8 +54,9 @@ ...@@ -47,8 +54,9 @@
self.lbPrice.attributedText = attribtStr; self.lbPrice.attributedText = attribtStr;
}else{ }else{
self.lbPrice.hidden = YES; self.lbPrice.hidden = YES;
self.discountLeft.constant = -28; self.priceSpace.constant = 0;
self.lbDiscount.textAlignment = NSTextAlignmentCenter; // self.discountLeft.constant = -28;
// self.lbDiscount.textAlignment = NSTextAlignmentCenter;
} }
// discountStr = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.price]]; // discountStr = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.price]];
discountStr = productVariant.priceFormatted; discountStr = productVariant.priceFormatted;
......
...@@ -48,12 +48,15 @@ ...@@ -48,12 +48,15 @@
return [[KWMUserDao shareDao] currencyCode]; return [[KWMUserDao shareDao] currencyCode];
} }
- (NSString *)priceFormattedByCurrencyCode:(NSDecimalNumber *) price { - (NSString *)priceFormattedByCurrencyCode:(NSDecimalNumber *) price {
// return [[[self numberFormatter] stringFromNumber:[self calcPriceByCurrencyCode:self.price]] stringByReplacingOccurrencesOfRegex:@"\\.00" withString:@""]; // return [[[self numberFormatter] stringFromNumber:[self calcPriceByCurrencyCode:self.price]] stringByReplacingOccurrencesOfRegex:@"\\.00" withString:@""];
// return [self fixFormatted:[[self numberFormatter] stringFromNumber:[NSDecimalNumber decimalNumberWithString:@"88888.88"]]];
return [self fixFormatted:[[self numberFormatter] stringFromNumber:[self calcPriceByCurrencyCode:price]]]; return [self fixFormatted:[[self numberFormatter] stringFromNumber:[self calcPriceByCurrencyCode:price]]];
} }
- (NSString *)priceFormatted:(NSDecimalNumber *)price { - (NSString *)priceFormatted:(NSDecimalNumber *)price {
// return [self fixFormatted:[[self numberFormatter] stringFromNumber:[NSDecimalNumber decimalNumberWithString:@"88888.88"]]];
return [self fixFormatted:[[self numberFormatter] stringFromNumber:price]]; return [self fixFormatted:[[self numberFormatter] stringFromNumber:price]];
} }
......
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