| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 | ////  ASGoodsDetailsVM.m//  Asteria////  Created by 王猛 on 2023/12/26.//#import "ASGoodsDetailsVM.h"@implementation ASGoodsDetailsVM- (void)ry_respnsSucessWithPath:(NSString *)mark data:(id)data reqNetType:(ReqNetType)reqNetType{    if([mark isEqualToString:Goods_productGetProductsById]){        GoodsInformationM *model = [GoodsInformationM mj_objectWithKeyValues:data];        [ASGoodsDetailsVM tool_addGooodsImgUrlValue:model];        NSMutableArray *ary = [NSMutableArray arrayWithArray:@[model]];        [self ry_VMconfigDelegateData:data parseAry:ary success:YES mark:mark reqNetType:reqNetType];    }else if ([mark isEqualToString:Goods_productGetProductsReview]){        NSMutableArray <GoodsReviewsListM *>*array = [GoodsReviewsListM mj_objectArrayWithKeyValuesArray:data[@"items"]];        [self ry_VMconfigDelegateData:data parseAry:array success:YES mark:mark reqNetType:reqNetType];    }else{        [self ry_VMconfigDelegateData:data parseAry:[NSMutableArray array] success:YES mark:mark reqNetType:reqNetType];    }}+(void)tool_addGooodsImgUrlValue:(GoodsInformationM *)infoModel{    NSMutableArray <MediaGalleryEntriesModel *>*imgArry =[NSMutableArray arrayWithArray:infoModel.media_gallery_entries];    for (int i = 0; i< imgArry.count; i++) {        MediaGalleryEntriesModel *tempmodel = imgArry[i];        if(i==0){            infoModel.add_gooodsImgUrl =   tempmodel.file;        }    }}+(NSMutableAttributedString *)tool_changePriceAtr:(GoodsInformationM *)model{    NSMutableAttributedString *priceAtr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@%@",model.currency_symbol,model.final_prices]];    [priceAtr addAttribute: NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"#0B0B0B"] range:NSMakeRange(0, priceAtr.length)];    [priceAtr addAttribute:NSFontAttributeName value:[UIFont fontWithName:Rob_Bold size:20] range:NSMakeRange(0, priceAtr.length)];    if([model.final_prices floatValue] == [model.price floatValue]){        return  priceAtr;    }else{        [priceAtr appendAttributedString:[[NSAttributedString alloc]initWithString:@"  "]];        NSMutableAttributedString *priceAtrSub1 = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@",model.price]];        [priceAtrSub1 addAttribute:NSForegroundColorAttributeName                        value:[UIColor colorWithHexString:@"#8c8c8c"]                        range:NSMakeRange(0, priceAtrSub1.length)];        [priceAtrSub1 addAttribute:NSFontAttributeName                        value:[UIFont fontWithName:Rob_Regular size:14]                        range:NSMakeRange(0, priceAtrSub1.length)];        [priceAtrSub1 addAttribute:NSStrikethroughStyleAttributeName                        value:[NSNumber numberWithInteger:NSUnderlineStyleSingle]                        range:NSMakeRange(0, priceAtrSub1.length)];        [priceAtr appendAttributedString:priceAtrSub1];        return  priceAtr;    }}+(NSMutableAttributedString *)tool_addOptionPrice:(CGFloat)addPrice quantity:(NSInteger)quantity infoMoel:(GoodsInformationM *)model{    CGFloat add_final_price_f = (addPrice+[model.final_prices floatValue])*quantity;    NSString *add_final_price = [NSString stringWithFormat:@"%.2f",add_final_price_f];        NSMutableAttributedString *priceAtr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@%@",model.currency_symbol,add_final_price]];    [priceAtr addAttribute: NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"#0B0B0B"] range:NSMakeRange(0, priceAtr.length)];    [priceAtr addAttribute:NSFontAttributeName value:[UIFont fontWithName:Rob_Bold size:20] range:NSMakeRange(0, priceAtr.length)];    if([model.final_prices floatValue] == [model.price floatValue]){        return  priceAtr;    }else{        CGFloat add_price_f = (addPrice+[model.price floatValue])*quantity;        NSString *add_price = [NSString stringWithFormat:@"%.2f",add_price_f];        [priceAtr appendAttributedString:[[NSAttributedString alloc]initWithString:@"  "]];        NSMutableAttributedString *priceAtrSub1 = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@",add_price]];        [priceAtrSub1 addAttribute:NSForegroundColorAttributeName                        value:[UIColor colorWithHexString:@"#8c8c8c"]                        range:NSMakeRange(0, priceAtrSub1.length)];        [priceAtrSub1 addAttribute:NSFontAttributeName                        value:[UIFont fontWithName:Rob_Regular size:14]                        range:NSMakeRange(0, priceAtrSub1.length)];        [priceAtrSub1 addAttribute:NSStrikethroughStyleAttributeName                        value:[NSNumber numberWithInteger:NSUnderlineStyleSingle]                        range:NSMakeRange(0, priceAtrSub1.length)];        [priceAtr appendAttributedString:priceAtrSub1];        return  priceAtr;    }}@end
 |