190 lines
4.4 KiB
Plaintext
190 lines
4.4 KiB
Plaintext
<template>
|
|
<view class="admin-page-container">
|
|
<view class="page-card">
|
|
<!-- 搜索栏 -->
|
|
<view class="search-wrap">
|
|
<view class="search-item">
|
|
<text class="label">搜索:</text>
|
|
<input class="input" placeholder="请输入模板名称" v-model="searchKey" />
|
|
</view>
|
|
<button class="btn btn-primary" @click="onSearch">查询</button>
|
|
</view>
|
|
|
|
<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: 2;">模板名称</view>
|
|
<view class="th" style="flex: 2;">计费方式</view>
|
|
<view class="th" style="flex: 2;">指定包邮</view>
|
|
<view class="th" style="flex: 1;">排序</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 freightList" :key="item.id" class="tr">
|
|
<view class="td" style="flex: 1;">{{ item.id }}</view>
|
|
<view class="td" style="flex: 2;">{{ item.name }}</view>
|
|
<view class="td" style="flex: 2;">{{ item.method }}</view>
|
|
<view class="td" style="flex: 2;">{{ item.freeShipping ? '开启' : '关闭' }}</view>
|
|
<view class="td" style="flex: 1;">{{ item.sort }}</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'
|
|
|
|
const searchKey = ref('')
|
|
|
|
type FreightItem = {
|
|
id: number
|
|
name: string
|
|
method: string
|
|
freeShipping: boolean
|
|
sort: number
|
|
addTime: string
|
|
}
|
|
|
|
const freightList = reactive<FreightItem[]>([
|
|
{ id: 5, name: '测试', method: '按件数', freeShipping: false, sort: 0, addTime: '2025-05-18 09:44:14' },
|
|
{ id: 4, name: '模板3', method: '按体积', freeShipping: false, sort: 0, addTime: '2023-12-20 09:53:23' },
|
|
{ id: 3, name: '运费2', method: '按重量', freeShipping: false, sort: 0, addTime: '2023-12-20 09:53:02' },
|
|
{ id: 2, name: '模板1', method: '按件数', freeShipping: true, sort: 0, addTime: '2023-12-20 09:29:05' }
|
|
])
|
|
|
|
function onSearch() {
|
|
console.log('Search:', searchKey.value)
|
|
}
|
|
|
|
function onAdd() {
|
|
console.log('Add freight template')
|
|
}
|
|
|
|
function onEdit(item: FreightItem) {
|
|
console.log('Edit:', item.name)
|
|
}
|
|
|
|
function onDel(item: FreightItem) {
|
|
console.log('Delete:', item.id)
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.admin-page-container {
|
|
/* 使用 Layout 的背景和内边距 */
|
|
padding: 0;
|
|
background-color: transparent;
|
|
min-height: auto;
|
|
}
|
|
|
|
.page-card {
|
|
background-color: #fff;
|
|
border-radius: 4px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.search-wrap {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
padding-bottom: 20px;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.label {
|
|
font-size: 14px;
|
|
color: #606266;
|
|
}
|
|
|
|
.input {
|
|
width: 200px;
|
|
height: 32px;
|
|
padding: 0 10px;
|
|
border: 1px solid #dcdfe6;
|
|
border-radius: 4px;
|
|
font-size: 14px;
|
|
color: #606266;
|
|
margin-right: 15px;
|
|
}
|
|
|
|
.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;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.action-btn {
|
|
color: #1890ff;
|
|
font-size: 13px;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.action-btn-del {
|
|
color: #ed4014;
|
|
font-size: 13px;
|
|
}
|
|
</style>
|