123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- //
- // HomeHeaderView.swift
- // xingchuangke
- //
- // Created by Virgil on 2019/3/22.
- // Copyright © 2019 Virgil. All rights reserved.
- //
- import UIKit
- class HomeHeaderView: UIView {
- @IBOutlet weak var imgMember: UIImageView!
- @IBOutlet weak var txtCTPOSPersonal: UITextField!
- @IBOutlet weak var viewTop: UIView!
- @IBOutlet weak var viewContent1: UIView!
- @IBOutlet weak var viewContent2: UIView!
- @IBOutlet weak var viewContent3: UIView!
- @IBOutlet weak var viewContent4: UIView!
- @IBOutlet weak var viewContent5: UIView!
- @IBOutlet weak var btnMenu1: UIButton!
- @IBOutlet weak var btnMenu2: UIButton!
- @IBOutlet weak var btnMenu3: UIButton!
- @IBOutlet weak var btnMenu4: UIButton!
- @IBOutlet weak var btnMenu5: UIButton!
- @IBOutlet weak var btnMenu6: UIButton!
- @IBOutlet weak var btnMenu7: UIButton!
- @IBOutlet weak var btnMenu8: UIButton!
- @IBOutlet weak var btnMenu9: UIButton!
- @IBOutlet weak var btnMenu10: UIButton!
- @IBOutlet weak var btnMenu11: UIButton!
- @IBOutlet weak var btnMenu12: UIButton!
- @IBOutlet weak var lblSumMoney: UILabel!
- @IBOutlet weak var lblMoney1: UILabel!
- @IBOutlet weak var lblMoney2: UILabel!
- @IBOutlet weak var lblMoney3: UILabel!
- @IBOutlet weak var lblMoney4: UILabel!
- @IBOutlet weak var lblTitleSYJSQ: UILabel!
- @IBOutlet weak var btnStartJS: UIButton!
- @IBOutlet weak var txtCTPOS: UITextField!
- @IBOutlet weak var txtMPOS: UITextField!
- @IBOutlet weak var txtMonth: UITextField!
- @IBOutlet weak var lblBMoney: UILabel!
- @IBOutlet weak var viewContent3View2: UIView!
- @IBOutlet weak var viewContent3View4: UIView!
- @IBOutlet weak var viewContent3View3: UIView!
- @IBOutlet weak var viewContent3Line2: UIView!
- @IBOutlet weak var viewContent3Line1: UIView!
- var isHid: Bool!
- func reloadMoney() {
- lblSumMoney.text = "\(CommonValue.getUserProfitTotal())"
- lblMoney1.text = "\(CommonValue.getUserProfitPos())"
- lblMoney2.text = "\(CommonValue.getUserProfitCard())"
- lblMoney3.text = "\(CommonValue.getUserProfitIntegral())"
- lblMoney4.text = "\(CommonValue.getUserProfitActivation())"
- lblBMoney.text = "可提现余额:\(CommonValue.getUserProfitBalance())"
- imgMember.image = UIImage(named: "member\(CommonValue.getUserLevel())")
- }
- func initView() {
- viewTop.isHidden = true
- self.setSizeWidth(width: ScreenWidth)
- viewContent1.setSizeHeight(height: ScreenWidth / 1242 * 710)
- viewContent2.marginTop(top: 5, view: viewContent1)
- if CommonValue.checkIsAS() {
- viewContent2.setSizeHeight(height: 110)
- viewContent3.setSizeHeight(height: 200)
- viewContent3Line2.isHidden = true
- viewContent3Line1.setSizeHeight(height: 50)
- viewContent3View2.isHidden = true
- viewContent3View3.isHidden = true
- } else {
- // viewContent2.setSizeHeight(height: 206);
- viewContent2.setSizeHeight(height: 312)
- viewContent3.setSizeHeight(height: 276)
- viewContent3Line2.isHidden = false
- viewContent3Line1.setSizeHeight(height: 111)
- viewContent3View2.isHidden = false
- viewContent3View3.isHidden = false
- }
- if isHid {
- btnMenu5.isHidden = true
- btnMenu6.isHidden = true
- btnMenu12.isHidden = true
- CommonViewUntils.setViewCenter(arrView: [btnMenu1, btnMenu2, btnMenu3], marginLeft: 15, marginRight: 15)
- CommonViewUntils.setViewCenter(arrView: [btnMenu4,btnMenu7, btnMenu8], marginLeft: 15, marginRight: 15)
- CommonViewUntils.setViewCenter(arrView: [btnMenu9, btnMenu10,btnMenu11], marginLeft: 15, marginRight: 15)
- btnMenu4.mj_y = btnMenu5.mj_y
- }else{
- btnMenu5.isHidden = false
- btnMenu6.isHidden = false
- btnMenu12.isHidden = false
- CommonViewUntils.setViewCenter(arrView: [btnMenu1, btnMenu2, btnMenu3, btnMenu4], marginLeft: 15, marginRight: 15)
- CommonViewUntils.setViewCenter(arrView: [btnMenu5, btnMenu6, btnMenu7, btnMenu8], marginLeft: 15, marginRight: 15)
- CommonViewUntils.setViewCenter(arrView: [btnMenu9, btnMenu10, btnMenu11, btnMenu12], marginLeft: 15, marginRight: 15)
- btnMenu4.mj_y = btnMenu3.mj_y
- }
- txtCTPOS.setLayer(borderWidth: 1, color: 0xf4f4f4)
- txtCTPOS.setCornerRadius(size: 4)
- txtCTPOS.setContentMarginLeft(leftWidth: 16)
- txtCTPOSPersonal.setLayer(borderWidth: 1, color: 0xf4f4f4)
- txtCTPOSPersonal.setCornerRadius(size: 4)
- txtCTPOSPersonal.setContentMarginLeft(leftWidth: 16)
- txtMPOS.setLayer(borderWidth: 1, color: 0xf4f4f4)
- txtMPOS.setCornerRadius(size: 4)
- txtMPOS.setContentMarginLeft(leftWidth: 16)
- txtMonth.setLayer(borderWidth: 1, color: 0xf4f4f4)
- txtMonth.setCornerRadius(size: 4)
- txtMonth.setContentMarginLeft(leftWidth: 16)
- btnStartJS.setCornerRadius(size: 5)
- // viewContent3.marginTop(top: 10, view: viewContent2);
- viewContent3.isHidden = true
- viewContent4.isHidden = true
- // viewContent4.marginTop(top: 10, view: viewContent3);
- //
- // viewContent5.marginTop(top: 10, view: viewContent4);
- viewContent5.marginTop(top: 10, view: viewContent2)
- lblTitleSYJSQ.attributedText = CommonViewUntils.getAttributedString(str: "收益计算器", left: [2, 5], color: [CommonUntils.getUIColorFromRGB(rgbValue: 0x333333, alpha: 1.0), CommonUntils.getUIColorFromRGB(rgbValue: 0x37a6ff, alpha: 1.0)])
- self.setSizeHeight(height: viewContent5.bottom())
- }
- //btnAddTarget(view: self.view, selector: #selector(self.btnMenuClick))
- @IBAction func btnMenuClick(_ sender: AnyObject) {
- if CommonValue.getUserId() == "" {
- appDelegate.navController.pushViewController(LoginViewController(), animated: true)
- return
- }
- let isAuth = CommonValue.getUserIsAuthentication()
- if isAuth == 0 {
- CommonUntils.AlertView(controller: appDelegate.navController, title: nil, message: "此功能需要实名认证才可以使用", buttons: ["立即认证"], style: .alert, actionHandler: {(_, _) in
- let viewWeb = RealNameAuthViewController()
- appDelegate.navController.pushViewController(viewWeb, animated: true)
- }) {
- }
- return
- } else if isAuth == 1 {
- SVProgressHUD.showError(withStatus: "您的实名认证正在审核中,请稍后再试")
- appDelegate.reloadUserInfo()
- return
- } else if isAuth == 3 {
- CommonUntils.AlertView(controller: appDelegate.navController, title: nil, message: "您的实名认证未通过,请重新提交实名认证信息", buttons: ["立即认证"], style: .alert, actionHandler: {(_, _) in
- let viewWeb = RealNameAuthViewController()
- appDelegate.navController.pushViewController(viewWeb, animated: true)
- }) {
- }
- return
- }
- //if(CommonValue.getuser)
- switch (sender as! UIButton).tag {
- case 1001: // 明星排行榜
- appDelegate.navController.pushViewController(RankingListViewController(), animated: true)
- break
- case 1002: // 消息
- break
- case 1003: // 商户录入
- appDelegate.navController.pushViewController(SelectPayBrandViewController(), animated: true)
- //appDelegate.navController.pushViewController(BJHKPhoneViewController(), animated: true);
- break
- case 1004: // 邀请好友
- appDelegate.navController.pushViewController(InviteViewController(), animated: true)
- break
- case 1005: // 我的代理
- let vc = MyDelegateViewController()
- appDelegate.navController.pushViewController(vc, animated: true)
- break
- case 1006: // 商户管理
- let vc = BrandListViewController()
- vc.strTitle = "商户管理"
- appDelegate.navController.pushViewController(vc, animated: true)
- break
- case 1007: // 推荐办卡
- if isHid {
- SVProgressHUD.showError(withStatus: "敬请期待")
- }else{
- // appDelegate.navController.pushViewController(BJBusinessViewController(), animated: true);
- // appDelegate.navController.pushViewController(ApplyCardWebViewController(), animated: true);
- let tabbarCard = ApplyCardTabBarViewController()
- tabbarCard.type = 0
- tabbarCard.initBar()
- appDelegate.navController.pushViewController(tabbarCard, animated: true)
- }
- break
- case 1008: // 积分专区
- // if isHid {
- SVProgressHUD.showError(withStatus: "敬请期待")
- // }else{
- // let tabbarCard = ApplyCardTabBarViewController()
- // tabbarCard.type = 1
- // tabbarCard.initBar()
- // appDelegate.navController.pushViewController(tabbarCard, animated: true)
- // }
- break
- case 1009: // 车险理财
- // SVProgressHUD.showInfo(withStatus: "敬请期待")
- let vc = ActiveListViewController()
- appDelegate.navController.pushViewController(vc, animated: true)
- //appDelegate.navController.pushViewController(CarInsuranceViewController(), animated: true);
- break
- case 1010: // 机具管理
- appDelegate.navController.pushViewController(PosManangerViewController(), animated: true)
- break
- case 1011: // 我的钱包--进入详情
- appDelegate.navController.pushViewController(MyWalletViewController(), animated: true)
- break
- case 1012: // 查看使用规则
- let viewWeb = CommonWebViewViewController()
- viewWeb.strTitle = "收益计算器使用规则"
- viewWeb.url = "\(RequestURL.sysConfigWeb)?type=wallet_rules"
- viewWeb.sourceType = 0
- appDelegate.navController.pushViewController(viewWeb, animated: true)
- // let viewWeb = CommonWebViewViewController();
- // viewWeb.strTitle = "收益计算器使用规则";
- // viewWeb.strContent = "1、传统POS以户月均交易量7万计算<br>2、MPOS以户月均交易量3万计算"
- // viewWeb.sourceType = 1;
- // appDelegate.navController.pushViewController(viewWeb, animated: true);
- break
- case 1013: // 开始计算
- break
- case 1014: // 优惠商城
- appDelegate.navController.pushViewController(ShoppingMallCollectionViewController(), animated: true)
- break
- case 1015: // 文案库
- appDelegate.navController.pushViewController(ArticleManagerViewController(), animated: true)
- break
- case 1016: // 我的学习
- let vc = StudyViewController()
- appDelegate.navController.pushViewController(vc, animated: true)
- break
- default:
- break
- }
- }
- }
|