user-realauth.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>实名认证-创业帮</title>
  6. <meta name="keywords" content="实名认证-创业帮">
  7. <meta name="description" content="实名认证-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="实名认证-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/crop.css">
  16. <link rel="stylesheet" href="./static/css/main.css">
  17. <style>
  18. .uploadimg{height:114px;}
  19. .imgtitle{
  20. z-index:99;
  21. width:100%;
  22. top:80%;
  23. left:50%;
  24. transform:translate(-50%, -50%);
  25. }
  26. @media only screen and (max-device-height : 500px){
  27. .f11{font-size:11px};
  28. .f12{font-size:12px !important;}
  29. .f14{font-size:14px;}
  30. .uploadimg{font-size:12px;height:114px;}
  31. .mb12{margin-bottom:12px;}
  32. .pt8{padding-top:8px;}
  33. .pt16{padding-top:16px;}
  34. }
  35. </style>
  36. </head>
  37. <body class="nopb pt0" style="padding-top:0;">
  38. <div id="app" v-cloak>
  39. <van-nav-bar class="user_rank_explan_title" left-arrow title="实名认证" @click-left="goback" v-if="toptitleisshow">
  40. <template #left> <img src="./static/images/left.png" alt=""></template>
  41. </van-nav-bar>
  42. <div class="pt16 pb16 pl16 pr16 bb8f7f7f7">
  43. <div class="f14 c333 mb12">上传照片</div>
  44. <van-row class="mb12 pt8" gutter="13">
  45. <van-col span="12">
  46. <div class="rel" @click="ocr">
  47. <div class="tc f11 caaa abs imgtitle">身份证正面照片</div><img class="uploadimg" :src="CertFrontImage" alt="" width="100%">
  48. </div>
  49. <div class="tc f11 c999 pt4"><span> 识别不了?</span><span class="c333" style="text-decoration:underline;color:#FFA402;" @click="uploadphoto(1)">点击上传</span></div>
  50. </van-col>
  51. <van-col span="12">
  52. <div class="rel" @click="bocr">
  53. <div class="tc f11 caaa abs imgtitle">身份证背面照片</div><img class="uploadimg" :src="CertReverseImage" alt="" width="100%">
  54. </div>
  55. <div class="tc f11 c999 pt4"><span> 识别不了?</span><span class="c333" style="text-decoration:underline;color:#FFA402;" @click="uploadphoto(2)">点击上传</span></div>
  56. </van-col>
  57. </van-row>
  58. <van-row class="pt16" gutter="13">
  59. <van-col class="tc" span="12" @click="uploadphoto(3)">
  60. <div class="spbgc rel">
  61. <div class="tc f11 caaa abs imgtitle">手持身份证照片</div><img class="uploadimg" :src="HandCertImage" alt="" style="width:100%;">
  62. </div>
  63. <div class="tc f11 c999 pt4"></div>
  64. </van-col>
  65. <van-col span="12">
  66. <div class="rel" @click="ocrbank">
  67. <div class="tc f11 caaa abs imgtitle">结算卡照片(含卡号)</div><img class="uploadimg" :src="BankCardPositiveImage" alt="" width="100%">
  68. </div>
  69. <div class="tc f11 c999 pt4"><span> 识别不了?</span><span class="c333" style="text-decoration:underline;color:#FFA402;" @click="uploadphoto(4)">点击上传</span></div>
  70. </van-col>
  71. </van-row>
  72. </div>
  73. <div class="mb20 bb8f7f7f7">
  74. <van-field v-model="real.RealName" @input="checkValue" label="姓名" placeholder="请输入您的姓名"></van-field>
  75. <van-field v-model="real.CertId" @input="checkValue" @blur="verIdCard" label="身份证号" placeholder="请输入您的身份证号码"></van-field>
  76. <van-field v-model="real.SettleBankCardNo" @input="checkValue" label="结算银行卡" placeholder="请输入您的结算银行卡号"></van-field>
  77. <van-field v-model="real.BankMobile" @input="checkValue" label="预留手机号" placeholder="请输入结算银行卡预留手机号"></van-field>
  78. <van-field v-model="real.SettleBankName" placeholder="请选择" @change="checkValue" readonly @click="typeisshow" label="结算银行名称" right-icon="arrow-down"></van-field>
  79. <van-field v-model="real.BankName" @input="checkValue" placeholder="请填入银行卡开户行全称" label="填入开户行"></van-field>
  80. <van-popup v-model="BankNameflag" position="bottom">
  81. <van-picker title="开户行全称" show-toolbar :columns="BankNamelist" @confirm="banknamefn" @cancel="BankNameflag = false"></van-picker>
  82. </van-popup>
  83. <van-field v-model="real.Areas" is-link @change="checkValue" readonly label="工作地区" placeholder="请选择您所在的地区" @click="show = true"></van-field>
  84. </div>
  85. <div class="pt16 bc333" v-cloak>
  86. <van-button type="primary" block color="#FFD500" :disabled="canRegist ? false : true" @click="submitbtn">确认提交</van-button>
  87. <van-popup v-model="show" position="bottom" round style="padding-top:0;">
  88. <van-area :area-list="areaList" @confirm="onareaConfirm" @cancel="show = false"> </van-area>
  89. </van-popup>
  90. </div>
  91. <van-dialog v-model="showresult" theme="round-button" @close="back" confirm-button-text="知道了" v-if="dialogstatus === '1'">
  92. <div class="pt16 pl16 pr16 tc"><img src="./static/images/success@3x.png" width="48">
  93. <div class="f14 c333">认证成功</div>
  94. <div class="pt16 pb16 f12 c999">欢迎加入创业帮团队</div>
  95. </div>
  96. </van-dialog>
  97. <van-dialog v-model="showresult" theme="round-button" confirm-button-text="返回修改" v-if="dialogstatus !== '1'">
  98. <div class="pt16 pl16 pr16 tc"><img src="./static/images/fail@3x.png" width="48">
  99. <div class="f14 c333">认证失败</div>
  100. <div class="pt16 pb16 f12 c999">{{failinfo}}</div>
  101. </div>
  102. </van-dialog>
  103. <input type="file" accept="image/*" id="upload" style="display:none;">
  104. <input type="file" accept="image/*" id="upload1" style="display:none;">
  105. <van-popup v-model="choseType" position="bottom">
  106. <van-picker title="开户银行" show-toolbar :columns="typecolumns" @confirm="choseTypeonConfirm" @cancel="choseType = false"></van-picker>
  107. </van-popup>
  108. </div>
  109. <script src="./static/js/clipboard.min.js"></script>
  110. <script src="./static/js/klm-vv.min.js"></script>
  111. <script src="./static/js/appfunc.min.js"></script>
  112. <script src="./static/js/klm-axios-config.js"></script>
  113. <script src="./static/js/publicfn.js"></script>
  114. <script src="./static/js/exif.js"></script>
  115. <script src="./static/js/transformation-matrix.js"></script>
  116. <script src="./static/js/prefix-umd.js"></script>
  117. <script src="./static/js/index.js"></script>
  118. <script src="./static/js/arealist.js"></script>
  119. <script>
  120. const postbaseRequest = (url, parameter) => {
  121. let param = new URLSearchParams();
  122. param.append('value', parameter);
  123. return request({
  124. url,
  125. method: 'post',
  126. headers: {
  127. // 'Access-Control-Allow-Origin':'*'
  128. 'Content-Type': 'application/x-www-form-urlencoded'
  129. },
  130. data: param,
  131. });
  132. };
  133. </script>
  134. <script>
  135. //上回后回调方法,用于调用缩放、裁切、旋转功能
  136. function OnStart(){
  137. if(PublicLib.getCookieInfo('userIsSign') === 'true'){
  138. app.isagreenment = true;
  139. }
  140. PublicLib.putCookieInfo('userIsSign', '');
  141. };
  142. function AppUpload(imgpath) {
  143. setTimeout(function () {
  144. app.iscut = true;
  145. if(app.imgtype === 3){
  146. PublicLib.WapCropForApp(380, 600, 'upload1', imgpath, 1);
  147. // 添加本地上传图片方法
  148. } else {
  149. PublicLib.WapCropForApp(600, 380, 'upload', imgpath, 1);
  150. };
  151. }, 300);
  152. };
  153. //裁切结束后回调方法
  154. function ShowPhoto(url) {
  155. app.iscut = false;
  156. //获取最终的图片地址
  157. app.changebankimg(url);
  158. };
  159. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  160. // 可以通过下面的方式手动注册
  161. Vue.use(vant.Lazyload);
  162. // 在 #app 标签下渲染一个按钮组件
  163. let app = new Vue({
  164. el: '#app',
  165. data() {
  166. return {
  167. activeIcon:'./static/images/checked@3x.png',
  168. inactiveIcon:'./static/images/unchecked@3x.png',
  169. isagreenment:false,
  170. Bankdetailname:'',
  171. BankType:'',
  172. BankNameflag:false,
  173. BankNamelist:[],
  174. choseType:false,
  175. iscut:false,
  176. toptitleisshow,
  177. showresult: false,
  178. dialogstatus: '1',
  179. failinfo:'',
  180. real:{
  181. //- 手机号码
  182. Mobile:'',
  183. //- 姓名
  184. RealName:'',
  185. BankMobile:'',
  186. //- 身份证号
  187. CertId:'',
  188. //- 银行卡号
  189. SettleBankCardNo:'',
  190. //- 身份正面
  191. CertFrontImage:'',
  192. //- 身份反面
  193. CertReverseImage:'',
  194. //- 银行卡正面
  195. HandCertImage:'',
  196. //- 银行卡反面
  197. BankCardPositiveImage:'',
  198. //- 地区
  199. Areas:'',
  200. Id:'',
  201. },
  202. CertFrontImage:'./static/images/realauth-1.png',
  203. //- 身份反面
  204. CertReverseImage:'./static/images/realauth-2.png',
  205. //- 手持正面
  206. HandCertImage:'./static/images/realauth-3.png',
  207. //- 银行卡反面
  208. BankCardPositiveImage:'./static/images/realauth-4.png',
  209. canRegist: false,
  210. show: false,
  211. cascaderValue: '',
  212. areaList,
  213. imgtype:'',
  214. typecolumns:[],
  215. SettleBankName:'',
  216. type:'',
  217. // 选项列表,children 代表子选项,支持多级嵌套
  218. test:false,
  219. };
  220. },
  221. created() {
  222. this.type = browsertype.versions.ios ? 'ios' : 'android';
  223. this.giveToast();
  224. //- this.getuserinfo();
  225. if(PublicLib.getCookieInfo('userId') === '14'){
  226. this.test = true;
  227. };
  228. },
  229. methods: {
  230. //- OCR身份证正面
  231. ocr(){
  232. PublicLib.OCRIdCard(1);
  233. },
  234. //- OCR身份证反面
  235. bocr(){
  236. PublicLib.OCRIdCard(2);
  237. },
  238. //- OCR银行卡正面
  239. ocrbank(){
  240. PublicLib.OCRBankCard();
  241. },
  242. getBase64Info(type,base64,cardnum,name = ''){
  243. setTimeout(async()=>{
  244. const res = await postbaseRequest('api/PublicMethod/UploadPhotoByBase64?t='+Math.random(6),base64);
  245. if(res.status !== '1') return tips('图片上传失败,请重试!');
  246. //- ID正面
  247. if(type === 1){
  248. this.real.CertId = cardnum.replaceAll(' ','');
  249. this.real.RealName = name;
  250. this.real.CertFrontImage = res.data;
  251. this.CertFrontImage = showHost + res.data;
  252. //- this.CertFrontImage = base64;
  253. //- ID反面
  254. }else if(type === 2){
  255. //- this.ocrimg = base64;
  256. //- this.date = cardnum;
  257. this.real.CertReverseImage = res.data;
  258. this.CertReverseImage = showHost + res.data;
  259. //- 银行卡
  260. }else{
  261. //- this.ocrbankimg = base64;
  262. this.real.SettleBankCardNo = cardnum.replaceAll(' ','');
  263. //- this.bankcardexpore = name;
  264. this.real.BankCardPositiveImage = res.data;
  265. this.BankCardPositiveImage = showHost + res.data;
  266. };
  267. },500);
  268. },
  269. checkLogin(){
  270. this.checkValue();
  271. setTimeout(() => {
  272. if(this.isagreenment === false){
  273. this.isagreenment = false;
  274. }else{
  275. this.isagreenment = false;
  276. PublicLib.Goto({Url:'user-maker-service'});
  277. };
  278. },100)
  279. },
  280. //- 年龄验证
  281. verIdCard(){
  282. if(!verificationIdCardNumber(this.real.CertId)) return tips('身份证格式错误!');
  283. const year = '' + (new Date().getFullYear() - 66) + fillzero((new Date().getMonth() + 1)) + fillzero((new Date().getDate()));
  284. const year3 = '' + (new Date().getFullYear() - 18) + fillzero((new Date().getMonth() + 1)) + fillzero((new Date().getDate()));
  285. year2 = this.real.CertId.substring(6,14);
  286. if(Number(year) >= Number(year2) || Number(year2) > Number(year3)) {
  287. //超龄
  288. tips('年龄范围为18~65周岁,请填写符合的身份证')
  289. return true;
  290. }else{
  291. return false;
  292. }
  293. },
  294. async BankNameflagfn(){
  295. //- this.BankNameflag = true;
  296. //- //- 发起请求
  297. //- res = await getRequest('api/v1/openbanktable/list?t='+Math.random(6),JSON.stringify({PageSize:50,PageNum:1,SearchKey:this.Bankdetailname}));
  298. //- if(res.status !== '1') return tips(user.info);
  299. //- //- console.log(res)
  300. //- let arr = [];
  301. //- res.data.forEach(item=>{
  302. //- arr.push(item.BankName);
  303. //- })
  304. //- this.BankNamelist = arr;
  305. },
  306. banknamefn(data){
  307. this.BankNameflag = false;
  308. this.real.BankName = data;
  309. },
  310. //- 选择器选择
  311. choseTypeonConfirm(date){
  312. this.real.SettleBankName = date.value;
  313. this.choseType = false;
  314. this.checkValue();
  315. },
  316. async typeisshow(){
  317. this.choseType = true;
  318. res = await getRequest('api/v1/merchantaddinfo/options?t='+Math.random(6),JSON.stringify({PageSize:1000,PageNum:1,Kind:4}));
  319. if(res.status !== '1') return tips('账户类型请求错误,请关闭重试!');
  320. this.typecolumns = res.data;
  321. },
  322. giveToast(){
  323. //- vant.Toast('提示');
  324. // 警告通知
  325. vant.Notify({ color: '#333', background: '#FFD500',duration: 5000, message: '请先上传图片,确保上传的照片真实、清晰可辨' });
  326. },
  327. checkValue(){
  328. console.log(123);
  329. this.canRegist = (this.real.BankMobile !== '' && this.real.BankName !== '' && this.real.SettleBankName !== '' && this.real.RealName !== '' && this.real.CertId !== '' && this.real.Areas !== '' && this.real.SettleBankCardNo !== '' && this.real.CertFrontImage !== '' && this.real.CertReverseImage !== '' && this.real.HandCertImage !== '' && this.real.BankCardPositiveImage !== '') ? true : false;
  330. //- this.canRegist = (this.isagreenment && this.real.Mobile !== '' && this.real.BankName !== '' && this.real.SettleBankName !== '' && this.real.RealName !== '' && this.real.CertId !== '' && this.real.Areas !== '' && this.real.SettleBankCardNo !== '' && this.real.CertFrontImage !== '' && this.real.CertReverseImage !== '' && this.real.HandCertImage !== '' && this.real.BankCardPositiveImage !== '') ? true : false;
  331. },
  332. back(){
  333. //- this.goback();
  334. },
  335. onareaConfirm(value){
  336. let str = '';
  337. value.forEach(item=>{
  338. str += `${item.name},`
  339. });
  340. str = str.substr(0,str.length - 1);
  341. this.real.Areas = str;
  342. console.log(str);
  343. this.show = false;
  344. this.checkValue();
  345. },
  346. //- 获取四要素
  347. async getuserinfo(){
  348. //- 获取用户ID
  349. const Id = PublicLib.getCookieInfo('userId');
  350. //- 实名认证四要素
  351. const res = await getRequest('api/v1/users/authinfo?t='+Math.random(6),JSON.stringify({Id}));
  352. this.real.RealName = res.data.RealName;
  353. this.real.Mobile = res.data.Mobile;
  354. this.real.CertId = res.data.CertId;
  355. this.real.SettleBankCardNo = res.data.SettleBankCardNo;
  356. this.real.Id = Id;
  357. },
  358. async submitbtn(){
  359. if(verification(this.real.BankMobile)) return;
  360. if(!verificationIdCardNumber(this.real.CertId)) return tips('身份证格式错误!');
  361. if(!verificationbankcardId(this.real.SettleBankCardNo)) return tips('银行卡格式错误!');
  362. //- 年龄限制
  363. if(this.verIdCard()) return;
  364. const Id = PublicLib.getCookieInfo('userId');
  365. const res = await postRequest('api/v1/users/postauth?t='+Math.random(6),JSON.stringify({
  366. Mobile:this.real.Mobile.trim(),
  367. BankMobile:this.real.BankMobile.trim(),
  368. RealName:this.real.RealName.trim(),
  369. CertId:this.real.CertId.trim(),
  370. SettleBankCardNo:this.real.SettleBankCardNo.trim(),
  371. Areas:this.real.Areas.trim(),
  372. BankName:this.real.BankName.trim(),
  373. SettleBankName:this.real.SettleBankName.trim(),
  374. CertFrontImage:this.real.CertFrontImage.trim(),
  375. CertReverseImage:this.real.CertReverseImage.trim(),
  376. HandCertImage:this.real.HandCertImage.trim(),
  377. BankCardPositiveImage:this.real.BankCardPositiveImage.trim(),
  378. Id,
  379. Distribute:1,
  380. }));
  381. if(res.status === '1'){
  382. this.dialogstatus = res.status;
  383. this.failinfo = res.info;
  384. this.showresult = true;
  385. }else if(res.status === '2'){
  386. tips('实名认证成功');
  387. setTimeout(()=>{
  388. PublicLib.Goto({Url:'user-login'});
  389. },2000);
  390. }else{
  391. tips(res.info);
  392. };
  393. },
  394. goback(){
  395. if(this.iscut){
  396. this.iscut = false;
  397. }else{
  398. PublicLib.GoBack({Level:1});
  399. };
  400. },
  401. uploadphoto(type){
  402. this.imgtype = type;
  403. if (isWeb) {
  404. if(type === 3){
  405. PublicLib.WapCrop(380, 600, 'upload1', 1);
  406. }else{
  407. PublicLib.WapCrop(600, 380, 'upload', 1);
  408. }
  409. };
  410. PublicLib.UploadPhoto({
  411. Quality:1,
  412. PhotoCount:1,
  413. Width:300,
  414. Height:300,
  415. });
  416. },
  417. changebankimg(url){
  418. switch(this.imgtype){
  419. case 1:
  420. this.real.CertFrontImage = url;
  421. this.CertFrontImage = showHost + url;
  422. break;
  423. case 2:
  424. this.real.CertReverseImage = url;
  425. this.CertReverseImage = showHost + url;
  426. break;
  427. case 3:
  428. this.real.HandCertImage = url;
  429. this.HandCertImage = showHost + url;
  430. break;
  431. case 4:
  432. this.real.BankCardPositiveImage = url;
  433. this.BankCardPositiveImage = showHost + url;
  434. break;
  435. };
  436. this.checkValue();
  437. },
  438. }
  439. });
  440. </script>
  441. </body>
  442. </html>