From a34e74cbffb91513cad684a909862f55bdfc0a46 Mon Sep 17 00:00:00 2001
From: aaron <>
Date: Mon, 24 Feb 2025 00:13:21 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E9=80=81=E5=91=98?=
=?UTF-8?q?=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layouts/BasicLayout.vue | 9 +
src/router/index.js | 6 +
src/views/deliveryman/List.vue | 476 +++++++++++++++++++++++++++++++++
src/views/user/UserList.vue | 123 +--------
4 files changed, 495 insertions(+), 119 deletions(-)
create mode 100644 src/views/deliveryman/List.vue
diff --git a/src/layouts/BasicLayout.vue b/src/layouts/BasicLayout.vue
index c576247..0012dd7 100644
--- a/src/layouts/BasicLayout.vue
+++ b/src/layouts/BasicLayout.vue
@@ -25,6 +25,9 @@
用户列表
+
+ 配送员列表
+
@@ -202,6 +205,12 @@ export default defineComponent({
}
]
},
+ {
+ key: 'deliveryman',
+ icon: () => h(UserOutlined),
+ title: '配送员管理',
+ path: '/deliveryman/list'
+ },
{
key: 'order',
icon: () => h(ShoppingOutlined),
diff --git a/src/router/index.js b/src/router/index.js
index 20f8e04..18834c2 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -22,6 +22,12 @@ const routes = [
component: () => import('../views/user/UserList.vue'),
meta: { title: '用户列表' }
},
+ {
+ path: '/deliveryman/list',
+ name: 'DeliverymanList',
+ component: () => import('../views/deliveryman/List.vue'),
+ meta: { title: '配送员列表' }
+ },
{
path: '/community/list',
name: 'CommunityList',
diff --git a/src/views/deliveryman/List.vue b/src/views/deliveryman/List.vue
new file mode 100644
index 0000000..763af26
--- /dev/null
+++ b/src/views/deliveryman/List.vue
@@ -0,0 +1,476 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 查询
+
+
+ 重置
+
+
+
+
+
+
+
+
+
+ {{ formatPhone(record.phone) }}
+
+
+
+
+ {{ record.community_name }}
+
+
+ 未设置
+
+
+
+
+
+
+ {{ record.community_name ? '修改小区' : '设置小区' }}
+
+
+ 设置分佣比例
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请输入0-100之间的整数
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/user/UserList.vue b/src/views/user/UserList.vue
index 102a589..e08ad55 100644
--- a/src/views/user/UserList.vue
+++ b/src/views/user/UserList.vue
@@ -85,19 +85,6 @@
-
-
-
- {{ record.community_name }}
-
-
- 未设置
-
-
- {{ record.community_name ? '修改' : '设置' }}
-
-
-
@@ -148,35 +135,6 @@
-
-
-
-
-
-
-
-
-
@@ -245,12 +203,6 @@ export default defineComponent({
key: 'roles',
width: 200,
},
- {
- title: '归属小区',
- dataIndex: 'community_name',
- key: 'community_name',
- width: 250,
- },
{
title: '创建时间',
dataIndex: 'create_time',
@@ -352,13 +304,6 @@ export default defineComponent({
const newPassword = ref('')
const passwordInput = ref(null)
- // 小区相关状态
- const communityModalVisible = ref(false)
- const communitySaving = ref(false)
- const communityLoading = ref(false)
- const selectedCommunityId = ref(undefined)
- const communityOptions = ref([])
-
// 可选角色列表
const availableRoles = [
{ label: '普通用户', value: 'user' },
@@ -394,7 +339,10 @@ export default defineComponent({
newRoles.push('user')
}
- await request.put(`/api/user/roles?user_id=${currentUserId.value}`, newRoles)
+ await request.put(`/api/user/roles`, {
+ user_id: currentUserId.value,
+ roles: newRoles
+ })
message.success('角色修改成功')
roleModalVisible.value = false
@@ -488,69 +436,14 @@ export default defineComponent({
resetStates()
}
- // 获取小区列表
- const fetchCommunityList = async () => {
- try {
- communityLoading.value = true
- const res = await request.get('/api/community')
- if (res.code === 200 && res.data) {
- communityOptions.value = res.data.items || []
- }
- } catch (error) {
- console.error('获取小区列表失败:', error)
- message.error('获取小区列表失败')
- } finally {
- communityLoading.value = false
- }
- }
-
- // 小区编辑处理函数
- const handleEditCommunity = (record) => {
- currentUserId.value = record.userid
- selectedCommunityId.value = record.community_id
- communityModalVisible.value = true
-
- if (communityOptions.value.length === 0) {
- fetchCommunityList()
- }
- }
-
- // 保存小区修改
- const handleCommunitySave = async () => {
- try {
- communitySaving.value = true
- await request.put('/api/user/community', {
- user_id: currentUserId.value,
- community_id: selectedCommunityId.value
- })
-
- message.success('修改成功')
- communityModalVisible.value = false
- fetchData() // 刷新列表
- } catch (error) {
- console.error('修改所属小区失败:', error)
- message.error('修改失败')
- } finally {
- communitySaving.value = false
- }
- }
-
- // 修改取消处理函数
- const handleCommunityCancel = () => {
- communityModalVisible.value = false
- resetStates()
- }
-
// 重置状态的函数
const resetStates = () => {
currentUserId.value = null
selectedRoles.value = []
- selectedCommunityId.value = undefined
}
onMounted(() => {
fetchData()
- fetchCommunityList() // 预加载小区列表
})
return {
@@ -579,14 +472,6 @@ export default defineComponent({
handleResetPassword,
handleCopyPassword,
handleClosePasswordModal,
- communityModalVisible,
- communitySaving,
- communityLoading,
- selectedCommunityId,
- communityOptions,
- handleEditCommunity,
- handleCommunitySave,
- handleCommunityCancel,
currentUserId
}
}