|
|
@@ -61,11 +61,11 @@
|
|
|
<!-- 站点清单 end-->
|
|
|
|
|
|
|
|
|
-<!-- 停车券-->
|
|
|
- <uv-popup ref="parking_popup_ref" closeable>
|
|
|
+ <!-- 停车券-->
|
|
|
+ <uv-popup ref="parking_popup_ref">
|
|
|
<view class="parking_box">
|
|
|
- <image show-menu-by-longpress src="/static/parking-qrcode.png" style="width: 420rpx;height: 420rpx;"/>
|
|
|
<text>长按识别二维码获取停车优惠</text>
|
|
|
+ <image show-menu-by-longpress src="/static/parking-qrcode.png"/>
|
|
|
</view>
|
|
|
</uv-popup>
|
|
|
|
|
|
@@ -73,7 +73,7 @@
|
|
|
<login-bar class="w100 text-center"></login-bar>
|
|
|
</cover-view>-->
|
|
|
<!-- <cover-view class="login_bar" v-show="!isLogin">-->
|
|
|
- <login-bar class="w100 text-center" ></login-bar>
|
|
|
+ <!-- <login-bar class="w100 text-center" ></login-bar>-->
|
|
|
<!-- </cover-view>-->
|
|
|
<tab-bar :index="0"></tab-bar>
|
|
|
</view>
|
|
|
@@ -103,10 +103,10 @@ const initState = () => ({
|
|
|
bannerList: [],
|
|
|
swiperList: [],
|
|
|
menuList: [
|
|
|
- {name: "photo", title: "洗车", icon: '/static/iconfont/default/fastwash.svg'},
|
|
|
- {name: "lock", title: "充值", icon: '/static/iconfont/default/recharge.svg'},
|
|
|
- {name: "star", title: "卡券", icon: '/static/iconfont/default/coupon.svg'},
|
|
|
- {name: "red-packet", title: "停车", icon: '/static/iconfont/default/parking.svg'},
|
|
|
+ {name: "wash", auth: false, title: "洗车", icon: '/static/iconfont/default/fastwash.svg'},
|
|
|
+ {name: "charge", auth: true, title: "充值", icon: '/static/iconfont/default/recharge.svg'},
|
|
|
+ {name: "coupon", auth: false, title: "消费券", icon: '/static/iconfont/default/coupon.svg'},
|
|
|
+ {name: "parking", auth: false, title: "停车券", icon: '/static/iconfont/default/parking.svg'},
|
|
|
],
|
|
|
qrcodeOption: {
|
|
|
style: 'round',
|
|
|
@@ -136,7 +136,7 @@ const initState = () => ({
|
|
|
position: "fixed",
|
|
|
|
|
|
},
|
|
|
- screenWidth:350
|
|
|
+ screenWidth: 350
|
|
|
})
|
|
|
|
|
|
const state = reactive(initState())
|
|
|
@@ -210,9 +210,9 @@ onShow(() => {
|
|
|
loadWashStationList();
|
|
|
}
|
|
|
|
|
|
- if (isLogin.value) {
|
|
|
- loadBannerList();
|
|
|
- } else {
|
|
|
+ loadBannerList();
|
|
|
+
|
|
|
+ if (!isLogin.value) {
|
|
|
addListener();
|
|
|
}
|
|
|
|
|
|
@@ -227,10 +227,10 @@ onHide(() => {
|
|
|
const addListener = () => {
|
|
|
uni.$on('login', function (data) {
|
|
|
isLogin.value = data.isLogin;
|
|
|
- if (!state.bannerList || state.bannerList.length === 0) {
|
|
|
- loadBannerList();
|
|
|
- }
|
|
|
- loadWashStationList();
|
|
|
+ // if (!state.bannerList || state.bannerList.length === 0) {
|
|
|
+ // loadBannerList();
|
|
|
+ // }
|
|
|
+ // loadWashStationList();
|
|
|
|
|
|
})
|
|
|
|
|
|
@@ -263,24 +263,38 @@ const handleBannerClick = (index: number) => {
|
|
|
}
|
|
|
|
|
|
const handleMenuClick = (menu: any) => {
|
|
|
- checkLogin().then((res) => {
|
|
|
- if (menu.title === '洗车') {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages-wash/scan/index'
|
|
|
- })
|
|
|
- } else if (menu.title === '充值') {
|
|
|
+ let {auth,name} = menu;
|
|
|
+ if(auth){
|
|
|
+ checkLogin().then((res) => {
|
|
|
+ handleMenuItemNative(menu)
|
|
|
+ }).catch(e => {
|
|
|
+ console.error("handleMenuClick 校验,跳转登录页", e)
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages-user/wallet/recharge'
|
|
|
+ url: '/pages-user/login/index'
|
|
|
})
|
|
|
- } else if (menu.title === '停车') {
|
|
|
- parking_popup_ref.value?.open('center');
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: '敬请期待',
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ handleMenuItemNative(menu)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const handleMenuItemNative = (menu:any) => {
|
|
|
+ if (menu.name === 'wash') {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages-wash/scan/index'
|
|
|
+ })
|
|
|
+ } else if (menu.name === 'charge') {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages-user/wallet/recharge'
|
|
|
+ })
|
|
|
+ } else if (menu.name === 'parking') {
|
|
|
+ parking_popup_ref.value?.open('center');
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '敬请期待',
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -313,22 +327,20 @@ const loadCurrentLocation = () => {
|
|
|
}
|
|
|
|
|
|
const loadWashStationList = () => {
|
|
|
- if (isLogin.value) {
|
|
|
- if (state.stationList && state.stationList.length > 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- post(`/wash-station/listStation`, {pageSize: 5}).then((res: any) => {
|
|
|
- console.log(res)
|
|
|
- let {list, total} = res;
|
|
|
- list.forEach((station: any) => {
|
|
|
- if (station.location) {
|
|
|
- let stationLocation = JSON.parse(station.location);
|
|
|
- station.distance = calcMapDistance(state.location.latitude, state.location.longitude, stationLocation.stationLat, stationLocation.stationLng);
|
|
|
- }
|
|
|
- })
|
|
|
- state.stationList = list;
|
|
|
- })
|
|
|
+ if (state.stationList && state.stationList.length > 0) {
|
|
|
+ return;
|
|
|
}
|
|
|
+ post(`/wash-station/listStation`, {pageSize: 5}).then((res: any) => {
|
|
|
+ console.log(res)
|
|
|
+ let {list, total} = res;
|
|
|
+ list.forEach((station: any) => {
|
|
|
+ if (station.location) {
|
|
|
+ let stationLocation = JSON.parse(station.location);
|
|
|
+ station.distance = calcMapDistance(state.location.latitude, state.location.longitude, stationLocation.stationLat, stationLocation.stationLng);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.stationList = list;
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const handleNavMap = (station: any) => {
|
|
|
@@ -352,12 +364,12 @@ const handleNavStation = (station: any) => {
|
|
|
|
|
|
|
|
|
const handleContact = (e: any) => {
|
|
|
- console.log("handleContact", e)
|
|
|
+ // console.log("handleContact", e)
|
|
|
}
|
|
|
|
|
|
|
|
|
const onChange = (e) => {
|
|
|
- console.log(e)
|
|
|
+ // console.log(e)
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -476,17 +488,25 @@ movable-area {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.parking_box{
|
|
|
- width: 500rpx;
|
|
|
- height: 500rpx;
|
|
|
+.parking_box {
|
|
|
+ width: 450rpx;
|
|
|
+ height: 450rpx;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
border-radius: 4px;
|
|
|
+ image{
|
|
|
+ //border: 1px solid $uni-color-primary;
|
|
|
+ border-radius: 3px;
|
|
|
+ width: 420rpx;
|
|
|
+ height: 420rpx;
|
|
|
+ }
|
|
|
|
|
|
- text{
|
|
|
+ text {
|
|
|
+ padding-top: 30rpx;
|
|
|
font-size: 12px;
|
|
|
+ color: $uni-color-primary;
|
|
|
}
|
|
|
}
|
|
|
</style>
|