123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632 |
- //
- // Cart_CheckoutC.m
- // Asteria
- //
- // Created by 王猛 on 2024/2/16.
- //
- #import "Cart_CheckoutC.h"
- #import "ASAddressListViewController.h"
- #import "ASCheckoutTopView.h"
- #import "ASCheckoutBottomView.h"
- #import "CartCheckTableV.h"
- #import "CartVM.h"
- #import "ASUserModel.h"
- #import "ASGoodsDetailsVM.h"
- #import "ASAddGiftGoodsView.h"
- @interface Cart_CheckoutC ()<RY_baseVMprotocol>
- @property (nonatomic, strong) CartVM *VM;
- @property (nonatomic, strong) ASCheckoutTopView *topView;
- @property (nonatomic, strong) ASCheckoutBottomView *bottomView;
- @property (nonatomic, strong) CartCheckTableV *TableV;
- @property (nonatomic, strong) MyCartCouponCellData *couponCellM;
- @property (nonatomic, strong) MyCartGrandTotalCellData *totalCellM;
- @property (nonatomic, strong) ASCheckoutPointData *pointCellM;
- @property (nonatomic, strong) ASCheckoutAddressData *addressCellM;
- @property (nonatomic, strong) ASCheckoutShipMethodData *shipmethodCellM;
- @property (nonatomic, strong) ASCheckoutCommentData *commentCellM;
- //存放支付方式
- @property (nonatomic, strong) NSArray *paymentArray;
- //选中支付方式
- @property (nonatomic, strong) ASCheckoutPaymentModel *paymentModel;
- //手动添加赠品至购物车
- @property (nonatomic, strong) ASGoodsDetailsVM *goodsDetailsVM;
- @property (nonatomic, strong) ASAddGiftGoodsView *addGiftView;
- @property (nonatomic, strong) NSMutableArray *addGiftParamArr;
- @property (nonatomic, assign) int index;
- @property (nonatomic, assign) int giftShowCount;
- @end
- @implementation Cart_CheckoutC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"Checkout";
-
- //获取支付方式
- [self requestPaymentMode];
- //获取运输方式
- [self requestGetShipMethodByAddress];
- //获取购物车信息(地址信息)
- [self requestCartInfo];
- }
- - (void)initSubviews {
- [super initSubviews];
-
- self.addGiftParamArr = [[NSMutableArray alloc] initWithCapacity:1];
- self.index = 0;
- self.giftShowCount = 0;
-
- IPhoneXHeigh
- [self setupTableV:[CartCheckTableV class] Frame:CGRectMake(0, securitytop_Y , KScreenWidth, KScreenHeight - securitytop_Y)];
- self.TableV.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
- self.TableV.tableHeaderView = self.topView;
- self.TableV.tableFooterView = self.bottomView;
-
- @weakify(self)
- self.TableV.tapClose = ^(NSInteger num, id data) {
- //num = 0 删除商品 ,1 修改数量 countV
- @strongify(self)
- if([data isKindOfClass:[CartTotalsItemsM class]]){
- switch (num) {
- case 0:
- [self reqNet_DEL_cartsMineItems:(CartTotalsItemsM *)data];
- break;
- case 1:
- [self reqnet_Cart_cartsMineItems_Post:(CartTotalsItemsM *)data];
- break;
- default:
- break;
- }
- }else if ([data isKindOfClass:[MyCartCouponCellData class]]){
- MyCartCouponCellData *couponM = (MyCartCouponCellData *)data;
- if(num ==0){ //使用优惠券
- [self reqNet_PUT_cartsMineCoupons:couponM.coupon_code];
- }else if(num == 1){//删除优惠券
- [self reqNet_DEL_cartsMineCoupons];
- }
- } else if ([data isKindOfClass:[ASCheckoutPointData class]]) {
- ASCheckoutPointData *pointData = (ASCheckoutPointData *)data;
- if(num ==0){ //使用积分
- [self requestUseLimitPoint:pointData.usePoint];
- }else if(num == 1){//取消使用积分
- [self requestCancelUsePoint];
- }
- } else if ([data isKindOfClass:[ASCheckoutCommentData class]]) {
- ASCheckoutCommentData *commentData = (ASCheckoutCommentData *)data;
- if(num ==0){ //使用积分
- self.commentCellM.commentStr = commentData.commentStr;
- }
- } else if ([data isKindOfClass:[ASCheckoutShipMethodData class]]) {
- //选择运输方式、、、、并设置
- ASCheckoutShipMethodData *shipMethodData = (ASCheckoutShipMethodData *)data;
- self.shipmethodCellM = shipMethodData;
- for (int i = 0; i < self.shipmethodCellM.shipMethodArray.count; i++) {
- ASCheckoutShipMethodModel *shipModel = [self.shipmethodCellM.shipMethodArray objectAtIndex:i];
- if (i == num) {
- shipModel.isSelect = YES;
- self.shipmethodCellM.shipMethodModel = shipModel;
- } else {
- shipModel.isSelect = NO;
- }
- }
- [self requestSetShipMethodByAddress];
- }
- };
-
- }
- - (void)ry_respnsData:(id)data
- parseAry:(NSMutableArray *)arry
- sucess:(BOOL)sucessOrFail
- mark:(NSString *)mark
- reqNetType:(ReqNetType)reqNetType{
- [MBProgressHUD hideHUDForView:self.view animated:YES];
- if([mark isEqualToString:Cart_cartsMineTotals]){
- if(sucessOrFail){
- CartTotalsM *model = [arry firstObject];
- self.totalsM = model;
-
- [self updateData];
- }
- } else if ([mark isEqualToString:Chectout_getPaymentMode]) {
- if(sucessOrFail){
- // 更新支付方式
- self.paymentArray = arry;
- if (self.paymentArray.count > 0) {
- self.paymentModel = self.paymentArray[0];
- [self.bottomView setBottomPayStyle:self.paymentModel.code];
- }
- //首次进入展示购物车数据UI
- [self updateData];
- }
- } else if ([mark isEqualToString:Cart_cartInfo]) {
- if(sucessOrFail){
- // 获取上次下单地址
- NSDictionary *dic = (NSDictionary *)data;
- NSArray *array = [[dic objectForKey:@"extension_attributes"] objectForKey:@"shipping_assignments"];
-
- if (array.count > 0) {
- NSDictionary *shipping_assignments = array[0];
- NSDictionary *shippingDic = [shipping_assignments objectForKey:@"shipping"];
- NSDictionary *addressDic = [shippingDic objectForKey:@"address"];
- // ASAddressModel *addressModel = [ASAddressModel defualtData];
- ASAddressReginModel *reginModel = [ASAddressReginModel mj_objectWithKeyValues:addressDic];
- ASAddressModel *addressModel = [ASAddressModel mj_objectWithKeyValues:addressDic];
- addressModel.region = reginModel;
- if (!NIL(addressModel.postcode)) {
- self.addressCellM.addressModel = addressModel;
-
- if (self.shipmethodCellM.shipMethodModel) {
- //默认设置第一个运输方式
- [self requestSetShipMethodByAddress];
- }
- }
- }
- //首次进入展示购物车数据UI
- [self updateData];
- }
-
- } else if ([mark isEqualToString:Chectout_addShipAddress_id]) {
-
- if(sucessOrFail){
- NSArray *shipMethodArr = (NSArray *)data;
- if (shipMethodArr.count > 0) {
-
- self.shipmethodCellM.shipMethodArray = [ASCheckoutShipMethodModel mj_objectArrayWithKeyValuesArray:shipMethodArr];
- ASCheckoutShipMethodModel *firstModel = self.shipmethodCellM.shipMethodArray[0];
- firstModel.isSelect = YES;
-
- self.shipmethodCellM.shipMethodModel = firstModel;
- self.shipmethodCellM.shipmethodSymbol = self.totalsM.currency_symbol;
-
- //默认设置第一个运输方式
- [self requestSetShipMethodByAddress];
-
-
- }
- [self reqNet_Cart_cartsMineTotals];
- }
-
- } else if ([mark isEqualToString:Chectout_getShipMethod]) {
-
- if(sucessOrFail){
- NSArray *shipMethodArr = (NSArray *)data;
-
-
- if (shipMethodArr.count > 0) {
- self.shipmethodCellM.shipMethodArray = [ASCheckoutShipMethodModel mj_objectArrayWithKeyValuesArray:shipMethodArr];
- ASCheckoutShipMethodModel *firstModel = self.shipmethodCellM.shipMethodArray[0];
- firstModel.isSelect = YES;
- self.shipmethodCellM.shipMethodModel = firstModel;
-
- self.shipmethodCellM.shipmethodSymbol = self.totalsM.currency_symbol;
-
- if (self.addressCellM.addressModel) {
- //默认设置第一个运输方式
- [self requestSetShipMethodByAddress];
- }
- }
- }
- [self updateData];
-
- } else if ([mark isEqualToString:Cart_cartsMineItems_Post]
- || [mark isEqualToString:DEL_cartsMineItems]
- || [mark isEqualToString:PUT_cartsMineCoupons]
- || [mark isEqualToString:Chectout_PUT_usePoints]
- || [mark isEqualToString:Chectout_DEL_cancelusePoints]
- || [mark isEqualToString:Chectout_setShipMethod]
- || [mark isEqualToString:Chectout_giftAddCart]){
- if(sucessOrFail){
- if ([mark isEqualToString:Chectout_giftAddCart]) {
- self.index --;
- if (self.index == 0) {
- [self reqNet_Cart_cartsMineTotals];
- }
- } else {
- [self reqNet_Cart_cartsMineTotals];
- }
- }else{
- [self.view makeToast:(NSString *)data duration:2 position:CSToastPositionCenter];
- }
- } else if ([mark isEqualToString:Goods_productGetProductsById]) {
- //请求赠品详情
- GoodsInformationM *model = (GoodsInformationM *)[arry firstObject];
-
- NSMutableDictionary *param = [NSMutableDictionary dictionaryWithDictionary:@{@"product_id":model.Id, @"isPromoItems":@"yes"}];
- if (model.options.count > 0) {
- NSMutableDictionary *optionDic = [NSMutableDictionary dictionary];
- for (OptionsModel *optionM in model.options) {
- OptionsValuesM *valuesM = optionM.values[0];
- NSString *tempStr =[NSString stringWithFormat:@"options[%@]",optionM.option_id];
- optionDic[tempStr] =valuesM.option_type_id;
- }
- [param addEntriesFromDictionary:optionDic];
- }
- [self.addGiftParamArr addObject:param];
- if (self.giftShowCount < 2 && self.addGiftParamArr.count == 1 && self.addGiftView.hidden) {
- self.addGiftView.hidden = NO;
- [self.addGiftView setGiftData:model.add_gooodsImgUrl];
- }
- }
- }
- - (void)updateData{
-
- [self.topView setTopViewData:self.totalsM.items_qty price:[NSString stringWithFormat:@"%@%@",self.totalsM.currency_symbol,self.totalsM.subtotal]];
-
- [self.TableV.infodata removeAllObjects];
- self.TableV.infodata = [NSMutableArray arrayWithArray:self.totalsM.items];
-
- //邮寄地址--邮寄方式
- if (self.addressCellM.addressModel) {
- [self.TableV.infodata addObject:self.addressCellM];
- }
-
- //运输方式
- [self.TableV.infodata addObject:self.shipmethodCellM];
-
- //优惠券
- self.couponCellM.couponAry =[NSMutableArray arrayWithArray: [ASNetTools shared].xxx_couponAry];
- self.couponCellM.coupon_code = self.totalsM.coupon_code;
- self.couponCellM.discount_amount = self.totalsM.discount_amount;
- self.couponCellM.currency_symbol = self.totalsM.currency_symbol;
- [self.TableV.infodata addObject:self.couponCellM];
-
- //积分
- NSDictionary *pointScaleDic = [Current_normalTool dicFromjsonStr:[self.totalsM.extension_attributes objectForKey:@"mw_earn_points_data"]];
- if (pointScaleDic.count > 0) {
- self.pointCellM.pointScale = [[pointScaleDic allValues] objectAtIndex:0];
- self.pointCellM.priceScale = [[pointScaleDic allKeys] objectAtIndex:0];
- }
- self.pointCellM.usePoint = [NSString stringWithFormat:@"%@", [self.totalsM.extension_attributes objectForKey:@"mw_rwrdpoints_amnt"]];
- self.pointCellM.usePrice = [NSString stringWithFormat:@"%@", [self.totalsM.extension_attributes objectForKey:@"mw_rwrdpoints_cur_amnt"]];
- self.pointCellM.pointBalance = [ASUserInfoManager shared].userPoints;
- self.pointCellM.priceSymbol = self.totalsM.currency_symbol;
- [self.TableV.infodata addObject:self.pointCellM];
-
- //备注
- [self.TableV.infodata addObject:self.commentCellM];
-
- //价格明细
- self.totalCellM.total_segments = [NSMutableArray arrayWithArray:self.totalsM.total_segments];
- self.totalCellM.currency_symbol = self.totalsM.currency_symbol;
- [self.TableV.infodata addObject:self.totalCellM];
-
- //支付方式数据
- [self.TableV.infodata addObjectsFromArray:self.paymentArray];
-
- //手动添加赠品功能
- [self.addGiftParamArr removeAllObjects];
-
- NSDictionary *freeData = (NSDictionary *)[[self.totalsM.extension_attributes objectForKey:@"free_data"] mj_JSONObject];
- BOOL is_show = [[freeData objectForKey:@"is_show"] boolValue];
- if (is_show && self.giftShowCount< 2) {//显示存在赠品
- NSArray *productArr = [freeData objectForKey:@"products"];
- if (productArr.count > 0) { //存在赠品
- for (int i = 0; i < productArr.count; i++) {
- NSDictionary *productDic = productArr[i];
- NSString *entity_id = productDic[@"entity_id"];
- [self reqNet_GoodsDetails_productGetProduct:entity_id];
- }
- }
- }
-
- [self.TableV reloadData];
- }
- - (void)tapcellTriggereventIndex:(NSIndexPath *)index model:(id)model{
- if([model isKindOfClass:[CartTotalsItemsM class]]){
- CartTotalsItemsM *itemM = (CartTotalsItemsM *)model;
- if(itemM.isGift){
- return;
- }
- UIViewController *viewController = [[CTMediator sharedInstance] Goods_GoodsDetailsC:@{@"entity_id":itemM.product_id}];
- [self.navigationController pushViewController:viewController animated:YES];
- } else if ([model isKindOfClass:[ASCheckoutPaymentModel class]]) {
- ASCheckoutPaymentModel *paymentModel = (ASCheckoutPaymentModel *)model;
- if (paymentModel.isSelect) {
- return;
- }
-
- for (int i = 0; i < self.TableV.infodata.count; i++) {
- id itemModel = self.TableV.infodata[i];
-
- if ([itemModel isKindOfClass:[ASCheckoutPaymentModel class]]) {
- ASCheckoutPaymentModel *tempModel = (ASCheckoutPaymentModel *)itemModel;
- if (index.row == i) {
- tempModel.isSelect = YES;
- self.paymentModel = tempModel;
- [self.bottomView setBottomPayStyle:tempModel.code];
- } else {
- tempModel.isSelect = NO;
- }
- }
- }
-
- [self.TableV reloadData];
- } else if ([model isKindOfClass:[ASCheckoutAddressData class]]) {
-
- ASAddressListViewController *vc = [ASAddressListViewController new];
- vc.isSelMode = true;
- vc.sel_Id = self.addressCellM.addressModel.Id;
- @weakify(self)
- vc.selectAddressBlock = ^(ASAddressModel * _Nonnull addressM) {
- @strongify(self)
-
- self.addressCellM.addressModel = addressM;
-
- [self requestAddShipAddress];
- };
- [self.navigationController pushViewController:vc animated:true];
- }
- }
- #pragma mark - **************** reqNet ****************
- //获取支付方式
- - (void)requestPaymentMode {
- [self.VM ry_requestGetApi:Chectout_getPaymentMode param:@{}];
- }
- //添加邮寄地址
- - (void)requestAddShipAddress {
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestPostApi:Chectout_addShipAddress_id param:@{@"addressId":self.addressCellM.addressModel.Id}];
- }
- //根据邮寄地址获取邮寄方式
- - (void)requestGetShipMethodByAddress {
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestGetApi:Chectout_getShipMethod param:@{}];
- }
- //设置邮寄方式
- - (void)requestSetShipMethodByAddress {
-
- NSDictionary *addressDic1 = (NSDictionary *)[self.addressCellM.addressModel.region mj_JSONObject];
- NSDictionary *addressDic = (NSDictionary *)[self.addressCellM.addressModel mj_JSONObject];
- NSMutableDictionary *param = [NSMutableDictionary dictionaryWithDictionary:addressDic];
- [param addEntriesFromDictionary:addressDic1];
-
- [param removeObjectForKey:@"extension_attributes"];//移除格式不正确的无用参数
-
- if (NIL(self.shipmethodCellM.shipMethodModel.method_code) || NIL(self.shipmethodCellM.shipMethodModel.carrier_code)) {
- [self.view makeToast:@"运输方式获取失败"];
- return;
- }
-
- NSDictionary *params = @{@"shipping_address":param,
- @"shipping_method_code":self.shipmethodCellM.shipMethodModel.method_code,
- @"shipping_carrier_code":self.shipmethodCellM.shipMethodModel.carrier_code};
-
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestPostApi:Chectout_setShipMethod param:@{@"addressInformation":params}];
- }
- //获取购物车信息(地址信息)
- - (void)requestCartInfo {
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestGetApi:Cart_cartInfo param:@{}];
- }
- ///获取购物车信息(报价整合)
- -(void)reqNet_Cart_cartsMineTotals{
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestGetApi:Cart_cartsMineTotals param:@{}];
- }
- ///修改商品的数量
- -(void)reqnet_Cart_cartsMineItems_Post:(CartTotalsItemsM *)itemM{
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- NSDictionary *cartItemDic = @{
- @"item_id":itemM.item_id,
- @"qty":itemM.qty,
- @"quote_id":self.totalsM.cart_id
- };
- NSMutableDictionary *param = [NSMutableDictionary dictionaryWithDictionary:@{
- @"cartItem":cartItemDic
- }];
- [self.VM ry_requestPostApi:Cart_cartsMineItems_Post param:param];
- }
- ///删除商品
- -(void)reqNet_DEL_cartsMineItems:(CartTotalsItemsM *)itemM{
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestDeleteApi:DEL_cartsMineItems paramStr:itemM.item_id];
- }
- -(void)reqNet_PUT_cartsMineCoupons:(NSString *)coupon{
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- self.giftShowCount = 0;
- [self.VM ry_requestPutApi:PUT_cartsMineCoupons param:coupon];
- }
- -(void)reqNet_DEL_cartsMineCoupons{
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestDeleteApi:DEL_cartsMineCoupons paramStr:@""];
- }
- //使用指定积分
- - (void)requestUseLimitPoint:(NSString *)point {
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestPutApi:Chectout_PUT_usePoints param:point];
- }
- //取消使用积分
- - (void)requestCancelUsePoint {
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.VM ry_requestDeleteApi:Chectout_DEL_cancelusePoints paramStr:@""];
- }
- //下单
- -(void)requestSureOrder{
-
- NSString *paymentCode = self.paymentModel.code;
-
- if ([paymentCode isEqualToString:@"paypal_express"]) {//paypal
-
- for (int i=0; i<self.totalCellM.total_segments.count; i++) {
- NSDictionary *dic = self.totalCellM.total_segments[i];
- NSString *code = MM_str(dic[@"code"]);
- if ([code isEqualToString:@"grand_total"]){ //subBottomV
- NSString *priceStr = [NSString stringWithFormat:@"%@",dic[@"value"]];
- // [self PayPalWithAmount:priceStr currencyCode:ASCurrencyManager.shared.currentCur shortDescription:@"购买商品"];
- return;
- }
- }
- return;
- } else if ([paymentCode isEqualToString:@"stripe_payments"]) {//visa
-
- } else if ([paymentCode isEqualToString:@"afterpay_payment"]) {//afterpay
-
- } else if ([paymentCode isEqualToString:@"klarna_kco"]) {//klarna
-
- } else {
-
- }
-
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- NSDictionary *param = @{@"method":paymentCode};
-
- [ASNetTools.shared putWithPath:Chectout_PUT_sureOrder param:@{@"paymentMethod":param} success:^(id _Nonnull json) {
- [MBProgressHUD hideHUDForView:self.view animated:YES];
- NSLog(@"=======%@", json);
-
- } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
- [MBProgressHUD hideHUDForView:self.view animated:YES];
- NSLog(@"=======%@=====%@", code, msg);
- }];
-
- }
- //请求赠品商品详情
- -(void)reqNet_GoodsDetails_productGetProduct:(NSString *)enterId{
- NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
- // [params setObject:@"55475" forKey:@"productId"];
- [params setObject:enterId forKey:@"productId"];
- [params setObject:ASCurrencyManager.shared.currentCur forKey:@"currencyCode"];
- // [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self.goodsDetailsVM ry_requestGetApi:Goods_productGetProductsById param:params];
- }
- //赠品加车
- - (void)requestGiftAddCart {
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
-
- for (int i = 0; i < self.addGiftParamArr.count; i++) {
- NSDictionary *param = self.addGiftParamArr[i];
- self.index ++;
- self.giftShowCount = 2;
- [self.VM ry_formDataRequestPostApi:Chectout_giftAddCart param:param];
- }
-
-
- }
- #pragma mark --- 懒加载 ---
- - (void)ucm_bindvmmodel{
- self.VM = [[CartVM alloc] initDelegate:self];
- self.goodsDetailsVM = [[ASGoodsDetailsVM alloc] initDelegate:self];
- }
- - (MyCartCouponCellData *)couponCellM {
- if (!_couponCellM) {
- _couponCellM = [[MyCartCouponCellData alloc] init];
- }
- return _couponCellM;
- }
- - (MyCartGrandTotalCellData *)totalCellM {
- if (!_totalCellM) {
- _totalCellM = [[MyCartGrandTotalCellData alloc] init];
- }
- return _totalCellM;
- }
- - (ASCheckoutPointData *)pointCellM {
- if (!_pointCellM) {
- _pointCellM = [[ASCheckoutPointData alloc] init];
- }
- return _pointCellM;
- }
- - (ASCheckoutAddressData *)addressCellM {
- if (!_addressCellM) {
- _addressCellM = [[ASCheckoutAddressData alloc] init];
- }
- return _addressCellM;
- }
- - (ASCheckoutShipMethodData *)shipmethodCellM {
- if (!_shipmethodCellM) {
- _shipmethodCellM = [[ASCheckoutShipMethodData alloc] init];
- }
- return _shipmethodCellM;
- }
- - (ASCheckoutCommentData *)commentCellM {
- if (!_commentCellM) {
- _commentCellM = [[ASCheckoutCommentData alloc] init];
- _commentCellM.commentStr = @"";
- }
- return _commentCellM;
- }
- - (ASCheckoutTopView *)topView {
- if (!_topView) {
- // IPhoneXHeigh
- _topView = [[ASCheckoutTopView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 60)];
- @weakify(self)
- _topView.isFlodBlock = ^(BOOL isFlod) {
- @strongify(self)
- self.TableV.isFlod = isFlod;
- [self.TableV reloadData];
- };
- }
- return _topView;
- }
- - (ASCheckoutBottomView *)bottomView {
- if (!_bottomView) {
- _bottomView = [[ASCheckoutBottomView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 100)];
- @weakify(self)
- _bottomView.bottomBlock = ^{
- @strongify(self)
- // [self.view makeToast:@"调起支付"];
- [self requestSureOrder];
- };
- }
- return _bottomView;
- }
- - (ASAddGiftGoodsView *)addGiftView {
- if (!_addGiftView) {
- _addGiftView = [[ASAddGiftGoodsView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
- @weakify(self)
- _addGiftView.addBlock = ^(int type) {
- @strongify(self)
- self.addGiftView.hidden = YES;
- if (type == 1) {
- [self requestGiftAddCart];
- } else {
- self.giftShowCount ++;
- }
- };
- _addGiftView.hidden = YES;
- [[UIApplication sharedApplication].keyWindow addSubview:_addGiftView];
- }
- return _addGiftView;
- }
- #pragma mark - **************** reqNet ****************
- @end
|