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.
 
 
 
 

204 lines
4.5 KiB

// pages/release/personAuth/index.js
const util = require('../../../utils/util.js')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
form: {
legalPersonName: '',
legalPhone: '',
legalPersonIdcard: '',
idcardPicFront: '',
idcardPicBehind: '',
idcardPicHold: ''
},
isEdit: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.authInfo){
let authInfo = JSON.parse(decodeURIComponent(options.authInfo));
this.setData({
isEdit: true,
['form.legalPersonName']: authInfo.legalPersonName,
['form.legalPhone']: authInfo.legalPhone || '',
['form.legalPersonIdcard']: authInfo.legalPersonIdcard,
['form.idcardPicFront']: authInfo.idcardPicFront,
['form.idcardPicBehind']: authInfo.idcardPicBehind,
['form.idcardPicHold']: authInfo.idcardPicHold,
['form.id']: authInfo.id,
['form.authorizationType']: 2
})
}
},
inpChange(e){
let type = e.currentTarget.dataset.type
let value = e.detail.value
if(type == 'name'){
this.setData({
['form.legalPersonName']: value
})
} else if(type == 'phone'){
this.setData({
['form.legalPhone']: value
})
} else if(type == 'idcard'){
this.setData({
['form.legalPersonIdcard']: value
})
}
},
upCard(e){
let type = e.currentTarget.dataset.type;
util.chooseImages(img => {
if(type == 'f'){
this.setData({
['form.idcardPicFront']: img
})
} else if(type == 'b'){
this.setData({
['form.idcardPicBehind']: img
})
} else{
this.setData({
['form.idcardPicHold']: img
})
}
});
},
submit(){
let form = this.data.form;
if(form.legalPersonName == ''){
wx.showToast({
title: '请填写姓名',
icon: 'none'
})
return
} else if(form.legalPhone == ''){
wx.showToast({
title: '请填写手机号',
icon: 'none'
})
return
} else if(form.legalPersonIdcard == ''){
wx.showToast({
title: '请填写身份证号',
icon: 'none'
})
return
} else if(form.idcardPicFront == ''){
wx.showToast({
title: '请上传身份证正面照',
icon: 'none'
})
return
} else if(form.idcardPicBehind == ''){
wx.showToast({
title: '请上传身份证反面面照',
icon: 'none'
})
return
} else if(form.idcardPicHold == ''){
wx.showToast({
title: '请上传手持身份证照',
icon: 'none'
})
return
} else{
if(this.data.isEdit == false){
app.http('post','EnterpriseAuthentication/createAuthenticInfoOne',this.data.form).then((res)=>{
if(res.data.success){
wx.showModal({
title: '提示!',
content: '提交成功!请等待审核',
success(res) {
wx.switchTab({
url: '/pages/index/index',
})
}
})
} else{
wx.showToast({
title: res.data.msg,
icon: 'none'
})
}
})
} else{
app.http('post','EnterpriseAuthentication/editAuthenticInfo',this.data.form).then((res)=>{
if(res.data.success){
wx.showModal({
title: '提示!',
content: '提交成功!请等待审核',
success(res) {
wx.switchTab({
url: '/pages/index/index',
})
}
})
} else{
wx.showToast({
title: res.data.msg,
icon: 'none'
})
}
})
}
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})