添加SVG图标组件,替换emoji图标为矢量图标
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>建材销售管家</title>
|
||||
<!-- IconFont 图标库 -->
|
||||
<link rel="stylesheet" href="https://at.alicdn.com/t/font_3410480_1x6a2sijq4i.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
101
src/components/Icon.vue
Normal file
101
src/components/Icon.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<text class="icon-svg" :style="iconStyle">
|
||||
<image :src="svgSrc" :style="{ width: sizeRpx, height: sizeRpx }" mode="aspectFit" />
|
||||
</text>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const iconSvgs = {
|
||||
// 首页
|
||||
home: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>',
|
||||
user: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>',
|
||||
chart: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"/></svg>',
|
||||
|
||||
// 商品
|
||||
product: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2zm-5 12H9v-2h6v2zm5-7H4V4l16-.02V7z"/></svg>',
|
||||
add: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>',
|
||||
search: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>',
|
||||
|
||||
// 订单
|
||||
order: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>',
|
||||
edit: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/></svg>',
|
||||
check: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2352c41a"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>',
|
||||
close: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ff4d4f"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>',
|
||||
|
||||
// 库存
|
||||
stock: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2zm-5 12H9v-2h6v2zm5-7H4V4l16-.02V7z"/></svg>',
|
||||
alert: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23fa8c16"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/></svg>',
|
||||
in: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>',
|
||||
out: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M5 5h6v2H7v2h4v6h2v-6h4v-2h-4V7h-2v2H5V5zm14 7l4-4h-3V5h-2v3H9l4 4z"/></svg>',
|
||||
warehouse: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M20 4H4v2h16V4zm1 10v-2l-1-5H4l-1 5v2h1v6h10v-6h4v6h2v-6h1zm-9 4H6v-4h6v4z"/></svg>',
|
||||
|
||||
// 客户
|
||||
customer: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/></svg>',
|
||||
phone: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"/></svg>',
|
||||
|
||||
// 金钱
|
||||
money: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M11.8 10.9c-2.27-.59-3-1.2-3-2.15 0-1.09 1.01-1.85 2.7-1.85 1.78 0 2.44.85 2.5 2.1h2.21c-.07-1.72-1.12-3.3-3.21-3.81V3h-3v2.16c-1.94.42-3.5 1.68-3.5 3.61 0 2.31 1.91 3.46 4.7 4.13 2.5.6 3 1.48 3 2.41 0 .69-.49 1.79-2.7 1.79-2.06 0-2.87-.92-2.98-2.1h-2.2c.12 2.19 1.76 3.42 3.68 3.83V21h3v-2.15c1.95-.37 3.5-1.5 3.5-3.55 0-2.84-2.43-3.81-4.7-4.4z"/></svg>',
|
||||
|
||||
// 操作
|
||||
logout: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"/></svg>',
|
||||
right: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ccc"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',
|
||||
left: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ccc"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>',
|
||||
down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ccc"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>',
|
||||
lock: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>',
|
||||
filter: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/></svg>',
|
||||
calendar: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>',
|
||||
setting: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></svg>',
|
||||
|
||||
// 微信
|
||||
wechat: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2309bb07"><path d="M9.5 4C5.36 4 2 6.69 2 10c0 1.89 1.08 3.56 2.78 4.66L4 17l2.5-1.5c.89.36 1.87.56 2.5.56 3.64 0 6.5-2.69 6.5-6.5S13.14 4 9.5 4zm-2 5.5h2v2H7.5v-2zm3 0h1.5v1.5H10.5V9.5zm2 0h2v2h-2V9.5zm-1.5 3h2v2H9.5v-2zM17.5 9c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm-4 2c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"/></svg>',
|
||||
|
||||
// 现金
|
||||
cash: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1.41 16.09V20h-2.67v-1.93c-1.71-.36-3.16-1.46-3.27-3.4h1.96c.1 1.05.82 1.87 2.65 1.87 1.96 0 2.4-.98 2.4-1.59 0-.83-.44-1.61-2.67-2.14-2.48-.6-4.18-1.62-4.18-3.67 0-1.72 1.39-2.84 3.11-3.21V4h2.67v1.95c1.86.45 2.79 1.86 2.85 3.39H14.3c-.05-1.11-.64-1.87-2.22-1.87-1.5 0-2.4.68-2.4 1.64 0 .84.65 1.39 2.67 1.91s4.18 1.39 4.18 3.91c-.01 1.83-1.38 2.83-3.12 3.16z"/></svg>',
|
||||
|
||||
// 支付宝
|
||||
alipay: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%231677ff"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2.3 11.56l-2.93-2.93-1.69 1.7-1.29-1.29 2.93-2.93 1.29 1.29 1.7-1.7 1.29 1.29-1.7 1.7 1.29 1.29 1.7-1.7 1.29 1.29-2.59 2.68z"/></svg>'
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'Icon',
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
size: {
|
||||
type: [Number, String],
|
||||
default: 32
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sizeRpx() {
|
||||
return typeof this.size === 'number' ? `${this.size}rpx` : this.size
|
||||
},
|
||||
svgSrc() {
|
||||
return iconSvgs[this.name] || iconSvgs.product
|
||||
},
|
||||
iconStyle() {
|
||||
const style = {}
|
||||
if (this.size) {
|
||||
style.fontSize = typeof this.size === 'number' ? `${this.size}rpx` : this.size
|
||||
}
|
||||
if (this.color) {
|
||||
style.color = this.color
|
||||
}
|
||||
return style
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.icon-svg {
|
||||
display: inline-block;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,10 @@
|
||||
import { createSSRApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import Icon from './components/Icon.vue'
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.component('Icon', Icon)
|
||||
return {
|
||||
app
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<text class="username">{{ userInfo.username || '用户' }}</text>
|
||||
</view>
|
||||
<view class="role-badge" :class="roleClass">
|
||||
<text class="role-icon">👤</text>
|
||||
<Icon name="user" :size="24" color="#fff" />
|
||||
<text class="role-text">{{ roleText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -15,25 +15,31 @@
|
||||
<!-- 快捷操作 - 管理员/销售 -->
|
||||
<view class="stats-card" v-if="!isCustomer && !isGuest">
|
||||
<view class="card-header">
|
||||
<text class="card-title">📊 今日概览</text>
|
||||
<text class="card-title">今日概览</text>
|
||||
</view>
|
||||
<view class="stats-grid">
|
||||
<view class="stat-item">
|
||||
<view class="stat-icon order-icon">📋</view>
|
||||
<view class="stat-icon order-icon">
|
||||
<Icon name="order" :size="40" color="#667eea" />
|
||||
</view>
|
||||
<view class="stat-info">
|
||||
<text class="stat-value">{{ stats.orderCount || 0 }}</text>
|
||||
<text class="stat-label">今日订单</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-icon money-icon">💰</view>
|
||||
<view class="stat-icon money-icon">
|
||||
<Icon name="money" :size="40" color="#fa8c16" />
|
||||
</view>
|
||||
<view class="stat-info">
|
||||
<text class="stat-value">¥{{ stats.actualAmount || 0 }}</text>
|
||||
<text class="stat-label">今日销售额</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-icon alert-icon">⚠️</view>
|
||||
<view class="stat-icon alert-icon">
|
||||
<Icon name="alert" :size="40" color="#ff4d4f" />
|
||||
</view>
|
||||
<view class="stat-info">
|
||||
<text class="stat-value">{{ stats.stockAlerts || 0 }}</text>
|
||||
<text class="stat-label">库存预警</text>
|
||||
@@ -49,22 +55,30 @@
|
||||
<!-- 管理员菜单 -->
|
||||
<template v-if="isAdmin">
|
||||
<view class="menu-card" @click="goTo('/pages/product/manage')">
|
||||
<view class="menu-card-icon blue">📦</view>
|
||||
<view class="menu-card-icon blue">
|
||||
<Icon name="product" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">商品管理</text>
|
||||
<text class="menu-card-desc">管理商品库存</text>
|
||||
</view>
|
||||
<view class="menu-card" @click="goTo('/pages/order/create')">
|
||||
<view class="menu-card-icon green">📝</view>
|
||||
<view class="menu-card-icon green">
|
||||
<Icon name="edit" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">创建订单</text>
|
||||
<text class="menu-card-desc">新增销售订单</text>
|
||||
</view>
|
||||
<view class="menu-card" @click="goToTab('/pages/order/list')">
|
||||
<view class="menu-card-icon orange">📋</view>
|
||||
<view class="menu-card-icon orange">
|
||||
<Icon name="order" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">订单列表</text>
|
||||
<text class="menu-card-desc">查看所有订单</text>
|
||||
</view>
|
||||
<view class="menu-card" @click="goStock()">
|
||||
<view class="menu-card-icon red">🏭</view>
|
||||
<view class="menu-card-icon red">
|
||||
<Icon name="stock" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">库存管理</text>
|
||||
<text class="menu-card-desc">库存预警监控</text>
|
||||
</view>
|
||||
@@ -72,17 +86,23 @@
|
||||
<!-- 销售菜单 -->
|
||||
<template v-else-if="isSales">
|
||||
<view class="menu-card" @click="goTo('/pages/product/list')">
|
||||
<view class="menu-card-icon blue">📦</view>
|
||||
<view class="menu-card-icon blue">
|
||||
<Icon name="product" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">商品浏览</text>
|
||||
<text class="menu-card-desc">查看商品列表</text>
|
||||
</view>
|
||||
<view class="menu-card" @click="goTo('/pages/order/create')">
|
||||
<view class="menu-card-icon green">📝</view>
|
||||
<view class="menu-card-icon green">
|
||||
<Icon name="edit" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">创建订单</text>
|
||||
<text class="menu-card-desc">新增销售订单</text>
|
||||
</view>
|
||||
<view class="menu-card" @click="goToTab('/pages/order/list')">
|
||||
<view class="menu-card-icon orange">📋</view>
|
||||
<view class="menu-card-icon orange">
|
||||
<Icon name="order" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">订单列表</text>
|
||||
<text class="menu-card-desc">查看所有订单</text>
|
||||
</view>
|
||||
@@ -90,12 +110,16 @@
|
||||
<!-- 顾客菜单 -->
|
||||
<template v-else-if="isCustomer">
|
||||
<view class="menu-card" @click="goTo('/pages/product/list')">
|
||||
<view class="menu-card-icon blue">📦</view>
|
||||
<view class="menu-card-icon blue">
|
||||
<Icon name="product" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">商品浏览</text>
|
||||
<text class="menu-card-desc">查看商品列表</text>
|
||||
</view>
|
||||
<view class="menu-card" @click="goToTab('/pages/order/list')">
|
||||
<view class="menu-card-icon orange">📋</view>
|
||||
<view class="menu-card-icon orange">
|
||||
<Icon name="order" :size="40" color="#fff" />
|
||||
</view>
|
||||
<text class="menu-card-title">我的订单</text>
|
||||
<text class="menu-card-desc">查看订单记录</text>
|
||||
</view>
|
||||
@@ -103,7 +127,9 @@
|
||||
<!-- 游客菜单 -->
|
||||
<template v-else-if="isGuest">
|
||||
<view class="guest-card" @click="goTo('/pages/login/index')">
|
||||
<text class="guest-icon">🔑</text>
|
||||
<view class="guest-icon">
|
||||
<Icon name="user" :size="80" color="#fff" />
|
||||
</view>
|
||||
<text class="guest-text">点击登录</text>
|
||||
<text class="guest-desc">登录后使用完整功能</text>
|
||||
</view>
|
||||
@@ -114,7 +140,7 @@
|
||||
<!-- 提示区域 -->
|
||||
<view class="tips-section" v-if="isCustomer">
|
||||
<view class="tip-card">
|
||||
<text class="tip-title">💡 温馨提示</text>
|
||||
<text class="tip-title">温馨提示</text>
|
||||
<view class="tip-list">
|
||||
<text class="tip-item">• 您可以浏览商品</text>
|
||||
<text class="tip-item">• 您可以查看半年内的订单</text>
|
||||
@@ -125,7 +151,7 @@
|
||||
|
||||
<view class="tips-section" v-if="isGuest">
|
||||
<view class="tip-card">
|
||||
<text class="tip-title">🎉 欢迎使用</text>
|
||||
<text class="tip-title">欢迎使用</text>
|
||||
<view class="tip-list">
|
||||
<text class="tip-item">• 请登录后使用完整功能</text>
|
||||
<text class="tip-item">• 登录后可浏览商品和查看订单</text>
|
||||
@@ -135,7 +161,10 @@
|
||||
|
||||
<!-- 退出登录 -->
|
||||
<view class="logout-section" v-if="!isGuest">
|
||||
<button class="logout-btn" @click="logout">🚪 退出登录</button>
|
||||
<button class="logout-btn" @click="logout">
|
||||
<Icon name="logout" :size="32" color="#fff" style="margin-right: 10rpx" />
|
||||
退出登录
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -188,7 +217,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async loadUserInfo() {
|
||||
// 假登录时从本地存储获取
|
||||
const localRole = uni.getStorageSync('role')
|
||||
if (localRole) {
|
||||
this.userInfo = {
|
||||
@@ -197,7 +225,6 @@ export default {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const userInfo = await authApi.getCurrentUser()
|
||||
this.userInfo = userInfo
|
||||
@@ -211,7 +238,6 @@ export default {
|
||||
const stats = await orderApi.getStatistics({ startDate: today })
|
||||
this.stats.orderCount = stats.orderCount || 0
|
||||
this.stats.actualAmount = stats.actualAmount || 0
|
||||
|
||||
const alerts = await productApi.getStockAlerts()
|
||||
this.stats.stockAlerts = alerts ? alerts.length : 0
|
||||
} catch (e) {
|
||||
@@ -243,14 +269,12 @@ export default {
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 全局样式 */
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
/* 顶部欢迎区域 */
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -293,17 +317,12 @@ export default {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.role-icon {
|
||||
font-size: 28rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.role-text {
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
/* 统计卡片 */
|
||||
.stats-card {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
@@ -340,7 +359,6 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 40rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
@@ -373,7 +391,6 @@ export default {
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
/* 功能菜单区域 */
|
||||
.menu-section {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
@@ -415,7 +432,6 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 40rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
@@ -447,7 +463,6 @@ export default {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 游客登录卡片 */
|
||||
.guest-card {
|
||||
width: 100%;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
@@ -461,7 +476,6 @@ export default {
|
||||
}
|
||||
|
||||
.guest-icon {
|
||||
font-size: 80rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
@@ -477,7 +491,6 @@ export default {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
/* 提示区域 */
|
||||
.tips-section {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
@@ -508,7 +521,6 @@ export default {
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
/* 退出登录 */
|
||||
.logout-section {
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
@@ -523,6 +535,9 @@ export default {
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.logout-btn:active {
|
||||
|
||||
Reference in New Issue
Block a user