在价格,金额的计算中,如果直接使用<, >, =去计算金额会导致由精度导致的不准确问题。好的做法是:
NSNumber *totalPriceNumber = [NSNumber numberWithFloat:totalPrice];
NSNumber *minPriceNumber = [NSNumber numberWithFloat:schoolModel.minprice];
if ([totalPriceNumber compare:minPriceNumber] == -1) {
@strongify(self)
[self disappearView];
[[RSToastView shareRSToastView] showToast:[NSString stringWithFormat:@"最低%.2f元起送",schoolModel.minprice]];
}