删除客户跟进
This commit is contained in:
parent
7f81c5385a
commit
8a184a90d2
|
|
@ -187,6 +187,22 @@ export const updateFollowup = (data) => {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除跟进记录
|
||||
* @param {string|string[]} followIds 跟进ID或ID数组(多个ID用逗号分隔或传入数组)
|
||||
* @returns {Promise} 返回删除结果
|
||||
*/
|
||||
export const deleteFollowup = (followIds) => {
|
||||
// 如果传入的是数组,转换为逗号分隔的字符串
|
||||
const idsParam = Array.isArray(followIds) ? followIds.join(',') : followIds;
|
||||
|
||||
return uni.$uv.http.delete(`bst/customerFollow/${idsParam}`, {}, {
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取客户项目列表
|
||||
* @param {string} customerId 客户ID
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
<view class="edit-btn" @click.stop="handleEdit(item)">
|
||||
<text class="edit-icon">✏️</text>
|
||||
</view>
|
||||
<view class="delete-btn" @click.stop="handleDelete(item)">
|
||||
<text class="delete-icon">🗑️</text>
|
||||
</view>
|
||||
<text class="followup-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -47,6 +50,7 @@
|
|||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { deleteFollowup } from '@/common/api/customer';
|
||||
|
||||
const props = defineProps({
|
||||
followupList: {
|
||||
|
|
@ -55,7 +59,7 @@ const props = defineProps({
|
|||
}
|
||||
});
|
||||
|
||||
const emit = defineEmits(['followup-click']);
|
||||
const emit = defineEmits(['followup-click', 'refresh']);
|
||||
|
||||
// 按日期分组的跟进记录
|
||||
const groupedFollowupList = computed(() => {
|
||||
|
|
@ -144,6 +148,34 @@ const handleEdit = (item) => {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 删除跟进记录
|
||||
const handleDelete = (item) => {
|
||||
if (!item || !item.followId) {
|
||||
uni.$uv.toast('跟进记录ID不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: '确定要删除这条跟进记录吗?删除后无法恢复。',
|
||||
confirmText: '删除',
|
||||
confirmColor: '#f56c6c',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
await deleteFollowup(item.followId);
|
||||
uni.$uv.toast('删除成功');
|
||||
// 通知父组件刷新列表
|
||||
emit('refresh');
|
||||
} catch (error) {
|
||||
console.error('删除跟进记录失败:', error);
|
||||
uni.$uv.toast(error?.message || '删除失败,请重试');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
@ -263,7 +295,8 @@ const handleEdit = (item) => {
|
|||
gap: 8px;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
.edit-btn,
|
||||
.delete-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
|
|
@ -279,10 +312,17 @@ const handleEdit = (item) => {
|
|||
}
|
||||
}
|
||||
|
||||
.edit-icon {
|
||||
.edit-icon,
|
||||
.delete-icon {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
&:active {
|
||||
background-color: #fee;
|
||||
}
|
||||
}
|
||||
|
||||
.followup-arrow {
|
||||
font-size: 22px;
|
||||
color: #d0d0d0;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@
|
|||
v-show="activeTab === 'followup'"
|
||||
:followup-list="followupList"
|
||||
@followup-click="handleFollowupClick"
|
||||
@refresh="loadFollowupList"
|
||||
/>
|
||||
|
||||
<!-- 项目列表标签页 -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user