parkingDetails.vue 7.5 KB

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