//
//  PrizeDetailInfoViewController.m
//  Open
//
//  Created by 雷俊博 on 2019/9/5.
//  Copyright © 2019 黄江涛 . All rights reserved.
//

#import "PrizeDetailInfoViewController.h"
#import "PrizeDetailCardView.h"
#import "PrizeDetailProcessView.h"
#import "SNXUXIANView.h"
#import "CTPrizeDetailProcessTableViewCell.h"

#import "Constants.h"

#import "CTAPIBaseManager.h"

#import <Masonry.h>
#import <SVProgressHUD.h>
#import <IQKeyboardManager.h>
#import "UIImageView+WebCache.h"
#import "WXApi.h"

#import "InsuranceAlertView.h"
#import "AddressAlertView.h"
#import "PrizeInfoCommitSuccessAlertView.h"
#import "CitiesDataTool.h"

#import "GTCountSDK.h"
#import "CQToast.h"

#import "WXApi.h"


@interface PrizeDetailInfoViewController ()<UITableViewDelegate,UITableViewDataSource,InsuranceAlertViewDelegate,AddressAlertViewDelegate>

@property (nonatomic, strong)UIScrollView *scrollView;

@property (nonatomic, strong)UIView *backView;

@property (nonatomic, strong)PrizeDetailCardView *cardView;

@property (nonatomic, strong)PrizeDetailProcessView *processView;

@property (nonatomic, strong)UIImageView * img_connect;
@property (nonatomic, strong)UIImageView * img_connect2;

@property (nonatomic, strong)UILabel *lb_number;

@property (nonatomic, strong)UILabel *lb_moneyNumber;
@property (nonatomic, strong)UILabel *lb_moneyUnit;


@property (nonatomic, strong)UILabel *lb_type;

@property (nonatomic, strong)UILabel *lb_date;

@property (nonatomic, strong)UIButton *btn_getCoins;

@property (nonatomic, strong)SNXUXIANView *lineView;

@property (nonatomic, strong)UILabel *lb_stateTitle;

@property (nonatomic, strong)UILabel *lb_state;

@property (nonatomic, strong)UIButton *btn_bindWx;

@property (nonatomic, strong)UIImageView *img_wxIcon;

@property (nonatomic, strong)UILabel *lb_prizeNameTitle;

@property (nonatomic, strong)UILabel *lb_prizeName;

@property (nonatomic, strong)UILabel *lb_CDkeyTitle;

@property (nonatomic, strong)UILabel *lb_CDkey;

@property (nonatomic, strong)UIButton *btn_copy;

@property (nonatomic, strong)UIButton *btn_list;

@property (nonatomic, strong)UITableView *tableView;

@end

@implementation PrizeDetailInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor colorWithHex:0xf8502c];
    
    
    
    [self.view addSubview:self.scrollView];
    
    
    
    if (self.type == CTListPrizeTypeCoins200 || self.type == CTListPrizeTypeCoins388 || self.type == CTListPrizeTypeCoins588) {
         self.lb_number.text = [self.contentDic[@"giftName"] stringByReplacingOccurrencesOfString:@"金币" withString:@""];
        self.lb_state.text = self.contentDic[@"lotterStatus"];
        self.lb_prizeName.text = self.contentDic[@"giftName"];
        NSString * state = self.contentDic[@"lotterStatus"];
        if ([state isEqualToString:@"未领取"]) {
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
           self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            
            [self.btn_getCoins setTitle:@"立即领取" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
            
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            
            
        }else if ([state isEqualToString:@"已领取"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
//            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[self getCustomDateStrWithDate:startDate]];
            [self.btn_getCoins setTitle:@"已领取" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins.userInteractionEnabled = NO;
        }else if ([state isEqualToString:@"已过期"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            [self.btn_getCoins setTitle:@"已过期" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins .userInteractionEnabled = NO;
        }
    }else if (self.type == CTListPrizeTypeCoupons50_YanWo){
        
        self.lb_moneyNumber.text = @"50";
        self.lb_type.text = @"金币抽奖优惠券";
        self.lb_state.text = self.contentDic[@"lotterStatus"];
        self.lb_prizeName.text = self.contentDic[@"giftName"];
        NSString * state = self.contentDic[@"lotterStatus"];
        
        if ([state isEqualToString:@"未领取"]) {
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            
            [self.btn_getCoins setTitle:@"复制兑换码去兑换" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
            
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            
            
        }else if ([state isEqualToString:@"已领取"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
//            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[self getCustomDateStrWithDate:startDate]];
            [self.btn_getCoins setTitle:@"兑换码已领取" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins.userInteractionEnabled = NO;
            
                CGRect frame = self.cardView.frame;
            
                frame.size.height = 326 * WIDTHRADIU;
            
                self.cardView.frame = frame;
            
              self.lb_CDkeyTitle.hidden = NO;
              self.lb_CDkey.hidden = NO;
              self.btn_copy.hidden = NO;
            
            NSString *ticketNo = self.contentDic[@"ticketNo"];
            self.lb_CDkey.text = [EnercryTool decryptUseDES:ticketNo key:DESKEY];
            
        }else if ([state isEqualToString:@"已过期"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            [self.btn_getCoins setTitle:@"兑换码已过期" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins .userInteractionEnabled = NO;
        }
        
    }else if (self.type == CTListPrizeTypeCouponsFree_YanWo){
        
        self.lb_number.text = @"免费";
        self.lb_type.text = @"金币抽奖优惠券";
        self.lb_state.text = self.contentDic[@"lotterStatus"];
        self.lb_prizeName.text = self.contentDic[@"giftName"];
        NSString * state = self.contentDic[@"lotterStatus"];
        
        if ([state isEqualToString:@"未领取"]) {
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            
            [self.btn_getCoins setTitle:@"复制兑换码去兑换" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
            
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            
            
        }else if ([state isEqualToString:@"已领取"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
//            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[self getCustomDateStrWithDate:startDate]];
            [self.btn_getCoins setTitle:@"兑换码已领取" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins.userInteractionEnabled = NO;
            
            CGRect frame = self.cardView.frame;
            
            frame.size.height = 326 * WIDTHRADIU;
            
            self.cardView.frame = frame;
            
            self.lb_CDkeyTitle.hidden = NO;
            self.lb_CDkey.hidden = NO;
            self.btn_copy.hidden = NO;
            
            NSString *ticketNo = self.contentDic[@"ticketNo"];
            self.lb_CDkey.text = [EnercryTool decryptUseDES:ticketNo key:DESKEY];
        }else if ([state isEqualToString:@"已过期"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            [self.btn_getCoins setTitle:@"兑换码已过期" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins .userInteractionEnabled = NO;
        }
        
    }else if (self.type == CTListPrizeTypeInsurance_DaDi){
        
        
        
        
        NSString *content = @"最高可赔25000元\n专属于您的农村家财险";

        NSMutableDictionary *attDic = [NSMutableDictionary dictionary];
        [attDic setValue:[UIFont systemFontOfSize:20] forKey:NSFontAttributeName];      // 字体大小
        NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:content attributes:attDic];
        NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
        style.alignment = NSTextAlignmentCenter;
        style.lineSpacing = 6;                                                          // 设置行之间的间距
        [attStr addAttribute:NSParagraphStyleAttributeName value:style range: NSMakeRange(0, content.length)];
        
        self.lb_number.attributedText = attStr;
        self.lb_type.text = @"金币抽奖保险";
         self.lb_state.text = self.contentDic[@"lotterStatus"];
        self.lb_prizeName.text = self.contentDic[@"giftName"];
        NSString * state = self.contentDic[@"lotterStatus"];
        if ([state isEqualToString:@"未领取"]) {
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter15DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            
            [self.btn_getCoins setTitle:@"立即领取" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
            
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            
            
        }else if ([state isEqualToString:@"已领取"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
//            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[self getCustomDateStrWithDate:startDate]];
            [self.btn_getCoins setTitle:@"已领取" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins.userInteractionEnabled = NO;
        }else if ([state isEqualToString:@"已过期"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter15DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            [self.btn_getCoins setTitle:@"已过期" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins .userInteractionEnabled = NO;
        }
    } else if (self.type == CTListPrizeTypePackage2 || self.type == CTListPrizeTypePackage3 || self.type == CTListPrizeTypePackage5 || self.type == CTListPrizeTypePackage10 )
    {
        if (self.type == CTListPrizeTypePackage5) {
             self.lb_moneyNumber.text = @"5";
        } else{
             self.lb_moneyNumber.text = [self.contentDic[@"giftName"] stringByReplacingOccurrencesOfString:@"元红包" withString:@""];
        }
        
        self.lb_type.text = @"金币抽奖红包";
        self.lb_stateTitle.text = @"收款微信号";
        
        
        
        
        self.lb_prizeNameTitle.text = @"提现金额";
        self.lb_prizeName.text = [self.contentDic[@"giftName"] stringByReplacingOccurrencesOfString:@"话费" withString:@""];
        NSString * state = self.contentDic[@"lotterStatus"];
        
        if ([state isEqualToString:@"未领取"]) {
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            
            [self.btn_getCoins setTitle:@"微信提现" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
            
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            
        }else if ([state isEqualToString:@"发放中"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            
            [self.btn_getCoins setTitle:@"发放中..." forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
            
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
        }else if ([state isEqualToString:@"已领取"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
//            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[self getCustomDateStrWithDate:startDate]];
            [self.btn_getCoins setTitle:@"已领取" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins .userInteractionEnabled = NO;
        }else if ([state isEqualToString:@"已过期"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            [self.btn_getCoins setTitle:@"已过期" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
            _btn_getCoins .userInteractionEnabled = NO;
            
        }else if ([state isEqualToString:@"领取失败"]){
            NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
            NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
            self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
            
            [self.btn_getCoins setTitle:@"重新领取" forState:UIControlStateNormal];
            [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
            
            _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
            _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
            _btn_getCoins.layer.borderWidth = 1.0;
        }
        
        
        [self requestBindAPI];
        
        
        
    }else if (self.type == CTListPrizeTypeCustomPackage){
        
         if ([self.contentDic[@"randomMoney"] isKindOfClass:[NSNumber class]]) {
                       NSNumber *randomMoney = self.contentDic[@"randomMoney"];
                        self.lb_moneyNumber.text = [NSString stringWithFormat:@"%@",randomMoney];
                   }
                 
        self.lb_type.text = @"现金红包";
        self.lb_state.text = self.contentDic[@"lotterStatus"];
        self.lb_prizeName.text = self.contentDic[@"giftName"];
        NSString * state = self.contentDic[@"lotterStatus"];
        if ([state isEqualToString:@"未领取"]) {
                   NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
                   NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
                  self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
                   
                   [self.btn_getCoins setTitle:@"立即领取" forState:UIControlStateNormal];
                   [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
                   
                   _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                   _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
                   _btn_getCoins.layer.borderWidth = 1.0;
                   
                   
        }else if ([state isEqualToString:@"已领取"]){
                   NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
//                   NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
                   self.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[self getCustomDateStrWithDate:startDate]];
                   [self.btn_getCoins setTitle:@"已领取" forState:UIControlStateNormal];
                   [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
                   _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                   _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
                   _btn_getCoins.layer.borderWidth = 1.0;
                   _btn_getCoins.userInteractionEnabled = NO;
               }else if ([state isEqualToString:@"已过期"]){
                   NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
                   NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
                   self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
                   [self.btn_getCoins setTitle:@"已过期" forState:UIControlStateNormal];
                   [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
                   _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                   _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
                   _btn_getCoins.layer.borderWidth = 1.0;
                   _btn_getCoins .userInteractionEnabled = NO;
               }
    }else if (self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeSandals || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine|| self.type == CTListPrizeTypeDisposableMop  || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard || self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy || self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI|| self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN){
        [[CitiesDataTool sharedManager]requestAllProvince];
        
        self.lb_number.font = [UIFont systemFontOfSize:65];
        if (self.type == CTListPrizeTypeSmartCup) {
            self.lb_number.text = @"保温杯";
        }else if (self.type == CTListPrizeTypeShoe){
            self.lb_number.text = @"居家棉拖鞋";
            
        }else if (self.type == CTListPrizeTypeToyCar){
            self.lb_number.text = @"遥控玩具车";
        }else if (self.type == CTListPrizeTypeElectricFan){
            self.lb_number.text = @"迷你暖风机";
        }else if (self.type == CTListPrizeTypeMedicalMask){
            self.lb_number.text = @"医用口罩";
        }else if (self.type == CTListPrizeTypeDisinfectant){
           self.lb_number.text = @"抗病毒";
        }else if (self.type == CTListPrizeTypeTissue){
           self.lb_number.text = @"消毒湿纸巾";
        }else if (self.type == CTListPrizeTypeFan){
           self.lb_number.text = @"桌面小风扇";
        }else if (self.type == CTListPrizeTypeWashbasin){
            self.lb_number.text = @"家用脸盆";
        }else if (self.type == CTListPrizeTypeSandals){
            self.lb_number.text = @"家居凉拖鞋";
        }else if (self.type == CTListPrizeTypeTeaSet){
            self.lb_number.text = @"功夫茶具";
        }else if (self.type == CTListPrizeTypeTeaMassageStick){
            self.lb_number.text = @"按摩棒";
        }else if (self.type == CTListPrizeTypeMiniHumidifier){
            self.lb_number.text = @"迷你加湿器";
        }else if (self.type == CTListPrizeTypeRazor){
            self.lb_number.text = @"黑金色剃须刀";
        }else if (self.type == CTListPrizeTypeCookerTool){
            self.lb_number.text = @"厨具五件套";
        }else if (self.type == CTListPrizeTypeWashingLiquid){
            self.lb_number.text = @"洗衣液";
        }else if (self.type == CTListPrizeTypeStorageBox){
            self.lb_number.text = @"内衣收纳盒";
        }else if (self.type == CTListPrizeTypeUSBElectronicScale){
            self.lb_number.text = @"USB电子秤";
        }else if (self.type == CTListPrizeTypeAutoFoldUmbrella){
            self.lb_number.text = @"自动折叠晴雨伞";
        }else if (self.type == CTListPrizeTypeMosquitoKillingLamp){
            self.lb_number.text = @"灭蚊灯";
        }else if (self.type == CTListPrizeTypeHUAWeiMate40){
            self.lb_number.text = @"华为Mate40";
        }else if (self.type == CTListPrizeTypeHoldFan){
            self.lb_number.text = @"手持风扇";
        }else if (self.type == CTListPrizeTypequalityDrawing){
            self.lb_number.text = @"品质抽纸";
        }else if (self.type == CTListPrizeTypeTeapot){
            self.lb_number.text = @"饮茶水壶";
        }else if (self.type == CTListPrizeTypeiPhone12Pro){
            self.lb_number.text = @"iPhone12 Pro";
        }else if (self.type == CTListPrizeTypeUglyOrange){
            self.lb_number.text = @"甘甜丑橘";
        }else if (self.type == CTListPrizeTypeRedmi9A){
            self.lb_number.text = @"红米9A";
        }else if (self.type == CTListPrizeTypeSummerSleepingMat){
            self.lb_number.text = @"夏日凉席";
        }else if (self.type == CTListPrizeTypeChineseWolfberry){
            self.lb_number.text = @"养生枸杞";
        }else if (self.type == CTListPrizeTypeSummerQuilt){
            self.lb_number.text = @"空调被";
        }else if (self.type == CTListPrizeTypeWashingMachine){
            self.lb_number.text = @"洗衣机";
        }else if (self.type == CTListPrizeTypeDisposableMop){
            self.lb_number.text = @"免洗拖把";
        }else if (self.type == CTListPrizeTypeHairDrier){
            self.lb_number.text = @"吹风机";
        }else if (self.type == CTListPrizeTypeKitchenRack){
            self.lb_number.text = @"厨房置物架";
        }else if (self.type == CTListPrizeTypeMultifunctionalPluginBoard){
            self.lb_number.text = @"多功能插板";
        }else if (self.type == CTListPrizeTypeBathroomMat){
            self.lb_number.text = @"浴室防滑垫";
        }else if (self.type == CTListPrizeTypeIpadMini){
            self.lb_number.text = @"ipad mini";
        }else if (self.type == CTListPrizeTypeCeramicCasserole){
            self.lb_number.text = @"陶瓷砂锅";
        }else if (self.type == CTListPrizeTypeCervicalSpineMassager){
            self.lb_number.text = @"颈椎按摩器";
        }else if (self.type == CTListPrizeTypeWirelessBluetoothHeadset){
            self.lb_number.text = @"无线蓝牙耳机";
        }else if (self.type == CTListPrizeTypeWinterCup){
            self.lb_number.text = @"冬季水杯";
        }else if (self.type == CTListPrizeTypeBin){
            self.lb_number.text = @"收纳箱";
        }else if (self.type == CTListPrizeTypeAirHumidifier){
            self.lb_number.text = @"空气加湿器";
        }else if (self.type == CTListPrizeTypeCreativeLaundryBasket){
            self.lb_number.text = @"创意洗菜篮";
        }else if (self.type == CTListPrizeTypeBedDesk){
            self.lb_number.text = @"床上书桌";
        }else if (self.type == CTListPrizeTypeHairBallTrimmer){
            self.lb_number.text = @"毛球修剪器";
        }else if (self.type == CTListPrizeTypePlushCushions){
            self.lb_number.text = @"毛绒坐垫";
        }else if (self.type == CTListPrizeTypeSolidWoodHangers){
            self.lb_number.text = @"实木衣架";
        }else if (self.type == CTListPrizeTypeTopCup){
            self.lb_number.text = @"高档保温杯";
        }else if (self.type == CTListPrizeTypeVirginPulpPaper){
            self.lb_number.text = @"原浆抽纸";
        }else if (self.type == CTListPrizeTypeAbsorbent){
            self.lb_number.text = @"吸水防滑垫";
        }else if (self.type == CTListPrizeTypeElectronicScale){
            self.lb_number.text = @"电子秤";
        }else if (self.type == CTListPrizeTypeWirelessMouse){
            self.lb_number.text = @"充电无线鼠标";
        }else if (self.type == CTListPrizeTypeDishwashingGloves){
            self.lb_number.text = @"洗碗手套";
        }else if (self.type == CTListPrizeTypeNewYearHanged){
            self.lb_number.text = @"新春挂件";
        }else if (self.type == CTListPrizeTypeNewYearCandy){
            self.lb_number.text = @"过年糖果盘";
        }else if (self.type == CTListPrizeTypeLogNapkins){
            self.lb_number.text = @"原木餐巾纸";
        }else if (self.type == CTListPrizeTypeHighTempCup){
            self.lb_number.text = @"耐高温水杯";
        }else if (self.type == CTListPrizeTypeHeavyAbsorbentTowel){
            self.lb_number.text = @"吸水厚毛巾";
        }else if (self.type == CTListPrizeTypeHackTechBroom){
            self.lb_number.text = @"黑科技扫把";
        }else if (self.type == CTListPrizeTypeHeadScratcherMassager){
            self.lb_number.text = @"头部抓痒按摩器";
        }else if (self.type == CTListPrizeTypeChineseRedMaskr){
            self.lb_number.text = @"中国红口罩";
        }else if (self.type == CTListPrizeTypeBOLIBEI){
            self.lb_number.text = @"玻璃杯";
        }else if (self.type == CTListPrizeTypeKONGQI){
            self.lb_number.text = @"空气净化器";
        }else if (self.type == CTListPrizeTypeLIANGTUOXIE){
            self.lb_number.text = @"凉拖鞋";
        }else if (self.type == CTListPrizeTypeXISHUIMAOPJIN){
            self.lb_number.text = @"吸水毛巾";
        }
        
        self.lb_type.text = @"金币抽奖奖品";
        self.lb_state.text = self.contentDic[@"lotterStatus"];
        self.lb_prizeName.text = self.contentDic[@"giftName"];
        NSString * state = self.contentDic[@"lotterStatus"];
        if ([state isEqualToString:@"未领取"]) {
                   NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
                   NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
                  self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
                   
                   [self.btn_getCoins setTitle:@"立即领取" forState:UIControlStateNormal];
                   [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
                   
                   _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                   _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
                   _btn_getCoins.layer.borderWidth = 1.0;
                   
                   
               }else if ([state isEqualToString:@"发放中"]){
                   NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
                   NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
                   self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
                   [self.btn_getCoins setTitle:@"发货中..." forState:UIControlStateNormal];
                   [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
                    _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                    _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
                    _btn_getCoins.layer.borderWidth = 1.0;
                   _btn_getCoins.userInteractionEnabled = NO;
                   
                    self.lb_state.text = @"发货中";
               }else if ([state isEqualToString:@"已领取"]){
                   NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
//                   NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
                   self.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[self getCustomDateStrWithDate:startDate]];
                   [self.btn_getCoins setTitle:@"已签收" forState:UIControlStateNormal];
                   [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
                   _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                   _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
                   _btn_getCoins.layer.borderWidth = 1.0;
                   _btn_getCoins.userInteractionEnabled = NO;
                   self.lb_state.text = @"已签收";
               }else if ([state isEqualToString:@"已过期"]){
                   NSDate *startDate = [self getDateWithDateStr:self.contentDic[@"createTime"]];
                   NSDate *endDate = [self getDateAfter30DaysWithCurrentDate:startDate];
                   self.lb_date.text = [NSString stringWithFormat:@"有效期：%@-%@",[self getCustomDateStrWithDate:startDate],[self getCustomDateStrWithDate:endDate]];
                   [self.btn_getCoins setTitle:@"已过期" forState:UIControlStateNormal];
                   [_btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
                   _btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                   _btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
                   _btn_getCoins.layer.borderWidth = 1.0;
                   _btn_getCoins .userInteractionEnabled = NO;
               }
    }
    
    
    if (self.type == CTListPrizeTypeCouponsFree_YanWo) {
        self.lb_number.font = [UIFont systemFontOfSize:50 * WIDTHRADIU];;
    }else if (self.type == CTListPrizeTypeInsurance_DaDi){
        self.lb_number.font = [UIFont systemFontOfSize:20 * WIDTHRADIU];
    }else if (self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeSandals || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine || self.type == CTListPrizeTypeDisposableMop || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard || self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole  || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions  || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy | self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI|| self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN){
        self.lb_number.font = [UIFont systemFontOfSize:40 * WIDTHRADIU];
    }else{
        self.lb_number.font = [UIFont systemFontOfSize:70 * WIDTHRADIU];
    }
    
    
    
    [self navConfig];
    
    if (@available(iOS 11.0, *)) {
        self.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    } else {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    
    [self.navigationController.navigationBar navBarBackGroundColor:[UIColor colorWithHex:0xf8502c] image:nil isOpaque:YES];//颜色
           
      [self.navigationController.navigationBar navBarBottomLineHidden:YES];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithHex:0xf8502c];
    [self.navigationController setNavigationBarHidden:YES];
    
//    [self.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
//
//        [self.navigationController.navigationBar setBackgroundImage:[self convertViewToImage:[self getNavBackView]] forBarMetrics:UIBarMetricsDefault];
//
//    } completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
//        [self.navigationController.navigationBar setBackgroundImage:[self convertViewToImage:[self getNavBackView]] forBarMetrics:UIBarMetricsDefault];
//    }];
    

    [GTCountSDK trackCountEvent:@"life_prizeDetail" withArgs:@{}];//个推统计
    [JANALYTICSService startLogPageView:@"奖品详情"];
    [MobClick beginLogPageView:@"奖品详情"];
    
    self.navigationController.navigationBar.translucent = NO;
    
    
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    
    
    [JANALYTICSService stopLogPageView:@"奖品详情"];
    [MobClick endLogPageView:@"奖品详情"];
    
    self.navigationController.navigationBar.translucent = YES;
    
    
    
//    self.navigationController.navigationBar.barTintColor = K_MainColor;
//
//    [self.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
//
//          [self.navigationController.navigationBar setBackgroundImage:[self convertViewToImage:[self getMainColorBackView]] forBarMetrics:UIBarMetricsDefault];
//          
//      } completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
//          [self.navigationController.navigationBar setBackgroundImage:[self convertViewToImage:[self getMainColorBackView]] forBarMetrics:UIBarMetricsDefault];
//      }];
}

- (void)viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];
    
    
    
    
    if (self.type == CTListPrizeTypeCoins200 ||  self.type == CTListPrizeTypeCoins388 || self.type == CTListPrizeTypeCoins588  || self.type == CTListPrizeTypeCouponsFree_YanWo ||self.type == CTListPrizeTypeInsurance_DaDi || self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeSandals || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine || self.type == CTListPrizeTypeDisposableMop || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard || self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole  || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions  || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy | self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI|| self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN) {
        
        [self.lb_number mas_makeConstraints:^(MASConstraintMaker *make) {
                       make.centerX.equalTo(self.cardView);
                       make.top.offset(35 * WIDTHRADIU);
                       make.height.offset(55 * WIDTHRADIU);
                   }];
       
        [self.lb_type mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.cardView);
            make.top.equalTo(self.lb_number.mas_bottom).offset(14 * WIDTHRADIU);
            make.height.offset(14 * WIDTHRADIU);
        }];
    }else{
        [self.lb_moneyNumber mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerX.equalTo(self.cardView).offset(-15 * WIDTHRADIU);
                make.top.offset(35 * WIDTHRADIU);
                make.height.offset(55 * WIDTHRADIU);
            }];
        
        [self.lb_moneyUnit mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.lb_moneyNumber);
            make.left.equalTo(self.lb_moneyNumber.mas_right).offset(5 * WIDTHRADIU);
            make.height.offset(15 * WIDTHRADIU);
        }];
        
        [self.lb_type mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.cardView);
            make.top.equalTo(self.lb_moneyNumber.mas_bottom).offset(14 * WIDTHRADIU);
            make.height.offset(14 * WIDTHRADIU);
        }];
        
    }
        
    if(self.type == CTListPrizeTypePackage2 || self.type == CTListPrizeTypePackage3 ||self.type == CTListPrizeTypePackage5 || self.type == CTListPrizeTypePackage10 || self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeSandals || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine || self.type == CTListPrizeTypeDisposableMop || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard || self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole  || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions  || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy | self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI|| self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN){
            if (self.state == CTListPrizeStateUnGet ||  self.state == CTListPrizeStateInvalid || self.state == CTListPrizeStateUnKnow) {
                
            }else{
                [self.img_connect mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(self.cardView).offset(50 * WIDTHRADIU);
                    make.top.equalTo(self.cardView.mas_bottom).offset(-14 * WIDTHRADIU);
                    make.width.offset(10 * WIDTHRADIU);
                    make.height.offset(43 * WIDTHRADIU);
                }];
                
                [self.img_connect2 mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(self.cardView).offset(-50 * WIDTHRADIU);
                    make.top.equalTo(self.cardView.mas_bottom).offset(-14 * WIDTHRADIU);
                    make.width.offset(10 * WIDTHRADIU);
                    make.height.offset(43 * WIDTHRADIU);
                }];
            }
        }
        
        
       
    
    
   
    
    [self.lb_date mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.cardView);
        make.top.equalTo(self.lb_type.mas_bottom).offset(6 * WIDTHRADIU);
        make.height.offset(14 * WIDTHRADIU);
    }];
    
    [self.btn_getCoins mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lb_date.mas_bottom).offset(20 * WIDTHRADIU);
        make.left.offset(30 * WIDTHRADIU);
        make.right.offset(-30 * WIDTHRADIU);
        make.height.offset(40 * WIDTHRADIU);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.btn_getCoins.mas_bottom).offset(21 * WIDTHRADIU);
        make.left.offset(8 * WIDTHRADIU);
        make.right.offset(- 8 * WIDTHRADIU);
        make.height.offset(0.5);
    }];
    
    [self.lb_stateTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lineView.mas_bottom).offset(15 * WIDTHRADIU);
        make.left.offset(14 * WIDTHRADIU);
        make.height.offset(14 * WIDTHRADIU);
    }];
    
    if (self.type == CTListPrizeTypeCoins200 || self.type == CTListPrizeTypeCoins388 || self.type == CTListPrizeTypeCoins588 || self.type == CTListPrizeTypeCustomPackage || self.type == CTListPrizeTypeCoupons50_YanWo || self.type == CTListPrizeTypeCouponsFree_YanWo || self.type == CTListPrizeTypeInsurance_DaDi || self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeSandals || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine || self.type == CTListPrizeTypeDisposableMop || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard || self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole  || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions  || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy | self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI|| self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN) {
        [self.lb_state mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.lb_stateTitle);
            make.right.offset(-27 * WIDTHRADIU);
            make.height.offset(14 * WIDTHRADIU);
        }];
    }else {
        [self.btn_bindWx mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.lb_stateTitle);
            make.right.offset(-27 * WIDTHRADIU);
            make.height.offset(14 * WIDTHRADIU);
        }];
        
        [self.img_wxIcon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.btn_bindWx);
            make.right.equalTo(self.btn_bindWx.mas_left).offset(-3);
            make.width.height.offset(20 * WIDTHRADIU);
        }];
    }
    
   
    
    [self.lb_prizeNameTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lb_stateTitle.mas_bottom).offset(15 * WIDTHRADIU);
        make.left.equalTo(self.lb_stateTitle);
        make.height.offset(14 * WIDTHRADIU);
    }];
    
    [self.lb_prizeName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.lb_prizeNameTitle);
         make.right.offset(-27 * WIDTHRADIU);
        make.height.offset(14 * WIDTHRADIU);
    }];
    
    if (self.type == CTListPrizeTypeCouponsFree_YanWo || self.type == CTListPrizeTypeCoupons50_YanWo) {
        
        [self.lb_CDkeyTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.lb_prizeNameTitle.mas_bottom).offset(15 * WIDTHRADIU);
            make.left.equalTo(self.lb_prizeNameTitle);
            make.height.offset(14 * WIDTHRADIU);
        }];
        
        [self.btn_copy mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.lb_CDkeyTitle);
            make.right.offset(-27 * WIDTHRADIU);
            make.height.offset(16 * WIDTHRADIU);
            make.width.offset(28);
        }];
        
        [self.lb_CDkey mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.lb_CDkeyTitle);
            make.right.equalTo(self.btn_copy.mas_left).offset(-5);
            make.height.offset(14 * WIDTHRADIU);
        }];
       
    }
    
    
    
    
    
   
   
    
}

- (void)navConfig
{
    UIView*navView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, cl_kNavigationBarHeight)];
    navView.backgroundColor = [UIColor colorWithHex:0xf8502c];
    //返回按钮
    UIButton* backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [backBtn setTitle:@"返回" forState:UIControlStateNormal];
    [backBtn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
    [backBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    backBtn.frame = CGRectMake(10, cl_kStatusBarHeight, 60, 44);
    [backBtn layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleLeft imageTitleSpace:4];
    [backBtn addTarget:self action:@selector(backClick:) forControlEvents:UIControlEventTouchUpInside];
    
    
    UILabel* lb_title = [UILabel new];
    lb_title.text = self.title;
    lb_title.font = [UIFont boldSystemFontOfSize:17];
    lb_title.textAlignment = NSTextAlignmentCenter;
    lb_title.textColor = [UIColor whiteColor];
    [navView addSubview:backBtn];
    [navView addSubview:lb_title];
    [lb_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(cl_kStatusBarHeight);
        make.centerX.equalTo(navView);
        make.height.offset(44);
    }];
    
    if (self.type == CTListPrizeTypeCouponsFree_YanWo || self.type == CTListPrizeTypeCoupons50_YanWo) {
        [navView addSubview:self.btn_list];
        [self.btn_list mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.offset(cl_kStatusBarHeight);
            make.right.offset(-10);
            make.width.offset(80);
            make.height.offset(44);
        }];
    }
    
    [self.view addSubview:navView];
}

#pragma mark - InsuranceAlertViewDelegate
/** 弹窗按钮点击的回调 */
- (void)InsuranceAlertView:(InsuranceAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 200) {
        [self goToDaDiInsuranceVC];
    }
}

#pragma mark - AddressAlertViewDelegate
- (void)commitUserInfo:(NSDictionary *)userInfo
{
    NSLog(@"userInfo:%@",userInfo);
    
    [self receiveVacuumCupRequest:userInfo];
}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
    return 3;
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *stringIdentifier = @"cell";
    
    CTPrizeDetailProcessTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:stringIdentifier];
    
    cell.currented = YES;
    if (indexPath.row == 0) {
        cell.hasUpLine = NO;
        cell.hasDownLine = YES;
        
    }else if (indexPath.row == 1){
        cell.hasUpLine = YES;
        cell.hasDownLine = YES;
    }else if (indexPath.row == 2){
        cell.hasUpLine = YES;
        cell.hasDownLine = NO;
    }
    
    [cell reloadUIWithData:self.contentDic type:self.type state:self.state Index:indexPath.row];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 54 * WIDTHRADIU;
}

#pragma mark - 字符串转日期后30天后的日期
- (NSDate *)getDateWithDateStr:(NSString *)str
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy/MM/dd"];
    NSDate *date = [dateFormatter dateFromString:str];
    
    return date;
}

- (NSDate *)getDate2WithDateStr:(NSString *)str
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSDate *date = [dateFormatter dateFromString:str];
    
    return date;
}

- (NSDate *)getDateAfter30DaysWithCurrentDate:(NSDate *)date
{
    NSDate *newDate = [date dateByAddingTimeInterval:30 * 60 * 60  * 24];
    return newDate;
}

- (NSDate *)getDateAfter15DaysWithCurrentDate:(NSDate *)date
{
    NSDate *newDate = [date dateByAddingTimeInterval:15 * 60 * 60  * 24];
    return newDate;
}

- (NSString *)getCustomDateStrWithDate:(NSDate *)date
{
    // 获取代表公历的NSCalendar对象
    NSCalendar *gregorian = [[NSCalendar alloc]
                             initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
    // 定义一个时间字段的旗标，指定将会获取指定年、月、日、时、分、秒的信息
    unsigned unitFlags = NSCalendarUnitYear |
    NSCalendarUnitMonth |  NSCalendarUnitDay |
    NSCalendarUnitHour |  NSCalendarUnitMinute |
    NSCalendarUnitSecond | NSCalendarUnitWeekday;
    // 获取不同时间字段的信息
    NSDateComponents* comp = [gregorian components: unitFlags
                                          fromDate:date];
    // 获取各时间字段的数值
    NSLog(@"现在是%ld年" , comp.year);
    NSLog(@"现在是%ld月 " , comp.month);
    NSLog(@"现在是%ld日" , comp.day);
    NSLog(@"现在是%ld时" , comp.hour);
    NSLog(@"现在是%ld分" , comp.minute);
    NSLog(@"现在是%ld秒" , comp.second);
    NSLog(@"现在是星期%ld" , comp.weekday);
    
    return [NSString stringWithFormat:@"%ld.%ld.%ld",(long)comp.year,comp.month,comp.day];
    
}

- (NSString *)getCustom2DateStrWithDate:(NSDate *)date
{
    // 获取代表公历的NSCalendar对象
    NSCalendar *gregorian = [[NSCalendar alloc]
                             initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
    // 定义一个时间字段的旗标，指定将会获取指定年、月、日、时、分、秒的信息
    unsigned unitFlags = NSCalendarUnitYear |
    NSCalendarUnitMonth |  NSCalendarUnitDay |
    NSCalendarUnitHour |  NSCalendarUnitMinute |
    NSCalendarUnitSecond | NSCalendarUnitWeekday;
    // 获取不同时间字段的信息
    NSDateComponents* comp = [gregorian components: unitFlags
                                          fromDate:date];
    // 获取各时间字段的数值
    NSLog(@"现在是%ld年" , comp.year);
    NSLog(@"现在是%ld月 " , comp.month);
    NSLog(@"现在是%ld日" , comp.day);
    NSLog(@"现在是%ld时" , comp.hour);
    NSLog(@"现在是%ld分" , comp.minute);
    NSLog(@"现在是%ld秒" , comp.second);
    NSLog(@"现在是星期%ld" , comp.weekday);
    
    return [NSString stringWithFormat:@"%ld.%ld.%ld   %ld:%ld",(long)comp.year,comp.month,comp.day,comp.hour,comp.minute];
    
}

#pragma mark - event response
- (void)backClick:(UIButton *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)btnClick:(UIButton *)sender
{
    


    
    if (self.type == CTListPrizeTypePackage2  ||self.type == CTListPrizeTypePackage3 || self.type == CTListPrizeTypePackage5  || self.type == CTListPrizeTypePackage10) {
        
        if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]] ) {
            [SVProgressHUD showErrorWithStatus:@"您未安装微信\n只支持微信提现哟!"];
            
            return;
        }
        
        if ([sender.titleLabel.text isEqualToString:@"绑定微信提现"]) {
            [self getUserInfoForPlatform:UMSocialPlatformType_WechatSession];
        }else if ([sender.titleLabel.text isEqualToString:@"微信提现"]){
            
            
           
           
            
            
            [self withdrawCash];
            sender.userInteractionEnabled = NO;
        }else if ([sender.titleLabel.text isEqualToString:@"重新领取"]){
            [self withdrawCash];
            sender.userInteractionEnabled = NO;
        }
       
    }else if (self.type == CTListPrizeTypeInsurance_DaDi){
            InsuranceAlertView *alertView = [[InsuranceAlertView alloc]init];
            alertView.delegate = self;
            [alertView show];
        
            return;
        
    }  else if (self.type == CTListPrizeTypeCoins200 || self.type == CTListPrizeTypeCoins388 || self.type == CTListPrizeTypeCoins588 || self.type == CTListPrizeTypeCustomPackage){
        if ([sender.titleLabel.text isEqualToString:@"立即领取"]) {
            [self requestGetCoins];
        }
    }else if (self.type == CTListPrizeTypeCouponsFree_YanWo || self.type == CTListPrizeTypeCoupons50_YanWo){
        [self getExchangeTickets];
    }else if (self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeSandals || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine || self.type == CTListPrizeTypeDisposableMop || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard || self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole  || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions  || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy | self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI|| self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN){
        
        if (self.state == CTListPrizeStateUnGet && [sender.titleLabel.text isEqualToString:@"立即领取"]) {
            AddressAlertView *alertView = [[AddressAlertView alloc]initWithType:self.type];
            
            alertView.delegate = self;
            
            [alertView show];
        }
        
    }
    
    
}

- (void)bindWXClick:(UIButton *)sender
{
    if ([sender.titleLabel.text isEqualToString:@"未绑定"]) {
        
        
        if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]] ) {
            [SVProgressHUD showErrorWithStatus:@"您未安装微信\n只支持微信提现哟!"];
            
            return;
        }
        
        [self getUserInfoForPlatform:UMSocialPlatformType_WechatSession];
        
        sender.userInteractionEnabled = NO;
    }
}


- (void)btn_copyClick:(UIButton *)btn
{
    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    pasteboard.string = self.lb_CDkey.text;
    
    
    [CQToast setDefaultDuration:1];
    [CQToast showWithMessage:@"兑换码已复制"];
    
    
    double delayInSeconds = 1.0;
    
   　dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        
        　　  WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object];
        launchMiniProgramReq.userName = @"gh_d91a69e1bbbe";  //拉起的小程序的username
        //launchMiniProgramReq.path = @"WXMiniPro://gh_f8a0e531525d/pages/base/redirect/index?routeKey=PH04_PRODUCT_TRANSFER_CY&wtagid=118.4.2";    //拉起小程序页面的可带参路径，不填默认拉起小程序首页
        launchMiniProgramReq.miniProgramType = WXMiniProgramTypeRelease; //拉起小程序的类型
        [WXApi sendReq:launchMiniProgramReq completion:^(BOOL success) {
            
        }];
        
        });
    
    
  
}

- (void)processBtnClick:(UIButton *)btn
{
    
    if (self.type == CTListPrizeTypeCouponsFree_YanWo || self.type == CTListPrizeTypeCoupons50_YanWo) {
//        UIStoryboard *sb  =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
        WebViewController *tc=[WebViewController new];
        
        tc.title = @"智能客服";
        
        //String url1 = "http://172.16.10.121/award/html-kefu/question/1cj.html";
        //String url2 = "http://172.16.10.121/award/html-kefu/question/3cj.html";
        
        tc.URL =[NSURL URLWithString: @"http://kefu.weface.com.cn/question/1cj.html"];
        
        
        
        [self.navigationController pushViewController:tc animated:YES];
    }
   
}




#pragma mark - api 调用
- (void)requestBindAPI
{
    
    WeakSelf
    NSString *url = [NSString stringWithFormat:@"%@scorepay/validateBind",CoinsBaseUrl];
    
    NSDictionary *dic = @{
                          @"userid":[NSNumber numberWithInteger:[getPeopleID PeopleID]],
                          @"telephone": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                          @"requestTimeStamp":[NSNumber numberWithInteger:[self getNowTimeTimestamp3]],
                          @"fromModel":@"2",
                          @"accounttype":[NSNumber numberWithInt:1],
                          };
    
    
    NSArray *result = [dic.allKeys sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        
        NSLog(@"%@~%@",obj1,obj2); //3~4 2~1 3~1 3~2
        
        return [obj1 compare:obj2]; //升序
        
    }];
    NSString *sign = nil;
    for (int i = 0; i < result.count; i++) {
        NSString *key = result[i];
        if (i==0) {
            sign = [NSString stringWithFormat:@"%@=%@",key,dic[key]];
        }else{
            
            sign = [NSString stringWithFormat:@"%@&%@=%@",sign,key,dic[key]];
        }
    }
    
    sign = [NSString stringWithFormat:@"%@&weface9578",sign];
    
    NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:dic];
    
    NSString *signString = [[MyMD5 md5:sign] lowercaseString];
    [params setObject:signString forKey:@"sign"];
    
    [CTAPIBaseManager POST:url params:params completionHandler:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        
        self.btn_bindWx.userInteractionEnabled = NO;
        
        if (error) {
            [SVProgressHUD showInfoWithStatus:@"无网络"];
            return ;
        }
        
        if (responseObject) {
            NSNumber *code = responseObject[@"code"];
            NSString *des = responseObject[@"des"];
            if ([code isKindOfClass:[NSNumber class]]) {
                if (code.integerValue == 0) {
                    if (weakSelf.state == CTListPrizeStateUnGet) {
                        [weakSelf.btn_getCoins setTitle:@"微信提现" forState:UIControlStateNormal];
                    }
                    
                    NSString *screenName = [NSString blankString:responseObject[@"result"][@"screenName"]] ? @"" : responseObject[@"result"][@"screenName"];
                    NSString *iconUrl = [NSString blankString:responseObject[@"result"][@"iconUrl"]] ? @"" : responseObject[@"result"][@"iconUrl"];
                    
                    [weakSelf.btn_bindWx setTitle:screenName forState:UIControlStateNormal];
                    [weakSelf.btn_bindWx  layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleRight imageTitleSpace:3];
                    
                    [weakSelf.img_wxIcon sd_setImageWithURL:[NSURL URLWithString:iconUrl] placeholderImage:[UIImage imageNamed:@"my_information_headportrait_default"]];
                    
                    self.btn_bindWx.userInteractionEnabled = NO;
                    
                    
                }else if (code.integerValue == 1018){
                    if (weakSelf.state == CTListPrizeStateUnGet) {
                        [weakSelf.btn_getCoins setTitle:@"绑定微信提现" forState:UIControlStateNormal];
                    }
                    
                }else{
                    [SVProgressHUD showInfoWithStatus:des];
                }
            }else{
                [SVProgressHUD showInfoWithStatus:@"服务器错误"];
            }
        }
    }];
}

//30元兑换

- (void)exchangeTicket
{
    
   [KKLoadingAnimationView show];
    
    WeakSelf
    NSString *url = [NSString stringWithFormat:@"%@scorepay/cashMoney",CoinsBaseUrl];
    
    NSDictionary *dic = @{
                          @"recordId":self.contentDic[@"recordId"],
                          @"userorderno":self.contentDic[@"userorderno"] ? self.contentDic[@"userorderno"] : @"",
                          @"giftId":self.contentDic[@"giftId"],
                          @"userid":[NSNumber numberWithInteger:[getPeopleID PeopleID]],
                          @"telephone": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                          @"requestTimeStamp":[NSNumber numberWithInteger:[self getNowTimeTimestamp3]],
                          @"paystyle":[NSNumber numberWithInt:1],
                          };
    
    
    NSArray *result = [dic.allKeys sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        
        NSLog(@"%@~%@",obj1,obj2); //3~4 2~1 3~1 3~2
        
        return [obj1 compare:obj2]; //升序
        
    }];
    NSString *sign = nil;
    for (int i = 0; i < result.count; i++) {
        NSString *key = result[i];
        if (i==0) {
            sign = [NSString stringWithFormat:@"%@=%@",key,dic[key]];
        }else{
            
            sign = [NSString stringWithFormat:@"%@&%@=%@",sign,key,dic[key]];
        }
    }
    
    sign = [NSString stringWithFormat:@"%@&kw#8ra",sign];
    
    NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:dic];
    
    NSString *signString = [[MyMD5 md5:sign] lowercaseString];
    [params setObject:signString forKey:@"sign"];
    
    [CTAPIBaseManager POST:url params:params completionHandler:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        
        weakSelf.btn_getCoins.userInteractionEnabled = YES;
        
        [KKLoadingAnimationView dismiss];
        
        if (error) {
            [SVProgressHUD showInfoWithStatus:@"无网络"];
            return ;
        }
        
        if (responseObject) {
            NSNumber *code = responseObject[@"code"];
//            NSString *des = responseObject[@"des"];
            if ([code isKindOfClass:[NSNumber class]]) {
                if (code.integerValue == 0) {
                    
                    if (weakSelf.clickBlock) {
                        weakSelf.clickBlock(YES);
                    }
                   
                    [weakSelf.btn_getCoins setTitle:@"已领取" forState:UIControlStateNormal];
                    [weakSelf.btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
                    weakSelf.btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                    weakSelf.btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
                    weakSelf.btn_getCoins.layer.borderWidth = 1.0;
                    weakSelf.btn_getCoins .userInteractionEnabled = NO;
                    
                    NSString *payTime = responseObject[@"result"][@"payTime"];
                    weakSelf.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[weakSelf getCustom2DateStrWithDate:[weakSelf getDate2WithDateStr:payTime]]];
                    
                    
                    NSMutableDictionary *dic = [weakSelf.contentDic mutableCopy];
                    
                    [dic setObject:[weakSelf getCustomDateStrWithDate:[weakSelf getDate2WithDateStr:payTime]] forKey:@"payTime"];
                    
                    [dic setObject:[weakSelf getCustomDateStrWithDate:[NSDate date]] forKey:@"orderRequestTime"];
                    
                    self.contentDic = dic;
                    
                    if (weakSelf.state == CTListPrizeStateUnGet) {
                        
                        
                        weakSelf.state = CTListPrizeStateReceived;
                        
                        [weakSelf withDrawrefreshUI];
                    }else if (weakSelf.state == CTListPrizeStateFailure){
                        weakSelf.state = CTListPrizeStateReceived;
                        
                        [weakSelf.tableView reloadData];
                    }
                    
                    
                    
                    
                }else if (code.integerValue == 1017){
                    [SVProgressHUD showInfoWithStatus:@"提现失败"];
                }else if (code.integerValue == 1018){
                    [SVProgressHUD showInfoWithStatus:@"账户未授权"];
                }else if (code.integerValue == 1023){
                    [SVProgressHUD showInfoWithStatus:@"账户异常"];
                }else if (code.integerValue == 1024){
                    [SVProgressHUD showInfoWithStatus:@"账户异常"];
                }else{
                    [SVProgressHUD showInfoWithStatus:@"    请确定微信账号           \n  是否已实名   "];
                    if (self.state == CTListPrizeStateUnGet) {
                        
                        weakSelf.clickBlock(YES);
                        [weakSelf.btn_getCoins setTitle:@"重新领取" forState:UIControlStateNormal];
                        
                        weakSelf.state = CTListPrizeStateFailure;
                        [weakSelf withDrawrefreshUI];
                    }
                    
                }
            } else{
                [SVProgressHUD showInfoWithStatus:@"无网络"];
            }
        }
        
    }];
}


- (void)goToDaDiInsuranceVC
{
    NSLog(@"跳转到大地保险界面");
    
    
    [GTCountSDK trackCountEvent:@"InsuranceClickStatistics" withArgs:@{}];
    
    WebViewController *tc=[WebViewController new];
    
    tc.title = @"房屋险";
    
 
    
    tc.URL =[NSURL URLWithString: @"http://bdxt.95590.cn/bdmobile/view/store/product/ruralHomeInsurance/ruralHomeInsurance_toubao.html?storeCode=vsrhbtMbuKye5pBQ6jsT&status=6&provinceComCode=41&isShareFlag=1&from=groupmessage&isappinstalled=0"];
    
    
 
        [self.navigationController pushViewController:tc animated:YES];
    
}


- (void)bindWxApiWithParams:(NSDictionary *)dic
{
    NSString *url = [NSString stringWithFormat:@"%@scorepay/accountBind",CoinsBaseUrl];
    
    
    
    NSDictionary *dic2 = @{
                          @"userid":[NSNumber numberWithInteger:[getPeopleID PeopleID]],
                          @"telephone": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                          @"accounttype":[NSNumber numberWithInt:1],
                          @"requestTimeStamp":[NSNumber numberWithInteger:[self getNowTimeTimestamp3]],
                          @"fromModel":@"2",
                          @"accounttype":[NSNumber numberWithInt:1],
                          };
    
    NSMutableDictionary *dic3 = [[NSMutableDictionary alloc]initWithDictionary:dic];
    
    [dic3 addEntriesFromDictionary:dic2];
    
    
    NSArray *result = [dic3.allKeys sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        
        NSLog(@"%@~%@",obj1,obj2); //3~4 2~1 3~1 3~2
        
        return [obj1 compare:obj2]; //升序
        
    }];
    NSString *sign = nil;
    for (int i = 0; i < result.count; i++) {
        NSString *key = result[i];
        if (i==0) {
            sign = [NSString stringWithFormat:@"%@=%@",key,dic3[key]];
        }else{
            
            sign = [NSString stringWithFormat:@"%@&%@=%@",sign,key,dic3[key]];
        }
    }
    
    sign = [NSString stringWithFormat:@"%@&weface9578",sign];
    
    NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:dic3];
    
    NSString *signString = [[MyMD5 md5:sign] lowercaseString];
    [params setObject:signString forKey:@"sign"];
    
    NSString *username = dic3[@"screenname"];
    [params setObject:[username stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]] forKey:@"screenname"];
    
    WeakSelf
    [CTAPIBaseManager POST:url params:params completionHandler:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        
        if (error) {
            [SVProgressHUD showInfoWithStatus:@"无网络"];
            return ;
        }
        
        if (responseObject) {
            NSNumber *code = responseObject[@"code"];
            NSString *des = responseObject[@"des"];
            if ([code isKindOfClass:[NSNumber class]]) {
                if (code.integerValue == 0) {
                    
                    weakSelf.clickBlock(YES);
                    
                    [weakSelf.btn_getCoins setTitle:@"微信提现" forState:UIControlStateNormal];
                    
                    NSString *screenName = username ? username : @"";
                    NSString *iconUrl = dic[@"iconurl"];
                    
                    [weakSelf.btn_bindWx setTitle:screenName forState:UIControlStateNormal];
                    [weakSelf.btn_bindWx  layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleRight imageTitleSpace:3];
                    
                    [weakSelf.img_wxIcon sd_setImageWithURL:[NSURL URLWithString:iconUrl] placeholderImage:[UIImage imageNamed:@"my_information_headportrait_default"]];
                    
                }else if (code.integerValue == 1018){
                    [weakSelf.btn_getCoins setTitle:@"绑定微信提现" forState:UIControlStateNormal];
                }else if (code.integerValue == 1019){
                     [SVProgressHUD showInfoWithStatus:@"该微信号已绑定"];
                }else{
                    [SVProgressHUD showInfoWithStatus:des];
                }
            }else{
                [SVProgressHUD showInfoWithStatus:@"服务器错误"];
            }
        }
    }];
}


//兑换码接口
- (void)getExchangeTickets
{
    [KKLoadingAnimationView show];
    
    WeakSelf
    NSString *url = [NSString stringWithFormat:@"%@score/excharge",CoinsBaseUrl];
    
    NSDictionary *dic = @{
                          @"telphone": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                          @"sysorderNo":self.contentDic[@"recordId"] ? [NSString stringWithFormat:@"%@",self.contentDic[@"recordId"]] : @"",
                          @"userId":[NSString stringWithFormat:@"%ld",[getPeopleID PeopleID]],
                          @"requestTimeStamp":[NSNumber numberWithInteger:[self getNowTimeTimestamp3]]
                          };
    
    
    NSArray *result = [dic.allKeys sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        
        NSLog(@"%@~%@",obj1,obj2); //3~4 2~1 3~1 3~2
        
        return [obj1 compare:obj2]; //升序
        
    }];
    NSString *sign = nil;
    for (int i = 0; i < result.count; i++) {
        NSString *key = result[i];
        if (i==0) {
            sign = [NSString stringWithFormat:@"%@=%@",key,dic[key]];
        }else{
            
            sign = [NSString stringWithFormat:@"%@&%@=%@",sign,key,dic[key]];
        }
    }
    
    sign = [NSString stringWithFormat:@"%@&kk#d12",sign];
    
    NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:dic];
    
    NSString *signString = [[MyMD5 md5:sign] lowercaseString];
    [params setObject:signString forKey:@"sign"];
    
    [CTAPIBaseManager POST:url params:params completionHandler:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        
       [KKLoadingAnimationView dismiss];
        
        if (error) {
            [SVProgressHUD showInfoWithStatus:@"无网络"];
            return ;
        }
        
        if (responseObject) {
            NSNumber *code = responseObject[@"code"];
            NSString *des = responseObject[@"des"];
            if ([code isKindOfClass:[NSNumber class]]) {
                if (code.integerValue == 0) {
                    
                    weakSelf.clickBlock(YES);
                    [weakSelf.btn_getCoins setTitle:@"兑换码已领取" forState:UIControlStateNormal];
                    [weakSelf.btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
                    weakSelf.btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                    weakSelf.btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
                    weakSelf.btn_getCoins.layer.borderWidth = 1.0;
                    weakSelf.btn_getCoins .userInteractionEnabled = NO;
                    weakSelf.lb_state.text = @"已领取";
                    
                    CGRect frame = weakSelf.cardView.frame;
                    
                    frame.size.height = 326 * WIDTHRADIU;
                    
                    weakSelf.cardView.frame = frame;
                    
                    weakSelf.lb_CDkeyTitle.hidden = NO;
                    weakSelf.lb_CDkey.hidden = NO;
                    weakSelf.btn_copy.hidden = NO;
                    
                    NSString *ticketNo = responseObject[@"result"][@"ticketNo"];
                    weakSelf.lb_CDkey.text = [EnercryTool decryptUseDES:ticketNo key:DESKEY];
                    
                    
                    [weakSelf btn_copyClick:self.btn_copy];
                    
                }else{
                    [SVProgressHUD showInfoWithStatus:des];
                }
            } else{
                [SVProgressHUD showInfoWithStatus:@"服务器错误"];
            }
        }
        
    }];
}


//雷俊博,中奖分享赠送
- (void)loadData2{
    
    
    
    
    NSString *url = [NSString stringWithFormat:@"%@score/increateScore",CoinsBaseUrl];
    NSDictionary *dic = @{
                          @"userId":[NSNumber numberWithInteger:[getPeopleID PeopleID]],
                          @"telephone": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                          @"scoreType":@"1014",
                          @"reqTimesTamp":[NSNumber numberWithInteger:[self getNowTimeTimestamp3]],
                          @"fromModel":@"2"
                          };
    
    NSArray *result = [dic.allKeys sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        
        NSLog(@"%@~%@",obj1,obj2); //3~4 2~1 3~1 3~2
        
        return [obj1 compare:obj2]; //升序
        
    }];
    NSString *sign = nil;
    for (int i = 0; i < result.count; i++) {
        NSString *key = result[i];
        if (i==0) {
            sign = [NSString stringWithFormat:@"%@=%@",key,dic[key]];
        }else{
            
            sign = [NSString stringWithFormat:@"%@&%@=%@",sign,key,dic[key]];
        }
    }
    
    sign = [NSString stringWithFormat:@"%@&Kanwf574",sign];
    
    NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:dic];
    
    NSString *signString = [[MyMD5 md5:sign] lowercaseString];
    [params setObject:signString forKey:@"sign"];
    
    
    
    
    
    
    
    [self extracted:params url:url];
    
}

- (void)extracted:(NSMutableDictionary *)params url:(NSString *)url {
    WeakSelf
    [CTAPIBaseManager POST:url params:params completionHandler:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        
        if (responseObject) {
            NSNumber *code = responseObject[@"code"];
            if ([code isKindOfClass:[NSNumber class]]) {
                if (code.integerValue == 1006) {
                    //@1缩放s动画
                    
                    NSDate *oldDate = [NSDate date];
                    [[NSUserDefaults standardUserDefaults]setObject:oldDate forKey:@"shareLastTime"];
                    [[NSUserDefaults standardUserDefaults]synchronize];
                    
                    NSNumber *score = responseObject[@"result"][@"score"];
                    if ([score isKindOfClass:[NSNumber class]]) {
                        
                        
                        [weakSelf alertWithScore:score];
                       
                    }
                    
                    
                    
                }
                
               
                
            }
            
           
        }
    }];
}



#pragma mark - 绑定微信
- (void)getUserInfoForPlatform:(UMSocialPlatformType)platformType
{WeakSelf
    [[UMSocialManager defaultManager] getUserInfoWithPlatform:platformType currentViewController:self completion:^(id result, NSError *error) {
        NSLog(@">>>>>wx>>result:%@, error:%@",result,error);
        
        if (error) {
            [SVProgressHUD showErrorWithStatus:@"微信授权失败!"];
            return;
        }
        
        UMSocialUserInfoResponse *resp = result;
        if(resp.uid ){
            if (!resp.name) {
                resp.name =@"";
            }
            if (!resp.iconurl) {
                resp.iconurl=@"";
            }
            
           
        }
        // 第三方登录数据(为空表示平台未提供)
        // 授权数据
        NSLog(@" uid: %@", resp.uid);//uuid
        NSLog(@" openid: %@", resp.openid);
        NSLog(@" accessToken: %@", resp.accessToken);
        NSLog(@" refreshToken: %@", resp.refreshToken);
        NSLog(@" expiration: %@", resp.expiration);
        
        // 用户数据
        NSLog(@" name: %@", resp.name);
        NSLog(@" iconurl: %@", resp.iconurl);
        NSLog(@" gender: %@", resp.gender);
        
        // 第三方平台SDK原始数据
        NSLog(@" originalResponse: %@", resp.originalResponse);
        
        NSDictionary *dic = @{
                              @"iconurl":resp.iconurl ? resp.iconurl :@"",
                              @"openid":resp.openid ? resp.openid : @"",
                              @"uid":resp.uid ? resp.uid : @"",
                              @"token":resp.accessToken ? resp.accessToken : @"",
                              @"screenname":resp.name ? resp.name : @"",
                              };
        [weakSelf bindWxApiWithParams:dic];
    }];
}




- (void)withdrawCash
{
    
    

    
    [KKLoadingAnimationView show];
    
    WeakSelf
    NSString *url = [NSString stringWithFormat:@"%@scorepay/cashMoney",CoinsBaseUrl];
    
    NSDictionary *dic = @{
                          @"recordId":self.contentDic[@"recordId"],
                          @"userorderno":self.contentDic[@"userorderno"] ? self.contentDic[@"userorderno"] : @"",
                          @"giftId":self.contentDic[@"giftId"],
                          @"userid":[NSNumber numberWithInteger:[getPeopleID PeopleID]],
                          @"telephone": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                          @"requestTimeStamp":[NSNumber numberWithInteger:[self getNowTimeTimestamp3]],
                          @"paystyle":[NSNumber numberWithInt:1],
                          };
    
    
    NSArray *result = [dic.allKeys sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        
        NSLog(@"%@~%@",obj1,obj2); //3~4 2~1 3~1 3~2
        
        return [obj1 compare:obj2]; //升序
        
    }];
    NSString *sign = nil;
    for (int i = 0; i < result.count; i++) {
        NSString *key = result[i];
        if (i==0) {
            sign = [NSString stringWithFormat:@"%@=%@",key,dic[key]];
        }else{
            
            sign = [NSString stringWithFormat:@"%@&%@=%@",sign,key,dic[key]];
        }
    }
    
    sign = [NSString stringWithFormat:@"%@&kw#8ra",sign];
    
    NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:dic];
    
    NSString *signString = [[MyMD5 md5:sign] lowercaseString];
    [params setObject:signString forKey:@"sign"];
    
    [CTAPIBaseManager POST:url params:params completionHandler:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        
        weakSelf.btn_getCoins.userInteractionEnabled = YES;
        
        [KKLoadingAnimationView dismiss];
        
        if (error) {
            [SVProgressHUD showInfoWithStatus:@"无网络"];
            return ;
        }
        
        if (responseObject) {
            NSNumber *code = responseObject[@"code"];
//            NSString *des = responseObject[@"des"];
            if ([code isKindOfClass:[NSNumber class]]) {
                if (code.integerValue == 0) {
                    
                    weakSelf.clickBlock(YES);
                    [weakSelf.btn_getCoins setTitle:@"已领取" forState:UIControlStateNormal];
                    [weakSelf.btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
                    weakSelf.btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                    weakSelf.btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
                    weakSelf.btn_getCoins.layer.borderWidth = 1.0;
                    weakSelf.btn_getCoins .userInteractionEnabled = NO;
                    
                    NSString *payTime = responseObject[@"result"][@"payTime"];
                    weakSelf.lb_date.text = [NSString stringWithFormat:@"领取时间：%@",[weakSelf getCustom2DateStrWithDate:[weakSelf getDate2WithDateStr:payTime]]];
                    
                    
                    NSMutableDictionary *dic = [weakSelf.contentDic mutableCopy];
                    
                    [dic setObject:[weakSelf getCustomDateStrWithDate:[weakSelf getDate2WithDateStr:payTime]] forKey:@"payTime"];
                    
                    [dic setObject:[weakSelf getCustomDateStrWithDate:[NSDate date]] forKey:@"orderRequestTime"];
                    
                    self.contentDic = dic;
                    
                    if (weakSelf.state == CTListPrizeStateUnGet) {
                       
                        
                        weakSelf.state = CTListPrizeStateReceived;
                        
                        [weakSelf withDrawrefreshUI];
                    }else if (weakSelf.state == CTListPrizeStateFailure){
                        weakSelf.state = CTListPrizeStateReceived;
                        
                        [weakSelf.tableView reloadData];
                    }
                    
                  
                    
                   
                }else if (code.integerValue == 1017){
                    [SVProgressHUD showInfoWithStatus:@"提现失败"];
                }else if (code.integerValue == 1018){
                    [SVProgressHUD showInfoWithStatus:@"账户未授权"];
                }else if (code.integerValue == 1023){
                    [SVProgressHUD showInfoWithStatus:@"账户异常"];
                }else if (code.integerValue == 1024){
                    [SVProgressHUD showInfoWithStatus:@"账户异常"];
                }else{
                    [SVProgressHUD showInfoWithStatus:@"    请确定微信账号           \n  是否已实名   "];
                    if (self.state == CTListPrizeStateUnGet) {
                        
                          weakSelf.clickBlock(YES);
                          [weakSelf.btn_getCoins setTitle:@"重新领取" forState:UIControlStateNormal];
                        
                        weakSelf.state = CTListPrizeStateFailure;
                        [weakSelf withDrawrefreshUI];
                    }
                    
                }
            } else{
                [SVProgressHUD showInfoWithStatus:@"无网络"];
            }
        }
        
    }];
}


//领取金币
- (void)requestGetCoins
{
    
   [KKLoadingAnimationView show];
    
    WeakSelf
    NSString *url = [NSString stringWithFormat:@"%@score/excharge",CoinsBaseUrl];
    
    NSDictionary *dic = @{
                          @"telphone": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                          @"sysorderNo":self.contentDic[@"recordId"] ? [NSString stringWithFormat:@"%@",self.contentDic[@"recordId"]] : @"",
                          @"userId":[NSString stringWithFormat:@"%ld",[getPeopleID PeopleID]],
                          @"requestTimeStamp":[NSNumber numberWithInteger:[self getNowTimeTimestamp3]]
                          };
    
    
    NSArray *result = [dic.allKeys sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        
        NSLog(@"%@~%@",obj1,obj2); //3~4 2~1 3~1 3~2
        
        return [obj1 compare:obj2]; //升序
        
    }];
    NSString *sign = nil;
    for (int i = 0; i < result.count; i++) {
        NSString *key = result[i];
        if (i==0) {
            sign = [NSString stringWithFormat:@"%@=%@",key,dic[key]];
        }else{
            
            sign = [NSString stringWithFormat:@"%@&%@=%@",sign,key,dic[key]];
        }
    }
    
    sign = [NSString stringWithFormat:@"%@&kk#d12",sign];
    
    NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:dic];
    
     NSString *signString = [[MyMD5 md5:sign] lowercaseString];
    [params setObject:signString forKey:@"sign"];
    
    [CTAPIBaseManager POST:url params:params completionHandler:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        
        [KKLoadingAnimationView dismiss];
        
        if (error) {
            [SVProgressHUD showInfoWithStatus:@"无网络"];
            return ;
        }
        
        if (responseObject) {
            NSNumber *code = responseObject[@"code"];
            NSString *des = responseObject[@"des"];
            if ([code isKindOfClass:[NSNumber class]]) {
                if (code.integerValue == 0) {
                    
                    weakSelf.clickBlock(YES);
                    [weakSelf.btn_getCoins setTitle:@"已领取" forState:UIControlStateNormal];
                    [weakSelf.btn_getCoins setTitleColor:[UIColor colorWithHex:0xb3b3b3] forState:UIControlStateNormal];
                    weakSelf.btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                    weakSelf.btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xb3b3b3].CGColor;
                    weakSelf.btn_getCoins.layer.borderWidth = 1.0;
                    weakSelf.btn_getCoins .userInteractionEnabled = NO;
                    weakSelf.lb_state.text = @"已领取";
                }else{
                    [SVProgressHUD showInfoWithStatus:des];
                }
            } else{
                [SVProgressHUD showInfoWithStatus:@"服务器错误"];
            }
        }
        
    }];
}


//领取保温杯接口
- (void)receiveVacuumCupRequest:(NSDictionary *)para
{
    NSString *urlString = [NSString stringWithFormat:@"%@score/excharge",CoinsBaseUrl];
    
    NSDictionary *dic = @{
                             @"telphone": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                             @"sysorderNo":self.contentDic[@"recordId"] ? [NSString stringWithFormat:@"%@",self.contentDic[@"recordId"]] : @"",
                             @"userId":[NSString stringWithFormat:@"%ld",[getPeopleID PeopleID]],
                             @"requestTimeStamp":[NSNumber numberWithInteger:[self getNowTimeTimestamp3]]
                             };
       
       
       NSArray *result = [dic.allKeys sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
           
           NSLog(@"%@~%@",obj1,obj2); //3~4 2~1 3~1 3~2
           
           return [obj1 compare:obj2]; //升序
           
       }];
       NSString *sign = nil;
       for (int i = 0; i < result.count; i++) {
           NSString *key = result[i];
           if (i==0) {
               sign = [NSString stringWithFormat:@"%@=%@",key,dic[key]];
           }else{
               
               sign = [NSString stringWithFormat:@"%@&%@=%@",sign,key,dic[key]];
           }
       }
       
       sign = [NSString stringWithFormat:@"%@&kk#d12",sign];
       
       NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:dic];
       
        NSString *signString = [[MyMD5 md5:sign] lowercaseString];
       [params setObject:signString forKey:@"sign"];
    
    NSDictionary *otherPram = nil;
    
    if (self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine || self.type == CTListPrizeTypeDisposableMop || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard || self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole  || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions  || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy | self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI || self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN) {
        otherPram = @{
            @"expressName":[EnercryTool AES256Encrypt:para[@"name"]  key:AESKEY],
            @"expressTelephone":[EnercryTool AES256Encrypt:para[@"mobile"] key:AESKEY],
            @"expressAdress":[EnercryTool AES256Encrypt:[NSString stringWithFormat:@"%@%@",para[@"address"],para[@"detailAddress"]] key:AESKEY]
        };
    }else if (self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeSandals){
       otherPram = @{
            @"expressName":[EnercryTool AES256Encrypt:para[@"name"]  key:AESKEY],
            @"expressTelephone":[EnercryTool AES256Encrypt:para[@"mobile"] key:AESKEY],
            @"expressAdress":[EnercryTool AES256Encrypt:[NSString stringWithFormat:@"%@%@",para[@"address"],para[@"detailAddress"]] key:AESKEY],
            @"remark":[EnercryTool AES256Encrypt:para[@"remark"]  key:AESKEY]
        };
    }
    
    [params addEntriesFromDictionary:otherPram];
    

    NSLog(@"领取保温杯接口url:%@",urlString);
    NSLog(@"params:%@",params);
    WeakSelf
    [CTAPIBaseManager POST:urlString params:params completionHandler:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        
        NSLog(@"responseObject:%@",responseObject);
        NSLog(@"error:%@",error);
        
        [SVProgressHUD doneShow];
        [SVProgressHUD dismiss];
        
        if (error) {
            [SVProgressHUD showInfoWithStatus:@"无网络"];
            return ;
        }
        
        if (responseObject) {
            NSNumber *code = responseObject[@"code"];
            NSString *des = responseObject[@"des"];
            if ([code isKindOfClass:[NSNumber class]]) {
                if (code.integerValue == 0) {
                    
                    weakSelf.clickBlock(YES);
                    [weakSelf.btn_getCoins setTitle:@"发货中..." forState:UIControlStateNormal];
                    [weakSelf.btn_getCoins setTitleColor:[UIColor colorWithHex:0xfd592f] forState:UIControlStateNormal];
                    weakSelf.btn_getCoins.layer.cornerRadius = 20 * WIDTHRADIU;
                    weakSelf.btn_getCoins.layer.borderColor = [UIColor colorWithHex:0xfd592f].CGColor;
                    weakSelf.btn_getCoins.layer.borderWidth = 1.0;
                    weakSelf.btn_getCoins .userInteractionEnabled = NO;
                    weakSelf.lb_state.text = @"发货中";
                    weakSelf.state = CTListPrizeStateGiving;
                    [weakSelf withDrawrefreshUI];
                    [PrizeInfoCommitSuccessAlertView showSuccessViewWithNumber:@"200" block:^(CTShareType type) {
                        if (type == CTShareTypeWX) {
                            [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession];
                        }else if (type == CTShareTypeFriend){
                            [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine];
                        }
                           }];
                    
                }else{
                    [SVProgressHUD showInfoWithStatus:des];
                }
            } else{
                [SVProgressHUD showInfoWithStatus:@"服务器错误"];
            }
        }
        
    }];
}

//点击提现后,重新刷新UI
- (void)withDrawrefreshUI
{
    [self.backView addSubview:self.processView];
    [self.backView  addSubview:self.img_connect];
    [self.backView  addSubview:self.img_connect2];
    
    [self.img_connect mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.cardView).offset(50 * WIDTHRADIU);
        make.top.equalTo(self.cardView.mas_bottom).offset(-14 * WIDTHRADIU);
        make.width.offset(10 * WIDTHRADIU);
        make.height.offset(43 * WIDTHRADIU);
    }];
    
    [self.img_connect2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.cardView).offset(-50 * WIDTHRADIU);
        make.top.equalTo(self.cardView.mas_bottom).offset(-14 * WIDTHRADIU);
        make.width.offset(10 * WIDTHRADIU);
        make.height.offset(43 * WIDTHRADIU);
    }];
}

#pragma mark - 获取当前时间戳

-(NSInteger )getNowTimeTimestamp3{
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
    
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss SSS"]; // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
    
    //设置时区,这个对于时间的处理有时很重要
    
    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
    
    [formatter setTimeZone:timeZone];
    
    NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式
    
    NSInteger timeSp = [datenow timeIntervalSince1970]*1000;
    
    return timeSp;
}

- (void)alertWithScore:(NSNumber *)score
{
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"每日分享成功"
                                                    message:[NSString stringWithFormat:@"赠送%@金币",score]
                                                   delegate:nil
                                          cancelButtonTitle:NSLocalizedString(@"确定", @"确定")
                                          otherButtonTitles:nil];
    [alert show];
}
#pragma mark - 分享
- (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType
{
    if (![WXApi isWXAppInstalled]) {
        [Tools showMessage:@"请先安装微信!!!"];
        return;
    }
     WeakSelf
       //创建分享消息对象
       UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
       
       
       //创建网页内容对象
//       NSString* thumbURL =  UMS_THUMB_IMAGE;
       UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:@"就差你啦！我刚刚在看看社保抽到大奖了，快来看看吧" descr:@"签到0元抽，奖品免费拿，还有更多惊喜在等你哟~" thumImage:[UIImage imageNamed:@"login_icon"]];
       //设置网页地址
     NSString *url = @"http://nginx.weface.com.cn/lesson/share/src/award.html";//外网
//       NSString *url = @"http://172.16.10.133/projects/html-nginx/html-nginx/lesson/share/src/award.html";//内网
       shareObject.webpageUrl = url;
       
       //分享消息对象设置分享内容对象
       messageObject.shareObject = shareObject;
       
       //调用分享接口
       [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
           if (error) {
               UMSocialLogInfo(@"************Share fail with error %@*********",error);
           }else{
               if ([data isKindOfClass:[UMSocialShareResponse class]]) {
                   UMSocialShareResponse *resp = data;
                   //分享结果消息
                   UMSocialLogInfo(@"response message is %@",resp.message);
                   //第三方原始返回的数据
                   UMSocialLogInfo(@"response originalResponse data is %@",resp.originalResponse);
                   
               }else{
                   UMSocialLogInfo(@"response data is %@",data);
               }
               
               [weakSelf loadData2];
           }
           
       }];
}


#pragma mark - getters and setters
- (UIView *)getNavBackView
{
    UIView*backView = [[UIView alloc]initWithFrame:CGRectMake(0,0, ScreenWidth,cl_kNavigationBarHeight)];
    CAGradientLayer*gradientLayer = [CAGradientLayer layer];
    gradientLayer.locations = @[@0.0, @1.0];
    gradientLayer.startPoint = CGPointMake(1, 0);
    gradientLayer.endPoint = CGPointMake(1, 1);
    [gradientLayer setColors:@[(id)[[UIColor colorWithHex:0xff5633] CGColor],(id)[[UIColor colorWithHex:0xf8502c] CGColor]]];//渐变数组
    gradientLayer.frame = backView.frame;
    [backView.layer addSublayer:gradientLayer];
    return backView;
}

//渐变色
- (UIImage *)convertViewToImage:(UIView *)v
{
    CGSize s = v.bounds.size;
    //UIGraphicsBeginImageContextWithOptions(s, NO, [UIScreen mainScreen].scale);
    UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init];
    format.opaque = NO;
    format.scale = [UIScreen mainScreen].scale;
    UIGraphicsImageRenderer*re=[[UIGraphicsImageRenderer alloc] initWithSize:s format:format];
    [v.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

- (UIView *)getMainColorBackView
{
    UIView*backView = [[UIView alloc]initWithFrame:CGRectMake(0,0, ScreenWidth,cl_kNavigationBarHeight)];
    backView.backgroundColor = K_MainColor;
       return backView;
}
- (UIScrollView *)scrollView
{
    
    if (!_scrollView) {
        _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, cl_kNavigationBarHeight, ScreenWidth, ScreenHeight - cl_kNavigationBarHeight)];
        _scrollView.backgroundColor = [UIColor clearColor];
        _scrollView.contentSize = CGSizeMake(ScreenWidth, ScreenHeight);
        
        
        _scrollView.showsHorizontalScrollIndicator = NO;
        _scrollView.showsVerticalScrollIndicator = NO;
        
        [_scrollView addSubview:self.backView];
    }
    return _scrollView;
    
}

- (UIView *)backView
{
    if (!_backView) {
        _backView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight * 1)];
        _backView.backgroundColor = [UIColor clearColor];
        [_backView addSubview:self.cardView];
        
        if (self.type == CTListPrizeTypeCoins200 ||  self.type == CTListPrizeTypeCoins388 || self.type == CTListPrizeTypeCoins588 || self.type == CTListPrizeTypeCustomPackage || self.type == CTListPrizeTypeCouponsFree_YanWo || self.type == CTListPrizeTypeCoupons50_YanWo || self.type == CTListPrizeTypeInsurance_DaDi) {
           
        }else{
            if (self.state == CTListPrizeStateUnGet || self.state == CTListPrizeStateInvalid || self.state == CTListPrizeStateUnKnow) {
                
            }else{
                [_backView addSubview:self.processView];
                [_backView addSubview:self.img_connect];
                [_backView addSubview:self.img_connect2];
            }
            
        }
      
    }
    return _backView;
}

- (PrizeDetailCardView *)cardView
{
    if (!_cardView) {
        _cardView = [[PrizeDetailCardView alloc]initWithFrame:CGRectMake(10 * WIDTHRADIU, 10 * WIDTHRADIU , ScreenWidth - 20 * WIDTHRADIU, 304 * WIDTHRADIU)];
        _cardView.backgroundColor = [UIColor whiteColor];
        
        if (self.type == CTListPrizeTypeCoins200 || self.type == CTListPrizeTypeCoins388 || self.type == CTListPrizeTypeCoins588  || self.type == CTListPrizeTypeCouponsFree_YanWo ||  self.type == CTListPrizeTypeInsurance_DaDi || self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeSandals || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine || self.type == CTListPrizeTypeDisposableMop || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard || self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole  || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions  || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy | self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI|| self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN) {
            [_cardView addSubview:self.lb_number];
        }else{
            [_cardView addSubview:self.lb_moneyNumber];
            [_cardView addSubview:self.lb_moneyUnit];
            
        }
        
        [_cardView addSubview:self.lb_type];
        [_cardView addSubview:self.lb_date];
        [_cardView addSubview:self.btn_getCoins];
        [_cardView addSubview:self.lineView];
        [_cardView addSubview:self.lb_stateTitle];
        
        if (self.type == CTListPrizeTypeCoins200 || self.type == CTListPrizeTypeCoins388 || self.type == CTListPrizeTypeCoins588 || self.type == CTListPrizeTypeCustomPackage || self.type == CTListPrizeTypeCoupons50_YanWo || self.type == CTListPrizeTypeCouponsFree_YanWo || self.type == CTListPrizeTypeInsurance_DaDi || self.type == CTListPrizeTypeSmartCup || self.type == CTListPrizeTypeShoe || self.type == CTListPrizeTypeToyCar || self.type == CTListPrizeTypeElectricFan || self.type == CTListPrizeTypeMedicalMask || self.type == CTListPrizeTypeDisinfectant || self.type == CTListPrizeTypeTissue || self.type == CTListPrizeTypeFan || self.type == CTListPrizeTypeWashbasin || self.type == CTListPrizeTypeSandals || self.type == CTListPrizeTypeTeaSet || self.type == CTListPrizeTypeTeaMassageStick || self.type == CTListPrizeTypeMiniHumidifier || self.type == CTListPrizeTypeRazor || self.type == CTListPrizeTypeCookerTool || self.type == CTListPrizeTypeWashingLiquid || self.type == CTListPrizeTypeStorageBox || self.type == CTListPrizeTypeUSBElectronicScale || self.type == CTListPrizeTypeAutoFoldUmbrella || self.type == CTListPrizeTypeMosquitoKillingLamp || self.type == CTListPrizeTypeHUAWeiMate40 || self.type == CTListPrizeTypeHoldFan  || self.type == CTListPrizeTypequalityDrawing || self.type == CTListPrizeTypeTeapot || self.type == CTListPrizeTypeiPhone12Pro || self.type == CTListPrizeTypeUglyOrange || self.type == CTListPrizeTypeRedmi9A || self.type == CTListPrizeTypeSummerSleepingMat || self.type == CTListPrizeTypeChineseWolfberry || self.type == CTListPrizeTypeSummerQuilt || self.type == CTListPrizeTypeWashingMachine || self.type == CTListPrizeTypeDisposableMop || self.type == CTListPrizeTypeHairDrier || self.type == CTListPrizeTypeKitchenRack ||  self.type == CTListPrizeTypeMultifunctionalPluginBoard | self.type == CTListPrizeTypeBathroomMat || self.type == CTListPrizeTypeIpadMini || self.type == CTListPrizeTypeCeramicCasserole  || self.type == CTListPrizeTypeCervicalSpineMassager || self.type == CTListPrizeTypeWirelessBluetoothHeadset || self.type == CTListPrizeTypeWinterCup || self.type == CTListPrizeTypeBin || self.type == CTListPrizeTypeAirHumidifier  || self.type == CTListPrizeTypeCreativeLaundryBasket || self.type == CTListPrizeTypeBedDesk || self.type == CTListPrizeTypeHairBallTrimmer  || self.type == CTListPrizeTypePlushCushions  || self.type == CTListPrizeTypeSolidWoodHangers || self.type == CTListPrizeTypeTopCup || self.type == CTListPrizeTypeVirginPulpPaper || self.type == CTListPrizeTypeAbsorbent || self.type == CTListPrizeTypeElectronicScale || self.type == CTListPrizeTypeWirelessMouse || self.type == CTListPrizeTypeDishwashingGloves || self.type == CTListPrizeTypeNewYearHanged || self.type == CTListPrizeTypeNewYearCandy | self.type == CTListPrizeTypeLogNapkins || self.type == CTListPrizeTypeHighTempCup || self.type == CTListPrizeTypeHeavyAbsorbentTowel || self.type == CTListPrizeTypeHackTechBroom || self.type == CTListPrizeTypeHeadScratcherMassager || self.type == CTListPrizeTypeChineseRedMaskr|| self.type == CTListPrizeTypeBOLIBEI || self.type == CTListPrizeTypeKONGQI|| self.type == CTListPrizeTypeLIANGTUOXIE || self.type == CTListPrizeTypeXISHUIMAOPJIN) {
            [_cardView addSubview:self.lb_state];
        }else{
            [_cardView addSubview:self.btn_bindWx];
            [_cardView addSubview:self.img_wxIcon];
        }
        
        [_cardView addSubview:self.lb_prizeNameTitle];
        [_cardView addSubview:self.lb_prizeName];
        
        if (self.type == CTListPrizeTypeCouponsFree_YanWo || self.type == CTListPrizeTypeCoupons50_YanWo) {
            [_cardView addSubview:self.lb_CDkeyTitle];
            [_cardView addSubview:self.lb_CDkey];
            [_cardView addSubview:self.btn_copy];
        }
    }
    return _cardView;
}

- (PrizeDetailProcessView *)processView
{
    if (!_processView) {
        _processView = [[PrizeDetailProcessView alloc]initWithFrame:CGRectMake(10 * WIDTHRADIU, 329 * WIDTHRADIU,  ScreenWidth - 20 * WIDTHRADIU, 210 * WIDTHRADIU)];
        _processView.backgroundColor = [UIColor whiteColor];
        
        [_processView addSubview:self.tableView];
    }
    return _processView;
}

- (UIImageView *)img_connect
{
    if (!_img_connect) {
        _img_connect = [[UIImageView alloc]init];
        _img_connect.image = [UIImage imageNamed:@"关联"];
    }
    return _img_connect;
}

- (UIImageView *)img_connect2
{
    if (!_img_connect2) {
        _img_connect2 = [[UIImageView alloc]init];
        _img_connect2.image = [UIImage imageNamed:@"关联"];
    }
    return _img_connect2;
}

- (UILabel *)lb_number
{
    if (!_lb_number) {
        _lb_number = [[UILabel alloc]init];
        _lb_number.textColor = [UIColor colorWithHex:0xfe5733];
        _lb_number.textAlignment = NSTextAlignmentCenter;
        _lb_number.font = [UIFont systemFontOfSize:70 * WIDTHRADIU];
        _lb_number.text = @"10";
        _lb_number.numberOfLines = 0;
        
    }
    return _lb_number;
}

- (UILabel *)lb_moneyNumber
{
    if (!_lb_moneyNumber) {
        _lb_moneyNumber = [[UILabel alloc]init];
        _lb_moneyNumber.textColor = [UIColor colorWithHex:0xfe5733];
        _lb_moneyNumber.textAlignment = NSTextAlignmentCenter;
        _lb_moneyNumber.font = [UIFont systemFontOfSize:70 * WIDTHRADIU];
        _lb_moneyNumber.text = @"10";
       
        
    }
    return _lb_moneyNumber;
}

- (UILabel *)lb_moneyUnit
{
    if (!_lb_moneyUnit) {
        _lb_moneyUnit = [[UILabel alloc]init];
        _lb_moneyUnit.textColor = [UIColor colorWithHex:0xfe5733];
        _lb_moneyUnit.textAlignment = NSTextAlignmentCenter;
        _lb_moneyUnit.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
        _lb_moneyUnit.text = @"元";
        
    }
    return _lb_moneyUnit;
}




//- (UILabel *)lb_unit
//{
//    if (!_lb_unit) {
//        _lb_unit = [[UILabel alloc]init];
//        _lb_unit.textColor = [UIColor whiteColor];
//        _lb_unit.textAlignment = NSTextAlignmentCenter;
//        _lb_unit.font = [UIFont systemFontOfSize:13 * WIDTHRADIU];
//        _lb_unit.text = @"元";
//    }
//    return _lb_unit;
//}

- (UILabel *)lb_type
{
    if (!_lb_type) {
        _lb_type = [[UILabel alloc]init];
        _lb_type.textAlignment = NSTextAlignmentCenter;
        _lb_type.textColor = [UIColor colorWithHex:0x808080];
        _lb_type.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
        _lb_type.text = @"金币奖励";
    }
    return _lb_type;
}

- (UILabel *)lb_date
{
    if (!_lb_date) {
        _lb_date = [[UILabel alloc]init];
        _lb_date.text = @"有效期：2019.09.02-2019.10.02";
        _lb_date.textColor = [UIColor colorWithHex:0x808080];
        _lb_date.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
    }
    return _lb_date;
}

- (UIButton *)btn_getCoins
{
    if (!_btn_getCoins) {
        _btn_getCoins = [UIButton buttonWithType:UIButtonTypeCustom];
        _btn_getCoins.titleLabel.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
        _btn_getCoins.backgroundColor = [UIColor clearColor];
        
        [_btn_getCoins addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _btn_getCoins;
}

- (SNXUXIANView *)lineView
{
    if (!_lineView) {
        _lineView = [[SNXUXIANView alloc]init];
    }
    return _lineView;
}

- (UILabel *)lb_stateTitle
{
    if (!_lb_stateTitle) {
        _lb_stateTitle = [[UILabel alloc]init];
        _lb_stateTitle.text = @"领取状态";
        _lb_stateTitle.textColor = [UIColor colorWithHex:0x808080];
        _lb_stateTitle.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
    }
    return _lb_stateTitle;
}

- (UILabel *)lb_state
{
    if (!_lb_state) {
        _lb_state = [[UILabel alloc]init];
        _lb_state.text = @"实时到账";
        _lb_state.textColor = [UIColor colorWithHex:0x808080];
        _lb_state.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
    }
    return _lb_state;
}

- (UIButton *)btn_bindWx
{
    if (!_btn_bindWx) {
        _btn_bindWx = [UIButton buttonWithType:UIButtonTypeCustom];
        [_btn_bindWx setTitleColor:[UIColor colorWithHex:0x808080] forState:UIControlStateNormal];
        _btn_bindWx.titleLabel.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
        [_btn_bindWx setImage:[UIImage imageNamed:@"my_arrow_normal"] forState:UIControlStateNormal];
        [_btn_bindWx setTitle:@"未绑定" forState:UIControlStateNormal];
        [_btn_bindWx layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleRight imageTitleSpace:0];
        
        [_btn_bindWx addTarget:self action:@selector(bindWXClick:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _btn_bindWx;
}

- (UIImageView *)img_wxIcon
{
    if (!_img_wxIcon) {
        _img_wxIcon = [[UIImageView alloc]init];
        _img_wxIcon.layer.cornerRadius = 10 * WIDTHRADIU;
        _img_wxIcon.layer.masksToBounds = YES;
    }
    return _img_wxIcon;
}


- (UILabel *)lb_prizeNameTitle
{
    if (!_lb_prizeNameTitle) {
        _lb_prizeNameTitle = [[UILabel alloc]init];
        _lb_prizeNameTitle.text = @"奖品名称";
        _lb_prizeNameTitle.textColor = [UIColor colorWithHex:0x808080];
        _lb_prizeNameTitle.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
    }
    return _lb_prizeNameTitle;
}

- (UILabel *)lb_prizeName
{
    if (!_lb_prizeName) {
        _lb_prizeName = [[UILabel alloc]init];
        _lb_prizeName.text = @"200金币";
        _lb_prizeName.textColor = [UIColor colorWithHex:0x808080];
        _lb_prizeName.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
    }
    return _lb_prizeName;
}

- (UILabel *)lb_CDkeyTitle
{
    if (!_lb_CDkeyTitle) {
        _lb_CDkeyTitle = [[UILabel alloc]init];
        _lb_CDkeyTitle.text = @"兑换码";
        _lb_CDkeyTitle.textColor = [UIColor colorWithHex:0x808080];
        _lb_CDkeyTitle.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
        _lb_CDkeyTitle.hidden = YES;
    }
    return _lb_CDkeyTitle;
}

- (UILabel *)lb_CDkey
{
    if (!_lb_CDkey) {
        _lb_CDkey = [[UILabel alloc]init];
        _lb_CDkey.text = @"";
        _lb_CDkey.textColor = [UIColor colorWithHex:0x808080];
        _lb_CDkey.font = [UIFont systemFontOfSize:14 * WIDTHRADIU];
        _lb_CDkey.hidden = YES;
    }
    return _lb_CDkey;
}

- (UIButton *)btn_copy
{
    if (!_btn_copy) {
        _btn_copy = [UIButton buttonWithType:UIButtonTypeCustom];
        [_btn_copy setTitle:@"复制" forState:UIControlStateNormal];
        _btn_copy.titleLabel.font = [UIFont systemFontOfSize:9];
        [_btn_copy setTitleColor:K_MainColor forState:UIControlStateNormal];
        _btn_copy.layer.cornerRadius = 3;
        _btn_copy.layer.borderWidth = 1.0;
        _btn_copy.layer.borderColor = K_MainColor.CGColor;
        _btn_copy.hidden = YES;
        [_btn_copy addTarget:self action:@selector(btn_copyClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btn_copy;
}

- (UIButton *)btn_list
{
    if (!_btn_list) {
        _btn_list = [UIButton buttonWithType:UIButtonTypeCustom];
        
        _btn_list.frame = CGRectMake(0, 0, 80, 40);
        [_btn_list setTitle:@"领取流程" forState:UIControlStateNormal];
        _btn_list.titleLabel.font = [UIFont systemFontOfSize:17];
        [_btn_list setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        
        [_btn_list addTarget:self action:@selector(processBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _btn_list;
}


- (UITableView *)tableView
{
    if (!_tableView ) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(10 * WIDTHRADIU, 30 * WIDTHRADIU, ScreenWidth - 40 * WIDTHRADIU, 160 * WIDTHRADIU) style:UITableViewStyleGrouped];
        _tableView.showsHorizontalScrollIndicator = YES;
        _tableView.showsVerticalScrollIndicator = NO;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.backgroundColor = [UIColor clearColor];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.scrollEnabled = NO;
        [_tableView registerClass:[CTPrizeDetailProcessTableViewCell class] forCellReuseIdentifier:@"cell"];
        _tableView.tableFooterView = [UIView new];
        
        
    }
    return _tableView;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
