Commit ff936d5b by liimin

Merge branch 'feature/rework' of http://192.168.3.233:8090/monorepo/venus into feature/rework

2 parents 90e4fbbd 71e14a30
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"configurations" : [ "configurations" : [
{ {
"customPlaygroundType" : "local", "customPlaygroundType" : "local",
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
} }
] ]
......
<template> <template>
<view class="main-tab-shell-root"> <view class="main-tab-shell-root">
<view class="main-tab-shell-body main-tab-shell-body-landscape"> <view class="main-tab-shell-body main-tab-shell-body-landscape">
<HomeFrameTabbarLandscape :adapter-class-name="adapterClassName" <HomeFrameTabbarLandscape :user-name="userName"
:user-name="userName"
:current-tab-index="currentTabIndex" :current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList" :scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup" :show-scene-popup="showScenePopup"
...@@ -22,11 +21,12 @@ ...@@ -22,11 +21,12 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed } from "vue"; import { computed, inject, type Ref } from "vue";
import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue"; import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts"; import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts"; import { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
type MainTabShellSlotProps = { type MainTabShellSlotProps = {
userInfo: UTSJSONObject userInfo: UTSJSONObject
...@@ -40,17 +40,22 @@ defineSlots<MainTabShellSlots>(); ...@@ -40,17 +40,22 @@ defineSlots<MainTabShellSlots>();
const props = defineProps<{ const props = defineProps<{
activeTabIndex: number activeTabIndex: number
userInfo?: null | UTSJSONObject
}>(); }>();
const shellUserInfoRef = inject(SCENE_SHELL_USER_INFO_INJECT_KEY, null) as Ref<UTSJSONObject> | null;
const tabbarSource: HomeFrameTabbarSource = { const tabbarSource: HomeFrameTabbarSource = {
getAdapterClass: (): null | string => null,
getTabIndex: (): number => props.activeTabIndex, getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject getUserInfo: (): null | UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
return storage.get("userInfo") as null | UTSJSONObject;
}
}; };
const _tabbar = useHomeFrameTabbar(tabbarSource); const _tabbar = useHomeFrameTabbar(tabbarSource);
const adapterClassName = _tabbar.adapterClassName;
const userName = _tabbar.userName; const userName = _tabbar.userName;
const currentTabIndex = _tabbar.currentTabIndex; const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList; const sceneTypeList = _tabbar.sceneTypeList;
...@@ -65,8 +70,12 @@ const onChooseScene = _tabbar.onChooseScene; ...@@ -65,8 +70,12 @@ const onChooseScene = _tabbar.onChooseScene;
const jumpPersonCenter = _tabbar.jumpPersonCenter; const jumpPersonCenter = _tabbar.jumpPersonCenter;
const slotUserInfo = computed((): UTSJSONObject => { const slotUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo; const r = shellUserInfoRef;
return u != null ? u : ({} as UTSJSONObject); if (r != null) {
return r.value as UTSJSONObject;
}
const raw = storage.get("userInfo");
return raw != null ? raw as UTSJSONObject : ({} as UTSJSONObject);
}); });
</script> </script>
......
...@@ -4,11 +4,7 @@ ...@@ -4,11 +4,7 @@
<view class="main-tab-shell-slot main-tab-shell-slot-portrait"> <view class="main-tab-shell-slot main-tab-shell-slot-portrait">
<slot :user-info="slotUserInfo"></slot> <slot :user-info="slotUserInfo"></slot>
</view> </view>
<HomeFrameTabbarPortrait :adapter-class-name="adapterClassName" <HomeFrameTabbarPortrait :current-tab-index="currentTabIndex"
:is-pad-portrait-mode="isPadPortraitMode"
:tabbar-height="tabbarHeight"
:tabbar-icon-size="tabbarIconSize"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList" :scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup" :show-scene-popup="showScenePopup"
:show-setting="showSetting" :show-setting="showSetting"
...@@ -21,11 +17,12 @@ ...@@ -21,11 +17,12 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed } from "vue"; import { computed, inject, type Ref } from "vue";
import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue"; import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts"; import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts"; import { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
type MainTabShellSlotProps = { type MainTabShellSlotProps = {
userInfo: UTSJSONObject userInfo: UTSJSONObject
...@@ -39,20 +36,22 @@ defineSlots<MainTabShellSlots>(); ...@@ -39,20 +36,22 @@ defineSlots<MainTabShellSlots>();
const props = defineProps<{ const props = defineProps<{
activeTabIndex: number activeTabIndex: number
userInfo?: null | UTSJSONObject
}>(); }>();
const shellUserInfoRef = inject(SCENE_SHELL_USER_INFO_INJECT_KEY, null) as Ref<UTSJSONObject> | null;
const tabbarSource: HomeFrameTabbarSource = { const tabbarSource: HomeFrameTabbarSource = {
getAdapterClass: (): null | string => null,
getTabIndex: (): number => props.activeTabIndex, getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject getUserInfo: (): null | UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
return storage.get("userInfo") as null | UTSJSONObject;
}
}; };
const _tabbar = useHomeFrameTabbar(tabbarSource); const _tabbar = useHomeFrameTabbar(tabbarSource);
const adapterClassName = _tabbar.adapterClassName;
const isPadPortraitMode = _tabbar.isPadPortraitMode;
const tabbarHeight = _tabbar.tabbarHeight;
const tabbarIconSize = _tabbar.tabbarIconSize;
const currentTabIndex = _tabbar.currentTabIndex; const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList; const sceneTypeList = _tabbar.sceneTypeList;
const showScenePopup = _tabbar.showScenePopup; const showScenePopup = _tabbar.showScenePopup;
...@@ -63,8 +62,12 @@ const onSettingVisible = _tabbar.onSettingVisible; ...@@ -63,8 +62,12 @@ const onSettingVisible = _tabbar.onSettingVisible;
const onChooseScene = _tabbar.onChooseScene; const onChooseScene = _tabbar.onChooseScene;
const slotUserInfo = computed((): UTSJSONObject => { const slotUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo; const r = shellUserInfoRef;
return u != null ? u : ({} as UTSJSONObject); if (r != null) {
return r.value as UTSJSONObject;
}
const raw = storage.get("userInfo");
return raw != null ? raw as UTSJSONObject : ({} as UTSJSONObject);
}); });
</script> </script>
......
<template> <template>
<!-- 物理 tab 三页共用:横/竖两套壳 + 默认槽;方向由 updateOrientation + useOrientation 驱动 --> <!-- 物理 tab 三页共用:横/竖两套壳 + 默认槽;方向由 updateOrientation + useOrientation 驱动 -->
<MainTabShellPortrait v-if="shellIsPortrait" <MainTabShellPortrait v-if="shellIsPortrait"
:active-tab-index="props.activeTabIndex" :active-tab-index="props.activeTabIndex">
:user-info="userInfo">
<template #default="{ userInfo: u }"> <template #default="{ userInfo: u }">
<slot :user-info="u"></slot> <slot :user-info="u"></slot>
</template> </template>
</MainTabShellPortrait> </MainTabShellPortrait>
<MainTabShellLandscape v-else <MainTabShellLandscape v-else
:active-tab-index="props.activeTabIndex" :active-tab-index="props.activeTabIndex">
:user-info="userInfo">
<template #default="{ userInfo: u }"> <template #default="{ userInfo: u }">
<slot :user-info="u"></slot> <slot :user-info="u"></slot>
</template> </template>
...@@ -17,7 +15,7 @@ ...@@ -17,7 +15,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, defineExpose, onMounted, onResize, ref, type Ref } from "vue"; import { computed, defineExpose, onMounted, onResize, provide, ref, type Ref } from "vue";
import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts"; import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts";
import { requestRecordPermission } from "@/utils/permission.uts"; import { requestRecordPermission } from "@/utils/permission.uts";
...@@ -26,6 +24,7 @@ import { hideNativeTabBar } from "@/utils/tabBarShell.uts"; ...@@ -26,6 +24,7 @@ import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import MainTabShellLandscape from "./MainTabShellLandscape.uvue"; import MainTabShellLandscape from "./MainTabShellLandscape.uvue";
import MainTabShellPortrait from "./MainTabShellPortrait.uvue"; import MainTabShellPortrait from "./MainTabShellPortrait.uvue";
import { SCENE_SHELL_USER_INFO_INJECT_KEY } from "./tabbarShared.uts";
type SceneShellSlotProps = { type SceneShellSlotProps = {
userInfo: UTSJSONObject userInfo: UTSJSONObject
...@@ -51,6 +50,8 @@ const shellIsPortrait = computed((): boolean => { ...@@ -51,6 +50,8 @@ const shellIsPortrait = computed((): boolean => {
}); });
onMounted((): void => { onMounted((): void => {
requestRecordPermission();
hideNativeTabBar();
updateOrientation(); updateOrientation();
}); });
...@@ -59,6 +60,7 @@ onResize((_res: any): void => { ...@@ -59,6 +60,7 @@ onResize((_res: any): void => {
}); });
const userInfo = ref<UTSJSONObject>({}); const userInfo = ref<UTSJSONObject>({});
provide(SCENE_SHELL_USER_INFO_INJECT_KEY, userInfo);
function updateApp(): void { function updateApp(): void {
const info = storage.get("userInfo"); const info = storage.get("userInfo");
...@@ -67,12 +69,6 @@ function updateApp(): void { ...@@ -67,12 +69,6 @@ function updateApp(): void {
} }
} }
onLoad((_options) => {
requestRecordPermission();
hideNativeTabBar();
updateOrientation();
});
onShow(() => { onShow(() => {
hideNativeTabBar(); hideNativeTabBar();
}); });
......
<template> <template>
<HomeFrameTabbarLandscape v-if="!isPortraitMode" <HomeFrameTabbarLandscape v-if="!isPortraitMode"
:adapter-class-name="adapterClassName"
:user-name="userName" :user-name="userName"
:current-tab-index="currentTabIndex" :current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList" :scene-type-list="sceneTypeList"
...@@ -14,10 +13,6 @@ ...@@ -14,10 +13,6 @@
@choose-scene="onChooseScene" @choose-scene="onChooseScene"
@jump-person-center="jumpPersonCenter" /> @jump-person-center="jumpPersonCenter" />
<HomeFrameTabbarPortrait v-else <HomeFrameTabbarPortrait v-else
:adapter-class-name="adapterClassName"
:is-pad-portrait-mode="isPadPortraitMode"
:tabbar-height="tabbarHeight"
:tabbar-icon-size="tabbarIconSize"
:current-tab-index="currentTabIndex" :current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList" :scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup" :show-scene-popup="showScenePopup"
...@@ -39,7 +34,6 @@ import type { HomeFrameTabbarSource } from "./tabbarShared.uts"; ...@@ -39,7 +34,6 @@ import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts"; import { useHomeFrameTabbar } from "./tabbarShared.uts";
const props = defineProps<{ const props = defineProps<{
adapterClass?: string
tabIndex?: number tabIndex?: number
userInfo?: null | UTSJSONObject userInfo?: null | UTSJSONObject
}>(); }>();
...@@ -51,19 +45,11 @@ const isPortraitMode = computed((): boolean => { ...@@ -51,19 +45,11 @@ const isPortraitMode = computed((): boolean => {
}); });
const tabbarSource: HomeFrameTabbarSource = { const tabbarSource: HomeFrameTabbarSource = {
getAdapterClass: (): null | string => props.adapterClass as null | string,
getTabIndex: (): number => props.tabIndex != null ? (props.tabIndex as number) : 0, getTabIndex: (): number => props.tabIndex != null ? (props.tabIndex as number) : 0,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
}; };
const _tabbar = useHomeFrameTabbar(tabbarSource); const _tabbar = useHomeFrameTabbar(tabbarSource);
const adapterClassName = _tabbar.adapterClassName;
const isPadPortraitMode = _tabbar.isPadPortraitMode;
const tabbarHeight = _tabbar.tabbarHeight;
const tabbarIconSize = _tabbar.tabbarIconSize;
const landscapeTabbarRootStyle = _tabbar.landscapeTabbarRootStyle;
const landscapeTabbarInnerHeight = _tabbar.landscapeTabbarInnerHeight;
const landscapeTabbarIconSize = _tabbar.landscapeTabbarIconSize;
const currentTabIndex = _tabbar.currentTabIndex; const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList; const sceneTypeList = _tabbar.sceneTypeList;
const userName = _tabbar.userName; const userName = _tabbar.userName;
......
<template> <template>
<view class="home-tabbar home-tabbar-landscape" <view class="home-tabbar home-tabbar-landscape">
:class="[adapterClassName]"> <!-- <image class="home-tabbar-bg-img"
<image class="home-tabbar-bg-img"
mode="aspectFill" mode="aspectFill"
src="/static/images/home/left-bg.png" /> src="/static/images/home/left-bg.png" /> -->
<view class="hf-landscape-column"> <view class="hf-landscape-column">
<view class="user-box user-box-clickable hf-landscape-user" <view class="user-box user-box-clickable hf-landscape-user"
@click="emit('jumpPersonCenter')"> @click="emit('jumpPersonCenter')">
<view class="hf-landscape-profile"> <view class="hf-landscape-profile">
<un-avatar :text="avatarText" <un-avatar :text="avatarText"
shape="circle" shape="circle"
size="52" size="42"
bgColor="#2f6af7" bgColor="#2f6af7"
color="#ffffff" color="#ffffff"
fontSize="20" /> fontSize="20" />
...@@ -33,6 +32,7 @@ ...@@ -33,6 +32,7 @@
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="home-tabbar-footer flex-col hf-landscape-footer"> <view class="home-tabbar-footer flex-col hf-landscape-footer">
<view class="hf-landscape-footer-btn" <view class="hf-landscape-footer-btn"
@tap="emit('sceneChange')"> @tap="emit('sceneChange')">
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
src="/static/images/home/setting.png" /> src="/static/images/home/setting.png" />
</view> </view>
</view> </view>
</view>
<CenterPopup :list="sceneTypeList" <CenterPopup :list="sceneTypeList"
title="选择场景" title="选择场景"
:visible="showScenePopup" :visible="showScenePopup"
...@@ -67,7 +66,6 @@ import SettingBox from "@/pages/person/SettingBox.uvue"; ...@@ -67,7 +66,6 @@ import SettingBox from "@/pages/person/SettingBox.uvue";
import { HOME_FRAME_TABS } from "./tabbarShared.uts"; import { HOME_FRAME_TABS } from "./tabbarShared.uts";
const props = defineProps<{ const props = defineProps<{
adapterClassName: string
userName: string userName: string
currentTabIndex: number currentTabIndex: number
sceneTypeList: UTSJSONObject[] sceneTypeList: UTSJSONObject[]
...@@ -108,16 +106,15 @@ function onTabItemClick(index: number): void { ...@@ -108,16 +106,15 @@ function onTabItemClick(index: number): void {
<style scoped lang="scss"> <style scoped lang="scss">
@import "./styles/common.scss"; @import "./styles/common.scss";
/* 横屏侧栏主列:顶/左右/底对称留白,子块共一条竖直中轴 */ /* 顶部用户区:仅内容高度,不把中间 Tab 区挤没 */
.hf-landscape-column { .hf-landscape-column {
flex: 1; flex-shrink: 0;
min-height: 0;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
padding: 14px 10px 20px; padding: 14px 10px 0;
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
...@@ -143,7 +140,7 @@ function onTabItemClick(index: number): void { ...@@ -143,7 +140,7 @@ function onTabItemClick(index: number): void {
/* 与 MyCenterMain .name 一致;与 Tab 文案同宽便于视觉对齐 */ /* 与 MyCenterMain .name 一致;与 Tab 文案同宽便于视觉对齐 */
.hf-landscape-name { .hf-landscape-name {
margin-top: 10px; margin-top: 10px;
font-size: 19px; font-size: 14px;
font-weight: 600; font-weight: 600;
color: #1a2433; color: #1a2433;
line-height: 24px; line-height: 24px;
...@@ -155,15 +152,6 @@ function onTabItemClick(index: number): void { ...@@ -155,15 +152,6 @@ function onTabItemClick(index: number): void {
white-space: nowrap; white-space: nowrap;
} }
.hf-landscape-tab-wrap {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 0;
}
.hf-landscape-footer { .hf-landscape-footer {
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -171,8 +159,8 @@ function onTabItemClick(index: number): void { ...@@ -171,8 +159,8 @@ function onTabItemClick(index: number): void {
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
flex-shrink: 0; flex-shrink: 0;
margin-top: auto; padding-left: 10px;
padding-bottom: 0; padding-right: 10px;
} }
.hf-landscape-footer-btn { .hf-landscape-footer-btn {
...@@ -194,10 +182,11 @@ function onTabItemClick(index: number): void { ...@@ -194,10 +182,11 @@ function onTabItemClick(index: number): void {
flex-shrink: 0; flex-shrink: 0;
} }
/* 横屏侧栏 Tab 区域 */ /* 横屏侧栏 Tab:占满中间 landscape-tabbar-wrap,条目在剩余高度内垂直居中 */
.landscape-vertical-tabs { .landscape-vertical-tabs {
flex: 1;
min-height: 0;
width: 100%; width: 100%;
height: var(--tabbar-height, 540px);
padding-left: var(--tabbar-padding, 16px); padding-left: var(--tabbar-padding, 16px);
padding-right: var(--tabbar-padding, 16px); padding-right: var(--tabbar-padding, 16px);
padding-top: 8px; padding-top: 8px;
...@@ -231,8 +220,8 @@ function onTabItemClick(index: number): void { ...@@ -231,8 +220,8 @@ function onTabItemClick(index: number): void {
} }
.landscape-vertical-tabs__icon { .landscape-vertical-tabs__icon {
width: var(--tabbar-icon-size, 28px); width: var(--tabbar-icon-size);
height: var(--tabbar-icon-size, 28px); height: var(--tabbar-icon-size);
flex-shrink: 0; flex-shrink: 0;
} }
......
<template> <template>
<view class="home-tabbar home-tabbar-portrait" <view class="home-tabbar home-tabbar-portrait home-tabbar-portrait-pad">
:class="[adapterClassName, isPadPortraitMode ? 'home-tabbar-portrait-pad' : '']">
<un-tabbar :model-value="currentTabIndex" <un-tabbar :model-value="currentTabIndex"
class="portrait-un-tabbar" class="portrait-un-tabbar"
:fixed="true" :fixed="true"
...@@ -9,13 +8,12 @@ ...@@ -9,13 +8,12 @@
active-color="#3773f8" active-color="#3773f8"
inactive-color="#8a98b5" inactive-color="#8a98b5"
bg-color="#ffffff" bg-color="#ffffff"
:height="tabbarHeight"
@change="emit('tabChange', ($event as string | number))"> @change="emit('tabChange', ($event as string | number))">
<un-tabbar-item v-for="(item, index) in tabs" <un-tabbar-item v-for="(item, index) in tabs"
:key="index" :key="index"
:name="index" :name="index"
:text="item.label" :text="item.label">
:icon-size="tabbarIconSize">
<template #icon="{ active }"> <template #icon="{ active }">
<image v-if="active === true" <image v-if="active === true"
class="tabbar-icon-img" class="tabbar-icon-img"
...@@ -45,10 +43,6 @@ import SettingBox from "@/pages/person/SettingBox.uvue"; ...@@ -45,10 +43,6 @@ import SettingBox from "@/pages/person/SettingBox.uvue";
import { HOME_FRAME_TABS } from "./tabbarShared.uts"; import { HOME_FRAME_TABS } from "./tabbarShared.uts";
defineProps<{ defineProps<{
adapterClassName: string
isPadPortraitMode: boolean
tabbarHeight: number
tabbarIconSize: number
currentTabIndex: number currentTabIndex: number
sceneTypeList: UTSJSONObject[] sceneTypeList: UTSJSONObject[]
showScenePopup: boolean showScenePopup: boolean
...@@ -67,4 +61,10 @@ const tabs = HOME_FRAME_TABS; ...@@ -67,4 +61,10 @@ const tabs = HOME_FRAME_TABS;
<style scoped lang="scss"> <style scoped lang="scss">
@import "./styles/common.scss"; @import "./styles/common.scss";
/* 与 layout-root 注入的 index.vars.uts 中 --tabbar-icon-size 一致;横屏侧栏见 TabbarLandscape .landscape-vertical-tabs__icon */
.tabbar-icon-img {
width: var(--tabbar-icon-size);
height: var(--tabbar-icon-size);
}
</style> </style>
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, defineExpose, ref } from "vue"; import { computed, defineExpose, onMounted, ref } from "vue";
import type { UnSwiperItem } from "@/uni_modules/uview-unix"; import type { UnSwiperItem } from "@/uni_modules/uview-unix";
...@@ -235,7 +235,8 @@ function onStartClick(): void { ...@@ -235,7 +235,8 @@ function onStartClick(): void {
emit("start"); emit("start");
} }
onLoad((options) => {
onMounted((): void => {
requestRecordPermission(); requestRecordPermission();
}); });
defineExpose({ defineExpose({
......
...@@ -454,6 +454,7 @@ ...@@ -454,6 +454,7 @@
pointer-events: none; pointer-events: none;
} }
.hf-landscape-column,
.user-box, .user-box,
.landscape-tabbar-wrap, .landscape-tabbar-wrap,
.home-tabbar-footer { .home-tabbar-footer {
...@@ -464,6 +465,8 @@ ...@@ -464,6 +465,8 @@
.home-tabbar-landscape { .home-tabbar-landscape {
min-height: 0; min-height: 0;
height: 100%;
align-self: stretch;
} }
.home-tabbar-portrait { .home-tabbar-portrait {
...@@ -577,8 +580,9 @@ ...@@ -577,8 +580,9 @@
min-height: 0; min-height: 0;
} }
/* 横屏:footer 为侧栏第三段,由父级 flex 贴底;竖屏若复用此类名再按需加 margin */
.home-tabbar-footer { .home-tabbar-footer {
margin-top: auto; flex-shrink: 0;
padding-bottom: 40px; padding-bottom: 40px;
} }
......
...@@ -85,8 +85,8 @@ export default { ...@@ -85,8 +85,8 @@ export default {
'--common-title-height': '54px', '--common-title-height': '54px',
'--entrance-icon-size': '64px', '--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)', '--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '640px', '--tabbar-height': '70px',
'--tabbar-icon-size': '34px', '--tabbar-icon-size': '46px',
'--tabbar-width': '140px', '--tabbar-width': '140px',
}, },
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
'--entrance-icon-size': '64px', '--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)', '--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '70px', '--tabbar-height': '70px',
'--tabbar-icon-size': '34px', '--tabbar-icon-size': '32px',
}, },
} }
} }
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { cssClassRef } from "@/services/adapter";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import { notifyUserSceneTypeChanged } from "@/utils/userSceneEvents.uts"; import { notifyUserSceneTypeChanged } from "@/utils/userSceneEvents.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts"; import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
export type HomeFrameTabbarSource = { export type HomeFrameTabbarSource = {
getAdapterClass: () => null | string
getTabIndex: () => number getTabIndex: () => number
getUserInfo: () => null | UTSJSONObject getUserInfo: () => null | UTSJSONObject
} }
/** SceneShell `provide`:`Ref<UTSJSONObject>`;MainTabShell `inject`,与插槽同源 */
export const SCENE_SHELL_USER_INFO_INJECT_KEY = "homeFrame.sceneShellUserInfo"
export type TabItem = { export type TabItem = {
label: string; label: string;
icon: string; icon: string;
...@@ -98,20 +99,6 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) { ...@@ -98,20 +99,6 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
const showScenePopup = ref(false); const showScenePopup = ref(false);
const showSetting = ref(false); const showSetting = ref(false);
const adapterClassName = computed((): string => {
const cls = source.getAdapterClass();
if (cls != null && cls !== "") {
return cls as string;
}
const fromRef = cssClassRef.value;
return fromRef != null ? (fromRef as string) : "";
});
const isPadPortraitMode = computed((): boolean => {
const cls = adapterClassName.value;
return cls.indexOf("layout-portrait-768x1174") >= 0;
});
const currentTabIndex = computed((): number => { const currentTabIndex = computed((): number => {
return source.getTabIndex(); return source.getTabIndex();
}); });
...@@ -264,8 +251,6 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) { ...@@ -264,8 +251,6 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
return { return {
showScenePopup, showScenePopup,
showSetting, showSetting,
adapterClassName,
isPadPortraitMode,
currentTabIndex, currentTabIndex,
sceneTypeList, sceneTypeList,
sceneTypeIdList, sceneTypeIdList,
......
...@@ -13,24 +13,6 @@ ...@@ -13,24 +13,6 @@
} }
}, },
{ {
"path": "pages/usedCar/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/equity/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/boutique/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/receptionCenter/center", "path": "pages/receptionCenter/center",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
...@@ -43,12 +25,6 @@ ...@@ -43,12 +25,6 @@
} }
}, },
{ {
"path": "pages/test/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
......
...@@ -9,166 +9,151 @@ ...@@ -9,166 +9,151 @@
<text class="test-orientation-text">hooks:{{ hookOrientation }} {{ hookOrientation=='landscape'?'横屏':'竖屏'}} {{ isLandscape }}</text> <text class="test-orientation-text">hooks:{{ hookOrientation }} {{ hookOrientation=='landscape'?'横屏':'竖屏'}} {{ isLandscape }}</text>
</view> --> </view> -->
<view class="reception-center-page"> <view class="reception-center-page">
<!-- <un-navbar title="接待中心" left-icon="" /> -->
<!-- <view class="reception-navbar-spacer"></view> -->
<!-- Tab 切换 --> <!-- Tab 切换 -->
<view v-if="isLandscape != true" class="reception-tabs-container" :style="receptionTabsContainerStyle"> <view v-if="isLandscape != true"
<un-tabs class="reception-tabs-container"
:style="receptionTabsContainerStyle">
<un-tabs :active-style="mainTabActiveStyle"
class="reception-main-tabs" class="reception-main-tabs"
:height="mainTabBarHeight"
:inactive-style="mainTabInactiveStyle"
:item-style="mainTabItemStyle"
line-color="#1677ff"
:line-height="mainTabLineHeight"
:line-width="mainTabLineWidth"
:list="mainTabs"
:style="receptionMainTabsShellStyle" :style="receptionMainTabsShellStyle"
:value="mainTabIndex" :value="mainTabIndex"
:list="mainTabs" @change="onMainTabChange">
:height="mainTabBarHeight" </un-tabs>
:lineWidth="mainTabLineWidth"
:lineHeight="mainTabLineHeight"
lineColor="#1677ff"
:activeStyle="mainTabActiveStyle"
:inactiveStyle="mainTabInactiveStyle"
:itemStyle="mainTabItemStyle"
@change="onMainTabChange"
></un-tabs>
</view> </view>
<!-- Tab 内容区域 --> <!-- Tab 内容区域 -->
<view class="reception-content-container"> <view class="reception-content-container">
<!-- 竖屏:保持原逻辑(Tabs 切换展示) --> <!-- 竖屏:保持原逻辑(Tabs 切换展示) -->
<view v-if="isLandscape != true" class="reception-content-portrait"> <view v-if="isLandscape != true" class="reception-content-portrait">
<!-- 竖屏:业绩看板内容溢出时允许上下滚动 --> <!-- 竖屏:业绩看板内容溢出时允许上下滚动 -->
<scroll-view <scroll-view v-if="mainTabIndex == 0"
v-if="mainTabIndex == 0"
class="reception-dashboard-scroll" class="reception-dashboard-scroll"
scroll-y="true" scroll-y="true"
show-scrollbar="false" show-scrollbar="false">
> <ReceptionDashboardTab :achievement-value-text="monthValueAchievementText"
<ReceptionDashboardTab :compare-rows="currentOutputTab.compareRows"
:output-tab-index="outputTabIndex"
:performance-data="performanceData" :performance-data="performanceData"
:performance-metrics-visible="performanceMetricsVisible" :performance-metrics-visible="performanceMetricsVisible"
:selected-brand="selectedBrand" :selected-brand="selectedBrand"
:time-progress-percent="timeProgressPercent"
:compare-rows="currentOutputTab.compareRows"
:summary="currentOutputTab.summary" :summary="currentOutputTab.summary"
:target-value-text="monthValueTargetText" :target-value-text="monthValueTargetText"
:achievement-value-text="monthValueAchievementText" :time-progress-percent="timeProgressPercent"
:output-tab-index="outputTabIndex"
@toggle-metrics="togglePerformanceMetricsVisibility"
@open-brand-picker="show = true" @open-brand-picker="show = true"
@update:output-tab-index="onOutputTabIndexChange" @toggle-metrics="togglePerformanceMetricsVisibility"
/> @update:output-tab-index="onOutputTabIndexChange" />
</scroll-view> </scroll-view>
<view v-if="mainTabIndex == 1" class="reception-list-wrapper"> <view v-if="mainTabIndex == 1" class="reception-list-wrapper">
<ReceptionCustomerListTab <ReceptionCustomerListTab :customer-list="customerList"
:sticky-header="isLandscape" :customer-list-has-more="customerListHasMore"
:list-sub-tab-index="listSubTabIndex" :customer-list-loading-more="customerListLoadingMore"
:reception-filter-narrow-mode="receptionFilterNarrowMode"
:entry-filter-index="entryFilterIndex" :entry-filter-index="entryFilterIndex"
:filter-tab-index="filterTabIndex" :filter-tab-index="filterTabIndex"
:submitted-result-tab-index="submittedResultTabIndex" :list-sub-tab-index="listSubTabIndex"
:reception-filter-narrow-mode="receptionFilterNarrowMode"
:reception-list-has-more="receptionListHasMore"
:reception-list-loading-more="receptionListLoadingMore"
:reception-record-list="receptionRecordList"
:review-tab-index="reviewTabIndex" :review-tab-index="reviewTabIndex"
:sticky-header="isLandscape"
:submitted-result-tab-index="submittedResultTabIndex"
:unsubmitted-pending-tab-index="unsubmittedPendingTabIndex" :unsubmitted-pending-tab-index="unsubmittedPendingTabIndex"
:customer-list="customerList"
:reception-record-list="receptionRecordList"
:customer-list-loading-more="customerListLoadingMore"
:customer-list-has-more="customerListHasMore"
:reception-list-loading-more="receptionListLoadingMore"
:reception-list-has-more="receptionListHasMore"
@scroll-lower="onListScrollToLower"
@switch-list-sub-tab="switchListSubTab"
@switch-entry-filter-tab="switchEntryFilterTab"
@switch-filter-tab="switchFilterTab"
@open-submitted-result-picker="openSubmittedResultPicker"
@open-review-picker="openReviewPicker"
@switch-unsubmitted-pending-tab="switchUnsubmittedPendingTab"
@customer-entry-click="onCustomerEntryClick" @customer-entry-click="onCustomerEntryClick"
@entry-click="onListCustomerEntryClick" @entry-click="onListCustomerEntryClick"
@entry-edit="onListCustomerEntryEdit"
@entry-delete="onListCustomerEntryDelete" @entry-delete="onListCustomerEntryDelete"
@entry-edit="onListCustomerEntryEdit"
@open-review-picker="openReviewPicker"
@open-submitted-result-picker="openSubmittedResultPicker"
@reception-click="onReceptionCardClick" @reception-click="onReceptionCardClick"
/> @scroll-lower="onListScrollToLower"
@switch-entry-filter-tab="switchEntryFilterTab"
@switch-filter-tab="switchFilterTab"
@switch-list-sub-tab="switchListSubTab"
@switch-unsubmitted-pending-tab="switchUnsubmittedPendingTab" />
</view> </view>
</view> </view>
<!-- 横屏:隐藏 Tabs,左右分栏同时展示(左 1/3 业绩看板,右 2/3 客户列表) --> <!-- 横屏:隐藏 Tabs,左右分栏同时展示(左 1/3 业绩看板,右 2/3 客户列表) -->
<view v-else class="reception-content-landscape"> <view v-else class="reception-content-landscape">
<view class="reception-landscape-left"> <view class="reception-landscape-left">
<ReceptionDashboardTab <ReceptionDashboardTab :achievement-value-text="monthValueAchievementText"
:compare-rows="currentOutputTab.compareRows"
:output-tab-index="outputTabIndex"
:performance-data="performanceData" :performance-data="performanceData"
:performance-metrics-visible="performanceMetricsVisible" :performance-metrics-visible="performanceMetricsVisible"
:selected-brand="selectedBrand" :selected-brand="selectedBrand"
:time-progress-percent="timeProgressPercent"
:compare-rows="currentOutputTab.compareRows"
:summary="currentOutputTab.summary" :summary="currentOutputTab.summary"
:target-value-text="monthValueTargetText" :target-value-text="monthValueTargetText"
:achievement-value-text="monthValueAchievementText" :time-progress-percent="timeProgressPercent"
:output-tab-index="outputTabIndex"
@toggle-metrics="togglePerformanceMetricsVisibility"
@open-brand-picker="show = true" @open-brand-picker="show = true"
@update:output-tab-index="onOutputTabIndexChange" @toggle-metrics="togglePerformanceMetricsVisibility"
/> @update:output-tab-index="onOutputTabIndexChange" />
</view> </view>
<view class="reception-landscape-right"> <view class="reception-landscape-right">
<ReceptionCustomerListTab <ReceptionCustomerListTab :customer-list="customerList"
:sticky-header="isLandscape" :customer-list-has-more="customerListHasMore"
:list-sub-tab-index="listSubTabIndex" :customer-list-loading-more="customerListLoadingMore"
:reception-filter-narrow-mode="receptionFilterNarrowMode"
:entry-filter-index="entryFilterIndex" :entry-filter-index="entryFilterIndex"
:filter-tab-index="filterTabIndex" :filter-tab-index="filterTabIndex"
:submitted-result-tab-index="submittedResultTabIndex" :list-sub-tab-index="listSubTabIndex"
:reception-filter-narrow-mode="receptionFilterNarrowMode"
:reception-list-has-more="receptionListHasMore"
:reception-list-loading-more="receptionListLoadingMore"
:reception-record-list="receptionRecordList"
:review-tab-index="reviewTabIndex" :review-tab-index="reviewTabIndex"
:sticky-header="isLandscape"
:submitted-result-tab-index="submittedResultTabIndex"
:unsubmitted-pending-tab-index="unsubmittedPendingTabIndex" :unsubmitted-pending-tab-index="unsubmittedPendingTabIndex"
:customer-list="customerList"
:reception-record-list="receptionRecordList"
:customer-list-loading-more="customerListLoadingMore"
:customer-list-has-more="customerListHasMore"
:reception-list-loading-more="receptionListLoadingMore"
:reception-list-has-more="receptionListHasMore"
@scroll-lower="onListScrollToLower"
@switch-list-sub-tab="switchListSubTab"
@switch-entry-filter-tab="switchEntryFilterTab"
@switch-filter-tab="switchFilterTab"
@open-submitted-result-picker="openSubmittedResultPicker"
@open-review-picker="openReviewPicker"
@switch-unsubmitted-pending-tab="switchUnsubmittedPendingTab"
@customer-entry-click="onCustomerEntryClick" @customer-entry-click="onCustomerEntryClick"
@entry-click="onListCustomerEntryClick" @entry-click="onListCustomerEntryClick"
@entry-edit="onListCustomerEntryEdit"
@entry-delete="onListCustomerEntryDelete" @entry-delete="onListCustomerEntryDelete"
@entry-edit="onListCustomerEntryEdit"
@open-review-picker="openReviewPicker"
@open-submitted-result-picker="openSubmittedResultPicker"
@reception-click="onReceptionCardClick" @reception-click="onReceptionCardClick"
/> @scroll-lower="onListScrollToLower"
@switch-entry-filter-tab="switchEntryFilterTab"
@switch-filter-tab="switchFilterTab"
@switch-list-sub-tab="switchListSubTab"
@switch-unsubmitted-pending-tab="switchUnsubmittedPendingTab" />
</view> </view>
</view> </view>
</view> </view>
<!-- 全局弹窗 --> <!-- 全局弹窗 -->
<un-picker :show="show" :columns="columns" @close="onClose" @cancel="onClose" @confirm="onConfirm" /> <un-picker :columns="columns"
<un-picker :show="show"
:key="submittedResultPickerLayerKey" @cancel="onClose"
:show="showSubmittedResultPicker" @close="onClose"
@confirm="onConfirm" />
<un-picker :key="submittedResultPickerLayerKey"
:columns="submittedResultPickerColumns" :columns="submittedResultPickerColumns"
:default-index="submittedResultPickerDefaultIndex" :default-index="submittedResultPickerDefaultIndex"
@close="onSubmittedResultPickerClose" :show="showSubmittedResultPicker"
@cancel="onSubmittedResultPickerClose" @cancel="onSubmittedResultPickerClose"
@confirm="onSubmittedResultPickerConfirm" @close="onSubmittedResultPickerClose"
/> @confirm="onSubmittedResultPickerConfirm" />
<un-picker <un-picker :key="reviewPickerLayerKey"
:key="reviewPickerLayerKey"
:show="showReviewPicker"
:columns="reviewPickerColumns" :columns="reviewPickerColumns"
:default-index="reviewPickerDefaultIndex" :default-index="reviewPickerDefaultIndex"
@close="onReviewPickerClose" :show="showReviewPicker"
@cancel="onReviewPickerClose" @cancel="onReviewPickerClose"
@confirm="onReviewPickerConfirm" @close="onReviewPickerClose"
/> @confirm="onReviewPickerConfirm" />
<!-- 客户录入列表 → 客户档案(FormDetail) --> <!-- 客户录入列表 → 客户档案(FormDetail) -->
<view v-if="showCustomerFormDetail" class="form-detail-inner"> <view v-if="showCustomerFormDetail" class="form-detail-inner">
<FormDetail <FormDetail :detail="customerFormDetailItem"
:show="showCustomerFormDetail" :show="showCustomerFormDetail"
:detail="customerFormDetailItem" @close="onCustomerFormDetailClose" />
@close="onCustomerFormDetailClose"
/>
</view> </view>
<!-- 接待复盘列表 → 接待详情(receptionDetail) --> <!-- 接待复盘列表 → 接待详情(receptionDetail) -->
<view v-if="showReceptionRecordDetail" class="form-detail-inner"> <view v-if="showReceptionRecordDetail" class="form-detail-inner">
...@@ -182,48 +167,37 @@ ...@@ -182,48 +167,37 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
// 接待中心 Tab 聚合页 import { type ComponentPublicInstance, type Ref, computed, onMounted, onResize, onUnmounted, ref, watch } from "vue";
import { ref, computed, onMounted, onUnmounted, watch, onResize, type Ref, type ComponentPublicInstance } from 'vue' import { type UnPickerColumn, type UnPickerColumnItem, type UnPickerConfirmEvent, type UnTabItem } from "@/uni_modules/uview-unix";
import SceneShell from '@/components/HomeFrame/SceneShell.uvue' import { getCustomerFileList, getMerchantPerformance, getReceptionList } from "@/api/receiption.uts";
import { type UnPickerColumn, type UnPickerColumnItem, type UnPickerConfirmEvent, type UnTabItem } from '@/uni_modules/uview-unix' import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import FormDetail from './forms/FormDetail.uvue'
import ReceptionDetail from './receptionDetail.uvue'
import ReceptionDashboardTab from './tabs/ReceptionDashboardTab.uvue'
import ReceptionCustomerListTab from './tabs/ReceptionCustomerListTab.uvue'
import type { CompareRow, OutputSummary } from './types/reception-output-types.uts'
import { getStr, getNum, getTs, getCurrentMonthRange, getTodayDayRangeStrings, getMockPerformanceData, isPerformanceDataEmpty, resolveHasMore, mergeByKey } from './types/reception-center-helpers.uts'
import { getMerchantPerformance, getCustomerFileList, getReceptionList } from '@/api/receiption.uts'
import { storage } from '@/utils/storage.uts'
import { resolutionState } from '@/services/adapter/index.uts'
import { cssClassRef } from "@/services/adapter"; import { cssClassRef } from "@/services/adapter";
import { updateOrientation, useOrientation } from '@/services/adapter/hooks/index.uts' import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts";
// 导入样式变量 import { storage } from "@/utils/storage.uts";
import { import FormDetail from "./forms/FormDetail.uvue";
getPortraitConfig, import ReceptionDetail from "./receptionDetail.uvue";
getReceptionPortraitMainTabsConfig, import pageVars from "./styles/index.vars";
type ReceptionPortraitMainTabsConfig import { getReceptionPortraitMainTabsConfig, type ReceptionPortraitMainTabsConfig } from "./styles/portrait.uts";
} from "./styles/portrait.uts"; import ReceptionCustomerListTab from "./tabs/ReceptionCustomerListTab.uvue";
import pageVars from './styles/index.vars' import ReceptionDashboardTab from "./tabs/ReceptionDashboardTab.uvue";
import { getCurrentMonthRange, getMockPerformanceData, getNum, getStr, getTodayDayRangeStrings, mergeByKey, resolveHasMore } from "./types/reception-center-helpers.uts";
const shellRef = ref(null) import type { CompareRow, OutputSummary } from "./types/reception-output-types.uts";
const shellRef = ref(null);
onShow(() => { onShow(() => {
// 页面每次「显示」时,让外壳组件从本地缓存里刷新用户信息。
if (shellRef.value != null) { if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod('updateApp') (shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
} }
}) });
const isPortrait768x1174 = computed((): boolean => { const isPortrait768x1174 = computed((): boolean => {
// 仅在 768x1174 分辨率(竖屏适配类名)下展示顶部安全区占位 // 仅在 768x1174 分辨率(竖屏适配类名)下展示顶部安全区占位
return cssClassRef.value.indexOf('layout-portrait-768x1174') >= 0 return cssClassRef.value.indexOf("layout-portrait-768x1174") >= 0;
}) });
const receptionOrientationHook = useOrientation();
/** useOrientation 全局状态,配合 updateOrientation 在 onMounted / onResize 刷新后展示 */
const receptionOrientationHook = useOrientation()
const hookOrientation = computed((): string => { const hookOrientation = computed((): string => {
return (receptionOrientationHook.orientationKey as Ref<string>).value return (receptionOrientationHook.orientationKey as Ref<string>).value;
}) });
/** /**
* 固定页面可用高度,避免出现“整页上下滑 + 内部列表滚动”的双滚动/溢出问题。 * 固定页面可用高度,避免出现“整页上下滑 + 内部列表滚动”的双滚动/溢出问题。
* 说明: * 说明:
...@@ -232,138 +206,119 @@ const hookOrientation = computed((): string => { ...@@ -232,138 +206,119 @@ const hookOrientation = computed((): string => {
* - 内容区继续用 flex 布局分配剩余高度(Tabs 固定、内容自适应) * - 内容区继续用 flex 布局分配剩余高度(Tabs 固定、内容自适应)
*/ */
const receptionShellPageStyle = computed((): UTSJSONObject => { const receptionShellPageStyle = computed((): UTSJSONObject => {
const h = (receptionOrientationHook.windowHeight as Ref<number>).value const h = (receptionOrientationHook.windowHeight as Ref<number>).value;
if (h > 0) { if (h > 0) {
return { return {
width: '100%', width: "100%",
height: `${h}px`, height: `${h}px`,
overflow: 'hidden' overflow: "hidden"
} as UTSJSONObject } as UTSJSONObject;
} }
return { return {
width: '100%', width: "100%",
height: '100%', height: "100%",
overflow: 'hidden' overflow: "hidden"
} as UTSJSONObject } as UTSJSONObject;
}) });
// ========== Tab 管理 ========== // ========== Tab 管理 ==========
/** 主 Tab:0=业绩看板,1=客户列表 */ /** 主 Tab:0=业绩看板,1=客户列表 */
const mainTabIndex = ref(0) const mainTabIndex = ref(0);
const mainTabs: UnTabItem[] = [ const mainTabs: UnTabItem[] = [
{ name: '业绩看板' } as UnTabItem, { name: "业绩看板" } as UnTabItem,
{ name: '客户列表' } as UnTabItem { name: "客户列表" } as UnTabItem
] ];
// 动态样式 - 根据分辨率返回不同的样式
// 动态样式 - 根据分辨率返回不同的样式
const dynamicModuleBoxStyle = computed((): any => {
// 使用 cssClassRef.value 确保响应式
const adapterCls = cssClassRef.value;
if (adapterCls.indexOf('layout-portrait-768x1174') >= 0) {
const cfg = getPortraitConfig(adapterCls)
return cfg != null ? ({ ...cfg } as UTSJSONObject) : ({} as UTSJSONObject);
}
// computed 返回值不能为 null(UTS 中 Any? -> Any 会触发类型不匹配)
return {} as UTSJSONObject;
});
/** 仅 layout-portrait-768x1174 有值;其它分辨率为 null,主 Tab 保持模板 + scss 原样式 */ /** 仅 layout-portrait-768x1174 有值;其它分辨率为 null,主 Tab 保持模板 + scss 原样式 */
const receptionPortraitMainTabsOverride = computed((): null | ReceptionPortraitMainTabsConfig => { const receptionPortraitMainTabsOverride = computed((): null | ReceptionPortraitMainTabsConfig => {
return getReceptionPortraitMainTabsConfig(cssClassRef.value) return getReceptionPortraitMainTabsConfig(cssClassRef.value);
}) });
const receptionTabsContainerStyle = computed((): UTSJSONObject => { const receptionTabsContainerStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value const c = receptionPortraitMainTabsOverride.value;
if (c == null) { if (c == null) {
return {} as UTSJSONObject return {} as UTSJSONObject;
} }
return { return {
padding: c.containerPadding, padding: c.containerPadding,
// 仅 768x1174 竖屏需要额外顶距,其它分辨率强制为 0(避免顶部出现多余空隙) marginTop: "30px",
marginTop: '30px', } as UTSJSONObject;
} as UTSJSONObject });
})
const receptionMainTabsShellStyle = computed((): UTSJSONObject => { const receptionMainTabsShellStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value const c = receptionPortraitMainTabsOverride.value;
if (c == null) { if (c == null) {
return {} as UTSJSONObject return {} as UTSJSONObject;
} }
return { return {
padding: c.mainTabsPadding, padding: c.mainTabsPadding,
borderRadius: c.mainTabsBorderRadius, borderRadius: c.mainTabsBorderRadius,
boxShadow: c.mainTabsBoxShadow boxShadow: c.mainTabsBoxShadow
} as UTSJSONObject } as UTSJSONObject;
}) });
const mainTabBarHeight = computed((): number => { const mainTabBarHeight = computed((): number => {
const c = receptionPortraitMainTabsOverride.value const c = receptionPortraitMainTabsOverride.value;
return c != null ? c.height : 52 return c != null ? c.height : 52;
}) });
const mainTabLineWidth = computed((): number => { const mainTabLineWidth = computed((): number => {
const c = receptionPortraitMainTabsOverride.value const c = receptionPortraitMainTabsOverride.value;
return c != null ? c.lineWidth : 42 return c != null ? c.lineWidth : 42;
}) });
const mainTabLineHeight = computed((): number => { const mainTabLineHeight = computed((): number => {
const c = receptionPortraitMainTabsOverride.value const c = receptionPortraitMainTabsOverride.value;
return c != null ? c.lineHeight : 4 return c != null ? c.lineHeight : 4;
}) });
const mainTabActiveStyle = computed((): UTSJSONObject => { const mainTabActiveStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value const c = receptionPortraitMainTabsOverride.value;
if (c == null) { if (c == null) {
return { return {
color: '#1677ff', color: "#1677ff",
fontWeight: 700, fontWeight: 700,
fontSize: '17px' fontSize: "17px"
} as UTSJSONObject } as UTSJSONObject;
} }
return { return {
color: '#1677ff', color: "#1677ff",
fontWeight: 700, fontWeight: 700,
fontSize: c.activeFontSize fontSize: c.activeFontSize
} as UTSJSONObject } as UTSJSONObject;
}) });
const mainTabInactiveStyle = computed((): UTSJSONObject => { const mainTabInactiveStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value const c = receptionPortraitMainTabsOverride.value;
if (c == null) { if (c == null) {
return { return {
color: '#94a3b8', color: "#94a3b8",
fontWeight: 500, fontWeight: 500,
fontSize: '15px' fontSize: "15px"
} as UTSJSONObject } as UTSJSONObject;
} }
return { return {
color: '#94a3b8', color: "#94a3b8",
fontWeight: 400, fontWeight: 400,
fontSize: c.inactiveFontSize fontSize: c.inactiveFontSize
} as UTSJSONObject } as UTSJSONObject;
}) });
const mainTabItemStyle = computed((): UTSJSONObject => { const mainTabItemStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value const c = receptionPortraitMainTabsOverride.value;
if (c == null) { if (c == null) {
return { return {
paddingLeft: '18px', paddingLeft: "18px",
paddingRight: '18px' paddingRight: "18px"
} as UTSJSONObject } as UTSJSONObject;
} }
return { return {
paddingLeft: c.itemPaddingLeft, paddingLeft: c.itemPaddingLeft,
paddingRight: c.itemPaddingRight, paddingRight: c.itemPaddingRight,
paddingBottom: c.itemPaddingBottom paddingBottom: c.itemPaddingBottom
} as UTSJSONObject } as UTSJSONObject;
}) });
/** 客户列表下的二级 Tab:0=客户录入,1=接待复盘(原 rightTabIndex) */ /** 客户列表下的二级 Tab:0=客户录入,1=接待复盘(原 rightTabIndex) */
const listSubTabIndex = ref(0) const listSubTabIndex = ref(0);
// 产值卡片 tabs:0=本月交付转化率,1=本月交付客单价 // 产值卡片 tabs:0=本月交付转化率,1=本月交付客单价
const outputTabIndex = ref(0); const outputTabIndex = ref(0);
...@@ -378,7 +333,7 @@ const entryFilterIndex = ref(0); ...@@ -378,7 +333,7 @@ const entryFilterIndex = ref(0);
const submittedResultTabIndex = ref(0); const submittedResultTabIndex = ref(0);
// 未提交下子 tabs:0=待上传,1=待提交(当前与列表参数同样映射到 orderFinishFlag,若后端字段不同再拆参) // 未提交下子 tabs:0=待上传,1=待提交(当前与列表参数同样映射到 orderFinishFlag,若后端字段不同再拆参)
const unsubmittedPendingTabIndex = ref(0); const unsubmittedPendingTabIndex = ref(0);
const reviewTabIndex = ref(0) const reviewTabIndex = ref(0);
// Tab 数据结构 // Tab 数据结构
type OutputTabData = { type OutputTabData = {
...@@ -387,140 +342,140 @@ type OutputTabData = { ...@@ -387,140 +342,140 @@ type OutputTabData = {
} }
// 业绩数据(需在使用前声明,UTS 不支持变量提升) // 业绩数据(需在使用前声明,UTS 不支持变量提升)
const performanceData = ref<UTSJSONObject>({}) const performanceData = ref<UTSJSONObject>({});
// 时间进度:按「当月日期 / 当月天数」换算为百分比 // 时间进度:按「当月日期 / 当月天数」换算为百分比
const timeProgress = ref<number>(0) const timeProgress = ref<number>(0);
function setTimeProgress(): void { function setTimeProgress(): void {
// e.g. 2026-03-30 => 30 / 31 => 97% // e.g. 2026-03-30 => 30 / 31 => 97%
const now = new Date() const now = new Date();
const nowNum = now.getDate() const nowNum = now.getDate();
// 通过“下个月第 0 天”拿到“本月最后一天”,从而得到当月天数 // 通过“下个月第 0 天”拿到“本月最后一天”,从而得到当月天数
const monthDayNum = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate() const monthDayNum = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate();
timeProgress.value = monthDayNum > 0 ? Math.round(nowNum / monthDayNum * 100) : 0 timeProgress.value = monthDayNum > 0 ? Math.round(nowNum / monthDayNum * 100) : 0;
} }
// 页面首次渲染也要有值(避免首帧出现 0% 闪烁) // 页面首次渲染也要有值(避免首帧出现 0% 闪烁)
setTimeProgress() setTimeProgress();
const timeProgressPercent = computed((): number => { const timeProgressPercent = computed((): number => {
// 防御性 clamp:确保 width 与文本不会出现异常值 // 防御性 clamp:确保 width 与文本不会出现异常值
if (timeProgress.value < 0) { return 0 } if (timeProgress.value < 0) { return 0; }
if (timeProgress.value > 100) { return 100 } if (timeProgress.value > 100) { return 100; }
return timeProgress.value return timeProgress.value;
}) });
// 当前 tab 数据:由 outputTabIndex 与 performanceData 驱动 // 当前 tab 数据:由 outputTabIndex 与 performanceData 驱动
// Tab0=本月交付转化率:展示率(excellentStoreAvgDealRate/thisStoreDealRate/personalDealRate) // Tab0=本月交付转化率:展示率(excellentStoreAvgDealRate/thisStoreDealRate/personalDealRate)
// Tab1=本月交付客单价:展示额(excellentStoreAvgDeal/thisStoreKdj/personalKdj) // Tab1=本月交付客单价:展示额(excellentStoreAvgDeal/thisStoreKdj/personalKdj)
const currentOutputTab = computed((): OutputTabData => { const currentOutputTab = computed((): OutputTabData => {
const d = performanceData.value const d = performanceData.value;
const idx = outputTabIndex.value const idx = outputTabIndex.value;
// 转化率:当前值即百分比(0-100),宽度 = 当前值/100 换算为百分比展示,即 value% // 转化率:当前值即百分比(0-100),宽度 = 当前值/100 换算为百分比展示,即 value%
const toRatePct = (x: number): string => Math.min(100, x).toFixed(1) + '%' const toRatePct = (x: number): string => `${Math.min(100, x).toFixed(1) }%`;
const tab0: OutputTabData = { const tab0: OutputTabData = {
compareRows: [ compareRows: [
{ label: '优秀门店均值', barWidthPercent: toRatePct(getNum(d, 'excellentStoreAvgDealRate')), barClass: 'bg-blue-500', value: getNum(d, 'excellentStoreAvgDealRate').toFixed(1) + '%' }, { label: "优秀门店均值", barWidthPercent: toRatePct(getNum(d, "excellentStoreAvgDealRate")), barClass: "bg-blue-500", value: `${getNum(d, "excellentStoreAvgDealRate").toFixed(1) }%` },
{ label: '本门店', barWidthPercent: toRatePct(getNum(d, 'thisStoreDealRate')), barClass: 'bg-blue-400', value: getNum(d, 'thisStoreDealRate').toFixed(1) + '%' }, { label: "本门店", barWidthPercent: toRatePct(getNum(d, "thisStoreDealRate")), barClass: "bg-blue-400", value: `${getNum(d, "thisStoreDealRate").toFixed(1) }%` },
{ label: '个人', barWidthPercent: toRatePct(getNum(d, 'personalDealRate')), barClass: 'bg-blue-400', value: getNum(d, 'personalDealRate').toFixed(1) + '%' } { label: "个人", barWidthPercent: toRatePct(getNum(d, "personalDealRate")), barClass: "bg-blue-400", value: `${getNum(d, "personalDealRate").toFixed(1) }%` }
], ],
summary: { summary: {
summaryLabel: '实际产值', summaryLabel: "实际产值",
summaryValueNum: getNum(d, 'actualProduction').toFixed(1), summaryValueNum: getNum(d, "actualProduction").toFixed(1),
summaryValueUnit: '万', summaryValueUnit: "万",
personalLabel: '个人产值', personalLabel: "个人产值",
personalValue: getNum(d, 'personalProduction').toFixed(1) + '万', personalValue: `${getNum(d, "personalProduction").toFixed(1) }万`,
ringPercent: getNum(d, 'achievementRatio').toFixed(1) + '%', ringPercent: `${getNum(d, "achievementRatio").toFixed(1) }%`,
ringLabel: '达成率', ringLabel: "达成率",
ringPercentNum: Math.min(100, getNum(d, 'achievementRatio')), ringPercentNum: Math.min(100, getNum(d, "achievementRatio")),
ringComparePercent: 100 ringComparePercent: 100
} }
} };
const eAvg = getNum(d, 'excellentStoreAvgDeal') const eAvg = getNum(d, "excellentStoreAvgDeal");
const thisVal = getNum(d, 'thisStoreKdj') const thisVal = getNum(d, "thisStoreKdj");
const perVal = getNum(d, 'personalKdj') const perVal = getNum(d, "personalKdj");
// 客单价:以最大值为100%基准,当前值/最大值*100 换算展示 // 客单价:以最大值为100%基准,当前值/最大值*100 换算展示
const maxDeal = eAvg > thisVal ? (eAvg > perVal ? eAvg : perVal) : (thisVal > perVal ? thisVal : perVal) const maxDeal = eAvg > thisVal ? (Math.max(eAvg, perVal)) : (Math.max(thisVal, perVal));
const toDealPct = (x: number): string => (maxDeal > 0 ? (x / maxDeal * 100) : 0).toFixed(1) + '%' const toDealPct = (x: number): string => `${(maxDeal > 0 ? (x / maxDeal * 100) : 0).toFixed(1) }%`;
const tab1: OutputTabData = { const tab1: OutputTabData = {
compareRows: [ compareRows: [
{ label: '优秀门店均值', barWidthPercent: toDealPct(eAvg), barClass: 'bg-blue-500', value: '¥' + Math.round(eAvg) }, { label: "优秀门店均值", barWidthPercent: toDealPct(eAvg), barClass: "bg-blue-500", value: `¥${ Math.round(eAvg)}` },
{ label: '本门店', barWidthPercent: toDealPct(thisVal), barClass: 'bg-blue-400', value: '¥' + Math.round(thisVal) }, { label: "本门店", barWidthPercent: toDealPct(thisVal), barClass: "bg-blue-400", value: `¥${ Math.round(thisVal)}` },
{ label: '个人', barWidthPercent: toDealPct(perVal), barClass: 'bg-blue-400', value: '¥' + Math.round(perVal) } { label: "个人", barWidthPercent: toDealPct(perVal), barClass: "bg-blue-400", value: `¥${ Math.round(perVal)}` }
], ],
summary: { summary: {
summaryLabel: '实际产值', summaryLabel: "实际产值",
summaryValueNum: getNum(d, 'actualProduction').toFixed(1), summaryValueNum: getNum(d, "actualProduction").toFixed(1),
summaryValueUnit: '万', summaryValueUnit: "万",
personalLabel: '个人产值', personalLabel: "个人产值",
personalValue: getNum(d, 'personalProduction').toFixed(1) + '万', personalValue: `${getNum(d, "personalProduction").toFixed(1) }万`,
ringPercent: getNum(d, 'achievementRatio').toFixed(1) + '%', ringPercent: `${getNum(d, "achievementRatio").toFixed(1) }%`,
ringLabel: '达成率', ringLabel: "达成率",
ringPercentNum: Math.min(100, getNum(d, 'achievementRatio')), ringPercentNum: Math.min(100, getNum(d, "achievementRatio")),
ringComparePercent: 100 ringComparePercent: 100
} }
} };
if (idx == 1) { return tab1 } if (idx == 1) { return tab1; }
return tab0 return tab0;
}) });
/** 本月产值卡片底部:目标产值展示(有接口字段则用数据,否则保留占位) */ /** 本月产值卡片底部:目标产值展示(有接口字段则用数据,否则保留占位) */
const monthValueTargetText = computed((): string => { const monthValueTargetText = computed((): string => {
const d = performanceData.value const d = performanceData.value;
const v = getNum(d, 'targetProduction') const v = getNum(d, "targetProduction");
if (v > 0) { if (v > 0) {
return v.toFixed(0) + '万' return `${v.toFixed(0) }万`;
} }
return '-' return "-";
}) });
/** 本月产值卡片底部:达成比例(有接口字段则用数据,否则保留占位) */ /** 本月产值卡片底部:达成比例(有接口字段则用数据,否则保留占位) */
const monthValueAchievementText = computed((): string => { const monthValueAchievementText = computed((): string => {
const d = performanceData.value const d = performanceData.value;
const v = getNum(d, 'productionContribution') const v = getNum(d, "productionContribution");
if (v > 0) { if (v > 0) {
return v.toFixed(0) + '%' return `${v.toFixed(0) }%`;
} }
return '-' return "-";
}) });
// 客户档案列表(客户录入 Tab,接口 dj.api.smartcarlife.customervisits.customerInfoPage) // 客户档案列表(客户录入 Tab,接口 dj.api.smartcarlife.customervisits.customerInfoPage)
const customerList = ref<UTSJSONObject[]>([]) const customerList = ref<UTSJSONObject[]>([]);
// 接待复盘列表(接待复盘 Tab,接口 dj.api.smartcarlife.reception.customer.page) // 接待复盘列表(接待复盘 Tab,接口 dj.api.smartcarlife.reception.customer.page)
const receptionRecordList = ref<UTSJSONObject[]>([]) const receptionRecordList = ref<UTSJSONObject[]>([]);
/** 客户档案分页(customerInfoPage) */ /** 客户档案分页(customerInfoPage) */
const CUSTOMER_FILE_PAGE_SIZE = 10 const CUSTOMER_FILE_PAGE_SIZE = 10;
const customerFilePageNum = ref(1) const customerFilePageNum = ref(1);
/** 客户录入列表:触底加载更多 */ /** 客户录入列表:触底加载更多 */
const customerListLoadingMore = ref(false) const customerListLoadingMore = ref(false);
const customerListHasMore = ref(true) const customerListHasMore = ref(true);
/** 接待复盘分页(reception.customer.page) */ /** 接待复盘分页(reception.customer.page) */
const RECEPTION_PAGE_SIZE = 10 const RECEPTION_PAGE_SIZE = 10;
const receptionPageNum = ref(1) const receptionPageNum = ref(1);
const receptionListLoadingMore = ref(false) const receptionListLoadingMore = ref(false);
const receptionListHasMore = ref(true) const receptionListHasMore = ref(true);
const show = ref(false) const show = ref(false);
/** 已提交:战败/成交下拉 */ /** 已提交:战败/成交下拉 */
const showSubmittedResultPicker = ref(false) const showSubmittedResultPicker = ref(false);
/** 每次打开战败/成交选择器递增,保证 default-index 作用到滚轮 */ /** 每次打开战败/成交选择器递增,保证 default-index 作用到滚轮 */
const submittedResultPickerLayerKey = ref(0) const submittedResultPickerLayerKey = ref(0);
/** 已提交:未复盘/复盘下拉 */ /** 已提交:未复盘/复盘下拉 */
const showReviewPicker = ref(false) const showReviewPicker = ref(false);
/** 每次打开复盘选择器递增,保证 default-index 一定作用到滚轮(避免仅首次挂载生效) */ /** 每次打开复盘选择器递增,保证 default-index 一定作用到滚轮(避免仅首次挂载生效) */
const reviewPickerLayerKey = ref(0) const reviewPickerLayerKey = ref(0);
/** 右侧筛选区窄屏适配:避免 segmented 最小宽度导致横向溢出 */ /** 右侧筛选区窄屏适配:避免 segmented 最小宽度导致横向溢出 */
const receptionFilterNarrowMode = ref(false) const receptionFilterNarrowMode = ref(false);
/** uni-app x UTS 当前编译目标不支持 uni.onWindowResize,用定时轮询窗口尺寸以响应旋转 */ /** uni-app x UTS 当前编译目标不支持 uni.onWindowResize,用定时轮询窗口尺寸以响应旋转 */
let receptionDashboardLayoutPollId: number | null = null const receptionDashboardLayoutPollId: null | number = null;
const RECEPTION_LAYOUT_POLL_MS = 400 const RECEPTION_LAYOUT_POLL_MS = 400;
/** 是否横屏:与 orientationKey / hookOrientation 同源(useOrientation 的 isPortrait),保持 computed 随 updateOrientation 更新 */ /** 是否横屏:与 orientationKey / hookOrientation 同源(useOrientation 的 isPortrait),保持 computed 随 updateOrientation 更新 */
const isLandscape = computed((): boolean => { const isLandscape = computed((): boolean => {
return (receptionOrientationHook.isPortrait as Ref<boolean>).value != true return (receptionOrientationHook.isPortrait as Ref<boolean>).value != true;
}) });
/** 记录上一次打印过的方向,避免轮询期间刷屏 */ /** 记录上一次打印过的方向,避免轮询期间刷屏 */
let lastOrientationLogLandscape: boolean | null = null let lastOrientationLogLandscape: boolean | null = null;
function syncReceptionDashboardLayout(): void { function syncReceptionDashboardLayout(): void {
/** /**
...@@ -532,136 +487,134 @@ function syncReceptionDashboardLayout(): void { ...@@ -532,136 +487,134 @@ function syncReceptionDashboardLayout(): void {
* - uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,因此通过定时轮询触发同步 * - uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,因此通过定时轮询触发同步
* - 部分机型旋转后 getWindowInfo 的 windowWidth/windowHeight 刷新可能滞后,这里优先用 systemInfo 的 screenWidth/screenHeight 做兜底 * - 部分机型旋转后 getWindowInfo 的 windowWidth/windowHeight 刷新可能滞后,这里优先用 systemInfo 的 screenWidth/screenHeight 做兜底
*/ */
updateOrientation() updateOrientation();
// 必须用 uni.getWindowInfo():uview-unix 的 getWindowInfo 在 Android 上返回 GetWindowInfoResult,不能 as UTSJSONObject // 必须用 uni.getWindowInfo():uview-unix 的 getWindowInfo 在 Android 上返回 GetWindowInfoResult,不能 as UTSJSONObject
const info = uni.getWindowInfo() const info = uni.getWindowInfo();
// 宽高优先取 systemInfo(部分机型旋转后 getWindowInfo 可能刷新不及时) // 宽高优先取 systemInfo(部分机型旋转后 getWindowInfo 可能刷新不及时)
const sys = uni.getSystemInfoSync() const sys = uni.getSystemInfoSync();
const sysSw = sys.screenWidth const sysSw = sys.screenWidth;
const sysSh = sys.screenHeight const sysSh = sys.screenHeight;
const ww = info.windowWidth const ww = info.windowWidth;
const wh = info.windowHeight const wh = info.windowHeight;
const sw = info.screenWidth const sw = info.screenWidth;
const sh = info.screenHeight const sh = info.screenHeight;
// 横屏判定:宽 > 高。取值优先级:systemInfo.screen* -> windowInfo.screen* -> windowInfo.window* // 横屏判定:宽 > 高。取值优先级:systemInfo.screen* -> windowInfo.screen* -> windowInfo.window*
const w = sysSw > 0 ? sysSw : (sw > 0 ? sw : ww) const w = sysSw > 0 ? sysSw : (sw > 0 ? sw : ww);
const h = sysSh > 0 ? sysSh : (sh > 0 ? sh : wh) const h = sysSh > 0 ? sysSh : (sh > 0 ? sh : wh);
if (lastOrientationLogLandscape == null || lastOrientationLogLandscape != isLandscape.value) { if (lastOrientationLogLandscape == null || lastOrientationLogLandscape != isLandscape.value) {
lastOrientationLogLandscape = isLandscape.value lastOrientationLogLandscape = isLandscape.value;
console.log( console.log(
`[ReceptionCenter] 屏幕方向变化:${isLandscape.value ? '横屏' : '竖屏'}(w=${w}, h=${h}, window=${ww}x${wh}, screen=${sw}x${sh})` `[ReceptionCenter] 屏幕方向变化:${isLandscape.value ? "横屏" : "竖屏"}(w=${w}, h=${h}, window=${ww}x${wh}, screen=${sw}x${sh})`
) );
} }
console.log('[ReceptionCenter] syncReceptionDashboardLayout'); console.log("[ReceptionCenter] syncReceptionDashboardLayout");
// 横屏窄宽适配:避免右侧筛选区控件(如 segmented)在小于阈值时出现横向溢出 // 横屏窄宽适配:避免右侧筛选区控件(如 segmented)在小于阈值时出现横向溢出
const RECEPTION_FILTER_NARROW_WIDTH = 920 const RECEPTION_FILTER_NARROW_WIDTH = 920;
const nextFilterNarrowMode = isLandscape.value && w > 0 && w < RECEPTION_FILTER_NARROW_WIDTH const nextFilterNarrowMode = isLandscape.value && w > 0 && w < RECEPTION_FILTER_NARROW_WIDTH;
if (receptionFilterNarrowMode.value != nextFilterNarrowMode) { if (receptionFilterNarrowMode.value != nextFilterNarrowMode) {
receptionFilterNarrowMode.value = nextFilterNarrowMode receptionFilterNarrowMode.value = nextFilterNarrowMode;
} }
} }
let getPerformanceDataImpl: () => Promise<void> = async (): Promise<void> => {} let getPerformanceDataImpl: () => Promise<void> = async (): Promise<void> => {};
let getCustomerListImpl: (append: boolean) => Promise<void> = async (_append: boolean): Promise<void> => {} let getCustomerListImpl: (append: boolean) => Promise<void> = async (_append: boolean): Promise<void> => {};
let getReceptionRecordListImpl: (append: boolean) => Promise<void> = async (_append: boolean): Promise<void> => {} let getReceptionRecordListImpl: (append: boolean) => Promise<void> = async (_append: boolean): Promise<void> => {};
// onResize 回调可能在窗口尺寸变化过程中高频触发,这里做一次去重,避免控制台刷屏 // onResize 回调可能在窗口尺寸变化过程中高频触发,这里做一次去重,避免控制台刷屏
let lastOnResizeWidth: number | null = null let lastOnResizeWidth: null | number = null;
let lastOnResizeHeight: number | null = null let lastOnResizeHeight: null | number = null;
onResize((res: any) => { onResize((res: any) => {
// 1) 直接打印回调参数(满足“打印返回参数”的需求) // 1) 直接打印回调参数(满足“打印返回参数”的需求)
console.log('[ReceptionCenter][onResize] res =', res) console.log("[ReceptionCenter][onResize] res =", res);
// 2) 尝试从回调中提取 width/height 做去重(字段结构在不同端可能不同,必须防御性处理) // 2) 尝试从回调中提取 width/height 做去重(字段结构在不同端可能不同,必须防御性处理)
let w: number | null = null let w: null | number = null;
let h: number | null = null let h: null | number = null;
const obj = res as UTSJSONObject const obj = res as UTSJSONObject;
const sizeRaw = obj['size'] const sizeRaw = obj.size;
if (sizeRaw != null) { if (sizeRaw != null) {
const sizeObj = sizeRaw as UTSJSONObject const sizeObj = sizeRaw as UTSJSONObject;
const ww = sizeObj['windowWidth'] const ww = sizeObj.windowWidth;
const wh = sizeObj['windowHeight'] const wh = sizeObj.windowHeight;
if (typeof ww === 'number') { w = ww } if (typeof ww === "number") { w = ww; }
if (typeof wh === 'number') { h = wh } if (typeof wh === "number") { h = wh; }
} else { } else {
const ww = obj['windowWidth'] const ww = obj.windowWidth;
const wh = obj['windowHeight'] const wh = obj.windowHeight;
if (typeof ww === 'number') { w = ww } if (typeof ww === "number") { w = ww; }
if (typeof wh === 'number') { h = wh } if (typeof wh === "number") { h = wh; }
} }
if (w != null && h != null) { if (w != null && h != null && (lastOnResizeWidth != w || lastOnResizeHeight != h)) {
if (lastOnResizeWidth != w || lastOnResizeHeight != h) { lastOnResizeWidth = w;
lastOnResizeWidth = w lastOnResizeHeight = h;
lastOnResizeHeight = h console.log(`[ReceptionCenter][onResize] size = ${w}x${h}`);
console.log(`[ReceptionCenter][onResize] size = ${w}x${h}`) }
} updateOrientation();
} syncReceptionDashboardLayout();
updateOrientation() });
syncReceptionDashboardLayout()
})
function getPerformanceData(): Promise<void> { function getPerformanceData(): Promise<void> {
return getPerformanceDataImpl() return getPerformanceDataImpl();
} }
function getCustomerList(append: boolean): Promise<void> { function getCustomerList(append: boolean): Promise<void> {
console.log('[ReceptionCenter] 获取客户列表触底加载', append) console.log("[ReceptionCenter] 获取客户列表触底加载", append);
return getCustomerListImpl(append) return getCustomerListImpl(append);
} }
function getReceptionRecordList(append: boolean): Promise<void> { function getReceptionRecordList(append: boolean): Promise<void> {
return getReceptionRecordListImpl(append) return getReceptionRecordListImpl(append);
} }
// ========== Tab 切换事件 ========== // ========== Tab 切换事件 ==========
/** 主 Tab 切换 */ /** 主 Tab 切换 */
function onMainTabChange(e: any): void { function onMainTabChange(e: any): void {
let nextIndex = 0 let nextIndex = 0;
if (typeof e === 'number') { if (typeof e === "number") {
nextIndex = e nextIndex = e;
} else { } else {
const eventObj = e as UTSJSONObject const eventObj = e as UTSJSONObject;
const idx = eventObj['index'] const idx = eventObj.index;
if (idx != null && typeof idx === 'number') { if (idx != null && typeof idx === "number") {
nextIndex = idx nextIndex = idx;
} }
} }
mainTabIndex.value = nextIndex mainTabIndex.value = nextIndex;
console.log('[ReceptionCenter] 主 Tab 切换:', mainTabIndex.value) console.log("[ReceptionCenter] 主 Tab 切换:", mainTabIndex.value);
if (mainTabIndex.value == 0) { if (mainTabIndex.value == 0) {
void getPerformanceData() void getPerformanceData();
} else { } else {
customerFilePageNum.value = 1 customerFilePageNum.value = 1;
receptionPageNum.value = 1 receptionPageNum.value = 1;
if (listSubTabIndex.value == 0) { if (listSubTabIndex.value == 0) {
void getCustomerList(false) void getCustomerList(false);
} else { } else {
void getReceptionRecordList(false) void getReceptionRecordList(false);
} }
} }
} }
function onOutputTabIndexChange(index: number): void { function onOutputTabIndexChange(index: number): void {
console.log('[ReceptionCenter] 产值卡片 Tab 切换:', index) console.log("[ReceptionCenter] 产值卡片 Tab 切换:", index);
outputTabIndex.value = index outputTabIndex.value = index;
} }
/** 客户列表下的二级 Tab 切换 */ /** 客户列表下的二级 Tab 切换 */
function switchListSubTab(index: number): void { function switchListSubTab(index: number): void {
listSubTabIndex.value = index listSubTabIndex.value = index;
console.log('[ReceptionCenter] 列表二级 Tab 切换:', listSubTabIndex.value) console.log("[ReceptionCenter] 列表二级 Tab 切换:", listSubTabIndex.value);
// 重置页码并加载对应列表 // 重置页码并加载对应列表
if (index == 0) { if (index == 0) {
customerFilePageNum.value = 1 customerFilePageNum.value = 1;
void getCustomerList(false) void getCustomerList(false);
} else { } else {
receptionPageNum.value = 1 receptionPageNum.value = 1;
void getReceptionRecordList(false) void getReceptionRecordList(false);
} }
} }
...@@ -670,217 +623,215 @@ function onListScrollToLower(): void { ...@@ -670,217 +623,215 @@ function onListScrollToLower(): void {
// 横屏:左右分栏同时展示「业绩看板 + 客户列表」,此时 mainTabIndex 可能仍为 0 // 横屏:左右分栏同时展示「业绩看板 + 客户列表」,此时 mainTabIndex 可能仍为 0
// 因此触底加载不能依赖 mainTabIndex == 1 的门禁,否则横屏永远不触发加载更多 // 因此触底加载不能依赖 mainTabIndex == 1 的门禁,否则横屏永远不触发加载更多
if (isLandscape.value != true && mainTabIndex.value != 1) { if (isLandscape.value != true && mainTabIndex.value != 1) {
return return;
} }
if (listSubTabIndex.value == 0) { if (listSubTabIndex.value == 0) {
console.log('[ReceptionCenter] 客户列表触底') console.log("[ReceptionCenter] 客户列表触底");
void getCustomerList(true) void getCustomerList(true);
} else { } else {
console.log('[ReceptionCenter] 接待列表触底') console.log("[ReceptionCenter] 接待列表触底");
void getReceptionRecordList(true) void getReceptionRecordList(true);
} }
} }
/** 业绩看板数值是否展示(睁眼可见 / 闭眼隐藏) */ /** 业绩看板数值是否展示(睁眼可见 / 闭眼隐藏) */
const performanceMetricsVisible = ref(true) const performanceMetricsVisible = ref(true);
function togglePerformanceMetricsVisibility(): void { function togglePerformanceMetricsVisibility(): void {
performanceMetricsVisible.value = !performanceMetricsVisible.value performanceMetricsVisible.value = !performanceMetricsVisible.value;
} }
// 客户档案详情(客户录入列表卡片) // 客户档案详情(客户录入列表卡片)
const showCustomerFormDetail = ref(false) const showCustomerFormDetail = ref(false);
const customerFormDetailItem = ref<UTSJSONObject | null>(null) const customerFormDetailItem = ref<null | UTSJSONObject>(null);
// 接待复盘详情(接待列表卡片 → receptionDetail.uvue) // 接待复盘详情(接待列表卡片 → receptionDetail.uvue)
const showReceptionRecordDetail = ref(false) const showReceptionRecordDetail = ref(false);
const receptionRecordItem = ref<UTSJSONObject>({}) const receptionRecordItem = ref<UTSJSONObject>({});
function onReceptionCardClick(item: UTSJSONObject): void { function onReceptionCardClick(item: UTSJSONObject): void {
if (filterTabIndex.value == 0) { if (filterTabIndex.value == 0) {
// 与 FormAdd 打开方式一致:navigateTo + query record(JSON) // 与 FormAdd 打开方式一致:navigateTo + query record(JSON)
uni.navigateTo({ uni.navigateTo({
url: `/pages/receptionCenter/receptionDetail?record=${encodeURIComponent(JSON.stringify(item))}` url: `/pages/receptionCenter/receptionDetail?record=${encodeURIComponent(JSON.stringify(item))}`
}) });
} else { } else {
uni.showToast({ title: '该接待尚不支持复盘', icon: 'none' }) uni.showToast({ title: "该接待尚不支持复盘", icon: "none" });
} }
} }
// 是否使用鸿蒙/问界口径(true=问界/鸿蒙;false=延保/权益) // 是否使用鸿蒙/问界口径(true=问界/鸿蒙;false=延保/权益)
// channelType == 1 => 问界/鸿蒙 // channelType == 1 => 问界/鸿蒙
const isHarmonyValue = ref(false) const isHarmonyValue = ref(false);
type PerformanceTypeItem = { label: string; value: number } type PerformanceTypeItem = { label: string; value: number }
function performanceTypeList(): UnPickerColumn { function performanceTypeList(): UnPickerColumn {
let list: PerformanceTypeItem[] = [] let list: PerformanceTypeItem[] = [];
if (isHarmonyValue.value) { if (isHarmonyValue.value) {
list = [ list = [
{ label: '问界', value: 1 }, { label: "问界", value: 1 },
{ label: '鸿蒙', value: 2 }, { label: "鸿蒙", value: 2 },
] ];
} else { } else {
list = [ list = [
{ label: '延保', value: 1 }, { label: "延保", value: 1 },
{ label: '权益', value: 3 }, { label: "权益", value: 3 },
] ];
} }
// 对象字面量需显式断言为 UnPickerColumnItem,否则 UTS 会推断为 UTSJSONObject // 对象字面量需显式断言为 UnPickerColumnItem,否则 UTS 会推断为 UTSJSONObject
const items: UnPickerColumn = [] const items: UnPickerColumn = [];
let i = 0 let i = 0;
while (i < list.length) { while (i < list.length) {
items.push({ text: list[i].label, value: list[i].value } as UnPickerColumnItem) items.push({ text: list[i].label, value: list[i].value } as UnPickerColumnItem);
i++ i++;
} }
return items return items;
} }
// 选中的类型(默认取当前列表第一项) // 选中的类型(默认取当前列表第一项)
const selectedBrand = ref<string>(performanceTypeList()[0].text) const selectedBrand = ref<string>(performanceTypeList()[0].text);
const selectedBrandValue = ref<number>(performanceTypeList()[0].value as number) const selectedBrandValue = ref<number>(performanceTypeList()[0].value as number);
watch(isHarmonyValue, () => { watch(isHarmonyValue, () => {
// 口径切换时,避免 selectedBrand 仍指向旧列表项 // 口径切换时,避免 selectedBrand 仍指向旧列表项
const items = performanceTypeList() const items = performanceTypeList();
if (items.length > 0) { if (items.length > 0) {
selectedBrand.value = items[0].text selectedBrand.value = items[0].text;
selectedBrandValue.value = items[0].value as number selectedBrandValue.value = items[0].value as number;
} }
}) });
// picker 列 // picker 列
const columns = computed((): UnPickerColumn[] => { const columns = computed((): UnPickerColumn[] => {
return [performanceTypeList()] return [performanceTypeList()];
}) });
/** 战败/成交:与 submittedResultTabIndex 0/1 一致 */ /** 战败/成交:与 submittedResultTabIndex 0/1 一致 */
const submittedResultPickerColumns = computed((): UnPickerColumn[] => { const submittedResultPickerColumns = computed((): UnPickerColumn[] => {
const col: UnPickerColumn = [] const col: UnPickerColumn = [];
col.push({ text: '战败', value: 0 } as UnPickerColumnItem) col.push({ text: "战败", value: 0 } as UnPickerColumnItem, { text: "成交", value: 1 } as UnPickerColumnItem);
col.push({ text: '成交', value: 1 } as UnPickerColumnItem) return [col];
return [col] });
})
/** 打开战败/成交下拉时按当前选中回显(下标与 submittedResultTabIndex 一致) */ /** 打开战败/成交下拉时按当前选中回显(下标与 submittedResultTabIndex 一致) */
const submittedResultPickerDefaultIndex = computed((): number[] => { const submittedResultPickerDefaultIndex = computed((): number[] => {
return [submittedResultTabIndex.value] return [submittedResultTabIndex.value];
}) });
/** 未复盘/复盘:与 reviewTabIndex 0/1 一致 */ /** 未复盘/复盘:与 reviewTabIndex 0/1 一致 */
const reviewPickerColumns = computed((): UnPickerColumn[] => { const reviewPickerColumns = computed((): UnPickerColumn[] => {
const col: UnPickerColumn = [] const col: UnPickerColumn = [];
col.push({ text: '未复盘', value: 0 } as UnPickerColumnItem) col.push({ text: "未复盘", value: 0 } as UnPickerColumnItem, { text: "已复盘", value: 1 } as UnPickerColumnItem);
col.push({ text: '已复盘', value: 1 } as UnPickerColumnItem) return [col];
return [col] });
})
/** 打开复盘下拉时按当前 Tab 回显滚轮位置(单列,下标与 reviewTabIndex 一致) */ /** 打开复盘下拉时按当前 Tab 回显滚轮位置(单列,下标与 reviewTabIndex 一致) */
const reviewPickerDefaultIndex = computed((): number[] => { const reviewPickerDefaultIndex = computed((): number[] => {
return [reviewTabIndex.value] return [reviewTabIndex.value];
}) });
// 确认:将选中值填充到 tag,并关闭弹窗 // 确认:将选中值填充到 tag,并关闭弹窗
const onConfirm = (e: UnPickerConfirmEvent): void => { const onConfirm = (e: UnPickerConfirmEvent): void => {
const items = e.value const items = e.value;
if (items != null && items.length > 0) { if (items != null && items.length > 0) {
selectedBrand.value = items[0].text selectedBrand.value = items[0].text;
selectedBrandValue.value = items[0].value as number selectedBrandValue.value = items[0].value as number;
} }
show.value = false show.value = false;
} };
// 取消:仅关闭弹窗,不更新选中值 // 取消:仅关闭弹窗,不更新选中值
const onClose = (): void => { const onClose = (): void => {
show.value = false show.value = false;
} };
// 客户录入按钮点击:跳转到预录信息页面 // 客户录入按钮点击:跳转到预录信息页面
function onCustomerEntryClick(): void { function onCustomerEntryClick(): void {
uni.navigateTo({ uni.navigateTo({
url: '/pages/receptionCenter/FormAdd' url: "/pages/receptionCenter/FormAdd"
}) });
} }
function onListCustomerEntryEdit(item: UTSJSONObject): void { function onListCustomerEntryEdit(item: UTSJSONObject): void {
uni.navigateTo({ uni.navigateTo({
url: `/pages/receptionCenter/FormAdd?record=${encodeURIComponent(JSON.stringify(item))}` url: `/pages/receptionCenter/FormAdd?record=${encodeURIComponent(JSON.stringify(item))}`
}) });
} }
function onCustomerFormDetailClose(): void { function onCustomerFormDetailClose(): void {
showCustomerFormDetail.value = false showCustomerFormDetail.value = false;
customerFormDetailItem.value = null customerFormDetailItem.value = null;
} }
function onReceptionRecordDetailClose(): void { function onReceptionRecordDetailClose(): void {
showReceptionRecordDetail.value = false showReceptionRecordDetail.value = false;
receptionRecordItem.value = {} receptionRecordItem.value = {};
} }
function onListCustomerEntryClick(item: UTSJSONObject): void { function onListCustomerEntryClick(item: UTSJSONObject): void {
// 与 FormAdd 打开方式一致:navigateTo + query record(JSON) // 与 FormAdd 打开方式一致:navigateTo + query record(JSON)
uni.navigateTo({ uni.navigateTo({
url: `/pages/receptionCenter/forms/FormDetail?record=${encodeURIComponent(JSON.stringify(item))}` url: `/pages/receptionCenter/forms/FormDetail?record=${encodeURIComponent(JSON.stringify(item))}`
}) });
} }
function onListCustomerEntryDelete(item: UTSJSONObject): void { function onListCustomerEntryDelete(item: UTSJSONObject): void {
const idStr = getStr(item, 'id') const idStr = getStr(item, "id");
const list = customerList.value const list = customerList.value;
const next: UTSJSONObject[] = [] const next: UTSJSONObject[] = [];
let i = 0 let i = 0;
while (i < list.length) { while (i < list.length) {
if (getStr(list[i], 'id') != idStr) { if (getStr(list[i], "id") != idStr) {
next.push(list[i]) next.push(list[i]);
} }
i++ i++;
} }
customerList.value = next customerList.value = next;
uni.showToast({ title: '已删除', icon: 'none' }) uni.showToast({ title: "已删除", icon: "none" });
} }
/** /**
* 从登录态取门店 merchantId 与场景业务类型(与 FormAdd 一致:sceneType==0 为 1,否则 2)。 * 从登录态取门店 merchantId 与场景业务类型(与 FormAdd 一致:sceneType==0 为 1,否则 2)。
* 缺登录或门店号时返回 null,调用方跳过请求。 * 缺登录或门店号时返回 null,调用方跳过请求。
*/ */
function getLoginShopMerchantAndSceneBussiness(): UTSJSONObject | null { function getLoginShopMerchantAndSceneBussiness(): null | UTSJSONObject {
const rawUser = storage.get('userInfo') as UTSJSONObject | null const rawUser = storage.get("userInfo") as null | UTSJSONObject;
if (rawUser == null) { if (rawUser == null) {
return null return null;
} }
const merchantId = rawUser['shopMerchantId'] const merchantId = rawUser.shopMerchantId;
if (merchantId == null || `${merchantId}` == '') { if (merchantId == null || `${merchantId}` == "") {
return null return null;
} }
const sceneTypeRaw = rawUser['sceneType'] const sceneTypeRaw = rawUser.sceneType;
const sceneTypeNum = sceneTypeRaw != null ? (sceneTypeRaw as number) : 1 const sceneTypeNum = sceneTypeRaw != null ? (sceneTypeRaw as number) : 1;
const sceneBussiness = sceneTypeNum == 0 ? 1 : 2 const sceneBussiness = sceneTypeNum == 0 ? 1 : 2;
return { return {
merchantId: merchantId, merchantId,
sceneBussiness: sceneBussiness, sceneBussiness,
} as UTSJSONObject } as UTSJSONObject;
} }
/** 当日到店:与 receiption.uts 中 customerInfoPage 示例时间格式一致 */ /** 当日到店:与 receiption.uts 中 customerInfoPage 示例时间格式一致 */
// 客户档案列表请求参数(预录列表:分页 + 今日到店时传 startTime/endTime) // 客户档案列表请求参数(预录列表:分页 + 今日到店时传 startTime/endTime)
function getDefaultCustomerFileParams(): UTSJSONObject | null { function getDefaultCustomerFileParams(): null | UTSJSONObject {
const ctx = getLoginShopMerchantAndSceneBussiness() const ctx = getLoginShopMerchantAndSceneBussiness();
if (ctx == null) { if (ctx == null) {
return null return null;
} }
const params = { const params = {
"pageNum": customerFilePageNum.value, "pageNum": customerFilePageNum.value,
"pageSize": CUSTOMER_FILE_PAGE_SIZE, "pageSize": CUSTOMER_FILE_PAGE_SIZE,
"receptionStatus": 1, "receptionStatus": 1,
"merchantId": ctx['merchantId'], "merchantId": ctx.merchantId,
"bussinessScene": ctx['sceneBussiness'] as number, "bussinessScene": ctx.sceneBussiness as number,
} as UTSJSONObject } as UTSJSONObject;
if (entryFilterIndex.value == 0) { if (entryFilterIndex.value == 0) {
const range = getTodayDayRangeStrings() const range = getTodayDayRangeStrings();
params['startTime'] = range['startTime'] params.startTime = range.startTime;
params['endTime'] = range['endTime'] params.endTime = range.endTime;
} }
return params return params;
} }
/** /**
...@@ -889,391 +840,391 @@ function getDefaultCustomerFileParams(): UTSJSONObject | null { ...@@ -889,391 +840,391 @@ function getDefaultCustomerFileParams(): UTSJSONObject | null {
* - 复盘/未复盘 → reviewFlag(0=已复盘,非 0 如 1=未复盘) * - 复盘/未复盘 → reviewFlag(0=已复盘,非 0 如 1=未复盘)
* - 战败/成交(已提交)/ 待上传·待提交(未提交)→ orderFinishFlag(0/1;未提交若后端另有字段请改映射) * - 战败/成交(已提交)/ 待上传·待提交(未提交)→ orderFinishFlag(0/1;未提交若后端另有字段请改映射)
*/ */
function getDefaultReceptionListParams(): UTSJSONObject | null { function getDefaultReceptionListParams(): null | UTSJSONObject {
const ctx = getLoginShopMerchantAndSceneBussiness() const ctx = getLoginShopMerchantAndSceneBussiness();
if (ctx == null) { if (ctx == null) {
return null return null;
} }
// 与 reviewTabIndex、复盘选择器一致:0=已复盘,1=未复盘 // 与 reviewTabIndex、复盘选择器一致:0=已复盘,1=未复盘
const reviewFlag = reviewTabIndex.value const reviewFlag = reviewTabIndex.value;
const submitted = filterTabIndex.value == 0 ? 1 : 0 const submitted = filterTabIndex.value == 0 ? 1 : 0;
const orderFinishFlag = submitted == 1 const orderFinishFlag = submitted == 1
? (submittedResultTabIndex.value == 1 ? 1 : 0) ? (submittedResultTabIndex.value == 1 ? 1 : 0)
: (unsubmittedPendingTabIndex.value == 1 ? 1 : 0) : (unsubmittedPendingTabIndex.value == 1 ? 1 : 0);
return { return {
"merchantId": ctx['merchantId'], "merchantId": ctx.merchantId,
"pageNum": receptionPageNum.value, "pageNum": receptionPageNum.value,
"pageSize": RECEPTION_PAGE_SIZE, "pageSize": RECEPTION_PAGE_SIZE,
"reviewFlag": reviewFlag, "reviewFlag": reviewFlag,
"orderFinishFlag": orderFinishFlag, "orderFinishFlag": orderFinishFlag,
"bussinessType": ctx['sceneBussiness'] as number, "bussinessType": ctx.sceneBussiness as number,
"submitted": submitted, "submitted": submitted,
} as UTSJSONObject } as UTSJSONObject;
} }
// 页面加载/模块切换时请求门店业绩数据 // 页面加载/模块切换时请求门店业绩数据
getPerformanceDataImpl = async (): Promise<void> => { getPerformanceDataImpl = async (): Promise<void> => {
const raw = storage.get('userInfo') as UTSJSONObject | null const raw = storage.get("userInfo") as null | UTSJSONObject;
if (raw == null) { if (raw == null) {
performanceData.value = getMockPerformanceData() performanceData.value = getMockPerformanceData();
return return;
} }
const userInfo = raw const userInfo = raw;
const shopMerchantId = userInfo['shopMerchantId'] const shopMerchantId = userInfo.shopMerchantId;
const sceneType = userInfo['sceneType'] const sceneType = userInfo.sceneType;
const range = getCurrentMonthRange() const range = getCurrentMonthRange();
// 组装接口入参(对齐旧项目逻辑) // 组装接口入参(对齐旧项目逻辑)
const params: UTSJSONObject = { const params: UTSJSONObject = {
merchantIdList: shopMerchantId, merchantIdList: shopMerchantId,
sceneType: sceneType != null ? sceneType : 1, sceneType: sceneType != null ? sceneType : 1,
startDate: range['startDate'], startDate: range.startDate,
endDate: range['endDate'], endDate: range.endDate,
} as UTSJSONObject } as UTSJSONObject;
if (sceneType != null && sceneType == 0) { if (sceneType != null && sceneType == 0) {
if (isHarmonyValue.value === true) { if (isHarmonyValue.value === true) {
// 鸿蒙/问界:bussinessType 固定 1,hmzxFlag 来自当前模块值 // 鸿蒙/问界:bussinessType 固定 1,hmzxFlag 来自当前模块值
params['bussinessType'] = 1 params.bussinessType = 1;
params['hmzxFlag'] = selectedBrandValue.value params.hmzxFlag = selectedBrandValue.value;
} else { } else {
// 延保/权益:bussinessType 来自当前模块值 // 延保/权益:bussinessType 来自当前模块值
params['bussinessType'] = selectedBrandValue.value params.bussinessType = selectedBrandValue.value;
} }
} else { } else {
// 非 0 场景:hmzxFlag 由 isHarmony 决定(模块值只用于展示,不参与接口参数) // 非 0 场景:hmzxFlag 由 isHarmony 决定(模块值只用于展示,不参与接口参数)
params['hmzxFlag'] = isHarmonyValue.value === true ? 3 : 4 params.hmzxFlag = isHarmonyValue.value === true ? 3 : 4;
} }
try { try {
const res = await getMerchantPerformance(params) const res = await getMerchantPerformance(params);
const resObj = res as UTSJSONObject const resObj = res as UTSJSONObject;
const bizData = resObj['data'] as UTSJSONObject | null const bizData = resObj.data as null | UTSJSONObject;
// performanceData.value = isPerformanceDataEmpty(bizData) ? getMockPerformanceData() : (bizData as UTSJSONObject) // performanceData.value = isPerformanceDataEmpty(bizData) ? getMockPerformanceData() : (bizData as UTSJSONObject)
performanceData.value = bizData as UTSJSONObject performanceData.value = bizData as UTSJSONObject;
} catch (err) { } catch {
performanceData.value = getMockPerformanceData() performanceData.value = getMockPerformanceData();
} }
} };
watch(selectedBrandValue, () => { watch(selectedBrandValue, () => {
// picker 模块值切换:刷新业绩看板 // picker 模块值切换:刷新业绩看板
getPerformanceData() getPerformanceData();
}) });
/** append=false 首屏/筛选重置替换列表;append=true 触底追加下一页(pageNum 先 +1 再请求,失败回退) */ /** append=false 首屏/筛选重置替换列表;append=true 触底追加下一页(pageNum 先 +1 再请求,失败回退) */
getCustomerListImpl = async (append: boolean): Promise<void> => { getCustomerListImpl = async (append: boolean): Promise<void> => {
if (append) { if (append) {
if (customerListHasMore.value != true) { if (customerListHasMore.value != true) {
return return;
} }
if (customerListLoadingMore.value == true) { if (customerListLoadingMore.value == true) {
return return;
} }
} }
let pageBumped = false let pageBumped = false;
if (append) { if (append) {
customerFilePageNum.value = customerFilePageNum.value + 1 customerFilePageNum.value = customerFilePageNum.value + 1;
pageBumped = true pageBumped = true;
} else { } else {
customerListHasMore.value = true customerListHasMore.value = true;
} }
const fileParams = getDefaultCustomerFileParams() const fileParams = getDefaultCustomerFileParams();
if (fileParams == null) { if (fileParams == null) {
console.warn('[getCustomerList] 无登录门店信息,跳过客户档案列表请求') console.warn("[getCustomerList] 无登录门店信息,跳过客户档案列表请求");
if (pageBumped) { if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1 customerFilePageNum.value = customerFilePageNum.value - 1;
} }
return return;
} }
// 首屏/筛选重置与加载更多统一置位,供列表骨架屏、底部「加载中」与空态判断使用(append=false 原先未置 true,导致首屏一直空白) // 首屏/筛选重置与加载更多统一置位,供列表骨架屏、底部「加载中」与空态判断使用(append=false 原先未置 true,导致首屏一直空白)
customerListLoadingMore.value = true customerListLoadingMore.value = true;
try { try {
const res = await getCustomerFileList(fileParams) const res = await getCustomerFileList(fileParams);
console.log('[ReceptionCenter] 获取客户列表res', res) console.log("[ReceptionCenter] 获取客户列表res", res);
const resObj = res as UTSJSONObject const resObj = res as UTSJSONObject;
const codeRaw = resObj['code'] const codeRaw = resObj.code;
if (`${codeRaw}` != '0') { if (`${codeRaw}` != "0") {
const msgRaw = resObj['message'] const msgRaw = resObj.message;
const msgStr = msgRaw != null && `${msgRaw}` != '' ? `${msgRaw}` : '客户列表加载失败' const msgStr = msgRaw != null && `${msgRaw}` != "" ? `${msgRaw}` : "客户列表加载失败";
if (append != true) { if (append != true) {
customerList.value = [] customerList.value = [];
customerListHasMore.value = false customerListHasMore.value = false;
} }
if (pageBumped) { if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1 customerFilePageNum.value = customerFilePageNum.value - 1;
} }
uni.showToast({ title: msgStr, icon: 'none' }) uni.showToast({ title: msgStr, icon: "none" });
return return;
} }
const bizData = resObj['data'] as UTSJSONObject | null const bizData = resObj.data as null | UTSJSONObject;
if (bizData == null) { if (bizData == null) {
if (append != true) { if (append != true) {
customerList.value = [] customerList.value = [];
} }
customerListHasMore.value = false customerListHasMore.value = false;
if (pageBumped) { if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1 customerFilePageNum.value = customerFilePageNum.value - 1;
} }
return return;
} }
const list = bizData['list'] const list = bizData.list;
if (list == null || (list instanceof Array) != true) { if (list == null || (Array.isArray(list)) != true) {
if (append != true) { if (append != true) {
customerList.value = [] customerList.value = [];
} }
customerListHasMore.value = false customerListHasMore.value = false;
if (pageBumped) { if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1 customerFilePageNum.value = customerFilePageNum.value - 1;
} }
return return;
} }
const arr: UTSJSONObject[] = [] const arr: UTSJSONObject[] = [];
let i = 0 let i = 0;
while (i < list.length) { while (i < list.length) {
const item = list[i] as UTSJSONObject const item = list[i] as UTSJSONObject;
arr.push(item) arr.push(item);
i++ i++;
} }
if (append == true) { if (append == true) {
customerList.value = mergeByKey(customerList.value, arr, 'id') customerList.value = mergeByKey(customerList.value, arr, "id");
} else { } else {
customerList.value = arr customerList.value = arr;
} }
customerListHasMore.value = resolveHasMore( customerListHasMore.value = resolveHasMore(
bizData, bizData,
arr.length, arr.length,
customerList.value.length, customerList.value.length,
CUSTOMER_FILE_PAGE_SIZE CUSTOMER_FILE_PAGE_SIZE
) );
} catch (err) { } catch (error) {
console.error('获取客户档案列表失败:', err) console.error("获取客户档案列表失败:", error);
if (pageBumped) { if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1 customerFilePageNum.value = customerFilePageNum.value - 1;
} }
if (append != true) { if (append != true) {
customerListHasMore.value = false customerListHasMore.value = false;
} }
uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' }) uni.showToast({ title: "网络异常,请稍后重试", icon: "none" });
} finally { } finally {
customerListLoadingMore.value = false customerListLoadingMore.value = false;
} }
} };
/** append=false 重置页码后整表替换;append=true 触底下一页合并(与 getCustomerList 一致) */ /** append=false 重置页码后整表替换;append=true 触底下一页合并(与 getCustomerList 一致) */
getReceptionRecordListImpl = async (append: boolean): Promise<void> => { getReceptionRecordListImpl = async (append: boolean): Promise<void> => {
if (append) { if (append) {
if (receptionListHasMore.value != true) { if (receptionListHasMore.value != true) {
return return;
} }
if (receptionListLoadingMore.value == true) { if (receptionListLoadingMore.value == true) {
return return;
} }
} }
let pageBumped = false let pageBumped = false;
if (append) { if (append) {
receptionPageNum.value = receptionPageNum.value + 1 receptionPageNum.value = receptionPageNum.value + 1;
pageBumped = true pageBumped = true;
} else { } else {
receptionListHasMore.value = true receptionListHasMore.value = true;
} }
const receptionParams = getDefaultReceptionListParams() const receptionParams = getDefaultReceptionListParams();
if (receptionParams == null) { if (receptionParams == null) {
console.warn('[getReceptionRecordList] 无登录门店信息,跳过接待复盘列表请求') console.warn("[getReceptionRecordList] 无登录门店信息,跳过接待复盘列表请求");
if (pageBumped) { if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1 receptionPageNum.value = receptionPageNum.value - 1;
} }
return return;
} }
receptionListLoadingMore.value = true receptionListLoadingMore.value = true;
console.log("receptionParams接待复盘参数",receptionParams); console.log("receptionParams接待复盘参数", receptionParams);
try { try {
const res = await getReceptionList(receptionParams) const res = await getReceptionList(receptionParams);
console.log("receptionParams接待复盘列表",res); console.log("receptionParams接待复盘列表", res);
const resObj = res as UTSJSONObject const resObj = res as UTSJSONObject;
const codeRaw = resObj['code'] const codeRaw = resObj.code;
if (`${codeRaw}` != '0') { if (`${codeRaw}` != "0") {
const msgRaw = resObj['message'] const msgRaw = resObj.message;
const msgStr = msgRaw != null && `${msgRaw}` != '' ? `${msgRaw}` : '接待列表加载失败' const msgStr = msgRaw != null && `${msgRaw}` != "" ? `${msgRaw}` : "接待列表加载失败";
if (append != true) { if (append != true) {
receptionRecordList.value = [] receptionRecordList.value = [];
receptionListHasMore.value = false receptionListHasMore.value = false;
} }
if (pageBumped) { if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1 receptionPageNum.value = receptionPageNum.value - 1;
} }
uni.showToast({ title: msgStr, icon: 'none' }) uni.showToast({ title: msgStr, icon: "none" });
return return;
} }
const bizData = resObj['data'] as UTSJSONObject | null const bizData = resObj.data as null | UTSJSONObject;
if (bizData == null) { if (bizData == null) {
if (append != true) { if (append != true) {
receptionRecordList.value = [] receptionRecordList.value = [];
} }
receptionListHasMore.value = false receptionListHasMore.value = false;
if (pageBumped) { if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1 receptionPageNum.value = receptionPageNum.value - 1;
} }
return return;
} }
const list = bizData['list'] const list = bizData.list;
if (list == null || (list instanceof Array) != true) { if (list == null || (Array.isArray(list)) != true) {
if (append != true) { if (append != true) {
receptionRecordList.value = [] receptionRecordList.value = [];
} }
receptionListHasMore.value = false receptionListHasMore.value = false;
if (pageBumped) { if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1 receptionPageNum.value = receptionPageNum.value - 1;
} }
return return;
} }
const arr: UTSJSONObject[] = [] const arr: UTSJSONObject[] = [];
let i = 0 let i = 0;
while (i < list.length) { while (i < list.length) {
const item = list[i] as UTSJSONObject const item = list[i] as UTSJSONObject;
arr.push(item) arr.push(item);
i++ i++;
} }
if (append == true) { if (append == true) {
receptionRecordList.value = mergeByKey(receptionRecordList.value, arr, 'batchId') receptionRecordList.value = mergeByKey(receptionRecordList.value, arr, "batchId");
} else { } else {
receptionRecordList.value = arr receptionRecordList.value = arr;
} }
receptionListHasMore.value = resolveHasMore( receptionListHasMore.value = resolveHasMore(
bizData, bizData,
arr.length, arr.length,
receptionRecordList.value.length, receptionRecordList.value.length,
RECEPTION_PAGE_SIZE RECEPTION_PAGE_SIZE
) );
} catch (err) { } catch (error) {
console.error('获取接待复盘列表失败:', err) console.error("获取接待复盘列表失败:", error);
if (pageBumped) { if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1 receptionPageNum.value = receptionPageNum.value - 1;
} }
if (append != true) { if (append != true) {
receptionListHasMore.value = false receptionListHasMore.value = false;
} }
uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' }) uni.showToast({ title: "网络异常,请稍后重试", icon: "none" });
} finally { } finally {
receptionListLoadingMore.value = false receptionListLoadingMore.value = false;
} }
} };
function switchFilterTab(index: number): void { function switchFilterTab(index: number): void {
filterTabIndex.value = index filterTabIndex.value = index;
receptionPageNum.value = 1 receptionPageNum.value = 1;
void getReceptionRecordList(false) void getReceptionRecordList(false);
} }
function switchEntryFilterTab(index: number): void { function switchEntryFilterTab(index: number): void {
entryFilterIndex.value = index entryFilterIndex.value = index;
customerFilePageNum.value = 1 customerFilePageNum.value = 1;
void getCustomerList(false) void getCustomerList(false);
} }
function switchReviewTab(index: number): void { function switchReviewTab(index: number): void {
reviewTabIndex.value = index reviewTabIndex.value = index;
receptionPageNum.value = 1 receptionPageNum.value = 1;
void getReceptionRecordList(false) void getReceptionRecordList(false);
} }
function switchSubmittedResultTab(index: number): void { function switchSubmittedResultTab(index: number): void {
submittedResultTabIndex.value = index submittedResultTabIndex.value = index;
receptionPageNum.value = 1 receptionPageNum.value = 1;
void getReceptionRecordList(false) void getReceptionRecordList(false);
} }
function switchUnsubmittedPendingTab(index: number): void { function switchUnsubmittedPendingTab(index: number): void {
unsubmittedPendingTabIndex.value = index unsubmittedPendingTabIndex.value = index;
receptionPageNum.value = 1 receptionPageNum.value = 1;
void getReceptionRecordList(false) void getReceptionRecordList(false);
} }
function onSubmittedResultPickerConfirm(e: UnPickerConfirmEvent): void { function onSubmittedResultPickerConfirm(e: UnPickerConfirmEvent): void {
const items = e.value const items = e.value;
if (items != null && items.length > 0) { if (items != null && items.length > 0) {
const idx = items[0].value as number const idx = items[0].value as number;
switchSubmittedResultTab(idx) switchSubmittedResultTab(idx);
} }
showSubmittedResultPicker.value = false showSubmittedResultPicker.value = false;
} }
function onSubmittedResultPickerClose(): void { function onSubmittedResultPickerClose(): void {
showSubmittedResultPicker.value = false showSubmittedResultPicker.value = false;
} }
function openSubmittedResultPicker(): void { function openSubmittedResultPicker(): void {
submittedResultPickerLayerKey.value = submittedResultPickerLayerKey.value + 1 submittedResultPickerLayerKey.value = submittedResultPickerLayerKey.value + 1;
showSubmittedResultPicker.value = true showSubmittedResultPicker.value = true;
} }
function onReviewPickerConfirm(e: UnPickerConfirmEvent): void { function onReviewPickerConfirm(e: UnPickerConfirmEvent): void {
const items = e.value const items = e.value;
if (items != null && items.length > 0) { if (items != null && items.length > 0) {
const idx = items[0].value as number const idx = items[0].value as number;
if (reviewTabIndex.value != idx) { if (reviewTabIndex.value != idx) {
switchReviewTab(idx) switchReviewTab(idx);
} }
} }
showReviewPicker.value = false showReviewPicker.value = false;
} }
function onReviewPickerClose(): void { function onReviewPickerClose(): void {
showReviewPicker.value = false showReviewPicker.value = false;
} }
function openReviewPicker(): void { function openReviewPicker(): void {
reviewPickerLayerKey.value = reviewPickerLayerKey.value + 1 reviewPickerLayerKey.value = reviewPickerLayerKey.value + 1;
showReviewPicker.value = true showReviewPicker.value = true;
} }
onMounted(() => { onMounted(() => {
// 先刷新全局方向,再同步安全区与窄屏模式(与 isLandscape 的 computed 数据源一致) // 先刷新全局方向,再同步安全区与窄屏模式(与 isLandscape 的 computed 数据源一致)
updateOrientation() updateOrientation();
syncReceptionDashboardLayout() syncReceptionDashboardLayout();
// uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,这里统一用轮询保证兼容性 // uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,这里统一用轮询保证兼容性
// 如需 H5 实时监听,可在 H5 条件编译块里单独注册 // 如需 H5 实时监听,可在 H5 条件编译块里单独注册
// 页面加载后再次兜底计算(避免运行期时区/时间跳变导致不一致) // 页面加载后再次兜底计算(避免运行期时区/时间跳变导致不一致)
setTimeProgress() setTimeProgress();
// 根据当前 Tab 加载对应数据 // 根据当前 Tab 加载对应数据
// 横屏:左右分栏同时展示两个模块,因此初始化时两边数据都需要拉取 // 横屏:左右分栏同时展示两个模块,因此初始化时两边数据都需要拉取
if (isLandscape.value == true) { if (isLandscape.value == true) {
void getPerformanceData() void getPerformanceData();
if (listSubTabIndex.value != 0) { if (listSubTabIndex.value != 0) {
void getReceptionRecordList(false) void getReceptionRecordList(false);
} }
} else { } else {
if (mainTabIndex.value == 0) { if (mainTabIndex.value == 0) {
void getPerformanceData() void getPerformanceData();
} else { } else {
if (listSubTabIndex.value == 0) { if (listSubTabIndex.value == 0) {
// 客户列表会在下方统一触发一次 // 客户列表会在下方统一触发一次
} else { } else {
void getReceptionRecordList(false) void getReceptionRecordList(false);
} }
} }
} }
// 默认页面加载完成后拉取一次客户列表 // 默认页面加载完成后拉取一次客户列表
customerFilePageNum.value = 1 customerFilePageNum.value = 1;
void getCustomerList(false) void getCustomerList(false);
}) });
// 在 center.uvue setup 顶部监听自定义事件,刷新列表 // 在 center.uvue setup 顶部监听自定义事件,刷新列表
onMounted(() => { onMounted(() => {
uni.$on('refresh-reception-list', () => { uni.$on("refresh-reception-list", () => {
// 重新加载第一页 // 重新加载第一页
customerFilePageNum.value = 1 customerFilePageNum.value = 1;
void getCustomerList(false) void getCustomerList(false);
}) });
}) });
onUnmounted(() => { onUnmounted(() => {
uni.$off('refresh-reception-list') uni.$off("refresh-reception-list");
}) });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -1316,11 +1267,6 @@ onUnmounted(() => { ...@@ -1316,11 +1267,6 @@ onUnmounted(() => {
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
} }
.reception-navbar-spacer {
height: 44px;
flex-shrink: 0;
}
.reception-route-body { .reception-route-body {
flex: 1; flex: 1;
width: 100%; width: 100%;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!