ownerCertification.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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" @click="showXieyi">
  82. <image class="icon_selected" v-if="agree" src="../../static/icons/icon_yezhu_selected.png" mode=""></image>
  83. <image class="icon_selected" v-else src="../../static/icons/icon_yezhu_unselected.png" mode=""></image>
  84. <text class="tongyi">我已阅读并同意</text>
  85. <text class="xieyi_text">《入驻协议》</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 = true
  200. },
  201. showXieyi(){
  202. this.$refs.agreement.show()
  203. },
  204. showGender(){
  205. this.$refs.genderPicker.show();
  206. },
  207. confirm(e){
  208. this.genderStr = e.selItem.title;
  209. this.gender = e.selItem.value;
  210. },
  211. chooseCertificateType(){
  212. this.$refs.certificateTypePicker.show();
  213. },
  214. certificateTypeConfirm(e){
  215. this.certificateTypeStr = e.selItem.title;
  216. this.certificateType = e.selItem.value;
  217. },
  218. async queryProjectBox() {
  219. let ret = await this.$myRequest({
  220. url: "/project/queryProjectBox",
  221. data: {
  222. "onlineStatus": "1",
  223. }
  224. })
  225. this.houseList = [];
  226. if (ret.data.success) {
  227. let houseList = ret.data.list || [];
  228. let count = 0;
  229. while (count<houseList.length){
  230. this.houseList.push({
  231. title:houseList[count].name,
  232. value:houseList[count].id,
  233. })
  234. count++;
  235. }
  236. }
  237. },
  238. async getVeritify(){
  239. if(!this.mobile){
  240. uni.showToast({
  241. icon:"none",
  242. title:"请输入手机号"
  243. })
  244. return
  245. }
  246. var phone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
  247. if (!phone.test(this.mobile)) {
  248. uni.showToast({
  249. icon:"none",
  250. title:"请输入正确的手机号"
  251. })
  252. return
  253. }
  254. this.showInputVerifity = true;
  255. if(this.timer&&this.countdownTimes>=0){
  256. return
  257. }
  258. let ret = await this.$myRequest({
  259. url: "/sms/sendSmsVerifyCode",
  260. data: {
  261. "phone": this.mobile,
  262. },
  263. method:"GET"
  264. })
  265. if (ret.data.success) {
  266. this.countdown();
  267. }
  268. },
  269. chooseHouse(){
  270. this.$refs.housePicker.show();
  271. },
  272. houseConfirm(e){
  273. this.houseId = e.selItem.value;
  274. this.houseName = e.selItem.title
  275. },
  276. countdown(){
  277. this.timer = setInterval(()=>{
  278. this.countdownTimes--;
  279. this.veritifyTxt = this.countdownTimes+"s"
  280. if(this.countdownTimes<=0){
  281. clearInterval(this.timer);
  282. this.timer = null;
  283. this.veritifyTxt = '获取验证码';
  284. this.countdownTimes = 120;
  285. }
  286. },1000)
  287. },
  288. inputName(e){
  289. this.name = e.detail.value
  290. },
  291. inputMobile(e){
  292. this.mobile = e.detail.value
  293. },
  294. inputVerifity(e){
  295. this.verifity = e.detail.value
  296. },
  297. inputId(e){
  298. this.certificateNo = e.detail.value
  299. },
  300. inputRoomNo(e){
  301. this.roomNo = e.detail.value
  302. },
  303. toRegist(){
  304. if(this.mobileOld){
  305. this.addOrUpdate();
  306. }else{
  307. this.toLogin();
  308. }
  309. },
  310. async toLogin(){
  311. if(!this.mobile){
  312. uni.showToast({
  313. icon:"none",
  314. title:"请输入手机号"
  315. })
  316. return
  317. }
  318. if(!this.verifity){
  319. uni.showToast({
  320. icon:"none",
  321. title:"请输入验证码"
  322. })
  323. return
  324. }
  325. let ret = await this.$myRequest({
  326. url: "/authorizedPhone",
  327. data: {
  328. "code": this.verifity,
  329. "phone": this.mobile,
  330. "userId": getApp().globalData.userId,
  331. "projectId": getApp().globalData.projectId||"",
  332. "shareToken": getApp().globalData.shareToken||"",
  333. }
  334. });
  335. if(ret.data.success){
  336. let token = ret.data.single;
  337. getApp().globalData.token = token;
  338. uni.$emit('request');
  339. this.addOrUpdate();
  340. }else{
  341. uni.showToast({
  342. icon:"none",
  343. title:ret.data.message
  344. });
  345. }
  346. },
  347. async addOrUpdate() {
  348. if(!this.name){
  349. uni.showToast({
  350. icon:"none",
  351. title:"请输入姓名"
  352. })
  353. return
  354. }
  355. if(!this.gender){
  356. uni.showToast({
  357. icon:"none",
  358. title:"请选择性别"
  359. })
  360. return
  361. }
  362. if(!this.houseId){
  363. uni.showToast({
  364. icon:"none",
  365. title:"请选择认证项目"
  366. })
  367. return
  368. }
  369. if(!this.certificateType){
  370. uni.showToast({
  371. icon:"none",
  372. title:"请选择证件类型"
  373. })
  374. return
  375. }
  376. if(!this.certificateNo){
  377. uni.showToast({
  378. icon:"none",
  379. title:"请输入证件号"
  380. })
  381. return
  382. }else{
  383. if(this.certificateType==1){
  384. if(this.certificateNo.length!=18){
  385. uni.showToast({
  386. icon:"none",
  387. title:"请输入正确的身份证号"
  388. })
  389. return
  390. }
  391. }
  392. }
  393. if(!this.roomNo){
  394. uni.showToast({
  395. icon:"none",
  396. title:"请输入房号"
  397. })
  398. return
  399. }
  400. if(!this.agree){
  401. uni.showToast({
  402. icon:"none",
  403. title:"请阅读并同意《入住协议》"
  404. })
  405. return
  406. }
  407. let ret = await this.$myRequest({
  408. url: "/user/regist/addOrUpdate",
  409. data: {
  410. "agreeState": this.agree?1:0,
  411. "captcha":this.verifity,
  412. "certificateNo": this.certificateNo,
  413. "certificateType": this.certificateType,
  414. "phone": this.mobileOld?this.mobileOld:this.mobile,
  415. "projectId": this.houseId,
  416. "roomNo": this.roomNo,
  417. "sex": this.gender,
  418. "sign": this.sign,
  419. "userId": app.globalData.userId,
  420. "username": this.name,
  421. "phoneFrom":this.mobileOld?1:2
  422. }
  423. })
  424. if (ret.data.success) {
  425. uni.redirectTo({
  426. url:'../certificationResultPage/certificationResultPage'
  427. })
  428. }else{
  429. uni.showToast({
  430. icon:"none",
  431. title:ret.data.message
  432. })
  433. }
  434. },
  435. },
  436. destroyed() {
  437. if(null!=this.timer){
  438. clearInterval(this.timer);
  439. this.timer = null;
  440. }
  441. },
  442. components:{
  443. dmAgreeement,
  444. dmPickerView
  445. }
  446. }
  447. </script>
  448. <style lang="scss">
  449. .yezhu_body{
  450. width: 100%;
  451. height: 100vh;
  452. position: relative;
  453. .user_info{
  454. background: #ffffff;
  455. .user_item{
  456. margin-left: 40rpx;
  457. margin-right: 40rpx;
  458. height: 98rpx;
  459. display: flex;
  460. justify-content: space-between;
  461. align-items: center;
  462. .item_name{
  463. width: 20%;
  464. font-size: 28rpx;
  465. font-family: Verdana, Verdana-Regular;
  466. font-weight: 400;
  467. text-align: left;
  468. color: #262626;
  469. }
  470. .item_right{
  471. width: 80%;
  472. font-size: 26rpx;
  473. font-family: Verdana, Verdana-Regular;
  474. font-weight: 400;
  475. text-align: right;
  476. color: #262626;
  477. display: flex;
  478. align-items: center;
  479. .item_right_name{
  480. width: 100%;
  481. }
  482. .item_right_name_placeholder{
  483. font-size: 26rpx;
  484. font-family: Verdana, Verdana-Regular;
  485. font-weight: 400;
  486. color: #b1b1b1;
  487. }
  488. .icon_right{
  489. width: 10rpx;
  490. height: 22rpx;
  491. margin-left: 19rpx;
  492. }
  493. .veritify{
  494. width: 140rpx;
  495. height: 50rpx;
  496. margin-left: 10rpx;
  497. line-height: 50rpx;
  498. background: #ffffff;
  499. border: 2rpx solid #f07423;
  500. border-radius: 8rpx;
  501. font-size: 20rpx;
  502. font-family: Verdana, Verdana-Regular;
  503. font-weight: 400;
  504. text-align: center;
  505. color: #f07423;
  506. }
  507. }
  508. }
  509. .user_line{
  510. margin-left: 40rpx;
  511. margin-right: 40rpx;
  512. height: 2px;
  513. background: #f8f8f8;
  514. }
  515. }
  516. .project_ino{
  517. background: #ffffff;
  518. margin-top: 20rpx;
  519. .user_item{
  520. margin-left: 40rpx;
  521. margin-right: 40rpx;
  522. height: 98rpx;
  523. display: flex;
  524. justify-content: space-between;
  525. align-items: center;
  526. .item_name{
  527. width: 20%;
  528. font-size: 28rpx;
  529. font-family: Verdana, Verdana-Regular;
  530. font-weight: 400;
  531. text-align: left;
  532. color: #262626;
  533. }
  534. .item_right{
  535. width: 80%;
  536. font-size: 26rpx;
  537. font-family: Verdana, Verdana-Regular;
  538. font-weight: 400;
  539. text-align: right;
  540. color: #262626;
  541. display: flex;
  542. align-items: center;
  543. .item_right_name{
  544. width: 100%;
  545. }
  546. .item_right_name_placeholder{
  547. font-size: 26rpx;
  548. font-family: Verdana, Verdana-Regular;
  549. font-weight: 400;
  550. color: #b1b1b1;
  551. }
  552. .icon_right{
  553. width: 10rpx;
  554. height: 22rpx;
  555. margin-left: 19rpx;
  556. }
  557. }
  558. }
  559. .user_line{
  560. margin-left: 40rpx;
  561. margin-right: 40rpx;
  562. height: 2px;
  563. background: #f8f8f8;
  564. }
  565. }
  566. .xieyi{
  567. display: flex;
  568. width: 100%;
  569. justify-content: center;
  570. position: absolute;
  571. bottom: 162rpx;
  572. left: 0;
  573. align-items: center;
  574. .icon_selected{
  575. width: 24rpx;
  576. height: 24rpx;
  577. margin-right: 20rpx;
  578. }
  579. .tongyi{
  580. font-size: 24rpx;
  581. font-family: Verdana, Verdana-Regular;
  582. font-weight: 400;
  583. color: #999999;
  584. display: inline-block;
  585. }
  586. .xieyi_text{
  587. font-size: 24rpx;
  588. font-family: Verdana, Verdana-Regular;
  589. font-weight: 400;
  590. color: #f07423;
  591. display: inline-block;
  592. }
  593. }
  594. .btn_next{
  595. width: calc(100% - 80rpx);
  596. box-sizing: border-box;
  597. margin-left: 40rpx;
  598. margin-right: 40rpx;
  599. height: 72rpx;
  600. line-height: 72rpx;
  601. background: #f07423;
  602. border-radius: 12rpx;
  603. font-size: 32rpx;
  604. font-family: Verdana, Verdana-Regular;
  605. font-weight: 400;
  606. text-align: center;
  607. color: #ffffff;
  608. position: absolute;
  609. bottom: 60rpx;
  610. left: 0;
  611. }
  612. }
  613. </style>