authentication.vue 16 KB

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