Commit ee69fbcd by 前端

定位

1 parent 7497e403
......@@ -59,13 +59,6 @@ Page({
wx.p.router.back()
},
handleSure() {
wx.requestSubscribeMessage({
tmplIds: ['ctivVQAIoDzv1OKlcI9cXiJpyKZBUP1XamO8sBP8ij0'],
miniprogram_state: wx.getAccountInfoSync().miniProgram.envVersion == 'trial'?'trial':'formal',
success(res) {
}
})
let { detailInfo, startTime, endTime } = this.data
if (!startTime) {
wx.showToast({
......@@ -90,7 +83,11 @@ Page({
wx.requestSubscribeMessage({
tmplIds: ['ctivVQAIoDzv1OKlcI9cXiJpyKZBUP1XamO8sBP8ij0'],
success(res) {
wx.showToast({
title: '订阅成功',
icon: 'none'
})
wx.p.router.back()
}
})
})
......
/* packageEquity/pages/parking/detail/detail.wxss */
.box {
margin: 0rpx 30rpx;
margin: 30rpx 30rpx 0rpx;
}
.swiper-box {
......@@ -27,7 +27,6 @@ swiper {
.empty-box {
height: 50vh;
.empty-img {
width: 100%;
height: 50vh;
......@@ -37,13 +36,17 @@ swiper {
.swiper-item {
width: 100%;
height: 100%;
image {
border-radius: 8rpx 8rpx 0 0;
}
}
.location-box,
.remind-box {
background: #ffffff;
padding: 24rpx;
margin-bottom: 30rpx;
margin-bottom: 34rpx;
}
.location-num {
......@@ -51,19 +54,27 @@ swiper {
font-size: 32rpx;
color: #333333;
display: flex;
margin: 4rpx 0px;
.parking-logo {
width: 48rpx;
height: 48rpx;
margin-right: 6rpx;
}
text {
display: inline-block;
width: 680rpx;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
.location-status {
margin-top: 10rpx;
text {
margin-left: 10rpx;
margin-left: 18rpx;
display: inline-block;
width: 64rpx;
height: 32rpx;
......@@ -108,7 +119,7 @@ swiper {
display: flex;
align-items: center;
justify-content: center;
margin-top: 40rpx;
margin-top: 32rpx;
.picker {
width: 284rpx;
......
<view class="box">
<view class="swiper-box" wx:if="{{detailInfo.parkingStatus == 2}}">
<view class="swiper-box" wx:if="{{detailInfo.parkingSpaceImgList.length}}">
<swiper circular bindchange="onChange" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
......
// packageEquity/pages/parking/index/index.js
const STATUS = [{
label: '空闲', value: 1,name:'idleStatusCount'
label: '空闲', value: 1, name: 'idleStatusCount'
},
{
label: '占用', value: 2,name:'occupyStatusCount'
label: '占用', value: 2, name: 'occupyStatusCount'
},
{
label: '未知', value: 0,name:'unknowStatusCount'
label: '未知', value: 0, name: 'unknowStatusCount'
}
]
Page({
......@@ -15,18 +15,80 @@ Page({
* 页面的初始数据
*/
data: {
isRotate:false,
animationData: {},
drawerHeight: 456, // 当前抽屉的高度
touchStartY: 0, // 触摸起始位置
touchMoveY: 0, // 触摸移动位置
drawerExpanded: false, // 抽屉是否展开的标志
isRotate: false,
boxHeight: 456,
scale:16,
scale: 16,
markers: [],
STATUS,
tabIndex: [1],
tabIndex: '',
customCalloutMarkerIds: [],
num: 1,
},
touchStart(event) {
this.setData({
touchStartY: event.touches[0].clientY
});
},
touchMove(event) {
const { touchStartY, drawerHeight } = this.data;
const touchMoveY = event.touches[0].clientY;
const diffY = touchMoveY - touchStartY;
const newDrawerHeight = Math.max(drawerHeight - diffY, 0); // 根据实际需求设置抽屉的最小高度
const animation = wx.createAnimation({
duration: 0
});
animation.height(newDrawerHeight + 'rpx').step();
this.setData({
animationData: animation.export(),
drawerHeight: newDrawerHeight
});
},
touchEnd() {
const { drawerHeight } = this.data;
const { windowHeight } = wx.getSystemInfoSync();
if (drawerHeight > windowHeight * 0.5) {
// 抽屉高度大于屏幕高度的一半时,展开抽屉
this.expandDrawer();
} else {
// 否则收起抽屉
this.collapseDrawer();
}
},
expandDrawer() {
// const animation = wx.createAnimation({
// duration: 300,
// timingFunction: 'ease-out'
// });
// animation.height('100%').step();
this.setData({
drawerHeight: 850,
drawerExpanded: true
});
},
collapseDrawer() {
this.setData({
drawerHeight: 456,
});
},
pullH() {
const {boxHeight} = this.data
this.setData({boxHeight: boxHeight == 850?456:850})
const { boxHeight } = this.data
this.setData({ boxHeight: boxHeight == 850 ? 456 : 850 })
},
getCarPosition(latitude, longitude) {
const normalCallout = {
......@@ -37,21 +99,24 @@ Page({
height: 32,
iconPath: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/home/parking/location.png',
}
const {markers} = this.data
const { markers } = this.data
this.setData({
latitude, longitude,
markers: [normalCallout,...markers],
markers: [normalCallout, ...markers],
})
},
handleRefresh() {
this.parkingSpaceList()
this.setData({isRotate:true})
setTimeout(()=>{
this.setData({isRotate:false})
},1000)
},
getAllParking() {
wx.p.api.equityApi.parkingSpaceList({ locateFlag: 1 }).then(res => {
this.setData({ isRotate: true })
setTimeout(() => {
this.setData({ isRotate: false })
}, 1000)
},
getAllParking() {
let {
merchantId
} = wx.p.storage.get('merchant_info')
wx.p.api.equityApi.parkingSpaceList({ locateFlag: 1,merchantId }).then(res => {
const normalCallout = [], list = res.responseList || [];
list.forEach((item, index) => {
normalCallout.push({
......@@ -62,11 +127,11 @@ Page({
height: 32,
iconPath: `https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/home/parking/${item.parkingStatus == 1 ? 'idle' : item.parkingStatus == 2 ? 'occupy' : 'unknown'}.png`,
callout: {
content: `车位编号${item.parkingArea}-${item.parkingBuilding}-${item.parkingFloor} >`,
content: `${item.parkingArea}-${item.parkingBuilding}-${item.parkingFloor} >`,
color: '#666',
fontSize: 10,
borderWidth: 1,
borderRadius:22,
borderRadius: 22,
borderColor: '#FFFFFF',
padding: 6,
display: 'BYCLICK',
......@@ -74,22 +139,24 @@ Page({
},
})
})
const {markers} = this.data
this.setData({ markers: [...normalCallout,...markers],parking:res,isEmpty:normalCallout.length })
const { markers } = this.data
this.setData({ markers: [...normalCallout, ...markers], isEmpty: normalCallout.length })
})
},
parkingSpaceList() {
let { tabIndex } = this.data
wx.p.api.equityApi.parkingSpaceList({ locateFlag: 1, parkingStatusList: tabIndex }).then(res => {
let { tabIndex } = this.data ,{
merchantId
} = wx.p.storage.get('merchant_info')
wx.p.api.equityApi.parkingSpaceList({ locateFlag: 1, parkingStatusList: tabIndex === ''?null:[tabIndex],merchantId }).then(res => {
const list = res.responseList || [];
this.setData({ carList: list })
this.setData({ carList: list, parking: res })
})
},
/**
* 点击冒泡
*/
/**
* 点击冒泡
*/
callouttap(e) {
wx.p.router.go('/packageEquity/pages/parking/detail/detail', { id:e.markerId })
wx.p.router.go('/packageEquity/pages/parking/detail/detail', { id: e.markerId })
},
tolower() {
console.log(88)
......@@ -101,7 +168,7 @@ Page({
this.parkingSpaceList()
this.getAllParking()
wx.getLocation({
type: 'wgs84',
type: 'gcj02',
success: res => {
this.getCarPosition(res.latitude, res.longitude)
}
......@@ -116,20 +183,15 @@ Page({
console.log(mpCtx)
// 将地图缩放值改为初始值
this.setData({
scale: 16
scale: 16
})
},
},
markertap(e) {
},
selectTab(e) {
[1,2,3].indexOf(3)
const { index } = e.currentTarget.dataset,{tabIndex} = this.data,k = tabIndex.indexOf(index)
if (k<0) {
tabIndex.push(index)
}else {
tabIndex.splice(k,1)
}
this.setData({ tabIndex }, () => {
let { index } = e.currentTarget.dataset,{tabIndex} = this.data;
if(tabIndex === index) index = ''
this.setData({ tabIndex:index }, () => {
this.parkingSpaceList()
})
},
......
......@@ -6,26 +6,36 @@
#myMap {
width: 100%;
position: relative;
position: absolute;
top: 0rpx;
height: calc(100vh - 456rpx);
left: 0rpx;
}
.draw-box {
width: 100%;
height: 456rpx;
border-radius: 32rpx 32rpx 0 0;
transition: all ease 1s;
margin-top: -10rpx;
background: #f8f8f8;
position: absolute;
bottom: 0rpx;
left: 0rpx;
}
.cover-view {
width: 64rpx;
height: 64rpx;
width: 112rpx;
height: 112rpx;
position: absolute;
bottom: 20rpx;
right: 20rpx;
transition: all ease 1s;
}
.draw-tab {
display: flex;
margin: 20rpx;
margin: 0rpx 20rpx 10rpx;
align-items: center;
.tab-item {
......@@ -58,7 +68,6 @@
width: 32rpx;
height: 32rpx;
margin-left: 4rpx;
margin-top: 2px;
&.rotate {
transition: all 1s;
......@@ -69,9 +78,9 @@
}
.draw-header {
height: 56px;
height: 112rpx;
background-image: linear-gradient(180deg, #D6E8FE 0%, #F8F8F8 100%);
border-radius: 16px 16px 0 0;
border-radius: 32rpx 32rpx 0 0;
display: flex;
align-items: center;
padding: 0rpx 24rpx;
......@@ -80,7 +89,8 @@
.parking-arrow-icon {
position: absolute;
width: 72rpx;
height: 25rpx;
height: 8rpx;
border-radius: 4rpx;
left: 350rpx;
top: 10rpx;
z-index: 10000;background: #FFFFFF;
......@@ -137,14 +147,23 @@
width: 44rpx;
height: 44rpx;
margin-right: 6rpx;
margin-top: -15rpx;
}
.parking-desc {
width: calc(100% - 200rpx);
.parking-num {
font-weight: 600;
font-size: 28rpx;
color: #333333;
line-height: 44rpx;
margin-bottom: 10rpx;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
&.disabeld {
color: #999999;
}
}
.parking-status {
......@@ -169,6 +188,7 @@
&.unknown {
color: #999999;
background: #9999991a;
border: 1rpx solid #99999933;
border-radius: 4rpx;
}
......
<wxs module="jstools" src="includes.wxs"></wxs>
<view class="map-box">
<map id="myMap" style="height:calc(100vh - {{boxHeight}}rpx)" latitude="{{latitude}}" longitude="{{longitude}}" bindmarkertap="markertap" bindcallouttap="callouttap" bindlabeltap="labeltap" markers="{{markers}}" scale="{{scale}}">
<cover-view class="cover-view" bindtap="controltap">
<cover-image class="station" src="https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/home/parking/position.png"></cover-image>
<map id="myMap" latitude="{{latitude}}" longitude="{{longitude}}" bindmarkertap="markertap" bindcallouttap="callouttap" bindlabeltap="labeltap" markers="{{markers}}" scale="{{scale}}">
<cover-view style="bottom:{{drawerHeight == 456?20:400}}rpx" class="cover-view" bindtap="controltap">
<cover-image class="station" src="https://img01.glsx.com.cn/weapp/resource/miniprogram/wuye/home/parking/position.png"></cover-image>
</cover-view>
</map>
<view class="draw-box" style="height: {{boxHeight}}rpx;">
<view class="draw-box" style="height: {{drawerHeight}}rpx;">
<block wx:if="{{isEmpty}}">
<view class="draw-header">
<view class="draw-header" catch:touchstart="touchStart" catch:touchmove="touchMove" catch:touchend="touchEnd">
<view class="parking-arrow-icon" catch:tap="pullH">
</view>
</view>
<view class="parking-logo">
<glsx-image webp src="home/parking/stop.png" class="parking-logo"></glsx-image>
</view>
<view class="parking-desc">当前剩余空闲车位: <text>{{parking.idleStatusCount}}</text></view>
</view>
<view class="draw-tab">
<view class="tab-item {{jstools.includes(tabIndex,item.value)?'checked':''}}" data-index="{{item.value}}" bind:tap="selectTab" wx:for="{{STATUS}}">{{item.label}}({{parking[item.name]}})</view>
<view class="tab-item {{tabIndex === item.value?'checked':''}}" data-index="{{item.value}}" catch:tap="selectTab" wx:for="{{STATUS}}">{{item.label}}({{parking[item.name]}})</view>
<view class="tab-btn" bindtap="handleRefresh">刷新<view class="parking-refresh {{isRotate?'rotate':''}}">
<glsx-image webp src="home/parking/refresh.png"></glsx-image>
</view>
</view>
</view>
<view class="draw-body">
<view class="car-item" wx:for="{{carList}}" wx:key="index">
<view class="parking-logo">
<glsx-image webp src="home/parking/{{item.parkingStatus == 1?'idle':item.parkingStatus == 2?'occupy':'unknown'}}.png" class="parking-logo"></glsx-image>
</view>
<view class="parking-desc">
<view class="parking-num">
{{item.parkingArea}}-{{item.parkingBuilding}}-{{item.parkingFloor}}
<block wx:if="{{carList.length}}">
<view class="car-item" wx:for="{{carList}}" wx:key="index">
<view class="parking-logo">
<glsx-image webp src="home/parking/{{item.parkingStatus == 1?'idle':item.parkingStatus == 2?'occupy':'unknown'}}_icon.png" class="parking-logo"></glsx-image>
</view>
<view class="parking-status {{item.parkingStatus == 1?'idle':item.parkingStatus == 2?'occupy':'unknown'}}">
{{item.parkingStatusStr}}
<view class="parking-desc">
<view class="parking-num {{item.parkingStatus == 0?'disabeld':''}}">
{{item.parkingArea}}-{{item.parkingBuilding}}-{{item.parkingFloor}}
</view>
<view class="parking-status {{item.parkingStatus == 1?'idle':item.parkingStatus == 2?'occupy':'unknown'}}">
{{item.parkingStatusStr}}
</view>
</view>
<view class="parking-btn" bind:tap="jump" data-id="{{item.id}}">详情</view>
</view>
<view class="parking-btn" bind:tap="jump" data-id="{{item.id}}">详情</view>
</view>
</block>
<block wx:else>
<view class="empty-box" style="height: 100%;">
<view class="empty-body" style="width: 220rpx;height: 220rpx;">
<glsx-image webp src="home/parking/empty.png"></glsx-image>
</view>
<view class="empty-text">暂无车位</view>
</view>
</block>
</view>
</block>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!