ownerCertification.vue 16 KB

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