Files
vpUni/.svn/pristine/8f/8f54ce6104341bf8f0533d08fe8c465657d09020.svn-base
2026-03-09 16:39:03 +08:00

244 lines
5.0 KiB
Plaintext

<template>
<view class="page">
<!-- 时间筛选标签 -->
<view class="time-filter">
<text class="filter-item" @click="currentIndex=0" :class="{active:currentIndex==0}">今日</text>
<text class="filter-item" @click="currentIndex=1" :class="{active:currentIndex==1}">本周</text>
<text class="filter-item" @click="currentIndex=2" :class="{active:currentIndex==2}">本月</text>
</view>
<!-- 关键数据卡片 -->
<view class="data-cards">
<view class="data-card">
<text class="data-label">销售额</text>
<text class="data-value">¥12,345</text>
<text class="data-growth">+12.5%</text>
</view>
<view class="data-card">
<text class="data-label">订单数</text>
<text class="data-value">128单</text>
<text class="data-growth">+8.3%</text>
</view>
<view class="data-card">
<text class="data-label">访客数</text>
<text class="data-value">1,024人</text>
<text class="data-growth">+15.2%</text>
</view>
<view class="data-card">
<text class="data-label">人均消费</text>
<text class="data-value">¥96.4</text>
<text class="data-growth">+4.8%</text>
</view>
</view>
<!-- 销售趋势图表 -->
<!-- <view class="chart-section">
<text class="section-title">销售趋势</text>
<view class="chart-container">
</view>
</view> -->
<!-- 商品销量排行 -->
<!-- <view class="ranking-section">
<text class="section-title">商品销量排行</text>
<view class="ranking-list">
<view class="ranking-item" v-for="(item, index) in salesRanking" :key="index">
<view class="ranking-number">{{ index + 1 }}</view>
<text class="ranking-product">{{ item.name }}</text>
<view class="ranking-info">
<text class="ranking-sales">{{ item.sales }}份</text>
<u-icon :name="item.trend === 'up' ? 'arrow-up' : 'arrow-down'" size="24rpx"
:color="item.trend === 'up' ? '#4CD964' : '#FF3B30'" class="trend-icon"></u-icon>
</view>
</view>
</view>
</view> -->
<!-- 客流高峰时段 -->
<!-- <view class="flow-section">
<text class="section-title">客流高峰时段</text>
</view> -->
</view>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
// 商品销量排行数据类型
interface RankingItem {
name : string;
sales : number;
trend : 'up' | 'down';
}
let currentIndex = ref(0)
// 商品销量排行数据
const salesRanking = ref<RankingItem[]>([
{ name: '招牌牛肉面', sales: 245, trend: 'up' },
{ name: '香菇三明治', sales: 189, trend: 'down' },
{ name: '水果沙拉', sales: 156, trend: 'up' },
{ name: '红烧排骨', sales: 134, trend: 'up' },
{ name: '糖醋里脊', sales: 112, trend: 'down' }
]);
// 切换时间筛选
const changeTimeFilter = (index : number) => {
// 实际项目中这里应该有切换时间筛选的逻辑
console.log('切换时间筛选', index);
};
</script>
<style scoped lang="scss">
.page {
background-color: #F5F5F5;
min-height: 100vh;
padding-bottom: 40rpx;
}
/* 时间筛选标签 */
.time-filter {
display: flex;
justify-content: space-around;
padding: 30rpx;
background-color: #FFFFFF;
margin-bottom: 30rpx;
}
.filter-item {
font-size: 32rpx;
color: #666666;
padding: 10rpx 40rpx;
border-radius: 30rpx;
}
.filter-item.active {
background-color: #FF6600;
color: #FFFFFF;
}
/* 关键数据卡片 */
.data-cards {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20rpx;
padding: 0 30rpx;
margin-bottom: 30rpx;
}
.data-card {
background-color: #FFFFFF;
padding: 30rpx;
border-radius: 20rpx;
}
.data-label {
font-size: 28rpx;
color: #999999;
display: block;
margin-bottom: 20rpx;
}
.data-value {
font-size: 40rpx;
color: #333333;
font-weight: bold;
display: block;
margin-bottom: 10rpx;
}
.data-growth {
font-size: 28rpx;
color: #4CD964;
}
/* 图表区域 */
.chart-section,
.ranking-section,
.flow-section {
background-color: #FFFFFF;
padding: 30rpx;
border-radius: 20rpx;
margin: 0 30rpx 30rpx;
}
.section-title {
font-size: 36rpx;
color: #333333;
font-weight: bold;
display: block;
margin-bottom: 30rpx;
}
.chart-container {
width: 100%;
height: 320rpx;
}
.sales-trend-chart,
.customer-flow-chart {
width: 100%;
height: 100%;
}
/* 商品销量排行 */
.ranking-list {
gap: 20rpx;
}
.ranking-item {
display: flex;
align-items: center;
padding: 20rpx 0;
border-bottom: 1rpx solid #F0F0F0;
}
.ranking-item:last-child {
border-bottom: none;
}
.ranking-number {
width: 60rpx;
height: 60rpx;
background-color: #FF6600;
color: #FFFFFF;
font-size: 32rpx;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10rpx;
margin-right: 24rpx;
}
.ranking-product {
flex: 1;
font-size: 32rpx;
color: #333333;
}
.ranking-info {
display: flex;
align-items: center;
}
.ranking-sales {
font-size: 32rpx;
color: #333333;
margin-right: 16rpx;
}
.trend-icon {
margin-left: 8rpx;
}
</style>