lockInfo.vue 13 KB

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