123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- //
- // PersonalBaseViewController.swift
- // xingchuangke
- //
- // Created by Virgil on 2019/11/2.
- // Copyright © 2019 Virgil. All rights reserved.
- //
- import UIKit
- class PersonalBaseViewController: BaseViewController, AVCaptureViewControllerDelegate {
- @IBOutlet weak var txtShopDetailAddress: UITextField!
- @IBOutlet weak var txtShopAddress: UITextField!
- @IBOutlet weak var txtBusinessName: UITextField!
- @IBOutlet weak var txtXYKPhone: UITextField!
- @IBOutlet weak var txtXYKCard: UITextField!
- @IBOutlet weak var txtIDCard: UITextField!
- @IBOutlet weak var txtName: UITextField!
- @IBOutlet weak var txtShopName: UITextField!
- var shopOpen: ShopOpenEntity!
- override func viewDidLoad() {
- super.viewDidLoad()
- self.title = "完善资料"
- initNavLeftBackButton()
- }
- override func KeyboardHidden(gestureRecognizer: UIGestureRecognizer) {
- txtShopDetailAddress.resignFirstResponder()
- txtShopAddress.resignFirstResponder()
- txtBusinessName.resignFirstResponder()
- txtXYKPhone.resignFirstResponder()
- txtXYKCard.resignFirstResponder()
- txtIDCard.resignFirstResponder()
- txtName.resignFirstResponder()
- txtShopName.resignFirstResponder()
- }
- var viewSelectCity: Virgil_SelectCity!
- //btnAddTarget(view: self.view, selector: #selector(self.btnMenuClick))
- @IBAction func btnMenuClick(_ sender: AnyObject) {
- switch (sender as! UIButton).tag {
- case 1001: // 名称说明
- let vc = CommonWebViewViewController()
- vc.strTitle = "公司名称规则"
- vc.sourceType = 1
- vc.url = "\(RequestURL.sysConfigWeb)?type=company_name"
- toViewController(viewController: vc)
- break
- case 1002: // 身份证号拍照
- let vc = AVCaptureViewController()
- vc.delegate = self
- vc.cardType = 0
- self.present(vc, animated: true) {
- }
- break
- case 1003: // 选择店铺所在地区
- 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!.shopOpen.addressId1 = self!.getString(key: "addressId1", dic: dic)
- self!.shopOpen.addressId2 = self!.getString(key: "addressId2", dic: dic)
- self!.shopOpen.addressId3 = self!.getString(key: "addressId3", dic: dic)
- self!.shopOpen.addressName1 = self!.getString(key: "addressName1", dic: dic)
- self!.shopOpen.addressName2 = self!.getString(key: "addressName2", dic: dic)
- self!.shopOpen.addressName3 = self!.getString(key: "addressName3", dic: dic)
- //self!.shopOpen.address = self!.getString(key: "address", dic: dic);
- self!.txtShopAddress.text = self!.getString(key: "address", dic: dic)
- }
- self.view.addSubview(viewSelectCity)
- }
- viewSelectCity.showPickerView()
- break
- case 1004: // 下一步
- submitHK()
- break
- case 1005: //
- break
- case 1006: //
- break
- default:
- break
- }
- }
- // MARK: =============加载数据===============
- func submitHK() {
- if txtBusinessName.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入商户名称")
- return
- }
- if txtName.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入法人名称")
- return
- }
- if txtIDCard.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入身份证号")
- return
- }
- if txtXYKCard.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入信用卡号")
- return
- }
- if txtXYKPhone.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入信用卡预留手机号")
- return
- }
- if txtShopName.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入店铺名称")
- return
- }
- if self.shopOpen.addressId1 == "" || self.shopOpen.addressId2 == "" || self.shopOpen.addressId3 == "" {
- SVProgressHUD.showError(withStatus: "请选择店铺所在地区")
- return
- }
- if txtShopDetailAddress.text!.length() < 1 {
- SVProgressHUD.showError(withStatus: "请输入店铺地址")
- return
- }
- let url = RequestURL.improveInfo
- let params = NSMutableDictionary()
- params.setValue(shopOpen.phone, forKey: "regAccno")
- params.setValue(txtBusinessName.text!, forKey: "companyName")
- params.setValue(txtName.text!, forKey: "applicantName")
- params.setValue(txtIDCard.text!, forKey: "applicantCard")
- params.setValue(txtXYKCard.text!, forKey: "creditCardNum")
- params.setValue(txtXYKPhone.text!, forKey: "creditCardPhone")
- params.setValue(txtShopName.text!, forKey: "shopName")
- params.setValue(txtShopDetailAddress.text!, forKey: "shopAddress")
- params.setValue(self.shopOpen.addressId1, forKey: "shopProvinceId")
- params.setValue(self.shopOpen.addressName1, forKey: "shopProvinceName")
- params.setValue(self.shopOpen.addressName2, forKey: "shopCityName")
- params.setValue(self.shopOpen.addressId2, forKey: "shopCityId")
- params.setValue(self.shopOpen.addressName3, forKey: "shopAreaName")
- params.setValue(self.shopOpen.addressId3, forKey: "shopAreaId")
- submitData(url: url, params: params, tag: 1001)
- }
- override func returnData(tag: Int) {
- if tag == 1001 {
- let dichaike = dicBackData["haike"] as? NSDictionary
- if dichaike != nil {
- let dicResult = dichaike!["result"] as? NSDictionary
- if dicResult != nil {
- if dicResult!.getString(key: "regFlag") == "1" {
- self.shopOpen.pmmerId = dicResult!.getString(key: "pmmerId")
- self.shopOpen.companyName = txtBusinessName.text!
- self.shopOpen.name = txtName.text!
- self.shopOpen.card = txtIDCard.text!
- self.shopOpen.creditCardNum = txtXYKCard.text!
- self.shopOpen.creditCardPhone = txtXYKPhone.text!
- self.shopOpen.shopName = txtShopName.text!
- self.shopOpen.addressDetail = txtShopDetailAddress.text!
- let vc = PersonalBindCardViewController()
- vc.shopOpen = self.shopOpen
- toViewController(viewController: vc)
- } else {
- let dicMessage = dichaike!["message"] as? NSDictionary
- if dicMessage != nil {
- SVProgressHUD.showError(withStatus: dicMessage!.getString(key: "content"))
- } else {
- SVProgressHUD.showError(withStatus: "提交海科失败,请稍后重试!")
- }
- }
- } else {
- let dicMessage = dichaike!["message"] as? NSDictionary
- if dicMessage != nil {
- SVProgressHUD.showError(withStatus: dicMessage!.getString(key: "content"))
- } else {
- SVProgressHUD.showError(withStatus: "提交海科失败,请稍后重试!")
- }
- }
- } else {
- SVProgressHUD.showError(withStatus: "提交海科失败,请稍后重试!")
- }
- }
- }
- override func returnError(tag: Int, type: String) {
- }
- func avCaptureViewReData(_ iDInfo: IDInfo!, img: UIImage!) {
- txtIDCard.text = iDInfo.num!
- //imgShow.image = img;
- }
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- }
- override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
- super.init(nibName: "PersonalBaseViewController", bundle: nil)
- }
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- }
|