123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- //
- // ShopAuthViewController.swift
- // xingchuangke
- //
- // Created by Virgil on 2019/8/12.
- // Copyright © 2019 Virgil. All rights reserved.
- //
- import UIKit
- class BJShopInfoViewController: BaseViewController, AVCaptureViewControllerDelegate, CommonDelegate {
- @IBOutlet weak var txtQYFL: UITextField!
- @IBOutlet weak var txtType: UITextField!
- @IBOutlet weak var txtAddress2: UITextField!
- @IBOutlet weak var txtAddress1: UITextField!
- @IBOutlet weak var viewContentHeight: NSLayoutConstraint!
- @IBOutlet weak var viewContentWidth: NSLayoutConstraint!
- @IBOutlet weak var viewContent: UIView!
- @IBOutlet weak var txtIDCard: UITextField!
- @IBOutlet weak var txtName: UILabel!
- override func viewDidLoad() {
- super.viewDidLoad()
- self.title = "商户认证"
- initNavLeftBackButton()
- viewContentWidth.constant = ScreenWidth
- let substr = appDelegate.openMerchants.phone.suffix(4)
- txtName.text = "个体户\(appDelegate.openMerchants.settleName)\(substr)"
- }
-
- override func KeyboardHidden(gestureRecognizer: UIGestureRecognizer) {
- txtIDCard.resignFirstResponder()
- txtAddress2.resignFirstResponder()
- }
- var custom_code = ""
- var custom_name = ""
- var mcc_code = ""
- var mcc_name = ""
- var mcc_type = ""
- var provCode = ""
- var cityCode = ""
- var areaCode = ""
- var arrRateContent = [String]()
- ///0:行业类别 1:Mcc类型
- var commonSelectType = 0
- @IBAction func btnMenuClick(_ sender: AnyObject) {
- switch (sender as! UIButton).tag {
- case 1001: // 识别身份证号
- let vc = AVCaptureViewController()
- vc.delegate = self
- vc.cardType = 0
- self.present(vc, animated: true) {
- }
- break
- case 1002: // 所在地区
- btnSelectAddressClick()
- break
- case 1003: // 下一步
- if txtName.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入商户名")
- return
- }
- // if(txtIDCard.text!.length() < 1)
- // {
- // SVProgressHUD.showError(withStatus: "请输入身份证号")
- // return;
- // }
- if self.areaCode.length() < 1 {
- SVProgressHUD.showError(withStatus: "请选择所在地区")
- return
- }
- if txtAddress2.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入营业地址")
- return
- }
- if mcc_code.length() < 1 {
- SVProgressHUD.showError(withStatus: "请选择经营范围")
- return
- }
- if txtQYFL.text!.length() < 1 || txtQYFL.text! == "请选择" {
- SVProgressHUD.showError(withStatus: "请选择签约费率")
- return
- }
- appDelegate.openMerchants.mercName = txtName.text!
- //appDelegate.openMerchants.idCardNum = txtIDCard.text!
- appDelegate.openMerchants.provCode = provCode
- appDelegate.openMerchants.cityCode = cityCode
- appDelegate.openMerchants.areaCode = areaCode
- appDelegate.openMerchants.addrDetail = txtAddress1.text!
- appDelegate.openMerchants.bizScope = txtAddress2.text!
- appDelegate.openMerchants.customMccType = custom_code
- appDelegate.openMerchants.mccType = ""
- appDelegate.openMerchants.mcc = ""
- appDelegate.openMerchants.mccCode = mcc_code
- appDelegate.openMerchants.posRateCode = ""//txtQYFL.text!.replacingOccurrences(of: "%", with: "")
- appDelegate.openMerchants.qybRate = txtQYFL.text!.replacingOccurrences(of: "%", with: "")
- toViewController(viewController: BJBindViewController())
- break
- case 1004:
- break
- case 1005: // 经营范围
- commonSelectType = 1
- let vc = CommonSelectViewController()
- vc.delegate = self
- vc.type = 1
- toViewController(viewController: vc)
- break
- // case 1006: // Mcc类型
- // if custom_code == "" {
- // SVProgressHUD.showError(withStatus: "请先选择行业类别")
- // return
- // }
- // commonSelectType = 1
- // let vc = CommonSelectViewController()
- // vc.delegate = self
- // vc.type = 1
- // vc.custom_code = custom_code
- // toViewController(viewController: vc)
- // break
- case 1007: // 签约费率
- self.getFeiLv()
- break
- case 1008: // 增收手续费
- break
- default:
- break
- }
- }
- // MARK: =============加载数据===============
- func loadData() {
- let url = RequestURL.qybFindBankList
- let params = NSMutableDictionary()
- params.setValue("", forKey: "subjectId")
- params.setValue("", forKey: "showTimeSort")
- params.setValue("", forKey: "priceSort")
- loadDataInfo(url: url, params: params, tag: 1001)
- }
- ///费率
- let dicFL = NSMutableDictionary()
- func getFeiLv() {
- if dicFL.count > 0 {
- returnData(tag: 1003)
- return
- }
- let params = NSMutableDictionary()
- let url = RequestURL.rateConfig
- params.setValue(appDelegate.openMerchants.machineTypeId, forKey: "machine_type_id")
- params.setValue("0", forKey: "merchant_type")
- params.setValue(appDelegate.openMerchants.productTypeId, forKey: "product_type_id")
- loadDataInfo(url: url, params: params, tag: 1003, reDic: dicFL)
- }
- override func returnData(tag: Int) {
- if tag == 1001 {
- }
- if tag == 1003 {
- var rateMin = dicFL.getDouble(key: "loan_card_rate_min") * 100
- let rateMax = dicFL.getDouble(key: "loan_card_rate_max") * 100
- arrRateContent.removeAll()
- var arrTitle = [String]()
- while Int(rateMin) <= Int(rateMax) {
- arrTitle.append("\(String.init(format: "%.2f", rateMin / 100))%")
- arrRateContent.append(String.init(format: "%.2f", rateMin / 100))
- rateMin += 1
- }
- CommonUntils.AlertView(controller: self, title: nil, message: "请选择费率", buttons: arrTitle, style: .actionSheet) {[weak self] (index, _) in
- self!.txtQYFL.text = "\(self!.arrRateContent[index])%"
- }
- }
- }
- override func returnError(tag: Int, type: String) {
- }
- ///选择所在地区
- var viewSelectCity: Virgil_SelectCity!
- func btnSelectAddressClick() {
- //var viewSelectCity:Virgil_SelectCity!
- let addressList = CommonUntils.getPlistArrayForName(fileName: "AddressNew")
- if viewSelectCity == nil {
- viewSelectCity = Virgil_SelectCity(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: view.height()))
- viewSelectCity.modelType = 2
- viewSelectCity.initView(arrAddress: addressList) {[weak self] (dic) in
- self!.provCode = self!.getString(key: "addressId1", dic: dic)
- self!.cityCode = self!.getString(key: "addressId2", dic: dic)
- self!.areaCode = self!.getString(key: "addressId3", dic: dic)
- //self!.shopOpen.addressName1 = self!.getString(key: "addressName1", dic: dic) ;
- self!.txtAddress1.text = dic.getString(key: "address")
- }
- self.view.addSubview(viewSelectCity)
- }
- viewSelectCity.showPickerView()
- }
- func avCaptureViewReData(_ iDInfo: IDInfo!, img: UIImage!) {
- txtIDCard.text = iDInfo.num!
- //imgShow.image = img;
- }
- func rebackFunction(dic: NSMutableDictionary) {
- if commonSelectType == 0 {
- if custom_code != dic.getString(key: "code") {
- mcc_code = ""
- mcc_name = ""
- mcc_type = ""
- }
- custom_code = dic.getString(key: "code")
- custom_name = dic.getString(key: "name")
- txtType.text = custom_name
- } else if commonSelectType == 1 {
- mcc_code = dic.getString(key: "mcc_code")
- mcc_name = dic.getString(key: "mcc_name")
- mcc_type = dic.getString(key: "mcc_type")
- txtType.text = mcc_name
- }
- }
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- }
- override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
- super.init(nibName: "BJShopInfoViewController", bundle: nil)
- }
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- }
|