powerbank/pages/index/index.vue

561 lines
13 KiB
Vue
Raw Normal View History

2023-11-27 09:57:03 +08:00
<template>
2024-01-27 16:37:52 +08:00
<view class="page">
2024-05-11 10:57:53 +08:00
<!-- 用户首页显示 -->
<view class="useryonghu">
<u-navbar :is-back="false" :border-bottom="false" :background="bgc" title-color='#2E4975' title-size='36'
height='8'></u-navbar>
<view class="title">
充电宝
</view>
<view class="ditu">
<view class="dtxs">
<map class='map' :latitude="latitude" :longitude="longitude" @click="handleMapClick"
:markers="covers" />
</view>
<view class="tubiao">
<view class="gr" @click="btnindex(1)">
<image src="../../static/image/a1.png" mode="" style="width: 96rpx;height:98rpx;"></image>
<!-- 个人中心 -->
2024-01-27 16:37:52 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="gr" @click="btnindex(2)">
<image src="../../static/image/a2.png" mode="" style="width: 96rpx;height:102rpx;"></image>
<!-- 我的订单 -->
2024-01-27 16:37:52 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="gr" @click="btnindex(3)">
<image src="../../static/image/a3.png" mode="" style="width: 96rpx;height:98rpx;"></image>
<!-- 附近门店 -->
2024-01-27 16:37:52 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="gr" @click="btnindex(4)">
<image src="../../static/image/a4.png" mode="" style="width: 96rpx;height:94rpx;"></image>
<!-- 联系客服 -->
2024-01-27 16:37:52 +08:00
</view>
</view>
2024-05-11 10:57:53 +08:00
<view class="guangg">
<image src="../../static/image/a5.png" mode=""></image>
</view>
<view class="saoma">
<view>
<image src="../../static/image/sm.png" mode=""></image>扫码充电
2024-01-27 16:37:52 +08:00
</view>
</view>
</view>
2024-05-11 10:57:53 +08:00
</view>
<!-- 代理首页显示 -->
<!-- <view class="userdaili" v-if="false">
<u-navbar :is-back="false" title="首页" :border-bottom="false" :background="bgc" title-color='#000'
title-size='36' height='36'></u-navbar>
<view class="zhanghu">
<view class="zhtitle">
<text>账户余额</text> <text class="tx" @click="btnnav(9)">提现明细</text>
2024-01-27 16:37:52 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="zhje">
<text>1163.916</text> <text class="btntx" @click="btnnav(10)">立即提现</text>
</view>
<view class="buc">
收益提升技巧加强关注尽快为缺宝的设备补充充电宝
</view>
</view>
<view class="dttitle">
订单统计
2024-01-27 16:37:52 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="ordertongji">
<view class="orderday">
<view class="sj">
<text @click="btnriq(1)" :class="dateindex == 1 ? 'dateactive' : ''">今日</text>
<text @click="btnriq(2)" :class="dateindex == 2 ? 'dateactive' : ''">昨日</text>
<text @click="btnriq(3)" :class="dateindex == 3 ? 'dateactive' : ''">近七日</text>
<text @click="btnriq(4)" :class="dateindex == 4 ? 'dateactive' : ''">近30日</text>
</view>
</view>
<u-picker mode="time" v-model="show" :params="params" @confirm="confirm"></u-picker>
<view class="date">
<text @click="btnks(1)">{{selector}}</text> -- <text @click="btnks(2)">{{selectors}}</text>
</view>
<view class="shuju">
<view class="ddje">
<view class="shu">
32.5
2024-01-27 16:37:52 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="sb">
订单总额
2024-01-27 16:37:52 +08:00
</view>
</view>
2024-05-11 10:57:53 +08:00
<text style="width: 1px;height: 60rpx;background: #979797;margin-top: 24rpx;"></text>
<view class="ddje">
<view class="shu">
9
</view>
<view class="sb">
订单总数
2024-03-25 19:46:07 +08:00
</view>
</view>
2024-05-11 10:57:53 +08:00
<text style="width: 1px;height: 60rpx;background: #979797;margin-top: 24rpx;"></text>
<view class="ddje">
<view class="shu">
0
2024-01-27 16:37:52 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="sb">
新增店铺
</view>
</view>
<text style="width: 1px;height: 60rpx;background: #979797;margin-top: 24rpx;"></text>
<view class="ddje">
<view class="shu">
0
</view>
<view class="sb">
新增设备
</view>
</view>
2024-01-27 16:37:52 +08:00
</view>
</view>
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
<view class="dttitle">
更多功能
2024-01-27 16:37:52 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="gongneng">
<view class="icons" @click="btnnav(1)">
<image src="../../static/image/sbgl.png" mode=""></image>
2024-03-13 10:54:22 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="icons" @click="btnnav(2)">
<image src="../../static/image/dpgl.png" mode=""></image>
2024-03-13 10:54:22 +08:00
</view>
2024-05-11 10:57:53 +08:00
<view class="icons" @click="btnnav(3)">
<image src="../../static/image/yygl.png" mode=""></image>
</view>
<view class="icons" @click="btnnav(4)">
<image src="../../static/image/dlgl.png" mode=""></image>
</view>
<view class="icons" @click="btnnav(5)">
<image src="../../static/image/ddgl.png" mode=""></image>
</view>
<view class="icons" @click="btnnav(6)">
<image src="../../static/image/hydp.png" mode=""></image>
</view>
<view class="icons" @click="btnnav(7)">
<image src="../../static/image/sjfx.png" mode=""></image>
</view>
<view class="icons" @click="btnnav(8)">
<image src="../../static/image/a1.png" mode=""></image>
2024-03-13 10:54:22 +08:00
</view>
</view>
2024-05-11 10:57:53 +08:00
</view> -->
2023-11-27 09:57:03 +08:00
</view>
</template>
<script>
export default {
data() {
return {
2024-05-11 10:57:53 +08:00
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
2024-01-27 16:37:52 +08:00
},
2024-05-11 10:57:53 +08:00
dateindex: 1,
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
latitude: 27.109017527965676, // 初始纬度
longitude: 120.25287434763894, // 初始经度
covers: [], // 覆盖物数组
};
2023-11-27 09:57:03 +08:00
},
methods: {
2024-05-11 10:57:53 +08:00
btnindex(num) {
if (num == 2) {
uni.navigateTo({
url: '/pages/myorder/index'
})
} else if (num == 3) {
uni.navigateTo({
url: '/pages/nearbystores/index'
})
} else if (num == 1) {
uni.navigateTo({
url: '/pages/personal/index'
})
2024-03-25 19:46:07 +08:00
} else {
2024-05-11 10:57:53 +08:00
uni.navigateTo({
url: '/pages/abbr/index'
})
2024-03-25 19:46:07 +08:00
}
},
2024-05-11 10:57:53 +08:00
btnnav(num) {
if (num == 1) {
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
} else if (num == 2) {
} else if (num == 3) {
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
} else if (num == 4) {
}
2024-03-13 10:54:22 +08:00
},
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
getMyLocation() {
const self = this;
uni.getLocation({
type: 'wgs84',
success: (res) => {
console.log('我的位置:', res);
self.latitude = res.latitude;
self.longitude = res.longitude;
// 创建表示当前位置的覆盖物对象
const myLocationCover = {
latitude: res.latitude,
longitude: res.longitude,
width: 20,
height: 40,
iconPath: '../../static/image/icon1.png' // 替换为你的图标路径
};
// 将当前位置的覆盖物添加到covers数组中
self.covers.push(myLocationCover);
// 如果需要刷新地图或覆盖物,可以在这里调用相应的方法
},
fail: (err) => {
console.error('获取位置失败:', err);
2024-03-13 10:54:22 +08:00
}
});
},
2024-05-11 10:57:53 +08:00
// 假设这个方法用于初始化其他覆盖物(如充电宝图标)
initOtherCovers() {
this.covers = [{
latitude: 27.1040175279,
longitude: 120.22287435634,
width: 40,
height: 50,
iconPath: '../../static/image/tb.png'
},
{
latitude: 27.10801752796,
longitude: 120.26287434763,
width: 40,
height: 50,
iconPath: '../../static/image/tb.png'
}
];
2024-03-25 19:46:07 +08:00
},
2024-05-11 10:57:53 +08:00
handleMapClick(e) {
const {
latitude,
longitude
} = e.detail;
const clickedCover = this.covers.find(cover => {
// 假设覆盖物是以其中心点为基准的矩形
const left = cover.longitude - cover.width / 2;
const right = cover.longitude + cover.width / 2;
const top = cover.latitude + cover.height / 2;
const bottom = cover.latitude - cover.height / 2;
// 检查点击的经纬度是否在覆盖物的矩形范围内
return longitude >= left && longitude <= right && latitude >= bottom && latitude <= top;
2024-03-13 10:54:22 +08:00
});
2024-05-11 10:57:53 +08:00
if (clickedCover) {
uni.showToast({
title: `点击了店铺`,
icon: 'success',
duration: 2000
});
} else {
uni.showToast({
title: '点击了地图其他位置',
icon: 'none',
duration: 2000
});
}
2024-03-13 10:54:22 +08:00
},
2024-05-11 10:57:53 +08:00
},
mounted() {
this.initOtherCovers(); // 初始化其他覆盖物
this.getMyLocation(); // 获取并设置自身位置的覆盖物
2023-11-27 09:57:03 +08:00
}
2024-05-11 10:57:53 +08:00
};
2023-11-27 09:57:03 +08:00
</script>
2024-01-27 16:37:52 +08:00
<style lang="scss">
2024-05-11 10:57:53 +08:00
/deep/ .map {
width: 100%;
height: 100%;
}
.dateactive {
background: #E1F3ED;
}
2024-03-13 10:54:22 +08:00
page {
2024-05-11 10:57:53 +08:00
// background-color: ;
background: linear-gradient(180deg, #25CE88 0%, rgba(255, 255, 255, 0) 100%);
border-radius: 0rpx 0rpx 0rpx 0rpx;
2024-03-13 10:54:22 +08:00
}
.page {
2024-05-11 10:57:53 +08:00
width: 750rpx;
padding-left: 34rpx;
padding-right: 34rpx;
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
// 代理样式
.userdaili {
.gongneng {
width: 680rpx;
height: 304rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
padding: 0 50rpx;
box-sizing: border-box;
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
.icons {
display: inline-block;
width: 145rpx;
2024-03-13 10:54:22 +08:00
text-align: center;
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
image {
margin-top: 34rpx;
width: 50px;
height: 50px;
}
}
2024-03-25 19:46:07 +08:00
2024-03-13 10:54:22 +08:00
}
2024-05-11 10:57:53 +08:00
.ordertongji {
width: 680rpx;
height: 342rpx;
2024-03-13 10:54:22 +08:00
background: #FFFFFF;
2024-05-11 10:57:53 +08:00
border-radius: 24rpx 24rpx 24rpx 24rpx;
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.shuju {
2024-01-27 16:37:52 +08:00
display: flex;
2024-03-13 10:54:22 +08:00
justify-content: space-between;
2024-05-11 10:57:53 +08:00
padding: 0 40rpx;
box-sizing: border-box;
margin-top: 24rpx;
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.ddje {
text-align: center;
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.shu {
font-weight: 500;
font-size: 40rpx;
color: #3D3D3D;
2024-03-13 10:54:22 +08:00
}
2024-05-11 10:57:53 +08:00
.sb {
margin-top: 20rpx;
font-weight: 500;
font-size: 20rpx;
color: #3D3D3D;
2024-03-13 10:54:22 +08:00
}
}
2024-05-11 10:57:53 +08:00
}
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.date {
padding-left: 80rpx;
padding-right: 80rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
margin-top: 26rpx;
text {
padding: 6rpx 18rpx;
box-sizing: border-box;
background: #eee;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-size: 24rpx;
color: #808080;
2024-01-27 16:37:52 +08:00
}
}
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.orderday {
2024-03-13 10:54:22 +08:00
display: flex;
2024-05-11 10:57:53 +08:00
justify-content: space-between;
width: 100%;
padding: 10rpx 12rpx;
box-sizing: border-box;
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
text {
margin-right: 10rpx;
border-radius: 20rpx;
text-align: center;
display: inline-block;
width: 148rpx;
height: 84rpx;
// background: #E1F3ED;
text-align: center;
line-height: 84rpx;
2024-03-13 10:54:22 +08:00
}
}
}
2024-05-11 10:57:53 +08:00
.dttitle {
margin: 36rpx 0;
font-weight: 500;
font-size: 36rpx;
color: #3D3D3D;
}
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.zhanghu {
margin-top: 32rpx;
width: 680rpx;
height: 264rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
padding: 36rpx 38rpx;
box-sizing: border-box;
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.zhtitle {
2024-01-27 16:37:52 +08:00
display: flex;
2024-05-11 10:57:53 +08:00
justify-content: space-between;
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.sj {
2024-03-13 10:54:22 +08:00
display: flex;
2024-05-11 10:57:53 +08:00
justify-content: space-between;
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
text {
2024-01-27 16:37:52 +08:00
font-size: 24rpx;
2024-05-11 10:57:53 +08:00
color: #3D3D3D;
2024-01-27 16:37:52 +08:00
}
}
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.tx {
font-size: 24rpx;
color: #27D089;
}
2024-03-13 10:54:22 +08:00
}
2024-05-11 10:57:53 +08:00
.zhje {
margin-top: 20rpx;
2024-01-27 16:37:52 +08:00
display: flex;
2024-05-11 10:57:53 +08:00
justify-content: space-between;
border-bottom: 1px solid #ccc;
padding-bottom: 20rpx;
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
text {
font-weight: 500;
font-size: 48rpx;
color: #3D3D3D;
}
.btntx {
width: 156rpx;
height: 42rpx;
background: linear-gradient(270deg, #54DAA1 0%, #19CD82 100%);
border-radius: 40rpx 40rpx 40rpx 40rpx;
font-size: 24rpx;
color: #FFFFFF;
text-align: center;
line-height: 42rpx;
margin-top: 10rpx;
2024-01-27 16:37:52 +08:00
}
}
2024-03-13 10:54:22 +08:00
2024-05-11 10:57:53 +08:00
.buc {
margin-top: 20rpx;
font-size: 24rpx;
color: #979797;
}
2024-01-27 16:37:52 +08:00
}
2024-03-13 10:54:22 +08:00
}
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
//样式结束
.title {
font-weight: 500;
font-size: 36rpx;
color: #3D3D3D;
line-height: 50rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
.guangg {
image {
width: 680rpx;
height: 238rpx;
2024-03-13 10:54:22 +08:00
}
2024-05-11 10:57:53 +08:00
}
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
.saoma {
width: 750rpx;
height: 186rpx;
background: #FFFFFF;
position: fixed;
bottom: 0;
left: 0;
padding-top: 38rpx;
border-radius: 54rpx 54rpx 0 0;
view {
text-align: center;
width: 676rpx;
height: 102rpx;
background: linear-gradient(270deg, #54DAA1 0%, #19CD82 100%);
border-radius: 54rpx 54rpx 54rpx 54rpx;
font-weight: 500;
font-size: 40rpx;
color: #FFFFFF;
margin: auto;
line-height: 102rpx;
2024-01-27 16:37:52 +08:00
}
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
image {
width: 56rpx;
height: 56rpx;
vertical-align: middle;
margin-right: 10rpx;
}
2024-03-25 19:46:07 +08:00
}
2024-05-11 10:57:53 +08:00
.ditu {
width: 100%;
height: 964rpx;
background: #FFFFFF;
border-radius: 38rpx 38rpx 38rpx 38rpx;
margin-top: 34rpx;
padding-top: 16rpx;
.dtxs {
width: 642rpx;
height: 812rpx;
// background-color: red;
margin: auto;
}
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
.tubiao {
display: flex;
justify-content: space-between;
padding: 0 50rpx;
box-sizing: border-box;
padding-top: 20rpx;
padding-bottom: 24rpx;
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
.gr {
text-align: center;
width: 100%;
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
2024-03-25 19:46:07 +08:00
2024-05-11 10:57:53 +08:00
image {
display: block;
margin: auto;
margin-bottom: 14rpx;
}
}
}
2024-01-27 16:37:52 +08:00
}
}
2024-03-13 10:54:22 +08:00
</style>