123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- //
- // BJBindViewController.swift
- // xingchuangke
- //
- // Created by Virgil on 2019/8/12.
- // Copyright © 2019 Virgil. All rights reserved.
- //
- import UIKit
- class BJBindViewController: BaseViewController {
- @IBOutlet weak var txtNo: UITextField!
- @IBOutlet weak var lblZC: UITextField!
- var arrRateContent = [String]()
- override func viewDidLoad() {
- super.viewDidLoad()
- self.title = "绑定终端"
- initNavLeftBackButton()
- }
- override func KeyboardHidden(gestureRecognizer: UIGestureRecognizer) {
- txtNo.resignFirstResponder()
- }
- //btnAddTarget(view: self.view, selector: #selector(self.btnMenuClick))
- @IBAction func btnMenuClick(_ sender: AnyObject) {
- switch (sender as! UIButton).tag {
- case 1001: // 扫码
- mainViewControllerIsGo = false
- let authStatus = AVCaptureDevice.authorizationStatus(for: AVMediaType.video)
- if authStatus == .restricted || authStatus == .denied {
- CommonUntils.alert(message: "您的相机功能已被禁用\r\n请到“设置>隐私>相机”中开启")
- return
- }
- let view = ScannerViewController()
- self.navigationController?.pushViewController(view, animated: true)
- break
- case 1002: // 确认绑定
- if txtNo.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入终端号或点击右侧扫码按钮扫码")
- return
- }
- if lblZC.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请选择政策")
- return
- }
- appDelegate.openMerchants.posTerminalNo = txtNo.text!
- loadData()
- break
- case 1003: //
- break
- case 1004: //
- break
- case 1005: //
- break
- case 1006: //政策
- self.getFeiLv()
- break
- default:
- break
- }
- }
- ///政策
- func getFeiLv() {
- let params = NSMutableDictionary()
- let url = RequestURL.getPolicyFlag
- loadDataList(url: url, params: params, tag: 1003)
- }
- // MARK: =============加载数据===============
- func loadData() {
- let url = RequestURL.openingMerchantsQyb
- let params = appDelegate.openMerchants.mj_keyValues()!
- print(params)
- submitData(url: url, params: params, tag: 1002)
- }
- override func returnData(tag: Int) {
- if tag == 1002 {
- //SVProgressHUD.showSuccess(withStatus: "提交成功");
- SVProgressHUD.showSuccess(withStatus: "信息提交成功,请等待审核!")
- if !CommonUntils.reBackView(controller: self, aclass: ShopManagerViewController.classForCoder()) {
- self.navigationController?.popToRootViewController(animated: true)
- }
- }
- if tag == 1003 {
- arrRateContent.removeAll()
- var arrTitle = [String]()
- for dic in self.arrData {
- let dicNew = NSMutableDictionary(dictionary: dic as! NSDictionary)
- let name = dicNew.getString(key: "name")
- arrTitle.append("\(String.init(format: "%@", name))")
- arrRateContent.append(String.init(format: "%@", name))
- }
-
- CommonUntils.AlertView(controller: self, title: nil, message: "请选择政策", buttons: arrTitle, style: .actionSheet) {[weak self] (index, _) in
- self!.lblZC.text = "\(self!.arrRateContent[index])"
- let dic = self!.arrData[index]
- let dicNew = NSMutableDictionary(dictionary: dic as! NSDictionary)
- let depositFlag = dicNew.getString(key: "depositFlag")
- let policyFlag = dicNew.getString(key: "policyFlag")
- appDelegate.openMerchants.policyFlag = policyFlag
- appDelegate.openMerchants.depositFlag = depositFlag
- }
- }
- }
- override func returnError(tag: Int, type: String) {
- }
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- if mainViewControllerIsGo {
- mainViewControllerIsGo = false
- txtNo.text = mainViewControllerIsGoValue
- }
- }
- override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
- super.init(nibName: "BJBindViewController", bundle: nil)
- }
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- }
|