parkingDetails.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <view class="jpmain ">
  3. <view class="title">
  4. <view class="name">
  5. <view class="stationName">
  6. <img class="img" src="@/assets/img/parkingDetails/item1.png" alt="">
  7. <span class="item1">{{parkingInfo.name}}</span>
  8. </view>
  9. <view class="address" v-if="parkingInfo.distance">
  10. <img class="img" src="@/assets/img/if-location-pin@1x-2.png" alt="">
  11. <span class="item1">{{distanceN(parkingInfo.distance)}}</span>
  12. </view>
  13. </view>
  14. <view class="value" @click="gotoMain">
  15. <view class="item1">
  16. <img class="img" src="@/assets/img/parkingDetails/item2.png" alt="">
  17. </view>
  18. <view class="item2">切换</view>
  19. </view>
  20. </view>
  21. <view class="body">
  22. <view class="describe ">
  23. <view class="item1">
  24. 地址:<span>{{parkingInfo.address}}</span>
  25. </view>
  26. <view class="item2">
  27. <view class="item-a">
  28. 车位总数:<span>{{floorlockInfoList.length}}个</span>
  29. </view>
  30. <view class="item-b">
  31. 空闲车位:<span>{{idleNum}}个</span>
  32. </view>
  33. <view class="item-c" @click="gotoUrl('pages/index/main/lockInfo')">
  34. <img class="img" src="@/assets/img/if-location-pin@1x.png" alt="">
  35. 降锁说明
  36. </view>
  37. </view>
  38. </view>
  39. <u-empty text="列表为空" mode="list" margin-top="80" v-if="!floorlockInfoList.length"></u-empty>
  40. <view class="data " v-if="floorlockInfoList.length">
  41. <view class="info">
  42. <view class="name">请选择空闲车位</view>
  43. <view class="value">
  44. <img class="img" src="@/assets/img/parkingDetails/item3.png" alt="">
  45. <span class="item1">使用中</span>
  46. <img class="img" src="@/assets/img/parkingDetails/item4.png" alt="">
  47. <span>空闲</span>
  48. </view>
  49. </view>
  50. <view class="list">
  51. <view v-for="(item,i) in floorlockInfoList "
  52. @click="gotoInfoLock(item)"
  53. class="item" >
  54. <view class="name">
  55. <img class="img" v-if="item.lockStatus==0"
  56. src="@/assets/img/parkingDetails/item3.png" alt="">
  57. <img class="img" v-else
  58. src="@/assets/img/parkingDetails/item4.png" alt="">
  59. {{item.name}}
  60. </view>
  61. <view class="value">
  62. <view class="jpbutton jpbutton1" v-if="item.lockStatus==0" >
  63. <img class="img" src="@/assets/img/button/lock.png" alt="">
  64. 降锁
  65. </view>
  66. <view class="jpbutton jpbutton4" v-if="item.lockStatus==1">
  67. 使用中
  68. </view>
  69. <view class="jpbutton jpbutton5" v-if="item.lockStatus==2">
  70. 异常
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. import * as API from '@/apis/pagejs/index.js'
  81. export default {
  82. data() {
  83. return {
  84. id:"",
  85. floorlockInfo:{},
  86. floorlockInfoList:[],
  87. parkingInfo:[],
  88. latitude: 30.337053,
  89. longitude: 112.240222,
  90. point:false,//是否获取了定位
  91. setIntervalId:"",
  92. }
  93. },
  94. onLoad(op) {
  95. this.id=op.id
  96. this.getParkingDetails()
  97. },
  98. onReady() {
  99. this.setIntervalId=setInterval(()=>{
  100. this.getParkingFloorlockList(1)
  101. },1000*5)
  102. },
  103. onUnload() {
  104. //setInterval
  105. if(this.setIntervalId){
  106. clearInterval(this.setIntervalId)
  107. }
  108. },
  109. computed:{
  110. idleNum(){
  111. var num=0;
  112. this.floorlockInfoList.forEach(item=>{
  113. if(item.lockStatus==0){
  114. num++
  115. }
  116. })
  117. return num
  118. }
  119. },
  120. methods: {
  121. gotoMain(){
  122. uni.switchTab({
  123. url:"/pages/index/index"
  124. })
  125. },
  126. getParkingDetails(){
  127. uni.showLoading({
  128. title: "加载中",
  129. mask: true,
  130. })
  131. var obj={
  132. id:this.id
  133. }
  134. if(this.point){
  135. obj.longitude=this.longitude
  136. obj.latitude=this.latitude
  137. }
  138. API.parkingDetails(obj).then((res) => {
  139. this.parkingInfo=res.data.parkingInfo
  140. this.getParkingFloorlockList()
  141. uni.hideLoading();
  142. }).catch(error => {
  143. uni.hideLoading();
  144. uni.showToast({
  145. title: error,
  146. icon: "none"
  147. })
  148. })
  149. },
  150. gotoInfoLock(item){
  151. if(item.lockStatus==0){
  152. this.gotoUrl('pages/index/main/lockInfo?id='+item.id)
  153. }else if(item.lockStatus==1){
  154. uni.showToast({
  155. title: "使用中",
  156. icon: "none"
  157. })
  158. }else if(item.lockStatus==2){
  159. uni.showToast({
  160. title: "设备异常",
  161. icon: "none"
  162. })
  163. }
  164. },
  165. getParkingFloorlockList(bl){
  166. if(!bl){
  167. uni.showLoading({
  168. title: "加载中",
  169. mask: true,
  170. })
  171. }
  172. var obj={
  173. parkingId:this.id
  174. }
  175. API.parkingFloorlockList(obj).then((res) => {
  176. this.floorlockInfoList=res.data.floorlockInfoList
  177. if(!bl){
  178. uni.hideLoading();
  179. }
  180. }).catch(error => {
  181. uni.hideLoading();
  182. uni.showToast({
  183. title: error,
  184. icon: "none"
  185. })
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style scoped lang="scss">
  192. .title {
  193. background-color: rgba(22, 119, 255, 1);
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. padding: 40rpx 32rpx;
  198. color: rgba(255, 255, 255, 1);
  199. .name {
  200. display: flex;
  201. align-items: center;
  202. .stationName {
  203. font-size: 40rpx;
  204. display: flex;
  205. align-items: center;
  206. .item1 {
  207. margin: 0 24rpx;
  208. }
  209. .img{
  210. width: 56rpx;
  211. height: 56rpx;
  212. }
  213. }
  214. .address {
  215. font-size: 28rpx;
  216. display: flex;
  217. align-items: center;
  218. .item1 {
  219. margin: 0 8rpx;
  220. }
  221. .img{
  222. width: 32rpx;
  223. height: 32rpx;
  224. }
  225. }
  226. }
  227. .value {
  228. display: flex;
  229. flex-direction: column;
  230. align-items: center;
  231. .item1{
  232. .img{
  233. width: 36rpx;
  234. height: 36rpx;
  235. }
  236. }
  237. .item2 {
  238. font-size: 24rpx;
  239. }
  240. }
  241. }
  242. .describe {
  243. font-size: 32rpx;
  244. color: rgba(119, 119, 119, 1);
  245. padding-bottom: 32rpx;
  246. border-bottom: 1px solid rgba(232, 232, 232, 1);
  247. .item1 {
  248. span {
  249. color: rgba(51, 51, 51, 1);
  250. }
  251. padding-bottom: 16rpx;
  252. }
  253. .item-a {
  254. span {
  255. font-weight: bold;
  256. color: rgba(51, 51, 51, 1);
  257. }
  258. }
  259. .item-b {
  260. span {
  261. color: rgba(0, 185, 98, 1);
  262. font-weight: bold;
  263. }
  264. }
  265. .item-c {
  266. color: rgba(22, 119, 255, 1);
  267. display: flex;
  268. align-items: center;
  269. .img{
  270. width: 32rpx;
  271. height: 32rpx;
  272. }
  273. }
  274. .item2 {
  275. display: flex;
  276. justify-content: space-between;
  277. }
  278. }
  279. .data {
  280. .info {
  281. margin: 32rpx 0;
  282. padding: 16rpx;
  283. display: flex;
  284. justify-content: space-between;
  285. border-radius: 8rpx;
  286. border: 1px solid rgba(216, 220, 226, 1);
  287. .value {
  288. display: flex;
  289. align-items: center;
  290. .item1 {
  291. margin-right: 40rpx;
  292. }
  293. .img {
  294. width: 32rpx;
  295. height: 32rpx;
  296. }
  297. span {
  298. margin-left: 8rpx;
  299. }
  300. }
  301. }
  302. .list {
  303. .item {
  304. display: flex;
  305. justify-content: space-between;
  306. margin-bottom: 24rpx;
  307. .name {
  308. font-weight: bold;
  309. font-size: 36rpx;
  310. display: flex;
  311. align-items: center;
  312. .img {
  313. width: 50rpx;
  314. height: 50rpx;
  315. margin-right: 16rpx;
  316. }
  317. }
  318. }
  319. }
  320. }
  321. .jpbutton {
  322. border-radius: 100rpx;
  323. width: 160rpx;
  324. color: #fff;
  325. padding: 8rpx;
  326. display: flex;
  327. align-items: center;
  328. justify-content: center;
  329. .img{
  330. margin-right: 8rpx;
  331. width: 32rpx;
  332. height: 32rpx;
  333. }
  334. }
  335. .jpbutton1 {
  336. background-color: #2979FF;
  337. .img {
  338. width: 32rpx;
  339. height: 32rpx;
  340. }
  341. }
  342. .jpbutton2 {
  343. background-color: #2979FF;
  344. .img {
  345. width: 40rpx;
  346. height: 40rpx;
  347. animation: spin 2s linear infinite;
  348. /* 添加无限旋转动画 */
  349. }
  350. /* 定义旋转动画 */
  351. @keyframes spin {
  352. from {
  353. transform: rotate(0deg);
  354. /* 起始角度 */
  355. }
  356. to {
  357. transform: rotate(360deg);
  358. /* 结束角度 */
  359. }
  360. }
  361. }
  362. .jpbutton3 {
  363. background-color: #00B962;
  364. }
  365. .jpbutton4 {
  366. background-color: #A7A2A2;
  367. }
  368. .jpbutton5 {
  369. background-color: red;
  370. }
  371. </style>