EnterpriseAuth.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <div class="right-modifyPsw">
  3. <div class="right-modifyPsw-title">
  4. <span style="font-size: 18px;font-weight: bold">企业认证</span>
  5. <el-tag :type="authStatus.style" v-if="authType===1">{{authStatus.text}}</el-tag>
  6. <el-tag type="danger" v-if="authType===0">未认证</el-tag>
  7. <!-- <el-button type="primary" class="pull-right" size="small" v-if="canEdit" @click="canEdit = true">编辑</el-button>-->
  8. </div>
  9. <el-steps :active="active" process-status="finish" style="width: 400px;margin: 0 auto;margin-bottom: 20px;">
  10. <el-step title="上传企业信息"></el-step>
  11. <el-step title="上传法人信息"></el-step>
  12. <!-- <el-step title="确认信息"></el-step>-->
  13. <!-- <el-step title="认证结果"></el-step>-->
  14. </el-steps>
  15. <el-alert
  16. v-if="failureReason&&failureReason!==''"
  17. :title="failureReason"
  18. type="error">
  19. </el-alert>
  20. <div class="upload-wrapper" v-if="active===0" style="margin-top: 10px">
  21. <el-row class="agency-form-item">
  22. <el-col :span="3">企业logo:</el-col>
  23. <el-col :span="12">
  24. <el-upload
  25. class="avatar-uploader"
  26. style="border: lightgrey 1px solid"
  27. action="https://jsonplaceholder.typicode.com/posts/"
  28. :before-upload="beforeFileUpload"
  29. :http-request="uploadFile"
  30. :data="{type:3}"
  31. :disabled="!canEdit"
  32. >
  33. <img v-if="enterpriseForm.agencyPhoto" :src="enterpriseForm.agencyPhoto" class="avatar">
  34. </el-upload>
  35. </el-col>
  36. </el-row>
  37. <el-row class="agency-form-item">
  38. <el-col :span="3">企业名称:</el-col>
  39. <el-col :span="12">
  40. <el-input :disabled="!canEdit" v-model="enterpriseForm.evaluationAgencyName" placeholder="企业名称"></el-input>
  41. </el-col>
  42. </el-row>
  43. <el-row class="agency-form-item">
  44. <div>营业执照:</div>
  45. <el-col :span="8">
  46. <div class="uploader-businessLicensePhoto">
  47. <el-upload
  48. class="avatar-uploader idcard-uploader"
  49. style="border: lightgrey 1px solid"
  50. action="https://jsonplaceholder.typicode.com/posts/"
  51. :before-upload="beforeFileUpload"
  52. :http-request="uploadFile"
  53. :data="{type:2}"
  54. :disabled="!canEdit"
  55. >
  56. <img :src="enterpriseForm.businessLicensePhoto" class="avatar">
  57. </el-upload>
  58. <div><span style="color: red">*</span>营业执照:(仅支持三证合一)</div>
  59. </div>
  60. </el-col>
  61. <el-col :span="16">
  62. <div class="authentication-detail">
  63. <div class="authentication-detail-title">证件要求</div>
  64. <ul class="authentication-detail-list">
  65. <li>必须为清晰、完整的彩色原件扫描件或数码照</li>
  66. <li>仅支持.jpg .bmp .png .gif的图片格式,图片大小不超过4M</li>
  67. <li>必须在有效期内且年检章齐全(当年成立的公司可无年检章)</li>
  68. <li>必须为中国大陆工商局颁发</li>
  69. </ul>
  70. </div>
  71. </el-col>
  72. </el-row>
  73. </div>
  74. <div class="legal-person-wrapper" v-if="active===1">
  75. <el-form ref="enterpriseForm" :model="enterpriseForm" label-width="120px" style="width: 70%">
  76. <el-form-item label="法人姓名">
  77. <el-input :disabled="!canEdit" v-model="enterpriseForm.legalPersonName" placeholder="请输入您的姓名,需与身份证保持一致"></el-input>
  78. </el-form-item>
  79. <el-form-item label="身份证号码">
  80. <el-input :disabled="!canEdit" v-model="enterpriseForm.idCardNum" placeholder="身份证前后不能有空格"></el-input>
  81. </el-form-item>
  82. <el-form-item label="性别">
  83. <el-radio-group v-model="enterpriseForm.gender" :disabled="!canEdit">
  84. <el-radio label="男"></el-radio>
  85. <el-radio label="女"></el-radio>
  86. </el-radio-group>
  87. </el-form-item>
  88. <el-form-item label="身份证到期时间">
  89. <el-date-picker
  90. v-model="enterpriseForm.idCardDeadTime"
  91. style="width: 100%"
  92. align="right"
  93. type="date"
  94. placeholder="请按身份证背面“有效期限”如实填写"
  95. :disabled="!canEdit"
  96. >
  97. </el-date-picker>
  98. </el-form-item>
  99. <el-form-item label="家庭或单位地址">
  100. <el-input :disabled="!canEdit" v-model="enterpriseForm.address"></el-input>
  101. </el-form-item>
  102. <el-form-item label="认证权限">
  103. <el-checkbox-group v-model="enterpriseForm.roleList" :disabled="!canEdit">
  104. <el-checkbox :label="0">发任务</el-checkbox>
  105. <el-checkbox :label="1">接任务</el-checkbox>
  106. </el-checkbox-group>
  107. </el-form-item>
  108. </el-form>
  109. <div class="upload-wrapper">
  110. <el-row style="width: 100%">
  111. <el-col :span="9" style="padding-left: 30px">
  112. <div style="height:50%">
  113. <el-upload
  114. class="avatar-uploader idcard-uploader"
  115. style="border: lightgrey 1px solid"
  116. action="https://jsonplaceholder.typicode.com/posts/"
  117. :before-upload="beforeFileUpload"
  118. :http-request="uploadFile"
  119. :data="{type:0}"
  120. :disabled="!canEdit"
  121. >
  122. <img v-if="enterpriseForm.idCardPositivePhoto" :src="enterpriseForm.idCardPositivePhoto" class="avatar">
  123. </el-upload>
  124. <div style="text-align: center">身份证正面照</div>
  125. </div>
  126. <div style="width: 280px;margin-top: 50px">
  127. <el-upload
  128. class="avatar-uploader idcard-uploader"
  129. style="border: lightgrey 1px solid"
  130. action="https://jsonplaceholder.typicode.com/posts/"
  131. :before-upload="beforeFileUpload"
  132. :http-request="uploadFile"
  133. :data="{type:1}"
  134. :disabled="!canEdit"
  135. >
  136. <img v-if="enterpriseForm.idCardBackPhoto" :src="enterpriseForm.idCardBackPhoto" class="avatar">
  137. </el-upload>
  138. <div style="text-align: center">身份证反面照</div>
  139. </div>
  140. </el-col>
  141. <el-col :span="15">
  142. <div class="authentication-detail">
  143. <div class="authentication-detail-title">示例</div>
  144. <el-row style="width: 100%">
  145. <div>
  146. <div class="idcard-example1"></div>
  147. <div class="idcard-example2"></div>
  148. </div>
  149. <div>
  150. <ul class="authentication-detail-list">
  151. <li>仅支持.jpg .bmp .png .gif的图片格式,图 片大小不超过3M</li>
  152. <li>核实手持证件与原件方向一致,对焦身份证 进行拍照</li>
  153. <li>您提供的照片众测服务平台将予以保护,不 会用于其他用途</li>
  154. </ul>
  155. <a class="authentication-detail-list-blue">实名认证帮助></a>
  156. </div>
  157. </el-row>
  158. </div>
  159. </el-col>
  160. </el-row>
  161. </div>
  162. </div>
  163. <div class="enterprise-brn-wrapper">
  164. <button class="enterprise-btn previousBtn" @click="active--" v-if="active>0">上一步</button>
  165. <button class="enterprise-btn nextBtn" @click="active++" v-if="active===0">下一步</button>
  166. <button class="enterprise-btn nextBtn" @click="submitEnterpriseAuth" v-if="active===1 && authStatus.text !=='认证通过'">提交审核</button>
  167. </div>
  168. </div>
  169. </template>
  170. <script>
  171. import Apis from '@/js/api'
  172. import Http from '@/js/http'
  173. import {notify} from '@/constants/index'
  174. import {storageGet} from '@/js/index'
  175. import idcardPositive from '../../assets/img/idcard-positive.png'
  176. import idcardBack from '../../assets/img/idcard-back.png'
  177. export default {
  178. name: "EnterpriseAuth",
  179. data() {
  180. return {
  181. active: 0,
  182. user: {},
  183. canEdit:false,
  184. authType:-1,
  185. authStatus:{},
  186. enterpriseForm: {
  187. roleList: [],//0是发包 1是接包 如果两个都有那么权限都有。
  188. legalPersonName: "", //法人姓名
  189. businessLicensePhoto: require('../../assets/img/business-license.png'),//企业执照
  190. idCardNum: "",//身份证号码
  191. address: "",//地址
  192. gender: "",
  193. idCardPositivePhoto: idcardPositive,//身份证正面照
  194. idCardBackPhoto: idcardBack,//身份证反面照片
  195. idCardDeadTime: "",//身份证过期时间
  196. evaluationAgencyName:"", //企业名称
  197. agencyPhoto:"", //企业logo
  198. },
  199. failureReason:''
  200. }
  201. },
  202. methods: {
  203. submitEnterpriseAuth() {
  204. let firstSubmit = this.$route.query.type;
  205. if(firstSubmit==1){
  206. Http.post(`/api/user/${this.user.id}/agency`, this.enterpriseForm).then(res => {
  207. if (res) {
  208. notify('success', '提交成功');
  209. this.$router.push('/personal/authentication')
  210. }
  211. })
  212. }else{
  213. Http.put(`/api/user/${this.user.id}/agency`, this.enterpriseForm).then(res => {
  214. if (res) {
  215. notify('success', '修改成功');
  216. this.$router.push('/personal/authentication')
  217. }
  218. })
  219. }
  220. },
  221. //获取当前认证状态
  222. getAuthStatus() {
  223. Http.get(`/api/user/${this.user.id}`).then(res => {
  224. if (res.agencyVO) {
  225. this.authType = 1 //企业已参与认证
  226. this.authStatus = res.agencyVO.authStatus ? res.agencyVO.authStatus : {}
  227. //成功和审核中状态不可编辑,认证失败状态可编辑
  228. this.authStatus.style === 'info' ? this.canEdit = true : null
  229. this.failureReason = res.agencyVO.explain
  230. this.setFormInfo(res.agencyVO);
  231. } else {
  232. this.authType = 0 //未参与企业认证
  233. this.canEdit = true
  234. }
  235. })
  236. },
  237. setFormInfo(detail) {
  238. //回显认证信息
  239. this.enterpriseForm.roleList = detail.roleList,
  240. this.enterpriseForm.legalPersonName = detail.legalPersonName,
  241. this.enterpriseForm.gender = detail.gender,
  242. this.enterpriseForm.idCardNum = detail.idCardNum,
  243. this.enterpriseForm.address = detail.address,
  244. this.enterpriseForm.idCardPositivePhoto = detail.idCardPositivePhoto,
  245. this.enterpriseForm.idCardBackPhoto = detail.idCardBackPhoto,
  246. this.enterpriseForm.idCardDeadTime = detail.idCardDeadTime
  247. this.enterpriseForm.businessLicensePhoto = detail.businessLicensePhoto
  248. this.enterpriseForm.evaluationAgencyName = detail.evaluationAgencyName
  249. this.enterpriseForm.agencyPhoto = detail.agencyPhoto
  250. },
  251. setUserInfo() {
  252. this.user = storageGet('user') && storageGet('user').userVO;
  253. },
  254. //文件上传前的响应函数
  255. beforeFileUpload(file) {
  256. // 文件大小不能超过10M
  257. if (file.size > 10 * 1000 * 1000) {
  258. notify('error', '单个文件大小不能超过5M')
  259. return false;
  260. }
  261. let fileName = file.name
  262. let index = fileName.lastIndexOf('.');
  263. // 文件不能没有后缀
  264. if (index <= 0) {
  265. notify('error', '只能上传png/jpg/jpeg格式的文件')
  266. return false;
  267. }
  268. let fileSuffix = fileName.substr(index)
  269. // 文件后缀必须是.png或者.jpg
  270. if (fileSuffix !== '.jpg' && fileSuffix !== '.png' && fileSuffix !== '.jpeg') {
  271. notify('error', '只能上传png/jpg/jpeg格式的文件')
  272. return false;
  273. }
  274. },
  275. //上传文件,此处为上传图片
  276. uploadFile(param) {
  277. const formData = new FormData()
  278. let config = {
  279. //添加请求头
  280. headers: {'Content-Type': 'multipart/form-data'},
  281. }
  282. formData.append('file', param.file)
  283. //console.log(JSON.parse(this.user).userVO)
  284. Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.id), formData, config).then((res) => {
  285. if(param.data.type==2){
  286. this.enterpriseForm.businessLicensePhoto = res.data;
  287. }else if(param.data.type == 1){
  288. this.enterpriseForm.idCardBackPhoto = res.data
  289. }else if(param.data.type == 0){
  290. this.enterpriseForm.idCardPositivePhoto = res.data
  291. }else if(param.data.type == 3){
  292. this.enterpriseForm.agencyPhoto = res.data
  293. }
  294. notify('success', '上传成功')
  295. // this.$refs['agency'].validateField('photoUrl');
  296. }).catch(error => {
  297. notify('error', error.data)
  298. })
  299. },
  300. },
  301. mounted() {
  302. this.setUserInfo();
  303. this.getAuthStatus();
  304. console.log(this.$route.params.type)
  305. }
  306. }
  307. </script>
  308. <style scoped lang="less">
  309. .avatar-uploader{
  310. border-radius: 6px;
  311. cursor: pointer;
  312. position: relative;
  313. overflow: hidden;
  314. margin-right: 30px;
  315. width: 170px;
  316. height: 170px;
  317. }
  318. .idcard-uploader {
  319. border-radius: 6px;
  320. cursor: pointer;
  321. position: relative;
  322. overflow: hidden;
  323. margin-right: 30px;
  324. width: 270px;
  325. height: 150px;
  326. }
  327. .idcard-uploader .el-upload{
  328. width: 270px;
  329. height: 170px;
  330. }
  331. .avatar-uploader .el-upload{
  332. width: 170px;
  333. height: 170px;
  334. }
  335. .avatar-uploader .el-upload:hover {
  336. border-color: #409EFF;
  337. }
  338. .avatar-uploader-icon {
  339. font-size: 28px;
  340. color: #8c939d;
  341. width: 100%;
  342. height:170px;
  343. line-height: 170px;
  344. text-align: center;
  345. }
  346. .avatar {
  347. width: 100%;
  348. height: 170px;
  349. display: block;
  350. }
  351. .right-modifyPsw {
  352. padding: 20px;
  353. background: rgba(255, 255, 255, 1);
  354. box-shadow: 0px 1px 6px 0px rgba(8, 6, 6, 0.13);
  355. .right-modifyPsw-title {
  356. padding: 10px;
  357. border-bottom: 1px solid #ccc;
  358. margin-bottom: 20px;
  359. }
  360. .upload-wrapper {
  361. padding: 0 30px;
  362. .agency-form-item {
  363. margin-bottom: 10px;
  364. }
  365. .authentication-detail {
  366. padding: 0 30px;
  367. border-left: 1px solid rgba(220, 220, 220, 1);
  368. .idcard-example1{
  369. width: 270px;
  370. height: 160px;
  371. background-image: url("../../assets/img/idcard-back.png");
  372. background-size: 100% 100%;
  373. margin-bottom: 20px;
  374. }
  375. .idcard-example2{
  376. width: 270px;
  377. height: 160px;
  378. background-image: url("../../assets/img/idcard-positive.png");
  379. background-size: 100% 100%;
  380. margin-bottom: 20px;
  381. }
  382. .authentication-detail-title {
  383. font-size: 16px;
  384. font-family: Source Han Sans CN;
  385. font-weight: 600;
  386. border-bottom: 1px dashed rgba(220, 220, 220, 1);
  387. margin-bottom: 10px;
  388. padding-bottom: 5px;
  389. }
  390. }
  391. .authentication-detail-list {
  392. list-style-type: none;
  393. padding-left: 0;
  394. li:before {
  395. content: "\2022";
  396. color: #148AE0;
  397. font-size: 22px;
  398. margin-right: 10px;
  399. }
  400. }
  401. }
  402. .enterprise-brn-wrapper {
  403. margin-top: 40px;
  404. display: flex;
  405. justify-content: center;
  406. .enterprise-btn {
  407. border: 1px solid rgba(0, 118, 203, 1);
  408. width: 150px;
  409. background-color: white;
  410. color: rgba(0, 118, 203, 1);
  411. padding: 10px;
  412. margin: 0 30px;
  413. }
  414. .nextBtn {
  415. background-color: rgba(0, 118, 203, 1);
  416. color: white;
  417. }
  418. }
  419. }
  420. </style>