sunjh %!s(int64=6) %!d(string=hai) anos
pai
achega
66d41158a0

+ 50 - 40
src/components/authen/EnterpriseAuthentication.vue

@@ -15,13 +15,13 @@
             :show-file-list="false"
             :http-request="uploadFile"
             :before-upload="beforeFileUpload">
-            <img v-if="authentication.businessLicense" :src="authentication.businessLicense" class="avatar">
+            <img v-if="authentication.businessLicensePhoto" :src="authentication.businessLicensePhoto" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
           </el-upload>
           <span v-if="!isModifyMode">
           <el-image
             style="width: 100px;"
-            :src="authentication.businessLicense"
+            :src="authentication.businessLicensePhoto"
             fit="scale-down"></el-image>
         </span>
           <!--<div v-if="!isModifyMode">-->
@@ -31,20 +31,20 @@
           <!--</div>-->
         </el-form-item>
         <el-form-item label="公司法人姓名" prop="name">
-          <el-input v-if="isModifyMode" v-model="authentication.enterpriseBossName"></el-input>
-          <span v-if="!isModifyMode">{{authentication.enterpriseBossName}}</span>
+          <el-input v-if="isModifyMode" v-model="authentication.legalPersonName"></el-input>
+          <span v-if="!isModifyMode">{{authentication.legalPersonName}}</span>
         </el-form-item>
         <el-form-item label="对公账户" prop="name">
           <el-input v-if="isModifyMode" v-model="authentication.bankAccount"></el-input>
           <span v-if="!isModifyMode">{{authentication.bankAccount}}</span>
         </el-form-item>
         <el-form-item label="统一社会信用代码" prop="name">
-          <el-input v-if="isModifyMode" v-model="authentication.USCC"></el-input>
-          <span v-if="!isModifyMode">{{authentication.USCC}}</span>
+          <el-input v-if="isModifyMode" v-model="authentication.unifiedSocialCreditCode"></el-input>
+          <span v-if="!isModifyMode">{{authentication.unifiedSocialCreditCode}}</span>
         </el-form-item>
         <el-form-item label="公司地址" prop="name">
-          <el-input v-if="isModifyMode" v-model="authentication.enterpriseAddress"></el-input>
-          <span v-if="!isModifyMode">{{authentication.enterpriseAddress}}</span>
+          <el-input v-if="isModifyMode" v-model="authentication.address"></el-input>
+          <span v-if="!isModifyMode">{{authentication.address}}</span>
         </el-form-item>
 
         <el-form-item v-if="!isModifyMode">
@@ -63,7 +63,7 @@
 import Http from '@/js/http'
 import Apis from '@/js/api'
 import {notify} from '@/constants/index'
-import {defaultValue, getCurrentAuthenInfo, storageGet, updateEnterpriseAuthInfo} from '@/js/index'
+import {defaultValue, getCurrentEnterpriseAuthInfo, storageGet, updateEnterpriseAuthInfo} from '@/js/index'
 
 export default {
   name: 'EnterpriseAuthentication',
@@ -75,11 +75,11 @@ export default {
       loading: false,
       authentication: {
         enterpriseName: '',
-        enterpriseBossName: '',
+        legalPersonName: '',
         bankAccount: '',
-        businessLicense: defaultValue.image,
-        USCC: '',
-        enterpriseAddress: ''
+        businessLicensePhoto: defaultValue.image,
+        unifiedSocialCreditCode: '',
+        address: ''
       },
       rules: {
         // name: [
@@ -116,20 +116,21 @@ export default {
     //加载数据
     getAuthInfo () {
       this.showLoading()
-      getCurrentAuthenInfo().then((res) => {
-        //this.authentication.photo = []
-        this.authentication.businessLicense = res.businessLicensePhoto == null ? defaultValue.image : res.businessLicensePhoto
-        this.authentication.enterpriseName = res.companyName == null ? '暂未填写' : res.companyName
-        this.authentication.enterpriseBossName = res.legalPersonName == null ? '暂未填写' : res.legalPersonName
-        this.authentication.bankAccount = res.bankAccount == null ? '暂未填写' : res.bankAccount
-        this.authentication.USCC = res.unifiedSocialCreditCode == null ? '暂未填写' : res.unifiedSocialCreditCode
-        this.authentication.enterpriseAddress = res.address == null ? '暂未填写' : res.address
-        this.hideLoading()
-        console.log(this.authentication)
-      }).catch((error) => {
-        this.hideLoading()
-        notify('error', '加载认证信息失败:' + error.data)
-      })
+      getCurrentEnterpriseAuthInfo(this.user.userVO.id, this.getAuthInfoSuccess, this.getAuthInfoFail)
+    },
+    getAuthInfoSuccess (res) {
+      this.hideLoading()
+      this.authentication.enterpriseName = res.enterpriseName == null ? '暂未填写' : res.enterpriseName
+      this.authentication.legalPersonName = res.legalPersonName == null ? '暂未填写' : res.legalPersonName
+      this.authentication.businessLicensePhoto = res.businessLicensePhoto == null ? defaultValue.image : res.businessLicensePhoto
+      this.authentication.unifiedSocialCreditCode = res.unifiedSocialCreditCode == null ? '暂未填写' : res.unifiedSocialCreditCode
+      this.authentication.bankAccount = res.bankAccount == null ? '暂未填写' : res.bankAccount
+      this.authentication.address = res.address == null ? '暂未填写' : res.address
+      console.log(this.authentication)
+    },
+    getAuthInfoFail (error) {
+      this.hideLoading()
+      notify('error', '加载认证信息失败:' + error.data)
     },
     //表单进入可编辑状态,可修改表单,不再使用
     modifyInfo () {
@@ -140,22 +141,31 @@ export default {
       //this.isModifyMode = false
       this.showLoading()
       const newAuthentication = {
-        mobile: this.authentication.mobile,
-        evaluationAgencyName: this.authentication.name,
+        userId: this.user.userVO.id,
+        enterpriseName: this.authentication.enterpriseName,
+        legalPersonName: this.authentication.legalPersonName,
+        businessLicensePhoto: this.authentication.businessLicensePhoto,
+        unifiedSocialCreditCode: this.authentication.unifiedSocialCreditCode,
         bankAccount: this.authentication.bankAccount,
         address: this.authentication.address,
-        abilities: this.authentication.ability,
-        resources: this.authentication.resource,
-        agencyPhoto: this.authentication.photoUrl,
       }
-      updateEnterpriseAuthInfo.then((res) => {
-        this.hideLoading()
-        console.log(res)
-        notify('success', '认证信息修改成功')
-      }).catch(error => {
-        this.hideLoading()
-        notify('error', error.data)
-      })
+      updateEnterpriseAuthInfo(this.user.userVO.id, newAuthentication, this.updateAuthInfoSuccess, this.updateAuthInfoFail)
+    },
+    updateAuthInfoSuccess (res) {
+      this.hideLoading()
+      this.cancelModify()
+      console.log(res)
+      this.authentication.enterpriseName = res.enterpriseName == null ? '暂未填写' : res.enterpriseName
+      this.authentication.legalPersonName = res.legalPersonName == null ? '暂未填写' : res.legalPersonName
+      this.authentication.businessLicensePhoto = res.businessLicensePhoto == null ? defaultValue.image : res.businessLicensePhoto
+      this.authentication.unifiedSocialCreditCode = res.unifiedSocialCreditCode == null ? '暂未填写' : res.unifiedSocialCreditCode
+      this.authentication.bankAccount = res.bankAccount == null ? '暂未填写' : res.bankAccount
+      this.authentication.address = res.address == null ? '暂未填写' : res.address
+      notify('success', '认证信息修改成功')
+    },
+    updateAuthInfoFail (error) {
+      this.hideLoading()
+      notify('error', error.data)
     },
     //取消修改表单,表单进入不可编辑状态,不再使用
     cancelModify () {

+ 36 - 24
src/components/authen/EnterpriseAuthenticationCreate.vue

@@ -1,10 +1,10 @@
 <template>
-  <div class="create-container">
+  <div class="create-container" v-loading="loading">
     <div class="create-body">
       <div class="title">企业信息认证</div>
       <el-form :model="authentication" :rules="rules" ref="authentication" label-width="12%" class="demo-report">
         <el-form-item label="公司名" prop="name">
-          <el-input v-if="isModifyMode" v-model="authentication.enterpriseName"></el-input>
+          <el-input size="small" v-if="isModifyMode" v-model="authentication.enterpriseName"></el-input>
           <!--<span v-if="!isModifyMode">{{authentication.name}}</span>-->
         </el-form-item>
         <el-form-item label="公司营业执照" prop="file">
@@ -14,7 +14,7 @@
             :show-file-list="false"
             :http-request="uploadFile"
             :before-upload="beforeFileUpload">
-            <img v-if="authentication.businessLicense" :src="authentication.businessLicense" class="avatar">
+            <img v-if="authentication.businessLicensePhoto" :src="authentication.businessLicensePhoto" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
           </el-upload>
           <!--<div v-if="!isModifyMode">-->
@@ -24,19 +24,19 @@
           <!--</div>-->
         </el-form-item>
         <el-form-item label="公司法人姓名" prop="name">
-          <el-input v-if="isModifyMode" v-model="authentication.enterpriseBossName"></el-input>
+          <el-input size="small" v-if="isModifyMode" v-model="authentication.legalPersonName"></el-input>
           <!--<span v-if="!isModifyMode">{{authentication.name}}</span>-->
         </el-form-item>
         <el-form-item label="对公账户" prop="name">
-          <el-input v-if="isModifyMode" v-model="authentication.bankAccount"></el-input>
+          <el-input size="small" v-if="isModifyMode" v-model="authentication.bankAccount"></el-input>
           <!--<span v-if="!isModifyMode">{{authentication.name}}</span>-->
         </el-form-item>
         <el-form-item label="统一社会信用代码" prop="name">
-          <el-input v-if="isModifyMode" v-model="authentication.USCC"></el-input>
+          <el-input size="small" v-if="isModifyMode" v-model="authentication.unifiedSocialCreditCode"></el-input>
           <!--<span v-if="!isModifyMode">{{authentication.bankAccount}}</span>-->
         </el-form-item>
         <el-form-item label="公司地址" prop="name">
-          <el-input v-if="isModifyMode" v-model="authentication.enterpriseAddress"></el-input>
+          <el-input size="small" v-if="isModifyMode" v-model="authentication.address"></el-input>
           <!--<span v-if="!isModifyMode">{{authentication.address}}</span>-->
         </el-form-item>
 
@@ -57,7 +57,7 @@
 import Http from '@/js/http'
 import Apis from '@/js/api'
 import {notify} from '@/constants/index'
-import {storageGet} from '@/js/index'
+import {storageGet, uploadEnterpriseAuthenticationInfo} from '@/js/index'
 
 export default {
   name: 'EnterpriseAuthenticationCreate',
@@ -66,13 +66,14 @@ export default {
       userId: 0,
       user: {},
       isModifyMode: true,
+      loading: false,
       authentication: {
         enterpriseName: '',
-        enterpriseBossName: '',
+        legalPersonName: '',
         bankAccount: '',
-        businessLicense: '',
-        USCC: '',
-        enterpriseAddress: ''
+        businessLicensePhoto: '',
+        unifiedSocialCreditCode: '',
+        address: ''
       },
       rules: {
         // name: [
@@ -115,21 +116,26 @@ export default {
     //提交认证信息
     submitInfo () {
       //this.isModifyMode = false
+      this.showLoading()
       const newAuthentication = {
-        mobile: this.authentication.mobile,
-        evaluationAgencyName: this.authentication.name,
+        userId: this.user.userVO.id,
+        enterpriseName: this.authentication.enterpriseName,
+        legalPersonName: this.authentication.legalPersonName,
+        businessLicensePhoto: this.authentication.businessLicensePhoto,
+        unifiedSocialCreditCode: this.authentication.unifiedSocialCreditCode,
         bankAccount: this.authentication.bankAccount,
         address: this.authentication.address,
-        abilities: this.authentication.ability,
-        resources: this.authentication.resource,
-        agencyPhoto: this.authentication.photoUrl,
       }
-      Http.post(Apis.USER.SUBMIT_ENTERPRISE_AUTHENTICATION_INFO.replace('{userId}', this.user.userVO.id), newAuthentication).then((res) => {
-        console.log(res)
-        notify('success', '认证信息上传成功')
-      }).catch(error => {
-        notify('error', error.data.msg)
-      })
+      uploadEnterpriseAuthenticationInfo(this.user.userVO.id, newAuthentication, this.submitInfoSuccess, this.submitInfoFail)
+    },
+    submitInfoSuccess (res) {
+      this.hideLoading()
+      console.log(res)
+      notify('success', '认证信息上传成功')
+    },
+    submitInfoFail (error) {
+      this.hideLoading()
+      notify('error', error.data)
     },
     //取消修改表单,表单进入不可编辑状态,不再使用
     cancelModify () {
@@ -164,7 +170,7 @@ export default {
       formData.append('file', param.file)
       Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
         console.log('上传成功')
-        this.authentication.photoUrl = res.data
+        this.authentication.businessLicensePhoto = res.data
         console.log(res.data)
         notify('success', '上传成功')
       }).catch(error => {
@@ -179,6 +185,12 @@ export default {
     test () {
 
     },
+    showLoading () {
+      this.loading = true
+    },
+    hideLoading () {
+      this.loading = false
+    }
   },
 }
 </script>

+ 11 - 8
src/components/authen/IndividualAuthenticationCreate.vue

@@ -60,6 +60,7 @@ import {
   getProvinceCodeByProvinceName,
   getProvinceNameByProvinceCode,
   storageGet,
+  uploadIndividualAuthenticationInfo,
 } from '@/js/index'
 
 export default {
@@ -127,14 +128,16 @@ export default {
         bankAccount: this.authentication.bankAccount,
         address: this.authentication.address
       }
-      Http.post(Apis.USER.SUBMIT_INDIVIDUAL_AUTHENTICATION_INFO.replace('{userId}', this.user.userVO.id), newAuthentication).then((res) => {
-        this.hideLoading()
-        console.log(res)
-        notify('success', '认证信息上传成功')
-      }).catch(error => {
-        this.hideLoading()
-        notify('error', error.data)
-      })
+      uploadIndividualAuthenticationInfo(this.user.userVO.id, newAuthentication, this.submitInfoSuccess, this.submitInfoFail)
+    },
+    submitInfoSuccess (res) {
+      this.hideLoading()
+      console.log(res)
+      notify('success', '认证信息上传成功')
+    },
+    submitInfoFail (error) {
+      this.hideLoading()
+      notify('error', error.data)
     },
     //取消修改表单,表单进入不可编辑状态,不再使用
     cancelModify () {

+ 3 - 2
src/js/api.js

@@ -47,12 +47,13 @@ export default {
     GET_AUTH_URLS: '',
     LOGOUT: '/api/common/logout',
     SUBMIT_INDIVIDUAL_AUTHENTICATION_INFO: '/api/user/{userId}/personalAuth/',
-    SUBMIT_ENTERPRISE_AUTHENTICATION_INFO: '/api/user/{userId}/enterprise/',
+    SUBMIT_ENTERPRISE_AUTHENTICATION_INFO: '/api/user/{userId}/enterpriseAuth',
     SUBMIT_AGENCY_AUTHENTICATION_INFO: '/api/user/{userId}/agency/',
     UPDATE_INDIVIDUAL_AUTHENTICATION_INFO: '/api/user/{userId}/personalAuth',
-    UPDATE_ENTERPRISE_AUTHENTICATION_INFO: '/api/user/{userId}/enterprise/',
+    UPDATE_ENTERPRISE_AUTHENTICATION_INFO: '/api/user/{userId}/enterpriseAuth',
     UPDATE_AGENCY_AUTHENTICATION_INFO: '/api/user/{userId}/agency/',
     GET_INDIVIDUAL_AUTHENTICATION_INFO: '/api/user/{userId}/personalAuth',
+    GET_ENTERPRISE_AUTHENTICATION_INFO: '/api/user/{userId}/enterpriseAuth',
   },
   PAGE: {
     HOME_PAGE: '/api/common/index/',

+ 3 - 1
src/js/index.js

@@ -13,6 +13,7 @@ import {
   uploadAgencyAuthenticationInfo,
   uploadEnterpriseAuthenticationInfo,
   uploadIndividualAuthenticationInfo,
+  getCurrentEnterpriseAuthInfo,
 } from './userService'
 import {
   createProject,
@@ -92,7 +93,8 @@ export {
   uploadEnterpriseAuthenticationInfo,
   //TODO 尚未使用 代码未实现 上传个人认证信息
   uploadIndividualAuthenticationInfo,
-  getCurrentIndividualAuthenInfo
+  getCurrentIndividualAuthenInfo,
+  getCurrentEnterpriseAuthInfo
 }
 export {
   /*******************************************************************************/

+ 26 - 6
src/js/userService.js

@@ -79,13 +79,21 @@ export const getAuthUrls = () => {
 }
 
 //上传个人认证信息
-export const uploadIndividualAuthenticationInfo = () => {
-  Http.post(Apis)
+export const uploadIndividualAuthenticationInfo = (userId, userAuthInfo, uploadIndividualAuthenticationInfoSuccess, uploadIndividualAuthenticationInfoFail) => {
+  Http.post(Apis.USER.SUBMIT_INDIVIDUAL_AUTHENTICATION_INFO.replace('{userId}', userId), userAuthInfo).then((res) => {
+    uploadIndividualAuthenticationInfoSuccess(res)
+  }).catch(error => {
+    uploadIndividualAuthenticationInfoFail(error)
+  })
 }
 
 //上传企业认证信息
-export const uploadEnterpriseAuthenticationInfo = () => {
-
+export const uploadEnterpriseAuthenticationInfo = (userId, userAuthInfo, uploadEnterpriseAuthenticationInfoSuccess, uploadEnterpriseAuthenticationInfoFail) => {
+  Http.post(Apis.USER.SUBMIT_ENTERPRISE_AUTHENTICATION_INFO.replace('{userId}', userId), userAuthInfo).then((res) => {
+    uploadEnterpriseAuthenticationInfoSuccess(res)
+  }).catch(error => {
+    uploadEnterpriseAuthenticationInfoFail(error)
+  })
 }
 
 //上传机构认证信息
@@ -110,6 +118,14 @@ export const getCurrentIndividualAuthenInfo = (userId, getCurrentIndividualAuthe
   })
 }
 
+export const getCurrentEnterpriseAuthInfo = (userId, getCurrentEnterpriseAuthInfoSuccess, getCurrentEnterpriseAuthInfoFail) => {
+  Http.get(Apis.USER.GET_ENTERPRISE_AUTHENTICATION_INFO.replace('{userId}', userId)).then((res) => {
+    getCurrentEnterpriseAuthInfoSuccess(res)
+  }).catch((error) => {
+    getCurrentEnterpriseAuthInfoFail(error)
+  })
+}
+
 export const getCurrentAuthenInfo = () => {
   const individualData = {
     type: '个人',//企业、机构、个人
@@ -205,10 +221,14 @@ export const updateAgencyAuthInfo = (userId, authInfo) => {
   // })
   return Http.put(Apis.USER.UPDATE_AGENCY_AUTHENTICATION_INFO.replace('{userId}', userId), authInfo)
 }
-export const updateEnterpriseAuthInfo = (userId, authInfo) => {
+export const updateEnterpriseAuthInfo = (userId, authInfo, updateEnterpriseAuthInfoSuccess, updateEnterpriseAuthInfoFail) => {
   // const data = {}
   // return new Promise((resolve) => {
   //   resolve(data)
   // })
-  return Http.put(Apis.USER.UPDATE_ENTERPRISE_AUTHENTICATION_INFO.replace('{userId}', userId), authInfo)
+  Http.put(Apis.USER.UPDATE_ENTERPRISE_AUTHENTICATION_INFO.replace('{userId}', userId), authInfo).then((res) => {
+    updateEnterpriseAuthInfoSuccess(res)
+  }).catch((error) => {
+    updateEnterpriseAuthInfoFail(error)
+  })
 }