Merge remote-tracking branch 'origin/huangzhenbao-admin'
This commit is contained in:
233
pages/mall/admin/setting/delivery/management/index.uvue
Normal file
233
pages/mall/admin/setting/delivery/management/index.uvue
Normal file
@@ -0,0 +1,233 @@
|
||||
<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 pagedList" :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>
|
||||
<CommonPagination
|
||||
v-if="total > 0"
|
||||
:total="total"
|
||||
:loading="false"
|
||||
:currentPage="currentPage"
|
||||
:pageSize="pageSize"
|
||||
:pageSizeOptionLabels="pageSizeOptionLabels"
|
||||
:pageSizeIndex="pageSizeIndex"
|
||||
:visiblePages="visiblePages"
|
||||
:totalPage="totalPage"
|
||||
:jumpPageInput="jumpPageInput"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@page-change="handlePageChange"
|
||||
@update:jumpPageInput="(val: string) => { jumpPageInput.value = val }"
|
||||
@jump-page="handleJumpPage"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, computed } from 'vue'
|
||||
import CommonPagination from '@/components/CommonPagination/CommonPagination.uvue'
|
||||
|
||||
type CourierItem = {
|
||||
id: number
|
||||
avatar: string
|
||||
name: string
|
||||
phone: string
|
||||
isshow: boolean
|
||||
addTime: string
|
||||
}
|
||||
|
||||
// ========== MOCK DATA START ==========
|
||||
// TODO: 接真实接口时替换此处 courierList 为 fetchCourierList() 调用
|
||||
const courierList = ref<CourierItem[]>([
|
||||
{ id: 120, avatar: '/static/logo.png', name: '王明', phone: '13812345678', isshow: true, addTime: '2025-06-29 21:45:19' },
|
||||
{ id: 119, avatar: '/static/logo.png', name: '李红', phone: '13987654321', isshow: true, addTime: '2025-06-28 18:40:26' },
|
||||
{ id: 118, avatar: '/static/logo.png', name: '张伟', phone: '15800001111', isshow: true, addTime: '2025-06-27 09:00:00' },
|
||||
{ id: 117, avatar: '/static/logo.png', name: '刘洋', phone: '15900002222', isshow: false, addTime: '2025-06-26 15:14:40' },
|
||||
{ id: 116, avatar: '/static/logo.png', name: '陈娟', phone: '13600003333', isshow: true, addTime: '2025-06-25 10:00:00' },
|
||||
{ id: 115, avatar: '/static/logo.png', name: '杨帆', phone: '13700004444', isshow: true, addTime: '2025-06-24 08:30:00' },
|
||||
{ id: 114, avatar: '/static/logo.png', name: '赵雷', phone: '18900005555', isshow: false, addTime: '2025-06-23 11:20:00' },
|
||||
{ id: 113, avatar: '/static/logo.png', name: '周芳', phone: '13500006666', isshow: true, addTime: '2025-06-22 14:50:00' },
|
||||
{ id: 112, avatar: '/static/logo.png', name: '吴勇', phone: '15600007777', isshow: true, addTime: '2025-06-21 16:10:00' },
|
||||
{ id: 111, avatar: '/static/logo.png', name: '郑山', phone: '18700008888', isshow: true, addTime: '2025-06-20 09:40:00' },
|
||||
{ id: 110, avatar: '/static/logo.png', name: '孙海', phone: '13900009999', isshow: false, addTime: '2025-06-19 13:00:00' },
|
||||
{ id: 109, avatar: '/static/logo.png', name: '马琳', phone: '15300010101', isshow: true, addTime: '2025-06-18 07:50:00' },
|
||||
{ id: 108, avatar: '/static/logo.png', name: '胡兴', phone: '18600011111', isshow: true, addTime: '2025-06-17 12:00:00' },
|
||||
{ id: 107, avatar: '/static/logo.png', name: '高雪', phone: '13200012222', isshow: true, addTime: '2025-06-16 15:30:00' },
|
||||
{ id: 106, avatar: '/static/logo.png', name: 'cheshi', phone: '18943652356', isshow: true, addTime: '2025-06-15 21:45:19' },
|
||||
{ id: 105, avatar: '/static/logo.png', name: 'dl', phone: '15648569914', isshow: true, addTime: '2025-06-14 18:40:26' },
|
||||
{ id: 104, avatar: '/static/logo.png', name: '小牛马', phone: '13548652258', isshow: true, addTime: '2025-06-13 15:14:40' },
|
||||
{ id: 103, avatar: '/static/logo.png', name: '小李', phone: '13200013333', isshow: false, addTime: '2025-06-12 10:00:00' },
|
||||
{ id: 102, avatar: '/static/logo.png', name: '小刘', phone: '15000014444', isshow: true, addTime: '2025-06-11 09:00:00' },
|
||||
{ id: 101, avatar: '/static/logo.png', name: '小王', phone: '13300015555', isshow: true, addTime: '2025-06-10 08:00:00' }
|
||||
])
|
||||
// ========== MOCK DATA END ==========
|
||||
|
||||
// ========== PAGINATION STATE ==========
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(15)
|
||||
const jumpPageInput = ref('')
|
||||
const pageSizeOptions = [10, 15, 20, 30, 50]
|
||||
const pageSizeOptionLabels = computed(() => pageSizeOptions.map((n: number) => `${n}条/页`))
|
||||
const pageSizeIndex = computed(() => { const idx = pageSizeOptions.indexOf(pageSize.value); return idx >= 0 ? idx : 0 })
|
||||
const total = computed(() => courierList.value.length)
|
||||
const totalPage = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
|
||||
const pagedList = computed(() => {
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return courierList.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
const visiblePages = computed((): number[] => {
|
||||
const t = totalPage.value; const cur = currentPage.value
|
||||
if (t <= 7) return Array.from({ length: t }, (_: any, i: number) => i + 1)
|
||||
if (cur <= 4) return [1, 2, 3, 4, 5, -1, t]
|
||||
if (cur >= t - 3) return [1, -1, t - 4, t - 3, t - 2, t - 1, t]
|
||||
return [1, -1, cur - 1, cur, cur + 1, -1, t]
|
||||
})
|
||||
const handlePageChange = (p: number) => { currentPage.value = p }
|
||||
const handlePageSizeChange = (e: any) => {
|
||||
const idx = Number(e.detail.value)
|
||||
pageSize.value = pageSizeOptions[idx] ?? pageSizeOptions[0]
|
||||
currentPage.value = 1
|
||||
}
|
||||
const handleJumpPage = () => {
|
||||
const p = parseInt(jumpPageInput.value)
|
||||
if (!isNaN(p) && p >= 1 && p <= totalPage.value) currentPage.value = p
|
||||
}
|
||||
// ========== END PAGINATION STATE ==========
|
||||
|
||||
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 的背景和内边距 */
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.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;
|
||||
flex-direction: row;
|
||||
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>
|
||||
302
pages/mall/admin/setting/delivery/setting/station/index.uvue
Normal file
302
pages/mall/admin/setting/delivery/setting/station/index.uvue
Normal file
@@ -0,0 +1,302 @@
|
||||
<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>
|
||||
|
||||
<!-- 状态 Tabs -->
|
||||
<view class="tabs-wrap">
|
||||
<view class="tab-item active"><text class="tab-text">显示中的提货点(2)</text></view>
|
||||
<view class="tab-item"><text class="tab-text">隐藏中的提货点(0)</text></view>
|
||||
<view class="tab-item"><text class="tab-text">回收站中的提货点(9)</text></view>
|
||||
</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: 3;">地址</view>
|
||||
<view class="th" style="flex: 3;">营业时间</view>
|
||||
<view class="th" style="flex: 1.5;">是否显示</view>
|
||||
<view class="th" style="flex: 2;">操作</view>
|
||||
</view>
|
||||
<view class="table-body">
|
||||
<view v-for="item in pagedList" :key="item.id" class="tr">
|
||||
<view class="td" style="flex: 1;">{{ item.id }}</view>
|
||||
<view class="td" style="flex: 2;">
|
||||
<image class="station-img" :src="item.image" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="td" style="flex: 2;">{{ item.name }}</view>
|
||||
<view class="td" style="flex: 2;">{{ item.phone }}</view>
|
||||
<view class="td" style="flex: 3;">{{ item.address }}</view>
|
||||
<view class="td" style="flex: 3;">{{ item.hours }}</view>
|
||||
<view class="td" style="flex: 1.5;">
|
||||
<switch :checked="item.isshow" color="#1890ff" />
|
||||
</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>
|
||||
<CommonPagination
|
||||
v-if="total > 0"
|
||||
:total="total"
|
||||
:loading="false"
|
||||
:currentPage="currentPage"
|
||||
:pageSize="pageSize"
|
||||
:pageSizeOptionLabels="pageSizeOptionLabels"
|
||||
:pageSizeIndex="pageSizeIndex"
|
||||
:visiblePages="visiblePages"
|
||||
:totalPage="totalPage"
|
||||
:jumpPageInput="jumpPageInput"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@page-change="handlePageChange"
|
||||
@update:jumpPageInput="(val: string) => { jumpPageInput.value = val }"
|
||||
@jump-page="handleJumpPage"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, computed } from 'vue'
|
||||
import CommonPagination from '@/components/CommonPagination/CommonPagination.uvue'
|
||||
|
||||
const searchKey = ref('')
|
||||
|
||||
type StationItem = {
|
||||
id: number
|
||||
image: string
|
||||
name: string
|
||||
phone: string
|
||||
address: string
|
||||
hours: string
|
||||
isshow: boolean
|
||||
}
|
||||
|
||||
// ========== MOCK DATA START ==========
|
||||
// TODO: 接真实接口时替换此处 stationList 为 fetchStationList() 调用
|
||||
const stationList = ref<StationItem[]>([
|
||||
{ id: 65, image: '/static/logo.png', name: '北京朝阳门提货点', phone: '13012340001', address: '北京市朝阳区建国路1号', hours: '09:00 - 21:00', isshow: true },
|
||||
{ id: 64, image: '/static/logo.png', name: '北京海淨区提货点', phone: '13012340002', address: '北京市海淨区中关村大腃4号', hours: '08:30 - 20:30', isshow: true },
|
||||
{ id: 63, image: '/static/logo.png', name: '上海浦东新区提货点', phone: '13012340003', address: '上海市浦东新区张江高科2号', hours: '09:00 - 22:00', isshow: true },
|
||||
{ id: 62, image: '/static/logo.png', name: '上海徐汇提货点', phone: '13012340004', address: '上海市徐汇区淮海中路100号', hours: '10:00 - 21:00', isshow: false },
|
||||
{ id: 61, image: '/static/logo.png', name: '广州天河提货点', phone: '13012340005', address: '广州市天河区天河北路55号', hours: '09:00 - 21:00', isshow: true },
|
||||
{ id: 60, image: '/static/logo.png', name: '广州越秀提货点', phone: '13012340006', address: '广州市越秀区环市东路18号', hours: '08:00 - 20:00', isshow: true },
|
||||
{ id: 59, image: '/static/logo.png', name: '深圳南山提货点', phone: '13012340007', address: '深圳市南山区松白路7号', hours: '09:00 - 22:00', isshow: true },
|
||||
{ id: 58, image: '/static/logo.png', name: '深圳福田提货点', phone: '13012340008', address: '深圳市福田区深南大道青年公指1号', hours: '09:00 - 21:00', isshow: false },
|
||||
{ id: 57, image: '/static/logo.png', name: '成都武侯提货点', phone: '13012340009', address: '成都市武侯区為最居东路3号', hours: '09:00 - 21:00', isshow: true },
|
||||
{ id: 56, image: '/static/logo.png', name: '成都高新提货点', phone: '13012340010', address: '成都市高新区天府大道三段501号', hours: '08:30 - 20:30', isshow: true },
|
||||
{ id: 55, image: '/static/logo.png', name: '杭州西湖提货点', phone: '13012340011', address: '杭州市西湖区建途路21号', hours: '09:00 - 22:00', isshow: true },
|
||||
{ id: 54, image: '/static/logo.png', name: '杭州滨江提货点', phone: '13012340012', address: '杭州市拱墅区餓山镇中路', hours: '10:00 - 21:00', isshow: false },
|
||||
{ id: 53, image: '/static/logo.png', name: '武汉江汉提货点', phone: '13012340013', address: '武汉市江汉区建设大道100号', hours: '09:00 - 20:00', isshow: true },
|
||||
{ id: 52, image: '/static/logo.png', name: '武汉武昌提货点', phone: '13012340014', address: '武汉市武昌区紫菓路58号', hours: '08:30 - 21:00', isshow: true },
|
||||
{ id: 51, image: '/static/logo.png', name: '南京中山提货点', phone: '13012340015', address: '南京市中山区阳山路123号', hours: '09:00 - 21:00', isshow: true },
|
||||
{ id: 50, image: '/static/logo.png', name: '南京冿淮提货点', phone: '13012340016', address: '南京市冿淮区广州路9号', hours: '09:00 - 20:30', isshow: true },
|
||||
{ id: 49, image: '/static/logo.png', name: '苏州工业园提货点', phone: '13012340017', address: '苏州工业园区现代大道168号', hours: '09:00 - 21:00', isshow: false },
|
||||
{ id: 48, image: '/static/logo.png', name: '苏州姑苏提货点', phone: '13012340018', address: '苏州市姑苏区干将东路66号', hours: '07:30 - 22:00', isshow: true },
|
||||
{ id: 47, image: '/static/logo.png', name: '提货点222', phone: '13769102384', address: '能看见你的困难', hours: '00:00:00 - 23:00:00', isshow: true },
|
||||
{ id: 44, image: '/static/logo.png', name: '美东科技', phone: '15912341234', address: '襄阳火车站', hours: '08:00:00 - 22:00:00', isshow: true }
|
||||
])
|
||||
// ========== MOCK DATA END ==========
|
||||
|
||||
// ========== PAGINATION STATE ==========
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(15)
|
||||
const jumpPageInput = ref('')
|
||||
const pageSizeOptions = [10, 15, 20, 30, 50]
|
||||
const pageSizeOptionLabels = computed(() => pageSizeOptions.map((n: number) => `${n}条/页`))
|
||||
const pageSizeIndex = computed(() => { const idx = pageSizeOptions.indexOf(pageSize.value); return idx >= 0 ? idx : 0 })
|
||||
const total = computed(() => stationList.value.length)
|
||||
const totalPage = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
|
||||
const pagedList = computed(() => {
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return stationList.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
const visiblePages = computed((): number[] => {
|
||||
const t = totalPage.value; const cur = currentPage.value
|
||||
if (t <= 7) return Array.from({ length: t }, (_: any, i: number) => i + 1)
|
||||
if (cur <= 4) return [1, 2, 3, 4, 5, -1, t]
|
||||
if (cur >= t - 3) return [1, -1, t - 4, t - 3, t - 2, t - 1, t]
|
||||
return [1, -1, cur - 1, cur, cur + 1, -1, t]
|
||||
})
|
||||
const handlePageChange = (p: number) => { currentPage.value = p }
|
||||
const handlePageSizeChange = (e: any) => {
|
||||
const idx = Number(e.detail.value)
|
||||
pageSize.value = pageSizeOptions[idx] ?? pageSizeOptions[0]
|
||||
currentPage.value = 1
|
||||
}
|
||||
const handleJumpPage = () => {
|
||||
const p = parseInt(jumpPageInput.value)
|
||||
if (!isNaN(p) && p >= 1 && p <= totalPage.value) currentPage.value = p
|
||||
}
|
||||
// ========== END PAGINATION STATE ==========
|
||||
|
||||
function onSearch() {
|
||||
console.log('Search:', searchKey.value)
|
||||
}
|
||||
|
||||
function onAdd() {
|
||||
console.log('Add station')
|
||||
}
|
||||
|
||||
function onEdit(item: StationItem) {
|
||||
console.log('Edit:', item.name)
|
||||
}
|
||||
|
||||
function onDel(item: StationItem) {
|
||||
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: 250px;
|
||||
height: 32px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.tabs-wrap {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 1px solid #f0f2f5;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
padding: 10px 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
border-bottom: 2px solid #1890ff;
|
||||
}
|
||||
|
||||
.tab-item.active .tab-text {
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 14px;
|
||||
color: #515a6e;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.station-img {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
color: #1890ff;
|
||||
font-size: 13px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.action-btn-del {
|
||||
color: #ed4014;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
@@ -204,9 +204,10 @@ function getCalcMethodName(method: string): string {
|
||||
|
||||
<style scoped>
|
||||
.admin-page-container {
|
||||
padding: 15px;
|
||||
background-color: #f5f7f9;
|
||||
min-height: 100vh;
|
||||
/* 使用 Layout 的背景和内边距 */
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.page-card {
|
||||
@@ -290,6 +291,7 @@ function getCalcMethodName(method: string): string {
|
||||
color: #515a6e;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
280
pages/mall/admin/setting/delivery/setting/verifier/index.uvue
Normal file
280
pages/mall/admin/setting/delivery/setting/verifier/index.uvue
Normal file
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<view class="admin-page-container">
|
||||
<view class="page-card">
|
||||
<!-- 搜索栏 -->
|
||||
<view class="search-wrap">
|
||||
<view class="search-item">
|
||||
<text class="label">提货点名称:</text>
|
||||
<picker mode="selector" :range="stationRange" @change="onStationChange">
|
||||
<view class="picker-input">{{ stationText }}</view>
|
||||
</picker>
|
||||
</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: 1.5;">头像</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: 3;">添加时间</view>
|
||||
<view class="th" style="flex: 1.5;">状态</view>
|
||||
<view class="th" style="flex: 2;">操作</view>
|
||||
</view>
|
||||
<view class="table-body">
|
||||
<view v-for="item in pagedList" :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.wechatName }}</view>
|
||||
<view class="td" style="flex: 2;">{{ item.name }}</view>
|
||||
<view class="td" style="flex: 2;">{{ item.station }}</view>
|
||||
<view class="td" style="flex: 3;">{{ item.addTime }}</view>
|
||||
<view class="td" style="flex: 1.5;">
|
||||
<switch :checked="item.status" color="#1890ff" />
|
||||
</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>
|
||||
<CommonPagination
|
||||
v-if="total > 0"
|
||||
:total="total"
|
||||
:loading="false"
|
||||
:currentPage="currentPage"
|
||||
:pageSize="pageSize"
|
||||
:pageSizeOptionLabels="pageSizeOptionLabels"
|
||||
:pageSizeIndex="pageSizeIndex"
|
||||
:visiblePages="visiblePages"
|
||||
:totalPage="totalPage"
|
||||
:jumpPageInput="jumpPageInput"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@page-change="handlePageChange"
|
||||
@update:jumpPageInput="(val: string) => { jumpPageInput.value = val }"
|
||||
@jump-page="handleJumpPage"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, computed } from 'vue'
|
||||
import CommonPagination from '@/components/CommonPagination/CommonPagination.uvue'
|
||||
|
||||
const stationRange = ['所有', '提货点222', '美东科技']
|
||||
const stationText = ref('请选择')
|
||||
|
||||
type VerifierItem = {
|
||||
id: number
|
||||
avatar: string
|
||||
wechatName: string
|
||||
name: string
|
||||
station: string
|
||||
addTime: string
|
||||
status: boolean
|
||||
}
|
||||
|
||||
// ========== MOCK DATA START ==========
|
||||
// TODO: 接真实接口时替换此处 verifierList 为 fetchVerifierList() 调用
|
||||
const verifierList = ref<VerifierItem[]>([
|
||||
{ id: 113, avatar: '/static/logo.png', wechatName: '林小星', name: '13800000001', station: '提货点222', addTime: '2025-11-01 09:00:00', status: true },
|
||||
{ id: 112, avatar: '/static/logo.png', wechatName: '吴明', name: '13800000002', station: '美东科技', addTime: '2025-10-30 10:20:00', status: true },
|
||||
{ id: 111, avatar: '/static/logo.png', wechatName: '赵姐', name: '13800000003', station: '提货点222', addTime: '2025-10-29 11:40:00', status: false },
|
||||
{ id: 110, avatar: '/static/logo.png', wechatName: '高先', name: '13800000004', station: '美东科技', addTime: '2025-10-28 08:30:00', status: true },
|
||||
{ id: 109, avatar: '/static/logo.png', wechatName: '孙明', name: '13800000005', station: '提货点222', addTime: '2025-10-27 14:00:00', status: true },
|
||||
{ id: 108, avatar: '/static/logo.png', wechatName: '周波', name: '13800000006', station: '美东科技', addTime: '2025-10-26 16:10:00', status: true },
|
||||
{ id: 107, avatar: '/static/logo.png', wechatName: '郑军', name: '13800000007', station: '提货点222', addTime: '2025-10-25 09:50:00', status: false },
|
||||
{ id: 106, avatar: '/static/logo.png', wechatName: '谢婷', name: '13800000008', station: '美东科技', addTime: '2025-10-24 13:20:00', status: true },
|
||||
{ id: 105, avatar: '/static/logo.png', wechatName: '谢军', name: '13800000009', station: '提货点222', addTime: '2025-10-23 11:00:00', status: true },
|
||||
{ id: 104, avatar: '/static/logo.png', wechatName: '马芳', name: '13800000010', station: '美东科技', addTime: '2025-10-22 12:30:00', status: true },
|
||||
{ id: 103, avatar: '/static/logo.png', wechatName: '李迪', name: '13800000011', station: '提货点222', addTime: '2025-10-21 10:00:00', status: false },
|
||||
{ id: 102, avatar: '/static/logo.png', wechatName: '张玉', name: '13800000012', station: '美东科技', addTime: '2025-10-20 15:40:00', status: true },
|
||||
{ id: 101, avatar: '/static/logo.png', wechatName: '王海', name: '13800000013', station: '提货点222', addTime: '2025-10-19 08:20:00', status: true },
|
||||
{ id: 100, avatar: '/static/logo.png', wechatName: '刘云', name: '13800000014', station: '美东科技', addTime: '2025-10-18 09:10:00', status: true },
|
||||
{ id: 99, avatar: '/static/logo.png', wechatName: '陈山', name: '13800000015', station: '提货点222', addTime: '2025-10-17 11:30:00', status: false },
|
||||
{ id: 98, avatar: '/static/logo.png', wechatName: '吴州', name: '13800000016', station: '美东科技', addTime: '2025-10-16 14:50:00', status: true },
|
||||
{ id: 97, avatar: '/static/logo.png', wechatName: '魏桂', name: '13800000017', station: '提货点222', addTime: '2025-10-15 10:20:00', status: true },
|
||||
{ id: 96, avatar: '/static/logo.png', wechatName: '彭冬', name: '13800000018', station: '美东科技', addTime: '2025-10-14 16:00:00', status: true },
|
||||
{ id: 95, avatar: '/static/logo.png', wechatName: '夏迪', name: '13800000019', station: '提货点222', addTime: '2025-10-23 10:45:07', status: true },
|
||||
{ id: 94, avatar: '/static/logo.png', wechatName: '地球人', name: '15920014197', station: '美东科技', addTime: '2025-10-22 10:33:07', status: true }
|
||||
])
|
||||
// ========== MOCK DATA END ==========
|
||||
|
||||
// ========== PAGINATION STATE ==========
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(15)
|
||||
const jumpPageInput = ref('')
|
||||
const pageSizeOptions = [10, 15, 20, 30, 50]
|
||||
const pageSizeOptionLabels = computed(() => pageSizeOptions.map((n: number) => `${n}条/页`))
|
||||
const pageSizeIndex = computed(() => { const idx = pageSizeOptions.indexOf(pageSize.value); return idx >= 0 ? idx : 0 })
|
||||
const total = computed(() => verifierList.value.length)
|
||||
const totalPage = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
|
||||
const pagedList = computed(() => {
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return verifierList.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
const visiblePages = computed((): number[] => {
|
||||
const t = totalPage.value; const cur = currentPage.value
|
||||
if (t <= 7) return Array.from({ length: t }, (_: any, i: number) => i + 1)
|
||||
if (cur <= 4) return [1, 2, 3, 4, 5, -1, t]
|
||||
if (cur >= t - 3) return [1, -1, t - 4, t - 3, t - 2, t - 1, t]
|
||||
return [1, -1, cur - 1, cur, cur + 1, -1, t]
|
||||
})
|
||||
const handlePageChange = (p: number) => { currentPage.value = p }
|
||||
const handlePageSizeChange = (e: any) => {
|
||||
const idx = Number(e.detail.value)
|
||||
pageSize.value = pageSizeOptions[idx] ?? pageSizeOptions[0]
|
||||
currentPage.value = 1
|
||||
}
|
||||
const handleJumpPage = () => {
|
||||
const p = parseInt(jumpPageInput.value)
|
||||
if (!isNaN(p) && p >= 1 && p <= totalPage.value) currentPage.value = p
|
||||
}
|
||||
// ========== END PAGINATION STATE ==========
|
||||
|
||||
function onStationChange(e: any) {
|
||||
const index = parseInt(e.detail.value.toString())
|
||||
stationText.value = stationRange[index]
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
console.log('Search:', stationText.value)
|
||||
}
|
||||
|
||||
function onAdd() {
|
||||
console.log('Add verifier')
|
||||
}
|
||||
|
||||
function onEdit(item: VerifierItem) {
|
||||
console.log('Edit:', item.name)
|
||||
}
|
||||
|
||||
function onDel(item: VerifierItem) {
|
||||
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;
|
||||
}
|
||||
|
||||
.picker-input {
|
||||
width: 200px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
background-color: #fff;
|
||||
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;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
color: #1890ff;
|
||||
font-size: 13px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.action-btn-del {
|
||||
color: #ed4014;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,207 +0,0 @@
|
||||
<template>
|
||||
<view class="admin-page-container">
|
||||
<view class="page-card">
|
||||
<!-- 搜索栏 -->
|
||||
<view class="search-wrap">
|
||||
<view class="search-item">
|
||||
<text class="label">提货点名称:</text>
|
||||
<picker mode="selector" :range="stationRange" @change="onStationChange">
|
||||
<view class="picker-input">{{ stationText }}</view>
|
||||
</picker>
|
||||
</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: 1.5;">头像</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: 3;">添加时间</view>
|
||||
<view class="th" style="flex: 1.5;">状态</view>
|
||||
<view class="th" style="flex: 2;">操作</view>
|
||||
</view>
|
||||
<view class="table-body">
|
||||
<view v-for="item in verifierList" :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.wechatName }}</view>
|
||||
<view class="td" style="flex: 2;">{{ item.name }}</view>
|
||||
<view class="td" style="flex: 2;">{{ item.station }}</view>
|
||||
<view class="td" style="flex: 3;">{{ item.addTime }}</view>
|
||||
<view class="td" style="flex: 1.5;">
|
||||
<switch :checked="item.status" color="#1890ff" />
|
||||
</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 stationRange = ['所有', '提货点222', '美东科技']
|
||||
const stationText = ref('请选择')
|
||||
|
||||
type VerifierItem = {
|
||||
id: number
|
||||
avatar: string
|
||||
wechatName: string
|
||||
name: string
|
||||
station: string
|
||||
addTime: string
|
||||
status: boolean
|
||||
}
|
||||
|
||||
const verifierList = reactive<VerifierItem[]>([
|
||||
{ id: 94, avatar: '/static/logo.png', wechatName: '地球人', name: '15920014197', station: '美东科技', addTime: '2025-10-22 10:33:07', status: true }
|
||||
])
|
||||
|
||||
function onStationChange(e: any) {
|
||||
const index = parseInt(e.detail.value.toString())
|
||||
stationText.value = stationRange[index]
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
console.log('Search:', stationText.value)
|
||||
}
|
||||
|
||||
function onAdd() {
|
||||
console.log('Add verifier')
|
||||
}
|
||||
|
||||
function onEdit(item: VerifierItem) {
|
||||
console.log('Edit:', item.name)
|
||||
}
|
||||
|
||||
function onDel(item: VerifierItem) {
|
||||
console.log('Delete:', item.id)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.admin-page-container {
|
||||
padding: 15px;
|
||||
background-color: #f5f7f9;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.picker-input {
|
||||
width: 200px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
background-color: #fff;
|
||||
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;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
color: #1890ff;
|
||||
font-size: 13px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.action-btn-del {
|
||||
color: #ed4014;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user