123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- var businessT = require('../../../tool/business-tool.js')
- var sysT = require('../../../tool/sys-tool.js')
- var url = require('../../../constant/url.js')
- import Net from '../../../tool/net.js'
- var net = new Net()
- var app = getApp()
- Page({
- data: {
- ui: [{ t: '真实姓名' }, { t: '民族' }, { t: '身份证号', p: '请输入身份证号' }, { t: '户籍地址', p: '请输入户籍地址' }, { t: '手机号码', p: '请输入手机号码' }],
- idCardStatus: false,
- modalStatus: false,
- time: 60,
- },
- //拍摄要求模态框
- openModal() {
- var cameramodal = this.selectComponent("#camera-modal")
- cameramodal.openModal();
- },
- goBack() {
- swan.navigateBack();
- },
- goCamera(e) {
- var url
- if (e.currentTarget.dataset.type == 'front') {
- url = '../camera/camera?type=front&id=' + this.data.current.id + '&status=edit'
- } else {
- url = '../camera/camera?type=back&id=' + this.data.current.id + '&status=edit'
- }
- swan.navigateTo({
- url: url,
- });
- },
- initData() {
- var pages = getCurrentPages()
- this.setData({
- current: pages[pages.length - 2].data.current
- })
- console.log(this.data.current)
- swan.setNavigationBarTitle({
- title: this.data.current.user_name,
- })
- this.data.ui[0].v = this.data.current.user_name
- this.data.ui[1].v = this.data.current.nation
- this.data.ui[2].v = this.data.current.id_card
- this.data.ui[3].v = this.data.current.hk_address
- this.data.ui[4].v = this.data.current.phone
- var phone = app.globalData.userInfo.phone,userPhone=phone,
- card = this.data.current.bank_code
- card = "**** **** **** **** " + card.slice(-4)
- var str1 = phone.slice(0, 3)
- var str2 = phone.substring(11, 7)
- phone = str1 + "****" + str2
- this.setData({
- ui: this.data.ui,
- phone,
- userPhone,
- card
- })
- },
- refreshImg() {
- if (app.idCard.front) {
- var firstImg = app.idCard.front
- }
- if (app.idCard.back) {
- var secondImg = app.idCard.back
- }
- this.setData({
- firstImg,
- secondImg
- })
- },
- previewImg(e) {
- if (e.currentTarget.dataset.id == 'first') {
- swan.previewImage({
- urls: [this.data.firstImg]
- });
- }
- if (e.currentTarget.dataset.id == 'second') {
- swan.previewImage({
- urls: [this.data.secondImg]
- });
- }
- },
- inputAction(e) {
- if (e.currentTarget.dataset.index == 3) {
- this.data.current.hk_address = e.detail.value
- }
- else if (e.currentTarget.dataset.index == 4) {
- this.data.current.phone = e.detail.value
- }
- this.setData({
- current: this.data.current
- })
- if (e.currentTarget.dataset.type == 'checkingNum') {
- this.setData({ code: e.detail.value })
- }
- },
- openCheckingModal() {
- this.setData({
- modalStatus: true
- })
- },
- closeCheckingModal() {
- this.setData({
- modalStatus: false,
- code: ''
- })
- },
- getCode() {
- net.connect({
- url: url.app_host + url.getVerifyCode,
- data: { phone:this.data.userPhone },
- method: "POST",
- })
- var time = 60
- this.setData({ countDown: true })
- var timer1 = setInterval(() => {
- time -= 1
- this.setData({ time: time })
- }, 1000)
- var timer2 = setTimeout(() => {
- this.setData({ countDown: false, time: '60' })
- clearInterval(timer1)
- clearTimeout(timer2)
- }, 60000)
- },
- sendCode() {
- net.connectNeedLogin({
- url: url.app_host + url.getCustomer,
- data: { id: this.data.current.id, verifyCode: this.data.code },
- success: (err, res) => {
- this.data.ui[2].v = res.data.id_card
- this.setData({
- currentDetail: res.data,
- idCardStatus: true,
- ui: this.data.ui
- })
- this.closeCheckingModal()
- },
- fail: (err, res) => {
- businessT.showFailTips(err)
- }
- })
- },
- btnAction() {
- // 6217003800020952846
- if (this.data.current.phone.length != 11) {
- swan.showToast({
- title: '请输入正确的手机号码!',
- icon: 'none',
- mask: true
- });
- } else if (!this.data.current.hk_address) {
- swan.showToast({
- title: '请输入正确的户籍地址!',
- icon: 'none',
- mask: true
- });
- } else {
- this.data.current.id_card_img = this.data.firstImg
- this.data.current.id_card_img1 = this.data.secondImg
- swan.showLoading({
- title: '请稍后...',
- mask: true,
- })
- net.connectNeedLogin({
- url: url.app_host + url.modifyCustomer,
- data: { ...this.data.current },
- success: (err, res) => {
- swan.hideLoading();
- swan.showToast({
- title: '修改成功',
- mask: true
- });
- },
- fail: (err, res) => {
- swan.hideLoading();
- businessT.showFailTips(err)
- }
- }, true)
- }
- },
- goBank() {
- swan.navigateTo({
- url: '../edit-bank/edit-bank?current='+JSON.stringify(this.data.current),
- });
- },
- onLoad: function () {
- this.initData()
- this.setData({ suffix: sysT.suffixOfClass() })
- },
- 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.refreshImg()
- },
- onHide: function () {
- // 监听页面隐藏的生命周期函数
- },
- onUnload: function () {
- // 监听页面卸载的生命周期函数
- app.idCard.front = ''
- app.idCard.back = ''
- },
- onPullDownRefresh: function () {
- // 监听用户下拉动作
- },
- onReachBottom: function () {
- // 页面上拉触底事件的处理函数
- },
- onShareAppMessage: function () {
- // 用户点击右上角转发
- }
- });
|