123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- <template>
- <view class="jpmain body">
- <componentLogin ref="refLogin" :check="0"
- @findByOpenId="findByOpenId"></componentLogin>
- <view class="Area Area1" v-if="pointAuthorize">
- <view class="top">
- <view class="name">附近地锁</view>
- <view class="value" @click="getUserLocation()">
- <img class="img" src="@/assets/img/homepage/riLine-restart-line.svg" alt="">
- 重新定位
- </view>
- </view>
- <view class="list">
- <view class="line" v-for="(item,i) in nearList"
- @click="gotoInfo(item)">
-
- <view class="itembody">
- <view class="itemhead">
- <img class="img" src="@/assets/img/index.png" alt="">
- </view>
- <view class="item" >
- <view class="name">
-
- {{item.name}}
- <span class="tag" v-if="item.userPreferred"> <u-icon name="star-fill" color="#FFAE00" size="24"></u-icon> 常用 </span>
-
- </view>
- <view class="item2" >
- <span class="span" :class="' status status'+item.status">{{item.status=='1'?'在线':'离线'}}</span><span class="span">|</span>
- <span class="span" :class="' lockStatus lockStatus'+item.lockStatus">{{item.lockStatusN}}</span>
-
-
- <template v-if="item.buildMode">
-
- <span class="span">|</span>
- <span class="span buildMode1" v-if="item.buildMode==1" >用户自建</span>
- <span class="span buildMode2" v-if="item.buildMode==2" >平台运营</span>
-
- </template>
- <span class="span">|</span>
- <view class="span spanEnd" >{{item.parkingName}}</view>
- </view>
- </view>
-
- </view>
-
- <view class="value">小于50米
- <u-icon name="arrow-right" color="#CCCCCC"></u-icon>
- </view>
- </view>
- </view>
-
- <u-empty text="50米内没有地锁" mode="list" margin-top="80" v-if="!nearList.length">
- <view slot="bottom">
- <view class="value-slot" @click="getUserLocation()">
- <img class="img" src="@/assets/img/homepage/riLine-restart-line.svg" alt="">
- 重新定位
- </view>
- </view>
- </u-empty>
- </view>
- <view class="Area Area2" v-if="otherList.length">
- <view class="top">
- <view class="name">全部地锁</view>
- </view>
- <view class="list">
- <view class="line" v-for="(item,i) in otherList" :key="i"
- @click="gotoInfo(item)">
-
-
- <view class="itembody">
- <view class="itemhead">
- <img class="img" src="@/assets/img/index.png" alt="">
- </view>
- <view class="item" >
- <view class="name">
-
- {{item.name}}
- <span class="tag" v-if="item.userPreferred" > <u-icon name="star-fill" color="#FFAE00" size="24"></u-icon> 常用 </span>
- </view>
- <view class="item2" >
- <span class="span" :class="' status status'+item.status">{{item.status=='1'?'在线':'离线'}}</span><span class="span">|</span>
- <span class="span" :class="' lockStatus lockStatus'+item.lockStatus">{{item.lockStatusN}}</span>
-
-
- <template v-if="item.buildMode">
-
- <span class="span">|</span>
- <span class="span buildMode1" v-if="item.buildMode==1" >用户自建</span>
- <span class="span buildMode2" v-if="item.buildMode==2" >平台运营</span>
-
- </template>
- <span class="span">|</span>
- <view class="span spanEnd" >{{item.parkingName}}</view>
- </view>
-
- </view>
-
- </view>
- <view class="value" v-if="item.distance" >{{distanceN(item.distance)}}<u-icon name="arrow-right" color="#CCCCCC"></u-icon></view>
- <view class="value" v-else ><u-icon name="arrow-right" color="#CCCCCC"></u-icon></view>
-
-
- </view>
- </view>
- </view>
- <u-tabbar v-model="current" :list="tabbarList"
- mid-button-size="112" :mid-button="true"
- @input="gotoinput"
- inactive-color="#ADB8C2" active-color="#5098FF">
- </u-tabbar>
- </view>
- </template>
- <script>
- import * as API from '@/apis/pagejs/pagesIndex.js'
- import componentLogin from '@/components/componentLogin.vue';
-
- import tabbar from '@/pages/business/as-components/Tabbar.vue';
-
- export default {
- components: {
- componentLogin,tabbar,
- },
- data() {
- return {
- current: 0,
- pointAuthorize:true,
- latitude: 30.337053,
- longitude: 112.240222,
-
- allList: [],
- isReady:true,
- point: false, //是否获取了定位
- tabbarList: [{
-
- iconPath:require("@/assets/img/tabBar/index1.png") ,
- selectedIconPath: require( "@/assets/img/tabBar/index1-HL.png"),
- text: '附近 ',
- pagePath2: "/pages/business/index",
- },
- {
- iconPath: require("@/assets/img/tabBar/parking_icon.png"),
- selectedIconPath: require("@/assets/img/tabBar/parking_icon.png"),
- text: '',
- pagePath2: "/pages/business/main",
- midButton: true,
- },
-
-
- {
- iconPath: require("@/assets/img/tabBar/center.png"),
- selectedIconPath: require("@/assets/img/tabBar/center-HL.png"),
-
- text: '我的',
- pagePath2: "/pages/business/center",
- }
- ],
- }
- },
- onLoad() {
- this.userInfo = this.jphelp.getPersonInfo()
-
- },
- onReady() {
- this.$refs.refLogin.findByOpenId()
- //this.getParkingList()
-
- },
- onShow() {
- if(this.isReady){
- if(this.point){
- // #ifdef MP-WEIXIN
- this.getUserLocation()
- // #endif
- }else{
- this.getParkingList()
- }
-
- }
- },
-
- computed: {
- otherList() {
- var sz = []
- for (var i in this.allList) {
- var item = this.allList[i]
- if (this.point) {
- if (item.distance > 1) {
- sz.push(item)
- }
- } else {
- sz.push(item)
- }
- }
- return sz
- },
- nearList() {
- var sz = []
- for (var i in this.allList) {
- var item = this.allList[i]
- if (this.point) {
- if (item.distance < 1) {
- sz.push(item)
- }
- } else {
- }
- }
- return sz
- }
- },
- methods: {
- gotoinput(i){
- var item=this.tabbarList[i]
- if(!item.pagePath){
- uni.reLaunch({
- url:item.pagePath2
- })
- }
- },
- gotoInfo(item){
- var url='pages/business/lockInfo?from=1&id='+item.id;
- if (this.point) {
- url+=`&point=1&longitude=${this.longitude}&latitude=${this.latitude}`
- }
- url+="&d="+new Date().getTime()
- this.gotoUrl(url)
- },
- getParkingList() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- var obj = {
- pageIndex: 1,
- pageSize: 999,
- radius: 999999999,
- }
- if (this.point) {
- obj.longitude = this.longitude
- obj.latitude = this.latitude
- }
- API.floorList(obj).then((res) => {
- this.allList = res.data.data
- console.log(this.nearList)
- uni.hideLoading();
- }).catch(error => {
- uni.hideLoading();
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- findByOpenId(res) {
- this.isReady=true
- // #ifdef MP-WEIXIN
- this.getUserLocation()
- // #endif
-
- this.getParkingList()
-
- },
- getUserLocation() {
- var _this=this
- uni.authorize({
- scope: 'scope.userLocation',
- success() {
- uni.getLocation({
- type: 'gcj02',
- altitude:true,
- isHighAccuracy:true,
- success: function(res) {
-
- console.log('当前位置的经度:' + res.longitude);
- console.log('当前位置的纬度:' + res.latitude);
- _this.point=true
- _this.longitude=res.longitude
- _this.latitude=res.latitude
- _this.getParkingList()
- }
- });
- }
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .body {
- padding: 32rpx;
- padding-top:40rpx;
- }
-
- .value-slot {
- color: rgba(22, 119, 255, 1);
- font-size: 24rpx;
- display: flex;
- align-items: center;
-
- .img {
- width: 28rpx;
- height: 28rpx;
- }
- }
- .Area {
- .img {
- margin: 0 8rpx;
- }
- margin-bottom: 32rpx;
- .top {
- margin-bottom: 8rpx;
- display: flex;
- justify-content: space-between;
- .name {
- color: rgba(51, 51, 51, 1);
- font-size: 32rpx;
- font-weight: bold;
- }
- .value {
- color: rgba(22, 119, 255, 1);
- font-size: 24rpx;
- display: flex;
- align-items: center;
- .img {
- width: 28rpx;
- height: 28rpx;
- }
- }
- }
- .list {
- .line{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .itemhead{
- display: flex;
- .img {
- width: 48rpx;
- height: 48rpx;
- }
- }
- .itembody{
- padding: 16rpx 0;
-
- display: flex;
- align-items: center;
- }
- .item {
- display: flex;
- flex-direction: column;
- padding-left: 16rpx;
- .name {
- color: rgba(51, 51, 51, 1);
- font-size: 32rpx;
- display: flex;
- align-items: center;
- //padding-bottom: 8rpx;
-
- .tag{
- font-size: 24rpx;
- color: rgba(255,174,0,1);
- border: 1px solid rgba(255,174,0,1);
- padding: 1px 8rpx;
- border-radius: 4px;
- margin-left: 8rpx;
- }
-
- }
-
-
- }
- .value {
- color: rgba(119, 119, 119, 1);
- white-space: pre;
- font-size: 24rpx;
- }
- .item2{
- display: flex;
- white-space: pre;
- color: rgba(119, 119, 119, 1);
-
- font-size: 24rpx;
- .span{
- margin-right: 12rpx;
- }
- .spanEnd{
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- width: 180rpx;
- }
- .status1{
- color: #4CAF50;
- }
- .lockStatus{
- color: #4CAF50;
- }
- .lockStatus1{
- color: #4CAF50;
- }
- .lockStatus2{
- color: #ff9800;
- }
- .lockStatus0{
- color: red;
- }
- .lockStatus4{
- color: red;
- }
- }
- }
-
- }
- }
- .Area2 {
- margin-top: 40rpx;
- .list {
- .line {
- border-bottom: 1px solid rgba(232, 232, 232, 1);
- ;
- }
- }
- }
-
- .buildMode{
- font-size: 24rpx;
- border: 1px solid #bbbbbb;
- border-radius: 4px;
- color: #1677ff;
- padding: 2rpx 8rpx;
- margin:0 8rpx;
-
- }
- .buildMode1{
- color: #1677ff;
- //border: 1px solid #1677ff;
- }
- .buildMode2{
- color:#4CAF50;
- //border: 1px solid #4CAF50;
- }
- </style>
|