EnterpriseAuth.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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. import idcardPositive from '../../assets/img/idcard-positive.png'
  199. import idcardBack from '../../assets/img/idcard-back.png'
  200. export default {
  201. name: "EnterpriseAuth",
  202. data() {
  203. return {
  204. loading: false,
  205. active: 0,
  206. user: {},
  207. canEdit: false,
  208. authType: -1,
  209. authStatus: {},
  210. enterpriseForm1: {
  211. evaluationAgencyName: "", //企业名称
  212. agencyPhoto: "", //企业logo
  213. businessLicensePhoto: "",//企业执照
  214. },
  215. enterpriseForm: {
  216. roleList: [],//0是发包 1是接包 如果两个都有那么权限都有。
  217. legalPersonName: "", //法人姓名
  218. idCardNum: "",//身份证号码
  219. address: "",//地址
  220. gender: "",
  221. idCardPositivePhoto: "",//身份证正面照
  222. idCardBackPhoto: "",//身份证反面照片
  223. idCardDeadTime: "",//身份证过期时间
  224. },
  225. failureReason: '',
  226. rules1: {
  227. agencyPhoto: [
  228. {required: true, message: '请上传企业logo', trigger: 'blur'},
  229. ],
  230. businessLicensePhoto: [
  231. {required: true, message: '请上传企业执照', trigger: 'blur'},
  232. ],
  233. evaluationAgencyName: [
  234. {required: true, message: '请输入企业名称', trigger: 'blur'},
  235. ],
  236. },
  237. rules: {
  238. legalPersonName: [
  239. {required: true, message: '请输入法人姓名', trigger: 'blur'},
  240. ],
  241. idCardNum: [
  242. {required: true, message: '请输入身份证号码', trigger: 'blur'},
  243. ],
  244. address: [
  245. {required: true, message: '请输入家庭或单位地址', trigger: 'blur'},
  246. ],
  247. gender: [
  248. {required: true, message: '请选择性别', trigger: 'blur'}
  249. ],
  250. roleList: [
  251. {type: 'array', required: true, message: '请至少选择一个认证权限', trigger: 'change'}
  252. ],
  253. idCardDeadTime: [
  254. {required: true, message: '请选择身份证过期时间', trigger: 'change'}
  255. ]
  256. }
  257. }
  258. },
  259. methods: {
  260. nextStep() {
  261. this.$refs['enterpriseForm1'].validate(valid => {
  262. if (!valid) {
  263. notify('error', '信息填写不规范');
  264. return false
  265. } else {
  266. this.active++;
  267. }
  268. })
  269. },
  270. submitEnterpriseAuth() {
  271. this.$refs['enterpriseForm'].validate(valid => {
  272. if (!valid) {
  273. notify('error', '信息填写不规范');
  274. return false
  275. }
  276. })
  277. if (!this.enterpriseForm.idCardPositivePhoto) {
  278. notify('error', '身份证正面照片上传不规范');
  279. return false;
  280. }
  281. if (!this.enterpriseForm.idCardBackPhoto) {
  282. notify('error', '身份证反面照片上传不规范');
  283. return false;
  284. }
  285. let firstSubmit = this.$route.query.type;
  286. let data = {...this.enterpriseForm, ...this.enterpriseForm1};
  287. this.showLoading();
  288. if (firstSubmit == 1) {
  289. Http.post(`/api/user/${this.user.id}/agency`, data).then(res => {
  290. if (res) {
  291. notify('success', '提交成功');
  292. this.$router.push('/personal/authentication')
  293. }
  294. }).catch(err => {
  295. this.hideLoading();
  296. notify('error', err.data)
  297. })
  298. } else {
  299. Http.put(`/api/user/${this.user.id}/agency`, data).then(res => {
  300. if (res) {
  301. notify('success', '修改成功');
  302. this.$router.push('/personal/authentication')
  303. }
  304. }).catch(err => {
  305. this.hideLoading();
  306. notify('error', err.data)
  307. })
  308. }
  309. },
  310. //获取当前认证状态
  311. getAuthStatus() {
  312. Http.get(`/api/user/${this.user.id}`).then(res => {
  313. if (res.agencyVO) {
  314. this.authType = 1 //企业已参与认证
  315. this.authStatus = res.agencyVO.authStatus ? res.agencyVO.authStatus : {}
  316. //成功不可编辑,认证失败状态和审核中状态可编辑
  317. this.authStatus.style !== 'success' ? this.canEdit = true : null
  318. this.failureReason = res.agencyVO.explain
  319. this.setFormInfo(res.agencyVO);
  320. } else {
  321. this.authType = 0 //未参与企业认证
  322. this.canEdit = true
  323. }
  324. })
  325. },
  326. setFormInfo(detail) {
  327. //回显认证信息
  328. this.enterpriseForm.roleList = detail.roleList,
  329. this.enterpriseForm.legalPersonName = detail.legalPersonName,
  330. this.enterpriseForm.gender = detail.gender,
  331. this.enterpriseForm.idCardNum = detail.idCardNum,
  332. this.enterpriseForm.address = detail.address,
  333. this.enterpriseForm.idCardPositivePhoto = detail.idCardPositivePhoto,
  334. this.enterpriseForm.idCardBackPhoto = detail.idCardBackPhoto,
  335. this.enterpriseForm.idCardDeadTime = detail.idCardDeadTime
  336. this.enterpriseForm1.businessLicensePhoto = detail.businessLicensePhoto
  337. this.enterpriseForm1.evaluationAgencyName = detail.evaluationAgencyName
  338. this.enterpriseForm1.agencyPhoto = detail.agencyPhoto
  339. },
  340. setUserInfo() {
  341. this.user = storageGet('user') && storageGet('user').userVO;
  342. },
  343. //文件上传前的响应函数
  344. beforeFileUpload(file) {
  345. // 文件大小不能超过10M
  346. if (file.size > 10 * 1000 * 1000) {
  347. notify('error', '单个文件大小不能超过5M')
  348. return false;
  349. }
  350. let fileName = file.name
  351. let index = fileName.lastIndexOf('.');
  352. // 文件不能没有后缀
  353. if (index <= 0) {
  354. notify('error', '只能上传png/jpg/jpeg格式的文件')
  355. return false;
  356. }
  357. let fileSuffix = fileName.substr(index)
  358. // 文件后缀必须是.png或者.jpg
  359. if (fileSuffix !== '.jpg' && fileSuffix !== '.png' && fileSuffix !== '.jpeg') {
  360. notify('error', '只能上传png/jpg/jpeg格式的文件')
  361. return false;
  362. }
  363. },
  364. //上传文件,此处为上传图片
  365. uploadFile(param) {
  366. const formData = new FormData()
  367. let config = {
  368. //添加请求头
  369. headers: {'Content-Type': 'multipart/form-data'},
  370. }
  371. formData.append('file', param.file)
  372. //console.log(JSON.parse(this.user).userVO)
  373. Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.id), formData, config).then((res) => {
  374. if (param.data.type == 2) {
  375. this.enterpriseForm1.businessLicensePhoto = res.data;
  376. } else if (param.data.type == 1) {
  377. this.enterpriseForm.idCardBackPhoto = res.data
  378. } else if (param.data.type == 0) {
  379. this.enterpriseForm.idCardPositivePhoto = res.data
  380. } else if (param.data.type == 3) {
  381. this.enterpriseForm1.agencyPhoto = res.data
  382. }
  383. notify('success', '上传成功')
  384. // this.$refs['agency'].validateField('photoUrl');
  385. }).catch(error => {
  386. notify('error', error.data)
  387. })
  388. },
  389. showLoading() {
  390. this.loading = true
  391. },
  392. hideLoading() {
  393. this.loading = false
  394. },
  395. },
  396. mounted() {
  397. this.setUserInfo();
  398. this.getAuthStatus();
  399. }
  400. }
  401. </script>
  402. <style scoped lang="less">
  403. .avatar-uploader {
  404. border-radius: 6px;
  405. cursor: pointer;
  406. position: relative;
  407. overflow: hidden;
  408. margin-right: 20px;
  409. width: 170px;
  410. height: 170px;
  411. }
  412. .idcard-uploader {
  413. border-radius: 6px;
  414. cursor: pointer;
  415. position: relative;
  416. overflow: hidden;
  417. margin-right: 20px;
  418. width: 270px;
  419. height: 170px;
  420. }
  421. .idcard-uploader .el-upload {
  422. width: 270px;
  423. height: 170px;
  424. }
  425. .avatar-uploader .el-upload {
  426. width: 170px;
  427. height: 170px;
  428. }
  429. .avatar-uploader .el-upload:hover {
  430. border-color: #409EFF;
  431. }
  432. .avatar-uploader-icon {
  433. font-size: 28px;
  434. color: #8c939d;
  435. width: 170px;
  436. height: 170px;
  437. line-height: 170px;
  438. text-align: center;
  439. }
  440. .card-uploader-icon {
  441. font-size: 28px;
  442. color: #8c939d;
  443. width: 270px;
  444. height: 170px;
  445. line-height: 170px;
  446. text-align: center;
  447. }
  448. .avatar {
  449. width: 100%;
  450. height: 170px;
  451. display: block;
  452. }
  453. .right-modifyPsw {
  454. padding: 20px;
  455. background: rgba(255, 255, 255, 1);
  456. box-shadow: 0px 1px 6px 0px rgba(8, 6, 6, 0.13);
  457. .right-modifyPsw-title {
  458. padding: 10px;
  459. border-bottom: 1px solid #ccc;
  460. margin-bottom: 20px;
  461. }
  462. .uploader-wrapper {
  463. .agency-form-item {
  464. margin-bottom: 10px;
  465. }
  466. .authentication-detail {
  467. padding: 0 15px;
  468. border-left: 1px solid rgba(220, 220, 220, 1);
  469. .idcard-example1 {
  470. width: 270px;
  471. height: 160px;
  472. background-image: url("../../assets/img/idcard-back.png");
  473. background-size: 100% 100%;
  474. margin-bottom: 20px;
  475. }
  476. .idcard-example2 {
  477. width: 270px;
  478. height: 160px;
  479. background-image: url("../../assets/img/idcard-positive.png");
  480. background-size: 100% 100%;
  481. margin-bottom: 20px;
  482. }
  483. .authentication-detail-title {
  484. font-size: 16px;
  485. font-family: Source Han Sans CN;
  486. font-weight: 600;
  487. border-bottom: 1px dashed rgba(220, 220, 220, 1);
  488. margin-bottom: 10px;
  489. padding-left: 20px;
  490. }
  491. .authentication-detail-list {
  492. list-style-type: none;
  493. padding-left: 0 !important;
  494. line-height: 24px;
  495. li:before {
  496. content: "\2022";
  497. color: #148AE0;
  498. font-size: 22px;
  499. margin-right: 5px;
  500. }
  501. }
  502. }
  503. }
  504. .enterprise-btn-wrapper {
  505. margin-top: 40px;
  506. display: flex;
  507. justify-content: center;
  508. .enterprise-btn {
  509. border: 1px solid rgba(0, 118, 203, 1);
  510. width: 150px;
  511. background-color: white;
  512. color: rgba(0, 118, 203, 1);
  513. padding: 10px;
  514. margin: 0 30px;
  515. }
  516. .nextBtn {
  517. background-color: rgba(0, 118, 203, 1);
  518. color: white;
  519. }
  520. }
  521. }
  522. </style>