ownerCertification.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  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. if (ret.data.success) {
  220. this.countdown();
  221. }
  222. },
  223. chooseHouse(){
  224. this.$refs.housePicker.show();
  225. },
  226. houseConfirm(e){
  227. this.houseId = e.selItem.value;
  228. this.houseName = e.selItem.title
  229. },
  230. countdown(){
  231. this.timer = setInterval(()=>{
  232. this.countdownTimes--;
  233. this.veritifyTxt = this.countdownTimes+"s"
  234. if(this.countdownTimes<=0){
  235. clearInterval(this.timer);
  236. this.timer = null;
  237. this.veritifyTxt = '获取验证码';
  238. this.countdownTimes = 120;
  239. }
  240. },1000)
  241. },
  242. inputName(e){
  243. this.name = e.detail.value
  244. },
  245. inputMobile(e){
  246. this.mobile = e.detail.value
  247. },
  248. inputVerifity(e){
  249. this.verifity = e.detail.value
  250. },
  251. inputId(e){
  252. this.certificateNo = e.detail.value
  253. },
  254. inputRoomNo(e){
  255. this.roomNo = e.detail.value
  256. },
  257. toRegist(){
  258. if(this.mobileOld){
  259. this.addOrUpdate();
  260. }else{
  261. this.toLogin();
  262. }
  263. },
  264. async toLogin(){
  265. if(!this.mobile){
  266. uni.showToast({
  267. icon:"none",
  268. title:"请输入手机号"
  269. })
  270. return
  271. }
  272. if(!this.verifity){
  273. uni.showToast({
  274. icon:"none",
  275. title:"请输入验证码"
  276. })
  277. return
  278. }
  279. let ret = await this.$myRequest({
  280. url: "/authorizedPhone",
  281. data: {
  282. "code": this.verifity,
  283. "phone": this.mobile,
  284. "userId": getApp().globalData.userId,
  285. "projectId": getApp().globalData.projectId||"",
  286. "shareToken": getApp().globalData.shareToken||"",
  287. }
  288. });
  289. if(ret.data.success){
  290. let token = ret.data.single;
  291. getApp().globalData.token = token;
  292. uni.$emit('request');
  293. this.addOrUpdate();
  294. }else{
  295. uni.showToast({
  296. icon:"none",
  297. title:ret.data.message
  298. });
  299. }
  300. },
  301. async addOrUpdate() {
  302. if(!this.name){
  303. uni.showToast({
  304. icon:"none",
  305. title:"请输入姓名"
  306. })
  307. return
  308. }
  309. if(!this.gender){
  310. uni.showToast({
  311. icon:"none",
  312. title:"请选择性别"
  313. })
  314. return
  315. }
  316. if(!this.houseId){
  317. uni.showToast({
  318. icon:"none",
  319. title:"请选择认证项目"
  320. })
  321. return
  322. }
  323. if(!this.certificateType){
  324. uni.showToast({
  325. icon:"none",
  326. title:"请选择证件类型"
  327. })
  328. return
  329. }
  330. if(!this.certificateNo){
  331. uni.showToast({
  332. icon:"none",
  333. title:"请输入证件号"
  334. })
  335. return
  336. }
  337. if(!this.roomNo){
  338. uni.showToast({
  339. icon:"none",
  340. title:"请输入房号"
  341. })
  342. return
  343. }
  344. if(!this.agree){
  345. uni.showToast({
  346. icon:"none",
  347. title:"请阅读并同意《入住协议》"
  348. })
  349. return
  350. }
  351. let ret = await this.$myRequest({
  352. url: "/user/regist/addOrUpdate",
  353. data: {
  354. "agreeState": this.agree?1:0,
  355. "captcha":this.verifity,
  356. "certificateNo": this.certificateNo,
  357. "certificateType": this.certificateType,
  358. "phone": this.mobileOld?this.mobileOld:this.mobile,
  359. "projectId": this.houseId,
  360. "roomNo": this.roomNo,
  361. "sex": this.gender,
  362. "sign": this.sign,
  363. "userId": app.globalData.userId,
  364. "username": this.name,
  365. "phoneFrom":this.mobileOld?1:2
  366. }
  367. })
  368. if (ret.data.success) {
  369. uni.redirectTo({
  370. url:'../certificationResultPage/certificationResultPage'
  371. })
  372. }else{
  373. uni.showToast({
  374. icon:"none",
  375. title:ret.data.message
  376. })
  377. }
  378. },
  379. },
  380. destroyed() {
  381. if(null!=this.timer){
  382. clearInterval(this.timer);
  383. this.timer = null;
  384. }
  385. },
  386. components:{
  387. dmAgreeement,
  388. dmPickerView
  389. }
  390. }
  391. </script>
  392. <style lang="scss">
  393. .yezhu_body{
  394. width: 100%;
  395. height: 100vh;
  396. position: relative;
  397. .user_info{
  398. background: #ffffff;
  399. .user_item{
  400. margin-left: 40rpx;
  401. margin-right: 40rpx;
  402. height: 98rpx;
  403. display: flex;
  404. justify-content: space-between;
  405. align-items: center;
  406. .item_name{
  407. width: 20%;
  408. font-size: 28rpx;
  409. font-family: Verdana, Verdana-Regular;
  410. font-weight: 400;
  411. text-align: left;
  412. color: #262626;
  413. }
  414. .item_right{
  415. width: 80%;
  416. font-size: 26rpx;
  417. font-family: Verdana, Verdana-Regular;
  418. font-weight: 400;
  419. text-align: right;
  420. color: #262626;
  421. display: flex;
  422. align-items: center;
  423. .item_right_name{
  424. width: 100%;
  425. }
  426. .item_right_name_placeholder{
  427. font-size: 26rpx;
  428. font-family: Verdana, Verdana-Regular;
  429. font-weight: 400;
  430. color: #b1b1b1;
  431. }
  432. .icon_right{
  433. width: 10rpx;
  434. height: 22rpx;
  435. margin-left: 19rpx;
  436. }
  437. .veritify{
  438. width: 140rpx;
  439. height: 50rpx;
  440. margin-left: 10rpx;
  441. line-height: 50rpx;
  442. background: #ffffff;
  443. border: 2rpx solid #f07423;
  444. border-radius: 8rpx;
  445. font-size: 20rpx;
  446. font-family: Verdana, Verdana-Regular;
  447. font-weight: 400;
  448. text-align: center;
  449. color: #f07423;
  450. }
  451. }
  452. }
  453. .user_line{
  454. margin-left: 40rpx;
  455. margin-right: 40rpx;
  456. height: 2px;
  457. background: #f8f8f8;
  458. }
  459. }
  460. .project_ino{
  461. background: #ffffff;
  462. margin-top: 20rpx;
  463. .user_item{
  464. margin-left: 40rpx;
  465. margin-right: 40rpx;
  466. height: 98rpx;
  467. display: flex;
  468. justify-content: space-between;
  469. align-items: center;
  470. .item_name{
  471. width: 20%;
  472. font-size: 28rpx;
  473. font-family: Verdana, Verdana-Regular;
  474. font-weight: 400;
  475. text-align: left;
  476. color: #262626;
  477. }
  478. .item_right{
  479. width: 80%;
  480. font-size: 26rpx;
  481. font-family: Verdana, Verdana-Regular;
  482. font-weight: 400;
  483. text-align: right;
  484. color: #262626;
  485. display: flex;
  486. align-items: center;
  487. .item_right_name{
  488. width: 100%;
  489. }
  490. .item_right_name_placeholder{
  491. font-size: 26rpx;
  492. font-family: Verdana, Verdana-Regular;
  493. font-weight: 400;
  494. color: #b1b1b1;
  495. }
  496. .icon_right{
  497. width: 10rpx;
  498. height: 22rpx;
  499. margin-left: 19rpx;
  500. }
  501. }
  502. }
  503. .user_line{
  504. margin-left: 40rpx;
  505. margin-right: 40rpx;
  506. height: 2px;
  507. background: #f8f8f8;
  508. }
  509. }
  510. .xieyi{
  511. display: flex;
  512. width: 100%;
  513. justify-content: center;
  514. position: absolute;
  515. bottom: 162rpx;
  516. left: 0;
  517. align-items: center;
  518. .icon_selected{
  519. width: 24rpx;
  520. height: 24rpx;
  521. margin-right: 20rpx;
  522. }
  523. .tongyi{
  524. font-size: 24rpx;
  525. font-family: Verdana, Verdana-Regular;
  526. font-weight: 400;
  527. color: #999999;
  528. display: inline-block;
  529. }
  530. .xieyi_text{
  531. font-size: 24rpx;
  532. font-family: Verdana, Verdana-Regular;
  533. font-weight: 400;
  534. color: #f07423;
  535. display: inline-block;
  536. }
  537. }
  538. .btn_next{
  539. width: calc(100% - 80rpx);
  540. box-sizing: border-box;
  541. margin-left: 40rpx;
  542. margin-right: 40rpx;
  543. height: 72rpx;
  544. line-height: 72rpx;
  545. background: #f07423;
  546. border-radius: 12rpx;
  547. font-size: 32rpx;
  548. font-family: Verdana, Verdana-Regular;
  549. font-weight: 400;
  550. text-align: center;
  551. color: #ffffff;
  552. position: absolute;
  553. bottom: 60rpx;
  554. left: 0;
  555. }
  556. }
  557. </style>