lockInfo.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. <template>
  2. <view>
  3. <componentLogin ref="refLogin"
  4. @findByOpenId="findByOpenId"></componentLogin>
  5. <u-popup v-model="showMessage" mode="bottom" border-radius="30">
  6. <view class="showMessage">
  7. <view class="title">降锁成功</view>
  8. <view class="body">
  9. 车位锁已经降锁,请尽快驶入车位!<br />
  10. 若超过3分钟未停车,车位锁将自动升起上锁,如需继续使用请重新扫码降锁。
  11. </view>
  12. <view class="botton">
  13. <u-button @click="showMessage=false" type="primary" shape="square">知道了</u-button>
  14. </view>
  15. </view>
  16. </u-popup>
  17. <view class="jpmain " v-if="loading" >
  18. <view class="gradient-header">
  19. <view class="jpback">
  20. </view>
  21. </view>
  22. <view class="body" v-if="id" >
  23. <view class="page" v-if="floorlockInfo.id" >
  24. <view class="page-main">
  25. <view class="name">
  26. <view class="name-info">
  27. {{floorlockInfo.name}}
  28. </view>
  29. <view class="code-info">
  30. 编号:{{floorlockInfo.lockNo}}
  31. </view>
  32. </view>
  33. <view class=" tags" >
  34. <span class="tag typeN" :class="'typeN'+floorlockInfo.type">{{floorlockInfo.typeN}}</span>
  35. <span class="tag" :class="'status'+floorlockInfo.status">{{floorlockInfo.status==1?'在线':'离线'}}</span>
  36. </view>
  37. </view>
  38. <view class="page-info">
  39. <view class="info-span" v-if="floorlockInfo.lastOnlineTime">
  40. 更新时间:{{floorlockInfo.lastOnlineTime}}
  41. </view>
  42. <view class="info-span" v-if="floorlockInfo.batteryLevel" >
  43. 电压:{{floorlockInfo.batteryLevel}}V
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="page-top" v-if="id">
  49. <template v-if="floorlockInfo.status==0" >
  50. <view class="name">
  51. <img class="img" src="@/assets/img/lockstatus/index4.png" alt="">
  52. </view>
  53. </template>
  54. <template v-else>
  55. <view class="name" v-if="floorlockInfo.parkingStatus==1">
  56. <img class="img" src="@/assets/img/lockstatus/index3.png" alt="">
  57. </view>
  58. <view class="name" v-else-if="floorlockInfo.lockStatus==1">
  59. <img class="img" src="@/assets/img/lockstatus/index1.png" alt="">
  60. </view>
  61. <view class="name" v-else-if="floorlockInfo.lockStatus==3">
  62. <img class="img" src="@/assets/img/lockstatus/index2.png" alt="">
  63. </view>
  64. <view class="name" v-else-if="floorlockInfo.lockStatus==2">
  65. <img class="img" src="@/assets/img/lockstatus/index2.png" alt="">
  66. </view>
  67. <view class="name" v-else-if="floorlockInfo.lockStatus==4||floorlockInfo.lockStatus==0">
  68. <img class="img" src="@/assets/img/lockstatus/index4.png" alt="">
  69. </view>
  70. </template>
  71. <view class=" value" style="color:red;text-align: center;font-size: 28rpx;" v-if="floorlockInfo.lockStatus==2&&floorlockInfo.parkingStatus==0">
  72. 3分钟后自动抬锁,请尽快驶入车位
  73. </view>
  74. <view class=" valuestatus">
  75. <view class="bo1">
  76. <img src="@/assets/img/lockstatus/status2.svg"> <span>雷达</span> <span :style="floorlockInfo.parkingStatus==1?'color:#FF7B00':'color:#00B962'">{{floorlockInfo.parkingStatus==1?'有车':'无车'}}</span>
  77. </view>
  78. <view class="bo2">
  79. </view>
  80. <view class="bo1">
  81. <img src="@/assets/img/lockstatus/status1.svg"> <span>地锁</span>
  82. <span v-if="floorlockInfo.lockStatus==1||floorlockInfo.lockStatus==2|floorlockInfo.lockStatus==3">
  83. <u-icon color="#00B962" v-if="floorlockInfo.lockStatus==1" name="arrow-upward"></u-icon>
  84. <u-icon color="#8161FF" v-if="floorlockInfo.lockStatus==2" name="arrow-downward"></u-icon>
  85. <u-icon name="more-dot-fill" v-if="floorlockInfo.lockStatus==3"></u-icon>
  86. </span>
  87. <span v-else>
  88. 故障
  89. </span>
  90. </view>
  91. </view>
  92. <view class="valuebutton" @click="operateBtn">
  93. <template v-if="floorlockInfo.status==0" >
  94. <view class="jpbutton jpbutton5">
  95. <u-icon name="phone-fill" label="电话报修"
  96. color="#fff" label-color="#fff" label-size="36"></u-icon>
  97. </view>
  98. </template>
  99. <template v-else >
  100. <view class="jpbutton jpbutton6" v-if="floorlockInfo.parkingStatus==1">
  101. 该车位已被占用
  102. </view>
  103. <view class="jpbutton jpbutton1" v-else-if="floorlockInfo.lockStatus==1">
  104. <img class="img" src="@/assets/img/button/lock.svg" alt="">
  105. 降锁
  106. </view>
  107. <!-- <view class="jpbutton jpbutton6" v-else-if="floorlockInfo.lockStatus==2">
  108. 地锁降
  109. </view> -->
  110. <view class="jpbutton jpbutton4" v-else-if="floorlockInfo.lockStatus==3">
  111. 降锁中
  112. </view>
  113. <view class="jpbutton jpbutton5" v-else-if="floorlockInfo.lockStatus==4||floorlockInfo.lockStatus==0">
  114. <u-icon name="phone-fill" label="电话报修"
  115. color="#fff" label-color="#fff" label-size="36"></u-icon>
  116. </view>
  117. </template>
  118. </view>
  119. </view>
  120. <view class="body">
  121. <view class="page">
  122. <view class="page-content">
  123. <view class="tip1">
  124. <view class="step">1、从微信小程序入口进入停车场页面,或通过微信扫描位于充电桩或地锁上的二维码进入车位详情页面;</view>
  125. <view class="step">2、选择需要降锁的车位,点击“降锁”按钮,等待地锁降下后系统会提示降锁成功,此时即可将车辆驶入指定车位。</view>
  126. </view>
  127. <view class="tip2">
  128. <view class="tip-title">温馨提示</view>
  129. <view class="step">1、成功降锁后请于三分钟内将车辆驶入指定车位;超时地锁会自动升起,需重新扫码降锁;</view>
  130. <view class="step">2、请按降锁流程说明停车,严禁使用外力降锁;</view>
  131. <view class="step">3、地锁服务热线 400-8899-619。</view>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. <u-modal v-model="openLockBl" @confirm="lockStatus1" confirm-color="#00B962" :show-cancel-button="true"
  137. ref="uModal" title="提示" content="是否下降当前地锁?" confirm-text="开启"></u-modal>
  138. <u-modal v-model="closeLockBl" @confirm="lockStatus2" confirm-color="#fa3534" :show-cancel-button="true"
  139. ref="uModal" title="提示" content="是否结束使用当前地锁?" confirm-text="结束"></u-modal>
  140. <u-modal v-model="loginBl" @confirm="loginconfirm" :show-cancel-button="true"
  141. ref="uModal" title="提示" content="当前用户未登录,是否前往登录" confirm-text="登录"></u-modal>
  142. <u-modal v-model="openModalBl" @confirm="confirmPhone" confirm-text="拨打电话" confirm-color="#606266"
  143. :show-cancel-button="true" ref="uModal" :asyncClose="true" title="客服电话" :content="content"
  144. :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  145. </view>
  146. <view class="page-role" v-else>
  147. <img class="img" src="@/assets/img/nonwhitelist/info.png" alt="">
  148. <view class="text1">{{permission?'暂无权限':'加载中...'}}</view>
  149. <view class="text2" v-if="permission">此车位仅限车主及授权用户使用</view>
  150. <view class="botton" @click="gotoIndex" v-if="permission">返回首页</view>
  151. </view>
  152. </view>
  153. </template>
  154. <script>
  155. import * as API from '@/apis/pagejs/index.js'
  156. import componentLogin from '@/components/componentLogin.vue';
  157. export default {
  158. components: {
  159. componentLogin,
  160. //'u-modal': () => import('@/uni_modules/uview-ui/components/u-modal/u-modal'),
  161. //'u-popup': () => import('@/uni_modules/uview-ui/components/u-popup/u-popup'),
  162. //'u-button': () => import('@/uni_modules/uview-ui/components/u-button/u-button'),
  163. },
  164. data() {
  165. return {
  166. id: "",
  167. loading: true,
  168. usable:false,
  169. permission: false,
  170. loginBl:false,
  171. floorlockInfo: {
  172. lockStatusN:""
  173. },
  174. setIntervalId: "",
  175. showMessage: 0,
  176. content: "400-8899-619",
  177. openLockBl:false,
  178. closeLockBl:false,
  179. openModalBl: false,
  180. }
  181. },
  182. onLoad(op) {
  183. if(op.q){
  184. var val =decodeURIComponent(op.q);
  185. if(val&&val.indexOf("?id=")>-1){
  186. val=val.split("?id=")[1]
  187. if(val.indexOf("&")>-1){
  188. val=val.split("&")[0]
  189. }
  190. this.id = val
  191. }
  192. }
  193. if (op.id) {
  194. this.id = op.id
  195. uni.setNavigationBarTitle({
  196. title: "加载中..."
  197. })
  198. // this.$refs.refLogin.findByOpenId()
  199. } else {
  200. this.loading = true
  201. uni.setNavigationBarTitle({
  202. title: "降锁说明"
  203. })
  204. }
  205. },
  206. onShareTimeline(){
  207. if(this.id){
  208. return {
  209. title: '智泊e家-'+this.floorlockInfo.name,
  210. path: '/pages/business/lockInfo?id='+this.id ,
  211. }
  212. }else{
  213. return {
  214. title: '智泊e家',
  215. path: '/pages/index/index' ,
  216. }
  217. }
  218. },
  219. onShareAppMessage(res) {
  220. if (res.from === 'button') { // 来自页面内分享按钮
  221. //.log(res.target)
  222. }
  223. if(this.id){
  224. return {
  225. title: '智泊e家-'+this.floorlockInfo.name,
  226. path: '/pages/business/lockInfo?id='+this.id ,
  227. }
  228. }else{
  229. return {
  230. title: '智泊e家',
  231. path: '/pages/index/index' ,
  232. }
  233. }
  234. },
  235. onReady() {
  236. this.$refs.refLogin.findByOpenId()
  237. this.setIntervalId = setInterval(() => {
  238. this.getFloorlockDetails(1)
  239. }, 1000 * 3)
  240. this.jphelp.setInterval("lockInfo",this.setIntervalId)
  241. this.getFloorlockDetails()
  242. },
  243. onUnload() {
  244. //setInterval
  245. if (this.setIntervalId) {
  246. clearInterval(this.setIntervalId)
  247. }
  248. },
  249. methods: {
  250. findByOpenId(res) {
  251. },
  252. confirmPhone() {
  253. this.openModalBl = false;
  254. uni.makePhoneCall({
  255. phoneNumber: this.content //仅为示例
  256. });
  257. },
  258. gotoIndex() {
  259. uni.switchTab({
  260. url: "/pages/index/index"
  261. })
  262. },
  263. lockStatus1(){
  264. uni.showLoading({
  265. title: "加载中",
  266. mask: true,
  267. })
  268. var obj = {
  269. id: this.id,
  270. lockStatus:2
  271. }
  272. API.operateFloorlock(obj).then((res) => {
  273. uni.hideLoading();
  274. this.showMessage = true;
  275. this.getFloorlockDetails()
  276. setTimeout(() => {
  277. this.getFloorlockDetails(1)
  278. }, 1000 * 1)
  279. setTimeout(() => {
  280. this.getFloorlockDetails(1)
  281. }, 1000 * 2.5)
  282. }).catch(error => {
  283. uni.hideLoading();
  284. uni.showToast({
  285. title: error,
  286. icon: "none"
  287. })
  288. })
  289. },
  290. lockStatus2(){
  291. // uni.showToast({
  292. // title: "该车位已被占用...",
  293. // icon: "none"
  294. // })
  295. uni.showLoading({
  296. title: "加载中",
  297. mask: true,
  298. })
  299. var obj = {
  300. id: this.id,
  301. lockStatus:1
  302. }
  303. API.operateFloorlock(obj).then((res) => {
  304. uni.hideLoading();
  305. //this.showMessage = true;
  306. this.getFloorlockDetails()
  307. setTimeout(() => {
  308. this.getFloorlockDetails(1)
  309. }, 1000 * 1)
  310. setTimeout(() => {
  311. this.getFloorlockDetails(1)
  312. }, 1000 * 2.5)
  313. }).catch(error => {
  314. uni.hideLoading();
  315. uni.showToast({
  316. title: error,
  317. icon: "none"
  318. })
  319. })
  320. // #ifdef H5
  321. // #endif
  322. },
  323. lockStatus3(){
  324. uni.showToast({
  325. title: "下降中...",
  326. icon: "none"
  327. })
  328. },
  329. lockStatus0(){
  330. this.openModalBl=true;
  331. },
  332. loginconfirm(){
  333. this.$refs.refLogin.ashow()
  334. },
  335. operateBtn() {
  336. if(!this.jphelp.getPersonInfo().id){
  337. this.loginBl=true;
  338. }else if(this.floorlockInfo.status==0){
  339. this.lockStatus0()
  340. }else{
  341. if(this.floorlockInfo.lockStatus==4){
  342. this.lockStatus0() //异常
  343. }else if(this.floorlockInfo.lockStatus==1){
  344. //this.lockStatus1() //未使用
  345. this.openLockBl=true;
  346. }else if(this.floorlockInfo.lockStatus==2){
  347. //this.lockStatus2()
  348. //this.closeLockBl=true;
  349. //使用
  350. }else if(this.floorlockInfo.lockStatus==3){
  351. this.lockStatus3() //过程
  352. }
  353. }
  354. },
  355. getFloorlockDetails(bl) {
  356. if (!this.id) {
  357. return
  358. }
  359. if (!bl) {
  360. uni.showLoading({
  361. title: "加载中",
  362. mask: true,
  363. })
  364. }
  365. var obj = {
  366. id: this.id
  367. }
  368. API.floorlockDetails(obj).then((res) => {
  369. this.floorlockInfo = res.data.floorlockInfo
  370. // this.floorlockInfo.status=1;
  371. // this.floorlockInfo.lockStatus=1
  372. if(this.floorlockInfo.parkingPhone){
  373. this.content=this.floorlockInfo.parkingPhone
  374. }
  375. if (res.data.usable) {
  376. uni.setNavigationBarTitle({
  377. title: this.floorlockInfo.parkingName
  378. })
  379. this.loading = true
  380. } else {
  381. this.loading = false
  382. this.permission = true
  383. // #ifdef MP-WEIXIN
  384. uni.setBackgroundColor({
  385. backgroundColor: '#ffffff',
  386. })
  387. // #endif
  388. }
  389. if (!bl) {
  390. uni.hideLoading();
  391. }
  392. }).catch(error => {
  393. uni.hideLoading();
  394. uni.showToast({
  395. title: error,
  396. icon: "none"
  397. })
  398. })
  399. }
  400. },
  401. }
  402. </script>
  403. <style>
  404. page {
  405. background-color: rgba(242, 244, 246, 1);
  406. }
  407. </style>
  408. <style scoped lang="scss">
  409. /* styles.css */
  410. .page-role {
  411. padding-top: 120rpx;
  412. display: flex;
  413. flex-direction: column;
  414. align-items: center;
  415. .img {
  416. width: 500rpx;
  417. height: 500rpx;
  418. }
  419. .text1 {
  420. color: rgba(51, 51, 51, 1);
  421. font-weight: bold;
  422. font-size: 48rpx;
  423. margin-bottom: 16rpx;
  424. }
  425. .text2 {
  426. color: rgba(51, 51, 51, 1);
  427. font-size: 36rpx;
  428. margin-bottom: 200rpx;
  429. }
  430. .botton {
  431. border-radius: 100rpx;
  432. width: 360rpx;
  433. text-align: center;
  434. border: 1px solid rgba(187, 187, 187, 1);
  435. color: rgba(22, 119, 255, 1);
  436. padding: 16rpx;
  437. }
  438. }
  439. .body {
  440. padding: 32rpx;
  441. }
  442. .gradient-header {
  443. height: 0px;
  444. }
  445. .jpback {
  446. height: 400rpx;
  447. background: linear-gradient(180deg, rgba(203, 234, 255, 1) 0%, rgba(203, 234, 255, 0) 100%);
  448. }
  449. .page-top {
  450. padding: 40rpx;
  451. padding-top: 0rpx;
  452. display: flex;
  453. flex-direction: column;
  454. align-items: center;
  455. .name {
  456. width: 320rpx;
  457. height: 320rpx;
  458. display: flex;
  459. align-items: flex-end;
  460. .img {
  461. width: 320rpx;
  462. height: 320rpx;
  463. }
  464. .img2 {
  465. width: 320rpx;
  466. height: 140rpx;
  467. }
  468. }
  469. .value {
  470. //margin-top: 24rpx;
  471. font-size: 40rpx;
  472. font-weight: bold;
  473. color: #333333;
  474. }
  475. }
  476. .page {
  477. border-radius: 16rpx;
  478. background-color: rgba(255, 255, 255, 1);
  479. color: rgba(16, 16, 16, 1);
  480. padding: 32rpx;
  481. margin-bottom: 32rpx;
  482. font-size: 32rpx;
  483. color: rgb(16, 16, 16);
  484. .page-main {
  485. display: flex;
  486. justify-content: space-between;
  487. align-items: center;
  488. .name {
  489. color: rgba(51, 51, 51, 1);
  490. font-size: 36rpx;
  491. display: flex;
  492. flex-direction: column;
  493. .name-info{
  494. font-size: 36rpx;
  495. font-weight: bold;
  496. }
  497. .code-info{
  498. font-size: 24rpx;
  499. color: rgba(119,119,119,1);
  500. }
  501. }
  502. .tags{
  503. .tag {
  504. font-size: 24rpx;
  505. border: 1px solid rgba(187, 187, 187, 1);
  506. border-radius: 4px;
  507. background-color: rgba(22,119,255,1);
  508. color: rgba(255,255,255,1);
  509. padding: 1px 8rpx;
  510. margin-left: 8rpx;
  511. }
  512. .typeN1{
  513. background-color:#1677FF ;
  514. border: 1px solid #1677FF ;
  515. }
  516. .typeN2{
  517. background-color:#8161FF;
  518. border: 1px solid #8161FF;
  519. }
  520. .status1{
  521. background-color:#00B962;
  522. border: 1px solid #00B962;
  523. }
  524. .status0{
  525. background-color:#A7A2A2;
  526. border: 1px solid #A7A2A2;
  527. }
  528. }
  529. }
  530. .page-info{
  531. font-size: 24rpx;
  532. color: #777777;
  533. display: flex;
  534. justify-content: space-between;
  535. }
  536. .page-content {
  537. .step {
  538. margin-bottom: 16rpx;
  539. }
  540. .tip-title {
  541. color: #101010;
  542. font-size: 36rpx;
  543. font-weight: bold;
  544. margin-bottom: 24rpx;
  545. }
  546. .tip1 {
  547. .step {
  548. color: #101010
  549. }
  550. border-bottom: 1px solid rgba(241, 241, 241, 1);
  551. margin-bottom: 24rpx;
  552. padding-bottom: 8rpx;
  553. }
  554. .tip2 {
  555. .step {
  556. color: #333333
  557. }
  558. }
  559. }
  560. }
  561. .jpbutton {
  562. margin-top: 60rpx;
  563. border-radius: 100rpx;
  564. width: 400rpx;
  565. height: 84rpx;
  566. color: #fff;
  567. padding: 8rpx;
  568. display: flex;
  569. align-items: center;
  570. justify-content: center;
  571. font-size: 36rpx;
  572. .img {
  573. margin-right: 8rpx;
  574. width: 36rpx;
  575. height: 32rpx;
  576. }
  577. }
  578. .jpbutton1 {
  579. background-color: #2979FF;
  580. .img {
  581. width: 32rpx;
  582. height: 32rpx;
  583. }
  584. }
  585. .jpbutton2 {
  586. background-color: #2979FF;
  587. .img {
  588. width: 40rpx;
  589. height: 40rpx;
  590. animation: spin 2s linear infinite;
  591. /* 添加无限旋转动画 */
  592. }
  593. /* 定义旋转动画 */
  594. @keyframes spin {
  595. from {
  596. transform: rotate(0deg);
  597. /* 起始角度 */
  598. }
  599. to {
  600. transform: rotate(360deg);
  601. /* 结束角度 */
  602. }
  603. }
  604. }
  605. .jpbutton3 {
  606. background-color: #00B962;
  607. }
  608. .jpbutton4 {
  609. background-color: #A7A2A2;
  610. }
  611. .jpbutton6 {
  612. background-color: #FF7B00;
  613. }
  614. .jpbutton5 {
  615. background-color: #1677FF;
  616. }
  617. .showMessage {
  618. //padding: 24rpx 56rpx;
  619. padding: 40rpx 40rpx 60rpx 40rpx;
  620. .title {
  621. color: rgba(16, 16, 16, 1);
  622. font-size: 36rpx;
  623. margin-top: 32rpx;
  624. text-align: center;
  625. font-weight: bold;
  626. }
  627. .body {
  628. color: rgba(16, 16, 16, 1);
  629. font-size: 32rpx;
  630. padding-bottom: 66rpx;
  631. }
  632. }
  633. .valuestatus{
  634. display: flex;
  635. align-items: center;
  636. justify-content: space-around;
  637. border-radius: 8px;
  638. background: linear-gradient(180deg, rgba(229,240,255,1) 0%,rgba(255,255,255,1) 100%);
  639. color: rgba(16,16,16,1);
  640. font-size: 36rpx;
  641. text-align: center;
  642. box-shadow: 0px 2px 10px 0px rgba(110,170,255,0.5);
  643. border: 1px solid rgba(255,255,255,1);
  644. width: 686rpx;
  645. height: 120rpx;
  646. .bo1{
  647. width: 230rpx;
  648. display: flex;
  649. align-items: center;
  650. img{
  651. height: 48rpx;
  652. width: 48rpx;
  653. }
  654. }
  655. .bo2{
  656. height: 40rpx;
  657. border-left: 1px solid #9DA2A9 ;
  658. }
  659. span{
  660. margin-left: 16rpx;
  661. }
  662. }
  663. </style>