info.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view :style="'padding-top:'+nvaHeight+'px;padding-bottom:40rpx'">
  3. <view class="navbox">
  4. <uni-nav-bar title="扫码开门" color="#ffffff" :background-color="backgroundColor" :border="false" statusBar='true' fixed="true">
  5. </uni-nav-bar>
  6. </view>
  7. <!-- 主体 -->
  8. <image :src="navbg" class="navbg"></image>
  9. <view class="yymain">
  10. <image :src="tlogo" class="tlogo"></image>
  11. <view class="ysec">
  12. <uni-forms ref="form" :value="user" >
  13. <view class="yttit">填写信息</view>
  14. <view class="ynum flexcc">
  15. <view class="ynlist">
  16. <image :src="tabaimg" class="ynimg"></image>
  17. <view class="yntit">扫描二维码</view>
  18. <image :src="line" class="ynline"></image>
  19. </view>
  20. <view class="ynlist">
  21. <image :src="tabbimg" class="ynimg"></image>
  22. <view class="yntit">填写信息</view>
  23. <image :src="line" class="ynline"></image>
  24. </view>
  25. <view class="ynlist">
  26. <image :src="tabcimg" class="ynimg"></image>
  27. <view class="yntit">点击开门</view>
  28. </view>
  29. </view>
  30. <view class="ysecbox">
  31. <uni-forms-item name="username" label="姓名">
  32. <uni-easyinput :inputBorder="false" v-model="username" placeholder="请输入姓名" />
  33. </uni-forms-item>
  34. <uni-forms-item name="phonenumber" label="手机号码">
  35. <uni-easyinput :inputBorder="false" type="number" v-model="phonenumber" placeholder="请输入手机号码" />
  36. </uni-forms-item>
  37. <uni-forms-item name="code" label="验证码">
  38. <uni-easyinput :inputBorder="false" v-model="code" placeholder="请输入验证码" />
  39. <view class="line flex0"></view>
  40. <view v-if="timefalg" class="code act">{{time}}秒</view>
  41. <view v-else @click="getCode" class="code">获取验证码</view>
  42. </uni-forms-item>
  43. </view>
  44. <view class="rbtn" @click="submit">开门</view>
  45. <view class="rtip">※ 温馨提示:请按流程完善信息后即可开门</view>
  46. <image :src="flogo" class="flogo"></image>
  47. </uni-forms>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import * as base64 from "base-64"
  54. import { getOpenDzFn,sendSmskmFn } from "@/api/mine/order.js"
  55. export default {
  56. components:{},
  57. data() {
  58. return {
  59. navbg:require("@/static/images/navbg.png"),
  60. tabaimg:require("@/static/images/order/one.png"),
  61. tabbimg:require("@/static/images/order/two.png"),
  62. tabcimg:require("@/static/images/order/three.png"),
  63. tlogo:require("@/static/images/order/tlogo.png"),
  64. flogo:require("@/static/images/order/flogo.png"),
  65. line:require("@/static/images/order/line.png"),
  66. timefalg:false,
  67. time:'',
  68. username:'',
  69. phonenumber:'',
  70. code:'',
  71. user:{},
  72. equipmentName:"",//设备id,
  73. nvaHeight:44,
  74. backgroundColor: "transparent",
  75. }
  76. },
  77. onReady() {
  78. },
  79. onPageScroll(e) {
  80. var scrollTop = Number(e.scrollTop);
  81. if (scrollTop > 0) {
  82. this.backgroundColor = '#0491FD'
  83. } else {
  84. this.backgroundColor = 'transparent'
  85. }
  86. },
  87. onLoad:function(e){
  88. var type=e.adr;
  89. if(type==1){
  90. this.equipmentName='后门抓拍一体机1';
  91. }
  92. uni.getSystemInfo({
  93. success: (e) => {
  94. this.nvaHeight = Number(e.statusBarHeight)+44;
  95. }
  96. })
  97. // this.equipmentName=e.adr;
  98. },
  99. methods: {
  100. submit() {
  101. var that = this;
  102. if (!this.username) {
  103. that.$toast("请输入姓名")
  104. return
  105. }
  106. if (!this.phonenumber) {
  107. that.$toast("请输入手机号")
  108. return
  109. }
  110. if (!this.code) {
  111. that.$toast("请输入验证码")
  112. return
  113. }
  114. let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
  115. if (this.phonenumber && !regphone.test(this.phonenumber)) {
  116. that.$toast("请输入正确的手机号")
  117. return
  118. }
  119. that.timefalg=false;
  120. that.time=60;
  121. clearInterval(that.timer)
  122. var params={
  123. "equipmentName":this.equipmentName,
  124. "loginName":this.username,
  125. "phoneNumber":this.phonenumber,
  126. "code": this.code
  127. }
  128. getOpenDzFn(params).then(res=>{
  129. if(res.code==200){
  130. that.$toast('已开门');
  131. that.code='';
  132. }
  133. })
  134. },
  135. // getDetail(data){
  136. // var s=base64.encode(data)
  137. // this.$tab.navigateTo('/a/code?id='+s)
  138. // },
  139. getCode(){
  140. var that=this;
  141. if (!this.phonenumber) {
  142. that.$toast("请输入手机号")
  143. return
  144. }
  145. let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
  146. if (this.phonenumber && !regphone.test(this.phonenumber)) {
  147. that.$toast("请输入正确的手机号")
  148. return
  149. }
  150. var params={
  151. username:this.phonenumber
  152. }
  153. sendSmskmFn(params).then(res=>{
  154. if (res.code == 200) {
  155. // 发送验证码
  156. that.$toast("发送成功")
  157. that.time=60;
  158. that.timefalg=true;
  159. that.setTimein()
  160. } else {
  161. that.$toast(res.msg)
  162. }
  163. // 判断是不是对等的
  164. // that.getCodesend(that.phonenumber)
  165. })
  166. },
  167. // 验证码倒计时
  168. setTimein(){
  169. var that=this;
  170. clearInterval(that.timer)
  171. that.timer=setInterval(()=>{
  172. if(that.time<=1){
  173. that.timefalg=false;
  174. that.time=60;
  175. clearInterval(that.timer)
  176. }
  177. that.time=that.time-1;
  178. },1000)
  179. },
  180. }
  181. }
  182. </script>
  183. <style lang="scss">
  184. // page {
  185. // background-color: #f5f5f5;
  186. // }
  187. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  188. .navbg{width: 100%;height: 692rpx;}
  189. .yymain{flex: 1;z-index: 2;position: relative;padding: 24rpx 34rpx;}
  190. .tlogo{width: 506rpx;height: 168rpx;margin-bottom: 36rpx;}
  191. .flogo{width: 254rpx;height: 68rpx;margin: 0 auto;}
  192. .ynum{margin-bottom: 24rpx;
  193. .ynlist{flex: 1;position: relative;display: flex;flex-direction: column;align-items: center;padding: 20rpx 0;
  194. .ynimg{width: 42rpx;height: 42rpx;margin-bottom: 12rpx;}
  195. .yntit{font-weight: 500;font-size: 24rpx;color: #0391FD;}
  196. .ynline{width: 102rpx;height: 18rpx;position: absolute;right: 0;transform: translateX(51rpx);}
  197. }
  198. }
  199. .rtip{font-weight: 500;margin-bottom: 48rpx;text-align: center;
  200. font-size: 20rpx;
  201. color: #0391FD;}
  202. .ysec{border-radius: 14rpx;background-color: #ffffff;padding: 8rpx 28rpx 40rpx;
  203. .rbtn{width: 100%;height: 90rpx;background: $com-cd3;border-radius: 14rpx;text-align: center;line-height: 90rpx;font-size: 28rpx;font-weight: bold;color: #FFFEFE;margin: 70rpx auto 20rpx;}
  204. .yttit{font-size: 28rpx;font-weight: bold;color: #161616;;min-height: 72rpx;display: flex;align-items: center;padding: 0rpx 26rpx;box-sizing: border-box;position: relative;
  205. &::before{content: '';width: 6rpx;height: 34rpx;background: $com-cd3;border-radius: 4rpx;position: absolute;top: 50%;transform: translateY(-50%);left: 0rpx;}
  206. }
  207. // .ysecbox{padding:0 34rpx;background: #ffffff;}
  208. }
  209. .searchlist{
  210. padding: 0 30rpx;margin-top: 30rpx;
  211. }
  212. .line{width: 2rpx;height: 24rpx;background: #CDCDCD;margin: 0 24rpx;}
  213. .code{font-size: 26rpx;color: $com-cd3;font-weight: 500;
  214. &.act{color: #666666;}
  215. }
  216. .ysec /deep/ .uni-forms .uni-forms-item{padding: 8rpx 26rpx 8rpx;margin-bottom: 0;border: 2rpx solid #0391FD;margin-bottom: 24rpx;border-radius: 6rpx;}
  217. .ysec /deep/ .uni-forms-item__label{flex: 0 0 auto;width: auto !important;font-size: 28rpx;font-weight: bold;position: relative;color: #343434;}
  218. .ysec /deep/ .uni-textarea-placeholder{font-size: 28rpx;color: #DDDDDD !important;}
  219. .ysec /deep/ .uni-easyinput__placeholder-class{font-size: 28rpx;color: #DDDDDD;}
  220. .ysec /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  221. .ysec /deep/ .uni-easyinput{flex: 1;text-align: right;}
  222. // .ysec /deep/ .uni-forms-item:last-child{border-bottom: none;}
  223. .ysec /deep/ .uni-easyinput__content-input{font-size: 28rpx;}
  224. .ysec /deep/ .uni-forms-item__error{margin-top:20rpx;left: auto;right: 0;}
  225. </style>