remove in customer list
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<t-dialog
|
||||
class="remove-dialog"
|
||||
v-model:visible="visible"
|
||||
title="删除客户"
|
||||
>
|
||||
<div class="content">
|
||||
<div class="warning">删除后无法恢复,将同时清除以下关联数据:</div>
|
||||
<ul class="items">
|
||||
<li>登记事件记录及其附件,并撤销这些登记产生的积分</li>
|
||||
<li>客户积分账户、标签和客户附件</li>
|
||||
<li>解除该客户与其被邀请客户之间的邀请关系,被邀请客户不会被删除</li>
|
||||
<li>减少该客户原介绍人的邀请客户计数</li>
|
||||
<li>客户档案本身</li>
|
||||
</ul>
|
||||
<div class="hint">
|
||||
请输入客户姓名
|
||||
<span class="name red" v-text="customerName" />
|
||||
以确认删除
|
||||
</div>
|
||||
<t-input
|
||||
class="confirm-input"
|
||||
v-model.trim="confirmName"
|
||||
size="small"
|
||||
borderless
|
||||
clearable
|
||||
placeholder="请输入客户姓名"
|
||||
/>
|
||||
</div>
|
||||
<template #cancelBtn>
|
||||
<t-button
|
||||
theme="default"
|
||||
content="取消"
|
||||
block
|
||||
@click="close"
|
||||
/>
|
||||
</template>
|
||||
<template #confirmBtn>
|
||||
<t-button
|
||||
theme="danger"
|
||||
content="删除"
|
||||
block
|
||||
:loading="loading"
|
||||
:disabled="!canConfirm || loading"
|
||||
@click="confirm"
|
||||
/>
|
||||
</template>
|
||||
</t-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Customer } from "@/types/Customer";
|
||||
|
||||
defineOptions({
|
||||
name: "CustomerRemoveDialog"
|
||||
});
|
||||
|
||||
interface Props {
|
||||
visible?: boolean;
|
||||
customer?: Customer;
|
||||
loading?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
visible: false,
|
||||
loading: false
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:visible": [visible: boolean];
|
||||
confirm: [customer: Customer];
|
||||
}>();
|
||||
|
||||
const confirmName = ref("");
|
||||
const visible = computed({
|
||||
get: () => props.visible,
|
||||
set: (value: boolean) => emit("update:visible", value)
|
||||
});
|
||||
const customerName = computed(() => props.customer?.name || "");
|
||||
const canConfirm = computed(() => !!customerName.value && confirmName.value === customerName.value);
|
||||
|
||||
watch([() => props.visible, () => props.customer], () => {
|
||||
confirmName.value = "";
|
||||
});
|
||||
|
||||
function close(): void {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
function confirm(): void {
|
||||
if (!props.customer?.id || !canConfirm.value || props.loading) {
|
||||
return;
|
||||
}
|
||||
emit("confirm", props.customer);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.remove-dialog {
|
||||
|
||||
:deep(.t-dialog__footer) {
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.content {
|
||||
text-align: left;
|
||||
|
||||
.warning {
|
||||
color: #b42318;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.items {
|
||||
gap: .5rem;
|
||||
height: 9rem;
|
||||
margin: .75rem 0 1rem;
|
||||
display: flex;
|
||||
overflow-y: auto;
|
||||
line-height: 1.2;
|
||||
padding-left: 1.25rem;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.confirm-input {
|
||||
--td-input-vertical-padding: 10px;
|
||||
|
||||
border: 1px solid var(--td-component-border);
|
||||
margin-top: .5rem;
|
||||
border-radius: .75rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark) {
|
||||
.remove-dialog {
|
||||
|
||||
.warning {
|
||||
color: #fda29b;
|
||||
}
|
||||
|
||||
.confirm-input {
|
||||
background: rgba(15, 23, 42, .72);
|
||||
border-color: rgba(148, 163, 184, .16);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user