ownerCertification.vue 15 KB

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