remove button in point rule detail

This commit is contained in:
Timi
2026-08-24 16:53:28 +08:00
parent 2764001f5a
commit 9b843fc921
2 changed files with 67 additions and 58 deletions
-54
View File
@@ -88,17 +88,6 @@
</t-form-item>
</card-container>
</t-form>
<t-button
v-if="!isCreateMode"
class="delete red bg-white cell-button"
v-can="permissionCodes.pointRule.delete"
:loading="isRemoving"
variant="text"
block
@click="confirmRemove"
>
删除
</t-button>
</div>
<t-popup v-model="storePickerVisible" placement="bottom">
<t-picker
@@ -188,7 +177,6 @@
</template>
<script setup lang="ts">
import { DialogPlugin } from "tdesign-mobile-vue";
import { Time, useUserStore } from "timi-web";
import EventAPI from "@/api/EventAPI";
import PointAPI from "@/api/PointAPI";
@@ -240,7 +228,6 @@ const pageAccess = computed(() => ({
// ---------- 基础表单 ----------
const isSaving = ref(false);
const isRemoving = ref(false);
const formModel = reactive({
id: "",
storeId: "",
@@ -745,43 +732,6 @@ async function saveRule(): Promise<void> {
}
}
// ---------- 删除 ----------
async function confirmRemove(): Promise<void> {
if (!formModel.id || isRemoving.value) {
return;
}
const dialog = DialogPlugin.confirm({
title: "删除积分规则",
content: `确定删除规则 ${formModel.name || "未命名规则"} 吗?删除只影响后续登记,不会改变历史流水。`,
cancelBtn: "取消",
confirmBtn: "删除",
onCancel() {
dialog.destroy();
},
async onConfirm() {
dialog.destroy();
await removeRule();
}
});
}
async function removeRule(): Promise<void> {
if (!formModel.id) {
return;
}
isRemoving.value = true;
try {
await PointAPI.ruleRemove(formModel.id);
Message.success("积分规则已删除");
await router.replace("/management/points/rules");
} catch (error) {
Message.error(getErrorMessage(error, "积分规则删除失败"));
} finally {
isRemoving.value = false;
}
}
// ---------- 页面数据 ----------
async function fillForm(): Promise<void> {
@@ -920,10 +870,6 @@ onUnmounted(() => navBarStore.clearRight());
line-height: 1.5;
}
}
.delete {
margin-top: 1rem;
}
}
:global(html.theme-dark) {