style: 积分管理
This commit is contained in:
@@ -37,9 +37,6 @@ const getRoleList = async () => {
|
|||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const params = { ...queryParams.value };
|
const params = { ...queryParams.value };
|
||||||
|
|
||||||
console.log(params);
|
|
||||||
|
|
||||||
const data = await request(authApi("rolePage"), {
|
const data = await request(authApi("rolePage"), {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(params)
|
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 = () => {
|
const handleSearch = () => {
|
||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1;
|
||||||
@@ -98,7 +115,13 @@ const columns: TableColumnList = [
|
|||||||
{
|
{
|
||||||
label: "创建者",
|
label: "创建者",
|
||||||
prop: "createUserId",
|
prop: "createUserId",
|
||||||
width: "260"
|
width: "260",
|
||||||
|
formatter: row => {
|
||||||
|
const manager = managerUserOptions.value.find(
|
||||||
|
item => item.value === row.createUserId
|
||||||
|
);
|
||||||
|
return manager ? manager.label : "-";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "描述",
|
label: "描述",
|
||||||
@@ -167,6 +190,7 @@ const handleDelete = row => {
|
|||||||
// 页面加载时获取数据
|
// 页面加载时获取数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getRoleList();
|
getRoleList();
|
||||||
|
getManagerUserList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,25 @@ const memberTypeOptions = [
|
|||||||
{ value: "4", label: "月度会员" }
|
{ 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 () => {
|
const getCompanyList = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -232,6 +251,56 @@ const handleEdit = row => {
|
|||||||
// TODO: 实现编辑逻辑
|
// 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 => {
|
const handleDelete = row => {
|
||||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
@@ -340,10 +409,20 @@ onMounted(() => {
|
|||||||
<el-button link type="primary" size="small" @click="handleDetail(row)">
|
<el-button link type="primary" size="small" @click="handleDetail(row)">
|
||||||
明细
|
明细
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
<!-- <el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||||
编辑
|
编辑
|
||||||
|
</el-button> -->
|
||||||
|
<el-button link type="primary" size="small" @click="handleRaise(row)">
|
||||||
|
涨分
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="danger" size="small" @click="handleDelete(row)">
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
disabled
|
||||||
|
:style="{ opacity: 0.5 }"
|
||||||
|
@click="handleDelete(row)"
|
||||||
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -360,6 +439,73 @@ onMounted(() => {
|
|||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加涨分弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="raisePointDialog"
|
||||||
|
title="积分调整"
|
||||||
|
width="500px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="raisePointFormRef"
|
||||||
|
:model="raisePointForm"
|
||||||
|
label-width="100px"
|
||||||
|
class="raise-point-form"
|
||||||
|
>
|
||||||
|
<el-form-item label="用户:">
|
||||||
|
<span>{{
|
||||||
|
frontendUserOptions.find(item => item.value === currentRow?.userId)
|
||||||
|
?.label
|
||||||
|
}}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="所属公司:">
|
||||||
|
<span>{{
|
||||||
|
companyOptions.find(item => item.value === currentRow?.companyId)
|
||||||
|
?.label || "-"
|
||||||
|
}}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="当前积分:">
|
||||||
|
<span>{{ currentRow?.totalPoints }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="调整积分:" required>
|
||||||
|
<el-input-number
|
||||||
|
v-model="raisePointForm.spendingPoints"
|
||||||
|
:min="1"
|
||||||
|
:max="999999"
|
||||||
|
placeholder="请输入调整积分"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="调整原因:" required>
|
||||||
|
<el-select
|
||||||
|
v-model="raisePointForm.reasonId"
|
||||||
|
placeholder="请选择调整原因"
|
||||||
|
class="reason-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in reasonOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注说明:">
|
||||||
|
<el-input
|
||||||
|
v-model="raisePointForm.description"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入备注说明"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="raisePointDialog = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="handleRaiseSubmit">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -396,4 +542,17 @@ onMounted(() => {
|
|||||||
width: 180px;
|
width: 180px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.raise-point-form {
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.reason-select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
padding-top: 20px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user