CarRental_back/pages/index/index.vue

712 lines
15 KiB
Vue
Raw Normal View History

2024-05-08 23:18:30 +08:00
<template>
<view class="page">
2024-10-09 18:01:47 +08:00
<u-navbar :is-back="false" title="首页" :border-bottom="false" :background="bgc" title-color='#2E4975'
title-size='36' height='45'></u-navbar>
<view class="info_box">
<view class="tit">
运营概览
2024-05-08 23:18:30 +08:00
</view>
2024-10-16 17:49:16 +08:00
<!-- <view class="data_box">
2024-10-09 18:01:47 +08:00
<view class="data1">
近7天
2024-05-08 23:18:30 +08:00
</view>
2024-10-09 18:01:47 +08:00
<view class="data1">
2024-09-05 <view class="iconfont icon-xiangxia1"></view>
2024-05-08 23:18:30 +08:00
</view>
2024-10-09 18:01:47 +08:00
<view class="data1">
近30天
2024-05-08 23:18:30 +08:00
</view>
2024-06-25 18:02:39 +08:00
2024-10-16 17:49:16 +08:00
</view> -->
<view class="top_box">
<view class="left_text">
时间范围
</view>
<view class="timebox">
<view class="left_time" @click="time1=true">
{{firsTime}}
</view>
-
<view class="right_time" @click="time2=true">
{{lasTime}}
</view>
</view>
2024-05-08 23:18:30 +08:00
</view>
2024-10-09 18:01:47 +08:00
<view class="tit_box" >
<view class="tit_line"></view>
经营概况
2024-05-08 23:18:30 +08:00
</view>
2024-10-09 18:01:47 +08:00
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas1" canvas-id="uni-ec-canvas"
:ec="ec">
</uni-ec-canvas>
2024-05-08 23:18:30 +08:00
</view>
2024-10-09 18:01:47 +08:00
<view class="log_box">
<view class="log_li">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uLJmp6DVyyoeGsIIh7IJ" mode=""></image>
订单营收
2024-05-08 23:18:30 +08:00
</view>
2024-10-09 18:01:47 +08:00
<view class="log_li">
<image src="https://lxnapi.ccttiot.com/bike/img/static/u5m5JeBXwVdNB4LWB3Nr" mode=""></image>
订单数量
2024-06-06 18:04:50 +08:00
</view>
2024-10-09 18:01:47 +08:00
2024-06-06 18:04:50 +08:00
</view>
2024-10-09 18:01:47 +08:00
<view class="info_boxs">
<view class="info_li">
<view class="tit">
1359.00
2024-06-05 18:11:17 +08:00
</view>
2024-06-23 17:17:51 +08:00
<view class="txt">
2024-10-09 18:01:47 +08:00
今日订单营收
2024-06-23 17:17:51 +08:00
</view>
<view class="txt">
2024-10-09 18:01:47 +08:00
较昨日 <span>500.00</span> <image src="https://lxnapi.ccttiot.com/bike/img/static/uL4sBdN3Pbvn5tQvhwtk" mode=""></image>
2024-06-23 17:17:51 +08:00
</view>
</view>
2024-10-09 18:01:47 +08:00
<view class="info_li">
<view class="tit">
1359.00
2024-06-23 17:17:51 +08:00
</view>
<view class="txt">
2024-10-09 18:01:47 +08:00
今日订单数
2024-06-23 17:17:51 +08:00
</view>
<view class="txt">
2024-10-09 18:01:47 +08:00
较昨日 <span>40</span> <image src="https://lxnapi.ccttiot.com/bike/img/static/ugghyGkhTlc3xr0nle2a" mode=""></image>
2024-06-06 18:04:50 +08:00
</view>
2024-05-08 23:18:30 +08:00
</view>
2024-06-23 17:17:51 +08:00
</view>
2024-05-08 23:18:30 +08:00
</view>
2024-10-16 17:49:16 +08:00
<view class="tits" v-if="AccountInfo.userType==02">
车辆统计
</view>
<view class="info_cont">
<view class="li">
<view class="top">
车辆总数
</view>
<view class="bot">
390
</view>
</view>
<view class="line"></view>
<view class="li">
<view class="top">
车辆总数
</view>
<view class="bot">
390
</view>
</view>
<view class="line"></view>
<view class="li">
<view class="top">
车辆总数
</view>
<view class="bot">
390
</view>
</view>
</view>
2024-10-09 18:01:47 +08:00
<view class="tits">
更多功能
2024-06-27 18:04:37 +08:00
</view>
2024-10-16 17:49:16 +08:00
<view class="feature" v-if="AccountInfo.userType==03">
2024-10-09 18:01:47 +08:00
<image src="https://lxnapi.ccttiot.com/bike/img/static/u3J6GbXvEvdTtebETjfH" mode="" @click="topage(0)"></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/uahBs1ruuAha5PHiiTp9" mode="" @click="topage(1)"></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/u5yEuqhkS7785kZRiQqC" mode="" @click="topage(2)"></image>
2024-06-25 18:02:39 +08:00
</view>
2024-10-16 17:49:16 +08:00
<view class="feature" v-if="AccountInfo.userType==02">
<image src="https://lxnapi.ccttiot.com/bike/img/static/u3J6GbXvEvdTtebETjfH" mode="" @click="topages(0)"></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/ufE1T9RDOm7OmhLgTzXi" mode="" @click="topages(1)"></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/u5yEuqhkS7785kZRiQqC" mode="" @click="topages(2)"></image>
</view>
<u-picker mode="time" v-model="time1" :params="params" @confirm="confirm1"
:default-time='pickertime'></u-picker>
<u-picker mode="time" v-model="time2" :params="params" @confirm="confirm2"
:default-time='pickertime'></u-picker>
2024-10-09 18:01:47 +08:00
<tab-bar :indexs='0' style=""></tab-bar>
</view>
</template>
2024-05-08 23:18:30 +08:00
<script>
2024-06-23 17:17:51 +08:00
const app = getApp();
var xBlufi = require("@/utils/blufi/xBlufi.js");
let _this = null;
2024-10-09 18:01:47 +08:00
import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue'
import * as echarts from '@/components/uni-ec-canvas/echarts'
let chart = null
2024-05-08 23:18:30 +08:00
export default {
2024-10-09 18:01:47 +08:00
components: {
uniEcCanvas
},
2024-05-08 23:18:30 +08:00
data() {
return {
bgc: {
backgroundColor: "#F7FAFE",
2024-10-09 18:01:47 +08:00
},
ec: {
lazyLoad: true
},
chartday: [], // 保存日期的数组
chartData1: [], // 保存温度数据的数组
chartData2: [120, 90, 150, 80, 130, 110, 160],
2024-10-16 17:49:16 +08:00
info:{},
AccountInfo:{},
time1: false,
time2: false,
lasTime: '',
firsTime: '',
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
2024-07-22 17:47:13 +08:00
2024-10-09 18:01:47 +08:00
}
},
onLoad() {
this.generateMockData()
},
computed: {
2024-05-28 17:48:29 +08:00
2024-10-09 18:01:47 +08:00
},
onShow() {
this.$refs.canvas1.init(this.initChart)
this.getIndexInfo()
2024-10-16 17:49:16 +08:00
this.getAccountInfo()
2024-10-09 18:01:47 +08:00
},
watch: {
2024-05-28 17:48:29 +08:00
2024-10-09 18:01:47 +08:00
},
2024-10-16 17:49:16 +08:00
2024-10-09 18:01:47 +08:00
methods: {
2024-10-16 17:49:16 +08:00
topages(num ){
if(this.AccountInfo.userId){
if(num==0){
uni.navigateTo({
url:'/page_Operator/deviceMgmt'
})
}else if(num==1){
uni.navigateTo({
url:'/page_Operator/CarModel'
})
}else if(num==2){
uni.navigateTo({
url:'/page_Operator/order'
})
}
}else{
uni.navigateTo({
url:'/pages/login/login'
})
}
},
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
})
},
getAccountInfo(){
this.$u.get(`appAdmin/myAccountInfo`).then((res) => {
if (res.code === 200) {
this.AccountInfo=res.data
if(this.AccountInfo.userType=='04'){
uni.redirectTo({
url:'/page_Delivery/orerList'
})
}
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
});
},
2024-10-09 18:01:47 +08:00
topage(num){
if(num==0){
uni.navigateTo({
url:'/page_Merchant/order'
})
}else if(num==1){
uni.navigateTo({
url:'/page_Merchant/StoreManagement'
})
}else if(num==2){
uni.navigateTo({
url:'/page_Merchant/order'
})
}
2024-10-16 17:49:16 +08:00
},
confirm1(e) {
console.log(e, 'eeeeeeee');
this.firsTime = e.year + '-' + e.month + '-' + e.day
if (this.firsTime != '' && this.lasTime != '') {
this.getIndexInfo()
}
},
confirm2(e) {
this.lasTime = e.year + '-' + e.month + '-' + e.day
// this.pageNum=1
if (this.firsTime != '' && this.lasTime != '') {
this.getIndexInfo()
}
2024-10-09 18:01:47 +08:00
},
getIndexInfo(){
this.$u.get(`appAdmin/index`).then((res) => {
if (res.code === 200) {
this.info=res.data
2024-10-16 17:49:16 +08:00
2024-10-09 18:01:47 +08:00
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
});
},
generateMockData() {
// 生成 7 天的日期
let days = 7
let today = new Date()
for (let i = 0; i < days; i++) {
let day = new Date(today)
day.setDate(today.getDate() - (days - i - 1))
let month = day.getMonth() + 1
let date = day.getDate()
this.chartday.push(`${month}-${date}`)
2024-05-28 17:48:29 +08:00
2024-10-09 18:01:47 +08:00
// 生成随机温度数据假设范围为20℃到35℃
let temp = (Math.random() * 15 + 20).toFixed(2)
this.chartData1.push(temp)
}
},
initChart(canvas, width, height, canvasDpr) {
let that = this
2024-05-28 17:48:29 +08:00
2024-10-09 18:01:47 +08:00
const option = {
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top: '4%',
containLabel: true
},
xAxis: {
show: true,
type: 'category',
boundaryGap: false,
axisLine: {
show: false // 隐藏X轴线
},
axisTick: {
show: false // 隐藏X轴刻度
},
axisLabel: {
show: true,
color: '#999', // 调整为浅灰色
fontSize: 12,
rotate: 0,
},
splitLine: {
show: false,
},
data: that.chartday,
},
yAxis: [{
show: true,
type: 'value',
axisLine: {
show: false, // 隐藏Y轴线
},
axisTick: {
show: false, // 隐藏Y轴刻度
},
axisLabel: {
show: true,
color: '#999', // 调整为浅灰色
fontSize: 12,
},
splitLine: {
show: true, // 显示网格线
lineStyle: {
type: 'dashed', // 设置为虚线
color: '#ccc', // 虚线颜色
width: 1
2024-05-08 23:18:30 +08:00
}
}
2024-10-09 18:01:47 +08:00
},
{
show: true,
type: 'value',
position: 'right', // 右侧Y轴
axisLine: {
show: false, // 隐藏Y轴线
},
axisTick: {
show: false, // 隐藏Y轴刻度
},
axisLabel: {
show: true,
color: '#999', // 调整为浅灰色
fontSize: 12,
},
splitLine: {
show: false, // 不显示网格线
}
}
],
series: [{
name: '近7日订单营收',
type: 'line',
smooth: true,
symbol: 'none', // 取消圆形标志
symbolSize: 8, // 圆形标志大小
itemStyle: {
color: '#8E6BF9', // 圆形标志颜色
borderColor: '#fff',
borderWidth: 2
},
lineStyle: {
color: '#8E6BF9', // 线条颜色
width: 3, // 线条宽度
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(142, 107, 249, 0.3)'
}, // 顶部颜色
{
offset: 1,
color: 'rgba(142, 107, 249, 0)'
} // 底部颜色
])
2024-05-08 23:18:30 +08:00
}
2024-10-09 18:01:47 +08:00
},
data: that.chartData1, // 订单营收数据
},
{
name: '近7日订单单数',
type: 'line',
smooth: true,
yAxisIndex: 1, // 使用右侧Y轴
symbol: 'none', // 取消圆形标志
symbolSize: 8, // 圆形标志大小
itemStyle: {
color: '#67B8FF', // 圆形标志颜色
borderColor: '#fff',
borderWidth: 2
},
lineStyle: {
color: '#67B8FF', // 线条颜色
width: 3, // 线条宽度
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(103, 184, 255, 0.3)'
}, // 顶部颜色
{
offset: 1,
color: 'rgba(103, 184, 255, 0)'
} // 底部颜色
])
}
},
data: that.chartData2, // 订单单数数据
2024-05-08 23:18:30 +08:00
}
2024-10-09 18:01:47 +08:00
],
2024-05-28 17:48:29 +08:00
2024-10-09 18:01:47 +08:00
};
2024-05-28 17:48:29 +08:00
2024-10-09 18:01:47 +08:00
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
});
canvas.setChart(chart);
chart.setOption(option);
return chart;
2024-05-08 23:18:30 +08:00
}
2024-05-28 17:48:29 +08:00
2024-05-08 23:18:30 +08:00
}
2024-10-09 18:01:47 +08:00
}
</script>
2024-05-08 23:18:30 +08:00
2024-10-09 18:01:47 +08:00
<style lang="scss">
page {
background: #F7FAFE;
}
2024-06-04 18:12:12 +08:00
2024-10-09 18:01:47 +08:00
.page {
width: 100%;
padding-bottom: 200rpx;
2024-10-16 17:49:16 +08:00
.info_cont{
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-around;
margin: 0 auto;
margin-top: 18rpx;
width: 680rpx;
// height: 172rpx;
padding: 40rpx 0rpx;
background: #FFFFFF;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42,130,228,0.1);
border-radius: 24rpx 24rpx 24rpx 24rpx;
.li{
width: 110rpx;
display: flex;
flex-wrap: wrap;
justify-content: center;
.top{
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
}
.bot{
font-weight: 600;
font-size: 40rpx;
color: #3D3D3D;
}
}
.line{
width: 2rpx;
height: 74rpx;
background: #C7C7C7;
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
}
2024-10-09 18:01:47 +08:00
.feature{
margin: 0 auto;
margin-top: 24rpx;
width: 658rpx;
padding: 30rpx 40rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
image{
margin-right: 66rpx;
width: 96rpx;
height: 98rpx;
2024-06-04 18:12:12 +08:00
}
2024-10-09 18:01:47 +08:00
}
.tits{
margin-top: 40rpx;
margin-left: 44rpx;
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
}
.info_box {
margin: 0 auto;
padding: 30rpx 22rpx;
width: 680rpx;
// height: 966rpx;
background: #FFFFFF;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
border-radius: 24rpx 24rpx 24rpx 24rpx;
2024-10-16 17:49:16 +08:00
.top_box {
display: flex;
flex-wrap: nowrap;
align-items: center;
// padding: 28rpx 30rpx;
// padding: 20rpx 0;
margin: 0 auto;
// width: 672rpx;
height: 100rpx;
background: #FFFFFF;
// box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0, 0, 0, 0.07);
border-radius: 10rpx 10rpx 10rpx 10rpx;
.left_text {
display: flex;
flex-wrap: nowrap;
align-items: center;
width: 25%;
font-weight: 400;
font-size: 32rpx;
color: #3D3D3D;
.icon-xiangxia1 {
font-size: 26rpx;
}
}
.timebox {
width: 75%;
display: flex;
flex-wrap: nowrap;
align-items: center;
margin-left: 34rpx;
.left_time {
text-align: center;
margin-right: 6rpx;
height: 50rpx;
width: 45%;
border: 2rpx solid #ccc;
border-radius: 12rpx;
font-weight: 400;
font-size: 32rpx;
color: #979797;
}
.right_time {
text-align: center;
margin-left: 6rpx;
height: 50rpx;
width: 45%;
border: 2rpx solid #ccc;
border-radius: 12rpx;
font-weight: 400;
font-size: 32rpx;
color: #979797;
}
}
}
2024-10-09 18:01:47 +08:00
.info_boxs{
margin-top: 26rpx;
width: 636rpx;
padding: 24rpx 0;
background: #F4FBFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
2024-05-08 23:18:30 +08:00
display: flex;
flex-wrap: nowrap;
2024-10-09 18:01:47 +08:00
.info_li:first-child{
border-right: 1rpx solid #D8D8D8;
2024-05-08 23:18:30 +08:00
}
2024-10-09 18:01:47 +08:00
.info_li{
padding: 0 40rpx;
2024-05-08 23:18:30 +08:00
display: flex;
flex-wrap: wrap;
2024-10-09 18:01:47 +08:00
width: 50%;
.tit{
text-align: left;
width: 100%;
font-weight: 600;
font-size: 24rpx;
color: #3D3D3D;
2024-05-08 23:18:30 +08:00
}
2024-10-09 18:01:47 +08:00
.txt{
margin-top: 10rpx;
width: 100%;
display: flex;
align-items: center;
2024-05-08 23:18:30 +08:00
font-weight: 400;
2024-10-09 18:01:47 +08:00
font-size: 24rpx;
2024-05-08 23:18:30 +08:00
color: #3D3D3D;
2024-10-09 18:01:47 +08:00
span{
font-size: 600;
}
image{
width: 32rpx;
height: 32rpx;
}
2024-05-08 23:18:30 +08:00
}
}
}
2024-10-09 18:01:47 +08:00
.log_box{
2024-06-06 18:04:50 +08:00
display: flex;
2024-10-09 18:01:47 +08:00
flex-wrap: nowrap;
justify-content: space-around;
.log_li{
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
image{
margin-right: 8rpx;
width: 76rpx;
height:18rpx ;
}
2024-06-06 18:04:50 +08:00
}
}
2024-10-09 18:01:47 +08:00
.echarts {
width: 650rpx;
2024-06-20 18:08:54 +08:00
height: 500rpx;
2024-05-08 23:18:30 +08:00
}
2024-10-09 18:01:47 +08:00
.tit_box {
margin-top: 40rpx;
margin-bottom: 30rpx;
2024-06-06 18:04:50 +08:00
display: flex;
align-items: center;
2024-10-09 18:01:47 +08:00
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
2024-06-06 18:04:50 +08:00
2024-10-09 18:01:47 +08:00
.tit_line {
margin-right: 6rpx;
width: 10rpx;
height: 46rpx;
background: #4297F3;
border-radius: 5rpx 5rpx 5rpx 5rpx;
2024-06-06 18:04:50 +08:00
}
}
2024-10-09 18:01:47 +08:00
.data_box {
margin-top: 32rpx;
width: 100%;
2024-05-08 23:18:30 +08:00
display: flex;
2024-10-09 18:01:47 +08:00
flex-wrap: nowrap;
justify-content: space-around;
2024-05-08 23:18:30 +08:00
2024-10-09 18:01:47 +08:00
.act {
background: #4297F3;
color: #FFFFFF;
2024-05-08 23:18:30 +08:00
}
2024-10-09 18:01:47 +08:00
.data1 {
display: flex;
flex-wrap: nowrap;
padding: 8rpx 32rpx;
border-radius: 26rpx 26rpx 26rpx 26rpx;
background: #FFFFFF;
border: 2rpx solid #4297F3;
2024-05-08 23:18:30 +08:00
font-weight: 400;
font-size: 28rpx;
2024-10-09 18:01:47 +08:00
color: #4297F3;
2024-05-08 23:18:30 +08:00
}
2024-10-09 18:01:47 +08:00
// .data2{
2024-06-04 18:12:12 +08:00
2024-10-09 18:01:47 +08:00
// }
2024-05-08 23:18:30 +08:00
}
.tit {
2024-10-09 18:01:47 +08:00
margin-top: 40rpx;
2024-05-08 23:18:30 +08:00
width: 100%;
2024-10-09 18:01:47 +08:00
text-align: center;
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
2024-05-08 23:18:30 +08:00
}
}
2024-10-09 18:01:47 +08:00
2024-05-08 23:18:30 +08:00
}
</style>