ownerCertification.vue 14 KB

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