CommonRightMenu.swift 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. //
  2. // CommonRightMenu.swift
  3. // xingchuangke
  4. //
  5. // Created by Virgil on 2019/5/9.
  6. // Copyright © 2019 Virgil. All rights reserved.
  7. //
  8. import UIKit
  9. class CommonRightMenu: UIView {
  10. @IBOutlet weak var scrollView: UIScrollView!
  11. @IBOutlet weak var busAllBtn: UIButton!
  12. @IBOutlet weak var busJJBtn: UIButton!
  13. @IBOutlet weak var busSHBtn: UIButton!
  14. @IBOutlet weak var dealAllBtn: UIButton!
  15. @IBOutlet weak var dealXFBtn: UIButton!
  16. @IBOutlet weak var dealYJBtn: UIButton!
  17. @IBOutlet weak var dealZXBtn: UIButton!
  18. @IBOutlet weak var dealDKBtn: UIButton!
  19. @IBOutlet weak var payAllBtn: UIButton!
  20. @IBOutlet weak var payXFBtn: UIButton!
  21. @IBOutlet weak var paySKBtn: UIButton!
  22. @IBOutlet weak var payYSFBtn: UIButton!
  23. @IBOutlet weak var payZXBtn: UIButton!
  24. @IBOutlet weak var payWXBtn: UIButton!
  25. @IBOutlet weak var payALBtn: UIButton!
  26. @IBOutlet weak var cardAllBtn: UIButton!
  27. @IBOutlet weak var cardJJBtn: UIButton!
  28. @IBOutlet weak var cardDJBtn: UIButton!
  29. @IBOutlet weak var cardZDBtn: UIButton!
  30. @IBOutlet weak var cardYFBtn: UIButton!
  31. @IBOutlet weak var cardYLBtn: UIButton!
  32. @IBOutlet weak var wayAllBtn: UIButton!
  33. @IBOutlet weak var wayBtn: UIButton!
  34. @IBOutlet weak var wayBtn1: UIButton!
  35. @IBOutlet weak var btnConfrim: UIButton!
  36. @IBOutlet weak var btnReset: UIButton!
  37. @IBOutlet weak var btnEnd: UIButton!
  38. @IBOutlet weak var btnStart: UIButton!
  39. var queryEntity: QueryEntity!
  40. var oBackFunc: CommonBackQuery!
  41. var btnTypes = [UIButton]()
  42. var arrTempType = NSMutableArray()
  43. func initView(arrType: NSMutableArray, backFunc:@escaping CommonBackQuery) {
  44. oBackFunc = backFunc
  45. self.setSizeWidth(width: ScreenWidth)
  46. btnEnd.setCornerRadius(size: 3)
  47. btnStart.setCornerRadius(size: 3)
  48. scrollView.contentSize.height = btnConfrim.bottom() + 40
  49. busAllBtn.isSelected = true
  50. dealAllBtn.isSelected = true
  51. payAllBtn.isSelected = true
  52. cardAllBtn.isSelected = true
  53. wayAllBtn.isSelected = true
  54. busAllBtn.setTitleColor(.red, for: .selected)
  55. dealAllBtn.setTitleColor(.red, for: .selected)
  56. payAllBtn.setTitleColor(.red, for: .selected)
  57. cardAllBtn.setTitleColor(.red, for: .selected)
  58. wayAllBtn.setTitleColor(.red, for: .selected)
  59. arrTempType.removeAllObjects()
  60. arrTempType.addObjects(from: arrType as! [Any])
  61. // scrollViewType.removeAll();
  62. var left: CGFloat = 14
  63. btnTypes.removeAll()
  64. for i in 0 ..< arrType.count {
  65. let btn = UIButton(frame: CGRect(x: left, y: 0, width: 100, height: 36))
  66. btn.backgroundColor = CommonUntils.getUIColorFromRGB(rgbValue: 0xf5f5f5, alpha: 1.0)
  67. btn.setTitle((arrType[i] as! NSDictionary).getString(key: "name"), for: .normal)
  68. btn.setTitleColor(CommonUntils.getUIColorFromRGB(rgbValue: 0x333333, alpha: 1.0), for: .normal)
  69. btn.setTitleColor(UIColor.white, for: .selected)
  70. btn.sizeToFitWidth()
  71. btn.titleLabel?.font = UIFont.systemFont(ofSize: 12)
  72. btn.tag = i
  73. btn.addTarget(self, action: #selector(btnTypeClick), for: .touchUpInside)
  74. btn.setSizeWidth(width: btn.width() + 40)
  75. // scrollViewType.addSubview(btn)
  76. left = btn.right() + 15
  77. btnTypes.append(btn)
  78. btn.setCornerRadius(size: 3)
  79. }
  80. // scrollViewType.contentSize.width = left;
  81. queryEntity = QueryEntity()
  82. queryEntity.startTime = "选择开始日期"
  83. queryEntity.endTime = "选择截止日期"
  84. }
  85. @objc func btnTypeClick(btn: UIButton) {
  86. for btnTemp in btnTypes {
  87. if btnTemp.tag == btn.tag {
  88. queryEntity.typeID = (arrTempType[btn.tag] as! NSDictionary).getString(key: "id")
  89. btnTemp.backgroundColor = CommonUntils.getUIColorFromRGB(rgbValue: 0x2A92F7, alpha: 1.0)
  90. btnTemp.isSelected = true
  91. } else {
  92. btnTemp.backgroundColor = CommonUntils.getUIColorFromRGB(rgbValue: 0xf5f5f5, alpha: 1.0)
  93. btnTemp.isSelected = false
  94. }
  95. }
  96. }
  97. @IBAction func btnMenuClick(_ sender: AnyObject) {
  98. switch (sender as! UIButton).tag {
  99. case 1001: // 开始时间
  100. let viewDatePicer = (CommonViewUntils.getViewForXIB(anyClass: Virgil_SelectDateForPickerView.self) as! Virgil_SelectDateForPickerView)
  101. var defaultDate: Date!
  102. if queryEntity.startTime == "选择开始日期" || queryEntity.startTime.length() != 10 {
  103. defaultDate = CommonDate.addMonth(date: Date(), month: 0)
  104. } else {
  105. defaultDate = CommonDate.getDateForString(dateStr: queryEntity.startTime, dateFormat: "yyyy-MM-dd")
  106. }
  107. viewDatePicer.datePicker.maximumDate = Date()
  108. viewDatePicer.showDatePickerView(defaultDate: defaultDate) {[weak self] (str) in
  109. self!.queryEntity.startTime = str
  110. self!.refreshView()
  111. }
  112. break
  113. case 1002: // 结束时间
  114. let viewDatePicer = (CommonViewUntils.getViewForXIB(anyClass: Virgil_SelectDateForPickerView.self) as! Virgil_SelectDateForPickerView)
  115. var defaultDate: Date!
  116. if queryEntity.endTime == "选择截止日期" || queryEntity.endTime.length() != 10 {
  117. defaultDate = Date()
  118. } else {
  119. defaultDate = CommonDate.getDateForString(dateStr: queryEntity.endTime, dateFormat: "yyyy-MM-dd")
  120. }
  121. viewDatePicer.datePicker.maximumDate = Date()
  122. viewDatePicer.showDatePickerView(defaultDate: defaultDate) {[weak self] (str) in
  123. self!.queryEntity.endTime = str
  124. self!.refreshView()
  125. }
  126. refreshView()
  127. break
  128. case 1011: // 全部
  129. queryEntity.busType = ""
  130. refreshView()
  131. break
  132. case 1012: // 个人版
  133. queryEntity.busType = "0"
  134. refreshView()
  135. case 1013: // 商户版
  136. queryEntity.busType = "1"
  137. refreshView()
  138. break
  139. case 1021: // 全部
  140. queryEntity.depositTrade = ""
  141. refreshView()
  142. break
  143. case 1022: // 消费
  144. queryEntity.depositTrade = "03"
  145. refreshView()
  146. break
  147. case 1023: // 押金
  148. queryEntity.depositTrade = "19"
  149. refreshView()
  150. break
  151. case 1024: // 智能消费
  152. queryEntity.depositTrade = "20"
  153. refreshView()
  154. break
  155. case 1025: // 抵扣消费
  156. queryEntity.depositTrade = "21"
  157. refreshView()
  158. break
  159. case 1031: // 全部
  160. queryEntity.payType = ""
  161. refreshView()
  162. break
  163. case 1032: // 消费
  164. queryEntity.payType = "00"
  165. refreshView()
  166. break
  167. case 1033: // 收款
  168. queryEntity.payType = "01"
  169. refreshView()
  170. break
  171. case 1034: // 云闪付
  172. queryEntity.payType = "02"
  173. refreshView()
  174. break
  175. case 1035: // 智能消费
  176. queryEntity.payType = "03"
  177. refreshView()
  178. break
  179. case 1036: // 微信扫码
  180. queryEntity.payType = "04"
  181. refreshView()
  182. break
  183. case 1037: // 支付宝扫码
  184. queryEntity.payType = "05"
  185. refreshView()
  186. break
  187. case 1041: // 全部
  188. queryEntity.cardType = ""
  189. refreshView()
  190. break
  191. case 1042: // 借记卡
  192. queryEntity.cardType = "1"
  193. refreshView()
  194. break
  195. case 1043: // 贷记卡
  196. queryEntity.cardType = "2"
  197. refreshView()
  198. break
  199. case 1044: // 准贷记卡
  200. queryEntity.cardType = "3"
  201. refreshView()
  202. break
  203. case 1045: // 预付费卡
  204. queryEntity.cardType = "4"
  205. refreshView()
  206. break
  207. case 1046: // 银联双免
  208. queryEntity.cardType = "5"
  209. refreshView()
  210. break
  211. case 1003: // T0
  212. queryEntity.settleWay = "T0"
  213. refreshView()
  214. break
  215. case 1004: // T1
  216. queryEntity.settleWay = "T1"
  217. refreshView()
  218. break
  219. case 1005: // 全部
  220. queryEntity.settleWay = ""
  221. refreshView()
  222. break
  223. case 1007: // 重置
  224. queryEntity.startTime = "选择开始日期"
  225. queryEntity.endTime = "选择截止日期"
  226. queryEntity.cardType = ""
  227. queryEntity.settleWay = ""
  228. queryEntity.typeID = ""
  229. queryEntity.payType = ""
  230. queryEntity.depositTrade = ""
  231. queryEntity.busType = ""
  232. refreshView()
  233. break
  234. case 1008: // 确定
  235. hidMenu()
  236. if oBackFunc != nil {
  237. oBackFunc(queryEntity)
  238. }
  239. break
  240. case 1009: // 隐藏
  241. hidMenu()
  242. break
  243. default:
  244. break
  245. }
  246. }
  247. func refreshView() {
  248. for btnTemp in btnTypes {
  249. if queryEntity.typeID != (arrTempType[btnTemp.tag] as! NSDictionary).getString(key: "id") {
  250. btnTemp.isSelected = false
  251. btnTemp.backgroundColor = CommonUntils.getUIColorFromRGB(rgbValue: 0xf5f5f5, alpha: 1.0)
  252. }
  253. }
  254. if queryEntity.busType == "" {
  255. busAllBtn.isSelected = true
  256. busJJBtn.isSelected = false
  257. busSHBtn.isSelected = false
  258. busAllBtn.setTitleColor(.red, for: .selected)
  259. busJJBtn.setTitleColor(.black, for: .normal)
  260. busSHBtn.setTitleColor(.black, for: .normal)
  261. } else if queryEntity.busType == "0" {
  262. busAllBtn.isSelected = false
  263. busJJBtn.isSelected = true
  264. busSHBtn.isSelected = false
  265. busAllBtn.setTitleColor(.black, for: .normal)
  266. busJJBtn.setTitleColor(.red, for: .selected)
  267. busSHBtn.setTitleColor(.black, for: .normal)
  268. } else {
  269. busAllBtn.isSelected = false
  270. busJJBtn.isSelected = false
  271. busSHBtn.isSelected = true
  272. busAllBtn.setTitleColor(.black, for: .normal)
  273. busJJBtn.setTitleColor(.black, for: .normal)
  274. busSHBtn.setTitleColor(.red, for: .selected)
  275. }
  276. if queryEntity.depositTrade == "" {
  277. dealAllBtn.isSelected = true
  278. dealXFBtn.isSelected = false
  279. dealYJBtn.isSelected = false
  280. dealZXBtn.isSelected = false
  281. dealDKBtn.isSelected = false
  282. dealAllBtn.setTitleColor(.red, for: .selected)
  283. dealXFBtn.setTitleColor(.black, for: .normal)
  284. dealYJBtn.setTitleColor(.black, for: .normal)
  285. dealZXBtn.setTitleColor(.black, for: .normal)
  286. dealDKBtn.setTitleColor(.black, for: .normal)
  287. } else if queryEntity.depositTrade == "03" {
  288. dealAllBtn.isSelected = false
  289. dealXFBtn.isSelected = true
  290. dealYJBtn.isSelected = false
  291. dealZXBtn.isSelected = false
  292. dealDKBtn.isSelected = false
  293. dealAllBtn.setTitleColor(.black, for: .normal)
  294. dealXFBtn.setTitleColor(.red, for: .selected)
  295. dealYJBtn.setTitleColor(.black, for: .normal)
  296. dealZXBtn.setTitleColor(.black, for: .normal)
  297. dealDKBtn.setTitleColor(.black, for: .normal)
  298. }else if queryEntity.depositTrade == "19" {
  299. dealAllBtn.isSelected = false
  300. dealXFBtn.isSelected = false
  301. dealYJBtn.isSelected = true
  302. dealZXBtn.isSelected = false
  303. dealDKBtn.isSelected = false
  304. dealAllBtn.setTitleColor(.black, for: .normal)
  305. dealXFBtn.setTitleColor(.black, for: .normal)
  306. dealYJBtn.setTitleColor(.red, for: .selected)
  307. dealZXBtn.setTitleColor(.black, for: .normal)
  308. dealDKBtn.setTitleColor(.black, for: .normal)
  309. }else if queryEntity.depositTrade == "20" {
  310. dealAllBtn.isSelected = false
  311. dealXFBtn.isSelected = false
  312. dealYJBtn.isSelected = false
  313. dealZXBtn.isSelected = true
  314. dealDKBtn.isSelected = false
  315. dealAllBtn.setTitleColor(.black, for: .normal)
  316. dealXFBtn.setTitleColor(.black, for: .normal)
  317. dealYJBtn.setTitleColor(.black, for: .normal)
  318. dealZXBtn.setTitleColor(.red, for: .selected)
  319. dealDKBtn.setTitleColor(.black, for: .normal)
  320. }else {
  321. dealAllBtn.isSelected = false
  322. dealXFBtn.isSelected = false
  323. dealYJBtn.isSelected = false
  324. dealZXBtn.isSelected = false
  325. dealDKBtn.isSelected = true
  326. dealAllBtn.setTitleColor(.black, for: .normal)
  327. dealXFBtn.setTitleColor(.black, for: .normal)
  328. dealYJBtn.setTitleColor(.black, for: .normal)
  329. dealZXBtn.setTitleColor(.black, for: .normal)
  330. dealDKBtn.setTitleColor(.red, for: .selected)
  331. }
  332. if queryEntity.payType == "" {
  333. payAllBtn.isSelected = true
  334. payXFBtn.isSelected = false
  335. paySKBtn.isSelected = false
  336. payYSFBtn.isSelected = false
  337. payZXBtn.isSelected = false
  338. payWXBtn.isSelected = false
  339. payALBtn.isSelected = false
  340. payAllBtn.setTitleColor(.red, for: .selected)
  341. payXFBtn.setTitleColor(.black, for: .normal)
  342. paySKBtn.setTitleColor(.black, for: .normal)
  343. payYSFBtn.setTitleColor(.black, for: .normal)
  344. payZXBtn.setTitleColor(.black, for: .normal)
  345. payWXBtn.setTitleColor(.black, for: .normal)
  346. payALBtn.setTitleColor(.black, for: .normal)
  347. } else if queryEntity.payType == "00" {
  348. payAllBtn.isSelected = false
  349. payXFBtn.isSelected = true
  350. paySKBtn.isSelected = false
  351. payYSFBtn.isSelected = false
  352. payZXBtn.isSelected = false
  353. payWXBtn.isSelected = false
  354. payALBtn.isSelected = false
  355. payAllBtn.setTitleColor(.black, for: .normal)
  356. payXFBtn.setTitleColor(.red, for: .selected)
  357. paySKBtn.setTitleColor(.black, for: .normal)
  358. payYSFBtn.setTitleColor(.black, for: .normal)
  359. payZXBtn.setTitleColor(.black, for: .normal)
  360. payWXBtn.setTitleColor(.black, for: .normal)
  361. payALBtn.setTitleColor(.black, for: .normal)
  362. }else if queryEntity.payType == "01" {
  363. payAllBtn.isSelected = false
  364. payXFBtn.isSelected = false
  365. paySKBtn.isSelected = true
  366. payYSFBtn.isSelected = false
  367. payZXBtn.isSelected = false
  368. payWXBtn.isSelected = false
  369. payALBtn.isSelected = false
  370. payAllBtn.setTitleColor(.black, for: .normal)
  371. payXFBtn.setTitleColor(.black, for: .normal)
  372. paySKBtn.setTitleColor(.red, for: .selected)
  373. payYSFBtn.setTitleColor(.black, for: .normal)
  374. payZXBtn.setTitleColor(.black, for: .normal)
  375. payWXBtn.setTitleColor(.black, for: .normal)
  376. payALBtn.setTitleColor(.black, for: .normal)
  377. }else if queryEntity.payType == "02" {
  378. payAllBtn.isSelected = false
  379. payXFBtn.isSelected = false
  380. paySKBtn.isSelected = false
  381. payYSFBtn.isSelected = true
  382. payZXBtn.isSelected = false
  383. payWXBtn.isSelected = false
  384. payALBtn.isSelected = false
  385. payAllBtn.setTitleColor(.black, for: .normal)
  386. payXFBtn.setTitleColor(.black, for: .normal)
  387. paySKBtn.setTitleColor(.black, for: .normal)
  388. payYSFBtn.setTitleColor(.red, for: .selected)
  389. payZXBtn.setTitleColor(.black, for: .normal)
  390. payWXBtn.setTitleColor(.black, for: .normal)
  391. payALBtn.setTitleColor(.black, for: .normal)
  392. }else if queryEntity.payType == "03" {
  393. payAllBtn.isSelected = false
  394. payXFBtn.isSelected = false
  395. paySKBtn.isSelected = false
  396. payYSFBtn.isSelected = false
  397. payZXBtn.isSelected = true
  398. payWXBtn.isSelected = false
  399. payALBtn.isSelected = false
  400. payAllBtn.setTitleColor(.black, for: .normal)
  401. payXFBtn.setTitleColor(.black, for: .normal)
  402. paySKBtn.setTitleColor(.black, for: .normal)
  403. payYSFBtn.setTitleColor(.black, for: .normal)
  404. payZXBtn.setTitleColor(.red, for: .selected)
  405. payWXBtn.setTitleColor(.black, for: .normal)
  406. payALBtn.setTitleColor(.black, for: .normal)
  407. }else if queryEntity.payType == "04" {
  408. payAllBtn.isSelected = false
  409. payXFBtn.isSelected = false
  410. paySKBtn.isSelected = false
  411. payYSFBtn.isSelected = false
  412. payZXBtn.isSelected = false
  413. payWXBtn.isSelected = true
  414. payALBtn.isSelected = false
  415. payAllBtn.setTitleColor(.black, for: .normal)
  416. payXFBtn.setTitleColor(.black, for: .normal)
  417. paySKBtn.setTitleColor(.black, for: .normal)
  418. payYSFBtn.setTitleColor(.black, for: .normal)
  419. payZXBtn.setTitleColor(.black, for: .normal)
  420. payWXBtn.setTitleColor(.red, for: .selected)
  421. payALBtn.setTitleColor(.black, for: .normal)
  422. }else {
  423. payAllBtn.isSelected = false
  424. payXFBtn.isSelected = false
  425. paySKBtn.isSelected = false
  426. payYSFBtn.isSelected = false
  427. payZXBtn.isSelected = false
  428. payWXBtn.isSelected = false
  429. payALBtn.isSelected = true
  430. payAllBtn.setTitleColor(.black, for: .normal)
  431. payXFBtn.setTitleColor(.black, for: .normal)
  432. paySKBtn.setTitleColor(.black, for: .normal)
  433. payYSFBtn.setTitleColor(.black, for: .normal)
  434. payZXBtn.setTitleColor(.black, for: .normal)
  435. payWXBtn.setTitleColor(.black, for: .normal)
  436. payALBtn.setTitleColor(.red, for: .selected)
  437. }
  438. if queryEntity.cardType == "" {
  439. cardAllBtn.isSelected = true
  440. cardJJBtn.isSelected = false
  441. cardDJBtn.isSelected = false
  442. cardZDBtn.isSelected = false
  443. cardYFBtn.isSelected = false
  444. cardYLBtn.isSelected = false
  445. cardAllBtn.setTitleColor(.red, for: .selected)
  446. cardJJBtn.setTitleColor(.black, for: .normal)
  447. cardDJBtn.setTitleColor(.black, for: .normal)
  448. cardZDBtn.setTitleColor(.black, for: .normal)
  449. cardYFBtn.setTitleColor(.black, for: .normal)
  450. cardYLBtn.setTitleColor(.black, for: .normal)
  451. } else if queryEntity.cardType == "1" {
  452. cardAllBtn.isSelected = false
  453. cardJJBtn.isSelected = true
  454. cardDJBtn.isSelected = false
  455. cardZDBtn.isSelected = false
  456. cardYFBtn.isSelected = false
  457. cardYLBtn.isSelected = false
  458. cardAllBtn.setTitleColor(.black, for: .normal)
  459. cardJJBtn.setTitleColor(.red, for: .selected)
  460. cardDJBtn.setTitleColor(.black, for: .normal)
  461. cardZDBtn.setTitleColor(.black, for: .normal)
  462. cardYFBtn.setTitleColor(.black, for: .normal)
  463. cardYLBtn.setTitleColor(.black, for: .normal)
  464. }else if queryEntity.cardType == "2" {
  465. cardAllBtn.isSelected = false
  466. cardJJBtn.isSelected = false
  467. cardDJBtn.isSelected = true
  468. cardZDBtn.isSelected = false
  469. cardYFBtn.isSelected = false
  470. cardYLBtn.isSelected = false
  471. cardAllBtn.setTitleColor(.black, for: .normal)
  472. cardJJBtn.setTitleColor(.black, for: .normal)
  473. cardDJBtn.setTitleColor(.red, for: .selected)
  474. cardZDBtn.setTitleColor(.black, for: .normal)
  475. cardYFBtn.setTitleColor(.black, for: .normal)
  476. cardYLBtn.setTitleColor(.black, for: .normal)
  477. }else if queryEntity.cardType == "3" {
  478. cardAllBtn.isSelected = false
  479. cardJJBtn.isSelected = false
  480. cardDJBtn.isSelected = false
  481. cardZDBtn.isSelected = true
  482. cardYFBtn.isSelected = false
  483. cardYLBtn.isSelected = false
  484. cardAllBtn.setTitleColor(.black, for: .normal)
  485. cardJJBtn.setTitleColor(.black, for: .normal)
  486. cardDJBtn.setTitleColor(.black, for: .normal)
  487. cardZDBtn.setTitleColor(.red, for: .selected)
  488. cardYFBtn.setTitleColor(.black, for: .normal)
  489. cardYLBtn.setTitleColor(.black, for: .normal)
  490. }else if queryEntity.cardType == "4" {
  491. cardAllBtn.isSelected = false
  492. cardJJBtn.isSelected = false
  493. cardDJBtn.isSelected = false
  494. cardZDBtn.isSelected = false
  495. cardYFBtn.isSelected = true
  496. cardYLBtn.isSelected = false
  497. cardAllBtn.setTitleColor(.black, for: .normal)
  498. cardJJBtn.setTitleColor(.black, for: .normal)
  499. cardDJBtn.setTitleColor(.black, for: .normal)
  500. cardZDBtn.setTitleColor(.black, for: .normal)
  501. cardYFBtn.setTitleColor(.red, for: .selected)
  502. cardYLBtn.setTitleColor(.black, for: .normal)
  503. }else if queryEntity.cardType == "5" {
  504. cardAllBtn.isSelected = false
  505. cardJJBtn.isSelected = false
  506. cardDJBtn.isSelected = false
  507. cardZDBtn.isSelected = false
  508. cardYFBtn.isSelected = false
  509. cardYLBtn.isSelected = true
  510. cardAllBtn.setTitleColor(.black, for: .normal)
  511. cardJJBtn.setTitleColor(.black, for: .normal)
  512. cardDJBtn.setTitleColor(.black, for: .normal)
  513. cardZDBtn.setTitleColor(.black, for: .normal)
  514. cardYFBtn.setTitleColor(.black, for: .normal)
  515. cardYLBtn.setTitleColor(.red, for: .selected)
  516. }
  517. if queryEntity.settleWay == "" {
  518. wayAllBtn.isSelected = true
  519. wayBtn.isSelected = false
  520. wayBtn1.isSelected = false
  521. wayAllBtn.setTitleColor(.red, for: .selected)
  522. wayBtn.setTitleColor(.black, for: .normal)
  523. wayBtn1.setTitleColor(.black, for: .normal)
  524. } else if queryEntity.settleWay == "T0" {
  525. wayAllBtn.isSelected = false
  526. wayBtn.isSelected = true
  527. wayBtn1.isSelected = false
  528. wayAllBtn.setTitleColor(.black, for: .normal)
  529. wayBtn.setTitleColor(.red, for: .selected)
  530. wayBtn1.setTitleColor(.black, for: .normal)
  531. }else {
  532. wayAllBtn.isSelected = false
  533. wayBtn.isSelected = false
  534. wayBtn1.isSelected = true
  535. wayAllBtn.setTitleColor(.black, for: .normal)
  536. wayBtn.setTitleColor(.black, for: .normal)
  537. wayBtn1.setTitleColor(.red, for: .selected)
  538. }
  539. btnStart.setTitle(queryEntity.startTime, for: .normal)
  540. btnEnd.setTitle(queryEntity.endTime, for: .normal)
  541. }
  542. func showMenu(paretnView: UIView) {
  543. scrollView.marginLeft(left: ScreenWidth)
  544. paretnView.addSubview(self)
  545. self.setFillForSuperView()
  546. UIView.animate(withDuration: 0.5, animations: {
  547. self.scrollView.marginLeft(left: ScreenWidth - self.scrollView.width())
  548. }) { (_) in
  549. }
  550. }
  551. func hidMenu() {
  552. UIView.animate(withDuration: 0.5, animations: {
  553. self.scrollView.marginLeft(left: ScreenWidth)
  554. }) { (_) in
  555. self.removeFromSuperview()
  556. }
  557. }
  558. }
  559. class QueryEntity: NSObject {
  560. ///品牌ID
  561. var typeID = ""
  562. var startTime = ""
  563. var endTime = ""
  564. ///结算方式:T0 T1
  565. var settleWay = ""
  566. ///交易卡类型:借记卡
  567. var cardType = ""
  568. ///商户类型
  569. var busType = ""
  570. ///交易类型
  571. var depositTrade = ""
  572. ///交易方式
  573. var payType = ""
  574. ///设备类型
  575. var deviceType = ""
  576. }
  577. typealias CommonBackQuery=(_ entity: QueryEntity) -> Void