ownerCertification.vue 17 KB

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