lockInfo.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. <template>
  2. <view>
  3. <componentLogin ref="refLogin" :check="0"
  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. },
  161. data() {
  162. return {
  163. id: "",
  164. loading: true,
  165. usable:false,
  166. permission: false,
  167. loginBl:false,
  168. floorlockInfo: {
  169. lockStatusN:""
  170. },
  171. setIntervalId: "",
  172. showMessage: 0,
  173. content: "400-8899-619",
  174. openLockBl:false,
  175. closeLockBl:false,
  176. openModalBl: false,
  177. }
  178. },
  179. onLoad(op) {
  180. if(op.q){
  181. var val =decodeURIComponent(op.q);
  182. if(val&&val.indexOf("?id=")>-1){
  183. val=val.split("?id=")[1]
  184. if(val.indexOf("&")>-1){
  185. val=val.split("&")[0]
  186. }
  187. this.id = val
  188. }
  189. }
  190. if (op.id) {
  191. this.id = op.id
  192. uni.setNavigationBarTitle({
  193. title: "加载中..."
  194. })
  195. // this.$refs.refLogin.findByOpenId()
  196. } else {
  197. this.loading = true
  198. uni.setNavigationBarTitle({
  199. title: "降锁说明"
  200. })
  201. }
  202. },
  203. onShareTimeline(){
  204. if(this.id){
  205. return {
  206. title: '智泊e家-'+this.floorlockInfo.name,
  207. path: '/pages/business/lockInfo?id='+this.id ,
  208. }
  209. }else{
  210. return {
  211. title: '智泊e家',
  212. path: '/pages/index/index' ,
  213. }
  214. }
  215. },
  216. onShareAppMessage(res) {
  217. if (res.from === 'button') { // 来自页面内分享按钮
  218. //.log(res.target)
  219. }
  220. if(this.id){
  221. return {
  222. title: '智泊e家-'+this.floorlockInfo.name,
  223. path: '/pages/business/lockInfo?id='+this.id ,
  224. }
  225. }else{
  226. return {
  227. title: '智泊e家',
  228. path: '/pages/index/index' ,
  229. }
  230. }
  231. },
  232. onReady() {
  233. this.$refs.refLogin.findByOpenId()
  234. this.setIntervalId = setInterval(() => {
  235. this.getFloorlockDetails(1)
  236. }, 1000 * 3)
  237. this.jphelp.setInterval("lockInfo",this.setIntervalId)
  238. this.getFloorlockDetails()
  239. },
  240. onUnload() {
  241. //setInterval
  242. if (this.setIntervalId) {
  243. clearInterval(this.setIntervalId)
  244. }
  245. },
  246. methods: {
  247. findByOpenId(res) {
  248. },
  249. confirmPhone() {
  250. this.openModalBl = false;
  251. uni.makePhoneCall({
  252. phoneNumber: this.content //仅为示例
  253. });
  254. },
  255. gotoIndex() {
  256. uni.switchTab({
  257. url: "/pages/index/index"
  258. })
  259. },
  260. lockStatus1(){
  261. uni.showLoading({
  262. title: "加载中",
  263. mask: true,
  264. })
  265. var obj = {
  266. id: this.id,
  267. lockStatus:2
  268. }
  269. API.operateFloorlock(obj).then((res) => {
  270. uni.hideLoading();
  271. this.showMessage = true;
  272. this.getFloorlockDetails()
  273. setTimeout(() => {
  274. this.getFloorlockDetails(1)
  275. }, 1000 * 1)
  276. setTimeout(() => {
  277. this.getFloorlockDetails(1)
  278. }, 1000 * 2.5)
  279. }).catch(error => {
  280. uni.hideLoading();
  281. uni.showToast({
  282. title: error,
  283. icon: "none"
  284. })
  285. })
  286. },
  287. lockStatus2(){
  288. // uni.showToast({
  289. // title: "该车位已被占用...",
  290. // icon: "none"
  291. // })
  292. uni.showLoading({
  293. title: "加载中",
  294. mask: true,
  295. })
  296. var obj = {
  297. id: this.id,
  298. lockStatus:1
  299. }
  300. API.operateFloorlock(obj).then((res) => {
  301. uni.hideLoading();
  302. //this.showMessage = true;
  303. this.getFloorlockDetails()
  304. setTimeout(() => {
  305. this.getFloorlockDetails(1)
  306. }, 1000 * 1)
  307. setTimeout(() => {
  308. this.getFloorlockDetails(1)
  309. }, 1000 * 2.5)
  310. }).catch(error => {
  311. uni.hideLoading();
  312. uni.showToast({
  313. title: error,
  314. icon: "none"
  315. })
  316. })
  317. // #ifdef H5
  318. // #endif
  319. },
  320. lockStatus3(){
  321. uni.showToast({
  322. title: "下降中...",
  323. icon: "none"
  324. })
  325. },
  326. lockStatus0(){
  327. this.openModalBl=true;
  328. },
  329. loginconfirm(){
  330. this.$refs.refLogin.ashow()
  331. },
  332. operateBtn() {
  333. if(!this.jphelp.getPersonInfo().id){
  334. this.loginBl=true;
  335. }else if(this.floorlockInfo.status==0){
  336. this.lockStatus0()
  337. }else{
  338. if(this.floorlockInfo.lockStatus==4){
  339. this.lockStatus0() //异常
  340. }else if(this.floorlockInfo.lockStatus==1){
  341. //this.lockStatus1() //未使用
  342. this.openLockBl=true;
  343. }else if(this.floorlockInfo.lockStatus==2){
  344. //this.lockStatus2()
  345. //this.closeLockBl=true;
  346. //使用
  347. }else if(this.floorlockInfo.lockStatus==3){
  348. this.lockStatus3() //过程
  349. }
  350. }
  351. },
  352. getFloorlockDetails(bl) {
  353. if (!this.id) {
  354. return
  355. }
  356. if (!bl) {
  357. uni.showLoading({
  358. title: "加载中",
  359. mask: true,
  360. })
  361. }
  362. var obj = {
  363. id: this.id
  364. }
  365. API.floorlockDetails(obj).then((res) => {
  366. this.floorlockInfo = res.data.floorlockInfo
  367. // this.floorlockInfo.status=1;
  368. // this.floorlockInfo.lockStatus=1
  369. if(this.floorlockInfo.parkingPhone){
  370. this.content=this.floorlockInfo.parkingPhone
  371. }
  372. if (res.data.usable) {
  373. uni.setNavigationBarTitle({
  374. title: this.floorlockInfo.parkingName
  375. })
  376. this.loading = true
  377. } else {
  378. this.loading = false
  379. this.permission = true
  380. // #ifdef MP-WEIXIN
  381. uni.setBackgroundColor({
  382. backgroundColor: '#ffffff',
  383. })
  384. // #endif
  385. }
  386. if (!bl) {
  387. uni.hideLoading();
  388. }
  389. }).catch(error => {
  390. uni.hideLoading();
  391. uni.showToast({
  392. title: error,
  393. icon: "none"
  394. })
  395. })
  396. }
  397. },
  398. }
  399. </script>
  400. <style>
  401. page {
  402. background-color: rgba(242, 244, 246, 1);
  403. }
  404. </style>
  405. <style scoped lang="scss">
  406. /* styles.css */
  407. .page-role {
  408. padding-top: 120rpx;
  409. display: flex;
  410. flex-direction: column;
  411. align-items: center;
  412. .img {
  413. width: 500rpx;
  414. height: 500rpx;
  415. }
  416. .text1 {
  417. color: rgba(51, 51, 51, 1);
  418. font-weight: bold;
  419. font-size: 48rpx;
  420. margin-bottom: 16rpx;
  421. }
  422. .text2 {
  423. color: rgba(51, 51, 51, 1);
  424. font-size: 36rpx;
  425. margin-bottom: 200rpx;
  426. }
  427. .botton {
  428. border-radius: 100rpx;
  429. width: 360rpx;
  430. text-align: center;
  431. border: 1px solid rgba(187, 187, 187, 1);
  432. color: rgba(22, 119, 255, 1);
  433. padding: 16rpx;
  434. }
  435. }
  436. .body {
  437. padding: 32rpx;
  438. }
  439. .gradient-header {
  440. height: 0px;
  441. }
  442. .jpback {
  443. height: 400rpx;
  444. background: linear-gradient(180deg, rgba(203, 234, 255, 1) 0%, rgba(203, 234, 255, 0) 100%);
  445. }
  446. .page-top {
  447. padding: 40rpx;
  448. padding-top: 0rpx;
  449. display: flex;
  450. flex-direction: column;
  451. align-items: center;
  452. .name {
  453. width: 320rpx;
  454. height: 320rpx;
  455. display: flex;
  456. align-items: flex-end;
  457. .img {
  458. width: 320rpx;
  459. height: 320rpx;
  460. }
  461. .img2 {
  462. width: 320rpx;
  463. height: 140rpx;
  464. }
  465. }
  466. .value {
  467. //margin-top: 24rpx;
  468. font-size: 40rpx;
  469. font-weight: bold;
  470. color: #333333;
  471. }
  472. }
  473. .page {
  474. border-radius: 16rpx;
  475. background-color: rgba(255, 255, 255, 1);
  476. color: rgba(16, 16, 16, 1);
  477. padding: 32rpx;
  478. margin-bottom: 32rpx;
  479. font-size: 32rpx;
  480. color: rgb(16, 16, 16);
  481. .page-main {
  482. display: flex;
  483. justify-content: space-between;
  484. align-items: center;
  485. .name {
  486. color: rgba(51, 51, 51, 1);
  487. font-size: 36rpx;
  488. display: flex;
  489. flex-direction: column;
  490. .name-info{
  491. font-size: 36rpx;
  492. font-weight: bold;
  493. }
  494. .code-info{
  495. font-size: 24rpx;
  496. color: rgba(119,119,119,1);
  497. }
  498. }
  499. .tags{
  500. .tag {
  501. font-size: 24rpx;
  502. border: 1px solid rgba(187, 187, 187, 1);
  503. border-radius: 4px;
  504. background-color: rgba(22,119,255,1);
  505. color: rgba(255,255,255,1);
  506. padding: 1px 8rpx;
  507. margin-left: 8rpx;
  508. }
  509. .typeN1{
  510. background-color:#1677FF ;
  511. border: 1px solid #1677FF ;
  512. }
  513. .typeN2{
  514. background-color:#8161FF;
  515. border: 1px solid #8161FF;
  516. }
  517. .status1{
  518. background-color:#00B962;
  519. border: 1px solid #00B962;
  520. }
  521. .status0{
  522. background-color:#A7A2A2;
  523. border: 1px solid #A7A2A2;
  524. }
  525. }
  526. }
  527. .page-info{
  528. font-size: 24rpx;
  529. color: #777777;
  530. display: flex;
  531. justify-content: space-between;
  532. }
  533. .page-content {
  534. .step {
  535. margin-bottom: 16rpx;
  536. }
  537. .tip-title {
  538. color: #101010;
  539. font-size: 36rpx;
  540. font-weight: bold;
  541. margin-bottom: 24rpx;
  542. }
  543. .tip1 {
  544. .step {
  545. color: #101010
  546. }
  547. border-bottom: 1px solid rgba(241, 241, 241, 1);
  548. margin-bottom: 24rpx;
  549. padding-bottom: 8rpx;
  550. }
  551. .tip2 {
  552. .step {
  553. color: #333333
  554. }
  555. }
  556. }
  557. }
  558. .jpbutton {
  559. margin-top: 60rpx;
  560. border-radius: 100rpx;
  561. width: 400rpx;
  562. height: 84rpx;
  563. color: #fff;
  564. padding: 8rpx;
  565. display: flex;
  566. align-items: center;
  567. justify-content: center;
  568. font-size: 36rpx;
  569. .img {
  570. margin-right: 8rpx;
  571. width: 36rpx;
  572. height: 32rpx;
  573. }
  574. }
  575. .jpbutton1 {
  576. background-color: #2979FF;
  577. .img {
  578. width: 32rpx;
  579. height: 32rpx;
  580. }
  581. }
  582. .jpbutton2 {
  583. background-color: #2979FF;
  584. .img {
  585. width: 40rpx;
  586. height: 40rpx;
  587. animation: spin 2s linear infinite;
  588. /* 添加无限旋转动画 */
  589. }
  590. /* 定义旋转动画 */
  591. @keyframes spin {
  592. from {
  593. transform: rotate(0deg);
  594. /* 起始角度 */
  595. }
  596. to {
  597. transform: rotate(360deg);
  598. /* 结束角度 */
  599. }
  600. }
  601. }
  602. .jpbutton3 {
  603. background-color: #00B962;
  604. }
  605. .jpbutton4 {
  606. background-color: #A7A2A2;
  607. }
  608. .jpbutton6 {
  609. background-color: #FF7B00;
  610. }
  611. .jpbutton5 {
  612. background-color: #1677FF;
  613. }
  614. .showMessage {
  615. //padding: 24rpx 56rpx;
  616. padding: 40rpx 40rpx 60rpx 40rpx;
  617. .title {
  618. color: rgba(16, 16, 16, 1);
  619. font-size: 36rpx;
  620. margin-top: 32rpx;
  621. text-align: center;
  622. font-weight: bold;
  623. }
  624. .body {
  625. color: rgba(16, 16, 16, 1);
  626. font-size: 32rpx;
  627. padding-bottom: 66rpx;
  628. }
  629. }
  630. .valuestatus{
  631. display: flex;
  632. align-items: center;
  633. justify-content: space-around;
  634. border-radius: 8px;
  635. background: linear-gradient(180deg, rgba(229,240,255,1) 0%,rgba(255,255,255,1) 100%);
  636. color: rgba(16,16,16,1);
  637. font-size: 36rpx;
  638. text-align: center;
  639. box-shadow: 0px 2px 10px 0px rgba(110,170,255,0.5);
  640. border: 1px solid rgba(255,255,255,1);
  641. width: 686rpx;
  642. height: 120rpx;
  643. .bo1{
  644. width: 230rpx;
  645. display: flex;
  646. align-items: center;
  647. img{
  648. height: 48rpx;
  649. width: 48rpx;
  650. }
  651. }
  652. .bo2{
  653. height: 40rpx;
  654. border-left: 1px solid #9DA2A9 ;
  655. }
  656. span{
  657. margin-left: 16rpx;
  658. }
  659. }
  660. </style>