authentication.vue 17 KB

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