feat: 分端显示
This commit is contained in:
192
src/pagesMerchant/dashboard/index.vue
Normal file
192
src/pagesMerchant/dashboard/index.vue
Normal file
@@ -0,0 +1,192 @@
|
||||
<script lang="ts" setup>
|
||||
import { useUserStore } from '@/store/user'
|
||||
|
||||
definePage({
|
||||
style: {
|
||||
navigationBarTitleText: '商家工作台',
|
||||
},
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 模拟数据
|
||||
const stats = ref({
|
||||
todayOrders: 128,
|
||||
pendingOrders: 23,
|
||||
todaySales: 15680.50,
|
||||
totalGoods: 356,
|
||||
})
|
||||
|
||||
const quickActions = [
|
||||
{ icon: 'i-carbon-document-add', label: '新增订单', path: '/pagesMerchant/order/list' },
|
||||
{ icon: 'i-carbon-add-alt', label: '新增商品', path: '/pagesMerchant/goods/edit' },
|
||||
{ icon: 'i-carbon-wallet', label: '财务中心', path: '/pagesMerchant/finance/index' },
|
||||
{ icon: 'i-carbon-settings', label: '店铺设置', path: '/pagesMerchant/me/index' },
|
||||
]
|
||||
|
||||
function handleAction(path: string) {
|
||||
uni.navigateTo({ url: path })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="dashboard-page">
|
||||
<!-- 头部欢迎 -->
|
||||
<view class="header">
|
||||
<view class="welcome">
|
||||
<text class="greeting">您好,{{ userStore.userInfo?.nickname || '商家' }}</text>
|
||||
<text class="sub-text">今日订单运营数据</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 数据卡片 -->
|
||||
<view class="stats-grid">
|
||||
<view class="stat-card">
|
||||
<text class="stat-value">{{ stats.todayOrders }}</text>
|
||||
<text class="stat-label">今日订单</text>
|
||||
</view>
|
||||
<view class="stat-card warning">
|
||||
<text class="stat-value">{{ stats.pendingOrders }}</text>
|
||||
<text class="stat-label">待处理</text>
|
||||
</view>
|
||||
<view class="stat-card success">
|
||||
<text class="stat-value">¥{{ stats.todaySales.toFixed(0) }}</text>
|
||||
<text class="stat-label">今日销售额</text>
|
||||
</view>
|
||||
<view class="stat-card">
|
||||
<text class="stat-value">{{ stats.totalGoods }}</text>
|
||||
<text class="stat-label">商品总数</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 快捷操作 -->
|
||||
<view class="section">
|
||||
<view class="section-title">快捷操作</view>
|
||||
<view class="quick-actions">
|
||||
<view
|
||||
v-for="item in quickActions"
|
||||
:key="item.label"
|
||||
class="action-item"
|
||||
@click="handleAction(item.path)"
|
||||
>
|
||||
<view class="action-icon">
|
||||
<text :class="item.icon"></text>
|
||||
</view>
|
||||
<text class="action-label">{{ item.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dashboard-page {
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, #ff8f0d 0%, #ffb347 100%);
|
||||
padding: 40rpx 30rpx 60rpx;
|
||||
|
||||
.welcome {
|
||||
color: #fff;
|
||||
|
||||
.greeting {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.sub-text {
|
||||
font-size: 26rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 20rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-top: -40rpx;
|
||||
|
||||
.stat-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
|
||||
.stat-value {
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
&.warning .stat-value {
|
||||
color: #ff8f0d;
|
||||
}
|
||||
|
||||
&.success .stat-value {
|
||||
color: #00c05a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.section {
|
||||
margin: 30rpx 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.quick-actions {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 20rpx;
|
||||
|
||||
.action-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
|
||||
.action-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background: linear-gradient(135deg, #ff8f0d 0%, #ffb347 100%);
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
text {
|
||||
font-size: 40rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.action-label {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
105
src/pagesMerchant/finance/index.vue
Normal file
105
src/pagesMerchant/finance/index.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<script lang="ts" setup>
|
||||
definePage({
|
||||
style: {
|
||||
navigationBarTitleText: '财务中心',
|
||||
},
|
||||
})
|
||||
|
||||
// 模拟数据
|
||||
const finance = ref({
|
||||
balance: 125680.50,
|
||||
pendingSettlement: 23500.00,
|
||||
monthIncome: 89600.00,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="finance-page">
|
||||
<!-- 余额卡片 -->
|
||||
<view class="balance-card">
|
||||
<text class="label">可用余额</text>
|
||||
<text class="amount">¥{{ finance.balance.toFixed(2) }}</text>
|
||||
<view class="actions">
|
||||
<view class="action-btn">提现</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 财务统计 -->
|
||||
<view class="stats">
|
||||
<view class="stat-item">
|
||||
<text class="value">¥{{ finance.pendingSettlement.toFixed(2) }}</text>
|
||||
<text class="label">待结算</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="value">¥{{ finance.monthIncome.toFixed(2) }}</text>
|
||||
<text class="label">本月收入</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.finance-page {
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.balance-card {
|
||||
background: linear-gradient(135deg, #ff8f0d 0%, #ffb347 100%);
|
||||
border-radius: 24rpx;
|
||||
padding: 40rpx;
|
||||
color: #fff;
|
||||
|
||||
.label {
|
||||
font-size: 26rpx;
|
||||
opacity: 0.9;
|
||||
display: block;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.amount {
|
||||
font-size: 56rpx;
|
||||
font-weight: 700;
|
||||
display: block;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.actions {
|
||||
.action-btn {
|
||||
display: inline-block;
|
||||
padding: 16rpx 48rpx;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 40rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.stat-item {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
|
||||
.value {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
144
src/pagesMerchant/goods/list.vue
Normal file
144
src/pagesMerchant/goods/list.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<script lang="ts" setup>
|
||||
definePage({
|
||||
style: {
|
||||
navigationBarTitleText: '商品管理',
|
||||
},
|
||||
})
|
||||
|
||||
// 模拟商品数据
|
||||
const goods = ref([
|
||||
{ id: '1', name: '苹果 iPhone 15 Pro', price: 8999.00, stock: 50, status: 'on' },
|
||||
{ id: '2', name: '华为 Mate 60 Pro', price: 6999.00, stock: 30, status: 'on' },
|
||||
{ id: '3', name: '小米 14 Ultra', price: 5999.00, stock: 0, status: 'off' },
|
||||
])
|
||||
|
||||
function handleEdit(id: string) {
|
||||
uni.navigateTo({ url: `/pagesMerchant/goods/edit?id=${id}` })
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
uni.navigateTo({ url: '/pagesMerchant/goods/edit' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="goods-list-page">
|
||||
<view class="goods-list">
|
||||
<view
|
||||
v-for="item in goods"
|
||||
:key="item.id"
|
||||
class="goods-card"
|
||||
@click="handleEdit(item.id)"
|
||||
>
|
||||
<view class="goods-info">
|
||||
<text class="goods-name">{{ item.name }}</text>
|
||||
<view class="goods-meta">
|
||||
<text class="price">¥{{ item.price.toFixed(2) }}</text>
|
||||
<text class="stock" :class="{ warning: item.stock === 0 }">
|
||||
库存:{{ item.stock }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-status" :class="item.status">
|
||||
{{ item.status === 'on' ? '上架' : '下架' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 添加按钮 -->
|
||||
<view class="add-btn" @click="handleAdd">
|
||||
<text class="i-carbon-add"></text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goods-list-page {
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
padding: 20rpx;
|
||||
padding-bottom: 120rpx;
|
||||
}
|
||||
|
||||
.goods-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.goods-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.goods-info {
|
||||
flex: 1;
|
||||
|
||||
.goods-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
display: block;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.goods-meta {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
|
||||
.price {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #ff8f0d;
|
||||
}
|
||||
|
||||
.stock {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
|
||||
&.warning {
|
||||
color: #fa4350;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.goods-status {
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 22rpx;
|
||||
|
||||
&.on {
|
||||
background: rgba(0, 192, 90, 0.1);
|
||||
color: #00c05a;
|
||||
}
|
||||
|
||||
&.off {
|
||||
background: rgba(153, 153, 153, 0.1);
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
position: fixed;
|
||||
right: 40rpx;
|
||||
bottom: 140rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background: linear-gradient(135deg, #ff8f0d 0%, #ffb347 100%);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 8rpx 24rpx rgba(255, 143, 13, 0.4);
|
||||
|
||||
text {
|
||||
font-size: 48rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
152
src/pagesMerchant/me/index.vue
Normal file
152
src/pagesMerchant/me/index.vue
Normal file
@@ -0,0 +1,152 @@
|
||||
<script lang="ts" setup>
|
||||
import { useUserStore, CLIENT_TYPE_CONFIG, ClientType } from '@/store/user'
|
||||
import { tabbarStore } from '@/tabbar/store'
|
||||
|
||||
definePage({
|
||||
style: {
|
||||
navigationBarTitleText: '商家中心',
|
||||
},
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
const config = CLIENT_TYPE_CONFIG[ClientType.MERCHANT]
|
||||
|
||||
const menuList = [
|
||||
{ icon: 'i-carbon-settings', label: '店铺设置' },
|
||||
{ icon: 'i-carbon-customer-service', label: '客服中心' },
|
||||
{ icon: 'i-carbon-help', label: '帮助中心' },
|
||||
{ icon: 'i-carbon-information', label: '关于我们' },
|
||||
]
|
||||
|
||||
function handleLogout() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要退出登录吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
userStore.logout()
|
||||
tabbarStore.setTabbarByClientType('user')
|
||||
uni.reLaunch({ url: '/pages/login/index' })
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="me-page">
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-card" :style="{ background: config.color }">
|
||||
<view class="avatar">
|
||||
<image :src="userStore.userInfo?.avatar || '/static/images/avatar.jpg'" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<text class="nickname">{{ userStore.userInfo?.nickname || '商家用户' }}</text>
|
||||
<text class="tag">{{ config.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 菜单列表 -->
|
||||
<view class="menu-list">
|
||||
<view v-for="item in menuList" :key="item.label" class="menu-item">
|
||||
<view class="menu-left">
|
||||
<text :class="item.icon" class="menu-icon"></text>
|
||||
<text class="menu-label">{{ item.label }}</text>
|
||||
</view>
|
||||
<text class="i-carbon-chevron-right"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 退出登录 -->
|
||||
<view class="logout-btn" @click="handleLogout">退出登录</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.me-page {
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
padding: 60rpx 30rpx 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24rpx;
|
||||
|
||||
.avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.5);
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
.nickname {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.tag {
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.menu-list {
|
||||
background: #fff;
|
||||
margin: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.menu-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
|
||||
.menu-icon {
|
||||
font-size: 40rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.menu-label {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
margin: 40rpx 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
color: #fa4350;
|
||||
}
|
||||
</style>
|
||||
114
src/pagesMerchant/order/list.vue
Normal file
114
src/pagesMerchant/order/list.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<script lang="ts" setup>
|
||||
definePage({
|
||||
style: {
|
||||
navigationBarTitleText: '订单管理',
|
||||
},
|
||||
})
|
||||
|
||||
// 模拟订单数据
|
||||
const orders = ref([
|
||||
{ id: '1', orderNo: 'M202312170001', customer: '张三', amount: 299.00, status: 'pending', time: '10:30' },
|
||||
{ id: '2', orderNo: 'M202312170002', customer: '李四', amount: 1580.00, status: 'processing', time: '09:45' },
|
||||
{ id: '3', orderNo: 'M202312170003', customer: '王五', amount: 456.50, status: 'completed', time: '08:20' },
|
||||
])
|
||||
|
||||
const statusMap: Record<string, { text: string; color: string }> = {
|
||||
pending: { text: '待处理', color: '#ff8f0d' },
|
||||
processing: { text: '处理中', color: '#4d80f0' },
|
||||
completed: { text: '已完成', color: '#00c05a' },
|
||||
}
|
||||
|
||||
function handleOrder(id: string) {
|
||||
uni.navigateTo({ url: `/pagesMerchant/order/detail?id=${id}` })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="order-list-page">
|
||||
<view class="order-list">
|
||||
<view
|
||||
v-for="order in orders"
|
||||
:key="order.id"
|
||||
class="order-card"
|
||||
@click="handleOrder(order.id)"
|
||||
>
|
||||
<view class="order-header">
|
||||
<text class="order-no">{{ order.orderNo }}</text>
|
||||
<text class="order-status" :style="{ color: statusMap[order.status].color }">
|
||||
{{ statusMap[order.status].text }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="order-body">
|
||||
<text class="customer">客户:{{ order.customer }}</text>
|
||||
<text class="amount">¥{{ order.amount.toFixed(2) }}</text>
|
||||
</view>
|
||||
<view class="order-footer">
|
||||
<text class="time">今天 {{ order.time }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.order-list-page {
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.order-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.order-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
|
||||
.order-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16rpx;
|
||||
|
||||
.order-no {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.order-status {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.order-body {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
.customer {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.amount {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #ff8f0d;
|
||||
}
|
||||
}
|
||||
|
||||
.order-footer {
|
||||
.time {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user