authentication.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <template>
  2. <view>
  3. <u-navbar back-text="实名认证" back-icon-size="28" back-icon-color="#ffffff" :background="{backgroundColor: '#2795FD',}"
  4. :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <!-- 标签 -->
  6. <view class="tabs">
  7. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  8. </view>
  9. <view class="personal-box" v-if="current==0">
  10. <!-- 个人认证 -->
  11. <view class="personal-authentication" v-if="authentication">
  12. <view class="headline">
  13. 您的信息将会被严格保密,请放心填写
  14. </view>
  15. <!-- 信息 -->
  16. <view class="infos-group">
  17. <view class="item">
  18. <view class="title">
  19. 手机号码
  20. </view>
  21. <view class="value">
  22. {{personalForm.phone}}
  23. </view>
  24. </view>
  25. <view class="item">
  26. <view class="title">
  27. 真实姓名
  28. </view>
  29. <view class="value">
  30. <input v-model="personalForm.realName" type="text" placeholder="请填写真实姓名">
  31. </view>
  32. </view>
  33. <view class="item">
  34. <view class="title">
  35. 身份证号
  36. </view>
  37. <view class="value">
  38. <input v-model="personalForm.idCard" type="text" placeholder="请填写18位身份证号">
  39. </view>
  40. </view>
  41. </view>
  42. <button class="save" @click="personalAut" v-if="!perinReview">保存</button>
  43. <button class="save" style="background-color: #777777;" v-else>审核中</button>
  44. </view>
  45. <!-- 认证成功 -->
  46. <view class="success" v-if="!authentication">
  47. <view class="img-box">
  48. <img src="@/assets/img/success.png" alt="">
  49. </view>
  50. <!-- 信息 -->
  51. <view class="infos-box">
  52. <view class="item">
  53. <view class="title">
  54. 手机号码
  55. </view>
  56. <view class="title">
  57. {{personalForm.phone}}
  58. </view>
  59. </view>
  60. <view class="item">
  61. <view class="title">
  62. 姓名
  63. </view>
  64. <view class="title">
  65. {{personalForm.realName}}
  66. </view>
  67. </view>
  68. <view class="item">
  69. <view class="title">
  70. 身份证号
  71. </view>
  72. <view class="title">
  73. {{personalForm.idCard.slice(0,1)+'****************'+personalForm.idCard.slice(-1)}}
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 提示 -->
  79. <view class="tips" v-if="!authentication">
  80. <view class="tips-item">
  81. <view class="icon">
  82. <img src="@/assets/img/shield-user-line.png" alt="">
  83. </view>
  84. <view class="text">
  85. 信息安全保护中,认证信息将用于创建信息等功能,与账号为已绑定,未经您允许不对外提供
  86. </view>
  87. </view>
  88. <view class="tips-item">
  89. <view class="icon">
  90. <u-icon name="info-circle"></u-icon>
  91. </view>
  92. <view class="text">
  93. 每个账号只能进行一次实名认证,认证成功不支持修改
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <!-- 企业认证 -->
  99. <view class="enterprise-box" v-if="current==1">
  100. <view class="enterprise-authentication" v-if="enterprise">
  101. <view class="headline">
  102. 您的信息将会被严格保密,请放心填写
  103. </view>
  104. <!-- 企业信息 -->
  105. <view class="enterprise-infos">
  106. <view class="infos-input">
  107. <view class="item">
  108. <view class="title">
  109. 企业全称
  110. </view>
  111. <view class="input">
  112. <input v-model="enterpriseForm.name" type="text" placeholder="请填写企业全称">
  113. </view>
  114. </view>
  115. <view class="item">
  116. <view class="title">
  117. 企业地址
  118. </view>
  119. <view class="input">
  120. <input v-model="enterpriseForm.address" type="text" placeholder="请填写企业地址">
  121. </view>
  122. </view>
  123. <view class="item">
  124. <view class="title">
  125. 企业联系人
  126. </view>
  127. <view class="input">
  128. <input v-model="enterpriseForm.contactsPersonId" type="text" placeholder="请填写企业联系人">
  129. </view>
  130. </view>
  131. </view>
  132. <!-- 营业执照 -->
  133. <view class="business-license">
  134. <view class="title">
  135. <view class="title-left">
  136. 营业执照
  137. </view>
  138. <view class="title-right">
  139. 请保证图中文字、印章等清晰可辨识
  140. </view>
  141. </view>
  142. <view class="img-box" v-if="entinReview" >
  143. <img width="100%" height="100%" :src="enterpriseForm.licenseImage" alt="">
  144. </view>
  145. <u-upload v-else ref="uUpload" :action="action" name="photoFile" :file-list="listPic"
  146. :form-data="formData" :header="header" width="686" max-count="1" @on-success="onSuccess">
  147. </u-upload>
  148. </view>
  149. </view>
  150. <button class="save" @click="enterpriseCer" v-if="!entinReview">保存</button>
  151. <button class="save" style="background-color: #777777;" v-else>审核中</button>
  152. </view>
  153. <!-- 企业认证成功 -->
  154. <view class="success" v-if="!enterprise">
  155. <view class="img-box">
  156. <img src="@/assets/img/success.png" alt="">
  157. </view>
  158. <!-- 信息 -->
  159. <view class="infos-box">
  160. <view class="item">
  161. <view class="title">
  162. 企业全称
  163. </view>
  164. <view class="value">
  165. {{enterpriseForm.name}}
  166. </view>
  167. </view>
  168. <view class="item">
  169. <view class="title">
  170. 企业地址
  171. </view>
  172. <view class="value">
  173. {{enterpriseForm.address?enterpriseForm.address:'' }}
  174. </view>
  175. </view>
  176. <view class="item">
  177. <view class="title">
  178. 企业联系人
  179. </view>
  180. <view class="value">
  181. {{enterpriseForm.contactsPersonId?enterpriseForm.contactsPersonId:'' }}
  182. </view>
  183. </view>
  184. <view class="item">
  185. <view class="title">
  186. 营业执照
  187. </view>
  188. </view>
  189. <view class="img-box">
  190. <img :src="enterpriseForm.licenseImage" alt="">
  191. </view>
  192. </view>
  193. </view>
  194. <!-- 提示 -->
  195. <view class="tips" v-if="!enterprise">
  196. <view class="tips-item">
  197. <view class="icon">
  198. <img src="@/assets/img/shield-user-line.png" alt="">
  199. </view>
  200. <view class="text">
  201. 信息安全保护中,认证信息将用于创建信息等功能,与账号为已绑定,未经您允许不对外提供
  202. </view>
  203. </view>
  204. <view class="tips-item">
  205. <view class="icon">
  206. <u-icon name="info-circle"></u-icon>
  207. </view>
  208. <view class="text">
  209. 每个账号只能进行一次实名认证,认证成功不支持修改
  210. </view>
  211. </view>
  212. </view>
  213. </view>
  214. </view>
  215. </template>
  216. <script>
  217. import * as API_main from '@/apis/pagejs/packages.js'
  218. import * as API_weixin from '@/apis/weixin.js'
  219. import {
  220. checkIdCard
  221. } from '@/apis/utils'
  222. export default {
  223. data() {
  224. return {
  225. authentication: true,
  226. enterprise: true,
  227. perinReview: false,
  228. entinReview: false,
  229. list: [{
  230. name: '个人认证'
  231. }, {
  232. name: '企业认证'
  233. }],
  234. current: 0,
  235. personalForm: {
  236. realName: '',
  237. idCard: '',
  238. type: '0'
  239. },
  240. enterpriseForm: {
  241. name: '',
  242. licenseUrl: '',
  243. type: '1',
  244. address: '',
  245. contactsPersonId: '',
  246. },
  247. phone: '',
  248. listPic: [],
  249. action: '',
  250. header: '',
  251. formData: {}
  252. }
  253. },
  254. onLoad() {
  255. this.action = process.car.BASE_URL+"uploadPicture";
  256. this.formData = {
  257. subFolder: "licenseUrl"
  258. }
  259. var token = this.carhelp.getToken();
  260. this.header={
  261. 'Authorization': token,
  262. 'X-Requested-With': 'XMLHttpRequest'
  263. }
  264. },
  265. onReady() {
  266. this.getFindByOpenId();
  267. },
  268. methods: {
  269. onSuccess(data, index, lists, name) {
  270. //.log(data)
  271. if(data.result) {
  272. this.enterpriseForm.licenseUrl = data.data;
  273. }
  274. },
  275. personalAutApi(){
  276. uni.showLoading({
  277. title: "加载中",
  278. mask: true
  279. })
  280. API_main.createAuthentication(this.personalForm).then((res) => {
  281. uni.hideLoading();
  282. this.getFindByOpenId();
  283. }).catch(error => {
  284. uni.showToast({icon: 'none',
  285. title: error,
  286. icon: "none"
  287. })
  288. })
  289. },
  290. personalAut() {
  291. if(!this.personalForm.realName) {
  292. uni.showToast({icon: 'none',
  293. title: "请填写真实姓名",
  294. icon: "none"
  295. })
  296. return
  297. }
  298. if(!this.personalForm.idCard) {
  299. uni.showToast({icon: 'none',
  300. title: "请填写身份证号",
  301. icon: "none"
  302. })
  303. return
  304. }
  305. var checkIdCardResult = checkIdCard(this.personalForm.idCard);
  306. if (checkIdCardResult !== true) {
  307. uni.showToast({icon: 'none',
  308. title: checkIdCardResult,
  309. icon: "none"
  310. })
  311. return;
  312. }
  313. var _this=this;
  314. uni.showModal({
  315. title: '提示',
  316. content:"确认提交个人认证信息",
  317. //content: '这是一个模态弹窗',
  318. success: function(res) {
  319. if (res.confirm) {
  320. _this.personalAutApi()
  321. } else if (res.cancel) {
  322. //.log('用户点击取消');
  323. }
  324. }
  325. });
  326. },
  327. enterpriseCerApi() {
  328. uni.showLoading({
  329. title: "加载中",
  330. mask: true
  331. })
  332. API_main.createAuthentication({
  333. enterpriseName: this.enterpriseForm.name,
  334. licenseUrl: this.enterpriseForm.licenseUrl,
  335. contactsPersonId: this.enterpriseForm.contactsPersonId,
  336. address: this.enterpriseForm.address,
  337. type: this.enterpriseForm.type
  338. }).then((res) => {
  339. uni.hideLoading();
  340. this.getFindByOpenId();
  341. }).catch(error => {
  342. uni.showToast({icon: 'none',
  343. title: error,
  344. icon: "none"
  345. })
  346. })
  347. },
  348. enterpriseCer() {
  349. if(!this.enterpriseForm.name) {
  350. uni.showToast({icon: 'none',
  351. title: "请填写企业全称",
  352. icon: "none"
  353. })
  354. return
  355. }
  356. if(!this.enterpriseForm.address) {
  357. uni.showToast({icon: 'none',
  358. title: "请填写企业地址",
  359. icon: "none"
  360. })
  361. return
  362. }
  363. if(!this.enterpriseForm.contactsPersonId) {
  364. uni.showToast({icon: 'none',
  365. title: "请填写企业联系人",
  366. icon: "none"
  367. })
  368. return
  369. }
  370. if(!this.enterpriseForm.licenseUrl) {
  371. uni.showToast({icon: 'none',
  372. title: "请上传营业执照",
  373. icon: "none"
  374. })
  375. return
  376. }
  377. var _this=this;
  378. uni.showModal({
  379. title: '提示',
  380. content:"确认提交企业认证信息",
  381. //content: '这是一个模态弹窗',
  382. success: function(res) {
  383. if (res.confirm) {
  384. _this.enterpriseCerApi()
  385. } else if (res.cancel) {
  386. //.log('用户点击取消');
  387. }
  388. }
  389. });
  390. },
  391. getFindByOpenId(){
  392. uni.showLoading({
  393. title: "加载中",
  394. mask: true
  395. })
  396. API_weixin.findByOpenId({
  397. openId:this.carhelp.getOpenId()
  398. }).then((res) => {
  399. uni.hideLoading();
  400. var userList = res.data.regUser;
  401. var enterList = res.data.enterpriseInfo;
  402. this.personalForm = userList;
  403. if(userList.status == '1') {
  404. this.authentication = false;
  405. this.personalForm.realName = userList.realName;
  406. }
  407. if(enterList != null) {
  408. this.enterpriseForm = enterList;
  409. if(enterList.status == '0') {
  410. this.entinReview = true;
  411. } else {
  412. this.enterprise = false;
  413. }
  414. }
  415. if(userList.status == '0' && userList.idCard != null) {
  416. this.perinReview = true;
  417. }
  418. }).catch(error => {
  419. uni.showToast({icon: 'none',
  420. title: error,
  421. icon: "none"
  422. })
  423. })
  424. },
  425. change(index) {
  426. this.current = index;
  427. }
  428. }
  429. }
  430. </script>
  431. <style>
  432. page {
  433. background: #F0F0F2;
  434. padding-bottom: 150px;
  435. }
  436. </style>
  437. <style lang="scss" scoped>
  438. .headline {
  439. color: rgba(51, 51, 51, 1);
  440. padding-left: 32rpx;
  441. margin-top: 32rpx;
  442. }
  443. .personal-box {
  444. // 信息
  445. .infos-group {
  446. background-color: #fff;
  447. margin-top: 16rpx;
  448. .item {
  449. display: flex;
  450. align-items: center;
  451. padding: 24rpx 32rpx;
  452. .title {
  453. color: rgba(51, 51, 51, 1);
  454. font-size: 32rpx;
  455. width: 180rpx;
  456. }
  457. .value {
  458. /deep/.uni-input-input {
  459. color: rgba(51, 51, 51, 1);
  460. font-size: 32rpx;
  461. }
  462. }
  463. }
  464. .img-box {
  465. display: flex;
  466. justify-content: center;
  467. img {
  468. width: 100%;
  469. height: 440rpx;
  470. }
  471. }
  472. }
  473. }
  474. // 企业认证
  475. .enterprise-box {
  476. .enterprise-authentication {
  477. .enterprise-infos {
  478. background-color: #fff;
  479. padding: 24rpx 32rpx;
  480. margin-top: 16rpx;
  481. .item{
  482. padding: 6px 0;
  483. border-bottom: 1px solid #f1f1f1;
  484. }
  485. }
  486. .infos-input {
  487. padding: 0 0 24rpx 0;
  488. border-bottom: 1px solid #e6e6e6;
  489. }
  490. .item {
  491. display: flex;
  492. align-items: center;
  493. .title {
  494. color: rgba(51, 51, 51, 1);
  495. font-size: 32rpx;
  496. width: 180rpx;
  497. }
  498. .value {
  499. /deep/.uni-input-input {
  500. color: rgba(51, 51, 51, 1);
  501. font-size: 32rpx;
  502. }
  503. }
  504. }
  505. }
  506. .business-license {
  507. .title {
  508. display: flex;
  509. justify-content: space-between;
  510. padding: 24rpx 0 20rpx;
  511. .title1 {
  512. color: rgba(51, 51, 51, 1);
  513. font-size: 32rpx;
  514. }
  515. .title2 {
  516. color: #999999;
  517. }
  518. }
  519. // 上传
  520. /deep/.u-list-item {
  521. width: 686rpx;
  522. height: 360rpx !important;
  523. }
  524. /deep/.u-add-btn {
  525. color: #ACBAC9;
  526. font-size: 96rpx
  527. }
  528. /deep/.uicon-plus[data-v-2ee87dc9]:before {
  529. font-size: 72rpx;
  530. }
  531. }
  532. }
  533. //认证成功
  534. .success {
  535. background-color: #fff;
  536. .img-box {
  537. display: flex;
  538. justify-content: center;
  539. width: 686rpx;
  540. height: 596rpx;
  541. margin: 0 auto;
  542. padding: 48rpx;
  543. img {
  544. width: 100%;
  545. height: 100%;
  546. }
  547. }
  548. // 信息
  549. .infos-box {
  550. .item {
  551. display: flex;
  552. align-items: center;
  553. padding: 24rpx;
  554. margin: 0 32rpx;
  555. border-bottom: 1px solid #e3e3e3;
  556. .title {
  557. color: rgba(119, 119, 119, 1);
  558. font-size: 16px;
  559. width: 190rpx;
  560. }
  561. .value {
  562. color: rgba(51, 51, 51, 1);
  563. font-size: 16px;
  564. }
  565. }
  566. }
  567. }
  568. //提示
  569. .tips {
  570. padding: 24rpx 32rpx;
  571. .tips-item {
  572. display: flex;
  573. margin-bottom: 24rpx;
  574. font-size: 24rpx;
  575. line-height: 34rpx;
  576. .icon {
  577. width: 32rpx;
  578. height: 32rpx;
  579. img {
  580. width: 100%;
  581. height: 100%;
  582. vertical-align: middle;
  583. }
  584. }
  585. .text {
  586. flex: 1;
  587. margin-left: 8rpx;
  588. }
  589. }
  590. }
  591. // 保存
  592. .save {
  593. background-color: rgba(34, 149, 255, 1);
  594. color: rgba(241, 241, 241, 1);
  595. font-size: 36rpx;
  596. height: 96rpx;
  597. margin: 40rpx 32rpx;
  598. border-radius: 50px;
  599. }
  600. </style>