mirror of
https://github.com/hpd840321/craftlabs-authorization-sdk.git
synced 2026-06-09 10:00:30 +08:00
feat(m1): add customer freeze/unfreeze
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="goDetail(row.id)">详情</el-button>
|
||||
<el-button type="primary" link v-permission="'customer:rw'" @click="openEdit(row)">编辑</el-button>
|
||||
<el-button v-permission="'customer:freeze'" type="warning" link
|
||||
@click="toggleFreeze(row)">{{ row.status === 'FROZEN' ? '解冻' : '冻结' }}</el-button>
|
||||
<el-button type="danger" link v-permission="'customer:delete'" @click="onDelete(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -78,6 +80,7 @@ import { useRouter } from "vue-router";
|
||||
import { useAuthStore } from "../stores/auth";
|
||||
import { listCustomers, createCustomer, updateCustomer, deleteCustomer } from "../api/platform";
|
||||
import { apiErrorMessage } from "../utils/apiErrorMessage";
|
||||
import axios from "axios";
|
||||
|
||||
const auth = useAuthStore();
|
||||
const router = useRouter();
|
||||
@@ -203,6 +206,21 @@ async function submit() {
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleFreeze(row) {
|
||||
try {
|
||||
if (row.status === 'FROZEN') {
|
||||
await axios.patch(`/api/v1/customers/${row.id}/unfreeze`);
|
||||
ElMessage.success('已解冻');
|
||||
} else {
|
||||
await axios.patch(`/api/v1/customers/${row.id}/freeze`);
|
||||
ElMessage.success('已冻结');
|
||||
}
|
||||
await load();
|
||||
} catch (e) {
|
||||
ElMessage.error(apiErrorMessage(e, '操作失败'));
|
||||
}
|
||||
}
|
||||
|
||||
function onDelete(row) {
|
||||
ElMessageBox.confirm(`确定删除客户「${row.name || row.id}」吗?`, "提示", {
|
||||
type: "warning",
|
||||
|
||||
Reference in New Issue
Block a user