refactor layout

This commit is contained in:
Timi
2026-10-17 12:01:28 +08:00
parent fe467e8781
commit 469c595a7c
134 changed files with 11493 additions and 4437 deletions
@@ -1,180 +1,236 @@
<template>
<div v-can="permissionCodes.customerFollowUpReminder.read" class="follow-up-reminder-list">
<div class="filters glass">
<t-input
v-model="customerSearchKeyword"
class="customer"
type="search"
borderless
placeholder="输入客户编码、姓名或拼音"
@enter="applyCustomerSearch"
@clear="clearCustomer"
>
<template #suffix-icon>
<t-button
size="extra-small"
theme="primary"
variant="outline"
content="选择客户"
@click.stop="customerSelectorVisible = true"
/>
</template>
</t-input>
<t-dropdown-menu ref="dropdownMenuRef" class="menus">
<t-dropdown-item
v-model="dateFilterType"
:label="dateFilterLabel"
:options="dateOptions"
@change="handleDateFilterChange"
/>
<t-dropdown-item
v-model="statusFilter"
:label="statusFilterLabel"
:options="statusOptions"
@change="handleStatusChange"
/>
<t-dropdown-item
:label="selectedResponsibleName"
:options="[]"
@open="openResponsibleSelector"
/>
</t-dropdown-menu>
</div>
<t-pull-down-refresh
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="refresh"
@scrolltolower="fetch"
<div class="page-layout navbar follow-up-reminder-list">
<t-navbar
fixed
:z-index="20"
title="客户跟进提醒"
left-arrow
@left-click="$router.back()"
>
<div class="list-wrap">
<customer-profile-card class="customer" :customer="selectedCustomer" />
<t-cell-group class="summary" theme="card">
<t-cell title="提醒数量" :note="`共 ${pageResult.total} 条`" />
<t-cell v-if="dateFilterType !== 'all'" title="提醒时间" :note="dateFilterLabel" />
<t-cell v-if="selectedResponsibleId" title="负责人" :note="selectedResponsibleName" />
</t-cell-group>
<t-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line empty-cell-title-margin" theme="card">
<t-swipe-cell
v-for="(item, index) in pageResult.list"
:key="item.id || index"
class="item"
<template #right>
<div
class="nav-actions"
v-if="(canCreate) && pageNavBarActionList.length"
>
<t-popover
v-model:visible="pageNavBarActionVisible"
placement="bottom-right"
:show-arrow="false"
theme="light"
>
<t-cell
v-entrance-transition="{ step: 30 }"
class="cell"
arrow
@click="toDetail(item)"
<t-button
class="trigger"
variant="text"
:aria-label="'更多操作'"
type="button"
>
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(item.customer, 64)"
:src="getCustomerPhotoURL(item.customer, 64)"
:alt="getCustomerName(item)"
fit="cover"
class="avatar"
/>
<div v-else class="avatar fallback" v-text="getCustomerName(item).slice(0, 1)" />
<template #icon>
<t-icon name="ellipsis" />
</template>
<template #title>
<div class="title">
<div class="name-channel">
<span class="text-bold" v-text="getCustomerName(item)" />
<t-tag
v-if="item.notifyChannelList?.includes('INTERNAL')"
size="small"
theme="primary"
variant="outline"
content="站内信"
/>
<t-tag
v-if="item.notifyChannelList?.includes('SMS')"
size="small"
theme="warning"
variant="outline"
content="短信"
/>
</div>
<t-tag size="small" :theme="getStatusTheme(item.status)" :content="getStatusText(item.status)" />
</div>
</template>
<template #description>
<div class="description">
<div class="content clip-text" v-text="getContentSummary(item.content)" />
<div class="time-responsible">
<span
class="remind-time"
:class="getReminderTimeClass(item)"
v-text="getReminderTimeText(item.remindAt)"
/>
<span v-text="`负责人:${getResponsibleName(item)}`" />
</div>
</div>
</template>
</t-cell>
<template #right>
<div class="swipe-actions">
</t-button>
<template #content>
<div class="menu">
<t-button
v-if="canComplete && item.status === 'PENDING'"
class="complete swipe-cell-button"
v-for="action in pageNavBarActionList"
:key="action.key"
class="menu-item"
variant="text"
:loading="operatingId === item.id && operatingType === 'complete'"
@click.stop="confirmComplete(item)"
>完成</t-button>
<t-button
v-if="canDelete"
class="delete swipe-cell-button"
variant="text"
:loading="operatingId === item.id && operatingType === 'delete'"
@click.stop="confirmDelete(item)"
>删除</t-button>
type="button"
:theme="action.theme"
:loading="action.loading"
:disabled="action.disabled || action.loading"
@click="handlePageNavBarAction(action)"
>
<template v-if="action.icon" #icon>
<t-icon :name="action.icon" />
</template>
<span v-text="action.text" />
</t-button>
</div>
</template>
</t-swipe-cell>
</t-cell-group>
<div class="center-tips" v-text="isLoading ? '正在加载提醒' : pageResult.list.length ? (isNoMore ? '已经到底了' : '上拉加载更多') : '暂无跟进提醒'" />
</div>
</t-pull-down-refresh>
<customer-selector
v-model="selectedCustomerId"
v-model:visible="customerSelectorVisible"
:initial-keyword="customerSearchKeyword"
:store-id="currentStoreStore.currentStoreId"
:enable-scan="true"
@change="handleCustomerSelected"
/>
<managed-user-selector
v-model="selectedResponsibleId"
v-model:visible="responsibleSelectorVisible"
:store-id="currentStoreStore.currentStoreId"
@change="handleResponsibleSelected"
/>
<t-popup v-model="startVisible" placement="bottom">
<t-date-time-picker
v-if="startVisible"
v-model="startDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="提醒开始时间"
@cancel="startVisible = false"
@confirm="confirmStart"
</t-popover>
</div>
</template>
</t-navbar>
<main v-can="permissionCodes.customerFollowUpReminder.read" class="page-content scroll list">
<t-pull-down-refresh
class="pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="refresh"
@scrolltolower="fetch"
>
<div class="filters glass">
<t-input
v-model="customerSearchKeyword"
class="customer"
type="search"
borderless
placeholder="输入客户编码、姓名或拼音"
@enter="applyCustomerSearch"
@clear="clearCustomer"
>
<template #suffix-icon>
<t-button
size="extra-small"
theme="primary"
variant="outline"
content="选择客户"
@click.stop="customerSelectorVisible = true"
/>
</template>
</t-input>
<t-dropdown-menu ref="dropdownMenuRef" class="menus">
<t-dropdown-item
v-model="dateFilterType"
:label="dateFilterLabel"
:options="dateOptions"
@change="handleDateFilterChange"
/>
<t-dropdown-item
v-model="statusFilter"
:label="statusFilterLabel"
:options="statusOptions"
@change="handleStatusChange"
/>
<t-dropdown-item
:label="selectedResponsibleName"
:options="[]"
@open="openResponsibleSelector"
/>
</t-dropdown-menu>
</div>
<div class="list-wrap">
<customer-profile-card class="customer" :customer="selectedCustomer" />
<t-cell-group class="summary" theme="card">
<t-cell title="提醒数量" :note="`共 ${pageResult.total} 条`" />
<t-cell v-if="dateFilterType !== 'all'" title="提醒时间" :note="dateFilterLabel" />
<t-cell v-if="selectedResponsibleId" title="负责人" :note="selectedResponsibleName" />
</t-cell-group>
<t-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line empty-cell-title-margin" theme="card">
<t-swipe-cell
v-for="(item, index) in pageResult.list"
:key="item.id || index"
class="item"
>
<t-cell
v-entrance-transition="{ step: 30 }"
class="cell"
arrow
@click="toDetail(item)"
>
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(item.customer, 64)"
:src="getCustomerPhotoURL(item.customer, 64)"
:alt="getCustomerName(item)"
fit="cover"
class="avatar"
/>
<div v-else class="avatar fallback" v-text="getCustomerName(item).slice(0, 1)" />
</template>
<template #title>
<div class="title">
<div class="name-channel">
<span class="text-bold" v-text="getCustomerName(item)" />
<t-tag
v-if="item.notifyChannelList?.includes('INTERNAL')"
size="small"
theme="primary"
variant="outline"
content="站内信"
/>
<t-tag
v-if="item.notifyChannelList?.includes('SMS')"
size="small"
theme="warning"
variant="outline"
content="短信"
/>
</div>
<t-tag size="small" :theme="getStatusTheme(item.status)" :content="getStatusText(item.status)" />
</div>
</template>
<template #description>
<div class="description">
<div class="content clip-text" v-text="getContentSummary(item.content)" />
<div class="time-responsible">
<span
class="remind-time"
:class="getReminderTimeClass(item)"
v-text="getReminderTimeText(item.remindAt)"
/>
<span v-text="`负责人:${getResponsibleName(item)}`" />
</div>
</div>
</template>
</t-cell>
<template #right>
<div class="swipe-actions">
<t-button
v-if="canComplete && item.status === 'PENDING'"
class="complete swipe-cell-button"
variant="text"
:loading="operatingId === item.id && operatingType === 'complete'"
@click.stop="confirmComplete(item)"
>完成</t-button>
<t-button
v-if="canDelete"
class="delete swipe-cell-button"
variant="text"
:loading="operatingId === item.id && operatingType === 'delete'"
@click.stop="confirmDelete(item)"
>删除</t-button>
</div>
</template>
</t-swipe-cell>
</t-cell-group>
<div class="center-tips" v-text="isLoading ? '正在加载提醒' : pageResult.list.length ? (isNoMore ? '已经到底了' : '上拉加载更多') : '暂无跟进提醒'" />
</div>
</t-pull-down-refresh>
<customer-selector
v-model="selectedCustomerId"
v-model:visible="customerSelectorVisible"
:initial-keyword="customerSearchKeyword"
:store-id="currentStoreStore.currentStoreId"
:enable-scan="true"
@change="handleCustomerSelected"
/>
</t-popup>
<t-popup v-model="endVisible" placement="bottom">
<t-date-time-picker
v-if="endVisible"
v-model="endDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="提醒结束时间"
@cancel="endVisible = false"
@confirm="confirmEnd"
<managed-user-selector
v-model="selectedResponsibleId"
v-model:visible="responsibleSelectorVisible"
:store-id="currentStoreStore.currentStoreId"
@change="handleResponsibleSelected"
/>
</t-popup>
<t-popup v-model="startVisible" placement="bottom">
<t-date-time-picker
v-if="startVisible"
v-model="startDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="提醒开始时间"
@cancel="startVisible = false"
@confirm="confirmStart"
/>
</t-popup>
<t-popup v-model="endVisible" placement="bottom">
<t-date-time-picker
v-if="endVisible"
v-model="endDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="提醒结束时间"
@cancel="endVisible = false"
@confirm="confirmEnd"
/>
</t-popup>
</main>
</div>
<nav-bar-action-menu v-if="canCreate" :actions="actionList" />
</template>
<script setup lang="ts">
import type { NavBarAction } from "@/types/NavBarAction";
import { DialogPlugin, type DropdownValue } from "tdesign-mobile-vue";
import { Time } from "timi-web";
import { type PageResult, useUserStore } from "timi-web-api";
@@ -185,14 +241,22 @@ import CustomerAPI from "@/api/CustomerAPI";
import CustomerSelector from "@/components/CustomerSelector.vue";
import ManagedUserSelector from "@/pages/followUpReminder/component/ManagedUserSelector.vue";
import { useCurrentStoreStore } from "@/store/currentStoreStore";
import { useNavBarStore } from "@/store/navBarStore";
import type { Customer } from "@/types/Customer";
import type { ManagedUser } from "@/types/ManagedUser";
import type { FollowUpReminder, FollowUpReminderPage, FollowUpReminderStatus } from "@/types/FollowUpReminder";
import { getCustomerPhotoURL } from "@/utils/customer";
import { parseDateTime } from "@/utils/date";
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
const pageNavBarActionVisible = ref(false);
const pageNavBarActionList = computed<NavBarAction[]>(() => (unref(actionList) as NavBarAction[]).filter(action => action.visible !== false));
async function handlePageNavBarAction(action: NavBarAction): Promise<void> {
pageNavBarActionVisible.value = false;
await action.action();
}
import type { Customer } from "@/types/Customer";
type DateFilterType = "all" | "today" | "next7" | "custom";
defineOptions({
@@ -203,7 +267,6 @@ const router = useRouter();
const route = useRoute();
const userStore = useUserStore();
const currentStoreStore = useCurrentStoreStore();
const navBarStore = useNavBarStore();
const isGlobalManager = computed(() => userStore.hasRoles(gaoRoleCodes.globalManager));
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.create));
@@ -611,7 +674,7 @@ async function toDetail(item: FollowUpReminder): Promise<void> {
}
onMounted(async () => {
navBarStore.setCustomRightVisible(canCreate.value);
try {
await loadStoreScope();
const queryCustomerId = String(route.query.customerId || "");
@@ -637,7 +700,6 @@ watch(() => route.query.customerId, async value => {
await refresh();
});
onUnmounted(() => navBarStore.clearRight());
</script>
<style scoped lang="less">
@@ -833,4 +895,46 @@ onUnmounted(() => navBarStore.clearRight());
}
}
.nav-actions {
--td-popover-padding: 0 .5rem;
width: 6rem;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
:deep(.t-popover__content) { border-radius: .875rem; }
.trigger { padding: 0; }
.menu {
gap: .25rem;
display: grid;
padding: .5rem 0;
min-width: 9rem;
.menu-item {
--td-button-medium-height: 32px;
--td-button-medium-padding-horizontal: 10px;
gap: .25rem;
width: 100%;
font-weight: unset;
justify-content: flex-start;
}
}
}
:global(html.theme-dark) {
.nav-actions {
:deep(.t-popover__content) {
color: #e2e8f0;
background: rgba(30, 41, 59, .98);
}
.menu-item { color: #e2e8f0; }
}
}
</style>