房间完成
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#import "QXFamilyMemberCell.h"
|
||||
#import "QXUserHomeHeaderView.h"
|
||||
#import "QXCustomAlertView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXFamilyMemberCell()<UICollectionViewDataSource,UICollectionViewDelegate>
|
||||
@end
|
||||
@implementation QXFamilyMemberCell
|
||||
@@ -35,7 +37,7 @@
|
||||
}
|
||||
-(void)setModel:(QXFamilyMemberModel *)model{
|
||||
_model = model;
|
||||
[self.headerView setHeadIcon:model.nickname dress:model.dress];
|
||||
[self.headerView setHeadIcon:model.avatar dress:model.dress];
|
||||
[self.headerView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]];
|
||||
self.dayLabel.text = [NSString stringWithFormat:@"剩余租期:%@",model.end_day];
|
||||
self.timesLabel.text = [NSString stringWithFormat:@"免费续约次数:%@",model.free_renewal];
|
||||
@@ -47,20 +49,66 @@
|
||||
self.continueBtn.hidden = model.is_show_sign.intValue==1?NO:YES;
|
||||
}
|
||||
- (IBAction)continueAction:(id)sender {
|
||||
|
||||
QXCustomAlertView *al = [[QXCustomAlertView alloc] init];
|
||||
al.title = @"续约提示";
|
||||
al.message = @"尊敬的用户: 您的徒弟【夏沫】当前为首次签约的 免费续约期。续约后,徒弟合约将延长7天,您剩余的免费续约次数:1次";
|
||||
|
||||
al.cancleTitle = @"取消";
|
||||
al.commitTitle = @"确认续约";
|
||||
al.isFromController = YES;
|
||||
if (self.model.free_renewal.intValue>0) {
|
||||
al.message = [NSString stringWithFormat:@"尊敬的用户: 您的徒弟【%@】当前为首次签约的 免费续约期。续约后,徒弟合约将延长%@天,您剩余的免费续约次数:%d次",self.model.nickname,self.model.free_re_sign_day,self.model.free_renewal.intValue-1];
|
||||
}else{
|
||||
NSInteger currentFeeInt = (NSInteger)ceil(self.model.market_value.doubleValue*self.model.sign_user_ratio.doubleValue/100.0);
|
||||
NSString *currentFee = [NSString stringWithFormat:@"%ld",currentFeeInt];
|
||||
al.message = [NSString stringWithFormat:@"尊敬的用户:本次续约将预估支付%@金币(【%@】身价的 %@%% )作为续约费用,续约后,师徒合约将延长 %@ 天\n注:支付价格是预估价格,徒弟身价是实时变化 续约后无法取消",currentFee,self.model.nickname,self.model.sign_user_ratio,self.model.sign_times];
|
||||
}
|
||||
MJWeakSelf
|
||||
al.cancelBlock = ^{
|
||||
[[QXGlobal shareGlobal] hideViewBlock:nil];
|
||||
};
|
||||
al.commitBlock = ^{
|
||||
[[QXGlobal shareGlobal] hideViewBlock:nil];
|
||||
if (weakSelf.model.free_renewal.intValue>0) {
|
||||
[weakSelf networkFreeSign];
|
||||
}else{
|
||||
[weakSelf networkCoinSign];
|
||||
}
|
||||
};
|
||||
[QXGlobal.shareGlobal showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:nil];
|
||||
// [al showInView:self.viewController.view title:@"续约提示" message:@"尊敬的用户: 您的徒弟【夏沫】当前为首次签约的 免费续约期。续约后,徒弟合约将延长7天,您剩余的免费续约次数:1次" cancleTitle:@"取消" commitTitle:@"确认续约"];
|
||||
}
|
||||
|
||||
-(void)networkFreeSign{
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[QXMineNetwork signFreeResignWithUserId:self.model.user_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"续约成功");
|
||||
__strong typeof(weakSelf) strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"⚠️ self has been deallocated, skipping hide operation");
|
||||
return;
|
||||
}
|
||||
if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(needRefresh)]) {
|
||||
[strongSelf.delegate needRefresh];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)networkCoinSign{
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[QXMineNetwork signCoinResignWithUserId:self.model.user_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"续约成功");
|
||||
__strong typeof(weakSelf) strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"⚠️ self has been deallocated, skipping hide operation");
|
||||
return;
|
||||
}
|
||||
if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(needRefresh)]) {
|
||||
[strongSelf.delegate needRefresh];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
if (self.model==nil) {
|
||||
|
||||
Reference in New Issue
Block a user