lockInfo.vue 16 KB

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