删除客户跟进

This commit is contained in:
WindowBird 2025-11-10 14:41:21 +08:00
parent 7f81c5385a
commit 8a184a90d2
3 changed files with 60 additions and 3 deletions

View File

@ -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 * @param {string} customerId 客户ID

View File

@ -27,6 +27,9 @@
<view class="edit-btn" @click.stop="handleEdit(item)"> <view class="edit-btn" @click.stop="handleEdit(item)">
<text class="edit-icon"></text> <text class="edit-icon"></text>
</view> </view>
<view class="delete-btn" @click.stop="handleDelete(item)">
<text class="delete-icon">🗑</text>
</view>
<text class="followup-arrow"></text> <text class="followup-arrow"></text>
</view> </view>
</view> </view>
@ -47,6 +50,7 @@
<script setup> <script setup>
import { computed } from 'vue'; import { computed } from 'vue';
import { deleteFollowup } from '@/common/api/customer';
const props = defineProps({ const props = defineProps({
followupList: { followupList: {
@ -55,7 +59,7 @@ const props = defineProps({
} }
}); });
const emit = defineEmits(['followup-click']); const emit = defineEmits(['followup-click', 'refresh']);
// //
const groupedFollowupList = computed(() => { 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -263,7 +295,8 @@ const handleEdit = (item) => {
gap: 8px; gap: 8px;
} }
.edit-btn { .edit-btn,
.delete-btn {
width: 32px; width: 32px;
height: 32px; height: 32px;
display: flex; display: flex;
@ -279,10 +312,17 @@ const handleEdit = (item) => {
} }
} }
.edit-icon { .edit-icon,
.delete-icon {
font-size: 16px; font-size: 16px;
} }
.delete-btn {
&:active {
background-color: #fee;
}
}
.followup-arrow { .followup-arrow {
font-size: 22px; font-size: 22px;
color: #d0d0d0; color: #d0d0d0;

View File

@ -90,6 +90,7 @@
v-show="activeTab === 'followup'" v-show="activeTab === 'followup'"
:followup-list="followupList" :followup-list="followupList"
@followup-click="handleFollowupClick" @followup-click="handleFollowupClick"
@refresh="loadFollowupList"
/> />
<!-- 项目列表标签页 --> <!-- 项目列表标签页 -->