ownerCertification.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <template>
  2. <view class="yezhu_body">
  3. <view class="user_info">
  4. <view class="user_line">
  5. </view>
  6. <view class="user_item">
  7. <text class="item_name">姓名</text>
  8. <view class="item_right">
  9. <input placeholder-class="item_right_name_placeholder" class="item_right_name" type="text" v-model="name" @input="onKeyYHKNameInput" placeholder="请输入姓名" @blur='inputName' @confirm='inputName'/>
  10. <image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>
  11. </view>
  12. </view>
  13. <view class="user_line">
  14. </view>
  15. <view class="user_item">
  16. <text class="item_name">性别</text>
  17. <view class="item_right" @click="showGender">
  18. <input placeholder-class="item_right_name_placeholder" class="item_right_name" type="text" :value="genderStr" placeholder="请选择" disabled/>
  19. <image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>
  20. </view>
  21. </view>
  22. <view class="user_line">
  23. </view>
  24. <view class="user_item">
  25. <text class="item_name">手机号</text>
  26. <view class="item_right">
  27. <input v-if="mobileOld" placeholder-class="item_right_name_placeholder" type='number' maxlength="11" class="item_right_name" style="color: #b1b1b1;" :value="mobileOld" disabled/>
  28. <input v-else placeholder-class="item_right_name_placeholder" type='number' maxlength="11" style="width: calc(100% - 150rpx);" class="item_right_name" :value="mobile" placeholder="请输入" @blur='inputMobile' @confirm='inputMobile'/>
  29. <view class="veritify" @click="getVeritify" v-if="!mobileOld">
  30. {{veritifyTxt}}
  31. </view>
  32. <image v-if="mobileOld" class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>
  33. </view>
  34. </view>
  35. <view class="user_item" v-if="!mobileOld&&showInputVerifity">
  36. <text class="item_name">验证码</text>
  37. <view class="item_right">
  38. <input placeholder-class="item_right_name_placeholder" class="item_right_name" type="text" :value="verifity" placeholder="请输入" @blur='inputVerifity' @confirm='inputVerifity'/>
  39. <image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="project_ino">
  44. <view class="user_line">
  45. </view>
  46. <view class="user_item">
  47. <text class="item_name">认证项目</text>
  48. <view class="item_right" @click="chooseHouse">
  49. <input placeholder-class="item_right_name_placeholder" class="item_right_name" type="text" :value="houseName" placeholder="请选择" disabled/>
  50. <image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>
  51. </view>
  52. </view>
  53. <view class="user_line">
  54. </view>
  55. <view class="user_item">
  56. <text class="item_name">证件类型</text>
  57. <view class="item_right" @click="chooseCertificateType">
  58. <input placeholder-class="item_right_name_placeholder" class="item_right_name" type="text" :value="certificateTypeStr" placeholder="请选择" disabled/>
  59. <image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>
  60. </view>
  61. </view>
  62. <view class="user_line">
  63. </view>
  64. <view class="user_item">
  65. <text class="item_name">证件号</text>
  66. <view class="item_right">
  67. <input placeholder-class="item_right_name_placeholder" class="item_right_name" type="text" v-model ="certificateNo" placeholder="请输入" @input="idInput" @blur='inputId' @confirm='inputId'/>
  68. <image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>
  69. </view>
  70. </view>
  71. <view class="user_line">
  72. </view>
  73. <view class="user_item">
  74. <text class="item_name">填写房号</text>
  75. <view class="item_right">
  76. <input placeholder-class="item_right_name_placeholder" class="item_right_name" type="text" :value="roomNo" placeholder="请输入" @blur='inputRoomNo' @confirm='inputRoomNo'/>
  77. <image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="xieyi" >
  82. <image class="icon_selected" @click="agreeXieyi" v-if="agree" src="../../static/icons/icon_yezhu_selected.png" mode=""></image>
  83. <image class="icon_selected" @click="agreeXieyi" v-else src="../../static/icons/icon_yezhu_unselected.png" mode=""></image>
  84. <text class="tongyi">我已阅读并同意</text>
  85. <text class="xieyi_text" @click="showXieyi">《入驻协议》</text>
  86. </view>
  87. <view class="btn_next" @click="toRegist">
  88. 下一步
  89. </view>
  90. <dmAgreeement ref='agreement' @agree='agreeXieyi' :url='proviceUrl'></dmAgreeement>
  91. <dmPickerView ref="genderPicker" :options="genderList" :value="gender" @confirm="confirm" title="性别"></dmPickerView>
  92. <dmPickerView ref="housePicker" :options="houseList" :value="houseId" @confirm="houseConfirm" title="认证项目"></dmPickerView>
  93. <dmPickerView ref="certificateTypePicker" :options="certificateTypeList" :value="certificateType" @confirm="certificateTypeConfirm" title="证件类型"></dmPickerView>
  94. <login-notice></login-notice>
  95. <login></login>
  96. </view>
  97. </template>
  98. <script>
  99. import dmAgreeement from "../../components/subComponents/dmAgreement.vue";
  100. import dmPickerView from "../../components/subComponents/dmPickerView.vue";
  101. let app = getApp();
  102. export default {
  103. data() {
  104. return {
  105. agree:false,
  106. veritifyTxt:"获取验证码",
  107. genderList:[
  108. {
  109. title:"男",
  110. value:"1"
  111. },
  112. {
  113. title:"女",
  114. value:"0"
  115. }
  116. ],
  117. gender:"",
  118. genderStr:"",
  119. houseId:"",
  120. houseName:"",
  121. houseList:[],
  122. certificateType:"1",
  123. certificateTypeStr:"",
  124. certificateTypeList:[{
  125. title:"中国居民大陆身份证",
  126. value:"1"
  127. },{
  128. title:"香港居民身份证",
  129. value:"2"
  130. },{
  131. title:"护照",
  132. value:"3"
  133. }],
  134. mobileOld:"",
  135. mobile:"",
  136. verifity:"",
  137. name:"",
  138. certificateNo:"",
  139. roomNo:"",
  140. timer:null,
  141. countdownTimes:120,
  142. showInputVerifity:true,
  143. proviceUrl:"",
  144. };
  145. },
  146. onLoad(param) {
  147. this.mobileOld = param.mobile;
  148. },
  149. created() {
  150. this.queryProjectBox();
  151. this.queryProtocolConfigView();
  152. },
  153. methods:{
  154. async queryProtocolConfigView(){
  155. let res = await this.$myRequest({
  156. url: "/project/queryProtocolConfigView",
  157. data: {},
  158. })
  159. if(res.data.success){
  160. const curryUrl = this.curry("/hybrid/html/web/viewer.html?file=");
  161. this.proviceUrl = curryUrl(res.data.single.ownerRegistProtocol)
  162. }
  163. },
  164. curry(baseUrl) {
  165. return function(url) {
  166. let index = url.lastIndexOf('.');
  167. if (url.substring(index + 1).indexOf('pdf') > -1) {
  168. return baseUrl + url;
  169. } else {
  170. return url;
  171. }
  172. }
  173. },
  174. onKeyYHKNameInput(event){
  175. let value = event.target.value;
  176. let patt = /.*[0-9]{1,}.*/i;
  177. var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?%]");
  178. let _str=""
  179. for(let i=0,len=value.length;i<len;i++){
  180. _str+=value[i].replace(pattern,'').replace(patt,'')
  181. }
  182. this.$nextTick(function(){
  183. this.name = _str;
  184. })
  185. },
  186. idInput(event){
  187. let value = event.target.value;
  188. let patt = /^[\u4e00-\u9fa5]+$/;
  189. var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?% ]");
  190. let _str=""
  191. for(let i=0,len=value.length;i<len;i++){
  192. _str+=value[i].replace(pattern,'').replace(patt,'')
  193. }
  194. this.$nextTick(function(){
  195. this.certificateNo = _str;
  196. })
  197. },
  198. agreeXieyi(){
  199. this.agree = !this.agree
  200. },
  201. showXieyi(){
  202. uni.navigateTo({
  203. url:"../webviewPage/webviewPage?type=3"
  204. })
  205. },
  206. showGender(){
  207. this.$refs.genderPicker.show();
  208. },
  209. confirm(e){
  210. this.genderStr = e.selItem.title;
  211. this.gender = e.selItem.value;
  212. },
  213. chooseCertificateType(){
  214. this.$refs.certificateTypePicker.show();
  215. },
  216. certificateTypeConfirm(e){
  217. this.certificateTypeStr = e.selItem.title;
  218. this.certificateType = e.selItem.value;
  219. },
  220. async queryProjectBox() {
  221. let ret = await this.$myRequest({
  222. url: "/project/queryProjectBox",
  223. data: {
  224. "onlineStatus": "1",
  225. }
  226. })
  227. this.houseList = [];
  228. if (ret.data.success) {
  229. let houseList = ret.data.list || [];
  230. let count = 0;
  231. while (count<houseList.length){
  232. this.houseList.push({
  233. title:houseList[count].name,
  234. value:houseList[count].id,
  235. })
  236. count++;
  237. }
  238. }
  239. },
  240. async getVeritify(){
  241. if(!this.mobile){
  242. uni.showToast({
  243. icon:"none",
  244. title:"请输入手机号"
  245. })
  246. return
  247. }
  248. var phone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
  249. if (!phone.test(this.mobile)) {
  250. uni.showToast({
  251. icon:"none",
  252. title:"请输入正确的手机号"
  253. })
  254. return
  255. }
  256. this.showInputVerifity = true;
  257. if(this.timer&&this.countdownTimes>=0){
  258. return
  259. }
  260. let ret = await this.$myRequest({
  261. url: "/sms/sendSmsVerifyCode",
  262. data: {
  263. "phone": this.mobile,
  264. },
  265. method:"GET"
  266. })
  267. if (ret.data.success) {
  268. this.countdown();
  269. }
  270. },
  271. chooseHouse(){
  272. this.$refs.housePicker.show();
  273. },
  274. houseConfirm(e){
  275. this.houseId = e.selItem.value;
  276. this.houseName = e.selItem.title
  277. },
  278. countdown(){
  279. this.timer = setInterval(()=>{
  280. this.countdownTimes--;
  281. this.veritifyTxt = this.countdownTimes+"s"
  282. if(this.countdownTimes<=0){
  283. clearInterval(this.timer);
  284. this.timer = null;
  285. this.veritifyTxt = '获取验证码';
  286. this.countdownTimes = 120;
  287. }
  288. },1000)
  289. },
  290. inputName(e){
  291. this.name = e.detail.value
  292. },
  293. inputMobile(e){
  294. this.mobile = e.detail.value
  295. },
  296. inputVerifity(e){
  297. this.verifity = e.detail.value
  298. },
  299. inputId(e){
  300. this.certificateNo = e.detail.value
  301. },
  302. inputRoomNo(e){
  303. this.roomNo = e.detail.value
  304. },
  305. toRegist(){
  306. if(this.mobileOld){
  307. this.addOrUpdate();
  308. }else{
  309. this.toLogin();
  310. }
  311. },
  312. async toLogin(){
  313. if(!this.mobile){
  314. uni.showToast({
  315. icon:"none",
  316. title:"请输入手机号"
  317. })
  318. return
  319. }
  320. if(!this.verifity){
  321. uni.showToast({
  322. icon:"none",
  323. title:"请输入验证码"
  324. })
  325. return
  326. }
  327. let ret = await this.$myRequest({
  328. url: "/authorizedPhone",
  329. data: {
  330. "code": this.verifity,
  331. "phone": this.mobile,
  332. "userId": getApp().globalData.userId,
  333. "projectId": getApp().globalData.projectId||"",
  334. "shareToken": getApp().globalData.shareToken||"",
  335. }
  336. });
  337. if(ret.data.success){
  338. let token = ret.data.single;
  339. getApp().globalData.token = token;
  340. uni.$emit('request');
  341. this.addOrUpdate();
  342. }else{
  343. uni.showToast({
  344. icon:"none",
  345. title:ret.data.message
  346. });
  347. }
  348. },
  349. async addOrUpdate() {
  350. if(!this.name){
  351. uni.showToast({
  352. icon:"none",
  353. title:"请输入姓名"
  354. })
  355. return
  356. }
  357. if(!this.gender){
  358. uni.showToast({
  359. icon:"none",
  360. title:"请选择性别"
  361. })
  362. return
  363. }
  364. if(!this.houseId){
  365. uni.showToast({
  366. icon:"none",
  367. title:"请选择认证项目"
  368. })
  369. return
  370. }
  371. if(!this.certificateType){
  372. uni.showToast({
  373. icon:"none",
  374. title:"请选择证件类型"
  375. })
  376. return
  377. }
  378. if(!this.certificateNo){
  379. uni.showToast({
  380. icon:"none",
  381. title:"请输入证件号"
  382. })
  383. return
  384. }else{
  385. if(this.certificateType==1){
  386. if(this.certificateNo.length!=18){
  387. uni.showToast({
  388. icon:"none",
  389. title:"请输入正确的身份证号"
  390. })
  391. return
  392. }
  393. }
  394. }
  395. if(!this.roomNo){
  396. uni.showToast({
  397. icon:"none",
  398. title:"请输入房号"
  399. })
  400. return
  401. }
  402. if(!this.agree){
  403. uni.showToast({
  404. icon:"none",
  405. title:"请阅读并同意《入住协议》"
  406. })
  407. return
  408. }
  409. let ret = await this.$myRequest({
  410. url: "/user/regist/addOrUpdate",
  411. data: {
  412. "agreeState": this.agree?1:0,
  413. "captcha":this.verifity,
  414. "certificateNo": this.certificateNo,
  415. "certificateType": this.certificateType,
  416. "phone": this.mobileOld?this.mobileOld:this.mobile,
  417. "projectId": this.houseId,
  418. "roomNo": this.roomNo,
  419. "sex": this.gender,
  420. "sign": this.sign,
  421. "userId": app.globalData.userId,
  422. "username": this.name,
  423. "phoneFrom":this.mobileOld?1:2
  424. }
  425. })
  426. if (ret.data.success) {
  427. uni.redirectTo({
  428. url:'../certificationResultPage/certificationResultPage'
  429. })
  430. }else{
  431. uni.showToast({
  432. icon:"none",
  433. title:ret.data.message
  434. })
  435. }
  436. },
  437. },
  438. destroyed() {
  439. if(null!=this.timer){
  440. clearInterval(this.timer);
  441. this.timer = null;
  442. }
  443. },
  444. components:{
  445. dmAgreeement,
  446. dmPickerView
  447. }
  448. }
  449. </script>
  450. <style lang="scss">
  451. .yezhu_body{
  452. width: 100%;
  453. height: 100vh;
  454. position: relative;
  455. .user_info{
  456. background: #ffffff;
  457. .user_item{
  458. margin-left: 40rpx;
  459. margin-right: 40rpx;
  460. height: 98rpx;
  461. display: flex;
  462. justify-content: space-between;
  463. align-items: center;
  464. .item_name{
  465. width: 20%;
  466. font-size: 28rpx;
  467. font-family: Verdana, Verdana-Regular;
  468. font-weight: 400;
  469. text-align: left;
  470. color: #262626;
  471. }
  472. .item_right{
  473. width: 80%;
  474. font-size: 26rpx;
  475. font-family: Verdana, Verdana-Regular;
  476. font-weight: 400;
  477. text-align: right;
  478. color: #262626;
  479. display: flex;
  480. align-items: center;
  481. .item_right_name{
  482. width: 100%;
  483. }
  484. .item_right_name_placeholder{
  485. font-size: 26rpx;
  486. font-family: Verdana, Verdana-Regular;
  487. font-weight: 400;
  488. color: #b1b1b1;
  489. }
  490. .icon_right{
  491. width: 10rpx;
  492. height: 22rpx;
  493. margin-left: 19rpx;
  494. }
  495. .veritify{
  496. width: 140rpx;
  497. height: 50rpx;
  498. margin-left: 10rpx;
  499. line-height: 50rpx;
  500. background: #ffffff;
  501. border: 2rpx solid #f07423;
  502. border-radius: 8rpx;
  503. font-size: 20rpx;
  504. font-family: Verdana, Verdana-Regular;
  505. font-weight: 400;
  506. text-align: center;
  507. color: #f07423;
  508. }
  509. }
  510. }
  511. .user_line{
  512. margin-left: 40rpx;
  513. margin-right: 40rpx;
  514. height: 2px;
  515. background: #f8f8f8;
  516. }
  517. }
  518. .project_ino{
  519. background: #ffffff;
  520. margin-top: 20rpx;
  521. .user_item{
  522. margin-left: 40rpx;
  523. margin-right: 40rpx;
  524. height: 98rpx;
  525. display: flex;
  526. justify-content: space-between;
  527. align-items: center;
  528. .item_name{
  529. width: 20%;
  530. font-size: 28rpx;
  531. font-family: Verdana, Verdana-Regular;
  532. font-weight: 400;
  533. text-align: left;
  534. color: #262626;
  535. }
  536. .item_right{
  537. width: 80%;
  538. font-size: 26rpx;
  539. font-family: Verdana, Verdana-Regular;
  540. font-weight: 400;
  541. text-align: right;
  542. color: #262626;
  543. display: flex;
  544. align-items: center;
  545. .item_right_name{
  546. width: 100%;
  547. }
  548. .item_right_name_placeholder{
  549. font-size: 26rpx;
  550. font-family: Verdana, Verdana-Regular;
  551. font-weight: 400;
  552. color: #b1b1b1;
  553. }
  554. .icon_right{
  555. width: 10rpx;
  556. height: 22rpx;
  557. margin-left: 19rpx;
  558. }
  559. }
  560. }
  561. .user_line{
  562. margin-left: 40rpx;
  563. margin-right: 40rpx;
  564. height: 2px;
  565. background: #f8f8f8;
  566. }
  567. }
  568. .xieyi{
  569. display: flex;
  570. width: 100%;
  571. justify-content: center;
  572. position: absolute;
  573. bottom: 162rpx;
  574. left: 0;
  575. align-items: center;
  576. .icon_selected{
  577. width: 24rpx;
  578. height: 24rpx;
  579. margin-right: 20rpx;
  580. }
  581. .tongyi{
  582. font-size: 24rpx;
  583. font-family: Verdana, Verdana-Regular;
  584. font-weight: 400;
  585. color: #999999;
  586. display: inline-block;
  587. }
  588. .xieyi_text{
  589. font-size: 24rpx;
  590. font-family: Verdana, Verdana-Regular;
  591. font-weight: 400;
  592. color: #f07423;
  593. display: inline-block;
  594. }
  595. }
  596. .btn_next{
  597. width: calc(100% - 80rpx);
  598. box-sizing: border-box;
  599. margin-left: 40rpx;
  600. margin-right: 40rpx;
  601. height: 72rpx;
  602. line-height: 72rpx;
  603. background: #f07423;
  604. border-radius: 12rpx;
  605. font-size: 32rpx;
  606. font-family: Verdana, Verdana-Regular;
  607. font-weight: 400;
  608. text-align: center;
  609. color: #ffffff;
  610. position: absolute;
  611. bottom: 60rpx;
  612. left: 0;
  613. }
  614. }
  615. </style>