authentication.vue 18 KB

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