From 1908146a753fda04a8c40850546b8d8bb1ef720d Mon Sep 17 00:00:00 2001 From: zhj Date: Fri, 3 Jan 2025 12:19:56 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E7=A7=AF=E5=88=86=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/auth/role/index.vue | 32 ++++- src/views/biz/membershipPoint/index.vue | 163 +++++++++++++++++++++++- 2 files changed, 189 insertions(+), 6 deletions(-) diff --git a/src/views/auth/role/index.vue b/src/views/auth/role/index.vue index 12d9792..b07cf47 100644 --- a/src/views/auth/role/index.vue +++ b/src/views/auth/role/index.vue @@ -37,9 +37,6 @@ const getRoleList = async () => { try { loading.value = true; const params = { ...queryParams.value }; - - console.log(params); - const data = await request(authApi("rolePage"), { method: "POST", body: JSON.stringify(params) @@ -61,6 +58,26 @@ const getRoleList = async () => { } }; +// 管理用户列表数据 +const managerUserOptions = ref([]); +// 获取管理用户列表 +const getManagerUserList = async () => { + try { + const res = await request(authApi("getManagerUserPrimaryInfo"), { + method: "POST" + }); + if (res.status === 200) { + console.info(managerUserOptions); + managerUserOptions.value = res.data.map(item => ({ + value: item.id, + label: item.name + })); + } + } catch (error) { + console.error("获取管理用户列表失败:", error); + } +}; + // 搜索方法 const handleSearch = () => { queryParams.value.pageNum = 1; @@ -98,7 +115,13 @@ const columns: TableColumnList = [ { label: "创建者", prop: "createUserId", - width: "260" + width: "260", + formatter: row => { + const manager = managerUserOptions.value.find( + item => item.value === row.createUserId + ); + return manager ? manager.label : "-"; + } }, { label: "描述", @@ -167,6 +190,7 @@ const handleDelete = row => { // 页面加载时获取数据 onMounted(() => { getRoleList(); + getManagerUserList(); }); diff --git a/src/views/biz/membershipPoint/index.vue b/src/views/biz/membershipPoint/index.vue index 670e522..eda606d 100644 --- a/src/views/biz/membershipPoint/index.vue +++ b/src/views/biz/membershipPoint/index.vue @@ -43,6 +43,25 @@ const memberTypeOptions = [ { value: "4", label: "月度会员" } ]; +// 添加涨分弹窗相关状态 +const raisePointDialog = ref(false); +const raisePointForm = ref({ + spendingPoints: 0, + reasonId: "", + description: "" +}); +const currentRow = ref(null); + +// 涨分原因选项 +const reasonOptions = [ + { value: 1, label: "购买" }, + { value: 2, label: "活动奖励" }, + { value: 3, label: "签到奖励" }, + { value: 4, label: "任务奖励" }, + { value: 5, label: "管理员调整" }, + { value: 9, label: "其他" } +]; + // 获取公司列表 const getCompanyList = async () => { try { @@ -232,6 +251,56 @@ const handleEdit = row => { // TODO: 实现编辑逻辑 }; +const handleRaise = row => { + currentRow.value = row; + raisePointForm.value = { + spendingPoints: 0, + reasonId: "", + description: "" + }; + raisePointDialog.value = true; +}; + +// 添加提交方法 +const handleRaiseSubmit = async () => { + try { + if (raisePointForm.value.spendingPoints <= 0) { + ElMessage.warning("请输入正确的积分数量"); + return; + } + if (!raisePointForm.value.reasonId) { + ElMessage.warning("请选择涨分原因"); + return; + } + + const params = { + userId: currentRow.value.userId, + companyId: currentRow.value.companyId, + spendingPoints: raisePointForm.value.spendingPoints, + reasonId: raisePointForm.value.reasonId, + description: raisePointForm.value.description + }; + + console.log("params", params); + + const res = await request(bizApi("membershipPointRaise"), { + method: "POST", + body: JSON.stringify(params) + }); + + if (res.status === 200) { + ElMessage.success("涨分成功"); + raisePointDialog.value = false; + getPointList(); // 刷新列表 + } else { + ElMessage.error(res.msg || "涨分失败"); + } + } catch (error) { + console.error("涨分失败:", error); + ElMessage.error(error.message || "涨分失败"); + } +}; + const handleDelete = row => { ElMessageBox.confirm("确认删除该记录?", "警告", { confirmButtonText: "确定", @@ -340,10 +409,20 @@ onMounted(() => { 明细 - + + + 涨分 - + 删除 @@ -360,6 +439,73 @@ onMounted(() => { @current-change="handleCurrentChange" /> + + + + + + {{ + frontendUserOptions.find(item => item.value === currentRow?.userId) + ?.label + }} + + + {{ + companyOptions.find(item => item.value === currentRow?.companyId) + ?.label || "-" + }} + + + {{ currentRow?.totalPoints }} + + + + + + + + + + + + + + + @@ -396,4 +542,17 @@ onMounted(() => { width: 180px; } } + +.raise-point-form { + padding: 20px; + + .reason-select { + width: 100%; + } +} + +.dialog-footer { + padding-top: 20px; + text-align: right; +}