Commit 9fd0f18f by Lin

feat(接待中心): 优化客户和接待记录列表加载体验

- 在客户列表和接待记录列表中添加骨架屏占位效果,提升首次加载时的用户体验
- 调整列表项的渲染逻辑,确保在加载状态下不触发点击事件
- 优化样式,统一骨架屏和列表项的展示方式,增强视觉一致性
- 移除冗余的日志输出,简化代码结构
1 parent 21bf162f
......@@ -236,6 +236,7 @@ function getPerformanceData(): Promise<void> {
}
function getCustomerList(append: boolean): Promise<void> {
console.log('[ReceptionCenter] 获取客户列表触底加载', append)
return getCustomerListImpl(append)
}
......@@ -625,7 +626,6 @@ function getDefaultReceptionListParams(): UTSJSONObject | null {
// 页面加载/模块切换时请求门店业绩数据
getPerformanceDataImpl = async (): Promise<void> => {
const raw = storage.get('userInfo') as UTSJSONObject | null
console.log('[getPerformanceData] userInfo:', raw)
if (raw == null) {
performanceData.value = getMockPerformanceData()
return
......@@ -660,7 +660,6 @@ getPerformanceDataImpl = async (): Promise<void> => {
try {
const res = await getMerchantPerformance(params)
console.log('获取业绩数据成功res:', res)
const resObj = res as UTSJSONObject
const bizData = resObj['data'] as UTSJSONObject | null
// performanceData.value = isPerformanceDataEmpty(bizData) ? getMockPerformanceData() : (bizData as UTSJSONObject)
......@@ -687,11 +686,6 @@ getCustomerListImpl = async (append: boolean): Promise<void> => {
return
}
}
const fileParams = getDefaultCustomerFileParams()
if (fileParams == null) {
console.warn('[getCustomerList] 无登录门店信息,跳过客户档案列表请求')
return
}
let pageBumped = false
if (append) {
customerFilePageNum.value = customerFilePageNum.value + 1
......@@ -700,8 +694,18 @@ getCustomerListImpl = async (append: boolean): Promise<void> => {
} else {
customerListHasMore.value = true
}
const fileParams = getDefaultCustomerFileParams()
if (fileParams == null) {
console.warn('[getCustomerList] 无登录门店信息,跳过客户档案列表请求')
if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1
customerListLoadingMore.value = false
}
return
}
try {
const res = await getCustomerFileList(fileParams)
console.log('[ReceptionCenter] 获取客户列表res', res)
const resObj = res as UTSJSONObject
const codeRaw = resObj['code']
if (`${codeRaw}` != '0') {
......@@ -783,11 +787,6 @@ getReceptionRecordListImpl = async (append: boolean): Promise<void> => {
return
}
}
const receptionParams = getDefaultReceptionListParams()
if (receptionParams == null) {
console.warn('[getReceptionRecordList] 无登录门店信息,跳过接待复盘列表请求')
return
}
let pageBumped = false
if (append) {
receptionPageNum.value = receptionPageNum.value + 1
......@@ -796,6 +795,15 @@ getReceptionRecordListImpl = async (append: boolean): Promise<void> => {
} else {
receptionListHasMore.value = true
}
const receptionParams = getDefaultReceptionListParams()
if (receptionParams == null) {
console.warn('[getReceptionRecordList] 无登录门店信息,跳过接待复盘列表请求')
if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1
receptionListLoadingMore.value = false
}
return
}
console.log("receptionParams接待复盘参数",receptionParams);
try {
const res = await getReceptionList(receptionParams)
......
......@@ -24,10 +24,9 @@
>
<view class="filter-tabs-row entry-filter-segmented-wrap">
<un-segmented
shape="circle"
type="card"
:height="40"
bg-color="rgba(241, 245, 249, 0.5)"
bg-color="#f1f5f9"
active-color="#000000"
:model-value="filterTabIndex"
@update:model-value="emit('switchFilterTab', $event)"
......
......@@ -102,7 +102,6 @@ const reviewTabLabel = computed((): string => {
background-color: rgba(255, 255, 255, 0.5);
padding: 4px 12px;
border-radius: 999px;
border: 1px solid rgba(226, 232, 240, 1);
flex-direction: row;
align-items: center;
}
......@@ -116,8 +115,7 @@ const reviewTabLabel = computed((): string => {
justify-content: space-between;
border-radius: 10px;
background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
border: 1px solid #dbe6f5;
box-shadow: 0 1px 3px rgba(30, 41, 59, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
box-shadow: 0 1px 3px rgba(30, 41, 59, 0.06), inset 0 1px 0 #ffffff;
box-sizing: border-box;
}
......@@ -141,7 +139,7 @@ const reviewTabLabel = computed((): string => {
.tag-box--filter .tag-arrow-icon {
width: 14px;
height: 14px;
margin-left: 8px;
margin-left: 6px;
opacity: 0.8;
}
</style>
<template>
<!-- 客户录入列表:与 customervisits.customerInfoPage 字段对齐(ownerPhone / brandModel / customerTagName / arrivalDate / ownerName) -->
<view class="customer-entry-list">
<!-- 首次加载:列表为空时,用骨架卡片占位,避免空白 -->
<view
v-for="item in customerList"
v-if="loading && (props.customerList == null || props.customerList.length == 0)"
v-for="i in skeletonCardCount"
:key="'entry-skeleton-' + i"
class="list-card list-card-entry glass-card"
>
<un-skeleton rows="3" title loading></un-skeleton>
</view>
<view
v-else
v-for="item in props.customerList"
:key="getStr(item, 'id')"
class="list-card list-card-entry glass-card"
@click="onEntryCardClick(item)"
@longpress="onEntryCardLongPress(item)"
>
<view class="card-header-row">
<view class="card-title-box">
<text class="card-name">{{ getStr(item, 'ownerName') }}</text>
<text class="card-car">{{ getStr(item, 'brandModel') }}</text>
<un-skeleton :rows="3" title :loading="loading">
<view class="card-header-row">
<view class="card-title-box">
<text class="card-name">{{ getStr(item, 'ownerName') }}</text>
<text class="card-car">{{ getStr(item, 'brandModel') }}</text>
</view>
</view>
</view>
<view class="card-info-list">
<view class="info-row"><text class="info-label">车主电话</text><text class="info-value">{{ formatPhone(getStr(item, 'ownerPhone')) }}</text></view>
<view class="info-row"><text class="info-label">品牌车型</text><text class="info-value">{{ getStr(item, 'brandModel') }}</text></view>
<view class="info-row"><text class="info-label">客户标签</text><text class="info-value">{{ getStr(item, 'customerTagName') }}</text></view>
<view class="info-row"><text class="info-label">到店日期</text><text class="info-value">{{ formatArrivalDateOnly(getArrivalTsForEntry(item)) }}</text></view>
</view>
<view class="card-info-list">
<view class="info-row"><text class="info-label">车主电话</text><text class="info-value">{{ formatPhone(getStr(item, 'ownerPhone')) }}</text></view>
<view class="info-row"><text class="info-label">品牌车型</text><text class="info-value">{{ getStr(item, 'brandModel') }}</text></view>
<view class="info-row"><text class="info-label">客户标签</text><text class="info-value">{{ getStr(item, 'customerTagName') }}</text></view>
<view class="info-row"><text class="info-label">到店日期</text><text class="info-value">{{ formatArrivalDateOnly(getArrivalTsForEntry(item)) }}</text></view>
</view>
</un-skeleton>
<view
v-if="isEntryCardMaskVisible(item)"
v-if="!loading && isEntryCardMaskVisible(item)"
class="entry-card-mask"
@click.stop="onEntryCardMaskAbsorbTap"
>
......@@ -46,15 +58,20 @@
</template>
<script setup lang="uts">
import { ref, watch } from 'vue'
import { computed, ref, watch } from 'vue'
const props = defineProps<{
/** 客户档案列表(由父级拉取并传入) */
customerList: UTSJSONObject[]
/** 与父级「今日到店 / 全部客户」分段器同步;切换时关闭长按遮罩 */
entryFilterIndex: number
/** 加载中:骨架屏覆盖卡片内容;列表为空时用骨架卡片占位 */
loading?: boolean
}>()
const loading = computed<boolean>(() => props.loading === true)
const skeletonCardCount = 3
const emit = defineEmits<{
/** 点击卡片:打开客户档案详情 */
'entry-click': [item: UTSJSONObject]
......@@ -170,11 +187,17 @@ function formatArrivalDateOnly(ts: number | null): string {
}
function onEntryCardClick(item: UTSJSONObject): void {
if (loading.value) {
return
}
entryOverlayEntryId.value = ''
emit('entry-click', item)
}
function onEntryCardLongPress(item: UTSJSONObject): void {
if (loading.value) {
return
}
entryOverlayEntryId.value = getStr(item, 'id')
}
......
<template>
<!-- 接待复盘记录列表:与接待接口字段对齐,数据由父级拉取后传入 -->
<view class="reception-record-list">
<!-- 首次加载:列表为空时,用骨架卡片占位,避免空白 -->
<view
v-for="(item, idx) in receptionRecordList"
v-if="!loading && (props.receptionRecordList == null || props.receptionRecordList.length == 0)"
v-for="i in skeletonCardCount"
:key="'reception-skeleton-' + i"
class="list-card glass-card"
>
<un-skeleton rows="3" title loading></un-skeleton>
</view>
<view
v-else
v-for="(item, idx) in props.receptionRecordList"
:key="getStr(item, 'batchId') != '' ? getStr(item, 'batchId') + '-' + idx : 'recv-' + idx"
class="list-card glass-card"
@click="onCardClick(item)"
>
<view class="card-header-row">
<view class="card-title-box">
<text class="card-name">{{ getStr(item, 'customerName') }}</text>
<text class="card-car">{{ getStr(item, 'carBrand') }}</text>
</view>
<view class="card-status-box">
<view class="status-badge bg-slate-100">
<text class="status-text text-slate-400">{{ getReviewFlagText(item) }}</text>
<un-skeleton :rows="3" title :loading="loading">
<view class="card-header-row">
<view class="card-title-box">
<text class="card-name">{{ getStr(item, 'customerName') }}</text>
<text class="card-car">{{ getStr(item, 'carBrand') }}</text>
</view>
<view
v-if="shouldShowOrderFinishBadge(item)"
:class="orderFinishFlagIsSuccess(item) ? 'status-badge bg-green-50' : 'status-badge bg-red-50'"
>
<text :class="orderFinishFlagIsSuccess(item) ? 'status-text text-green-400' : 'status-text text-red-400'">{{ getOrderFinishResultLabel(item) }}</text>
<view class="card-status-box">
<view class="status-badge bg-slate-100">
<text class="status-text text-slate-400">{{ getReviewFlagText(item) }}</text>
</view>
<view
v-if="shouldShowOrderFinishBadge(item)"
:class="orderFinishFlagIsSuccess(item) ? 'status-badge bg-green-50' : 'status-badge bg-red-50'"
>
<text :class="orderFinishFlagIsSuccess(item) ? 'status-text text-green-400' : 'status-text text-red-400'">{{ getOrderFinishResultLabel(item) }}</text>
</view>
</view>
</view>
</view>
<view class="card-info-list">
<view class="info-row"><text class="info-label">客户电话</text><text class="info-value">{{ formatPhone(getStr(item, 'phoneNumber')) }}</text></view>
<view class="info-row"><text class="info-label">销售姓名</text><text class="info-value">{{ getReceptionSalesDisplay(item) }}</text></view>
<view class="info-row"><text class="info-label">接待时长</text><text class="info-value">{{ formatReceptionDuration(item) }}</text></view>
<view class="info-row"><text class="info-label">开始接待</text><text class="info-value">{{ formatTimestamp(getTs(item, 'receptionStartTime')) }}</text></view>
<view class="info-row info-row-last"><text class="info-label">结束接待</text><text class="info-value">{{ formatTimestamp(getTs(item, 'receptionEndTime')) }}</text></view>
</view>
<view class="card-info-list">
<view class="info-row"><text class="info-label">客户电话</text><text class="info-value">{{ formatPhone(getStr(item, 'phoneNumber')) }}</text></view>
<view class="info-row"><text class="info-label">销售姓名</text><text class="info-value">{{ getReceptionSalesDisplay(item) }}</text></view>
<view class="info-row"><text class="info-label">接待时长</text><text class="info-value">{{ formatReceptionDuration(item) }}</text></view>
<view class="info-row"><text class="info-label">开始接待</text><text class="info-value">{{ formatTimestamp(getTs(item, 'receptionStartTime')) }}</text></view>
<view class="info-row info-row-last"><text class="info-label">结束接待</text><text class="info-value">{{ formatTimestamp(getTs(item, 'receptionEndTime')) }}</text></view>
</view>
</un-skeleton>
</view>
</view>
</template>
<script setup lang="uts">
defineProps<{
import { computed } from 'vue'
const props = defineProps<{
/** 接待记录列表(由父级拉取并传入) */
receptionRecordList: UTSJSONObject[]
/** 加载中:骨架屏覆盖卡片内容;列表为空时用骨架卡片占位 */
loading?: boolean
}>()
const loading = computed<boolean>(() => props.loading === true)
const skeletonCardCount = 3
const emit = defineEmits<{
/** 点击卡片:父级根据 filterTabIndex 等处理详情或 toast */
'reception-click': [item: UTSJSONObject]
......@@ -177,6 +196,9 @@ function formatReceptionDuration(item: UTSJSONObject): string {
}
function onCardClick(item: UTSJSONObject): void {
if (loading.value) {
return
}
emit('reception-click', item)
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!