Files
xk-doctor-wx/subPackages/sub_clinic_admin/home/index.vue
李琦 27202c0740 1. 优化了一些交互,中药药品编辑交互
2. dev和生产环境统一鉴别
2026-05-30 13:53:14 +08:00

1 line
7.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<clinic-page-layout title="工作台" :show-tabbar="true" :tab-index="0">
<view class="workspace-container">
<!-- 头部品牌卡片保留高质感的品牌渐变色改为通栏无圆角 -->
<view class="brand-card">
<view class="brand-info">
<view class="badge">
<text class="badge-text">诊所管理系统</text>
</view>
<text class="store-name">{{ storeName }}</text>
<text class="store-subtitle">欢迎回来今天也要高效工作</text>
</view>
<!-- 极简几何装饰线拒绝突兀圆块 -->
<view class="brand-decorator"></view>
</view>
<!-- 聚合面板分区 -->
<view v-for="section in sections" :key="section.key" class="section-panel">
<!-- 面板标题 -->
<view class="panel-header">
<text class="panel-title">{{ section.title }}</text>
<!-- 极简的装饰点阵 -->
<view class="panel-dots">
<text class="dot"></text><text class="dot"></text><text class="dot"></text>
</view>
</view>
<!-- 4列高密度网格 -->
<view class="grid-layout">
<view
v-for="item in section.items"
:key="item.key"
class="grid-item"
hover-class="grid-item-active"
:hover-stay-time="100"
@click="go(item.path)"
>
<view class="icon-container">
<text class="icon-char">{{ item.icon }}</text>
</view>
<text class="item-label">{{ item.label }}</text>
</view>
</view>
</view>
</view>
</clinic-page-layout>
</template>
<script>
import ClinicPageLayout from '../components/clinic-page-layout.vue'
import { getWarehouseProductTypeOptions } from '@/api/clinicAdmin.js'
const FINANCE_MENUS = [
{ key: 'withdrawal', label: '提现管理', icon: '¥', path: '/subPackages/sub_clinic_admin/withdrawal/index' },
{ key: 'reconciliation', label: '对账单', icon: '账', path: '/subPackages/sub_clinic_admin/reconciliation/index' },
]
const BUSINESS_MENUS = [
{ key: 'order', label: '商品订单', icon: '单', path: '/subPackages/sub_clinic_admin/order/index' },
]
const WAREHOUSE_FALLBACK = {
key: 'warehouse',
label: '仓库管理',
icon: '仓', // 将兜底图标改为名字首字
path: '/subPackages/sub_clinic_admin/warehouse/index',
}
export default {
components: { ClinicPageLayout },
data() {
return {
storeName: '',
warehouseMenus: [WAREHOUSE_FALLBACK],
}
},
computed: {
sections() {
return [
{ key: 'finance', title: '财务管理', items: FINANCE_MENUS },
{ key: 'business', title: '业务管理', items: BUSINESS_MENUS },
{ key: 'warehouse', title: '仓库管理', items: this.warehouseMenus },
]
},
},
onShow() {
const user = uni.getStorageSync('clinic_admin_user') || {}
this.storeName = user.store_name || (user.store && user.store.name) || user.nick_name || '诊所管理'
this.loadWarehouseMenus()
},
methods: {
loadWarehouseMenus() {
getWarehouseProductTypeOptions().then(w => {
const raw = w.data
const options = Array.isArray(raw) ? raw : []
const warehouseMenus = options.map((opt) => {
const value = opt.value != null ? opt.value : opt.id
const label = opt.label || opt.name || '仓库'
const title = label.indexOf('仓库') >= 0 ? label : label + '仓库'
return {
key: 'warehouse-' + value,
label: title,
icon: label.charAt(0), // 提取仓库名称的第一个字符作为 Icon
path: '/subPackages/sub_clinic_admin/warehouse/index?type=' + encodeURIComponent(value) + '&label=' + encodeURIComponent(title),
}
})
this.warehouseMenus = warehouseMenus.length ? warehouseMenus : [WAREHOUSE_FALLBACK]
}).catch(() => {
this.warehouseMenus = [WAREHOUSE_FALLBACK]
})
},
go(path) {
uni.navigateTo({ url: path })
},
},
}
</script>
<style lang="scss" scoped>
/* 品牌主题色 */
$theme-primary: #6acdbb;
$theme-dark: #4db6a8;
/* 页面底色采用极淡的灰底,用来衬托纯白面板 */
$color-page-bg: #F5F7F8;
$color-text-title: #222B2A;
$color-text-sub: #5B6B69;
.workspace-container {
/* 移除左右和顶部 padding保留底部安全距离 */
padding: 0 0 60rpx;
background-color: $color-page-bg;
min-height: 100vh;
box-sizing: border-box;
}
/* 顶部品牌卡片:通栏布局,移除圆角 */
.brand-card {
position: relative;
background: linear-gradient(135deg, $theme-primary 0%, $theme-dark 100%);
padding: 48rpx 40rpx 44rpx;
margin-bottom: 24rpx;
color: #ffffff;
box-shadow: 0 4rpx 16rpx rgba(106, 205, 187, 0.15);
overflow: hidden;
}
.brand-info {
position: relative;
z-index: 2;
}
.badge {
display: inline-flex;
background: rgba(255, 255, 255, 0.2);
border: 1rpx solid rgba(255, 255, 255, 0.3);
padding: 6rpx 16rpx;
border-radius: 30rpx;
margin-bottom: 24rpx;
}
.badge-text {
font-size: 20rpx;
font-weight: 600;
color: #ffffff;
}
.store-name {
font-size: 40rpx;
font-weight: 700;
display: block;
line-height: 1.3;
margin-bottom: 8rpx;
}
.store-subtitle {
font-size: 24rpx;
opacity: 0.85;
display: block;
}
.brand-decorator {
position: absolute;
right: -60rpx;
bottom: -60rpx;
width: 280rpx;
height: 280rpx;
border: 36rpx solid rgba(255, 255, 255, 0.06);
border-radius: 50%;
z-index: 1;
}
/* 聚合大面板:通栏布局,移除圆角 */
.section-panel {
background-color: #ffffff;
padding: 32rpx 32rpx 40rpx;
margin-bottom: 24rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.02);
}
/* 面板标题区 */
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 8rpx;
margin-bottom: 32rpx;
}
.panel-title {
font-size: 30rpx;
font-weight: 700;
color: $color-text-title;
}
.panel-dots {
display: flex;
gap: 6rpx;
.dot {
width: 8rpx;
height: 8rpx;
background-color: rgba(106, 205, 187, 0.3);
border-radius: 50%;
}
}
/* 4列网格布局 */
.grid-layout {
display: grid;
grid-template-columns: repeat(4, 1fr); /* 严格一行四列 */
row-gap: 40rpx; /* 行间距适中,列间距靠 fr 自动均分 */
}
/* 单个网格元素 */
.grid-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transition: opacity 0.2s;
}
.grid-item-active {
opacity: 0.6;
}
/* 图标容器:采用类 iOS 的超椭圆,并透出主题色 */
.icon-container {
width: 88rpx;
height: 88rpx;
border-radius: 28rpx;
background: linear-gradient(135deg, rgba(106, 205, 187, 0.15), rgba(106, 205, 187, 0.05));
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16rpx;
}
.icon-char {
font-size: 38rpx;
color: $theme-dark;
font-weight: 700;
}
/* 文字标签:处理过长文本的截断 */
.item-label {
font-size: 24rpx;
color: $color-text-sub;
font-weight: 500;
text-align: center;
width: 100%;
padding: 0 8rpx;
box-sizing: border-box;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>