Commit b360d66e by Lin

feat(reception): 重构接待中心组件,新增客户列表功能

- 在 HomeFrame 组件中添加 reception-center-inner 样式以优化内容区显示
- 修改 CardContainer 组件的边框半径样式
- 更新 center 组件,重构客户列表为独立 CustomerList 组件,支持点击、编辑和删除操作
- 优化滚动视图的结构,确保内容在 flex 布局中正确显示
- 添加加载状态和底部提示信息以提升用户体验
1 parent 4843b03b
......@@ -45,7 +45,7 @@ const rootClass = computed((): string => {
background-color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.4);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
border-radius: 32px;
border-radius: 16px;
flex-direction: column;
}
......
<template>
<!-- 客户录入列表:与 customervisits.customerInfoPage 字段对齐(ownerPhone / brandModel / customerTagName / arrivalDate / ownerName) -->
<view class="customer-entry-list">
<view
v-for="item in 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>
</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
v-if="isEntryCardMaskVisible(item)"
class="entry-card-mask"
@click.stop="onEntryCardMaskAbsorbTap"
>
<view class="entry-mask-header">
<view class="entry-mask-close-btn" @click.stop="closeEntryCardMask">
<un-icon name="close" color="#ffffff" size="22"></un-icon>
</view>
</view>
<view class="entry-mask-actions-row">
<view class="entry-mask-action" @click.stop="onEntryCardMaskEdit(item)">
<un-icon name="edit-pen" color="#ffffff" size="28"></un-icon>
<text class="entry-mask-action-text">编辑</text>
</view>
<view class="entry-mask-action" @click.stop="onEntryCardMaskDelete(item)">
<un-icon name="trash" color="#fecaca" size="28"></un-icon>
<text class="entry-mask-action-text entry-mask-action-text-delete">删除</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, watch } from 'vue'
const props = defineProps<{
/** 客户档案列表(由父级拉取并传入) */
customerList: UTSJSONObject[]
/** 与父级「今日到店 / 全部客户」分段器同步;切换时关闭长按遮罩 */
entryFilterIndex: number
}>()
const emit = defineEmits<{
/** 点击卡片:打开客户档案详情 */
'entry-click': [item: UTSJSONObject]
/** 遮罩内编辑:父级打开预录表单并回显 */
'entry-edit': [item: UTSJSONObject]
/** 遮罩内删除:父级从列表移除该项 */
'entry-delete': [item: UTSJSONObject]
}>()
/** 长按展开的操作遮罩:按条目 id 匹配 */
const entryOverlayEntryId = ref('')
watch(
(): number => props.entryFilterIndex,
(_newIdx: number): void => {
entryOverlayEntryId.value = ''
}
)
function getStr(data: UTSJSONObject, key: string): string {
const v = data[key]
if (v == null) {
return ''
}
return `${v}`
}
function getTs(data: UTSJSONObject, key: string): number | null {
const v = data[key]
if (v == null) {
return null
}
if (typeof v == 'number') {
return v
}
const n = parseFloat(`${v}`)
return isNaN(n) ? null : n
}
function parseArrivalDateFieldToTs(v: any | null): number | null {
if (v == null) {
return null
}
if (typeof v == 'number') {
if (v > 0) {
return v
}
return null
}
const s = `${v}`.trim()
if (s == '') {
return null
}
let allDigits = true
let j = 0
while (j < s.length) {
const c = s.charCodeAt(j) ?? -1
if (c < 48 || c > 57) {
allDigits = false
break
}
j++
}
if (allDigits && s.length >= 10) {
const n = parseFloat(s)
if (!isNaN(n) && n > 0) {
return n
}
}
const head = s.length >= 10 ? s.substring(0, 10) : ''
if (head.length == 10) {
const parts = head.split('-')
if (parts.length == 3) {
const y = parseInt(parts[0], 10)
const mo = parseInt(parts[1], 10) - 1
const d = parseInt(parts[2], 10)
if (!isNaN(y) && !isNaN(mo) && !isNaN(d)) {
return new Date(y, mo, d, 12, 0, 0).getTime()
}
}
}
return null
}
function getArrivalTsForEntry(item: UTSJSONObject): number | null {
const fromAd = parseArrivalDateFieldToTs(item['arrivalDate'])
if (fromAd != null && fromAd > 0) {
return fromAd
}
return getTs(item, 'arrivalTime')
}
function formatPhone(phone: string): string {
if (phone == null || phone == '') {
return ''
}
const s = phone.replace(/\s/g, '')
if (s.length >= 11) {
return s.substring(0, 3) + ' ' + s.substring(3, 7) + ' ' + s.substring(7, 11)
}
return phone
}
function formatArrivalDateOnly(ts: number | null): string {
if (ts == null || ts <= 0) {
return ''
}
const d = new Date(ts)
const y = d.getFullYear()
const m = (d.getMonth() + 1).toString().padStart(2, '0')
const day = d.getDate().toString().padStart(2, '0')
return `${y}-${m}-${day}`
}
function onEntryCardClick(item: UTSJSONObject): void {
entryOverlayEntryId.value = ''
emit('entry-click', item)
}
function onEntryCardLongPress(item: UTSJSONObject): void {
entryOverlayEntryId.value = getStr(item, 'id')
}
function closeEntryCardMask(): void {
entryOverlayEntryId.value = ''
}
function onEntryCardMaskAbsorbTap(): void {}
function isEntryCardMaskVisible(item: UTSJSONObject): boolean {
const idStr = getStr(item, 'id')
return entryOverlayEntryId.value != '' && idStr == entryOverlayEntryId.value
}
function onEntryCardMaskEdit(item: UTSJSONObject): void {
closeEntryCardMask()
emit('entry-edit', item)
}
function onEntryCardMaskDelete(item: UTSJSONObject): void {
closeEntryCardMask()
emit('entry-delete', item)
}
</script>
<style scoped lang="scss">
.customer-entry-list {
flex-direction: column;
width: 100%;
}
.glass-card {
background-color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.4);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
border-radius: 32px;
flex-direction: column;
}
.list-card {
padding: 20px;
border-radius: 24px;
margin-bottom: 16px;
}
.list-card-entry {
position: relative;
overflow: hidden;
}
.entry-card-mask {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
border-radius: 24px;
background-color: rgba(15, 23, 42, 0.78);
flex-direction: column;
z-index: 10;
}
.entry-mask-header {
flex-direction: row;
justify-content: flex-end;
padding-top: 4px;
padding-right: 4px;
padding-left: 8px;
}
.entry-mask-close-btn {
padding: 8px;
flex-direction: row;
align-items: center;
justify-content: center;
}
.entry-mask-actions-row {
flex: 1;
flex-direction: row;
align-items: center;
justify-content: center;
padding-bottom: 16px;
}
.entry-mask-action {
flex-direction: column;
align-items: center;
margin-left: 28px;
margin-right: 28px;
}
.entry-mask-action-text {
font-size: 13px;
color: #ffffff;
margin-top: 8px;
text-align: center;
}
.entry-mask-action-text-delete {
color: #fecaca;
}
.card-header-row {
flex-direction: row;
justify-content: space-between;
margin-bottom: 16px;
}
.card-title-box {
flex-direction: column;
}
.card-name {
font-size: 18px;
font-weight: bold;
color: #1e293b;
}
.card-car {
font-size: 14px;
font-weight: bold;
color: #0055ff;
margin-top: 4px;
}
.card-info-list {
flex-direction: column;
}
.info-row {
flex-direction: row;
justify-content: space-between;
margin-bottom: 10px;
}
.info-label {
font-size: 12px;
color: #64748b;
}
.info-value {
font-size: 12px;
color: #334155;
}
</style>
......@@ -443,6 +443,12 @@ defineExpose({
flex-direction: column;
}
/* 仅接待中心内容区:收缩 + 裁剪溢出,让内部 scroll-view 获得固定视口高(勿加到 reception-detail-inner,避免裁切详情层) */
.reception-center-inner {
min-height: 0;
overflow: hidden;
}
/* 底部门店信息,与旧项目 store-addr 一致:居中、无通栏背景、两侧渐变线 */
.store-addr {
position: absolute;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!