幼教产品B2B生态平台小程序端
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.

235 lines
6.7 KiB

12 months ago
<template>
<view class="page">
11 months ago
<view class="block">
<view class="title">上传营业执照</view>
11 months ago
<image class="credential" :src="businessLicensePicture || 'http://124.71.79.122/images/miniProgram/credentials1.png'" mode="widthFix" @click="uploadBusinessLicense"></image>
11 months ago
</view>
<view v-if="isPreschool" class="block">
<view class="title">上传办学许可证</view>
11 months ago
<image class="credential" :src="licenseForRunningSchool || 'http://124.71.79.122/images/miniProgram/credentials2.png'" mode="widthFix" @click="uploadSchoolLicense"></image>
11 months ago
</view>
12 months ago
<view class="block">
<view class="form-list">
<view class="line with-arrow">
11 months ago
<view class="name">{{ isPreschool ? '幼儿园' : '企业' }}名称</view>
<input type="text" :placeholder="'请输入' + platformName + '名称'" v-model="form.companyName" />
12 months ago
<uni-icons type="right" size="18" color="#ababab"></uni-icons>
12 months ago
</view>
<view class="line with-arrow">
<view class="name">统一社会信用代码</view>
11 months ago
<input type="text" placeholder="请输入证件号码" v-model="form.creditCode" />
12 months ago
<uni-icons type="right" size="18" color="#ababab"></uni-icons>
12 months ago
</view>
<view class="line with-arrow">
<view class="name">法人</view>
11 months ago
<input type="text" placeholder="请输入法人" v-model="form.legalPerson" />
12 months ago
<uni-icons type="right" size="18" color="#ababab"></uni-icons>
12 months ago
</view>
</view>
</view>
<view class="btn-wrap">
<view class="btn" @click="submit">认证信息</view>
</view>
</view>
</template>
<script>
11 months ago
import { enterpriseCertificationStatus, creditCodeAuthentication, businessLicensePictureVerification, updateTeamInfo, organizationCertification, kindergartenWeChatApplication } from '@/apis/modules/user.js'
12 months ago
import OSS from '@/libs/Oss/upload'
export default {
data() {
return {
11 months ago
openId: uni.getStorageSync('openId'),
11 months ago
form: {
11 months ago
companyName: '',
11 months ago
creditCode: '',
legalPerson: '',
},
11 months ago
platformId: '',
businessLicensePicture: '',
11 months ago
licenseForRunningSchool: '',
12 months ago
}
},
11 months ago
computed: {
// 幼儿园
isPreschool() {
11 months ago
return this.platformId == 5
11 months ago
},
// 平台名字
platformName() {
11 months ago
return this.platformId == 6 ? '供应商' : this.platformId == 5 ? '幼儿园' : ''
11 months ago
},
},
12 months ago
onShow() {
11 months ago
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
this.platformId = +options.platformId
11 months ago
this.getEnterInfo()
12 months ago
},
methods: {
11 months ago
// 企业认证信息
async getEnterInfo() {
const res = await enterpriseCertificationStatus(this.openId)
if (res.data) {
const { data } = res
this.businessLicensePicture = data.businessLicensePicture || ''
this.licenseForRunningSchool = data.licenseForRunningSchool || ''
this.form.companyName = data.companyName || ''
this.form.creditCode = data.creditCode || ''
this.form.legalPerson = data.legalPerson || ''
11 months ago
this.form.address = data.address || ''
this.form.business = data.business || ''
this.form.capital = data.capital || ''
this.form.establishDate = data.establishDate || ''
this.form.type = data.type || ''
this.form.validPeriod = data.validPeriod || ''
this.form.platformSource = this.platformId
11 months ago
}
},
12 months ago
// 上传营业执照
11 months ago
uploadBusinessLicense() {
const that = this
uni.chooseImage({
success: (res) => {
const file = res.tempFilePaths[0];
11 months ago
OSS(file, async ({ url }) => {
that.businessLicensePicture = url
const { data } = await businessLicensePictureVerification(url)
11 months ago
if (data) {
that.form = {
11 months ago
companyName: data.name,
11 months ago
creditCode: data.reg_num,
legalPerson: data.person,
address: data.address,
business: data.business,
capital: data.capital,
11 months ago
establishDate: data.establish_date,
11 months ago
type: data.type,
11 months ago
validPeriod: data.valid_period,
11 months ago
platformSource: this.platformId,
11 months ago
}
}
})
}
});
},
// 上传办学许可证
11 months ago
uploadSchoolLicense() {
12 months ago
const that = this
uni.chooseImage({
12 months ago
success: (res) => {
const file = res.tempFilePaths[0];
11 months ago
OSS(file, async ({ url }) => {
that.licenseForRunningSchool = url
12 months ago
})
}
});
},
11 months ago
// 消息推送授权
publicNotice() {
const that = this
uni.requestSubscribeMessage({
tmplIds: ['ZB6wTenlv13mivxXwi-DWwjgVoNJ6eUr1vBvNdQGbJw'],
success: (res) => {
11 months ago
uni.setStorageSync('platformId', that.platformId)
const name = that.platformId == 6 ? '供应商' : '幼儿园'
10 months ago
that.$util.errMsg(`您已成功提交${name}认证,现在为您切换到${name}端。`)
11 months ago
setTimeout(() => {
11 months ago
uni.switchTab({
url: '/pages/person/person'
})
10 months ago
}, 2000)
11 months ago
},
fail: function(err) {
uni.showToast({
title: err,
duration: 2000,
icon: 'error'
});
}
})
},
// 提交
11 months ago
async submit() {
if (this.submiting) return false
11 months ago
const { form } = this
11 months ago
if (!form.companyName) return this.$util.errMsg(`请输入${platformName}名称!`)
11 months ago
if (!form.creditCode) return this.$util.errMsg('请输入统一社会信用代码!')
if (!form.legalPerson) return this.$util.errMsg('请输入法人!')
11 months ago
this.submiting = true
uni.showLoading({
title: '提交中'
})
11 months ago
const data = {
11 months ago
...form,
11 months ago
auditStatus: 1,
authenticationStatus: 1,
11 months ago
businessLicensePicture: this.businessLicensePicture,
licenseForRunningSchool: this.licenseForRunningSchool,
11 months ago
openId: this.openId
}
try {
// 个人
if (uni.getStorageSync('platformId') === 7) {
// 个人认证企业后新增一个企业角色
const res = await kindergartenWeChatApplication({
openId: this.openId,
platformId: this.platformId,
organizationName: form.companyName
})
data.accountId = res.data.registerId
await organizationCertification(data)
} else { // 幼儿园/供应商
await creditCodeAuthentication(data)
// 企业认证后要修改组织名字
await updateTeamInfo({
id: uni.getStorageSync('teamId'),
classificationName: form.companyName
11 months ago
})
11 months ago
}
11 months ago
uni.hideLoading()
this.publicNotice()
11 months ago
} catch(e) {
10 months ago
setTimeout(() => {
uni.hideLoading()
}, 1500)
11 months ago
this.submiting = false
}
12 months ago
},
}
}
</script>
<style scoped lang="scss">
.page {
padding-bottom: 170rpx;
-webkit-overflow-scrolling: touch;
}
.avatar {
width: 80rpx;
height: 80rpx;
border: 0;
border-radius: 50%;
}
.block {
padding: 24rpx;
}
.title {
margin-bottom: 20rpx;
font-size: 28rpx;
}
.credential {
width: 100%;
}
12 months ago
.form-list {
.name {
min-width: 250rpx;
}
}
12 months ago
</style>