You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.2 KiB
80 lines
2.2 KiB
// pages/home/authory/index.js
|
|
const request = require('../../../utils/request'); //导入模块
|
|
const util = require('../../../utils/util')
|
|
const event = require('../../../utils/event');
|
|
const app = getApp()
|
|
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
form: { identityAuthToken: null },
|
|
typeList: [{text: '身份证', value: 1}, {text: '身份证', value: 2}],
|
|
disable: true, // 是否不可以编辑, false:可编辑;true:不可编辑
|
|
auth: false
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
// this.pickerView = this.pickerView || this.selectComponent('#picker-view')
|
|
const that = this
|
|
wx.getStorage({
|
|
key: 'identityAuthToken',
|
|
success (res) {
|
|
that.setData({ form: JSON.parse(res.data)})
|
|
}
|
|
})
|
|
},
|
|
showPicker: function (e) {
|
|
if (this.data.flag) {
|
|
return
|
|
}
|
|
this.pickerView.showPicker(this.data.typeList, null, 1)
|
|
},
|
|
onPickerChange: function (e) {
|
|
if (!e.detail) {
|
|
return
|
|
}
|
|
if (e.detail.type == 1) {
|
|
this.setData({ ['form.bankName']: e.detail.text, ['form.bankId']: Number(e.detail.value) })
|
|
}
|
|
},
|
|
bindForm: function (e) {
|
|
// var form_data = 'form.' + e.target.id
|
|
this.data.form[e.target.id] = e.detail.value
|
|
},
|
|
submitForm: function(){
|
|
// /front/customer/personalAuth 个人会员认证
|
|
wx.showLoading({ title: '处理中', mask: true })
|
|
this.data.form.identityAuthToken = this.data.form.token
|
|
request.post('/recycle-service/identity-auth/identify/identity', this.data.form).then(res => {
|
|
wx.hideLoading()
|
|
app.globalData.userInfo.isAuth = 1
|
|
this.data.auth = true
|
|
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
|
|
this.wuxDialog.open({
|
|
resetOnClose: true,
|
|
title: '温馨提示',
|
|
maskClosable: false,
|
|
content: '个人信息认证成功',
|
|
buttons: [ {
|
|
text: '确定',
|
|
type: 'primary',
|
|
onTap(e) {
|
|
wx.navigateBack()
|
|
}
|
|
}]
|
|
})
|
|
}).catch(error => {
|
|
wx.hideLoading()
|
|
util.showToast(error)
|
|
})
|
|
},
|
|
onUnload: function () {
|
|
if(this.data.auth){
|
|
event.emit('EventMessage', { what: 82, desc: 'Auth Success' })
|
|
}
|
|
}
|
|
})
|