style: 会员积分

This commit is contained in:
2025-01-09 23:35:48 +08:00
parent e22bfd9c65
commit 4563f5ac91
3 changed files with 56 additions and 9 deletions

View File

@@ -48,6 +48,15 @@ export default {
title: "积分消费记录"
}
},
{
path: "/biz/propCount",
name: "propCount",
component: () => import("@/views/biz/propCount/index.vue"),
meta: {
icon: "ri:bank-card-line",
title: "道具统计"
}
},
{
path: "/biz/purchase",
name: "purchase",

View File

@@ -276,8 +276,15 @@ const handleRaise = row => {
raisePointDialog.value = true;
};
// 添加提交方法
// 添加提交状态控制
const submitting = ref(false);
// 修改提交方法
const handleRaiseSubmit = async () => {
console.log(submitting.value);
if (submitting.value) return; // 如果正在提交,直接返回
try {
if (raisePointForm.value.pointNum <= 0) {
ElMessage.warning("请输入正确的积分数量");
@@ -288,6 +295,8 @@ const handleRaiseSubmit = async () => {
return;
}
submitting.value = true; // 开始提交,设置状态
const params = {
userId: currentRow.value.userId,
companyId: currentRow.value.companyId,
@@ -296,15 +305,11 @@ const handleRaiseSubmit = async () => {
description: raisePointForm.value.description
};
console.log("params", params);
const res = await request(bizApi("raisePoint"), {
method: "POST",
body: JSON.stringify(params)
});
console.info(res);
if (res.status === 200) {
ElMessage.success("涨分成功");
raisePointDialog.value = false;
@@ -313,9 +318,10 @@ const handleRaiseSubmit = async () => {
ElMessage.error(res.msg || "涨分失败");
}
} catch (error) {
console.info(error);
console.error("涨分失败:", error);
ElMessage.error(error.message || "涨分失败");
} finally {
submitting.value = false; // 无论成功失败,都重置状态
}
};
@@ -394,7 +400,7 @@ const detailColumns = [
{
label: "变动原因",
prop: "reasonId",
width: "80",
width: "95",
formatter: row => {
const reason = reasonOptions.find(item => item.value === row.reasonId);
return reason ? reason.label : "-";
@@ -417,6 +423,21 @@ const detailColumns = [
}
];
// 添加抽屉关闭处理函数
const handleDrawerClose = () => {
detailDrawer.value = false;
// 重置查询参数
detailQueryParams.value = {
pageNum: 1,
pageSize: 20,
userId: "",
companyId: ""
};
// 清空数据
detailData.value = [];
detailTotal.value = 0;
};
// 页面加载时获取数据
onMounted(() => {
getPointList();
@@ -596,8 +617,16 @@ onMounted(() => {
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="raisePointDialog = false"> </el-button>
<el-button type="primary" @click="handleRaiseSubmit"> </el-button>
<el-button :disabled="submitting" @click="raisePointDialog = false"
> </el-button
>
<el-button
type="primary"
:loading="submitting"
@click="handleRaiseSubmit"
>
{{ submitting ? "提交中..." : "确 定" }}
</el-button>
</span>
</template>
</el-dialog>

View File

@@ -0,0 +1,9 @@
<script setup lang="ts">
defineOptions({
name: "propCount"
});
</script>
<template>
<h1>道具管理</h1>
</template>