authentication.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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. <input v-model="personalForm.phone" type="text" placeholder="15500001111">
  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>
  116. <!-- 营业执照 -->
  117. <view class="business-license">
  118. <view class="title">
  119. <view class="title-left">
  120. 营业执照
  121. </view>
  122. <view class="title-right">
  123. 请保证图中文字、印章等清晰可辨识
  124. </view>
  125. </view>
  126. <u-upload ref="uUpload" :action="action" name="photoFile" :file-list="listPic"
  127. :form-data="formData" :header="header" width="686" max-count="1" @on-success="onSuccess">
  128. </u-upload>
  129. </view>
  130. </view>
  131. <button class="save" @click="enterpriseCer" v-if="!entinReview">保存</button>
  132. <button class="save" style="background-color: #777777;" v-else>审核中</button>
  133. </view>
  134. <!-- 企业认证成功 -->
  135. <view class="success" v-if="!enterprise">
  136. <view class="img-box">
  137. <img src="@/assets/img/success.png" alt="">
  138. </view>
  139. <!-- 信息 -->
  140. <view class="infos-box">
  141. <view class="item">
  142. <view class="title">
  143. 企业全称
  144. </view>
  145. <view class="value">
  146. {{enterpriseForm.name}}
  147. </view>
  148. </view>
  149. <view class="item">
  150. <view class="title">
  151. 营业执照
  152. </view>
  153. </view>
  154. <view class="img-box">
  155. <img :src="enterpriseForm.licenseImage" alt="">
  156. </view>
  157. </view>
  158. </view>
  159. <!-- 提示 -->
  160. <view class="tips" v-if="!enterprise">
  161. <view class="tips-item">
  162. <view class="icon">
  163. <img src="@/assets/img/shield-user-line.png" alt="">
  164. </view>
  165. <view class="text">
  166. 信息安全保护中,认证信息将用于创建信息等功能,与账号为已绑定,未经您允许不对外提供
  167. </view>
  168. </view>
  169. <view class="tips-item">
  170. <view class="icon">
  171. <u-icon name="info-circle"></u-icon>
  172. </view>
  173. <view class="text">
  174. 每个账号只能进行一次实名认证,认证成功不支持修改
  175. </view>
  176. </view>
  177. </view>
  178. </view>
  179. </view>
  180. </template>
  181. <script>
  182. import * as API_main from '@/apis/pagejs/main.js'
  183. import * as API_weixin from '@/apis/weixin.js'
  184. import {
  185. checkIdCard
  186. } from '@/apis/utils'
  187. export default {
  188. data() {
  189. return {
  190. authentication: true,
  191. enterprise: true,
  192. perinReview: false,
  193. entinReview: false,
  194. list: [{
  195. name: '个人认证'
  196. }, {
  197. name: '企业认证'
  198. }],
  199. current: 0,
  200. personalForm: {
  201. realName: '',
  202. idCard: '',
  203. type: '0'
  204. },
  205. enterpriseForm: {
  206. name: '',
  207. licenseUrl: '',
  208. type: '1'
  209. },
  210. phone: '',
  211. listPic: [],
  212. action: '',
  213. header: '',
  214. formData: {}
  215. }
  216. },
  217. onLoad() {
  218. this.action = process.car.BASE_URL+"uploadPicture";
  219. this.formData = {
  220. subFolder: "licenseUrl"
  221. }
  222. var token = this.carhelp.getToken();
  223. this.header={
  224. 'Authorization': token,
  225. 'X-Requested-With': 'XMLHttpRequest'
  226. }
  227. },
  228. onReady() {
  229. this.getFindByOpenId();
  230. },
  231. methods: {
  232. onSuccess(data, index, lists, name) {
  233. console.log(data)
  234. if(data.result) {
  235. this.enterpriseForm.licenseUrl = data.data;
  236. }
  237. },
  238. personalAut() {
  239. if(!this.personalForm.realName) {
  240. uni.showToast({icon: 'none',
  241. title: "请填写真实姓名",
  242. icon: "none"
  243. })
  244. return
  245. }
  246. if(!this.personalForm.idCard) {
  247. uni.showToast({icon: 'none',
  248. title: "请填写身份证号",
  249. icon: "none"
  250. })
  251. return
  252. }
  253. var checkIdCardResult = checkIdCard(this.personalForm.idCard);
  254. if (checkIdCardResult !== true) {
  255. uni.showToast({icon: 'none',
  256. title: checkIdCardResult,
  257. icon: "none"
  258. })
  259. return;
  260. }
  261. uni.showLoading({
  262. title: "加载中",
  263. mask: true
  264. })
  265. API_main.createAuthentication(this.personalForm).then((res) => {
  266. uni.hideLoading();
  267. this.getFindByOpenId();
  268. }).catch(error => {
  269. uni.showToast({icon: 'none',
  270. title: error,
  271. icon: "none"
  272. })
  273. })
  274. },
  275. enterpriseCer() {
  276. if(!this.enterpriseForm.enterpriseName) {
  277. uni.showToast({icon: 'none',
  278. title: "请填写企业全称",
  279. icon: "none"
  280. })
  281. return
  282. }
  283. if(!this.enterpriseForm.licenseUrl) {
  284. uni.showToast({icon: 'none',
  285. title: "请上传营业执照",
  286. icon: "none"
  287. })
  288. return
  289. }
  290. uni.showLoading({
  291. title: "加载中",
  292. mask: true
  293. })
  294. API_main.createAuthentication({
  295. enterpriseName: this.enterpriseForm.name,
  296. licenseUrl: this.enterpriseForm.licenseUrl,
  297. type: this.enterpriseForm.type
  298. }).then((res) => {
  299. uni.hideLoading();
  300. this.getFindByOpenId();
  301. }).catch(error => {
  302. uni.showToast({icon: 'none',
  303. title: error,
  304. icon: "none"
  305. })
  306. })
  307. },
  308. getFindByOpenId(){
  309. uni.showLoading({
  310. title: "加载中",
  311. mask: true
  312. })
  313. API_weixin.findByOpenId({
  314. openId:this.carhelp.getOpenId()
  315. }).then((res) => {
  316. uni.hideLoading();
  317. var userList = res.data.regUser;
  318. var enterList = res.data.enterpriseInfo;
  319. this.personalForm = userList;
  320. if(userList.status == '1') {
  321. this.authentication = false;
  322. if(userList.realName.length == 2) {
  323. this.personalForm.realName = userList.realName.slice(0,1) + '*';
  324. } else {
  325. var num = userList.realName.length - 2;
  326. var xh = '';
  327. for (var i = 0; i < num; i++) {
  328. x += '*';
  329. }
  330. this.personalForm.realName = userList.realName.slice(0,1) + xh + userList.realName.slice(-1);
  331. }
  332. }
  333. if(enterList != null) {
  334. this.enterpriseForm = enterList;
  335. if(enterList.status == '0') {
  336. this.entinReview = true;
  337. } else {
  338. this.enterprise = false;
  339. }
  340. }
  341. if(userList.status == '0' && userList.idCard != null) {
  342. this.perinReview = true;
  343. }
  344. }).catch(error => {
  345. uni.showToast({icon: 'none',
  346. title: error,
  347. icon: "none"
  348. })
  349. })
  350. },
  351. change(index) {
  352. this.current = index;
  353. }
  354. }
  355. }
  356. </script>
  357. <style>
  358. page {
  359. background: #F0F0F2;
  360. padding-bottom: 150px;
  361. }
  362. </style>
  363. <style lang="scss" scoped>
  364. .headline {
  365. color: rgba(51, 51, 51, 1);
  366. padding-left: 32rpx;
  367. margin-top: 32rpx;
  368. }
  369. .personal-box {
  370. // 信息
  371. .infos-group {
  372. background-color: #fff;
  373. margin-top: 16rpx;
  374. .item {
  375. display: flex;
  376. align-items: center;
  377. padding: 24rpx 32rpx;
  378. .title {
  379. color: rgba(51, 51, 51, 1);
  380. font-size: 32rpx;
  381. width: 180rpx;
  382. }
  383. .value {
  384. /deep/.uni-input-input {
  385. color: rgba(51, 51, 51, 1);
  386. font-size: 32rpx;
  387. }
  388. }
  389. }
  390. .img-box {
  391. display: flex;
  392. justify-content: center;
  393. img {
  394. width: 100%;
  395. height: 440rpx;
  396. }
  397. }
  398. }
  399. }
  400. // 企业认证
  401. .enterprise-box {
  402. .enterprise-authentication {
  403. .enterprise-infos {
  404. background-color: #fff;
  405. padding: 24rpx 32rpx;
  406. margin-top: 16rpx;
  407. }
  408. .infos-input {
  409. padding: 0 0 24rpx 0;
  410. border-bottom: 1px solid #e6e6e6;
  411. }
  412. .item {
  413. display: flex;
  414. align-items: center;
  415. .title {
  416. color: rgba(51, 51, 51, 1);
  417. font-size: 32rpx;
  418. width: 180rpx;
  419. }
  420. .value {
  421. /deep/.uni-input-input {
  422. color: rgba(51, 51, 51, 1);
  423. font-size: 32rpx;
  424. }
  425. }
  426. }
  427. }
  428. .business-license {
  429. .title {
  430. display: flex;
  431. justify-content: space-between;
  432. padding: 24rpx 0 20rpx;
  433. .title1 {
  434. color: rgba(51, 51, 51, 1);
  435. font-size: 32rpx;
  436. }
  437. .title2 {
  438. color: #999999;
  439. }
  440. }
  441. // 上传
  442. /deep/.u-list-item {
  443. width: 686rpx;
  444. height: 360rpx !important;
  445. }
  446. /deep/.u-add-btn {
  447. color: #ACBAC9;
  448. font-size: 96rpx
  449. }
  450. /deep/.uicon-plus[data-v-2ee87dc9]:before {
  451. font-size: 72rpx;
  452. }
  453. }
  454. }
  455. //认证成功
  456. .success {
  457. background-color: #fff;
  458. .img-box {
  459. display: flex;
  460. justify-content: center;
  461. width: 686rpx;
  462. height: 596rpx;
  463. margin: 0 auto;
  464. padding: 48rpx;
  465. img {
  466. width: 100%;
  467. height: 100%;
  468. }
  469. }
  470. // 信息
  471. .infos-box {
  472. .item {
  473. display: flex;
  474. align-items: center;
  475. padding: 24rpx;
  476. margin: 0 32rpx;
  477. border-bottom: 1px solid #e3e3e3;
  478. .title {
  479. color: rgba(119, 119, 119, 1);
  480. font-size: 16px;
  481. width: 180rpx;
  482. }
  483. .value {
  484. color: rgba(51, 51, 51, 1);
  485. font-size: 16px;
  486. }
  487. }
  488. }
  489. }
  490. //提示
  491. .tips {
  492. padding: 24rpx 32rpx;
  493. .tips-item {
  494. display: flex;
  495. margin-bottom: 24rpx;
  496. font-size: 24rpx;
  497. line-height: 34rpx;
  498. .icon {
  499. width: 32rpx;
  500. height: 32rpx;
  501. img {
  502. width: 100%;
  503. height: 100%;
  504. vertical-align: middle;
  505. }
  506. }
  507. .text {
  508. flex: 1;
  509. margin-left: 8rpx;
  510. }
  511. }
  512. }
  513. // 保存
  514. .save {
  515. background-color: rgba(34, 149, 255, 1);
  516. color: rgba(241, 241, 241, 1);
  517. font-size: 36rpx;
  518. height: 96rpx;
  519. margin: 40rpx 32rpx;
  520. border-radius: 50px;
  521. }
  522. </style>