From 20f5b01987cd9639aec27e44a1a728c6fc89f9ea Mon Sep 17 00:00:00 2001 From: v6ole Date: Sun, 12 Jul 2026 20:49:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E6=9C=BA=E8=B7=9F=E5=8D=95?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=AD=9B=E9=80=89=E8=B7=9F=E8=BF=9B=E4=B8=AD?= =?UTF-8?q?=20+=20=E5=B7=B2=E6=B5=81=E5=A4=B1=E7=BD=AE=E5=BA=95=20+=20?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=88=97=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 后端: 状态改为已流失时自动清空 expected_revenue_date - PC端: 默认筛选跟进中,排序 跟进中→已签约→已流失 - 移动端: 列表自动排序,已流失在最底部 Co-Authored-By: Claude --- backend/app/api/mini_business.py | 3 +++ frontend/src/views/desktop/MiniBusiness.vue | 4 +++- frontend/src/views/mobile/MiniBizList.vue | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/app/api/mini_business.py b/backend/app/api/mini_business.py index 040146e..8435030 100644 --- a/backend/app/api/mini_business.py +++ b/backend/app/api/mini_business.py @@ -104,6 +104,9 @@ async def update_mini_business( update_data.pop("manager_id", None) for k, v in update_data.items(): setattr(m, k, v) + # Auto-clear expected revenue date when status becomes 已流失 + if m.status == "已流失" and m.expected_revenue_date: + m.expected_revenue_date = "" new_snapshot = {"customer_id": str(m.customer_id), "product_type": m.product_type, "amount": m.amount, "follow_up_detail": m.follow_up_detail, "status": m.status, "expected_revenue_date": m.expected_revenue_date} changes = compute_diff(old_snapshot, new_snapshot) if changes: diff --git a/frontend/src/views/desktop/MiniBusiness.vue b/frontend/src/views/desktop/MiniBusiness.vue index 3f316c1..af70bff 100644 --- a/frontend/src/views/desktop/MiniBusiness.vue +++ b/frontend/src/views/desktop/MiniBusiness.vue @@ -39,7 +39,7 @@ const logSaving = ref(false) // ── Filters ── const filterManager = ref('') -const filterStatus = ref('') +const filterStatus = ref('跟进中') const managerOptions = computed(() => { const seen = new Set() @@ -49,10 +49,12 @@ const managerOptions = computed(() => { .sort() }) +const statusOrder: Record = { '跟进中': 0, '已签约': 1, '已流失': 2 } const filteredItems = computed(() => { let list = miniBusiness.value if (filterManager.value) list = list.filter((m: any) => (m.manager_name || '未知') === filterManager.value) if (filterStatus.value) list = list.filter((m: any) => m.status === filterStatus.value) + list.sort((a: any, b: any) => (statusOrder[a.status] ?? 9) - (statusOrder[b.status] ?? 9)) return list }) diff --git a/frontend/src/views/mobile/MiniBizList.vue b/frontend/src/views/mobile/MiniBizList.vue index 42aed19..293049a 100644 --- a/frontend/src/views/mobile/MiniBizList.vue +++ b/frontend/src/views/mobile/MiniBizList.vue @@ -7,13 +7,17 @@ import { miniBusinessApi } from '@/api/miniBusiness' const router = useRouter() const loading = ref(false) const items = ref([]) +const statusOrder: Record = { '跟进中': 0, '已签约': 1, '已流失': 2 } onMounted(loadItems) async function loadItems() { loading.value = true - try { const res = await miniBusinessApi.list(); items.value = Array.isArray(res.data) ? res.data : (res.data.items || []) } - catch (_) {} + try { + const res = await miniBusinessApi.list() + const raw = Array.isArray(res.data) ? res.data : (res.data.items || []) + items.value = raw.sort((a: any, b: any) => (statusOrder[a.status] ?? 9) - (statusOrder[b.status] ?? 9)) + } catch (_) {} finally { loading.value = false } }