parkingDetails.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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/business/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. sz.forEach(item=>{
  177. if(item.key!='parkingDetails'){
  178. this.findByOpenId()
  179. }
  180. })
  181. }
  182. },
  183. onReady() {
  184. //this.$refs.refLogin.findByOpenId()
  185. this.isReady=true;
  186. this.getParkingDetails()
  187. this.setIntervalId=setInterval(()=>{
  188. this.getParkingFloorlockList(1)
  189. },1000*3)
  190. this.jphelp.setInterval("parkingDetails",this.setIntervalId)
  191. },
  192. onUnload() {
  193. //setInterval
  194. if(this.setIntervalId){
  195. clearInterval(this.setIntervalId)
  196. }
  197. },
  198. computed:{
  199. },
  200. methods: {
  201. findByOpenId(res) {
  202. },
  203. clickStar(){
  204. //this.isStar=!this.isStar
  205. if(this.jphelp.getPersonInfo().id){
  206. this.setPreferred()
  207. }else{
  208. this.$refs.refLogin.ashow()
  209. }
  210. },
  211. gotoMain(){
  212. uni.switchTab({
  213. url:"/pages/index/index"
  214. })
  215. },
  216. setPreferred(){
  217. uni.showLoading({
  218. title: "加载中",
  219. mask: true,
  220. })
  221. var obj={
  222. id:this.id,
  223. preferred:!this.isStar
  224. }
  225. API.setPreferred(obj).then((res) => {
  226. this.getParkingDetails()
  227. }).catch(error => {
  228. uni.hideLoading();
  229. uni.showToast({
  230. title: error,
  231. icon: "none"
  232. })
  233. })
  234. },
  235. getParkingDetails(){
  236. uni.showLoading({
  237. title: "加载中",
  238. mask: true,
  239. })
  240. var obj={
  241. id:this.id
  242. }
  243. if(this.point){
  244. obj.longitude=this.longitude
  245. obj.latitude=this.latitude
  246. }
  247. API.parkingDetails(obj).then((res) => {
  248. this.parkingInfo=res.data.parkingInfo
  249. this.isStar=this.parkingInfo.userPreferred
  250. this.totalNum=this.parkingInfo.totalNum
  251. this.idleNum=this.parkingInfo.idleNum
  252. this.getParkingFloorlockList()
  253. uni.hideLoading();
  254. }).catch(error => {
  255. uni.hideLoading();
  256. uni.showToast({
  257. title: error,
  258. icon: "none"
  259. })
  260. })
  261. },
  262. gotoInfoLock(item){
  263. this.gotoUrl('pages/business/lockInfo?id='+item.id)
  264. },
  265. getParkingFloorlockList(bl){
  266. if(!bl){
  267. uni.showLoading({
  268. title: "加载中",
  269. mask: true,
  270. })
  271. }
  272. var obj={
  273. parkingId:this.id
  274. }
  275. API.parkingFloorlockList(obj).then((res) => {
  276. this.floorlockInfoList=res.data.floorlockInfoList
  277. if(!bl){
  278. uni.hideLoading();
  279. }
  280. }).catch(error => {
  281. uni.hideLoading();
  282. uni.showToast({
  283. title: error,
  284. icon: "none"
  285. })
  286. })
  287. }
  288. }
  289. }
  290. </script>
  291. <style scoped lang="scss">
  292. .title {
  293. background-color: rgba(22, 119, 255, 1);
  294. display: flex;
  295. justify-content: space-between;
  296. align-items: center;
  297. padding: 40rpx 32rpx;
  298. color: rgba(255, 255, 255, 1);
  299. .name {
  300. display: flex;
  301. align-items: center;
  302. .stationName {
  303. font-size: 40rpx;
  304. display: flex;
  305. align-items: center;
  306. .item1 {
  307. margin: 0 24rpx;
  308. }
  309. .img{
  310. width: 56rpx;
  311. height: 56rpx;
  312. }
  313. }
  314. .address {
  315. font-size: 28rpx;
  316. display: flex;
  317. align-items: center;
  318. .item1 {
  319. margin: 0 8rpx;
  320. }
  321. .img{
  322. width: 32rpx;
  323. height: 32rpx;
  324. }
  325. }
  326. }
  327. .value {
  328. display: flex;
  329. width: 160rpx;
  330. justify-content: space-around;
  331. .value1{
  332. display: flex;
  333. flex-direction: column;
  334. align-items: center;
  335. justify-content: space-between;
  336. .item1{
  337. .img{
  338. width: 48rpx;
  339. height: 48rpx;
  340. }
  341. }
  342. .item2 {
  343. font-size: 24rpx;
  344. }
  345. }
  346. }
  347. }
  348. .describe {
  349. font-size: 32rpx;
  350. color: rgba(119, 119, 119, 1);
  351. padding-bottom: 32rpx;
  352. border-bottom: 1px solid rgba(232, 232, 232, 1);
  353. .item1 {
  354. span {
  355. color: rgba(51, 51, 51, 1);
  356. }
  357. padding-bottom: 16rpx;
  358. }
  359. .item-a {
  360. span {
  361. font-weight: bold;
  362. color: rgba(51, 51, 51, 1);
  363. }
  364. }
  365. .item-b {
  366. span {
  367. color: rgba(0, 185, 98, 1);
  368. font-weight: bold;
  369. }
  370. }
  371. .item-c {
  372. color: rgba(22, 119, 255, 1);
  373. display: flex;
  374. align-items: center;
  375. .img{
  376. width: 32rpx;
  377. height: 32rpx;
  378. }
  379. }
  380. .item2 {
  381. display: flex;
  382. justify-content: space-between;
  383. }
  384. }
  385. .data {
  386. .info {
  387. margin: 32rpx 0;
  388. padding: 16rpx;
  389. display: flex;
  390. justify-content: space-between;
  391. border-radius: 8rpx;
  392. border: 1px solid rgba(216, 220, 226, 1);
  393. .value {
  394. display: flex;
  395. align-items: center;
  396. .item1 {
  397. margin-right: 40rpx;
  398. }
  399. .img {
  400. width: 32rpx;
  401. height: 32rpx;
  402. }
  403. span {
  404. margin-left: 8rpx;
  405. }
  406. }
  407. }
  408. .list {
  409. .item {
  410. display: flex;
  411. justify-content: space-between;
  412. align-items: center;
  413. margin-bottom: 32rpx;
  414. .name {
  415. display: flex;
  416. align-items: center;
  417. .name-text{
  418. width: 320rpx;
  419. .name-info{
  420. font-size: 36rpx;
  421. font-weight: bold;
  422. width: 320rpx;
  423. overflow: hidden;
  424. white-space: nowrap;
  425. text-overflow: ellipsis;
  426. }
  427. .code-info{
  428. font-size: 20rpx;
  429. color: rgba(119,119,119,1);
  430. }
  431. }
  432. .img {
  433. width: 48rpx;
  434. height: 48rpx;
  435. margin-right: 16rpx;
  436. padding: 12rpx;
  437. border-radius: 8rpx;
  438. }
  439. .color3{
  440. background-color: rgba(215,249,233,1);
  441. }
  442. .color4{
  443. background-color: rgba(255,237,198,1);
  444. }
  445. .color5{
  446. background-color: rgba(228,228,228,1);
  447. }
  448. }
  449. }
  450. }
  451. }
  452. .jpbutton {
  453. border-radius: 100rpx;
  454. width: 160rpx;
  455. color: #fff;
  456. padding: 8rpx;
  457. display: flex;
  458. align-items: center;
  459. justify-content: center;
  460. .img{
  461. margin-right: 8rpx;
  462. width: 32rpx;
  463. height: 32rpx;
  464. }
  465. }
  466. .jpbutton1 {
  467. background-color: #2979FF;
  468. .img {
  469. width: 32rpx;
  470. height: 32rpx;
  471. }
  472. }
  473. .jpbutton2 {
  474. background-color: #2979FF;
  475. .img {
  476. width: 40rpx;
  477. height: 40rpx;
  478. animation: spin 2s linear infinite;
  479. /* 添加无限旋转动画 */
  480. }
  481. /* 定义旋转动画 */
  482. @keyframes spin {
  483. from {
  484. transform: rotate(0deg);
  485. /* 起始角度 */
  486. }
  487. to {
  488. transform: rotate(360deg);
  489. /* 结束角度 */
  490. }
  491. }
  492. }
  493. .jpbutton3 {
  494. background-color: #00B962;
  495. }
  496. .jpbutton4 {
  497. background-color: #A7A2A2;
  498. }
  499. .jpbutton6 {
  500. background-color: #FF7B00;
  501. }
  502. .jpbutton5 {
  503. background-color: red;
  504. }
  505. </style>