Commit ee69fbcd by 前端

定位

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