Commit 35adf822 by liimin

refactor: 重构首页场景调度,调整个人中心与导航配置

重构首页场景切换逻辑,使用Strategy模式替代硬编码分支,新增ScenePanelShell与sceneContext工具类;移除底部导航的接待中心tab项,将接待记录入口移至个人中心常用功能;更新tabbar配置与注释,删除废弃的接待中心相关组件与样式文件。
1 parent 61578096
Showing 42 changed files with 412 additions and 2607 deletions
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
<template>
<view class="rrl-root">
<view class="rrl-header">
<text class="rrl-title">最近接待记录</text>
<text class="rrl-more" @click="onViewAll">查看全部</text>
</view>
<view class="rrl-content">
<view v-if="loading" class="rrl-loading">
<text class="rrl-loading-text">加载中...</text>
</view>
<view v-else-if="cardList.length == 0" class="rrl-empty">
<text class="rrl-empty-text">暂无接待记录</text>
</view>
<view v-else :class="['rrl-list', isPortrait ? 'rrl-list--portrait' : 'rrl-list--landscape']">
<view
v-for="(item, idx) in cardList"
:key="'rrl-' + idx"
class="rrl-card"
@click="onCardClick(item.rawData)"
>
<view class="rrl-card-top">
<text class="rrl-card-name">{{ item.customerName }}</text>
<text :class="['rrl-card-badge', item.badgeBgClass]">
{{ item.resultText }}
</text>
</view>
<view class="rrl-card-info">
<text class="rrl-card-label">{{ item.carTypeText }}</text>
<text class="rrl-card-time">{{ item.timeText }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { type Ref, computed, onMounted, ref } from "vue";
import { getList } from "@/api/receiption.uts";
import { useOrientation } from "@/services/adapter/hooks/index.uts";
import { getStr } from "@/pages/receptionCenter/types/reception-center-helpers.uts";
import { formatReceptionDateTime, getReceptionResultBadgeBgClass } from "@/pages/receptionCenter/lists/reception-list-helpers.uts";
type ReceptionCardItem = {
customerName: string;
resultText: string;
badgeBgClass: string;
carTypeText: string;
timeText: string;
rawData: UTSJSONObject;
};
const props = withDefaults(defineProps<{
/** 最多展示条数 */
limit?: number
}>(), {
limit: 3
});
// 横竖屏检测
const orientationHook = useOrientation();
const isPortrait = computed((): boolean => {
return (orientationHook.isPortrait as Ref<boolean>).value;
});
const cardList = ref<ReceptionCardItem[]>([]);
const loading = ref(true);
function buildCardItem(row: UTSJSONObject): ReceptionCardItem {
const result = getStr(row, 'result');
const resultText = result != '' ? result : '进行中';
const carType = getStr(row, 'carType');
const carTypeText = carType != '' ? carType : '未填写车型';
return {
customerName: getStr(row, 'customerName'),
resultText: resultText,
badgeBgClass: getReceptionResultBadgeBgClass(result),
carTypeText: carTypeText,
timeText: formatReceptionDateTime(row, 'start'),
rawData: row
} as ReceptionCardItem;
}
async function fetchRecentList(): Promise<void> {
loading.value = true;
try {
const params = {
pageNum: 1,
pageSize: props.limit,
orderFinishFlag: "1"
} as UTSJSONObject;
const resp = await getList(params);
const respObj = resp as UTSJSONObject;
const rows = (respObj.data as UTSJSONObject)?.rows as UTSJSONObject[] | null;
const data = rows != null ? rows : ([] as UTSJSONObject[]);
const items: ReceptionCardItem[] = [];
let i = 0;
while (i < data.length) {
items.push(buildCardItem(data[i]));
i++;
}
cardList.value = items;
} catch (_e) {
cardList.value = [];
} finally {
loading.value = false;
}
}
function onCardClick(rawData: UTSJSONObject): void {
uni.navigateTo({
url: `/pages/receptionCenter/forms/FormDetail?record=${encodeURIComponent(JSON.stringify(rawData))}`
});
}
function onViewAll(): void {
uni.navigateTo({ url: "/pages/receptionCenter/center" });
}
onMounted(() => {
void fetchRecentList();
});
</script>
<style scoped lang="scss">
.rrl-root {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
min-height: 0;
max-height: 100%;
overflow: hidden;
}
.rrl-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 6px 0 8px 0;
flex-shrink: 0;
}
.rrl-title {
font-size: 16px;
font-weight: 600;
color: #1e293b;
}
.rrl-more {
font-size: 13px;
color: #3773f8;
padding: 4px 0;
}
.rrl-content {
flex: 1;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
}
.rrl-loading,
.rrl-empty {
display: flex;
align-items: center;
justify-content: center;
padding: 24px 0;
}
.rrl-loading-text {
font-size: 14px;
color: #94a3b8;
}
.rrl-empty-text {
font-size: 14px;
color: #94a3b8;
}
.rrl-list {
display: flex;
}
/* 竖屏:纵向排列,纵向滚动 */
.rrl-list--portrait {
flex-direction: column;
}
.rrl-list--portrait .rrl-card {
width: 100%;
margin-bottom: 10px;
}
.rrl-list--portrait .rrl-card:last-child {
margin-bottom: 0;
}
/* 横屏:横向排列,占满一行 */
.rrl-list--landscape {
flex-direction: row;
flex-wrap: nowrap;
}
.rrl-list--landscape .rrl-card {
flex: 1;
margin-right: 10px;
min-width: 0;
}
.rrl-list--landscape .rrl-card:last-child {
margin-right: 0;
}
.rrl-card {
background: #ffffff;
border: 1px solid #f1f5f9;
border-radius: 12px;
padding: 12px 14px;
box-sizing: border-box;
flex-shrink: 0;
}
.rrl-card-top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-bottom: 6px;
}
.rrl-card-name {
font-size: 15px;
font-weight: 600;
color: #1e293b;
flex: 1;
margin-right: 8px;
}
.rrl-card-badge {
font-size: 11px;
padding: 2px 8px;
border-radius: 10px;
flex-shrink: 0;
}
.rrl-card-info {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.rrl-card-label {
font-size: 13px;
color: #64748b;
}
.rrl-card-time {
font-size: 12px;
color: #94a3b8;
}
</style>
......@@ -2,7 +2,7 @@
<layout-root :page-vars="resolvedPageVars">
<!-- TabBar 壳组件:横/竖两套布局 + 默认槽;方向由 useOrientation 驱动 -->
<view v-if="shellIsPortrait" class="scene-shell-root-portrait">
<view class="scene-shell-slot-portrait">
<view class="scene-shell-main-portrait">
<slot></slot>
</view>
<view class="scene-shell-tabbar-portrait">
......@@ -18,7 +18,7 @@
@setting="onSetting"
@jump-person-center="jumpPersonCenter"
@switch-store="onSwitchStore" />
<view class="scene-shell-slot-landscape">
<view class="scene-shell-main-landscape">
<slot></slot>
</view>
</view>
......@@ -45,13 +45,12 @@ import { navigateToTab, useHomeFrameTabbar } from "./tabbarShared.uts";
// pageVars 自动匹配
import homePageVars from "@/pages/index/styles/index.vars";
import receptionVars from "@/pages/receptionCenter/styles/index.vars";
import personVars from "@/pages/person/styles/index.vars";
defineSlots();
const props = defineProps<{
/** 当前 tab 页下标:0 首页、1 接待中心、2 我的(与 un-tabbar 高亮一致) */
/** 当前 tab 页下标:0 首页、1 我的(与 un-tabbar 高亮一致) */
activeTabIndex: number
/** 页面 CSS 变量,不传时根据 activeTabIndex 自动匹配 */
pageVars?: UTSJSONObject
......@@ -76,7 +75,6 @@ const resolvedPageVars = computed((): UTSJSONObject => {
return props.pageVars;
}
if (props.activeTabIndex == 0) return homePageVars as UTSJSONObject;
if (props.activeTabIndex == 1) return receptionVars as UTSJSONObject;
return personVars as UTSJSONObject;
});
......@@ -124,16 +122,19 @@ onShow(() => {
min-width: 0;
}
.scene-shell-slot-portrait {
/** 竖屏:主内容区(TabBar 上方),统一边距 */
.scene-shell-main-portrait {
flex: 1;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
overflow: hidden;
padding: 0 var(--content-box-padding-side, 8px);
}
.scene-shell-tabbar-portrait {
flex-shrink: 0;
height: var(--tabbar-height, 70px); /* ✅ 使用 CSS 变量控制 tabbar 高度 */
}
......@@ -158,12 +159,14 @@ onShow(() => {
overflow: hidden;
}
.scene-shell-slot-landscape {
/** 横屏:主内容区(TabBar 右侧),统一边距 */
.scene-shell-main-landscape {
flex: 1 1 0%;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
padding: 0 var(--content-box-padding-side, 8px);
}
</style>
......@@ -38,7 +38,7 @@ export type TabItem = {
iconSrcInactive: string;
};
/** 与 pages.json tabBar 一致:首页 | 接待中心 | 我的(选店为普通页,见 shukeSelectStoreNav) */
/** 与 pages.json tabBar 一致:首页 | 我的 */
export const HOME_FRAME_TABS: TabItem[] = [
{
label: "首页",
......@@ -48,13 +48,6 @@ export const HOME_FRAME_TABS: TabItem[] = [
iconSrcInactive: "/static/images/tabbar/home.png"
},
{
label: "接待",
icon: "record",
name: "ReceptionCenter",
iconSrcActive: "/static/images/tabbar/record-active.png",
iconSrcInactive: "/static/images/tabbar/record.png"
},
{
label: "我的",
icon: "my",
name: "MyCenter",
......@@ -101,10 +94,6 @@ export function navigateToTab(index: number, currentTabIndex: number): void {
return;
}
if (index == 1) {
switchTabPage("pages/receptionCenter/center");
return;
}
if (index == 2) {
switchTabPage("pages/person/myCenter");
return;
}
......
......@@ -96,7 +96,6 @@
"^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.uvue",
"^layout-root$": "@/components/LayoutRoot/index.uvue",
"^Layout$": "@/components/Layout/index.uvue",
"^segment-tab$": "@/pages/receptionCenter/SegmentTab.uvue",
"^reception-detail$": "@/pages/receptionCenter/receptionDetail.uvue",
"^app-navbar$": "@/components/AppNavbar/index.uvue"
}
......@@ -129,12 +128,6 @@
"selectedIconPath": "static/images/tabbar/home-active.png"
},
{
"pagePath": "pages/receptionCenter/center",
"text": "接待中心",
"iconPath": "static/images/tabbar/record.png",
"selectedIconPath": "static/images/tabbar/record-active.png"
},
{
"pagePath": "pages/person/myCenter",
"text": "我的",
"iconPath": "static/images/tabbar/study.png",
......
......@@ -16,16 +16,8 @@
@switch-product="onIntroSwitchProduct" />
</view>
</view>
<view class="tool-box box-class">
<view class="common-title">
<text class="title-text">{{ toolBoxTitle }}</text>
</view>
<view class="content-box tool-content-box">
<ToolSkeleton v-if="!toolBoxLoaded" :count="4" />
<view v-else class="swiper-placeholder">
<un-empty mode="data" text="敬请期待"></un-empty>
</view>
</view>
<view class="recent-list-wrapper">
<RecentReceptionList />
</view>
<CenterPopup :list="padBusinessTypePopupItems"
......@@ -61,23 +53,35 @@
<script setup lang="uts">
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { ComponentPublicInstance, computed, nextTick, ref } from "vue";
import { ComponentPublicInstance, computed, nextTick, onShow, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue";
import ProductIntroSwiper from "@/components/ProductIntroSwiper.uvue";
import ProductIntroSkeleton from "@/components/Skeleton/ProductIntroSkeleton.uvue";
import ToolSkeleton from "@/components/Skeleton/ToolSkeleton.uvue";
import { delay } from "@/utils/delay.uts";
// ✅ 从 uview-unix 模块导入 UnSwiperItem 类型
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
import RecentReceptionList from "@/components/RecentReceptionList.uvue";
const props = defineProps<{
logic: BoutiqueLogic
/** 可选的业务逻辑对象,不传时内部自动创建(遵循场景 panel 自包含约定) */
logic?: BoutiqueLogic | null
}>();
const logic = props.logic;
const logic: BoutiqueLogic = (props.logic != null) ? props.logic : useBoutiqueLogic();
/** 组件级 onShow:每次页面展示时刷新数据(initIfNeeded 有内部防重复守卫) */
let _initialized = false;
onShow(() => {
if (!_initialized) {
_initialized = true;
void logic.initIfNeeded();
}
void logic.getBoutiquePackageList();
});
/** 模板里对嵌套 ComputedRef 的解包因端而异,用本地 computed 收口 */
const introModulesForHomeFrame = computed((): any[] => {
......@@ -132,8 +136,6 @@ const padBusinessTypePopupItems = computed((): any[] => {
const packageRef = ref(null);
/** 切换产品:受控弹层(与 CenterPopup `visible` + `update:visible` 用法一致) */
const showPadBusinessTypePopup = ref<boolean>(false);
const toolBoxTitle = ref<string>("展业工具");
const toolBoxLoaded = ref<boolean>(false);
function callExposedMethod(comp: any, methodName: string): void {
if (comp == null) return;
......@@ -175,20 +177,27 @@ function closePackageDetail(): void {
logic.chooseItem.value = {};
}
// 延迟加载展业工具骨架屏
delay(() => {
toolBoxLoaded.value = true;
}, 4);
</script>
<style scoped lang="scss">
.content-left {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
min-height: 0;
}
.module-box {
flex-shrink: 0;
height: var(--module-box-height, 420px);
}
.recent-list-wrapper {
flex: 1;
min-height: 0;
overflow: hidden;
margin-top: var(--l-spacing-sm, 8px);
}
.package-detail-box {
......
<template>
<!--
ScenePanelShell — 场景面板策略调度壳
Strategy 模式:每个场景 panel 是一条独立的 Strategy,
通过 sceneContext 自判激活状态,无需 if/else 链。
新增场景:创建 panel → 在此 import + 添加一行标签。
-->
<view class="app-content-box">
<view class="right-content-box flex-row">
<BoutiqueHomePanel />
<!-- 预留:新增场景时在此处添加 <EquityHomePanel /> 等标签 -->
</view>
</view>
</template>
<script setup lang="uts">
import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvue";
</script>
<style scoped lang="scss">
.app-content-box {
flex: 1;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
padding: var(--content-tabbar-gap, 12px);
}
.right-content-box {
flex: 1;
display: flex;
flex-direction: row;
margin-top: var(--l-spacing-md);
overflow: hidden;
}
</style>
<template>
<!--
首页主壳:TabBarShell(横/竖)+ 动态场景内容 + 常驻录音按钮。
场景通过外部按钮弹窗选择切换,录音按钮始终不销毁。
-->
<TabBarShell ref="shellRef"
:active-tab-index="0">
<TabBarShell :active-tab-index="0">
<view class="index-shell-page">
<view class="index-shell-scene-stretch">
<view class="tab-panel">
<RecordStart />
<view class="app-content-box">
<view class="right-content-box flex-row">
<BoutiqueHomePanel v-if="currentScene === 'boutique'" ref="boutiquePanelRef" :logic="boutiqueLogic" />
<EquityHomePanel v-else-if="currentScene === 'equity'" ref="equityPanelRef" />
<UsedCarHomePanel v-else-if="currentScene === 'usedcar'" />
<!-- 轻改 / 洗美 占位 -->
<view v-else class="scene-placeholder">
<un-empty mode="data" :text="placeholderText" />
</view>
</view>
</view>
<ScenePanelShell />
</view>
</view>
</view>
......@@ -28,58 +13,16 @@
</template>
<script setup lang="uts">
import { ref } from "vue";
import TabBarShell from "@/components/TabBar/TabBarShell.uvue";
import RecordStart from "./RecordStart.uvue";
import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvue";
import EquityHomePanel from "@/pages/equity/components/EquityHomePanel.uvue";
import UsedCarHomePanel from "@/pages/usedCar/components/UsedCarHomePanel.uvue";
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import ScenePanelShell from "./ScenePanelShell.uvue";
import { provideSceneContext } from "./sceneContext.uts";
import { storage } from "@/utils/storage.uts";
const shellRef = ref(null);
const boutiquePanelRef = ref(null);
const equityPanelRef = ref(null);
// ===== 场景选择 =====
type SceneId = string
class SceneItem {
id: SceneId = ""
label: string = ""
constructor(id: SceneId = "", label: string = "") {
this.id = id;
this.label = label;
}
}
const sceneList: SceneItem[] = [
{ id: "boutique", label: "精品" },
{ id: "equity", label: "权益" },
{ id: "usedcar", label: "二手车" },
{ id: "refit", label: "轻改" },
{ id: "wash", label: "洗美" },
];
const currentScene = ref<SceneId>("boutique");
const placeholderText = ref<string>("场景开发中,敬请期待");
function onSceneChange(id: SceneId): void {
if (id === currentScene.value) {
return;
}
currentScene.value = id;
}
// ===== 精品场景 logic =====
const boutiqueLogic: BoutiqueLogic = useBoutiqueLogic();
/** 当前场景 ID(默认精品,后续可从用户配置读取) */
provideSceneContext("boutique");
onShow(async () => {
// 用户/门店校验
const userInfo = storage.get("userInfo");
if (userInfo == null) {
storage.remove("userInfo");
......@@ -95,35 +38,10 @@ onShow(async () => {
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
// 精品场景初始化
if (currentScene.value === "boutique") {
await boutiqueLogic.initIfNeeded();
await boutiqueLogic.getBoutiquePackageList();
}
});
</script>
<style scoped lang="scss">
// ===== 应用内容区 (原 common.scss) =====
.app-content-box {
flex: 1;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
padding: var(--content-tabbar-gap, 12px);
}
.right-content-box {
flex: 1;
display: flex;
flex-direction: row;
margin-top: var(--l-spacing-md);
overflow: hidden;
}
.index-shell-page {
width: 100%;
height: 100%;
......@@ -166,13 +84,4 @@ onShow(async () => {
flex-direction: column;
position: relative;
}
/* ===== 场景占位 ===== */
.scene-placeholder {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
background-color: #f8fafc;
}
</style>
/**
* 场景调度 Context(Strategy 模式的上下文层)
*
* 角色分配:
* ScenePanelShell(Context)→ provide 当前场景 ID
* 各场景 panel(Strategy) → inject + useSceneActivation 自判激活
*
* 新增场景时:在 ScenePanelShell 注册 provide + 添加一行 panel 标签即可,
* 无需修改任何条件分支逻辑。
*/
import { computed, inject, provide, ref, type ComputedRef, type Ref } from "vue";
/** provide/inject 的 key */
export const SCENE_KEY = "__scene_current__";
export type SceneContext = {
currentScene: Ref<string>;
};
/** 被 ScenePanelShell 调用:向子树广播当前场景 ID */
export function provideSceneContext(initialScene: string): SceneContext {
const currentScene: Ref<string> = ref(initialScene);
provide(SCENE_KEY, currentScene);
return { currentScene };
}
/**
* 场景 panel 调用:判断本 panel 是否处于激活场景。
* 返回 ComputedRef,场景切换时模板 v-if 自动响应。
* 若无 SceneContext(独立使用场景)默认 true,兼容单场景独立运行。
*/
export function useSceneActivation(sceneId: string): ComputedRef<boolean> {
const ctx = inject<SceneContext | null>(SCENE_KEY, null);
if (ctx == null) {
return computed(() => true);
}
return computed(() => ctx.currentScene.value === sceneId);
}
......@@ -24,7 +24,8 @@
<CommonFunctions
@select-store="goSelectStore"
@attendance="goAttendance"
@setting="onSetting" />
@setting="onSetting"
@reception-entry="goReceptionCenter" />
</view>
</view>
......@@ -148,6 +149,10 @@ function goAttendance(): void {
uni.navigateTo({ url: "/pages/person/attendance" });
}
function goReceptionCenter(): void {
uni.navigateTo({ url: "/pages/receptionCenter/center" });
}
async function goSelectStore(): Promise<void> {
try {
uni.showLoading({ title: "加载中", mask: true });
......
<template>
<InfoSection title="常用功能" :border="false">
<un-cell title="接待记录"
icon="chat-fill"
isLink
clickable
@click="onReceptionEntry"
size="large" />
<un-cell title="选择门店"
icon="home-fill"
isLink
......@@ -27,6 +33,7 @@ const emit = defineEmits<{
selectStore: []
attendance: []
setting: []
receptionEntry: []
}>()
function onSelectStore(): void {
......@@ -40,4 +47,8 @@ function onAttendance(): void {
function onSetting(): void {
emit('setting')
}
function onReceptionEntry(): void {
emit('receptionEntry')
}
</script>
<template>
<TabBarShell ref="shellRef"
:active-tab-index="2">
:active-tab-index="1">
<!-- ✅ 修复空指针:骨架屏和真实内容同时渲染 -->
<PersonSkeleton v-if="!userInfoLoaded" />
<MyCenterMain @loaded="onMyCenterLoaded" />
......
<template>
<view :class="rootClass" :style="containerRootStyle">
<slot />
</view>
</template>
<script setup lang="uts">
import { computed } from 'vue'
/**
* 接待看板统一毛玻璃卡片容器:背景、描边、圆角、阴影与 flex 纵向布局。
* - plain:仅外壳,无默认内边距与底部间距(自行控制留白)
* - output:24px 内边距(产值、对比条等卡片)
* - funnel:同 output,并保留底部 10px 外边距(与列表间距一致)
*/
const props = withDefaults(
defineProps<{
variant?: 'plain' | 'output' | 'funnel'
/** 追加在根节点上的 class,空格分隔,便于业务侧扩展布局或覆盖 */
extraClass?: string
/** 分辨率适配等场景下覆盖 padding / 圆角 / 外边距(与 class 叠加,内联优先) */
rootStyle?: UTSJSONObject | null
}>(),
{
variant: 'output',
extraClass: '',
rootStyle: null
}
)
const containerRootStyle = computed((): UTSJSONObject => {
const s = props.rootStyle
if (s != null) {
return s
}
return {} as UTSJSONObject
})
const rootClass = computed((): string => {
let s = 'card-container'
if (props.variant == 'output' || props.variant == 'funnel') {
s += ' card-container--padded'
}
if (props.variant == 'funnel') {
s += ' card-container--funnel-gap'
}
if (props.extraClass != null && props.extraClass != '') {
s += ' ' + props.extraClass
}
return s
})
</script>
<style scoped lang="scss">
.card-container {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(255, 255, 255, 0.6);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
border-radius: 20px;
flex-direction: column;
}
.card-container--padded {
padding: 12px 8px 8px 8px;
}
.card-container--funnel-gap {
margin-bottom: var(--card-container--funnel-gap, 14px);
}
</style>
<template>
<card-container variant="funnel">
<view class="title-box">
<text class="title-text">接待记录情况</text>
</view>
<view class="funnel-container">
<view class="flow-layout">
<view class="funnel-main">
<view class="metric-card metric-card-primary">
<text class="metric-label">接待成交数</text>
<text class="metric-value">{{ funnelCountDisplay1 }}</text>
</view>
<view class="metric-card metric-card-secondary">
<text class="metric-label">接待战败数</text>
<text class="metric-value">{{ funnelCountDisplay2 }}</text>
</view>
</view>
<view class="rate-badge">
<text class="rate-caption">接待成交率</text>
<text class="rate-value">{{ contactRateMasked }}%</text>
</view>
</view>
</view>
</card-container>
</template>
<script setup lang="uts">
import { computed } from 'vue'
import CardContainer from './CardContainer.uvue'
/** 业绩看板聚合数据,与 center 中 performanceData 同源 */
const props = withDefaults(
defineProps<{
performanceData?: UTSJSONObject | null
/** 为 false 时隐藏客流数值 */
metricsVisible?: boolean
}>(),
{
performanceData: null,
metricsVisible: true
}
)
const performanceRef = computed((): UTSJSONObject => {
const pd = props.performanceData
return pd != null ? pd : ({} as UTSJSONObject)
})
function getNum(data: UTSJSONObject, key: string): number {
const v = data[key]
if (v == null) {
return 0
}
if (typeof v == 'number') {
return v
}
const n = parseFloat(`${v}`)
return isNaN(n) ? 0 : n
}
const cumulativeDeliveryCount = computed(() => getNum(performanceRef.value, 'cumulativeDeliveryCount'))
const actualContactCount = computed(() => getNum(performanceRef.value, 'actualContactCount'))
const funnelCountDisplay1 = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return `${cumulativeDeliveryCount.value}`
})
const funnelCountDisplay2 = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return `${actualContactCount.value}`
})
/** 触客率展示:接口可能返回 0.8(小数)或 80(百分比) */
const contactRateDisplay = computed(() => {
const v = getNum(performanceRef.value, 'contactRate')
if (v > 0 && v < 1) {
return (v * 100).toFixed(1)
}
return v.toFixed(1)
})
const contactRateMasked = computed((): string => {
if (props.metricsVisible == false) {
return '**'
}
return contactRateDisplay.value
})
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
.title-box {
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.title-text {
color: #333333;
font-size: var(--reception-dash-flow-title-font-size, 14px);
font-weight: 700;
}
.funnel-container {
background-color: var(--bg-card-hover, #F4F8FF);
border-radius: 16px;
padding: 8px;
margin-top: var(--reception-dash-flow-card-margin-top, 10px);
flex-direction: column;
overflow: hidden;
}
.flow-layout {
width: 100%;
min-height: 108px;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.funnel-main {
flex: 1;
min-height: 108px;
flex-direction: var(--reception-dash-flow-metric-layout-direction, column);
align-items: stretch;
justify-content: center;
padding-right: var(--reception-dash-flow-metric-to-rate-gap, 10px);
box-sizing: border-box;
}
.metric-card {
width: var(--reception-dash-flow-metric-card-width, 100%);
flex-grow: var(--reception-dash-flow-metric-card-flex-grow, 0);
flex-shrink: var(--reception-dash-flow-metric-card-flex-shrink, 0);
flex-basis: var(--reception-dash-flow-metric-card-flex-basis, auto);
min-height: var(--reception-dash-flow-metric-card-min-height, 48px);
border-radius: 12px;
background: rgba(255, 255, 255, 0.86);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 6px 14px rgba(37, 99, 235, 0.10);
padding: 8px 12px;
box-sizing: border-box;
flex-direction: column;
align-items: var(--reception-dash-flow-metric-text-align-items, flex-start);
justify-content: center;
}
.metric-card-primary {
margin-right: var(--reception-dash-flow-metric-card-primary-margin-right, 0px);
}
.metric-card-secondary {
margin-top: var(--reception-dash-flow-metric-card-secondary-margin-top, 8px);
background: rgba(255, 255, 255, 0.74);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
.metric-label {
font-size: var(--reception-dash-flow-metric-label-font-size, 11px);
color: #7b90ad;
line-height: var(--reception-dash-flow-metric-label-line-height, 14px);
width: 100%;
text-align: var(--reception-dash-flow-metric-text-align, left);
}
.metric-value {
margin-top: 3px;
font-size: var(--reception-dash-flow-metric-value-font-size, 19px);
font-weight: 700;
color: #1e40af;
line-height: var(--reception-dash-flow-metric-value-line-height, 22px);
width: 100%;
text-align: var(--reception-dash-flow-metric-text-align, left);
}
.rate-badge {
width: var(--reception-dash-flow-rate-badge-size, 94px);
height: var(--reception-dash-flow-rate-badge-size, 94px);
border-radius: var(--reception-dash-flow-rate-badge-radius, 47px);
background-color: var(--bg-card-hover, #EAF2FF);
border: 1px solid #cfe0ff;
box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
padding: 0 8px;
box-sizing: border-box;
flex-direction: column;
align-items: center;
justify-content: center;
}
.rate-caption {
font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
color: #5f7ea8;
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
}
.rate-value {
margin-top: 2px;
font-size: var(--reception-dash-flow-rate-value-font-size, 17px);
font-weight: 700;
color: #1d4ed8;
line-height: var(--reception-dash-flow-rate-value-line-height, 22px);
}
</style>
<template>
<card-container class="card-month-value">
<view class="title-box">
<text class="title-text">本月业绩</text>
</view>
<view class="output-summary">
<!-- 左侧数值 -->
<view class="summary-left">
<text class="summary-label">本月预估总产值</text>
<view class="summary-value-box">
<text class="summary-value-num">{{ summaryNumDisplay }}</text>
<text class="summary-value-unit">{{ summaryUnitDisplay }}</text>
</view>
<view class="summary-personal">
<text class="personal-label">个人产值占比:</text>
<text class="personal-value">{{ personalValueDisplay }}</text>
</view>
</view>
<!-- 右侧环形图 -->
<view class="summary-right">
<view class="ring-chart-wrap">
<!-- 底部灰色环 -->
<view class="ring-bg"></view>
<!-- 进度半圆 -->
<view v-if="ringProgressVisible" class="ring-progress-wrap">
<view class="ring-half ring-half-left">
<view class="ring-half-inner" :style="ringLeftStyle"></view>
</view>
<view class="ring-half ring-half-right">
<view class="ring-half-inner" :style="ringRightStyle"></view>
</view>
</view>
<!-- 中间文本 -->
<view class="ring-inner-text">
<text class="ring-value">{{ ringPercentDisplay }}</text>
<text class="ring-label">个人业绩占比</text>
</view>
</view>
</view>
</view>
<!-- 底部指标 -->
<view class="month-target-box">
<view class="target-item">
<text class="target-label">本月目标产值</text>
<text class="target-value">{{ targetValueDisplay }}</text>
</view>
<view class="target-item">
<text class="target-label">本月达成</text>
<text class="target-value">{{ achievementValueDisplay }}</text>
</view>
</view>
</card-container>
</template>
<script setup lang="uts">
import { computed } from 'vue'
import CardContainer from './CardContainer.uvue'
import type { OutputSummary } from '../types/reception-output-types.uts'
const props = withDefaults(
defineProps<{
summary: OutputSummary
targetValueText: string
achievementValueText: string
/** 为 false 时隐藏产值与达成相关数值 */
metricsVisible?: boolean
}>(),
{
targetValueText: '--',
achievementValueText: '--',
metricsVisible: true
}
)
/** 环形图用百分比:隐藏时不展示进度弧 */
const ringPercentNumForChart = computed((): number => {
if (props.metricsVisible == false) {
return 0
}
return props.summary.ringPercentNum
})
const summaryNumDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return props.summary.summaryValueNum
})
const summaryUnitDisplay = computed((): string => {
if (props.metricsVisible == false) {
return ''
}
return props.summary.summaryValueUnit
})
const personalValueDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return props.summary.personalValue
})
const ringPercentDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '**'
}
return props.summary.ringPercent
})
/** 有效数据且>0时才显示进度弧;0 或无数据仅展示浅色背景环 */
const ringProgressVisible = computed((): boolean => {
if (props.metricsVisible == false) {
return false
}
const p = ringPercentNumForChart.value
// 无数据常见占位:'--';隐藏态为 '**'
const text = ringPercentDisplay.value
const hasData = text != '--' && text != '**' && text != ''
return hasData && p > 0
})
const targetValueDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return props.targetValueText
})
const achievementValueDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '**'
}
return props.achievementValueText
})
// 左半圆旋转:0-50% 时旋转 P*360°,50-100% 时固定 180°
const ringLeftStyle = computed((): UTSJSONObject => {
const p = ringPercentNumForChart.value
const p01 = p > 100 ? 1 : (p < 0 ? 0 : p / 100)
const deg = p01 <= 0.5 ? p01 * 360 : 180
return { transform: `rotate(${deg}deg)` } as UTSJSONObject
})
// 右半圆旋转:>50% 时旋转 (P-0.5)*360°,形成连续弧
const ringRightStyle = computed((): UTSJSONObject => {
const p = ringPercentNumForChart.value
const p01 = p > 100 ? 1 : (p < 0 ? 0 : p / 100)
const deg = p01 > 0.5 ? (p01 - 0.5) * 360 : 0
return { transform: `rotate(${deg}deg)` } as UTSJSONObject
})
</script>
<style scoped lang="scss">
.card-month-value {
margin-bottom: 16px;
}
.title-box {
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.title-text {
color: #333333;
font-size: var(--reception-dash-month-title-font-size);
font-weight: 700;
}
.output-summary {
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-top: var(--reception-dash-month-output-summary-margin-top);
}
.summary-left {
flex-direction: column;
}
.summary-label {
font-size: var(--reception-dash-month-summary-label-font-size);
color: #64748b;
margin-bottom: var(--reception-dash-month-summary-label-margin-bottom);
}
.summary-value-box {
display: flex;
flex-direction: row;
align-items: flex-end;
}
.summary-value-num {
font-size: var(--reception-dash-month-summary-num-font-size);
font-weight: bold;
color: #1677ff;
}
.summary-value-unit {
font-size: var(--reception-dash-month-summary-unit-font-size);
color: #1677ff;
margin-left: var(--reception-dash-month-summary-unit-margin-left);
padding-bottom: var(--reception-dash-month-summary-unit-padding-bottom);
}
.summary-personal {
flex-direction: row;
margin-top: var(--reception-dash-month-personal-margin-top);
background-color: rgba(22, 119, 255, 0.05);
padding: var(--reception-dash-month-personal-padding);
border-radius: var(--reception-dash-month-personal-radius);
}
.personal-label {
font-size: var(--reception-dash-month-personal-label-font-size);
color: #64748b;
}
.personal-value {
font-size: var(--reception-dash-month-personal-value-font-size);
font-weight: 700;
color: #1677ff;
margin-left: 4px;
}
.summary-right {
position: relative;
flex-direction: column;
align-items: center;
}
.ring-chart-wrap {
position: relative;
width: var(--reception-dash-month-ring-size);
height: var(--reception-dash-month-ring-size);
}
.ring-bg {
position: absolute;
left: 0;
top: 0;
width: var(--reception-dash-month-ring-size);
height: var(--reception-dash-month-ring-size);
border-radius: var(--reception-dash-month-ring-radius);
border-width: var(--reception-dash-month-ring-border-width);
border-style: solid;
border-color: rgba(22, 119, 255, 0.08);
box-sizing: border-box;
}
.ring-progress-wrap {
position: absolute;
left: 0;
top: 0;
width: var(--reception-dash-month-ring-size);
height: var(--reception-dash-month-ring-size);
}
.ring-half {
position: absolute;
top: 0;
width: var(--reception-dash-month-ring-half-size);
height: var(--reception-dash-month-ring-size);
overflow: hidden;
}
.ring-half-left {
left: 0;
}
.ring-half-right {
left: var(--reception-dash-month-ring-half-right-left);
}
.ring-half-inner {
position: absolute;
width: var(--reception-dash-month-ring-size);
height: var(--reception-dash-month-ring-size);
border-radius: var(--reception-dash-month-ring-radius);
border-width: var(--reception-dash-month-ring-border-width);
border-style: solid;
border-color: #1677ff;
box-sizing: border-box;
transform-origin: var(--reception-dash-month-ring-transform-origin);
}
.ring-half-left .ring-half-inner {
left: 0;
border-right-color: transparent;
border-bottom-color: transparent;
}
.ring-half-right .ring-half-inner {
left: var(--reception-dash-month-ring-half-inner-right-left);
border-left-color: transparent;
border-bottom-color: transparent;
}
.ring-inner-text {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
flex-direction: column;
align-items: center;
justify-content: center;
}
.ring-value {
font-size: var(--reception-dash-month-ring-value-font-size);
font-weight: bold;
color: #1e293b;
}
.ring-label {
font-size: var(--reception-dash-month-ring-label-font-size);
color: #64748b;
margin-top: var(--reception-dash-month-ring-label-margin-top);
}
.month-target-box {
flex-direction: row;
justify-content: space-between;
padding-top: var(--reception-dash-month-target-padding-top);
}
.target-item {
flex-direction: column;
}
.target-label {
font-size: var(--reception-dash-month-target-label-font-size);
color: #64748b;
}
.target-value {
font-size: var(--reception-dash-month-target-value-font-size);
font-weight: 700;
color: #1e293b;
margin-top: var(--reception-dash-month-target-value-margin-top);
}
</style>
<template>
<card-container class="reception-dash-output-card">
<view class="tabs-box">
<un-segmented
shape="circle"
type="card"
:font-size="'var(--reception-dash-segmented-font-size)'"
:custom-style="{ height: 'var(--reception-dash-segmented-height)' }"
:model-value="tabIndex"
active-color="#000000"
@update:model-value="onSegmentedTabIndex"
>
<un-segmented-item text="本月交付转化率"></un-segmented-item>
<un-segmented-item text="本月交付客单价"></un-segmented-item>
</un-segmented>
</view>
<view class="compare-section">
<view
v-for="(row, idx) in compareRows"
:key="idx"
class="compare-row"
:class="{ 'compare-row-last': idx == compareRows.length - 1 }"
>
<text class="compare-label">{{ row.label }}</text>
<view class="compare-bar-bg">
<view
class="compare-bar-fill"
:class="row.barClass"
:style="compareBarFillStyle(row)"
></view>
</view>
<text class="compare-value">{{ metricsVisible ? row.value : '****' }}</text>
</view>
</view>
</card-container>
</template>
<script setup lang="uts">
import CardContainer from './CardContainer.uvue'
import type { CompareRow } from '../types/reception-output-types.uts'
const props = withDefaults(
defineProps<{
/** 0=本月交付转化率,1=本月交付客单价 */
tabIndex: number
compareRows: CompareRow[]
/** 为 false 时隐藏对比数值 */
metricsVisible?: boolean
}>(),
{
tabIndex: 0,
compareRows: (): CompareRow[] => [],
metricsVisible: true
}
)
const emit = defineEmits<{
'update:tabIndex': [value: number]
}>()
/** UTS 下勿用 computed({ get, set }) 做 v-model 桥接,运行时会 ClassCastException */
const onSegmentedTabIndex = (v: number): void => {
emit('update:tabIndex', v)
}
function compareBarFillStyle(row: CompareRow): UTSJSONObject {
return {
width: row.barWidthPercent,
height: 'var(--reception-dash-compare-bar-height)',
borderRadius: 'var(--reception-dash-compare-bar-border-radius)'
} as UTSJSONObject
}
</script>
<style scoped lang="scss">
.reception-dash-output-card {
padding: var(--reception-dash-card-padding);
border-radius: var(--reception-dash-card-border-radius);
box-shadow: var(--reception-dash-card-box-shadow);
}
.tabs-box {
flex-direction: row;
justify-content: space-between;
margin-bottom: var(--reception-dash-output-tabs-margin-bottom);
}
.compare-section {
flex-direction: column;
}
.compare-row {
flex-direction: row;
align-items: center;
margin-bottom: var(--reception-dash-compare-row-margin-bottom);
}
.compare-row-last {
margin-bottom: 0;
}
.compare-label {
font-size: var(--reception-dash-compare-label-font-size);
color: #64748b;
width: var(--reception-dash-compare-label-width);
}
.compare-bar-bg {
flex: 1;
height: var(--reception-dash-compare-bar-height);
background-color: rgba(22, 119, 255, 0.08);
border-radius: var(--reception-dash-compare-bar-border-radius);
margin-right: var(--reception-dash-compare-bar-bg-margin-right);
overflow: hidden;
flex-direction: row;
}
.compare-bar-fill {
height: 100%;
border-radius: var(--reception-dash-compare-bar-border-radius);
}
.bg-blue-500 {
background-color: #1677ff;
}
.bg-blue-400 {
background-color: #60a5fa;
}
.compare-value {
font-size: var(--reception-dash-compare-value-font-size);
font-weight: 700;
color: #1e293b;
width: var(--reception-dash-compare-value-width);
text-align: right;
}
</style>
<template>
<card-container variant="funnel">
<view class="title-row">
<text class="title-text">接待时效统计</text>
<view class="pill" :class="metricsVisible ? 'pill--on' : 'pill--off'">
<text class="pill-text">{{ metricsVisible ? '实时' : '隐藏' }}</text>
</view>
</view>
<view class="surface">
<view class="kpi-grid">
<view class="kpi-item kpi-item--primary">
<text class="kpi-label">今日接待</text>
<view class="kpi-value-row">
<text class="kpi-value">{{ metricsVisible ? `${todayReceptionCount}` : '****' }}</text>
<text class="kpi-unit">单</text>
</view>
</view>
<view class="kpi-item">
<text class="kpi-label">待跟进</text>
<view class="kpi-value-row">
<text class="kpi-value kpi-value--dark">{{ metricsVisible ? `${todayFollowUpCount}` : '****' }}</text>
<text class="kpi-unit">条</text>
</view>
</view>
<view class="kpi-item">
<text class="kpi-label">平均耗时</text>
<view class="kpi-value-row">
<text class="kpi-value kpi-value--dark">{{ metricsVisible ? `${avgMinutes}` : '**' }}</text>
<text class="kpi-unit">分钟</text>
</view>
</view>
<view class="kpi-item">
<text class="kpi-label">接待总时长</text>
<view class="kpi-value-row">
<text class="kpi-value kpi-value--dark">{{ metricsVisible ? peakHour : '**:**' }}</text>
</view>
</view>
</view>
<view class="divider"></view>
<view class="trend-row">
<view class="trend-meta">
<text class="trend-title">近 7 日接待趋势</text>
<text class="trend-sub">{{ metricsVisible ? `${weekTotal}` : '***' }}<text class="trend-sub-unit"> 单</text></text>
</view>
<view class="trend-bars">
<view
v-for="(h, i) in barHeights"
:key="i"
class="bar"
:class="i == barHeights.length - 1 ? 'bar--active' : ''"
:style="{ height: `${h}px` }"
></view>
</view>
</view>
</view>
</card-container>
</template>
<script setup lang="uts">
import { computed } from 'vue'
import CardContainer from './CardContainer.uvue'
const props = withDefaults(
defineProps<{
data?: UTSJSONObject | null
metricsVisible?: boolean
}>(),
{
data: null,
metricsVisible: true
}
)
const metricsVisible = computed((): boolean => props.metricsVisible != false)
const dataRef = computed((): UTSJSONObject => {
const d = props.data
return d != null ? d : ({} as UTSJSONObject)
})
function getNum(data: UTSJSONObject, key: string): number {
const v = data[key]
if (v == null) {
return 0
}
if (typeof v == 'number') {
return v
}
const n = parseFloat(`${v}`)
return isNaN(n) ? 0 : n
}
function getStr(data: UTSJSONObject, key: string): string {
const v = data[key]
if (v == null) {
return ''
}
return `${v}`
}
const todayReceptionCount = computed((): number => getNum(dataRef.value, 'todayReceptionCount'))
const todayFollowUpCount = computed((): number => getNum(dataRef.value, 'todayFollowUpCount'))
const avgMinutes = computed((): number => {
const v = getNum(dataRef.value, 'avgMinutes')
const r = Math.round(v)
return r < 0 ? 0 : r
})
const peakHour = computed((): string => {
const s = getStr(dataRef.value, 'peakHour')
return s != '' ? s : '14:00'
})
const weekTrend = computed((): number[] => {
const v = dataRef.value['weekTrend']
if (v == null || (Array.isArray(v)) != true) {
return [12, 18, 15, 22, 16, 19, 24]
}
const arr = v as Array<any>
const out: number[] = []
const n = arr.length
const take = n > 7 ? 7 : n
for (let i = 0; i < take; i++) {
const x = arr[i]
const num = typeof x == 'number' ? x : parseFloat(`${x}`)
out.push(isNaN(num) ? 0 : num)
}
while (out.length < 7) {
out.push(0)
}
return out
})
const weekTotal = computed((): number => {
const t = weekTrend.value
let sum = 0
for (let i = 0; i < t.length; i++) {
sum += t[i]
}
return sum
})
const barHeights = computed((): number[] => {
if (metricsVisible.value == false) {
return [10, 10, 10, 10, 10, 10, 10]
}
const t = weekTrend.value
let max = 0
for (let i = 0; i < t.length; i++) {
if (t[i] > max) {
max = t[i]
}
}
const base = 12
const top = 56
const span = top - base
const out: number[] = []
for (let i = 0; i < t.length; i++) {
const v = t[i]
const ratio = max > 0 ? (v / max) : 0
const h = base + Math.round(span * ratio)
out.push(h)
}
return out
})
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
.title-row {
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.title-text {
color: #333333;
font-size: var(--reception-dash-flow-title-font-size, 14px);
font-weight: 700;
}
.pill {
height: 24px;
padding: 0 10px;
border-radius: 999px;
flex-direction: row;
align-items: center;
justify-content: center;
border: 1px solid rgba(203, 213, 225, 0.9);
background-color: rgba(248, 250, 252, 0.92);
}
.pill--on {
border-color: rgba(59, 130, 246, 0.25);
background-color: rgba(239, 246, 255, 0.92);
}
.pill--off {
border-color: rgba(148, 163, 184, 0.35);
background-color: rgba(241, 245, 249, 0.92);
}
.pill-text {
font-size: var(--reception-dash-flow-metric-label-font-size, 11px);
line-height: var(--reception-dash-flow-metric-label-line-height, 14px);
color: #475569;
font-weight: 600;
}
.surface {
background-color: var(--bg-card-hover, #F4F8FF);
border-radius: 16px;
padding: 8px;
margin-top: var(--reception-dash-flow-card-margin-top, 10px);
flex-direction: column;
overflow: hidden;
}
.kpi-grid {
width: 100%;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.kpi-item {
width: 48.5%;
min-height: 56px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.84);
border: 1px solid rgba(255, 255, 255, 0.75);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 6px 14px rgba(37, 99, 235, 0.08);
padding: var(--reception-dash-flow-kpi-padding, 10px);
box-sizing: border-box;
flex-direction: column;
justify-content: center;
margin-bottom: var(--reception-dash-flow-kpi-margin-bottom, 10px);
}
.kpi-item--primary {
background-color: var(--bg-card, #E1EFFF);
border-color: rgba(59, 130, 246, 0.20);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 10px 18px rgba(37, 99, 235, 0.12);
}
.kpi-label {
font-size: var(--reception-dash-flow-metric-label-font-size, 11px);
color: #6b86a6;
line-height: var(--reception-dash-flow-metric-label-line-height, 14px);
}
.kpi-value-row {
margin-top: 4px;
flex-direction: row;
align-items: center; // ✅ UVUE 不支持 baseline,改用 center
}
.kpi-value {
font-size: var(--reception-dash-flow-metric-value-font-size, 19px);
font-weight: 700; // ✅ UVUE 不支持 800,改为 700 (bold)
color: #1d4ed8;
line-height: var(--reception-dash-flow-metric-value-line-height, 22px);
}
.kpi-value--dark {
color: #0f172a;
}
.kpi-unit {
margin-left: 6px;
font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
color: #64748b;
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
font-weight: 600;
}
.divider {
height: 1px;
width: 100%;
background-color: rgba(148, 163, 184, 0.22);
margin: 4px 0;
}
.trend-row {
flex-direction: row;
align-items: flex-end;
justify-content: space-between;
}
.trend-meta {
flex: 1;
padding-right: 10px;
box-sizing: border-box;
flex-direction: column;
justify-content: flex-end;
}
.trend-title {
font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
color: #6b86a6;
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
}
.trend-sub {
margin-top: 4px;
font-size: var(--reception-dash-flow-rate-value-font-size, 17px);
font-weight: 700; // ✅ UVUE 不支持 800,改为 700 (bold)
color: #0f172a;
line-height: var(--reception-dash-flow-rate-value-line-height, 22px);
}
.trend-sub-unit {
font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
color: #64748b;
font-weight: 600;
}
.trend-bars {
width: 132px;
height: var(--reception-dash-timeboard-trend-bars-height, 64px);
flex-direction: row;
align-items: flex-end;
justify-content: space-between;
}
.bar {
width: 14px;
border-radius: 10px;
background-color: rgba(148, 163, 184, 0.55);
}
.bar--active {
background-color: rgba(59, 130, 246, 0.96);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
}
</style>
<template>
<view class="line-bar-box">
<view class="tabs-header">
<page-tabs
:list="tabList"
@changeTab="changeTab"
size="small"
/>
</view>
<view class="chart-wrap">
<l-echart ref="chartRef" @finished="initChart" />
</view>
</view>
</template>
<script setup lang="uts">
import { ref, computed, watch, nextTick } from "vue";
import PageTabs from "@/components/PageTabs.uvue";
/** 接待中心 - 柱状图组件入参,透传页面数据与业务场景 */
const props = withDefaults(
defineProps<{
/** 是否展示业绩数据,受左侧「小眼睛」开关控制 */
dataShow?: boolean
/** 页面聚合数据(含门店/个人产值等),由父级 ReceptionCenter 提供 */
pageData?: UTSJSONObject | null
/** 业务场景类型:0-延保 1-轻改 等 */
sceneType?: number | null
/** 是否鸿蒙端,预留用于端能力差异处理 */
isHarmony?: boolean
/** 业务类型:1-延保 2-轻改 */
bussinessType?: number | null
}>(),
{
dataShow: true,
pageData: null,
sceneType: 1,
isHarmony: false,
bussinessType: null
}
);
type ChartMetricItem = { label: string; value: number; raw: string }
const chartRef = ref<LEchartComponentPublicInstance | null>(null)
/** 当前选中的 Tab 索引:0-成交率 1-客单价/成交数 */
const tabIndex = ref(0);
/** Tab 文案列表,会根据 sceneType / isHarmony / bussinessType 动态切换 */
const tabList = ref<string[]>(['本月交付成交率', '本月交付客单价']);
/** 当前柱状图原始数据(排序后):value 为数值,raw 为展示文案(如 85% / ¥28370 / --) */
const chartData = ref<ChartMetricItem[]>([]);
/** 成交率指标 key 与展示名称(与老项目保持一致) */
const rateKeys: string[] = ['excellentStoreAvgDealRate', 'thisStoreDealRate', 'personalDealRate'];
const rateLabels: string[] = ['优秀门店均值', '本门店', '个人'];
/** 客单价/成交数指标 key 与展示名称(与老项目保持一致) */
const priceKeys: string[] = ['excellentStoreAvgDeal', 'thisStoreKdj', 'personalKdj'];
const priceLabels: string[] = ['优秀门店均值', '本门店', '个人'];
/** pageData 计算属性:确保非空对象,便于后续访问 */
const pageDataRef = computed((): UTSJSONObject => {
const pd = props.pageData;
return pd != null ? pd : ({} as UTSJSONObject);
});
/** 将指标数值转换为柱状图长度,保证为 number */
function valueToBarLength(v: number): number {
if (v == null) {
return 0;
}
return v;
}
/** 获取指标数值,失败时返回 null */
function getMetricNumber(pd: UTSJSONObject, key: string): number | null {
const val = pd[key];
if (val == null || val == "") {
return null;
}
const num = parseFloat("" + val);
if (isNaN(num)) {
return null;
}
return num;
}
/** 按业务规则计算当前 Tab 下的 chartData:排序 + 文案填充 + 隐藏逻辑 */
function rebuildChartData(): void {
const pd = pageDataRef.value;
const metrics: ChartMetricItem[] = [];
const isRateTab = tabIndex.value == 0;
const keys = isRateTab ? rateKeys : priceKeys;
const labels = isRateTab ? rateLabels : priceLabels;
let i = 0;
while (i < keys.length) {
const key = keys[i];
const label = labels[i];
const numOrNull = getMetricNumber(pd, key);
const isNull = numOrNull == null;
const value = isNull ? 0 : (numOrNull as number);
let rawText = "--";
if (props.dataShow && !isNull) {
if (isRateTab) {
rawText = "" + value + "%";
} else {
// 轻改场景下,客单价 Tab 需要加 ¥ 前缀
if (props.sceneType == 1 && tabIndex.value == 1) {
rawText = "¥" + value;
} else {
rawText = "" + value;
}
}
}
metrics.push({
label,
value,
raw: rawText
} as ChartMetricItem);
i++;
}
// 根据数值从大到小排序(UTS 不支持自定义 comparator,使用手写排序)
const n = metrics.length;
let x = 0;
while (x < n - 1) {
let y = x + 1;
while (y < n) {
if (metrics[y].value > metrics[x].value) {
const tmp = metrics[x];
metrics[x] = metrics[y];
metrics[y] = tmp;
}
y++;
}
x++;
}
chartData.value = metrics;
}
/** 根据场景类型/业务类型/鸿蒙端动态设置 Tab 标题(对齐老项目逻辑)
* (sceneType 0: 2.1场景,1:1.1场景) (bussinessType 1:延保,3:权益)
* 2.1场景 鸿蒙 --- 问界/鸿蒙 [本月交付客单价] 改成 [整车延保成交数]
* 2.1场景 非鸿蒙 --- 选延保 [本月交付客单价] 改成 [整车延保成交数]
* 2.1场景 非鸿蒙 --- 权益 [本月交付成交率] 改为 [广联权益渗透率]; [本月交付客单价] 改成 [广联权益成交数]
*/
function rebuildTabList(): void {
let list: string[] = ['本月交付成交率', '本月交付客单价'];
const sceneType = props.sceneType;
const bussinessType = props.bussinessType;
const isHarmony = props.isHarmony == true;
if (sceneType != null && sceneType == 0) {
if (isHarmony) {
list[1] = '整车延保成交数';
} else {
if (bussinessType != null && bussinessType == 1) {
list[1] = '整车延保成交数';
} else if (bussinessType != null && bussinessType == 3) {
list = ['广联权益渗透率', '广联权益成交数'];
}
}
}
tabList.value = list;
}
/** 构建柱状图配置(APP 端 option 经 JSON 序列化传递,不支持 formatter 函数) */
function buildChartOption(): UTSJSONObject {
const data = chartData.value
const labels: string[] = []
let i = data.length - 1
while (i >= 0) {
labels.push(data[i].label)
i--
}
const gradients: UTSJSONObject[] = [
{ type: 'linear', x: 0, y: 0, x2: 1, y2: 0, colorStops: [{ offset: 0, color: '#389fff' }, { offset: 1, color: '#2c66f7' }] },
{ type: 'linear', x: 0, y: 0, x2: 1, y2: 0, colorStops: [{ offset: 0, color: '#708dff' }, { offset: 1, color: '#6858f5' }] },
{ type: 'linear', x: 0, y: 0, x2: 1, y2: 0, colorStops: [{ offset: 0, color: '#94cbff' }, { offset: 1, color: '#3283fb' }] }
]
const dataItems: UTSJSONObject[] = []
let j = data.length - 1
while (j >= 0) {
const it = data[j]
const grad = gradients[j] as UTSJSONObject
dataItems.push({
value: valueToBarLength(it.value),
raw: it.raw,
itemStyle: {
color: grad
}
} as UTSJSONObject)
j--
}
return {
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
confine: true,
formatter: '{b}: {@raw}'
},
grid: {
left: -4,
right: 85,
top: 12,
bottom: 12,
containLabel: true
},
xAxis: {
show: false,
type: 'value',
min: 0,
splitLine: { show: false }
},
yAxis: {
type: 'category',
axisTick: { show: false },
data: labels,
axisLine: { lineStyle: { width: 1, color: '#CFD4E3' } },
axisLabel: { color: '#333333', fontSize: 12, fontWeight: 400 }
},
series: [
{
name: '产值',
type: 'bar',
barWidth: 6,
data: dataItems,
label: {
show: props.dataShow,
position: 'right',
formatter: '{@raw}',
color: '#333333',
fontSize: 14,
fontWeight: 500
}
}
]
} as UTSJSONObject
}
/** 根据最新 props/pageData 重建图表并刷新 ECharts */
function refreshChart(): void {
rebuildTabList();
rebuildChartData();
const comp = chartRef.value;
if (comp != null) {
comp.setOption(buildChartOption());
}
}
/** Tab 切换回调 */
function changeTab(index: number): void {
tabIndex.value = index;
refreshChart();
}
const initChart = async (): Promise<void> => {
const comp = chartRef.value
if (comp == null) {
return
}
try {
await comp.init(null)
// 初始化时根据 props 构建实际业务数据
refreshChart();
} catch (e) {
console.error('LineBar 图表初始化失败:', e)
}
}
// 监听数据与业务场景变化,实时刷新图表
watch(
pageDataRef,
() => {
nextTick(() => {
refreshChart();
});
},
{ deep: true }
);
const dataShowRef = computed((): boolean => {
// ✅ UTS 避免 Boolean === true 比较
const val = props.dataShow;
return val != null && val;
});
const sceneTypeRef = computed((): number => {
const v = props.sceneType;
return v != null ? (v as number) : 0;
});
const bussinessTypeRef = computed((): number => {
const v = props.bussinessType;
return v != null ? (v as number) : 0;
});
const isHarmonyRef = computed((): boolean => {
// ✅ UTS 避免 Boolean === true 比较
const val = props.isHarmony;
return val != null && val;
});
watch(
dataShowRef,
() => {
nextTick(() => {
refreshChart();
});
}
);
watch(
sceneTypeRef,
() => {
nextTick(() => {
refreshChart();
});
}
);
watch(
bussinessTypeRef,
() => {
nextTick(() => {
refreshChart();
});
}
);
watch(
isHarmonyRef,
() => {
nextTick(() => {
refreshChart();
});
}
);
</script>
<style scoped lang="scss">
/* 基准 194px,随父级 flex 比例自适应;子绝父相定位参照 */
.line-bar-box {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
height: 100%;
min-height: 0;
box-sizing: border-box;
padding: 12px 14px;
background: #ffffff;
border-radius: 16px;
}
/* Tab 区域:顶部居中 */
.tabs-header {
width: 100%;
height: 32px;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-bottom: 8px;
}
/* 子绝父相:图表相对于 line-bar-box 靠左下定位 */
.chart-wrap {
position: absolute;
left: 14px;
bottom: 12px;
width: 268px;
height: 101px;
box-sizing: border-box;
}
</style>
......@@ -89,7 +89,6 @@ const onSwitchSubmittedResult = (event: any) => {
</script>
<style scoped lang="scss">
@import "../styles/reception-filter-shared.scss";
.reception-filters {
display: flex;
......
<template>
<view
v-if="false"
class="rcf-half"
>
<view class="filter-tabs-row entry-filter-segmented-wrap">
<un-segmented
type="card"
bg-color="rgba(241, 245, 249, 0.5)"
:font-size="'var(--reception-list-filters-segmented-font-size, 14px)'"
:custom-style="{ height: 'var(--reception-list-filters-segmented-height, 40px)' }"
active-color="#000000"
:model-value="entryFilterIndex"
@update:model-value="emit('switchEntryFilterTab', $event)"
>
<un-segmented-item text="今日到店"></un-segmented-item>
<un-segmented-item text="全部客户"></un-segmented-item>
</un-segmented>
</view>
</view>
<view
v-if="listSubTabIndex == 0"
class="rcf-half"
>
<view class="filter-tabs-row entry-filter-segmented-wrap">
<un-segmented
type="card"
:font-size="'var(--reception-list-filters-segmented-font-size, 14px)'"
:custom-style="{ height: 'var(--reception-list-filters-segmented-height, 40px)' }"
bg-color="#f1f5f9"
active-color="#000000"
:model-value="filterTabIndex"
@update:model-value="emit('switchFilterTab', $event)"
>
<un-segmented-item text="已提交"></un-segmented-item>
<un-segmented-item text="未提交"></un-segmented-item>
</un-segmented>
</view>
</view>
<view v-if="false" class="filter-actions">
<view class="pre-entry-btn" @click="emit('customerEntryClick')">
<view class="pre-entry-btn-icon-wrap">
<un-icon name="plus" color="#64748b" :size="preEntryIconSize"></un-icon>
</view>
<text class="pre-entry-btn-text">预录信息</text>
</view>
</view>
</template>
<script setup lang="uts">
import { computed, type Ref } from 'vue'
import { useScreenVars } from '@/services/adapter/hooks/index.uts'
import pageVars from '../styles/index.vars.uts'
const props = defineProps<{
listSubTabIndex: number
entryFilterIndex: number
filterTabIndex: number
}>()
const emit = defineEmits<{
switchEntryFilterTab: [number]
switchFilterTab: [number]
customerEntryClick: []
}>()
// 使用 index.vars.uts + common.scss 约定的 CSS 变量体系做自适应(方向/分辨率由 useScreenVars 内部决定)
const pageStyleVars = useScreenVars(pageVars as UTSJSONObject)
// const pageStyleVars = computed((): Any => {
// const sv = screenVarsHook.screenVars as Ref<UTSJSONObject>
// return sv.value as Any
// })
const preEntryIconSize = computed((): number => {
const v = (pageStyleVars.value as UTSJSONObject)['--reception-list-filters-pre-entry-icon-size'] as string | null
if (v == null || v == '') {
return 11
}
const n = parseInt(v.replace('px', ''), 10)
return isNaN(n) ? 11 : n
})
</script>
<style scoped lang="scss">
@import "../styles/reception-filter-shared.scss";
.pre-entry-btn {
height: var(--reception-list-filters-pre-entry-btn-height, 40px);
padding-left: 14px;
padding-right: 14px;
border-radius: 8px;
background-color: #ffffff;
border: 1px solid #dbe3ee;
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
min-width: 96px;
}
.pre-entry-btn-landscape {
height: 30px;
padding-left: 10px;
padding-right: 10px;
border-radius: 8px;
background-color: #ffffff;
border: 1px solid #dbe3ee;
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
min-width: 76px;
}
.pre-entry-btn-icon-wrap {
width: 16px;
height: 16px;
border-radius: 999px;
background-color: #f1f5f9;
border: 1px solid #dbe3ee;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
/* 勿用 line-height: 1:中文 ascend 常超出该行盒,原生端易裁掉上半截 */
.pre-entry-btn-text {
margin-left: 6px;
color: #475569;
font-size: var(--reception-list-filters-pre-entry-btn-text-font-size, 13px);
font-weight: 600;
line-height: var(--reception-list-filters-pre-entry-btn-text-line-height, 1.35);
}
.pre-entry-btn .pre-entry-btn-text {
color: #475569;
}
</style>
<template>
<view class="filter-actions filter-actions--review" v-if="listSubTabIndex == 0">
<view
v-if="false"
class="rcf-review-card review-tabs-wrap-wide"
>
<view class="filter-tabs-row entry-filter-segmented-wrap filter-dropdown-row">
<view
class="tag-box tag-box--filter"
@click="emit('openSubmittedResultPicker')"
>
<text class="tag-text">{{ submittedResultLabel }}</text>
<image class="tag-arrow-icon" src="/static/images/reception/icon-select-arrow.png" mode="aspectFit" />
</view>
</view>
</view>
<view
v-if="false"
class="rcf-review-card review-tabs-wrap-wide"
>
<view class="filter-tabs-row entry-filter-segmented-wrap filter-dropdown-row">
<view class="tag-box tag-box--filter" @click="emit('openReviewPicker')">
<text class="tag-text">{{ reviewTabLabel }}</text>
<image class="tag-arrow-icon" src="/static/images/reception/icon-select-arrow.png" mode="aspectFit" />
</view>
</view>
</view>
<view
v-if="filterTabIndex == 1"
class="rcf-review-half review-tabs-wrap-wide"
>
<view class="filter-tabs-row entry-filter-segmented-wrap">
<un-segmented
type="card"
:font-size="'var(--reception-list-filters-segmented-font-size, 14px)'"
:custom-style="{ height: 'var(--reception-list-filters-segmented-height, 40px)' }"
bg-color="#f1f5f9"
active-color="#000000"
:model-value="unsubmittedPendingTabIndex"
@update:model-value="emit('switchUnsubmittedPendingTab', $event)"
>
<un-segmented-item text="待上传"></un-segmented-item>
<un-segmented-item text="待提交"></un-segmented-item>
</un-segmented>
</view>
</view>
<view
v-if="filterTabIndex == 0"
class="rcf-review-half review-tabs-wrap-wide"
>
<view class="filter-tabs-row entry-filter-segmented-wrap">
<un-segmented
type="card"
:font-size="'var(--reception-list-filters-segmented-font-size, 14px)'"
:custom-style="{ height: 'var(--reception-list-filters-segmented-height, 40px)' }"
bg-color="#f1f5f9"
active-color="#000000"
:model-value="submittedResultTabIndex"
@update:model-value="onSwitchSubmittedResult($event)"
>
<un-segmented-item text="战败"></un-segmented-item>
<un-segmented-item text="成交"></un-segmented-item>
</un-segmented>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from 'vue'
const props = withDefaults(defineProps<{
listSubTabIndex: number
filterTabIndex: number
submittedResultTabIndex: number
reviewTabIndex: number
unsubmittedPendingTabIndex: number
}>(), {
listSubTabIndex: 0,
filterTabIndex: 0,
submittedResultTabIndex: 0,
reviewTabIndex: 0,
unsubmittedPendingTabIndex: 0
})
const emit = defineEmits<{
openSubmittedResultPicker: []
openReviewPicker: []
switchSubmittedResultTab: [number]
switchUnsubmittedPendingTab: [number]
}>()
const submittedResultLabel = computed((): string => {
return props.submittedResultTabIndex == 0 ? '战败' : '成交'
})
const reviewTabLabel = computed((): string => {
return props.reviewTabIndex == 0 ? '未复盘' : '已复盘'
})
const onSwitchSubmittedResult = (event: any) => {
const tabIndex: number = event as number
emit('switchSubmittedResultTab', tabIndex)
}
</script>
<style scoped lang="scss">
@import "../styles/reception-filter-shared.scss";
.filter-actions.filter-actions--review {
flex: 2 1 0;
min-width: 0;
margin-left: 8px;
}
.filter-actions--review .review-tabs-wrap {
flex: 1 1 0;
min-width: 0;
background: #f3f7fd;
border: 1px solid #e2e8f0;
border-radius: 10px;
padding: 2px;
box-sizing: border-box;
}
// ✅ UVUE 不支持 :not(:first-child) 选择器,改用统一的 margin
.filter-actions--review .review-tabs-wrap:not(:first-child) {
// margin-left: 6px; // UVUE 不支持伪类组合选择器
}
.filter-dropdown-row {
align-items: stretch;
width: 100%;
height: 100%;
}
.filter-tabs-row.entry-filter-segmented-wrap {
height: var(--reception-list-filters-tabs-row-height, 40px);
min-height: var(--reception-list-filters-tabs-row-height, 40px);
}
.tag-box {
background-color: rgba(255, 255, 255, 0.5);
padding: 4px 12px;
border-radius: 999px;
flex-direction: row;
align-items: center;
}
.tag-box--filter {
flex: 1;
width: 100%;
height: 100%;
min-height: var(--reception-list-filters-review-tag-min-height, 42px);
padding: 0 14px;
justify-content: space-between;
border-radius: 10px;
background-color: var(--bg-card, #FFFFFF);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 1px 3px rgba(30, 41, 59, 0.06), inset 0 1px 0 #ffffff;
box-sizing: border-box;
}
.tag-text {
font-size: 12px;
color: #333333;
}
.tag-box--filter .tag-text {
font-size: var(--reception-list-filters-review-tag-text-font-size, 13px);
font-weight: 700;
color: #334155;
}
.tag-arrow-icon {
width: 18px;
height: 18px;
margin-left: 4px;
}
.tag-box--filter .tag-arrow-icon {
width: var(--reception-list-filters-review-tag-arrow-size, 14px);
height: var(--reception-list-filters-review-tag-arrow-size, 14px);
margin-left: 6px;
opacity: 0.8;
}
</style>
<template>
<!-- ✅ 客户列表项骨架屏:移除根容器,让卡片直接成为父容器的子元素 -->
<block v-for="i in props.cardCount" :key="'entry-skeleton-' + i">
<view class="list-card list-card-entry glass-card">
<!-- ✅ 使用 uview-unix 的 un-skeleton 组件 -->
<un-skeleton
:loading="true"
:animate="true"
:title="true"
titleWidth="80%"
titleHeight="18px"
:rows="3"
rowsWidth="90%,75%,60%"
rowsHeight="14px,14px,14px"
:avatar="true"
avatarSize="48px"
avatarShape="circle" />
</view>
</block>
</template>
<script setup lang="uts">
const props = defineProps<{
/** 卡片数量 */
cardCount: number
}>()
</script>
<style scoped>
/* ✅ 卡片样式:完全模仿真实列表 .list-card-entry */
.list-card {
position: relative;
overflow: hidden;
padding: 16px;
border-radius: 16px;
margin-bottom: 12px;
margin-left: 6px;
margin-right: 6px;
box-sizing: border-box;
}
.list-card-entry {
min-width: var(--reception-list-card-min-width, 100%);
flex-grow: 1;
min-height: 172px;
}
.glass-card {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(255, 255, 255, 0.6);
/* ✅ 性能优化:移除 box-shadow */
/* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); */
border-radius: 16px;
flex-direction: column;
}
</style>
<template>
<!-- 业绩看板骨架屏 -->
<view :class="['dashboard-skeleton', props.compact == true ? 'dashboard-skeleton--compact' : '']">
<!-- ✅ 使用 uview-unix 的 un-skeleton 组件 -->
<view class="skeleton-card-wrapper">
<un-skeleton
:loading="true"
:animate="true"
:title="true"
titleWidth="60%"
titleHeight="20px"
:rows="3"
rowsWidth="80%,70%,50%"
rowsHeight="16px,16px,16px"
:avatar="false" />
</view>
<view class="skeleton-card-wrapper">
<un-skeleton
:loading="true"
:animate="true"
:title="true"
titleWidth="50%"
titleHeight="18px"
:rows="5"
rowsWidth="90%,80%,70%,60%,50%"
rowsHeight="14px,14px,14px,14px,14px"
:avatar="false" />
</view>
<view class="skeleton-card-wrapper">
<un-skeleton
:loading="true"
:animate="true"
:title="true"
titleWidth="55%"
titleHeight="18px"
:rows="4"
rowsWidth="85%,75%,65%,55%"
rowsHeight="14px,14px,14px,14px"
:avatar="false" />
</view>
</view>
</template>
<script setup lang="uts">
const props = defineProps<{
/** 是否为横屏紧凑版 */
compact?: boolean
}>()
</script>
<style scoped>
.dashboard-skeleton {
padding: 16px;
}
.dashboard-skeleton--compact {
padding: 12px; /* 横屏紧凑版 */
}
/* ✅ 卡片容器 - 保持与原有骨架屏相同的外观和间距 */
.skeleton-card-wrapper {
background-color: #FFFFFF;
border-radius: 12px;
padding: 16px;
margin-bottom: 16px;
border: 1px solid #F1F5F9;
}
/* 最后一个卡片不需要底部边距 */
.skeleton-card-wrapper:last-child {
margin-bottom: 0;
}
</style>
<template>
<!-- 客户列表骨架屏 -->
<view :class="['list-skeleton', props.grid == true ? 'list-skeleton--grid' : '']">
<!-- ✅ 使用 uview-unix 的 un-skeleton 组件 -->
<view class="skeleton-sub-tabs-wrapper">
<un-skeleton
:loading="true"
:animate="true"
:title="false"
:rows="1"
rowsWidth="100%"
rowsHeight="48px"
:avatar="false" />
</view>
<view class="skeleton-filter-wrapper">
<un-skeleton
:loading="true"
:animate="true"
:title="false"
:rows="1"
rowsWidth="100%"
rowsHeight="56px"
:avatar="false" />
</view>
<view :class="['skeleton-list-cards', props.grid == true ? 'skeleton-list-cards--grid' : '']">
<view
v-for="i in (props.cardCount ?? 6)"
:key="'skeleton-card-' + i"
class="skeleton-card-wrapper"
>
<un-skeleton
:loading="true"
:animate="true"
:title="true"
titleWidth="70%"
titleHeight="18px"
:rows="4"
rowsWidth="90%,80%,70%,60%"
rowsHeight="14px,14px,14px,14px"
:avatar="true"
avatarSize="40px"
avatarShape="circle" />
</view>
</view>
</view>
</template>
<script setup lang="uts">
const props = defineProps<{
/** 卡片数量 */
cardCount?: number
/** 是否为网格布局(横屏) */
grid?: boolean
}>()
</script>
<style scoped>
.list-skeleton {
padding: 16px;
}
.list-skeleton--grid {
/* 横屏网格布局 */
}
/* ✅ Tab 和筛选区容器 */
.skeleton-sub-tabs-wrapper {
background-color: #FFFFFF;
border-radius: 8px;
margin-bottom: 12px;
padding: 8px;
border: 1px solid #F1F5F9;
}
.skeleton-filter-wrapper {
background-color: #FFFFFF;
border-radius: 8px;
margin-bottom: 16px;
padding: 8px;
border: 1px solid #F1F5F9;
}
.skeleton-list-cards {
display: flex; /* ✅ UVUE 需要显式设置 display: flex */
flex-direction: var(--reception-list-container-direction, column);
flex-wrap: var(--reception-list-container-wrap, nowrap);
justify-content: var(--reception-list-container-justify, flex-start);
/* ✅ UVUE 不支持 gap,使用 margin 替代 */
}
.skeleton-list-cards--grid {
display: flex; /* ✅ UVUE 需要显式设置 display: flex */
flex-wrap: var(--reception-list-container-wrap, wrap);
flex-direction: var(--reception-list-container-direction, row);
justify-content: var(--reception-list-container-justify, space-between); /* ✅ 自动处理卡片间距 */
}
/* ✅ 卡片容器 - 保持与原有骨架屏相同的外观和间距 */
.skeleton-card-wrapper {
background-color: #FFFFFF;
border-radius: 12px;
padding: 16px;
margin-bottom: 12px; /* ✅ 使用 margin-bottom 替代 gap */
margin-left: 6px; /* ✅ 横向间距 */
margin-right: 6px; /* ✅ 横向间距 */
box-sizing: border-box;
border: 1px solid #F1F5F9;
/* ✅ 使用 min-width + flex-grow 实现自适应列数 */
min-width: var(--reception-list-card-min-width); /* ✅ 由 CSS 变量控制 */
flex-grow: 1;
flex-shrink: 0; /* ✅ 防止卡片被压缩 */
}
.skeleton-list-cards--grid .skeleton-card-wrapper {
/* ✅ 使用 CSS 变量控制宽度,不再硬编码 */
min-width: var(--reception-list-card-min-width); /* ✅ 由 CSS 变量控制 */
flex-grow: 1;
flex-shrink: 0; /* ✅ 防止卡片被压缩 */
/* ✅ 使用 justify-content: space-between 自动处理间距,不需要 :nth-child */
}
</style>
<template>
<!-- ✅ 接待记录列表项骨架屏:移除根容器,让卡片直接成为父容器的子元素 -->
<block v-for="i in props.cardCount" :key="'reception-skeleton-' + i">
<view class="list-card glass-card">
<!-- ✅ 使用 uview-unix 的 un-skeleton 组件 -->
<un-skeleton
:loading="true"
:animate="true"
:title="true"
titleWidth="70%"
titleHeight="18px"
:rows="4"
rowsWidth="90%,80%,70%,60%"
rowsHeight="14px,14px,14px,14px"
:avatar="true"
avatarSize="40px"
avatarShape="circle" />
</view>
</block>
</template>
<script setup lang="uts">
const props = defineProps<{
/** 卡片数量 */
cardCount: number
}>()
</script>
<style scoped>
/* ✅ 卡片样式:完全模仿真实列表 .list-card */
.list-card {
padding: 16px;
border-radius: 16px;
margin-bottom: 12px;
margin-left: 6px;
margin-right: 6px;
box-sizing: border-box;
min-width: var(--reception-list-card-min-width, 100%);
flex-grow: 1;
min-height: 200px;
}
.glass-card {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(255, 255, 255, 0.6);
/* ✅ 性能优化:移除 box-shadow */
/* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); */
border-radius: 16px;
flex-direction: column;
}
</style>
.adapter{
color:var(--adapter-color);
font-size: var(--adapter-fontsize);
}
.test-view{
height: var(--test-view-height);
background-color: var(--test-view-bg, transparent);
}
.reception-tabs-container{
padding: var(--reception-tabs-container-padding);
margin-top: var(--reception-tabs-container-margin-top);
background-color: var(--reception-tabs-container-bgc);
}
.reception-main-tabs {
font-size: var(--reception-main-tabs-font-size);
}
\ No newline at end of file
/* common.scss 已清空 - 所有样式已迁移到各组件 scoped 样式或 CSS 变量中 */
.glass-card {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(226, 232, 240, 1);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
border-radius: 10px;
flex-direction: column;
}
.filter-group {
min-width: 0;
padding: 3px;
border-radius: 8px;
}
.filter-group-compact {
padding: 2px;
border-radius: 6px;
}
.filter-tabs-row {
flex-direction: row;
flex: 1;
width: 100%;
height: var(--reception-list-filters-tabs-row-height, 40px);
min-height: var(--reception-list-filters-tabs-row-height, 40px);
}
.entry-filter-segmented-wrap {
align-items: stretch;
.un-segmented {
flex: 1;
width: 100%;
border-width: 0;
background-color: rgba(0, 0, 0, 0.04);
border-radius: 10px;
padding: 2px;
}
.un-segmented__item {
border-width: 0;
border-radius: 10px;
.un-segmented__item__text {
color: #64748b;
font-size: var(--reception-list-filters-segmented-font-size, 14px);
}
&--active {
background-color: #ffffff;
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
.un-segmented__item__text {
color: #1677ff;
font-weight: 600;
}
}
}
}
.filter-actions {
flex-direction: row;
flex-wrap: nowrap;
flex-grow: 0;
flex-shrink: 0;
margin-left: auto;
}
// =========================
// 组合类(降低模板里的 class 噪音)
// - 保留现有的原子类供历史代码使用
// - 新代码优先使用下面这些更“语义化”的短类名
// =========================
// 基础卡片(等价于 glass-card)
.reception-filter-card {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(226, 232, 240, 1);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
border-radius: 10px;
flex-direction: column;
}
// 筛选项外壳(等价于 filter-group + filter-group-compact)
.reception-filter-shell {
min-width: 0;
padding: 2px;
border-radius: 6px;
}
// "半宽 segmented"容器(从 Primary 本地样式提取,供 Primary/Secondary 复用)
.reception-filter-entry-segmented-half {
flex-grow: 0;
flex-shrink: 0;
flex-basis: 50%;
width: 50%;
// ✅ UVUE 不支持 max-width: 50%,移除后由 width: 50% 控制
min-width: 0;
}
// =========================
// 更短的缩写类(进一步减少模板字符数)
// - rcf = reception center filters
// - 建议模板层优先使用这组短类
// =========================
// 基础卡片:卡片外观 + 壳(等价于 reception-filter-card + reception-filter-shell)
.rcf-card {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(226, 232, 240, 1);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
border-radius: 10px;
flex-direction: column;
min-width: 0;
padding: 2px;
border-radius: 6px;
}
// 半宽 segmented:rcf-card + 50% 宽度
.rcf-half {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(226, 232, 240, 1);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
border-radius: 10px;
flex-direction: column;
min-width: 0;
padding: 2px;
border-radius: 6px;
flex-grow: 0;
flex-shrink: 0;
flex-basis: 50%;
width: 50%;
// ✅ UVUE 不支持 max-width: 50%,移除后由 width: 50% 控制
min-width: 0;
}
// review 区域卡片(用于 Secondary):rcf-card + review-tabs-wrap 的布局外观
.rcf-review-card {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(226, 232, 240, 1);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
border-radius: 10px;
flex-direction: column;
min-width: 0;
padding: 2px;
border-radius: 6px;
flex: 1 1 0;
min-width: 0;
background: #f3f7fd;
border: 1px solid #e2e8f0;
border-radius: 10px;
padding: 2px;
box-sizing: border-box;
}
// review 区域半宽 segmented:rcf-half + review-tabs-wrap 的布局外观
.rcf-review-half {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(226, 232, 240, 1);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
border-radius: 10px;
flex-direction: column;
min-width: 0;
padding: 2px;
border-radius: 6px;
flex-grow: 0;
flex-shrink: 0;
flex-basis: 50%;
width: 50%;
// ✅ UVUE 不支持 max-width: 50%,移除后由 width: 50% 控制
min-width: 0;
flex: 1 1 0;
min-width: 0;
background: #f3f7fd;
border: 1px solid #e2e8f0;
border-radius: 10px;
padding: 2px;
box-sizing: border-box;
}
......@@ -91,62 +91,3 @@ export function mergeByKey(existing: UTSJSONObject[], pageRows: UTSJSONObject[],
}
return merged
}
export function formatDate(d: Date): string {
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}`
}
export function getCurrentMonthRange(): UTSJSONObject {
const now = new Date()
const start = new Date(now.getFullYear(), now.getMonth(), 1)
const end = new Date(now.getFullYear(), now.getMonth() + 1, 0)
return {
startDate: formatDate(start),
endDate: formatDate(end),
} as UTSJSONObject
}
export function getTodayDayRangeStrings(): UTSJSONObject {
const now = new Date()
const y = now.getFullYear()
const m = (now.getMonth() + 1).toString().padStart(2, '0')
const day = now.getDate().toString().padStart(2, '0')
const dateStr = `${y}-${m}-${day}`
return {
startTime: `${dateStr} 00:00:00`,
endTime: `${dateStr} 23:59:59`,
} as UTSJSONObject
}
export function getMockPerformanceData(): UTSJSONObject {
return {
cumulativeDeliveryCount: 128,
actualContactCount: 96,
contactRate: 75,
achievementRatio: 85.5,
excellentStoreAvgDealRate: 42,
thisStoreDealRate: 38,
personalDealRate: 35,
actualProduction: 12.8,
personalProduction: 4.2,
excellentStoreAvgDeal: 12500,
thisStoreKdj: 10800,
personalKdj: 9500,
targetProduction: 199,
productionContribution: 100,
} as UTSJSONObject
}
export function isPerformanceDataEmpty(data: UTSJSONObject | null): boolean {
if (data == null) { return true }
const c = get(data, 'cumulativeDeliveryCount')
const a = get(data, 'actualContactCount')
const p = get(data, 'actualProduction')
const rate = get(data, 'contactRate')
const hasCount = (typeof c == 'number' && c > 0) || (typeof a == 'number' && a > 0) || (typeof p == 'number' && p > 0)
const hasRate = rate != null && `${rate}` != ''
return !(hasCount || hasRate)
}
/** 产值对比行:须在单文件定义,避免父子组件各写一份导致 Android ClassCastException */
export type CompareRow = {
label: string
barWidthPercent: string
barClass: string
value: string
}
/** 本月产值汇总区:与产值 Tab 共用,由父组件从业绩数据组装后传入 */
export type OutputSummary = {
summaryLabel: string
summaryValueNum: string
summaryValueUnit: string
personalLabel: string
personalValue: string
ringPercent: string
ringLabel: string
ringPercentNum: number
ringComparePercent: number
}
/** 输出 Tab 数据结构(转化率/客单价) */
export type OutputTabData = {
compareRows: CompareRow[]
summary: OutputSummary
}
/** 智能体信息条目:getAiagent 业务字段 */
export type AiAgentInfo = {
id?: number | null
entryName?: string | null
entryLogoUrl?: string | null
agentCode?: string | null
agentName?: string | null
agentUrl?: string | null
presuppositionProblem?: string | null
preEntryName?: string | null
accountPhone?: string | null
ownerPost?: string | null
domainName?: string | null
questionConfigList?: UTSJSONObject[] | null
ownerShipType?: number | null
tipShowFlag?: number | null
taskStatus?: string | number | null
checkDate?: string | null
sopTaskDetailInfoDTO?: UTSJSONObject | null
}
/** 智能体接口常见包裹结构 */
export type AiAgentResponseBody = {
code?: string | number | null
errId?: any | null
message?: string | null
data?: any | null
}
// NOTE: 该文件原先包含 CarBrandSelect(品牌-车型两步选择组件)相关类型。
// 本次移除该组件后,这些类型不再被其它代码引用,因此删除以避免维护负担。
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!