HomeHeaderView.swift 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. //
  2. // HomeHeaderView.swift
  3. // xingchuangke
  4. //
  5. // Created by Virgil on 2019/3/22.
  6. // Copyright © 2019 Virgil. All rights reserved.
  7. //
  8. import UIKit
  9. class HomeHeaderView: UIView {
  10. @IBOutlet weak var imgMember: UIImageView!
  11. @IBOutlet weak var txtCTPOSPersonal: UITextField!
  12. @IBOutlet weak var viewTop: UIView!
  13. @IBOutlet weak var viewContent1: UIView!
  14. @IBOutlet weak var viewContent2: UIView!
  15. @IBOutlet weak var viewContent3: UIView!
  16. @IBOutlet weak var viewContent4: UIView!
  17. @IBOutlet weak var viewContent5: UIView!
  18. @IBOutlet weak var btnMenu1: UIButton!
  19. @IBOutlet weak var btnMenu2: UIButton!
  20. @IBOutlet weak var btnMenu3: UIButton!
  21. @IBOutlet weak var btnMenu4: UIButton!
  22. @IBOutlet weak var btnMenu5: UIButton!
  23. @IBOutlet weak var btnMenu6: UIButton!
  24. @IBOutlet weak var btnMenu7: UIButton!
  25. @IBOutlet weak var btnMenu8: UIButton!
  26. @IBOutlet weak var btnMenu9: UIButton!
  27. @IBOutlet weak var btnMenu10: UIButton!
  28. @IBOutlet weak var btnMenu11: UIButton!
  29. @IBOutlet weak var btnMenu12: UIButton!
  30. @IBOutlet weak var lblSumMoney: UILabel!
  31. @IBOutlet weak var lblMoney1: UILabel!
  32. @IBOutlet weak var lblMoney2: UILabel!
  33. @IBOutlet weak var lblMoney3: UILabel!
  34. @IBOutlet weak var lblMoney4: UILabel!
  35. @IBOutlet weak var lblTitleSYJSQ: UILabel!
  36. @IBOutlet weak var btnStartJS: UIButton!
  37. @IBOutlet weak var txtCTPOS: UITextField!
  38. @IBOutlet weak var txtMPOS: UITextField!
  39. @IBOutlet weak var txtMonth: UITextField!
  40. @IBOutlet weak var lblBMoney: UILabel!
  41. @IBOutlet weak var viewContent3View2: UIView!
  42. @IBOutlet weak var viewContent3View4: UIView!
  43. @IBOutlet weak var viewContent3View3: UIView!
  44. @IBOutlet weak var viewContent3Line2: UIView!
  45. @IBOutlet weak var viewContent3Line1: UIView!
  46. var isHid: Bool!
  47. func reloadMoney() {
  48. lblSumMoney.text = "\(CommonValue.getUserProfitTotal())"
  49. lblMoney1.text = "\(CommonValue.getUserProfitPos())"
  50. lblMoney2.text = "\(CommonValue.getUserProfitCard())"
  51. lblMoney3.text = "\(CommonValue.getUserProfitIntegral())"
  52. lblMoney4.text = "\(CommonValue.getUserProfitActivation())"
  53. lblBMoney.text = "可提现余额:\(CommonValue.getUserProfitBalance())"
  54. imgMember.image = UIImage(named: "member\(CommonValue.getUserLevel())")
  55. }
  56. func initView() {
  57. viewTop.isHidden = true
  58. self.setSizeWidth(width: ScreenWidth)
  59. viewContent1.setSizeHeight(height: ScreenWidth / 1242 * 710)
  60. viewContent2.marginTop(top: 5, view: viewContent1)
  61. if CommonValue.checkIsAS() {
  62. viewContent2.setSizeHeight(height: 110)
  63. viewContent3.setSizeHeight(height: 200)
  64. viewContent3Line2.isHidden = true
  65. viewContent3Line1.setSizeHeight(height: 50)
  66. viewContent3View2.isHidden = true
  67. viewContent3View3.isHidden = true
  68. } else {
  69. // viewContent2.setSizeHeight(height: 206);
  70. viewContent2.setSizeHeight(height: 312)
  71. viewContent3.setSizeHeight(height: 276)
  72. viewContent3Line2.isHidden = false
  73. viewContent3Line1.setSizeHeight(height: 111)
  74. viewContent3View2.isHidden = false
  75. viewContent3View3.isHidden = false
  76. }
  77. if isHid {
  78. btnMenu5.isHidden = true
  79. btnMenu6.isHidden = true
  80. btnMenu12.isHidden = true
  81. CommonViewUntils.setViewCenter(arrView: [btnMenu1, btnMenu2, btnMenu3], marginLeft: 15, marginRight: 15)
  82. CommonViewUntils.setViewCenter(arrView: [btnMenu4,btnMenu7, btnMenu8], marginLeft: 15, marginRight: 15)
  83. CommonViewUntils.setViewCenter(arrView: [btnMenu9, btnMenu10,btnMenu11], marginLeft: 15, marginRight: 15)
  84. btnMenu4.mj_y = btnMenu5.mj_y
  85. }else{
  86. btnMenu5.isHidden = false
  87. btnMenu6.isHidden = false
  88. btnMenu12.isHidden = false
  89. CommonViewUntils.setViewCenter(arrView: [btnMenu1, btnMenu2, btnMenu3, btnMenu4], marginLeft: 15, marginRight: 15)
  90. CommonViewUntils.setViewCenter(arrView: [btnMenu5, btnMenu6, btnMenu7, btnMenu8], marginLeft: 15, marginRight: 15)
  91. CommonViewUntils.setViewCenter(arrView: [btnMenu9, btnMenu10, btnMenu11, btnMenu12], marginLeft: 15, marginRight: 15)
  92. btnMenu4.mj_y = btnMenu3.mj_y
  93. }
  94. txtCTPOS.setLayer(borderWidth: 1, color: 0xf4f4f4)
  95. txtCTPOS.setCornerRadius(size: 4)
  96. txtCTPOS.setContentMarginLeft(leftWidth: 16)
  97. txtCTPOSPersonal.setLayer(borderWidth: 1, color: 0xf4f4f4)
  98. txtCTPOSPersonal.setCornerRadius(size: 4)
  99. txtCTPOSPersonal.setContentMarginLeft(leftWidth: 16)
  100. txtMPOS.setLayer(borderWidth: 1, color: 0xf4f4f4)
  101. txtMPOS.setCornerRadius(size: 4)
  102. txtMPOS.setContentMarginLeft(leftWidth: 16)
  103. txtMonth.setLayer(borderWidth: 1, color: 0xf4f4f4)
  104. txtMonth.setCornerRadius(size: 4)
  105. txtMonth.setContentMarginLeft(leftWidth: 16)
  106. btnStartJS.setCornerRadius(size: 5)
  107. // viewContent3.marginTop(top: 10, view: viewContent2);
  108. viewContent3.isHidden = true
  109. viewContent4.isHidden = true
  110. // viewContent4.marginTop(top: 10, view: viewContent3);
  111. //
  112. // viewContent5.marginTop(top: 10, view: viewContent4);
  113. viewContent5.marginTop(top: 10, view: viewContent2)
  114. lblTitleSYJSQ.attributedText = CommonViewUntils.getAttributedString(str: "收益计算器", left: [2, 5], color: [CommonUntils.getUIColorFromRGB(rgbValue: 0x333333, alpha: 1.0), CommonUntils.getUIColorFromRGB(rgbValue: 0x37a6ff, alpha: 1.0)])
  115. self.setSizeHeight(height: viewContent5.bottom())
  116. }
  117. //btnAddTarget(view: self.view, selector: #selector(self.btnMenuClick))
  118. @IBAction func btnMenuClick(_ sender: AnyObject) {
  119. if CommonValue.getUserId() == "" {
  120. appDelegate.navController.pushViewController(LoginViewController(), animated: true)
  121. return
  122. }
  123. let isAuth = CommonValue.getUserIsAuthentication()
  124. if isAuth == 0 {
  125. CommonUntils.AlertView(controller: appDelegate.navController, title: nil, message: "此功能需要实名认证才可以使用", buttons: ["立即认证"], style: .alert, actionHandler: {(_, _) in
  126. let viewWeb = RealNameAuthViewController()
  127. appDelegate.navController.pushViewController(viewWeb, animated: true)
  128. }) {
  129. }
  130. return
  131. } else if isAuth == 1 {
  132. SVProgressHUD.showError(withStatus: "您的实名认证正在审核中,请稍后再试")
  133. appDelegate.reloadUserInfo()
  134. return
  135. } else if isAuth == 3 {
  136. CommonUntils.AlertView(controller: appDelegate.navController, title: nil, message: "您的实名认证未通过,请重新提交实名认证信息", buttons: ["立即认证"], style: .alert, actionHandler: {(_, _) in
  137. let viewWeb = RealNameAuthViewController()
  138. appDelegate.navController.pushViewController(viewWeb, animated: true)
  139. }) {
  140. }
  141. return
  142. }
  143. //if(CommonValue.getuser)
  144. switch (sender as! UIButton).tag {
  145. case 1001: // 明星排行榜
  146. appDelegate.navController.pushViewController(RankingListViewController(), animated: true)
  147. break
  148. case 1002: // 消息
  149. break
  150. case 1003: // 商户录入
  151. appDelegate.navController.pushViewController(SelectPayBrandViewController(), animated: true)
  152. //appDelegate.navController.pushViewController(BJHKPhoneViewController(), animated: true);
  153. break
  154. case 1004: // 邀请好友
  155. appDelegate.navController.pushViewController(InviteViewController(), animated: true)
  156. break
  157. case 1005: // 我的代理
  158. let vc = MyDelegateViewController()
  159. appDelegate.navController.pushViewController(vc, animated: true)
  160. break
  161. case 1006: // 商户管理
  162. let vc = BrandListViewController()
  163. vc.strTitle = "商户管理"
  164. appDelegate.navController.pushViewController(vc, animated: true)
  165. break
  166. case 1007: // 推荐办卡
  167. if isHid {
  168. SVProgressHUD.showError(withStatus: "敬请期待")
  169. }else{
  170. // appDelegate.navController.pushViewController(BJBusinessViewController(), animated: true);
  171. // appDelegate.navController.pushViewController(ApplyCardWebViewController(), animated: true);
  172. let tabbarCard = ApplyCardTabBarViewController()
  173. tabbarCard.type = 0
  174. tabbarCard.initBar()
  175. appDelegate.navController.pushViewController(tabbarCard, animated: true)
  176. }
  177. break
  178. case 1008: // 积分专区
  179. // if isHid {
  180. SVProgressHUD.showError(withStatus: "敬请期待")
  181. // }else{
  182. // let tabbarCard = ApplyCardTabBarViewController()
  183. // tabbarCard.type = 1
  184. // tabbarCard.initBar()
  185. // appDelegate.navController.pushViewController(tabbarCard, animated: true)
  186. // }
  187. break
  188. case 1009: // 车险理财
  189. // SVProgressHUD.showInfo(withStatus: "敬请期待")
  190. let vc = ActiveListViewController()
  191. appDelegate.navController.pushViewController(vc, animated: true)
  192. //appDelegate.navController.pushViewController(CarInsuranceViewController(), animated: true);
  193. break
  194. case 1010: // 机具管理
  195. appDelegate.navController.pushViewController(PosManangerViewController(), animated: true)
  196. break
  197. case 1011: // 我的钱包--进入详情
  198. appDelegate.navController.pushViewController(MyWalletViewController(), animated: true)
  199. break
  200. case 1012: // 查看使用规则
  201. let viewWeb = CommonWebViewViewController()
  202. viewWeb.strTitle = "收益计算器使用规则"
  203. viewWeb.url = "\(RequestURL.sysConfigWeb)?type=wallet_rules"
  204. viewWeb.sourceType = 0
  205. appDelegate.navController.pushViewController(viewWeb, animated: true)
  206. // let viewWeb = CommonWebViewViewController();
  207. // viewWeb.strTitle = "收益计算器使用规则";
  208. // viewWeb.strContent = "1、传统POS以户月均交易量7万计算<br>2、MPOS以户月均交易量3万计算"
  209. // viewWeb.sourceType = 1;
  210. // appDelegate.navController.pushViewController(viewWeb, animated: true);
  211. break
  212. case 1013: // 开始计算
  213. break
  214. case 1014: // 优惠商城
  215. appDelegate.navController.pushViewController(ShoppingMallCollectionViewController(), animated: true)
  216. break
  217. case 1015: // 文案库
  218. appDelegate.navController.pushViewController(ArticleManagerViewController(), animated: true)
  219. break
  220. case 1016: // 我的学习
  221. let vc = StudyViewController()
  222. appDelegate.navController.pushViewController(vc, animated: true)
  223. break
  224. default:
  225. break
  226. }
  227. }
  228. }