Commit 61547116 by Lin

feat: 新增接待详情页面及相关功能

- 在 pages.json 中添加接待详情页面路径
- 更新 HomeFrame 组件以支持接待详情的展示逻辑
- 在 ReceptionCenter 组件中实现接待卡片点击时展示接待详情的功能
- 修改相关样式以适应接待详情的展示需求
1 parent 0f73a9bb
<template>
<un-popup
:show="props.show"
mode="right"
:width="popupSize.w"
:height="popupSize.h"
closeable
closeOnClickOverlay
safeAreaInsetBottom
safeAreaInsetTop
:customStyle="{ overflow: 'hidden', boxSizing: 'border-box' }"
@close="handleClose"
@open="onPopupOpen"
>
<view class="form-detail-wrap">
<view class="form-detail-header">
<text class="form-detail-title">客户档案</text>
</view>
<scroll-view class="form-detail-scroll" scroll-y="true">
<view class="form-detail-body">
<view class="form-row">
<text class="form-label">姓名</text>
<text class="form-value">{{ displayName }}</text>
</view>
<view class="form-row">
<text class="form-label">电话</text>
<text class="form-value">{{ displayPhone }}</text>
</view>
<view class="form-row">
<text class="form-label">品牌车型</text>
<text class="form-value">{{ displayBrandModel }}</text>
</view>
<view class="form-row">
<text class="form-label">接待场景</text>
<text class="form-value">{{ displayReceptionScenario }}</text>
</view>
<view class="form-row">
<text class="form-label">到店日期</text>
<text class="form-value">{{ displayVisitDate }}</text>
</view>
<view class="form-row">
<text class="form-label">客户标签</text>
<text class="form-value">{{ displayCustomerTags }}</text>
</view>
</view>
<!-- <view class="form-detail-goods">
<text class="form-detail-goods-title">商品套餐</text>
<un-empty
mode="data"
text="数据为空"
icon="http://cdn.uviewui.com/uview/empty/car.png"
/>
</view> -->
</scroll-view>
</view>
</un-popup>
</template>
<script setup lang="uts">
import { ref, computed, onMounted } from 'vue'
type PopupSize = { w: string; h: string }
function getPopupSize(): PopupSize {
const info = uni.getWindowInfo()
const w = info.windowWidth > 0 ? info.windowWidth : info.screenWidth
const h = info.windowHeight > 0 ? info.windowHeight : info.screenHeight
return { w: w + 'px', h: h + 'px' }
}
const props = withDefaults(
defineProps<{
show?: boolean
/** 详情数据,支持 ownerName/name、ownerPhone/phone、brandModel、receptionScenario、arrivalDate/arrivalTime、customerTags */
detail?: UTSJSONObject | null
}>(),
{ show: false, detail: null }
)
const popupSize = ref<PopupSize>({ w: '375px', h: '667px' })
onMounted(() => {
popupSize.value = getPopupSize()
})
function onPopupOpen(): void {
popupSize.value = getPopupSize()
}
const emit = defineEmits<{
'close': []
}>()
function getStr(data: UTSJSONObject | null, key: string): string {
if (data == null) { return '' }
const v = data[key]
if (v == null) { return '' }
return `${v}`
}
function getTs(data: UTSJSONObject | null, key: string): number | null {
if (data == null) { return 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
}
// 格式化手机号:13001365398 -> 130 0136 5398
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
}
// 格式化到店日期:支持 arrivalDate(YYYY-MM-DD) 或 arrivalTime(时间戳)
function formatVisitDate(d: UTSJSONObject | null): string {
if (d == null) { return '' }
const dateStr = getStr(d, 'arrivalDate')
if (dateStr != null && dateStr != '') {
return dateStr
}
const ts = getTs(d, 'arrivalTime')
if (ts == null || ts <= 0) { return '' }
const date = new Date(ts)
const y = date.getFullYear()
const m = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
return `${y}-${m}-${day}`
}
// 空值显示为 "-"
function orPlaceholder(val: string): string {
return (val != null && val != '') ? val : '-'
}
const displayName = computed((): string => {
const d = props.detail
if (d == null) { return '-' }
const v = getStr(d, 'ownerName')
if (v != '') { return v }
return orPlaceholder(getStr(d, 'name'))
})
const displayPhone = computed((): string => {
const d = props.detail
if (d == null) { return '-' }
const raw = getStr(d, 'ownerPhone')
if (raw != '') { return formatPhone(raw) }
const raw2 = getStr(d, 'phone')
return orPlaceholder(formatPhone(raw2))
})
const displayBrandModel = computed((): string => {
const d = props.detail
if (d == null) { return '-' }
return orPlaceholder(getStr(d, 'brandModel'))
})
const displayReceptionScenario = computed((): string => {
const d = props.detail
if (d == null) { return '-' }
return orPlaceholder(getStr(d, 'receptionScenario'))
})
const displayVisitDate = computed((): string => {
const d = props.detail
if (d == null) { return '-' }
const v = formatVisitDate(d)
return orPlaceholder(v)
})
const displayCustomerTags = computed((): string => {
const d = props.detail
if (d == null) { return '-' }
return orPlaceholder(getStr(d, 'customerTags'))
})
function handleClose(): void {
emit('close')
}
</script>
<style lang="scss" scoped>
.form-detail-wrap {
display: flex;
flex-direction: column;
height: 100%;
padding: 24px 24px 0;
padding-bottom: 24px;
overflow: hidden;
box-sizing: border-box;
}
.form-detail-header {
margin-bottom: 16px;
}
.form-detail-title {
font-size: 18px;
font-weight: 700;
color: #1e293b;
}
.form-detail-scroll {
flex: 1;
min-height: 0;
overflow: hidden;
}
.form-detail-body {
display: flex;
flex-direction: column;
width: 100%;
}
.form-row {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
padding: 12px 0;
border-bottom: 1px solid #e2e8f0;
}
.form-label {
width: 100px;
flex-shrink: 0;
font-size: 14px;
color: #1e293b;
}
.form-value {
flex: 1;
min-width: 0;
font-size: 14px;
color: #1e293b;
}
.form-value:empty {
color: #94a3b8;
}
.form-detail-goods {
display: flex;
flex-direction: column;
margin-top: 24px;
padding-top: 16px;
border-top: 1px solid #e2e8f0;
}
.form-detail-goods-title {
font-size: 16px;
font-weight: 700;
color: #1e293b;
margin-bottom: 16px;
}
</style>
......@@ -214,7 +214,7 @@
:class="{ 'active-filter-tab': resultTabIndex == 1 }"
@click="switchResultTab(1)"
>
<text class="filter-tab-text" :class="resultTabIndex == 1 ? 'text-slate-800 font-bold' : 'text-slate-500'">成功</text>
<text class="filter-tab-text" :class="resultTabIndex == 1 ? 'text-slate-800 font-bold' : 'text-slate-500'">成交</text>
</view>
</view>
</view>
......@@ -253,6 +253,7 @@
v-for="(item, idx) in filteredEntryList"
:key="getStr(item, 'id')"
class="list-card glass-card"
@click="onEntryCardClick(item)"
>
<view class="card-header-row">
<view class="card-title-box">
......@@ -273,6 +274,7 @@
v-for="(item, idx) in filteredCustomerList"
:key="getStr(item, 'id')"
class="list-card glass-card"
@click="onReceptionCardClick(item)"
>
<view class="card-header-row">
<view class="card-title-box">
......@@ -285,9 +287,9 @@
</view>
<view
v-if="getStr(item, 'receptionResultName') != ''"
:class="getStr(item, 'receptionResultName').indexOf('成功') >= 0 ? 'status-badge bg-green-50' : 'status-badge bg-red-50'"
:class="getStr(item, 'receptionResultName').indexOf('成交') >= 0 ? 'status-badge bg-green-50' : 'status-badge bg-red-50'"
>
<text :class="getStr(item, 'receptionResultName').indexOf('成功') >= 0 ? 'status-text text-green-400' : 'status-text text-red-400'">{{ getStr(item, 'receptionResultName') }}</text>
<text :class="getStr(item, 'receptionResultName').indexOf('成交') >= 0 ? 'status-text text-green-400' : 'status-text text-red-400'">{{ getStr(item, 'receptionResultName') }}</text>
</view>
</view>
</view>
......@@ -343,6 +345,7 @@
<un-picker :show="show" :columns="columns" @close="onClose" @cancel="onClose" @confirm="onConfirm" />
<!-- 预录信息:由 FormAdd 组件统一维护 -->
<FormAdd :show="preEntryPopupVisible" @close="onPreEntryClose" @submit="onPreEntrySubmit" />
<FormDetail :show="showReceptionDetail" :detail="receptionDetailItem" @close="onReceptionDetailClose" />
</template>
<script setup lang="uts">
......@@ -350,6 +353,7 @@
import { ref, computed, onMounted } from 'vue'
import type { UnPickerColumn, UnPickerColumnItem, UnPickerConfirmEvent } from '@/uni_modules/uview-unix'
import FormAdd from './FormAdd.uvue'
import FormDetail from './FormDetail.uvue'
import { getMerchantPerformance } from '@/api/receiption.uts'
// 产值卡片 tabs:0=本月交付转化率,1=本月交付客单价
......@@ -367,21 +371,21 @@ const entryFilterIndex = ref(0);
// 复盘 tabs:0=复盘,1=未复盘
const reviewTabIndex = ref(0);
// 结果 tabs:0=战败,1=成功
// 结果 tabs:0=战败,1=成交
const resultTabIndex = ref(0);
// 客户档案列表数据(接待复盘卡片)
const customerList = ref<UTSJSONObject[]>([])
// 硬编码模拟数据:覆盖 已提交/未提交、战败/成功、已复盘/未复盘 等组合(0 表示无时间戳)
// 硬编码模拟数据:覆盖 已提交/未提交、战败/成交、已复盘/未复盘 等组合(0 表示无时间戳)
const MOCK_CUSTOMER_LIST: UTSJSONObject[] = [
{ id: 1, ownerName: '谢海旭', brandModel: 'AITO M9', ownerPhone: '13001365398', receptionist: '李玉燕', startTime: 1710763200000, endTime: 1710764280000, receptionTime: 1710764280000, receptionResultName: '战败', submitted: 1 },
{ id: 2, ownerName: '周海宝', brandModel: 'AITO M7', ownerPhone: '13800138001', receptionist: '王芳', startTime: 0, endTime: 0, receptionTime: 0, receptionResultName: '战败', submitted: 1 },
{ id: 3, ownerName: '王燕妮', brandModel: '问界 M5', ownerPhone: '13900139002', receptionist: '刘明', startTime: 1710770000000, endTime: 1710771200000, receptionTime: 1710771200000, receptionResultName: '成功', submitted: 1 },
{ id: 4, ownerName: '陈希', brandModel: 'AITO M9', ownerPhone: '13700137003', receptionist: '陈华', startTime: 0, endTime: 0, receptionTime: 0, receptionResultName: '成功', submitted: 1 },
{ id: 3, ownerName: '王燕妮', brandModel: '问界 M5', ownerPhone: '13900139002', receptionist: '刘明', startTime: 1710770000000, endTime: 1710771200000, receptionTime: 1710771200000, receptionResultName: '成交', submitted: 1 },
{ id: 4, ownerName: '陈希', brandModel: 'AITO M9', ownerPhone: '13700137003', receptionist: '陈华', startTime: 0, endTime: 0, receptionTime: 0, receptionResultName: '成交', submitted: 1 },
{ id: 5, ownerName: '梁敏', brandModel: 'AITO M9', ownerPhone: '13512229999', receptionist: '李玉燕', startTime: 1710780000000, endTime: 1710781500000, receptionTime: 1710781500000, receptionResultName: '战败', submitted: 0 },
{ id: 6, ownerName: '吕文', brandModel: 'AITO M9', ownerPhone: '13600136004', receptionist: '张伟', startTime: 0, endTime: 0, receptionTime: 0, receptionResultName: '战败', submitted: 0 },
{ id: 7, ownerName: '林佳', brandModel: '问界 M5', ownerPhone: '13400134005', receptionist: '李强', startTime: 1710790000000, endTime: 1710791800000, receptionTime: 1710791800000, receptionResultName: '成功', submitted: 0 },
{ id: 7, ownerName: '林佳', brandModel: '问界 M5', ownerPhone: '13400134005', receptionist: '李强', startTime: 1710790000000, endTime: 1710791800000, receptionTime: 1710791800000, receptionResultName: '成交', submitted: 0 },
{ id: 8, ownerName: '李明', brandModel: 'AITO M7', ownerPhone: '13300133006', receptionist: '赵磊', startTime: 0, endTime: 0, receptionTime: 0, receptionResultName: '', submitted: 0 }
]
......@@ -407,6 +411,9 @@ const entryList = ref<UTSJSONObject[]>(getInitialEntryList())
const show = ref(false)
// 预录信息弹出层显示状态
const preEntryPopupVisible = ref(false)
// 客户档案详情弹窗:客户录入卡片点击时展示
const showReceptionDetail = ref(false)
const receptionDetailItem = ref<UTSJSONObject | null>(null)
// 选中的品牌,默认问界
const selectedBrand = ref('问界')
// 对象字面量需显式断言为 UnPickerColumnItem,否则 UTS 会推断为 UTSJSONObject
......@@ -460,6 +467,37 @@ function onPreEntryClose(): void {
preEntryPopupVisible.value = false
}
// 客户录入卡片点击:打开 FormDetail 弹窗展示客户档案详情
function onEntryCardClick(item: UTSJSONObject): void {
receptionDetailItem.value = item
showReceptionDetail.value = true
}
// 客户档案详情弹窗关闭(FormDetail 组件 emit close 时调用)
function onReceptionDetailClose(): void {
showReceptionDetail.value = false
receptionDetailItem.value = null
}
// 从 UTSJSONObject 安全读取字符串(需在使用前定义,UTS 无函数提升)
function getStr(data: UTSJSONObject, key: string): string {
const v = data[key]
if (v == null) { return '' }
return `${v}`
}
// 接待复盘卡片点击:若为成交则展示接待详情
const emit = defineEmits<{
'show-reception-detail': [item: UTSJSONObject]
}>()
function onReceptionCardClick(item: UTSJSONObject): void {
const resultName = getStr(item, 'receptionResultName')
if (resultName.indexOf('成交') >= 0) {
// emit('show-reception-detail', item)
}
}
// 对比行数据结构:barWidthPercent 由当前值/100 换算
type CompareRow = {
label: string
......@@ -496,13 +534,6 @@ function getNum(data: UTSJSONObject, key: string): number {
return isNaN(n) ? 0 : n
}
// 从 UTSJSONObject 安全读取字符串
function getStr(data: UTSJSONObject, key: string): string {
const v = data[key]
if (v == null) { return '' }
return `${v}`
}
// 从 UTSJSONObject 安全读取时间戳(number | null)
function getTs(data: UTSJSONObject, key: string): number | null {
const v = data[key]
......@@ -589,7 +620,7 @@ const filteredEntryList = computed((): UTSJSONObject[] => {
return arr
})
// 根据筛选条件过滤后的客户列表(支持 已提交/未提交、战败/成功、复盘/未复盘)
// 根据筛选条件过滤后的客户列表(支持 已提交/未提交、战败/成交、复盘/未复盘)
const filteredCustomerList = computed((): UTSJSONObject[] => {
const list = customerList.value
const arr: UTSJSONObject[] = []
......@@ -600,10 +631,10 @@ const filteredCustomerList = computed((): UTSJSONObject[] => {
const submitted = isSubmitted(item)
if (filterTabIndex.value == 0 && !submitted) { i++; continue }
if (filterTabIndex.value == 1 && submitted) { i++; continue }
// 接待复盘 tab 下才筛选 战败/成功、复盘/未复盘
// 接待复盘 tab 下才筛选 战败/成交、复盘/未复盘
if (rightTabIndex.value == 1) {
const resultName = getStr(item, 'receptionResultName')
const hasResult = resultName.indexOf('成功') >= 0
const hasResult = resultName.indexOf('成交') >= 0
if (resultTabIndex.value == 0 && hasResult) { i++; continue }
if (resultTabIndex.value == 1 && !hasResult) { i++; continue }
const reviewed = hasReceptionTime(item)
......@@ -1349,7 +1380,7 @@ onMounted(() => {
border-radius: 6px;
}
/* 战败/成功、复盘/未复盘 tab 在 filter-actions 中的间距 */
/* 战败/成交、复盘/未复盘 tab 在 filter-actions 中的间距 */
.review-tabs-wrap {
margin-left: 6px;
flex: 0 0 auto;
......
......@@ -52,7 +52,12 @@
<slot name="home"></slot>
</view>
<view v-else-if="tabIndex == 1" class="reception-center-wrap">
<ReceptionCenterCenter />
<view v-show="!showReceptionDetail" class="reception-center-inner">
<ReceptionCenterCenter @show-reception-detail="onShowReceptionDetail" />
</view>
<view v-show="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :embedded="true" :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view>
</view>
</view>
......@@ -102,7 +107,12 @@
</view>
<!-- 横屏接待中心:仅显示右侧列表区 -->
<view v-else-if="tabIndex == 1" class="reception-center-wrap">
<ReceptionCenterCenter :only-right="true" />
<view v-show="!showReceptionDetail" class="reception-center-inner">
<ReceptionCenterCenter :only-right="true" @show-reception-detail="onShowReceptionDetail" />
</view>
<view v-show="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :embedded="true" :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view>
</view>
</view>
......@@ -143,6 +153,7 @@ import { storage } from "@/utils/storage.uts";
import HomeFrameLeftSide from "./LeftSide.uvue";
import HomeFrameMessageIndex from "./MessageIndex.uvue";
import ReceptionCenterCenter from "./ReceptionCenter/center.uvue";
import ReceptionDetail from "./ReceptionCenter/receptionDetail.uvue";
const props = defineProps<{
showFooter?: boolean
......@@ -177,6 +188,9 @@ const showDetail = ref(false);
const userInfo = ref<UTSJSONObject>({});
const sceneType = ref<number>(1);
const tabIndex = ref(0);
// 接待详情:成交卡片点击时展示
const showReceptionDetail = ref(false);
const receptionDetailItem = ref<UTSJSONObject>({});
function updateApp(): void {
const info = storage.get("userInfo");
......@@ -199,6 +213,15 @@ function onChangeTab(index: number): void {
tabIndex.value = index;
}
function onShowReceptionDetail(item: UTSJSONObject): void {
receptionDetailItem.value = item;
showReceptionDetail.value = true;
}
function onReceptionDetailClose(): void {
showReceptionDetail.value = false;
}
function onStartClick(): void {
emit("start");
}
......@@ -399,6 +422,18 @@ defineExpose({
min-height: 0;
display: flex;
flex-direction: column;
position: relative;
}
.reception-center-inner,
.reception-detail-inner {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
}
/* 底部门店信息,与旧项目 store-addr 一致:居中、无通栏背景、两侧渐变线 */
......
......@@ -54,6 +54,13 @@
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/common/receptionDetail/index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "接待详情"
}
}
],
"easycom": {
......@@ -67,7 +74,8 @@
"^home-frame$": "@/components/HomeFrame/index.uvue",
"^layout-root$": "@/components/LayoutRoot/index.uvue",
"^Layout$": "@/components/Layout/index.uvue",
"^segment-tab$": "@/components/HomeFrame/ReceptionCenter/SegmentTab.uvue"
"^segment-tab$": "@/components/HomeFrame/ReceptionCenter/SegmentTab.uvue",
"^reception-detail$": "@/components/HomeFrame/ReceptionCenter/receptionDetail.uvue"
}
},
"globalStyle": {
......
<template>
<view class="page-wrap">
<reception-detail />
</view>
</template>
<script setup lang="uts">
// 接待详情页:使用 receptionDetail 组件统一维护
</script>
<style>
.page-wrap {
height: 100%;
display: flex;
flex-direction: column;
background-color: #F8FAFC;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!