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.

353 lines
8.9 KiB

3 years ago
// pages/release/companyAuth/index.js
3 years ago
const util = require('../../../utils/util.js')
const app = getApp()
3 years ago
Page({
/**
* 页面的初始数据
*/
data: {
3 years ago
form: {
isLegalPerson: 0, //是否为企业法人
authorizationPath: '', // 授权书图片
enterpriseName: '', //企业名称
creditCode: '', //信用代码
3 years ago
industryId: '', //所在行业
3 years ago
enterpriseScale: '请选择', //企业规模
businessLicense: '', //营业执照照片
bankAccount: '', //银行账号
bankName: '', // 开户银行
bankBranch: '', // 开户网点
legalPersonName: '', //法人姓名
legalPhone: '', //法人手机号
legalPersonIdcard: '', // 法人身份证
idcardPicFront: '',// 法人身份证正面照
idcardPicBehind: '',// 法人身份证背面照
idcardPicHold: '',// 法人手持身份证
},
3 years ago
isEdit: false,
3 years ago
scaleArr: ['0-25','25-99','99-200','200-500','500及以上']
3 years ago
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
3 years ago
this.getResourcesCagetory()
3 years ago
if(options.authInfo){
let authInfo = JSON.parse(decodeURIComponent(options.authInfo));
this.setData({
isEdit: true,
['form.isLegalPerson']: 0, //是否为企业法人
['form.authorizationPath']: authInfo.authorizationPath || '', // 授权书图片
['form.enterpriseName']: authInfo.enterpriseName, //企业名称
['form.creditCode']: authInfo.creditCode, //信用代码
['form.enterpriseScale']: authInfo.enterpriseScale || '请选择', //企业规模
['form.businessLicense']: authInfo.businessLicense || '', //营业执照照片
['form.bankAccount']: authInfo.bankAccount || '', //银行账号
['form.bankName']: authInfo.bankName ||'', // 开户银行
['form.bankBranch']: authInfo.bankBranch ||'', // 开户网点
['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.enterpriseId']: authInfo.enterpriseId,
['form.id']: authInfo.id,
['form.authorizationType']: 1
})
}
3 years ago
},
3 years ago
//获取供应、需求类型
getResourcesCagetory(){
app.http('GET','ResourcesCagetory/listResourcesCagetory').then((res)=>{
// console.log(res)
if(res.data.success){
this.setData({
resourcesList: res.data.data
})
}
})
},
//选择行业
toProfession(){
wx.navigateTo({
url: '/pages/user/profession/index',
})
},
3 years ago
checkBank(e){
3 years ago
// console.log(e.detail.value)
3 years ago
app.http('get','EnterpriseAuthentication/getBankName',{bankAccount: e.detail.value}).then((res)=>{
if(res.data.success){
this.setData({
['form.bankName']: res.data.data
})
}
})
},
inpChange(e){
let type = e.currentTarget.dataset.type
let value = e.detail.value
switch (type){
case 'enterpriseName':
this.setData({
['form.enterpriseName']: value
})
break;
case 'creditCode':
this.setData({
['form.creditCode']: value
})
break;
case 'bankAccount':
this.setData({
['form.bankAccount']: value
})
break;
case 'bankName':
this.setData({
['form.bankName']: value
})
break;
case 'bankBranch':
this.setData({
['form.bankBranch']: value
})
break;
case 'name':
this.setData({
['form.legalPersonName']: value
})
break;
case 'phone':
this.setData({
['form.legalPhone']: value
})
break;
case 'idcard':
this.setData({
['form.legalPersonIdcard']: value
})
break;
}
},
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 if(type == 'h'){
this.setData({
['form.idcardPicHold']: img
})
} else if(type == 'ap'){
this.setData({
['form.authorizationPath']: img
})
} else if(type == 'bl'){
this.setData({
['form.businessLicense']: img
})
}
})
},
bindPickerChange(e){
3 years ago
this.setData({
3 years ago
['form.enterpriseScale']: this.data.scaleArr[e.detail.value]
3 years ago
})
},
3 years ago
radioClick(e){
this.setData({
['form.isLegalPerson']: e.detail.value
})
},
prevImg(e){
// let url = e.currentTarget.dataset.url;
// wx.previewImage({
// urls: [url],
// })
},
submit(){
let form = this.data.form
3 years ago
console.log(form)
3 years ago
if(form.isLegalPerson == 0 && form.authorizationPath == ''){
wx.showToast({
title: '请上传授权书!',
icon: 'none'
})
return
} else if(form.enterpriseName == ''){
wx.showToast({
title: '请填写企业名称',
icon: 'none'
})
return
} else if(form.creditCode == ''){
wx.showToast({
title: '请填写信用代码',
icon: 'none'
})
return
} else if(form.enterpriseScale == '请选择'){
wx.showToast({
title: '请选择企业规模',
icon: 'none'
})
return
} else if(form.businessLicense == ''){
wx.showToast({
title: '请上传营业执照',
icon: 'none'
})
return
} else if(form.bankAccount == ''){
wx.showToast({
title: '请输入银行账号',
icon: 'none'
})
return
} else if(form.bankName == ''){
wx.showToast({
title: '请输入银行名称',
icon: 'none'
})
return
} else if(form.bankName == ''){
wx.showToast({
title: '请输入开户网点',
icon: 'none'
})
return
} else 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{
3 years ago
if(!this.data.isEdit){
app.http('post','EnterpriseAuthentication/createAuthenticInfoTwo',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'
})
}
})
}
3 years ago
}
},
3 years ago
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
3 years ago
console.log('232322')
3 years ago
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})