EnterpriseAuth.vue 15 KB

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