EnterpriseAuth.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <template>
  2. <div class="right-modifyPsw" v-loading="loading">
  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 v-if="active===0" class="uploader-wrapper">
  21. <el-form ref="enterpriseForm1" :model="enterpriseForm1" :rules="rules1" label-width="100px"
  22. style="width: 600px;margin-top: 10px">
  23. <el-form-item label="企业logo:" prop="agencyPhoto">
  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="enterpriseForm1.agencyPhoto" :src="enterpriseForm1.agencyPhoto" class="avatar">
  34. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  35. </el-upload>
  36. </el-form-item>
  37. <el-form-item label="企业名称:" prop="evaluationAgencyName">
  38. <el-input :disabled="!canEdit" v-model="enterpriseForm1.evaluationAgencyName"
  39. placeholder="身份证前后不能有空格"></el-input>
  40. </el-form-item>
  41. <el-form-item label="营业执照:" prop="businessLicensePhoto" style="width: 850px">
  42. <el-row class="agency-form-item">
  43. <el-col :span="10">
  44. <div class="uploader-businessLicensePhoto">
  45. <el-upload
  46. class="avatar-uploader idcard-uploader"
  47. style="border: lightgrey 1px solid"
  48. action="https://jsonplaceholder.typicode.com/posts/"
  49. :before-upload="beforeFileUpload"
  50. :http-request="uploadFile"
  51. :data="{type:2}"
  52. :disabled="!canEdit"
  53. >
  54. <img v-if="enterpriseForm1.businessLicensePhoto" :src="enterpriseForm1.businessLicensePhoto"
  55. class="avatar">
  56. <i v-else class="el-icon-plus avatar-uploader-icon card-uploader-icon"></i>
  57. </el-upload>
  58. <div><span style="color: red">*</span>营业执照:(仅支持三证合一)</div>
  59. </div>
  60. </el-col>
  61. <el-col :span="14">
  62. <div class="authentication-detail">
  63. <div class="authentication-detail-title">证件要求</div>
  64. <ul class="authentication-detail-list" style="padding-left:0 ">
  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. </el-form-item>
  74. </el-form>
  75. </div>
  76. <div class="legal-person-wrapper" v-if="active===1">
  77. <el-form ref="enterpriseForm" :model="enterpriseForm" :rules="rules" label-width="130px" style="width: 600px">
  78. <!-- <el-form-item label="法人姓名" prop="legalPersonName">-->
  79. <!-- <el-input :disabled="!canEdit" v-model="enterpriseForm.legalPersonName"-->
  80. <!-- placeholder="请输入您的姓名,需与身份证保持一致"></el-input>-->
  81. <!-- </el-form-item>-->
  82. <!-- <el-form-item label="身份证号码" prop="idCardNum">-->
  83. <!-- <el-input :disabled="!canEdit" v-model="enterpriseForm.idCardNum" placeholder="身份证前后不能有空格"></el-input>-->
  84. <!-- </el-form-item>-->
  85. <!-- <el-form-item label="性别" prop="gender">-->
  86. <!-- <el-radio-group v-model="enterpriseForm.gender" :disabled="!canEdit">-->
  87. <!-- <el-radio label="男"></el-radio>-->
  88. <!-- <el-radio label="女"></el-radio>-->
  89. <!-- </el-radio-group>-->
  90. <!-- </el-form-item>-->
  91. <el-form-item label="法人姓名" prop="legalPersonName">
  92. <el-input :disabled="!canEdit" v-model="enterpriseForm.legalPersonName"
  93. ></el-input>
  94. </el-form-item>
  95. <el-form-item label="性别" prop="gender" required>
  96. <el-radio-group v-model="enterpriseForm.gender" :disabled="!canEdit">
  97. <el-radio label="男"></el-radio>
  98. <el-radio label="女"></el-radio>
  99. </el-radio-group>
  100. </el-form-item>
  101. <el-form-item label="身份证号码" prop="idCardNum">
  102. <el-input :disabled="!canEdit" v-model="enterpriseForm.idCardNum"></el-input>
  103. </el-form-item>
  104. <el-form-item label="身份证到期时间" prop="idCardDeadTime">
  105. <el-date-picker
  106. v-model="enterpriseForm.idCardDeadTime"
  107. style="width: 100%"
  108. align="right"
  109. type="date"
  110. placeholder="请按身份证背面“有效期限”如实填写"
  111. :disabled="!canEdit"
  112. >
  113. </el-date-picker>
  114. </el-form-item>
  115. <el-form-item label="家庭或单位地址" prop="address">
  116. <el-input :disabled="!canEdit" v-model="enterpriseForm.address"></el-input>
  117. </el-form-item>
  118. <el-form-item label="认证权限" prop="roleList">
  119. <el-checkbox-group v-model="enterpriseForm.roleList" :disabled="!canEdit">
  120. <el-checkbox :label="1">发包</el-checkbox>
  121. <el-checkbox :label="0">接包</el-checkbox>
  122. </el-checkbox-group>
  123. </el-form-item>
  124. </el-form>
  125. <div class="uploader-wrapper">
  126. <el-row style="width: 100%">
  127. <el-col :span="9" style="padding-left: 30px">
  128. <div style="height:50%">
  129. <el-upload
  130. class="avatar-uploader idcard-uploader"
  131. style="border: lightgrey 1px solid"
  132. action="https://jsonplaceholder.typicode.com/posts/"
  133. :before-upload="beforeFileUpload"
  134. :http-request="uploadFile"
  135. :data="{type:0}"
  136. :disabled="!canEdit"
  137. >
  138. <img v-if="enterpriseForm.idCardPositivePhoto" :src="enterpriseForm.idCardPositivePhoto" class="avatar">
  139. <i v-else class="el-icon-plus avatar-uploader-icon card-uploader-icon"></i>
  140. </el-upload>
  141. <div style="text-align: center">身份证正面照<span style="color:red">(必填)</span></div>
  142. </div>
  143. <div style="width: 280px;margin-top: 50px">
  144. <el-upload
  145. class="avatar-uploader idcard-uploader"
  146. style="border: lightgrey 1px solid"
  147. action="https://jsonplaceholder.typicode.com/posts/"
  148. :before-upload="beforeFileUpload"
  149. :http-request="uploadFile"
  150. :data="{type:1}"
  151. :disabled="!canEdit"
  152. >
  153. <img v-if="enterpriseForm.idCardBackPhoto" :src="enterpriseForm.idCardBackPhoto" class="avatar">
  154. <i v-else class="el-icon-plus avatar-uploader-icon card-uploader-icon"></i>
  155. </el-upload>
  156. <div style="text-align: center">身份证反面照<span style="color:red">(必填)</span></div>
  157. </div>
  158. </el-col>
  159. <el-col :span="15">
  160. <div class="authentication-detail">
  161. <div class="authentication-detail-title">示例</div>
  162. <el-row style="width: 100%">
  163. <div>
  164. <div class="idcard-example1"></div>
  165. <div class="idcard-example2"></div>
  166. </div>
  167. <div>
  168. <ul class="authentication-detail-list">
  169. <li>仅支持.jpg .png .jpeg,图 片大小不超过3M</li>
  170. <li>核实手持证件与原件方向一致,对焦身份证 进行拍照</li>
  171. <li>您提供的照片众测服务平台将予以保护,不 会用于其他用途</li>
  172. </ul>
  173. <!-- <a class="authentication-detail-list-blue">实名认证帮助></a>-->
  174. </div>
  175. </el-row>
  176. </div>
  177. </el-col>
  178. </el-row>
  179. </div>
  180. </div>
  181. <div class="enterprise-btn-wrapper">
  182. <button class="enterprise-btn previousBtn" style="cursor: pointer" @click="active--" v-if="active>0">上一步</button>
  183. <button class="enterprise-btn nextBtn" style="cursor: pointer" @click="nextStep" v-if="active===0">下一步</button>
  184. <button class="enterprise-btn nextBtn" style="cursor: pointer" @click="submitEnterpriseAuth"
  185. v-if="active===1 && authType === 0">提交审核
  186. </button>
  187. <button class="enterprise-btn nextBtn" style="cursor: pointer" @click="submitEnterpriseAuth"
  188. v-if="active===1 && (authStatus.text =='审核中' || authStatus.text == '认证失败')">修改审核
  189. </button>
  190. </div>
  191. </div>
  192. </template>
  193. <script>
  194. import Apis from '@/js/api'
  195. import Http from '@/js/http'
  196. import {notify} from '@/constants/index'
  197. import {storageGet} from '@/js/index'
  198. export default {
  199. name: "EnterpriseAuth",
  200. data() {
  201. return {
  202. loading: false,
  203. active: 0,
  204. user: {},
  205. canEdit: false,
  206. authType: -1,
  207. authStatus: {},
  208. enterpriseForm1: {
  209. evaluationAgencyName: "", //企业名称
  210. agencyPhoto: "", //企业logo
  211. businessLicensePhoto: "",//企业执照
  212. },
  213. enterpriseForm: {
  214. roleList: [],//0是发包 1是接包 如果两个都有那么权限都有。
  215. legalPersonName: "", //法人姓名
  216. idCardNum: "",//身份证号码
  217. address: "",//地址
  218. gender: "",
  219. idCardPositivePhoto: "",//身份证正面照
  220. idCardBackPhoto: "",//身份证反面照片
  221. idCardDeadTime: "",//身份证过期时间
  222. },
  223. failureReason: '',
  224. rules1: {
  225. agencyPhoto: [
  226. {required: true, message: '请上传企业logo', trigger: 'blur'},
  227. ],
  228. businessLicensePhoto: [
  229. {required: true, message: '请上传企业执照', trigger: 'blur'},
  230. ],
  231. evaluationAgencyName: [
  232. {required: true, message: '请输入企业名称', trigger: 'blur'},
  233. ],
  234. },
  235. rules: {
  236. legalPersonName: [
  237. {required: true, message: '请输入法人姓名', trigger: 'blur'},
  238. ],
  239. idCardNum: [
  240. {required: true, message: '请输入身份证号码', trigger: 'blur'},
  241. ],
  242. address: [
  243. {required: true, message: '请输入家庭或单位地址', trigger: 'blur'},
  244. ],
  245. gender: [
  246. {required: true, message: '请选择性别', trigger: 'blur'}
  247. ],
  248. roleList: [
  249. {type: 'array', required: true, message: '请至少选择一个认证权限', trigger: 'change'}
  250. ],
  251. idCardDeadTime: [
  252. {required: true, message: '请选择身份证过期时间', trigger: 'change'}
  253. ]
  254. }
  255. }
  256. },
  257. methods: {
  258. nextStep() {
  259. this.$refs['enterpriseForm1'].validate(valid => {
  260. if (!valid) {
  261. notify('error', '信息填写不规范');
  262. return false
  263. } else {
  264. this.active++;
  265. }
  266. })
  267. },
  268. submitEnterpriseAuth() {
  269. this.$refs['enterpriseForm'].validate(valid => {
  270. if (!valid) {
  271. notify('error', '信息填写不规范');
  272. return false
  273. }
  274. })
  275. if (!this.enterpriseForm.idCardPositivePhoto) {
  276. notify('error', '身份证正面照片上传不规范');
  277. return false;
  278. }
  279. if (!this.enterpriseForm.idCardBackPhoto) {
  280. notify('error', '身份证反面照片上传不规范');
  281. return false;
  282. }
  283. let firstSubmit = this.$route.query.type;
  284. let data = {...this.enterpriseForm, ...this.enterpriseForm1};
  285. this.showLoading();
  286. if (firstSubmit == 1) {
  287. Http.post(`/api/user/${this.user.id}/agency`, data).then(res => {
  288. if (res) {
  289. notify('success', '提交成功');
  290. this.$router.push('/personal/authentication')
  291. }
  292. }).catch(err => {
  293. this.hideLoading();
  294. notify('error', err.data)
  295. })
  296. } else {
  297. Http.put(`/api/user/${this.user.id}/agency`, data).then(res => {
  298. if (res) {
  299. notify('success', '修改成功');
  300. this.$router.push('/personal/authentication')
  301. }
  302. }).catch(err => {
  303. this.hideLoading();
  304. notify('error', err.data)
  305. })
  306. }
  307. },
  308. //获取当前认证状态
  309. getAuthStatus() {
  310. Http.get(`/api/user/${this.user.id}`).then(res => {
  311. if (res.agencyVO) {
  312. this.authType = 1 //企业已参与认证
  313. this.authStatus = res.agencyVO.authStatus ? res.agencyVO.authStatus : {}
  314. //成功不可编辑,认证失败状态和审核中状态可编辑
  315. this.authStatus.style !== 'success' ? this.canEdit = true : null
  316. this.failureReason = res.agencyVO.explain
  317. this.setFormInfo(res.agencyVO);
  318. } else {
  319. this.authType = 0 //未参与企业认证
  320. this.canEdit = true
  321. }
  322. })
  323. },
  324. setFormInfo(detail) {
  325. //回显认证信息
  326. this.enterpriseForm.roleList = detail.roleList,
  327. this.enterpriseForm.legalPersonName = detail.legalPersonName,
  328. this.enterpriseForm.gender = detail.gender,
  329. this.enterpriseForm.idCardNum = detail.idCardNum,
  330. this.enterpriseForm.address = detail.address,
  331. this.enterpriseForm.idCardPositivePhoto = detail.idCardPositivePhoto,
  332. this.enterpriseForm.idCardBackPhoto = detail.idCardBackPhoto,
  333. this.enterpriseForm.idCardDeadTime = detail.idCardDeadTime
  334. this.enterpriseForm1.businessLicensePhoto = detail.businessLicensePhoto
  335. this.enterpriseForm1.evaluationAgencyName = detail.evaluationAgencyName
  336. this.enterpriseForm1.agencyPhoto = detail.agencyPhoto
  337. },
  338. setUserInfo() {
  339. this.user = storageGet('user') && storageGet('user').userVO;
  340. },
  341. //文件上传前的响应函数
  342. beforeFileUpload(file) {
  343. // 文件大小不能超过10M
  344. if (file.size > 10 * 1000 * 1000) {
  345. notify('error', '单个文件大小不能超过5M')
  346. return false;
  347. }
  348. let fileName = file.name
  349. let index = fileName.lastIndexOf('.');
  350. // 文件不能没有后缀
  351. if (index <= 0) {
  352. notify('error', '只能上传png/jpg/jpeg格式的文件')
  353. return false;
  354. }
  355. let fileSuffix = fileName.substr(index)
  356. // 文件后缀必须是.png或者.jpg
  357. if (fileSuffix !== '.jpg' && fileSuffix !== '.png' && fileSuffix !== '.jpeg') {
  358. notify('error', '只能上传png/jpg/jpeg格式的文件')
  359. return false;
  360. }
  361. },
  362. //上传文件,此处为上传图片
  363. uploadFile(param) {
  364. const formData = new FormData()
  365. let config = {
  366. //添加请求头
  367. headers: {'Content-Type': 'multipart/form-data'},
  368. }
  369. formData.append('file', param.file)
  370. //console.log(JSON.parse(this.user).userVO)
  371. Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.id), formData, config).then((res) => {
  372. if (param.data.type == 2) {
  373. this.enterpriseForm1.businessLicensePhoto = res.data;
  374. } else if (param.data.type == 1) {
  375. this.enterpriseForm.idCardBackPhoto = res.data
  376. } else if (param.data.type == 0) {
  377. this.enterpriseForm.idCardPositivePhoto = res.data
  378. } else if (param.data.type == 3) {
  379. this.enterpriseForm1.agencyPhoto = res.data
  380. }
  381. notify('success', '上传成功')
  382. // this.$refs['agency'].validateField('photoUrl');
  383. }).catch(error => {
  384. notify('error', error.data)
  385. })
  386. },
  387. showLoading() {
  388. this.loading = true
  389. },
  390. hideLoading() {
  391. this.loading = false
  392. },
  393. },
  394. mounted() {
  395. this.setUserInfo();
  396. this.getAuthStatus();
  397. }
  398. }
  399. </script>
  400. <style scoped lang="less">
  401. .avatar-uploader {
  402. border-radius: 6px;
  403. cursor: pointer;
  404. position: relative;
  405. overflow: hidden;
  406. margin-right: 20px;
  407. width: 170px;
  408. height: 170px;
  409. }
  410. .idcard-uploader {
  411. border-radius: 6px;
  412. cursor: pointer;
  413. position: relative;
  414. overflow: hidden;
  415. margin-right: 20px;
  416. width: 270px;
  417. height: 170px;
  418. }
  419. .idcard-uploader .el-upload {
  420. width: 270px;
  421. height: 170px;
  422. }
  423. .avatar-uploader .el-upload {
  424. width: 170px;
  425. height: 170px;
  426. }
  427. .avatar-uploader .el-upload:hover {
  428. border-color: #409EFF;
  429. }
  430. .avatar-uploader-icon {
  431. font-size: 28px;
  432. color: #8c939d;
  433. width: 170px;
  434. height: 170px;
  435. line-height: 170px;
  436. text-align: center;
  437. }
  438. .card-uploader-icon {
  439. font-size: 28px;
  440. color: #8c939d;
  441. width: 270px;
  442. height: 170px;
  443. line-height: 170px;
  444. text-align: center;
  445. }
  446. .avatar {
  447. width: 100%;
  448. height: 170px;
  449. display: block;
  450. }
  451. .right-modifyPsw {
  452. padding: 20px;
  453. background: rgba(255, 255, 255, 1);
  454. box-shadow: 0px 1px 6px 0px rgba(8, 6, 6, 0.13);
  455. .right-modifyPsw-title {
  456. padding: 10px;
  457. border-bottom: 1px solid #ccc;
  458. margin-bottom: 20px;
  459. }
  460. .uploader-wrapper {
  461. .agency-form-item {
  462. margin-bottom: 10px;
  463. }
  464. .authentication-detail {
  465. padding: 0 15px;
  466. border-left: 1px solid rgba(220, 220, 220, 1);
  467. .idcard-example1 {
  468. width: 270px;
  469. height: 160px;
  470. background-image: url("../../assets/img/idcard-back.png");
  471. background-size: 100% 100%;
  472. margin-bottom: 20px;
  473. }
  474. .idcard-example2 {
  475. width: 270px;
  476. height: 160px;
  477. background-image: url("../../assets/img/idcard-positive.png");
  478. background-size: 100% 100%;
  479. margin-bottom: 20px;
  480. }
  481. .authentication-detail-title {
  482. font-size: 16px;
  483. font-family: Source Han Sans CN;
  484. font-weight: 600;
  485. border-bottom: 1px dashed rgba(220, 220, 220, 1);
  486. margin-bottom: 10px;
  487. padding-left: 20px;
  488. }
  489. .authentication-detail-list {
  490. list-style-type: none;
  491. padding-left: 0 !important;
  492. line-height: 24px;
  493. li:before {
  494. content: "\2022";
  495. color: #148AE0;
  496. font-size: 22px;
  497. margin-right: 5px;
  498. }
  499. }
  500. }
  501. }
  502. .enterprise-btn-wrapper {
  503. margin-top: 40px;
  504. display: flex;
  505. justify-content: center;
  506. .enterprise-btn {
  507. border: 1px solid rgba(0, 118, 203, 1);
  508. width: 150px;
  509. background-color: white;
  510. color: rgba(0, 118, 203, 1);
  511. padding: 10px;
  512. margin: 0 30px;
  513. }
  514. .nextBtn {
  515. background-color: rgba(0, 118, 203, 1);
  516. color: white;
  517. }
  518. }
  519. }
  520. </style>