Commit 882284fd authored by 刘俊宏's avatar 刘俊宏

完善个人中心--格利支付功能流程(待接口完善)即可完成

parent cf73f295
...@@ -26,14 +26,12 @@ class GeliPayInfoModel: Mappable { ...@@ -26,14 +26,12 @@ class GeliPayInfoModel: Mappable {
class GeliPayInfoDataModel: Mappable { class GeliPayInfoDataModel: Mappable {
var gelipay_username : String? //支付账号 var gelipay_username : String? //支付账号
var status : Int? //状态:1已绑定格利支付且格利支付已绑卡,2已绑定格利支付且格利支付未绑卡,3未绑定格利支付
required init?( map: Map) { required init?( map: Map) {
} }
func mapping(map: Map) { func mapping(map: Map) {
gelipay_username <- map["gelipay_username"] gelipay_username <- map["gelipay_username"]
status <- map["status"]
} }
......
...@@ -13,6 +13,7 @@ import UIKit ...@@ -13,6 +13,7 @@ import UIKit
open class PKHUDSquareBaseView: UIView { open class PKHUDSquareBaseView: UIView {
static let defaultSquareBaseViewFrame = CGRect(origin: CGPoint.zero, size: CGSize(width: 190, height: 126)) static let defaultSquareBaseViewFrame = CGRect(origin: CGPoint.zero, size: CGSize(width: 190, height: 126))
static let nodefaultSquareBaseViewFrame = CGRect(origin: CGPoint.zero, size: CGSize(width: 100, height: 100))
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
...@@ -20,10 +21,18 @@ open class PKHUDSquareBaseView: UIView { ...@@ -20,10 +21,18 @@ open class PKHUDSquareBaseView: UIView {
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) super.init(coder: aDecoder)
} }
public init(image: UIImage? = nil, title: String? = nil, subtitle: String? = nil) { public init(image: UIImage? = nil, title: String? = nil, subtitle: String? = nil) {
if subtitle == nil && title == nil {
super.init(frame: PKHUDSquareBaseView.nodefaultSquareBaseViewFrame)
}else{
super.init(frame: PKHUDSquareBaseView.defaultSquareBaseViewFrame) super.init(frame: PKHUDSquareBaseView.defaultSquareBaseViewFrame)
}
self.imageView.image = image self.imageView.image = image
titleLabel.text = title titleLabel.text = title
subtitleLabel.text = subtitle subtitleLabel.text = subtitle
...@@ -76,9 +85,15 @@ open class PKHUDSquareBaseView: UIView { ...@@ -76,9 +85,15 @@ open class PKHUDSquareBaseView: UIView {
let threeQuarterHeight = CGFloat(ceilf(CFloat(viewHeight / 4.0 * 3.0))) let threeQuarterHeight = CGFloat(ceilf(CFloat(viewHeight / 4.0 * 3.0)))
titleLabel.frame = CGRect(origin: CGPoint(x: originX, y: 0.0), size: CGSize(width: viewWidth, height: quarterHeight)) titleLabel.frame = CGRect(origin: CGPoint(x: originX, y: 0.0), size: CGSize(width: viewWidth, height: quarterHeight))
// imageView.frame = CGRect(origin: CGPoint(x: originX, y: quarterHeight), size: CGSize(width: viewWidth, height: halfHeight))
if subtitleLabel.text == nil && titleLabel.text == nil {
imageView.frame = CGRect(origin: CGPoint(x: originX, y: quarterHeight), size: CGSize(width: viewWidth, height: halfHeight))
}else{
imageView.frame = CGRect(origin: CGPoint(x: originX, y: 15), size: CGSize(width: viewWidth, height: halfHeight)) imageView.frame = CGRect(origin: CGPoint(x: originX, y: 15), size: CGSize(width: viewWidth, height: halfHeight))
}
subtitleLabel.frame = CGRect(origin: CGPoint(x: originX, y: threeQuarterHeight - 10), size: CGSize(width: viewWidth, height: quarterHeight)) subtitleLabel.frame = CGRect(origin: CGPoint(x: originX, y: threeQuarterHeight - 10), size: CGSize(width: viewWidth, height: quarterHeight))
} }
......
...@@ -23,9 +23,10 @@ class WebViewController: BaseViewController { ...@@ -23,9 +23,10 @@ class WebViewController: BaseViewController {
initInterface() initInterface()
} }
var urlStr:String? = ""
func initInterface() -> () { func initInterface() -> () {
let url = URL(string: "https://pay.gelifood.com/m/index.htm") let url = URL(string: urlStr!)
let request = URLRequest.init(url: url!, cachePolicy: .reloadRevalidatingCacheData, timeoutInterval: 10) let request = URLRequest.init(url: url!, cachePolicy: .reloadRevalidatingCacheData, timeoutInterval: 10)
wkWebView.navigationDelegate = self wkWebView.navigationDelegate = self
......
...@@ -99,8 +99,7 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable ...@@ -99,8 +99,7 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
}else if indexPath.row == 2{ }else if indexPath.row == 2{
//权限设置-弹窗 //权限设置-弹窗
// let vc = WebViewController()
// self.navigationController?.pushViewController(vc, animated: true)
_ = self.presentHGImagePicker(maxSelected:2) { (assets) in _ = self.presentHGImagePicker(maxSelected:2) { (assets) in
//结果处理 //结果处理
print("共选择了\(assets.count)张图片,分别如下:") print("共选择了\(assets.count)张图片,分别如下:")
......
...@@ -12,56 +12,77 @@ import LGButton ...@@ -12,56 +12,77 @@ import LGButton
class BindViewController: BaseViewController { class BindViewController: BaseViewController {
@IBOutlet weak var submitBtn: LGButton! @IBOutlet weak var submitBtn: LGButton!
@IBOutlet weak var pinkView: UIView!
@IBOutlet weak var accountTF: UITextField! @IBOutlet weak var accountTF: UITextField!
@IBOutlet weak var phoneTF: UITextField! @IBOutlet weak var phoneTF: UITextField!
@IBOutlet weak var codeTF: UITextField! @IBOutlet weak var codeTF: UITextField!
@IBOutlet weak var topInputView: UIView! @IBOutlet weak var codeBtn: UIButton!
@IBOutlet weak var topPinkHeight: NSLayoutConstraint!
var isNewBind = false
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
if isNewBind {
navbar.title = "换绑支付账号" navbar.title = "绑定支付账户"
self.view.addSubview(navbar)
if pinkView.isHidden {
topInputView.snp.makeConstraints { (make) in
make.top.equalTo(NavCGRect.height)
make.left.right.equalTo(0)
make.height.equalTo(50)
}
submitBtn.titleString = "确认绑定支付账户"
}else{ }else{
pinkView.snp.makeConstraints { (make) in navbar.title = "换绑支付账户"
make.top.equalTo(NavCGRect.height)
make.left.right.equalTo(0)
make.height.equalTo(22.5)
} }
topInputView.snp.makeConstraints { (make) in self.view.addSubview(navbar)
make.top.equalTo(NavCGRect.height+32.5) if isNewBind {
make.left.right.equalTo(0) topPinkHeight.constant = 44
make.height.equalTo(50) }else{
} topPinkHeight.constant = 44 - 38
submitBtn.titleString = "绑定支付账户"
} }
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
//MARK: -绑定、获取验证码、忘记手机号码方法 //MARK: -绑定、获取验证码
//
@IBAction func registerPayAccountAction(_ sender: Any) { @IBAction func registerPayAccountAction(_ sender: Any) {
print("注册支付账号") print("注册支付账号")
HUD.flash(.progress)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
locationGeliPay(["user_token":UserToken as Any,"type":"1"], success: { (data) in
HUD.hide(animated: true)
let dataM = data as! LocationGeliPayModel
let vc = WebViewController()
vc.urlStr = dataM.data?.url
self.navigationController?.pushViewController(vc, animated: true)
}) { (error) in
}
} }
@IBAction func getCodeAction(_ sender: Any) { @IBAction func getCodeAction(_ sender: UIButton) {
print("获取验证码") print("获取验证码")
sendSmsCaptcha(["phone":phoneTF.text as Any,"type":"5"], success: { (data) in
let dataM = data as! UpDataModel
if dataM.code == 1 {
sender.isUserInteractionEnabled = false
sender.setTitle("60s", for: .normal);
Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.timeCounting), userInfo: nil, repeats: true);
}
}) { (error) in
} }
@IBAction func forgetPhoneNumAction(_ sender: Any) {
print("忘记手机号码")
} }
var timeCount:Int = 60
@objc func timeCounting(sender:Timer){
timeCount -= 1
codeBtn.setTitle("\(timeCount)"+"s", for: .normal)
if timeCount == 0{
codeBtn.setTitle("获取验证码", for: .normal)
codeBtn.isUserInteractionEnabled = true
timeCount = 60
sender.invalidate()
}
}
@IBAction func submitBindingAction(_ sender: Any) { @IBAction func submitBindingAction(_ sender: Any) {
print("确认绑定账号") print("确认绑定账号")
} }
} }
...@@ -9,14 +9,25 @@ ...@@ -9,14 +9,25 @@
import UIKit import UIKit
import LGButton import LGButton
class BindStepTwoViewController: BaseViewController { class BindStepTwoViewController: BaseViewController,UITextFieldDelegate {
var phoneStr : String
= ""
var isNewBind = false
@IBOutlet weak var accountLbl: UILabel! @IBOutlet weak var accountLbl: UILabel!
@IBAction func getCodeAction(_ sender: Any) {
} @IBOutlet weak var codeBtn: UIButton!
@IBAction func forgetPassAction(_ sender: Any) {
}
@IBAction func nextStep(_ sender: Any) { @IBAction func nextStep(_ sender: Any) {
HUD.flash(.progress)
verifyMmsCaptcha(["phone":phoneStr,"type":"4","code":inputTF.text! as String], success: { (data) in
HUD.hide(animated: true)
let vc = BindViewController()
vc.isNewBind = self.isNewBind
self.navigationController?.pushViewController(vc, animated: true)
}) { (error) in
}
} }
...@@ -25,7 +36,11 @@ class BindStepTwoViewController: BaseViewController { ...@@ -25,7 +36,11 @@ class BindStepTwoViewController: BaseViewController {
@IBOutlet weak var nextBtn: LGButton! @IBOutlet weak var nextBtn: LGButton!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
if isNewBind {
navbar.title = "绑定支付账户" navbar.title = "绑定支付账户"
}else{
navbar.title = "换绑支付账户"
}
self.view.addSubview(navbar) self.view.addSubview(navbar)
topView.snp.makeConstraints { (make) in topView.snp.makeConstraints { (make) in
...@@ -33,26 +48,62 @@ class BindStepTwoViewController: BaseViewController { ...@@ -33,26 +48,62 @@ class BindStepTwoViewController: BaseViewController {
make.left.right.equalTo(0) make.left.right.equalTo(0)
make.height.equalTo(99) make.height.equalTo(99)
} }
inputTF.delegate = self
self.accountLbl.text = phoneStr
nextBtn.alpha = 0.5
nextBtn.isUserInteractionEnabled = false
// Do any additional setup after loading the view.
}
if inputTF.text?.count == 0 { func textFieldDidBeginEditing(_ textField: UITextField) {
changeBtnCanSelect (sender: textField)
}
func textFieldDidEndEditing(_ textField: UITextField) {
changeBtnCanSelect (sender: textField)
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
changeBtnCanSelect (sender: textField)
return true
}
func changeBtnCanSelect (sender:UITextField){
if sender.text?.count == 0 {
nextBtn.alpha = 0.5 nextBtn.alpha = 0.5
nextBtn.isUserInteractionEnabled = false nextBtn.isUserInteractionEnabled = false
}else{ }else{
nextBtn.alpha = 1 nextBtn.alpha = 1
nextBtn.isUserInteractionEnabled = true nextBtn.isUserInteractionEnabled = true
} }
// Do any additional setup after loading the view.
} }
/* @IBAction func getCodeAction(_ sender: UIButton) {
// MARK: - Navigation // HUD.flash(.labeledSubSuccess(subtitle: "发送成功"),delay: 1.2)
sendSmsCaptcha(["phone":phoneStr,"type":"4"], success: { (data) in
let dataM = data as! UpDataModel
if dataM.code == 1 {
sender.isUserInteractionEnabled = false
sender.setTitle("60s", for: .normal);
Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.timeCounting), userInfo: nil, repeats: true);
}
}) { (error) in
}
}
var timeCount:Int = 60
// In a storyboard-based application, you will often want to do a little preparation before navigation @objc func timeCounting(sender:Timer){
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { timeCount -= 1
// Get the new view controller using segue.destination. codeBtn.setTitle("\(timeCount)"+"s", for: .normal)
// Pass the selected object to the new view controller. if timeCount == 0{
codeBtn.setTitle("获取验证码", for: .normal)
codeBtn.isUserInteractionEnabled = true
timeCount = 60
sender.invalidate()
}
} }
*/
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BindStepTwoViewController" customModule="GeliBusinessPlatform" customModuleProvider="target"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BindStepTwoViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<connections> <connections>
<outlet property="accountLbl" destination="LOM-aL-uSm" id="Ej4-uV-9bk"/> <outlet property="accountLbl" destination="LOM-aL-uSm" id="Ej4-uV-9bk"/>
<outlet property="codeBtn" destination="EMV-Hk-uFx" id="owq-4Z-BtV"/>
<outlet property="inputTF" destination="aZQ-or-Ekx" id="KKJ-ou-7WF"/> <outlet property="inputTF" destination="aZQ-or-Ekx" id="KKJ-ou-7WF"/>
<outlet property="nextBtn" destination="B7f-Hz-PLj" id="bNM-Qb-uaI"/> <outlet property="nextBtn" destination="B7f-Hz-PLj" id="bNM-Qb-uaI"/>
<outlet property="topView" destination="qeZ-NG-WV9" id="wsf-Ri-WGg"/> <outlet property="topView" destination="qeZ-NG-WV9" id="wsf-Ri-WGg"/>
...@@ -35,11 +36,10 @@ ...@@ -35,11 +36,10 @@
<color key="textColor" name="标题字颜色"/> <color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="155*****121" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LOM-aL-uSm"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="7" translatesAutoresizingMaskIntoConstraints="NO" id="LOM-aL-uSm">
<rect key="frame" x="327" y="15" width="72" height="18.5"/> <rect key="frame" x="390.5" y="15" width="8.5" height="18.5"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="18.5" id="2ii-aD-Dsg"/> <constraint firstAttribute="height" constant="18.5" id="2ii-aD-Dsg"/>
<constraint firstAttribute="width" constant="72" id="VuV-bl-LZv"/>
</constraints> </constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/> <fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="灰色字体颜色"/> <color key="textColor" name="灰色字体颜色"/>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<color key="titleColor" name="按钮渐变色下,字体颜色"/> <color key="titleColor" name="按钮渐变色下,字体颜色"/>
</state> </state>
<connections> <connections>
<action selector="getCodeAction:" destination="-1" eventType="touchUpInside" id="3p8-73-upu"/> <action selector="getCodeAction:" destination="-1" eventType="touchUpInside" id="8iI-aZ-59X"/>
</connections> </connections>
</button> </button>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入验证码" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aZQ-or-Ekx"> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入验证码" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aZQ-or-Ekx">
...@@ -125,32 +125,19 @@ ...@@ -125,32 +125,19 @@
<userDefinedRuntimeAttribute type="number" keyPath="titleFontSize"> <userDefinedRuntimeAttribute type="number" keyPath="titleFontSize">
<real key="value" value="17"/> <real key="value" value="17"/>
</userDefinedRuntimeAttribute> </userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="3"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
<connections> <connections>
<action selector="nextStep:" destination="-1" eventType="touchUpInside" id="gD6-ue-Bde"/> <action selector="nextStep:" destination="-1" eventType="touchUpInside" id="gD6-ue-Bde"/>
</connections> </connections>
</view> </view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uVm-FH-axX">
<rect key="frame" x="149" y="297" width="116" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="dsT-sJ-mSF"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<state key="normal" title="忘记手机号码?">
<color key="titleColor" name="按钮渐变色下,字体颜色"/>
</state>
<connections>
<action selector="forgetPassAction:" destination="-1" eventType="touchUpInside" id="616-Hr-lW0"/>
</connections>
</button>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="uVm-FH-axX" secondAttribute="trailing" constant="149" id="3GD-ax-jUC"/>
<constraint firstItem="B7f-Hz-PLj" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="37.5" id="GVf-nl-UKJ"/> <constraint firstItem="B7f-Hz-PLj" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="37.5" id="GVf-nl-UKJ"/>
<constraint firstItem="uVm-FH-axX" firstAttribute="top" secondItem="B7f-Hz-PLj" secondAttribute="bottom" constant="10" id="HTH-CD-gj8"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="B7f-Hz-PLj" secondAttribute="trailing" constant="37.5" id="MkO-FJ-nuQ"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="B7f-Hz-PLj" secondAttribute="trailing" constant="37.5" id="MkO-FJ-nuQ"/>
<constraint firstItem="uVm-FH-axX" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="149" id="REr-yi-BXA"/>
<constraint firstItem="B7f-Hz-PLj" firstAttribute="top" secondItem="qeZ-NG-WV9" secondAttribute="bottom" constant="100" id="Tzq-ar-jLH"/> <constraint firstItem="B7f-Hz-PLj" firstAttribute="top" secondItem="qeZ-NG-WV9" secondAttribute="bottom" constant="100" id="Tzq-ar-jLH"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="qeZ-NG-WV9" secondAttribute="trailing" id="WtR-Xo-zsG"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="qeZ-NG-WV9" secondAttribute="trailing" id="WtR-Xo-zsG"/>
<constraint firstItem="qeZ-NG-WV9" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="toL-CZ-eyt"/> <constraint firstItem="qeZ-NG-WV9" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="toL-CZ-eyt"/>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import UIKit import UIKit
import LGButton import LGButton
class PayViewController: BaseViewController { class PayViewController: BaseViewController ,GeliAlertViewDelegate{
@IBOutlet weak var enterBtnFrameBtn: UIButton! @IBOutlet weak var enterBtnFrameBtn: UIButton!
@IBOutlet weak var enterBtn: LGButton! @IBOutlet weak var enterBtn: LGButton!
...@@ -20,48 +20,31 @@ class PayViewController: BaseViewController { ...@@ -20,48 +20,31 @@ class PayViewController: BaseViewController {
@IBOutlet weak var accountLbl: UILabel! @IBOutlet weak var accountLbl: UILabel!
@IBOutlet weak var userEnShowView: UIView!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
navbar.title = "支付账号" navbar.title = "支付账号"
self.view.addSubview(navbar) self.view.addSubview(navbar)
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
HUD.flash(.progress)
geliPayInfo(["user_token":UserToken as Any], success: { (data) in geliPayInfo(["user_token":UserToken as Any], success: { (data) in
let dataM = data as! GeliPayInfoModel let dataM = data as! GeliPayInfoModel
if dataM.data?.status == 3 { if dataM.code == 2 {
if self.accountLbl.text == "未绑定支付账号" { self.enterBtnFrameBtn.isHidden = false
self.enterBtn.titleString = "绑定账号" self.enterBtn.isHidden = true
self.enterBtn.borderColor = UIColor(named: "按钮渐变色下,字体颜色")!
self.enterBtn.titleColor = UIColor(named: "按钮渐变色下,字体颜色")!
self.enterBtn.gradientEndColor = UIColor(named: "app底色")
self.enterBtn.gradientStartColor = UIColor(named: "app底色")
self.enterBtn.borderWidth = 1.5
self.passBtn.isHidden = true self.passBtn.isHidden = true
self.changeBindBtn.isHidden = true self.changeBindBtn.isHidden = true
}
}else{ }else{
self.accountLbl.text = dataM.data?.gelipay_username
} }
self.userEnShowView.isHidden = true
HUD.hide(animated: true)
}) { (error) in }) { (error) in
} }
if accountLbl.text == "未绑定支付账号" {
enterBtn.titleString = "绑定账号"
enterBtn.borderColor = UIColor(named: "按钮渐变色下,字体颜色")!
enterBtn.titleColor = UIColor(named: "按钮渐变色下,字体颜色")!
enterBtn.gradientEndColor = UIColor(named: "app底色")
enterBtn.gradientStartColor = UIColor(named: "app底色")
enterBtn.borderWidth = 1.5
passBtn.isHidden = true
changeBindBtn.isHidden = true
}
// if navbar.title == "支付账号" {
// passBtn.setTitle("修改支付密码", for: .normal)
// }else{
// passBtn.setTitle("设置支付密码", for: .normal)
// }
pinkView.snp.makeConstraints { (make) in pinkView.snp.makeConstraints { (make) in
make.top.equalTo(NavCGRect.height) make.top.equalTo(NavCGRect.height)
...@@ -74,17 +57,75 @@ class PayViewController: BaseViewController { ...@@ -74,17 +57,75 @@ class PayViewController: BaseViewController {
@IBAction func bindAction(_ sender: Any) { @IBAction func bindAction(_ sender: Any) {
print("换绑账号") print("换绑账号")
let UserToken = UserDefaults.standard.value(forKey: "user_token")
getShopAdministratorInfo(["user_token":UserToken as Any], success: { (data) in
let dataM = data as! ShopAdministratorInfoModel
if dataM.code != 2 {
//跳转下一页
let vc = BindStepTwoViewController()
vc.phoneStr = dataM.data?.mobile as! String
self.navigationController?.pushViewController(vc, animated: true)
}
}) { (error) in
}
} }
@IBAction func passwordAction(_ sender: UIButton) { @IBAction func passwordAction(_ sender: UIButton) {
if sender.titleLabel?.text == "修改支付密码" { HUD.flash(.progress)
print("修改支付密码") let UserToken = UserDefaults.standard.value(forKey: "user_token")
}else{
print("设置支付密码") locationGeliPay(["user_token":UserToken as Any,"type":"2"], success: { (data) in
HUD.hide(animated: true)
let dataM = data as! LocationGeliPayModel
let vc = WebViewController()
vc.urlStr = dataM.data?.url
self.navigationController?.pushViewController(vc, animated: true)
}) { (error) in
} }
} }
@IBAction func enterInGLPayAction(_ sender: Any) { @IBAction func enterInGLPayAction(_ sender: Any) {
print("进入格利支付") print("进入格利支付")
HUD.flash(.progress)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
locationGeliPay(["user_token":UserToken as Any,"type":"1"], success: { (data) in
HUD.hide(animated: true)
let dataM = data as! LocationGeliPayModel
let vc = WebViewController()
vc.urlStr = dataM.data?.url
self.navigationController?.pushViewController(vc, animated: true)
}) { (error) in
}
} }
@IBAction func enterBindAction(_ sender: UIButton) {
print("未绑定--")
let UserToken = UserDefaults.standard.value(forKey: "user_token")
getShopAdministratorInfo(["user_token":UserToken as Any], success: { (data) in
let dataM = data as! ShopAdministratorInfoModel
if dataM.code != 2 {
//跳转下一页
let vc = BindStepTwoViewController()
vc.isNewBind = true
vc.phoneStr = dataM.data?.mobile as! String
self.navigationController?.pushViewController(vc, animated: true)
}else{
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = "020-81338860"
alertView.titileLbl.text = "亲爱的格利商户,您未绑定手机号,无法绑定格利账号,请联系:"
self.view.window?.addSubview(alertView)
}
}) { (error) in
}
}
func sureAction(sender: UIButton) {
UIApplication.shared.openURL(NSURL.init(string: "tel://020-81338860")! as URL)
}
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<outlet property="enterBtnFrameBtn" destination="4Jc-QV-Bqa" id="YLi-Cz-IgY"/> <outlet property="enterBtnFrameBtn" destination="4Jc-QV-Bqa" id="YLi-Cz-IgY"/>
<outlet property="passBtn" destination="aJE-2M-4y3" id="oWF-if-08i"/> <outlet property="passBtn" destination="aJE-2M-4y3" id="oWF-if-08i"/>
<outlet property="pinkView" destination="5ip-zi-hlC" id="Yt8-rj-o8p"/> <outlet property="pinkView" destination="5ip-zi-hlC" id="Yt8-rj-o8p"/>
<outlet property="userEnShowView" destination="wuO-lu-ULv" id="oDa-Og-TmN"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections> </connections>
</placeholder> </placeholder>
...@@ -180,7 +181,14 @@ ...@@ -180,7 +181,14 @@
<real key="value" value="1"/> <real key="value" value="1"/>
</userDefinedRuntimeAttribute> </userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
<connections>
<action selector="enterBindAction:" destination="-1" eventType="touchUpInside" id="0wC-Il-XZZ"/>
</connections>
</button> </button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wuO-lu-ULv">
<rect key="frame" x="0.0" y="0.0" width="414" height="862"/>
<color key="backgroundColor" name="app底色"/>
</view>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
...@@ -199,16 +207,23 @@ ...@@ -199,16 +207,23 @@
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="5ip-zi-hlC" secondAttribute="trailing" id="jaP-ca-fur"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="5ip-zi-hlC" secondAttribute="trailing" id="jaP-ca-fur"/>
<constraint firstItem="4Jc-QV-Bqa" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="37.5" id="mMt-4D-EFf"/> <constraint firstItem="4Jc-QV-Bqa" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="37.5" id="mMt-4D-EFf"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="dpm-28-Ljh" secondAttribute="trailing" constant="37.5" id="p4a-ll-Ibx"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="dpm-28-Ljh" secondAttribute="trailing" constant="37.5" id="p4a-ll-Ibx"/>
<constraint firstAttribute="trailing" secondItem="wuO-lu-ULv" secondAttribute="trailing" id="qrM-eG-7MH"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="wuO-lu-ULv" secondAttribute="bottom" id="rKC-00-5nJ"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="aJE-2M-4y3" secondAttribute="trailing" constant="37.5" id="shk-vI-E99"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="aJE-2M-4y3" secondAttribute="trailing" constant="37.5" id="shk-vI-E99"/>
<constraint firstItem="wuO-lu-ULv" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="vVV-EG-FPf"/>
<constraint firstItem="aJE-2M-4y3" firstAttribute="top" secondItem="dpm-28-Ljh" secondAttribute="bottom" constant="20" id="vlV-WR-Sjm"/> <constraint firstItem="aJE-2M-4y3" firstAttribute="top" secondItem="dpm-28-Ljh" secondAttribute="bottom" constant="20" id="vlV-WR-Sjm"/>
<constraint firstItem="Rgd-rh-pDk" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="we4-rg-j6j"/> <constraint firstItem="Rgd-rh-pDk" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="we4-rg-j6j"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Rgd-rh-pDk" secondAttribute="trailing" id="wiY-zs-sO1"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Rgd-rh-pDk" secondAttribute="trailing" id="wiY-zs-sO1"/>
<constraint firstItem="wuO-lu-ULv" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="wmN-1e-553"/>
</constraints> </constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/> <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="131.8840579710145" y="112.5"/> <point key="canvasLocation" x="131.8840579710145" y="112.5"/>
</view> </view>
</objects> </objects>
<resources> <resources>
<namedColor name="app底色">
<color red="0.94509803921568625" green="0.94509803921568625" blue="0.94509803921568625" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="按钮渐变色上"> <namedColor name="按钮渐变色上">
<color red="0.3880000114440918" green="0.62400001287460327" blue="0.90200001001358032" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.3880000114440918" green="0.62400001287460327" blue="0.90200001001358032" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment