123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- var businessT = require('../../../tool/business-tool.js')
- var sysT = require('../../../tool/sys-tool.js')
- var url = require('../../../constant/url.js')
- var publicData = require('../../../constant/data.js')
- var verify = require('../../../tool/verify.js')
- import Net from '../../../tool/net.js'
- var net = new Net()
- var app = getApp()
- Page({
- data: {
- card: '',
- bank: { bank: '', icon: '' },
- branch: '',
- isInput: false
- },
- inputAction(e) {
- if (e.currentTarget.dataset.type == 'card') {
- this.setData({
- card: e.detail.value
- })
- if (this.data.card.length == 22) {
- this.getBankWithInChooseBank()
- }
- } else {
- this.setData({
- branch: e.detail.value
- })
- }
- },
- intoChooseBank() {
- swan.navigateTo({
- url: './choose-bank/choose-bank',
- });
- },
- save() {
- if (!verify.isNumber(this.data.card) || this.data.card.length < publicData.minBankCodeLength) {
- swan.showToast({
- title: '请输入正确的银行卡卡号',
- icon: 'none',
- mask: true
- });
- } else if (this.data.bank.bank.length < publicData.minBankNameLength) {
- swan.showToast({
- title: '请输入正确的开户银行',
- icon: 'none',
- mask: true
- });
- } else {
- swan.showLoading({
- title: '请稍后...',
- mask: true,
- });
- net.connectNeedLogin({
- url: url.app_host + url.modifyBank,
- data: {
- sbu_id: this.data.current.id,
- bank: this.data.bank.bank,
- bank_code: this.data.card,
- bank_branch: this.data.branch
- },
- success: (err, res) => {
- swan.hideLoading();
- swan.showToast({
- title: '修改成功!',
- icon: 'none',
- mask: true
- });
- var pages = getCurrentPages()
- var prevPage = pages[pages.length - 2]
- var card = this.data.card
- card = "**** **** **** **** " + card.slice(-4)
- prevPage.setData({
- card
- })
- swan.navigateBack()
- },
- fail: (err, res) => {
- swan.hideLoading();
- businessT.showFailTips(err)
- }
- })
- }
- },
- inputFocus() {
- this.data.isInput = true
- },
- inputBlur() {
- if (this.data.isInput) {
- this.data.isInput = false
- this.getBankWithInChooseBank(false)
- }
- },
- getBankWithInChooseBank(flag) {
- net.connect({
- url: url.alipayGetBank + this.data.card,
- data: {},
- method: 'GET',
- success: (err, res) => { },
- fail: (err, res) => {
- businessT.debugLog(res)
- if (res && res['bank']) {
- var dic = publicData.alipayBankDic
- if (dic[res['bank']]) {
- this.data.bank.bank = dic[res['bank']]
- this.data.bank.icon = this.getBankIcon(this.data.bank.bank)
- this.setData({
- bank: this.data.bank
- })
- return
- }
- }
- if (flag) {
- this.chooesBank()
- }
- }
- }, false)
- },
- getBankIcon(bank) {
- var icon = publicData.bankDic[bank]
- return icon
- },
- chooseBank() {
- console.log(this.data.isInput)
- if (this.data.isInput) {
- this.data.isInput = false
- this.getBankWithInChooseBank(true)
- return
- }
- this.intoChooseBank()
- },
- onLoad: function (res) {
- // 监听页面加载的生命周期函数
- var current = JSON.parse(res.current)
- this.setData({
- current,
- card: current.bank_code,
- bank_branch:current.bank_branch
- })
- this.getBankWithInChooseBank(false)
- },
- onReady: function () {
- // 监听页面初次渲染完成的生命周期函数
- },
- onShow: function () {
- // 监听页面显示的生命周期函数
- swan.setPageInfo && swan.setPageInfo({
- title: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
- keywords: '我的社保,我的社保网,我的社保APP,社会保障,社保,社保代缴,公积金代缴,社会保险,五险一金,医保,医疗保险,公积金,养老,生育,工伤,失业,住房公积金,社保代理,代缴社保,公积金代理,查悦社保,大社保,亲亲小保,社保掌上通,招聘求职,创业,买房,贷款,计算器,人社局,摇号',
- description: '我的社保APP是为个人、企业提供社保代缴代扣、公积金代扣代缴、社保查询、公积金查询服务的名牌产品。解决个体工商户、自由职业者、待业人员、全职妈妈、创业者等的个人社保公积金断缴难题,同时解决贷款, 买房, 买车, 养老, 医疗, 生育, 医疗报销等难题。同时为企业提供全国专业社保代理和公积金代理。',
- articleTitle: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
- release_date: '2019-02-23 20:00:00',
- success: function () {
- console.log('页面基础信息设置完成');
- },
- fail: function (res) {
- console.log('设置失败');
- },
- })
- this.setData({
- bank: this.data.bank
- })
- },
- onHide: function () {
- // 监听页面隐藏的生命周期函数
- },
- onUnload: function () {
- // 监听页面卸载的生命周期函数
- },
- onPullDownRefresh: function () {
- // 监听用户下拉动作
- },
- onReachBottom: function () {
- // 页面上拉触底事件的处理函数
- },
- onShareAppMessage: function () {
- // 用户点击右上角转发
- }
- });
|