Files
medical-mall/pages/mall/admin/maintain/dev-config/category.uvue
2026-02-11 19:51:32 +08:00

269 lines
6.5 KiB
Plaintext

<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 搜索栏 -->
<view class="admin-card filter-card">
<view class="filter-row">
<view class="filter-item">
<text class="label">是否显示:</text>
<view class="filter-select">
<text class="select-placeholder">请选择</text>
<text class="arrow">▼</text>
</view>
</view>
<view class="filter-item">
<text class="label">分类名称:</text>
<input class="filter-input" placeholder="请输入分类名称" />
</view>
<button class="btn primary" @click="onSearch">查询分类</button>
</view>
<view class="filter-row mt-12">
<view class="filter-item">
<text class="label">配置名称:</text>
<input class="filter-input" placeholder="请输入配置名称" />
</view>
<button class="btn primary" @click="onSearchConfig">查询配置</button>
</view>
</view>
<!-- 内容区 -->
<view class="admin-card content-card">
<!-- 操作按钮行 -->
<view class="action-bar">
<button class="btn primary small" @click="onAdd">添加配置分类</button>
</view>
<!-- 表格 -->
<view class="table-container list-table">
<view class="table-header">
<view class="col col-id"><text>ID</text></view>
<view class="col col-name"><text>分类名称</text></view>
<view class="col col-field"><text>分类字段</text></view>
<view class="col col-status"><text>状态</text></view>
<view class="col col-ops"><text>操作</text></view>
</view>
<view class="table-body">
<view v-for="item in dataList" :key="item.id" class="table-row">
<view class="col col-id"><text>{{ item.id }}</text></view>
<view class="col col-name">
<text class="expand-icon" v-if="item.hasChildren">▶</text>
<text>{{ item.name }}</text>
</view>
<view class="col col-field"><text>{{ item.field }}</text></view>
<view class="col col-status">
<switch :checked="item.status" color="#1890ff" scale="0.8" />
</view>
<view class="col col-ops">
<text class="op-link" @click="onConfig(item)">配置列表</text>
<view class="op-divider">|</view>
<text class="op-link" @click="onEdit(item)">编辑</text>
<view class="op-divider">|</view>
<text class="op-link op-danger" @click="onDelete(item)">删除</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const dataList = ref([
{ id: 9, name: '分销配置', field: 'fenxiao', status: true, hasChildren: true },
{ id: 65, name: '接口设置', field: 'system_serve', status: true, hasChildren: true },
{ id: 69, name: '客服配置', field: 'kefu_config', status: true, hasChildren: true },
{ id: 78, name: '应用配置', field: 'sys_app', status: true, hasChildren: true },
{ id: 100, name: '用户配置', field: 'system_user_config', status: true, hasChildren: true },
{ id: 113, name: '订单配置', field: 'order_config', status: true, hasChildren: true },
{ id: 129, name: '系统配置', field: 'system_config', status: true, hasChildren: true },
{ id: 136, name: '商品配置', field: 'product_config', status: true, hasChildren: true }
])
function onSearch() {
uni.showToast({ title: '查询分类', icon: 'none' })
}
function onSearchConfig() {
uni.showToast({ title: '查询配置', icon: 'none' })
}
function onAdd() {
uni.showToast({ title: '添加配置分类', icon: 'none' })
}
function onConfig(item: any) {
uni.showToast({ title: '配置列表: ' + item.name, icon: 'none' })
}
function onEdit(item: any) {
uni.showToast({ title: '编辑: ' + item.name, icon: 'none' })
}
function onDelete(item: any) {
uni.showModal({
title: '提示',
content: '确定要删除该分类吗?',
success: (res) => {
if (res.confirm) {
uni.showToast({ title: '已删除', icon: 'none' })
}
}
})
}
</script>
<style scoped lang="scss">
.admin-page {
padding: 20px;
background-color: #f5f7f9;
min-height: 100vh;
}
.admin-card {
background-color: #fff;
border-radius: 4px;
padding: 20px;
margin-bottom: 20px;
}
.filter-row {
display: flex;
flex-direction: row;
align-items: center;
}
.mt-12 { margin-top: 12px; }
.filter-item {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 24px;
}
.label {
font-size: 14px;
color: #333;
width: 80px;
}
.filter-select {
width: 200px;
height: 32px;
border: 1px solid #d9d9d9;
border-radius: 2px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 10px;
}
.select-placeholder {
color: #bfbfbf;
font-size: 14px;
}
.arrow {
font-size: 10px;
color: #bfbfbf;
}
.filter-input {
width: 200px;
height: 32px;
border: 1px solid #d9d9d9;
border-radius: 2px;
padding: 0 10px;
font-size: 14px;
}
.btn {
height: 32px;
padding: 0 20px;
border-radius: 2px;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border: 1px solid #d9d9d9;
background-color: #fff;
}
.btn.primary {
background-color: #1890ff;
border-color: #1890ff;
color: #fff;
}
.btn.small {
height: 28px;
padding: 0 10px;
font-size: 12px;
}
.action-bar {
margin-bottom: 16px;
}
.table-container {
width: 100%;
border: 1px solid #f0f0f0;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #fafafa;
border-bottom: 1px solid #f0f0f0;
}
.table-row {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.col {
padding: 12px 16px;
display: flex;
align-items: center;
font-size: 14px;
color: #333;
}
.col-id { width: 80px; }
.col-name { flex: 2; }
.col-field { flex: 2; }
.col-status { width: 100px; justify-content: center; }
.col-ops { flex: 2; justify-content: flex-end; }
.expand-icon {
margin-right: 8px;
font-size: 10px;
color: #999;
}
.op-link {
color: #1890ff;
cursor: pointer;
margin: 0 4px;
}
.op-danger {
color: #ff4d4f;
}
.op-divider {
color: #f0f0f0;
margin: 0 4px;
}
</style>