parkingDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. <template>
  2. <view class="jpmain ">
  3. <componentLogin ref="refLogin" :check="0"
  4. @findByOpenId="findByOpenId"></componentLogin>
  5. <view class="title">
  6. <view class="name">
  7. <view class="stationName">
  8. <img class="img" src="@/assets/img/parkingDetails/item1.svg" alt="">
  9. <span class="item1">{{parkingInfo.name}}</span>
  10. </view>
  11. <view class="address" v-if="parkingInfo.distance">
  12. <span class="item1">{{distanceN(parkingInfo.distance)}}</span>
  13. </view>
  14. </view>
  15. <view class="value" >
  16. <view class="value1" @click="clickStar">
  17. <view class="item1">
  18. <u-icon name="star-fill" v-if="isStar" size="48" color="#FFAE00"></u-icon>
  19. <u-icon name="star" v-else size="48" color="#fff"></u-icon>
  20. </view>
  21. <view class="item2">常用</view>
  22. </view>
  23. <view class="value1" @click="gotoMain" >
  24. <view class="item1">
  25. <img class="img" src="@/assets/img/parkingDetails/item2.svg" alt="">
  26. </view>
  27. <view class="item2">切换</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="body">
  32. <view class="describe ">
  33. <view class="item1">
  34. 地址:<span>{{parkingInfo.address}}</span>
  35. </view>
  36. <view class="item2">
  37. <view class="item-a">
  38. 地锁总数:<span>{{totalNum}}个</span>
  39. </view>
  40. <view class="item-b">
  41. 空闲地锁:<span>{{idleNum}}个</span>
  42. </view>
  43. <view class="item-c" @click="gotoUrl('pages/index/lockInfo')">
  44. <u-icon name="question-circle" color="#1677FF" label-color="#1677FF" label-size ="32" size="32" :margin-left="8" label="降锁说明"></u-icon>
  45. </view>
  46. </view>
  47. </view>
  48. <u-empty text="列表为空" mode="list" margin-top="80" v-if="!floorlockInfoList.length"></u-empty>
  49. <view class="data " v-if="floorlockInfoList.length">
  50. <view class="info">
  51. <view class="name">请选择空闲地锁</view>
  52. <view class="value">
  53. <img class="img " src="@/assets/img/parkingDetails/item4.svg" alt="">
  54. <span class="item1">使用中</span>
  55. <img class="img " src="@/assets/img/parkingDetails/item3.svg" alt="">
  56. <span class="item" >空闲</span>
  57. </view>
  58. </view>
  59. <view class="list">
  60. <view v-for="(item,i) in floorlockInfoList "
  61. class="item" @click="gotoInfoLock(item)" >
  62. <view class="name">
  63. <template v-if="item.status==0||item.lockStatus==4||item.lockStatus==0" >
  64. <img class="img color5"
  65. src="@/assets/img/parkingDetails/item5.svg" alt="">
  66. </template>
  67. <template v-else >
  68. <img class="img color4" v-if="item.parkingStatus==1"
  69. src="@/assets/img/parkingDetails/item4.svg" alt="">
  70. <img class="img color3" v-else
  71. src="@/assets/img/parkingDetails/item3.svg" alt="">
  72. </template>
  73. <view class="name-text">
  74. <view class="name-info">
  75. {{item.name}}
  76. </view>
  77. <view class="code-info">
  78. 编号:{{item.lockNo}}
  79. </view>
  80. </view>
  81. <view class="goto">
  82. <u-icon name="arrow-right" color="#BBBBBB"></u-icon>
  83. </view>
  84. </view>
  85. <view class="value" v-if="item.status==0" >
  86. <view class="jpbutton jpbutton4" >
  87. 离线
  88. </view>
  89. </view>
  90. <view class="value" v-else >
  91. <view class="jpbutton jpbutton6" v-if="item.parkingStatus==1">
  92. 使用中
  93. </view>
  94. <view class="jpbutton jpbutton1"
  95. v-else-if="item.lockStatus==1" >
  96. <img class="img" src="@/assets/img/button/lock.svg" alt="">
  97. 降锁
  98. </view>
  99. <view class="jpbutton jpbutton6" v-else-if="item.lockStatus==2">
  100. 地锁降
  101. </view>
  102. <view class="jpbutton jpbutton6"
  103. v-else-if="item.lockStatus==3" >
  104. 降锁中
  105. </view>
  106. <view class="jpbutton jpbutton4" v-else-if="item.lockStatus==4||item.lockStatus==0">
  107. 异常
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </template>
  116. <script>
  117. import * as API from '@/apis/pagejs/index.js'
  118. import componentLogin from '@/components/componentLogin.vue';
  119. export default {
  120. components: {
  121. componentLogin,
  122. },
  123. data() {
  124. return {
  125. id:"",
  126. floorlockInfo:{},
  127. floorlockInfoList:[],
  128. parkingInfo:[],
  129. latitude: 30.337053,
  130. longitude: 112.240222,
  131. point:false,//是否获取了定位
  132. setIntervalId:"",
  133. isStar:false,
  134. isReady:false,
  135. totalNum:0,
  136. idleNum:0,
  137. }
  138. },
  139. onLoad(op) {
  140. if(op.q){
  141. var val =decodeURIComponent(op.q);
  142. if(val&&val.indexOf("?id=")>-1){
  143. val=val.split("?id=")[1]
  144. if(val.indexOf("&")>-1){
  145. val=val.split("&")[0]
  146. }
  147. this.id = val
  148. }
  149. }
  150. this.id=op.id
  151. if(op.point){
  152. this.point=1
  153. this.latitude=op.latitude
  154. this.longitude=op.longitude
  155. console.log(op)
  156. }
  157. },
  158. onShareTimeline(){
  159. return {
  160. title: '智泊e家-'+this.parkingInfo.name,
  161. path: '/pages/index/main/parkingDetails?id='+this.id ,
  162. }
  163. },
  164. onShareAppMessage(res) {
  165. if (res.from === 'button') { // 来自页面内分享按钮
  166. //.log(res.target)
  167. }
  168. return {
  169. title: '智泊e家-'+this.parkingInfo.name,
  170. path: '/pages/index/main/parkingDetails?id='+this.id ,
  171. }
  172. },
  173. onShow(){
  174. if(this.isReady){
  175. var sz=this.jphelp.getInterval()
  176. if(sz){
  177. sz.forEach(item=>{
  178. if(item.key!='parkingDetails'){
  179. this.findByOpenId()
  180. }
  181. })
  182. }
  183. }
  184. },
  185. onReady() {
  186. //this.$refs.refLogin.findByOpenId()
  187. this.isReady=true;
  188. this.getParkingDetails()
  189. this.setIntervalId=setInterval(()=>{
  190. this.getParkingFloorlockList(1)
  191. },1000*3)
  192. this.jphelp.setInterval("parkingDetails",this.setIntervalId)
  193. },
  194. onUnload() {
  195. //setInterval
  196. if(this.setIntervalId){
  197. clearInterval(this.setIntervalId)
  198. }
  199. },
  200. computed:{
  201. },
  202. methods: {
  203. findByOpenId(res) {
  204. },
  205. clickStar(){
  206. //this.isStar=!this.isStar
  207. if(this.jphelp.getPersonInfo().id){
  208. this.setPreferred()
  209. }else{
  210. this.$refs.refLogin.ashow()
  211. }
  212. },
  213. gotoMain(){
  214. uni.switchTab({
  215. url:"/pages/index/index"
  216. })
  217. },
  218. setPreferred(){
  219. uni.showLoading({
  220. title: "加载中",
  221. mask: true,
  222. })
  223. var obj={
  224. id:this.id,
  225. preferred:!this.isStar
  226. }
  227. API.setPreferred(obj).then((res) => {
  228. this.getParkingDetails()
  229. }).catch(error => {
  230. uni.hideLoading();
  231. uni.showToast({
  232. title: error,
  233. icon: "none"
  234. })
  235. })
  236. },
  237. getParkingDetails(){
  238. uni.showLoading({
  239. title: "加载中",
  240. mask: true,
  241. })
  242. var obj={
  243. id:this.id
  244. }
  245. if(this.point){
  246. obj.longitude=this.longitude
  247. obj.latitude=this.latitude
  248. }
  249. API.parkingDetails(obj).then((res) => {
  250. this.parkingInfo=res.data.parkingInfo
  251. this.isStar=this.parkingInfo.userPreferred
  252. this.totalNum=this.parkingInfo.totalNum
  253. this.idleNum=this.parkingInfo.idleNum
  254. this.getParkingFloorlockList()
  255. uni.hideLoading();
  256. }).catch(error => {
  257. uni.hideLoading();
  258. uni.showToast({
  259. title: error,
  260. icon: "none"
  261. })
  262. })
  263. },
  264. gotoInfoLock(item){
  265. this.gotoUrl('pages/index/lockInfo?id='+item.id)
  266. },
  267. getParkingFloorlockList(bl){
  268. if(!bl){
  269. uni.showLoading({
  270. title: "加载中",
  271. mask: true,
  272. })
  273. }
  274. var obj={
  275. parkingId:this.id
  276. }
  277. API.parkingFloorlockList(obj).then((res) => {
  278. this.floorlockInfoList=res.data.floorlockInfoList
  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 scoped lang="scss">
  294. .title {
  295. background-color: rgba(22, 119, 255, 1);
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. padding: 40rpx 32rpx;
  300. color: rgba(255, 255, 255, 1);
  301. .name {
  302. display: flex;
  303. align-items: center;
  304. .stationName {
  305. font-size: 40rpx;
  306. display: flex;
  307. align-items: center;
  308. .item1 {
  309. margin: 0 24rpx;
  310. }
  311. .img{
  312. width: 56rpx;
  313. height: 56rpx;
  314. }
  315. }
  316. .address {
  317. font-size: 28rpx;
  318. display: flex;
  319. align-items: center;
  320. .item1 {
  321. margin: 0 8rpx;
  322. }
  323. .img{
  324. width: 32rpx;
  325. height: 32rpx;
  326. }
  327. }
  328. }
  329. .value {
  330. display: flex;
  331. width: 160rpx;
  332. justify-content: space-around;
  333. .value1{
  334. display: flex;
  335. flex-direction: column;
  336. align-items: center;
  337. justify-content: space-between;
  338. .item1{
  339. .img{
  340. width: 48rpx;
  341. height: 48rpx;
  342. }
  343. }
  344. .item2 {
  345. font-size: 24rpx;
  346. }
  347. }
  348. }
  349. }
  350. .describe {
  351. font-size: 32rpx;
  352. color: rgba(119, 119, 119, 1);
  353. padding-bottom: 32rpx;
  354. border-bottom: 1px solid rgba(232, 232, 232, 1);
  355. .item1 {
  356. span {
  357. color: rgba(51, 51, 51, 1);
  358. }
  359. padding-bottom: 16rpx;
  360. }
  361. .item-a {
  362. span {
  363. font-weight: bold;
  364. color: rgba(51, 51, 51, 1);
  365. }
  366. }
  367. .item-b {
  368. span {
  369. color: rgba(0, 185, 98, 1);
  370. font-weight: bold;
  371. }
  372. }
  373. .item-c {
  374. color: rgba(22, 119, 255, 1);
  375. display: flex;
  376. align-items: center;
  377. .img{
  378. width: 32rpx;
  379. height: 32rpx;
  380. }
  381. }
  382. .item2 {
  383. display: flex;
  384. justify-content: space-between;
  385. }
  386. }
  387. .data {
  388. .info {
  389. margin: 32rpx 0;
  390. padding: 16rpx;
  391. display: flex;
  392. justify-content: space-between;
  393. border-radius: 8rpx;
  394. border: 1px solid rgba(216, 220, 226, 1);
  395. .value {
  396. display: flex;
  397. align-items: center;
  398. .item1 {
  399. margin-right: 40rpx;
  400. }
  401. .img {
  402. width: 32rpx;
  403. height: 32rpx;
  404. }
  405. span {
  406. margin-left: 8rpx;
  407. }
  408. }
  409. }
  410. .list {
  411. .item {
  412. display: flex;
  413. justify-content: space-between;
  414. align-items: center;
  415. margin-bottom: 32rpx;
  416. .name {
  417. display: flex;
  418. align-items: center;
  419. .name-text{
  420. width: 320rpx;
  421. .name-info{
  422. font-size: 36rpx;
  423. font-weight: bold;
  424. width: 320rpx;
  425. overflow: hidden;
  426. white-space: nowrap;
  427. text-overflow: ellipsis;
  428. }
  429. .code-info{
  430. font-size: 20rpx;
  431. color: rgba(119,119,119,1);
  432. }
  433. }
  434. .img {
  435. width: 48rpx;
  436. height: 48rpx;
  437. margin-right: 16rpx;
  438. padding: 12rpx;
  439. border-radius: 8rpx;
  440. }
  441. .color3{
  442. background-color: rgba(215,249,233,1);
  443. }
  444. .color4{
  445. background-color: rgba(255,237,198,1);
  446. }
  447. .color5{
  448. background-color: rgba(228,228,228,1);
  449. }
  450. }
  451. }
  452. }
  453. }
  454. .jpbutton {
  455. border-radius: 100rpx;
  456. width: 160rpx;
  457. color: #fff;
  458. padding: 8rpx;
  459. display: flex;
  460. align-items: center;
  461. justify-content: center;
  462. .img{
  463. margin-right: 8rpx;
  464. width: 32rpx;
  465. height: 32rpx;
  466. }
  467. }
  468. .jpbutton1 {
  469. background-color: #2979FF;
  470. .img {
  471. width: 32rpx;
  472. height: 32rpx;
  473. }
  474. }
  475. .jpbutton2 {
  476. background-color: #2979FF;
  477. .img {
  478. width: 40rpx;
  479. height: 40rpx;
  480. animation: spin 2s linear infinite;
  481. /* 添加无限旋转动画 */
  482. }
  483. /* 定义旋转动画 */
  484. @keyframes spin {
  485. from {
  486. transform: rotate(0deg);
  487. /* 起始角度 */
  488. }
  489. to {
  490. transform: rotate(360deg);
  491. /* 结束角度 */
  492. }
  493. }
  494. }
  495. .jpbutton3 {
  496. background-color: #00B962;
  497. }
  498. .jpbutton4 {
  499. background-color: #A7A2A2;
  500. }
  501. .jpbutton6 {
  502. background-color: #FF7B00;
  503. }
  504. .jpbutton5 {
  505. background-color: red;
  506. }
  507. </style>