ownerCertification.vue 17 KB

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