162 lines
3.7 KiB
Plaintext
162 lines
3.7 KiB
Plaintext
<template>
|
|
<view class="admin-page-container">
|
|
<view class="page-card">
|
|
<view class="action-wrap">
|
|
<button class="btn btn-primary" @click="onAdd">添加配送员</button>
|
|
</view>
|
|
|
|
<!-- 表格区域 -->
|
|
<view class="table-wrap">
|
|
<view class="table-header">
|
|
<view class="th" style="flex: 1;">ID</view>
|
|
<view class="th" style="flex: 1.5;">头像</view>
|
|
<view class="th" style="flex: 2;">名称</view>
|
|
<view class="th" style="flex: 2.5;">手机号码</view>
|
|
<view class="th" style="flex: 1.5;">是否显示</view>
|
|
<view class="th" style="flex: 3;">添加时间</view>
|
|
<view class="th" style="flex: 2;">操作</view>
|
|
</view>
|
|
<view class="table-body">
|
|
<view v-for="item in courierList" :key="item.id" class="tr">
|
|
<view class="td" style="flex: 1;">{{ item.id }}</view>
|
|
<view class="td" style="flex: 1.5;">
|
|
<image class="avatar" :src="item.avatar" mode="aspectFill" />
|
|
</view>
|
|
<view class="td" style="flex: 2;">{{ item.name }}</view>
|
|
<view class="td" style="flex: 2.5;">{{ item.phone }}</view>
|
|
<view class="td" style="flex: 1.5;">
|
|
<switch :checked="item.isshow" color="#1890ff" @change="onToggleShow(item)" />
|
|
</view>
|
|
<view class="td" style="flex: 3;">{{ item.addTime }}</view>
|
|
<view class="td" style="flex: 2;">
|
|
<text class="action-btn" @click="onEdit(item)">编辑</text>
|
|
<text class="action-btn-del" @click="onDel(item)">删除</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="uts">
|
|
import { ref, reactive } from 'vue'
|
|
|
|
type CourierItem = {
|
|
id: number
|
|
avatar: string
|
|
name: string
|
|
phone: string
|
|
isshow: boolean
|
|
addTime: string
|
|
}
|
|
|
|
const courierList = reactive<CourierItem[]>([
|
|
{ id: 106, avatar: '/static/logo.png', name: 'cheshi', phone: '18943652356', isshow: true, addTime: '2025-06-29 21:45:19' },
|
|
{ id: 105, avatar: '/static/logo.png', name: 'dl', phone: '15648569914', isshow: true, addTime: '2025-06-28 18:40:26' },
|
|
{ id: 102, avatar: '/static/logo.png', name: '小牛马', phone: '13548652258', isshow: true, addTime: '2025-06-26 15:14:40' }
|
|
])
|
|
|
|
function onAdd() {
|
|
console.log('Add courier')
|
|
}
|
|
|
|
function onToggleShow(item: CourierItem) {
|
|
item.isshow = !item.isshow
|
|
}
|
|
|
|
function onEdit(item: CourierItem) {
|
|
console.log('Edit:', item.name)
|
|
}
|
|
|
|
function onDel(item: CourierItem) {
|
|
console.log('Delete:', item.id)
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.admin-page-container {
|
|
/* 使用 Layout 的背景和内边距 */
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.page-card {
|
|
background-color: #fff;
|
|
border-radius: 4px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.action-wrap {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.btn {
|
|
height: 32px;
|
|
line-height: 30px;
|
|
padding: 0 15px;
|
|
font-size: 14px;
|
|
border-radius: 4px;
|
|
border: none;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: #1890ff;
|
|
color: #fff;
|
|
}
|
|
|
|
.table-wrap {
|
|
width: 100%;
|
|
border: 1px solid #f0f0f0;
|
|
}
|
|
|
|
.table-header {
|
|
display: flex;
|
|
flex-direction: row;
|
|
background-color: #f8f8f9;
|
|
}
|
|
|
|
.th {
|
|
padding: 12px 10px;
|
|
font-size: 14px;
|
|
font-weight: bold;
|
|
color: #515a6e;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
text-align: center;
|
|
}
|
|
|
|
.tr {
|
|
display: flex;
|
|
flex-direction: row;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
}
|
|
|
|
.td {
|
|
padding: 12px 10px;
|
|
font-size: 14px;
|
|
color: #515a6e;
|
|
text-align: center;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.avatar {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.action-btn {
|
|
color: #1890ff;
|
|
font-size: 13px;
|
|
margin-right: 10px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.action-btn-del {
|
|
color: #ed4014;
|
|
font-size: 13px;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|