Files
barter-app/pages/company/approve.vue
2021-08-24 08:53:35 +08:00

260 lines
6.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content">
<view class="header">
<view class="title">企业认证</view>
<view class="subtitle">请如实填写认证信息快速审核开店</view>
</view>
<view class="white-box">
<view class="inputs logo">
<label>企业LOGO</label>
<image class="logo-cover" :src="logo || require('@/static/icons/add-icon.png')" @click="updImg('logo')" mode="aspectFill"></image>
</view>
<view class="inputs">
<label>企业名称</label>
<input type="text" v-model="name" placeholder="输入企业名称" />
</view>
<view class="inputs">
<label>企业类型</label>
<picker v-if="type.length > 0" :range="type" :value="typeIndex" range-key="name" @change="changePicker" data-type="type">
<view class="picker-text nowrap">
{{type[typeIndex].name}}
<uni-icons class="picker-icon" type="arrowdown"></uni-icons>
</view>
</picker>
</view>
<view class="inputs">
<label>企业行业</label>
<picker v-if="industry.length > 0" :range="industry" :value="industryIndex" range-key="title" @change="changePicker" data-type="industry">
<view class="picker-text nowrap">
{{industry[industryIndex].title}}
<uni-icons class="picker-icon" type="arrowdown"></uni-icons>
</view>
</picker>
</view>
<view class="inputs">
<label>法人姓名</label>
<input type="text" v-model="corporate" placeholder="输入法人姓名" />
</view>
<view class="inputs">
<label>法人身份证</label>
<input type="text" v-model="identity" placeholder="输入法人身份证" />
</view>
<view class="inputs">
<label>机构代码</label>
<input type="text" v-model="org" placeholder="输入企业组织机构代码" />
</view>
<view class="inputs logo">
<label>营业执照</label>
<image class="license-cover" :src="license || require('@/static/icons/add-icon.png')" @click="updImg('license')" mode="aspectFill"></image>
</view>
<view class="btns">
<button type="default" size="default" @click="submitApplies">提交认证</button>
</view>
</view>
</view>
</template>
<script>
import { appliesCreate, applies, appliesInfo } from '@/apis/interfaces/company'
import { uploads } from '@/apis/interfaces/uploading'
export default {
data() {
return {
formType : "",
name : "",
corporate : "",
identity : "",
org : "",
logo : "",
license : "",
type : [],
industry : [],
typeIndex : 0,
industryIndex: 0,
reason : ''
};
},
created(){
appliesCreate().then(res=>{
console.log(res)
this.industry = res.industries
this.type = res.type
this.formType = this.$Route.query.formType
this.name = res.info.name
this.typeIndex = res.type.findIndex(val => val.id === res.info.type.id) || 0
this.industryIndex = res.industries.findIndex(val => val.industry_id === res.info.industry.industry_id) || 0
if(this.formType === 'put'){
appliesInfo().then(formValue => {
this.corporate = formValue.certification.name
this.identity = formValue.certification.idcard
this.org = formValue.certification.code
this.logo = formValue.cover
this.license = formValue.certification.license
}).catch(valueErr => {
console.log(valueErr)
})
}
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods:{
// 提交信息
submitApplies(){
let method = this.formType === 'put' ? 'PUT' : 'POST'
applies({
name : this.name,
cover : this.logo,
license : this.license,
user_name : this.corporate,
id_card : this.identity,
code : this.org,
type : this.type[this.typeIndex].id,
industry_id : this.industry[this.industryIndex].industry_id,
}, method).then(res => {
uni.showModal({
title : '提示',
content : '您的企业认证信息已提交审核需3-7个工作日请耐心等待',
showCancel : false,
confirmText : '确认',
success : resModal => {
this.$Router.back()
}
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 选择器
changePicker(e){
let changeType = e.target.dataset.type,
changeVlae = e.detail.value
switch(changeType){
case 'type':
this.typeIndex = changeVlae
break
case 'industry':
this.industryIndex = changeVlae
break
}
},
// 上传图片
updImg(type){
uni.chooseImage({
count : 1,
success : choose => {
let paths = choose.tempFilePaths
uploading(paths).then(res => {
this[type] = res.url
console.log(this[type])
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
// 内容
.content{
.header{
height: 15vh;
padding-bottom: $padding * 2;
box-sizing: border-box;
@extend .vertical;
.title{
text-align: center;
font-size: $title-size + 14;
font-weight: bold;
line-height: 90rpx;
}
.subtitle{
font-size: $title-size-m;
color: $text-gray;
text-align: center;
}
}
.white-box{
background-color: white;
border-radius: $radius $radius 0 0;
min-height: 85vh;
padding: $padding $padding * 2 $padding * 2;
box-sizing: border-box;
.inputs{
position: relative;
margin-top: $margin;
background: white;
border-bottom: solid 1rpx $border-color;
padding-left: 200rpx;
line-height: 90rpx;
min-height: 90rpx;
label{
position: absolute;
top: 0;
left: 0;
width: 200rpx;
font-size: $title-size;
}
input{
height: 90rpx;
line-height: 90rpx;
font-size: $title-size;
}
.picker-text{
position: relative;
padding-right: 90rpx;
.picker-icon{
position: absolute;
right: 0;
top: 0;
}
}
}
.logo{
min-height: 98rpx;
padding-bottom: $padding;
.logo-cover{
position: absolute;
right: 0;
top: 0;
width: 98rpx;
height: 98rpx;
background: $border-color-lg;
border-radius: 50%;
}
.license-cover{
@extend .logo-cover;
border-radius: 0;
width: 131rpx;
}
}
.btns{
padding-top: $padding * 2;
button{
background: $text-price;
border-radius: 0;
height: 90rpx;
line-height: 90rpx;
font-size: $title-size;
color: white;
font-weight: bold;
&::after{
border: none;
}
}
}
}
}
</style>