Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a80cc5e4
authored
Apr 10, 2026
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'feature/rework' of
http://192.168.3.233:8090/monorepo/venus
into feature/rework
2 parents
9754b526
ed8426db
Show whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
3164 additions
and
1858 deletions
apps/uniappX/uniapp-x-tape/.hbuilderx/launch.json
apps/uniappX/uniapp-x-tape/components/HomeFrame/SceneShell.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/LeftSide.uvue → apps/uniappX/uniapp-x-tape/components/HomeFrame/Tabbar.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/index.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/presets/HomeMainTab.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/presets/MyCenterTab.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/presets/ReceptionStack.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/common.scss
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/landscape.uts
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/portrait.uts
apps/uniappX/uniapp-x-tape/pages.json
apps/uniappX/uniapp-x-tape/pages/boutique/components/BoutiqueLandscape.uvue → apps/uniappX/uniapp-x-tape/pages/boutique/components/BoutiqueHomePanel.uvue
apps/uniappX/uniapp-x-tape/pages/boutique/components/BoutiquePortrait.uvue
apps/uniappX/uniapp-x-tape/pages/boutique/index.uvue
apps/uniappX/uniapp-x-tape/pages/common/components/MerchantList.uvue
apps/uniappX/uniapp-x-tape/pages/common/components/Scene.uvue
apps/uniappX/uniapp-x-tape/pages/equity/components/EquityHomePanel.uvue
apps/uniappX/uniapp-x-tape/pages/equity/index.uvue
apps/uniappX/uniapp-x-tape/pages/index/index.uvue
apps/uniappX/uniapp-x-tape/pages/person/MyCenterMain.uvue
apps/uniappX/uniapp-x-tape/pages/person/myCenter.uvue
apps/uniappX/uniapp-x-tape/pages/personMyShell.uvue
apps/uniappX/uniapp-x-tape/pages/receptionCenter/ReceptionCenterMain.uvue
apps/uniappX/uniapp-x-tape/pages/receptionCenter/center.uvue
apps/uniappX/uniapp-x-tape/pages/receptionCenter/filters/ReceptionListPrimaryFilter.uvue
apps/uniappX/uniapp-x-tape/pages/receptionCenter/filters/ReceptionListSecondaryFilter.uvue
apps/uniappX/uniapp-x-tape/pages/receptionCenter/styles/common.scss
apps/uniappX/uniapp-x-tape/pages/receptionCenter/styles/index.vars.uts
apps/uniappX/uniapp-x-tape/pages/receptionCenter/styles/reception-filter-shared.css → apps/uniappX/uniapp-x-tape/pages/receptionCenter/styles/reception-filter-shared.scss
apps/uniappX/uniapp-x-tape/pages/receptionCenter/tabs/ReceptionCustomerListTab.uvue
apps/uniappX/uniapp-x-tape/pages/receptionCenter/tabs/ReceptionDashboardTab.uvue
apps/uniappX/uniapp-x-tape/pages/receptionShell.uvue
apps/uniappX/uniapp-x-tape/pages/usedCar/components/UsedCarHomePanel.uvue
apps/uniappX/uniapp-x-tape/pages/usedCar/index.uvue
apps/uniappX/uniapp-x-tape/utils/homeRoute.uts
apps/uniappX/uniapp-x-tape/utils/tabBarShell.uts
apps/uniappX/uniapp-x-tape/.hbuilderx/launch.json
View file @
a80cc5e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
"version"
:
"1.0"
,
"version"
:
"1.0"
,
"configurations"
:
[
"configurations"
:
[
{
{
"customPlaygroundType"
:
"local"
,
"playground"
:
"custom"
,
"playground"
:
"custom"
,
"type"
:
"uni-app:app-android"
"type"
:
"uni-app:app-android"
}
}
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/SceneShell.uvue
View file @
a80cc5e
<template>
<template>
<
view class="home-frame-container"
<
!-- 物理 tab 三页共用:自定义 Tabbar + 默认槽(首页 / 接待 / 我的由 pages 填入不同主体) -->
:key="adapterClass
"
<view class="home-frame-container scene-shell-root
"
:class="[modeClass, resolutionClass, adapterClass]">
:class="[modeClass, resolutionClass, adapterClass]">
<view class="home-content">
<view class="home-content">
<HomeFrameTabbar :adapter-class="adapterClass"
:tab-index="activeTabIndex"
:user-info="userInfo" />
<view class="right-side">
<view class="right-side">
<slot :user-info="userInfo"></slot>
<slot :user-info="userInfo"></slot>
</view>
</view>
<HomeFrameLeftSide :adapter-class="adapterClass"
:tab-index="activeTabIndex"
:user-info="userInfo" />
</view>
</view>
</view>
</view>
</template>
</template>
...
@@ -20,8 +20,9 @@ import { cssClassRef, useResolutionConfig } from "@/services/adapter";
...
@@ -20,8 +20,9 @@ import { cssClassRef, useResolutionConfig } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts";
import { layoutService } from "@/services/LayoutService.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts";
import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import HomeFrame
LeftSide from "./LeftSide
.uvue";
import HomeFrame
Tabbar from "./Tabbar
.uvue";
type SceneShellSlotProps = {
type SceneShellSlotProps = {
userInfo: UTSJSONObject
userInfo: UTSJSONObject
...
@@ -31,13 +32,13 @@ type SceneShellSlots = {
...
@@ -31,13 +32,13 @@ type SceneShellSlots = {
default(props: SceneShellSlotProps): any
default(props: SceneShellSlotProps): any
};
};
defineSlots<SceneShellSlots>();
const props = defineProps<{
const props = defineProps<{
/**
与当前路由对应:0 首页场景、1 接待中心、2 我的
*/
/**
当前 tab 页下标:0 首页、1 接待、2 我的(与 un-tabbar 高亮一致)
*/
activeTabIndex: number
activeTabIndex: number
}>();
}>();
defineSlots<SceneShellSlots>();
useResolutionConfig();
useResolutionConfig();
const adapterClass = computed((): string => {
const adapterClass = computed((): string => {
...
@@ -67,6 +68,11 @@ function updateApp(): void {
...
@@ -67,6 +68,11 @@ function updateApp(): void {
onLoad((_options) => {
onLoad((_options) => {
requestRecordPermission();
requestRecordPermission();
hideNativeTabBar();
});
onShow(() => {
hideNativeTabBar();
});
});
defineExpose({
defineExpose({
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/
LeftSide
.uvue
→
apps/uniappX/uniapp-x-tape/components/HomeFrame/
Tabbar
.uvue
View file @
a80cc5e
<template>
<template>
<!-- 横屏 / Pad:左侧竖向导航(头像 + 场景切换
+ 设置) -->
<!-- 横屏 / Pad:左侧竖向导航(头像 + un-tabbar
+ 设置) -->
<view v-if="!isPortraitMode"
<view v-if="!isPortraitMode"
:key="adapterClassName"
class="home-tabbar home-tabbar-landscape"
class="left-side left-side-pad"
:class="[adapterClassName]">
:class="[adapterClassName]">
<image class="left-side
-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="user-box user-box-clickable" @click="jumpPersonCenter">
<view class="user-box user-box-clickable" @click="jumpPersonCenter">
...
@@ -13,48 +12,63 @@
...
@@ -13,48 +12,63 @@
<text class="user-name-text">{{ userName }}</text>
<text class="user-name-text">{{ userName }}</text>
</view>
</view>
</view>
</view>
<view class="left-tabs">
<view class="landscape-tabbar-wrap">
<view v-for="(item, index) in tabs"
<un-tabbar :model-value="currentTabIndex"
class="landscape-un-tabbar"
:custom-style="landscapeTabbarRootStyle"
:fixed="false"
:placeholder="false"
:safe-area-inset-bottom="false"
active-color="#3773f8"
inactive-color="#8a98b5"
bg-color="transparent"
:height="landscapeTabbarInnerHeight"
@change="onTabChange(($event as string | number))">
<un-tabbar-item v-for="(item, index) in tabs"
:key="index"
:key="index"
class="tab-item"
:name="index"
:class="[currentTabIndex === index ? 'tabActive' : '']"
:text="item.label"
@click="onChangeTab(index)">
:icon-size="landscapeTabbarIconSize">
<view class="icon-box">
<template #icon="{ active }">
<view class="icon-placeholder" :class="[currentTabIndex === index ? 'icon-active' : '']"></view>
<image v-if="active === true"
</view>
class="tabbar-icon-img"
<text class="tab-label">{{ item.label }}</text>
mode="aspectFit"
</view>
:src="getTabIconSrc(item.icon, true)" />
<image v-else
class="tabbar-icon-img"
mode="aspectFit"
:src="getTabIconSrc(item.icon, false)" />
</template>
</un-tabbar-item>
</un-tabbar>
</view>
</view>
<view class="left
-footer flex-col">
<view class="home-tabbar
-footer flex-col">
<view class="btn-placeholder" @tap="onSceneChange"></view>
<view class="btn-placeholder" @tap="onSceneChange"></view>
<view class="btn-placeholder" @tap="onSetting"></view>
<view class="btn-placeholder" @tap="onSetting"></view>
</view>
</view>
<!-- 切换场景弹窗:用 visible 受控,避免 UTS 下 ref+expose 的强转问题 -->
<CenterPopup :list="sceneTypeList"
<CenterPopup :list="sceneTypeList"
title="选择场景"
title="选择场景"
:visible="showScenePopup"
:visible="showScenePopup"
@choose="onChooseScene"
@choose="onChooseScene"
@update:visible="onScenePopupVisible" />
@update:visible="onScenePopupVisible" />
<!-- 设置弹窗 -->
<SettingBox :visible="showSetting"
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
@update:visible="onSettingVisible" />
</view>
</view>
<!-- 竖屏手机:uView 底部 TabBar,图标沿用 static/images/tabbar
-->
<!-- 竖屏手机:底部 un-tabbar(系统 tabBar 已由 SceneShell hideTabBar 隐藏)
-->
<view v-else
<view v-else
:key="adapterClassName"
class="home-tabbar home-tabbar-portrait"
class="left-side left-side-portrait"
:class="[adapterClassName, isPadPortraitMode ? 'home-tabbar-portrait-pad' : '']">
:class="[adapterClassName, isPadPortraitMode ? 'left-side-portrait-pad' : '']">
<un-tabbar :model-value="currentTabIndex"
<un-tabbar :model-value="currentTabIndex"
class="portrait-un-tabbar"
class="portrait-un-tabbar"
:fixed="fals
e"
:fixed="tru
e"
:placeholder="false"
:placeholder="false"
:safe-area-inset-bottom="true"
:safe-area-inset-bottom="true"
active-color="#3773f8"
active-color="#3773f8"
inactive-color="#8a98b5"
inactive-color="#8a98b5"
bg-color="#ffffff"
bg-color="#ffffff"
:height="tabbarHeight"
:height="tabbarHeight"
@change="onPortrait
TabChange(($event as string | number))">
@change="on
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"
...
@@ -72,6 +86,13 @@
...
@@ -72,6 +86,13 @@
</template>
</template>
</un-tabbar-item>
</un-tabbar-item>
</un-tabbar>
</un-tabbar>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="onChooseScene"
@update:visible="onScenePopupVisible" />
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
</view>
</view>
</template>
</template>
...
@@ -82,15 +103,16 @@ import CenterPopup from "@/components/CenterPopup.uvue";
...
@@ -82,15 +103,16 @@ import CenterPopup from "@/components/CenterPopup.uvue";
import { cssClassRef } from "@/services/adapter";
import { cssClassRef } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts";
import { layoutService } from "@/services/LayoutService.uts";
import { storage } from "@/utils/storage.uts";
import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import SettingBox from "@/pages/person/SettingBox.uvue";
import SettingBox from "@/pages/person/SettingBox.uvue";
// 导入样式变量
import { getLandscapeConfig } from "./styles/landscape.uts";
import { getLandscapeConfig } from "./styles/landscape.uts";
import { getPortraitConfig, PORTRAIT_COMMON } from "./styles/portrait.uts";
import { getPortraitConfig, PORTRAIT_COMMON } from "./styles/portrait.uts";
const props = defineProps<{
const props = defineProps<{
adapterClass?: string
adapterClass?: string
/** 与当前 tab 页一致:0 首页、1 接待中心、2 我的 */
tabIndex?: number
tabIndex?: number
userInfo?: null | UTSJSONObject
userInfo?: null | UTSJSONObject
}>();
}>();
...
@@ -113,36 +135,52 @@ const isPadPortraitMode = computed((): boolean => {
...
@@ -113,36 +135,52 @@ const isPadPortraitMode = computed((): boolean => {
return cls.indexOf("layout-portrait-768x1174") >= 0;
return cls.indexOf("layout-portrait-768x1174") >= 0;
});
});
// TabBar 高度 - 根据分辨率动态设置
const tabbarHeight = computed((): number => {
const tabbarHeight = computed((): number => {
// 使用 cssClassRef.value 确保响应式
const adapterCls = cssClassRef.value;
const adapterCls = cssClassRef.value;
// 竖屏配置
const portraitConfig = getPortraitConfig(adapterCls);
const portraitConfig = getPortraitConfig(adapterCls);
if (portraitConfig != null) {
if (portraitConfig != null) {
return portraitConfig.tabbarHeight as number;
return portraitConfig.tabbarHeight as number;
}
}
// 默认值
return PORTRAIT_COMMON.tabbarHeight as number;
return PORTRAIT_COMMON.tabbarHeight as number;
});
});
// TabBar 图标尺寸 - 根据分辨率动态设置
const tabbarIconSize = computed((): number => {
const tabbarIconSize = computed((): number => {
// 使用 cssClassRef.value 确保响应式
const adapterCls = cssClassRef.value;
const adapterCls = cssClassRef.value;
// 竖屏配置
const portraitConfig = getPortraitConfig(adapterCls);
const portraitConfig = getPortraitConfig(adapterCls);
if (portraitConfig != null) {
if (portraitConfig != null) {
return portraitConfig.tabbarIconSize as number;
return portraitConfig.tabbarIconSize as number;
}
}
// 默认值
return PORTRAIT_COMMON.tabbarIconSize as number;
return PORTRAIT_COMMON.tabbarIconSize as number;
});
});
const landscapeTabbarRootStyle = computed((): string => {
const adapterCls = cssClassRef.value;
const lc = getLandscapeConfig(adapterCls);
const h = lc != null ? lc.leftTabsHeight : "540px";
const padLeft = lc != null ? lc.leftTabsPaddingLeft : "16px";
return `display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:${h};padding-left:${padLeft};padding-top:8px;padding-bottom:8px;box-sizing:border-box;`;
});
const landscapeTabbarInnerHeight = computed((): number => {
const adapterCls = cssClassRef.value;
const lc = getLandscapeConfig(adapterCls);
if (lc != null && adapterCls.indexOf("1920") >= 0) {
return 64;
}
if (lc != null) {
return 58;
}
return 56;
});
const landscapeTabbarIconSize = computed((): number => {
const adapterCls = cssClassRef.value;
if (adapterCls.indexOf("1920") >= 0) {
return 32;
}
return 28;
});
const currentTabIndex = computed((): number => {
const currentTabIndex = computed((): number => {
const idx = props.tabIndex as null | number;
const idx = props.tabIndex as null | number;
return idx != null ? idx : 0;
return idx != null ? idx : 0;
...
@@ -220,8 +258,6 @@ const tabs: TabItem[] = [
...
@@ -220,8 +258,6 @@ const tabs: TabItem[] = [
{ label: "首页", icon: "home", name: "HomeSlot" },
{ label: "首页", icon: "home", name: "HomeSlot" },
{ label: "接待中心", icon: "record", name: "ReceptionCenter" },
{ label: "接待中心", icon: "record", name: "ReceptionCenter" },
{ label: "我的", icon: "my", name: "MyCenter" },
{ label: "我的", icon: "my", name: "MyCenter" },
// { label: "场景集市", icon: "scene", name: "SceneMarket" },
// { label: "活动中心", icon: "activity", name: "ActivityCenter" }
];
];
function getTabIconSrc(icon: string, active: boolean): string {
function getTabIconSrc(icon: string, active: boolean): string {
...
@@ -246,8 +282,6 @@ const userName = computed((): string => {
...
@@ -246,8 +282,6 @@ const userName = computed((): string => {
return "";
return "";
}
}
const obj = info as UTSJSONObject;
const obj = info as UTSJSONObject;
// 与旧项目一致优先用 name;接口可能返回 staffName;无则用 merchantName
// App 端 storage 可能解析出 number,统一转 string 保证 text 能显示
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
if (raw == null) {
if (raw == null) {
return "";
return "";
...
@@ -256,25 +290,6 @@ const userName = computed((): string => {
...
@@ -256,25 +290,6 @@ const userName = computed((): string => {
return s !== "" ? s : "";
return s !== "" ? s : "";
});
});
function resolveMainHomeUrl(): string {
const raw = storage.get("userInfo");
let sceneType = 1;
if (raw != null) {
const st = (raw as UTSJSONObject).sceneType as null | number;
if (st != null) {
sceneType = st;
}
}
let url = "/pages/boutique/index";
if (sceneType == 0) {
url = "/pages/equity/index";
} else if (sceneType == 7) {
url = "/pages/usedCar/index";
}
return url;
}
/** 与 pages.json 的 path 一致(不含前导 /);失败时再试无前导 /,兼容部分运行时装载表差异 */
function reLaunchPage(pagesJsonPath: string): void {
function reLaunchPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const withSlash = "/" + trimmed;
const withSlash = "/" + trimmed;
...
@@ -286,31 +301,40 @@ function reLaunchPage(pagesJsonPath: string): void {
...
@@ -286,31 +301,40 @@ function reLaunchPage(pagesJsonPath: string): void {
});
});
}
}
function switchTabPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const url = "/" + trimmed;
uni.switchTab({
url,
success: () => {
hideNativeTabBar();
},
fail: (_err: any) => {
reLaunchPage(trimmed);
}
});
}
function navigateToTab(index: number): void {
function navigateToTab(index: number): void {
const cur = props.tabIndex != null ? (props.tabIndex as number) : 0;
const cur = props.tabIndex != null ? (props.tabIndex as number) : 0;
if (index == cur) {
if (index == cur) {
return;
return;
}
}
if (index == 0) {
if (index == 0) {
uni.reLaunch({ url: resolveMainHomeUrl() }
);
switchTabPage("pages/index/index"
);
return;
return;
}
}
if (index == 1) {
if (index == 1) {
// 放在 pages 根目录短路径,避免深层目录在部分构建里未进路由表(reLaunch errCode 4)
switchTabPage("pages/receptionCenter/center");
reLaunchPage("pages/receptionShell");
return;
return;
}
}
if (index == 2) {
if (index == 2) {
reLaunchPage("pages/personMyShell
");
switchTabPage("pages/person/myCenter
");
return;
return;
}
}
}
}
function onChangeTab(index: number): void {
function onTabChange(name: string | number): void {
navigateToTab(index);
}
function onPortraitTabChange(name: string | number): void {
const idx = name as number;
const idx = name as number;
navigateToTab(idx);
navigateToTab(idx);
}
}
...
@@ -349,10 +373,19 @@ function onChooseScene(index: number): void {
...
@@ -349,10 +373,19 @@ function onChooseScene(index: number): void {
info.sceneType = sceneType;
info.sceneType = sceneType;
uni.showLoading({ title: "切换中", mask: true });
uni.showLoading({ title: "切换中", mask: true });
storage.set("userInfo", info, 0);
storage.set("userInfo", info, 0);
let url = "/pages/boutique/index";
uni.switchTab({
if (sceneType == 0) url = "/pages/equity/index";
url: "/pages/index/index",
else if (sceneType == 7) url = "/pages/usedCar/index";
success: () => {
uni.reLaunch({ url });
hideNativeTabBar();
},
complete: () => {
uni.hideLoading();
},
fail: (_err: any) => {
uni.hideLoading();
reLaunchPage("pages/index/index");
}
});
}
}
function jumpPersonCenter(): void {
function jumpPersonCenter(): void {
...
@@ -362,4 +395,18 @@ function jumpPersonCenter(): void {
...
@@ -362,4 +395,18 @@ function jumpPersonCenter(): void {
<style scoped lang="scss">
<style scoped lang="scss">
@import "./styles/common.scss";
@import "./styles/common.scss";
.home-tabbar-landscape .landscape-un-tabbar > :deep(view) {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
.home-tabbar-landscape .landscape-un-tabbar > :deep(view) > :deep(view) {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
</style>
</style>
apps/uniappX/uniapp-x-tape/components/HomeFrame/index.uvue
View file @
a80cc5e
<template>
<template>
<view class="home-frame-container"
<view class="home-frame-container"
:key="adapterClass"
:class="[modeClass, resolutionClass, adapterClass, tabSlotEmbedClass]">
:class="[modeClass, resolutionClass, adapterClass]">
<!-- 首页内容区:横竖方向由容器 modeClass + common.scss 控制 .home-content -->
<!-- 首页内容区:横竖方向由容器 modeClass + common.scss 控制 .home-content -->
<view class="home-content">
<view class="home-content"
:class="tabbarVisible ? '' : 'hf-content-without-tabbar'">
<!-- Tabbar 在前:横屏 row 时自然在屏幕左侧;竖屏仍靠 order 把主内容置上;套壳页由 SceneShell 承载 Tabbar 时关闭 -->
<HomeFrameTabbar v-if="tabbarVisible"
:adapter-class="adapterClass"
:user-info="userInfo" />
<view class="right-side">
<view class="right-side">
<!-- 仅「场景首页」:接待中心 / 我的 为独立路由页(见
LeftSide 导航
) -->
<!-- 仅「场景首页」:接待中心 / 我的 为独立路由页(见
HomeFrameTabbar
) -->
<!-- 三卡片布局:轻改 / 权益等使用 swiperCustom -->
<!-- 三卡片布局:轻改 / 权益等使用 swiperCustom -->
<view v-if="useCardLayout" class="app-content-box right-content show-content-box">
<view v-if="useCardLayout" class="app-content-box right-content show-content-box">
<view v-if="resolvedShowStartReception"
<view v-if="resolvedShowStartReception"
...
@@ -64,10 +68,6 @@
...
@@ -64,10 +68,6 @@
</view>
</view>
</view>
</view>
</view>
</view>
<HomeFrameLeftSide :adapter-class="adapterClass"
:tab-index="0"
:user-info="userInfo" />
</view>
</view>
</view>
</view>
</template>
</template>
...
@@ -83,7 +83,7 @@ import { layoutService } from "@/services/LayoutService.uts";
...
@@ -83,7 +83,7 @@ import { layoutService } from "@/services/LayoutService.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts";
import { storage } from "@/utils/storage.uts";
import HomeFrame
LeftSide from "./LeftSide
.uvue";
import HomeFrame
Tabbar from "./Tabbar
.uvue";
import HomeFrameMessageIndex from "./MessageIndex.uvue";
import HomeFrameMessageIndex from "./MessageIndex.uvue";
import ProductIntroSwiper from "./ProductIntroSwiper.uvue";
import ProductIntroSwiper from "./ProductIntroSwiper.uvue";
...
@@ -92,6 +92,8 @@ import { getLandscapeConfig } from "./styles/landscape.uts";
...
@@ -92,6 +92,8 @@ import { getLandscapeConfig } from "./styles/landscape.uts";
import { getPortraitConfig } from "./styles/portrait.uts";
import { getPortraitConfig } from "./styles/portrait.uts";
const props = withDefaults(defineProps<{
const props = withDefaults(defineProps<{
/** false:仅渲染主内容区,外层由 SceneShell 等提供 Tabbar(避免双 Tabbar) */
showTabbar?: boolean
showFooter?: boolean
showFooter?: boolean
swiperCustom?: boolean
swiperCustom?: boolean
/** 产品介绍区:与 swiperCustom 配套,由页面传入列表与文案 */
/** 产品介绍区:与 swiperCustom 配套,由页面传入列表与文案 */
...
@@ -106,8 +108,23 @@ const props = withDefaults(defineProps<{
...
@@ -106,8 +108,23 @@ const props = withDefaults(defineProps<{
showStartReception?: boolean
showStartReception?: boolean
/** 展业工具区块标题,默认「展业工具」 */
/** 展业工具区块标题,默认「展业工具」 */
toolBoxTitle?: string
toolBoxTitle?: string
/**
* 嵌入 `pages/index/index` 的 SceneShell 槽内:与外层壳叠加时作为 flex 子项占满剩余区域。
* 独立整页使用 HomeFrame 时不要传(默认 false)。
*/
embedInTabSlot?: boolean
}>(), {
}>(), {
showTabbar: true,
showStartReception: true,
showStartReception: true,
embedInTabSlot: false,
});
const tabbarVisible = computed((): boolean => {
return props.showTabbar !== false;
});
const tabSlotEmbedClass = computed((): string => {
return props.embedInTabSlot === true ? "hf-embed-in-tab-slot" : "";
});
});
const emit = defineEmits<{
const emit = defineEmits<{
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/presets/HomeMainTab.uvue
0 → 100644
View file @
a80cc5e
<template>
<!--
层级(仅 index 物理 tab 页):
1) SceneShell:系统级 tab 壳(侧栏/底栏 + 右侧槽),见 SceneShell.uvue
2) HomeMainTab:按 userInfo.sceneType 切换下方三选一子树
3) *HomePanel:各场景业务 + 内层 HomeFrame(三卡片区,embedInTabSlot 与壳分工)
-->
<view class="hf-home-main-tab">
<view v-if="resolvedSceneType === 1"
class="hf-home-main-inner">
<BoutiqueHomePanel :logic="logic" />
</view>
<view v-else-if="resolvedSceneType === 0"
class="hf-home-main-inner">
<EquityHomePanel />
</view>
<view v-else-if="resolvedSceneType === 7"
class="hf-home-main-inner">
<UsedCarHomePanel />
</view>
<view v-else
class="hf-home-main-fallback">
<text class="hf-fallback-text">暂不支持当前场景</text>
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvue";
import EquityHomePanel from "@/pages/equity/components/EquityHomePanel.uvue";
import UsedCarHomePanel from "@/pages/usedCar/components/UsedCarHomePanel.uvue";
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { storage } from "@/utils/storage.uts";
const props = defineProps<{
logic: BoutiqueLogic
/** SceneShell 同步的 userInfo;switchTab 回首页时随 updateApp 更新,避免子组件 onShow 不触发导致场景不刷新 */
userInfo?: null | UTSJSONObject
}>();
const logic = props.logic;
function sceneTypeFromStorage(): number {
const raw = storage.get("userInfo");
if (raw == null) {
return 1;
}
const st = (raw as UTSJSONObject).sceneType as null | number;
return st != null ? st : 1;
}
const resolvedSceneType = computed((): number => {
const u = props.userInfo;
if (u != null) {
const st = (u as UTSJSONObject).sceneType as null | number;
if (st != null) {
return st as number;
}
}
return sceneTypeFromStorage();
});
</script>
<style scoped lang="scss">
.hf-home-main-tab {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
}
.hf-home-main-inner {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
}
.hf-home-main-fallback {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
}
.hf-fallback-text {
font-size: 15px;
color: #666;
text-align: center;
}
</style>
apps/uniappX/uniapp-x-tape/components/HomeFrame/presets/MyCenterTab.uvue
View file @
a80cc5e
<template>
<template>
<view class="my-center-wrap">
<view class="my-center-wrap">
<MyCenter :user-info="resolvedUserInfo" />
<MyCenter
Main
:user-info="resolvedUserInfo" />
</view>
</view>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { computed } from "vue";
import { computed } from "vue";
import MyCenter
from "@/pages/person/myCenter
.uvue";
import MyCenter
Main from "@/pages/person/MyCenterMain
.uvue";
const props = defineProps<{
const props = defineProps<{
userInfo?: null | UTSJSONObject
userInfo?: null | UTSJSONObject
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/presets/ReceptionStack.uvue
View file @
a80cc5e
<template>
<template>
<view class="hf-reception-stack">
<view class="hf-reception-stack">
<view class="reception-center-inner">
<ReceptionCenterMain />
<ReceptionCenter @show-reception-detail="onShowReceptionDetail" />
</view>
<view v-show="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view>
</view>
</view>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { ref } from "vue";
import ReceptionCenterMain from "@/pages/receptionCenter/ReceptionCenterMain.uvue";
import ReceptionCenter from "@/pages/receptionCenter/center.uvue";
import ReceptionDetail from "@/pages/receptionCenter/receptionDetail.uvue";
const showReceptionDetail = ref(false);
const receptionDetailItem = ref<UTSJSONObject>({});
function onShowReceptionDetail(item: UTSJSONObject): void {
receptionDetailItem.value = item;
showReceptionDetail.value = true;
}
function onReceptionDetailClose(): void {
showReceptionDetail.value = false;
receptionDetailItem.value = {};
}
</script>
</script>
<style scoped lang="scss">
<style scoped lang="scss">
...
@@ -35,18 +14,6 @@ function onReceptionDetailClose(): void {
...
@@ -35,18 +14,6 @@ function onReceptionDetailClose(): void {
width: 100%;
width: 100%;
height: 100%;
height: 100%;
min-height: 0;
min-height: 0;
position: relative;
display: flex;
flex-direction: column;
}
.reception-center-inner,
.reception-detail-inner {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
}
}
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/common.scss
View file @
a80cc5e
...
@@ -12,6 +12,13 @@
...
@@ -12,6 +12,13 @@
background
:
linear-gradient
(
to
bottom
,
#e8f0fe
,
#f5f7fa
);
background
:
linear-gradient
(
to
bottom
,
#e8f0fe
,
#f5f7fa
);
}
}
/* 嵌入 index tab 槽(SceneShell 右侧):在 flex 列/行里占满剩余空间,避免仅依赖 height:100% 横竖屏一侧失效 */
.home-frame-container.hf-embed-in-tab-slot
{
flex
:
1
;
min-height
:
0
;
min-width
:
0
;
}
// ===== 内容区域布局 =====
// ===== 内容区域布局 =====
.home-content
{
.home-content
{
position
:
relative
;
position
:
relative
;
...
@@ -30,6 +37,39 @@
...
@@ -30,6 +37,39 @@
.mode-landscape
.home-content
{
.mode-landscape
.home-content
{
flex-direction
:
row
;
flex-direction
:
row
;
/* 避免系统 RTL 下「第一个子节点」跑到视觉右侧,侧栏需始终在物理左侧 */
direction
:
ltr
;
}
/*
* 横屏 row 主槽 flex:须 min-width:0 + flex-basis:0%,否则部分端剩余宽度为 0。
* 拆成两条,避免与「首页内再嵌一套 HomeFrame」共用同一选择器时,改一侧误伤另一侧。
* - scene-shell-root:三 tab 壳(首页 / 接待 / 我的)槽位,侧栏 + 主区
* - hf-content-without-tabbar:内嵌 HomeFrame(精品 / 权益等),无内置 Tabbar
*/
.home-frame-container.scene-shell-root.mode-landscape
.home-content
>
.right-side
{
flex
:
1
1
0%
;
min-width
:
0
;
min-height
:
0
;
}
.home-frame-container.mode-landscape
.home-content.hf-content-without-tabbar
>
.right-side
{
flex
:
1
1
0%
;
min-width
:
0
;
min-height
:
0
;
}
/* 竖屏 column:主轴为高度,主槽须 min-height:0,与横屏 min-width 对称 */
.home-frame-container.scene-shell-root.mode-portrait
.home-content
>
.right-side
{
flex
:
1
1
0%
;
min-height
:
0
;
min-width
:
0
;
}
.home-frame-container.mode-portrait
.home-content.hf-content-without-tabbar
>
.right-side
{
flex
:
1
1
0%
;
min-height
:
0
;
min-width
:
0
;
}
}
.right-side
{
.right-side
{
...
@@ -43,12 +83,26 @@
...
@@ -43,12 +83,26 @@
order
:
1
;
order
:
1
;
}
}
.mode-portrait
.
left-side
-portrait
{
.mode-portrait
.
home-tabbar
-portrait
{
order
:
2
;
order
:
2
;
}
}
/* HomeFrame 仅主内容、Tabbar 由 SceneShell 提供时:单栏铺满 */
.hf-content-without-tabbar
.right-side
{
flex
:
1
;
width
:
100%
;
min-width
:
0
;
}
.mode-portrait
.hf-content-without-tabbar
.right-side
{
order
:
0
;
}
/* 横屏:Tabbar 在 DOM 中已先于 right-side,侧栏在物理左侧 */
// ===== 应用内容区 =====
// ===== 应用内容区 =====
.app-content-box
{
.app-content-box
{
/* 横屏:与左侧 Tabbar 用户区视觉对齐;竖屏见下方 .mode-portrait 覆盖 */
margin-top
:
40px
;
margin-top
:
40px
;
flex
:
1
;
flex
:
1
;
display
:
flex
;
display
:
flex
;
...
@@ -56,6 +110,10 @@
...
@@ -56,6 +110,10 @@
overflow
:
hidden
;
overflow
:
hidden
;
}
}
.mode-portrait
.app-content-box
{
margin-top
:
0
;
}
.right-content
{
.right-content
{
padding
:
0
var
(
--
l-spacing-xl
)
0
var
(
--
l-spacing-md
);
padding
:
0
var
(
--
l-spacing-xl
)
0
var
(
--
l-spacing-md
);
}
}
...
@@ -344,8 +402,8 @@
...
@@ -344,8 +402,8 @@
background
:
linear-gradient
(
to
right
,
#eeeeee
,
rgba
(
216
,
216
,
216
,
0
));
background
:
linear-gradient
(
to
right
,
#eeeeee
,
rgba
(
216
,
216
,
216
,
0
));
}
}
// =====
LeftSide 横屏导航基础样式
=====
// =====
HomeFrame Tabbar(横屏左侧 / 竖屏底部)
=====
.
left-side
{
.
home-tabbar
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
position
:
relative
;
position
:
relative
;
...
@@ -353,7 +411,7 @@
...
@@ -353,7 +411,7 @@
flex-shrink
:
0
;
flex-shrink
:
0
;
background-image
:
linear-gradient
(
to
bottom
,
#e8f0fe
,
#e8ecf5
);
background-image
:
linear-gradient
(
to
bottom
,
#e8f0fe
,
#e8ecf5
);
.
left-side
-bg-img
{
.
home-tabbar
-bg-img
{
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
top
:
0
;
top
:
0
;
...
@@ -364,17 +422,18 @@
...
@@ -364,17 +422,18 @@
}
}
.user-box
,
.user-box
,
.l
eft-tabs
,
.l
andscape-tabbar-wrap
,
.
left
-footer
{
.
home-tabbar
-footer
{
position
:
relative
;
position
:
relative
;
z-index
:
1
;
z-index
:
1
;
}
}
}
}
.left-side-pad
{
.home-tabbar-landscape
{
min-height
:
0
;
}
}
.
left-side
-portrait
{
.
home-tabbar
-portrait
{
width
:
100%
;
width
:
100%
;
flex-shrink
:
0
;
flex-shrink
:
0
;
flex-direction
:
column
;
flex-direction
:
column
;
...
@@ -397,7 +456,7 @@
...
@@ -397,7 +456,7 @@
height
:
30px
;
height
:
30px
;
}
}
.
left-side
-portrait-pad
{
.
home-tabbar
-portrait-pad
{
padding-bottom
:
6px
;
padding-bottom
:
6px
;
}
}
...
@@ -468,70 +527,73 @@
...
@@ -468,70 +527,73 @@
text-align
:
center
;
text-align
:
center
;
}
}
// LeftSide 横屏导航基础样式
// 横屏:中间区域放 un-tabbar(组件根节点通过 custom-style 纵向排列)
.left-tabs
{
.landscape-tabbar-wrap
{
flex
:
1
;
min-height
:
0
;
width
:
100%
;
width
:
100%
;
height
:
540px
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
center
;
justify-content
:
center
;
position
:
absolute
;
align-items
:
center
;
left
:
0
;
padding
:
8px
0
;
padding-left
:
16px
;
}
}
.tab-item
{
.landscape-un-tabbar
{
width
:
80px
;
width
:
100%
;
display
:
flex
;
flex
:
1
;
flex-direction
:
column
;
min-height
:
0
;
align-items
:
center
;
margin-bottom
:
12
.5px
;
}
}
.icon-box
{
.home-tabbar-footer
{
width
:
52px
;
margin-top
:
auto
;
height
:
52px
;
padding-bottom
:
40px
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
center
;
align-items
:
center
;
border-radius
:
26px
;
}
}
.icon-placeholder
{
.btn-placeholder
{
width
:
32px
;
width
:
40px
;
height
:
32px
;
height
:
40px
;
background-color
:
#8a98b5
;
background-color
:
#e8eaef
;
border-radius
:
8px
;
border-radius
:
20px
;
margin
:
var
(
--
l-spacing-sm
)
auto
0
;
}
}
.icon-active
{
// ========================================================================
background-color
:
#3773f8
;
// 首页布局调试(仅 pages/index 的 SceneShell 挂 hf-layout-debug 时生效)
// 验证横竖屏分区后删除:index.uvue 上的 hf-layout-debug + 本段样式
// ========================================================================
.hf-layout-debug.scene-shell-root
>
.home-content
>
.right-side
{
background-color
:
rgba
(
160
,
140
,
255
,
0
.22
);
}
}
.tab-label
{
.hf-layout-debug
.home-tabbar-landscape
{
font-size
:
13px
;
background-color
:
rgba
(
255
,
100
,
100
,
0
.38
)
!
important
;
color
:
#8a98b5
;
margin-top
:
6px
;
text-align
:
center
;
}
}
.tabActive
{
.hf-layout-debug
.home-tabbar-portrait
{
.tab-label
{
background-color
:
rgba
(
255
,
160
,
90
,
0
.42
)
!
important
;
color
:
#3773f8
;
}
}
}
.left-footer
{
/* 内层 HomeFrame(embed)整块主区 */
margin-top
:
auto
;
.hf-layout-debug
.hf-embed-in-tab-slot
>
.home-content
>
.right-side
{
padding-bottom
:
40px
;
background-color
:
rgba
(
90
,
200
,
220
,
0
.2
)
;
}
}
.btn-placeholder
{
.hf-layout-debug
.app-content-box.show-content-box
{
width
:
40px
;
background-color
:
rgba
(
120
,
120
,
120
,
0
.12
);
height
:
40px
;
}
background-color
:
#e8eaef
;
border-radius
:
20px
;
.hf-layout-debug
.start
{
margin
:
var
(
--
l-spacing-sm
)
auto
0
;
background-color
:
rgba
(
255
,
230
,
80
,
0
.55
)
!
important
;
}
.hf-layout-debug
.app-content-box
.content-left
.module-box
{
background-color
:
rgba
(
80
,
200
,
130
,
0
.4
);
}
.hf-layout-debug
.app-content-box
.content-left
.tool-box
{
background-color
:
rgba
(
80
,
140
,
255
,
0
.38
);
}
.hf-layout-debug
.app-content-box
.content-right
{
background-color
:
rgba
(
200
,
120
,
255
,
0
.38
);
}
}
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/landscape.uts
View file @
a80cc5e
...
@@ -12,7 +12,7 @@ export type LandscapeConfig = {
...
@@ -12,7 +12,7 @@ export type LandscapeConfig = {
toolBoxHeight: string
toolBoxHeight: string
toolBoxContentPaddingBottom?: string
toolBoxContentPaddingBottom?: string
//
LeftSide 导航
//
HomeFrame Tabbar(横屏)
leftTabsHeight: string
leftTabsHeight: string
leftTabsPaddingLeft: string
leftTabsPaddingLeft: string
iconBoxSize: string
iconBoxSize: string
...
@@ -30,7 +30,7 @@ export const LANDSCAPE_1174x768: LandscapeConfig = {
...
@@ -30,7 +30,7 @@ export const LANDSCAPE_1174x768: LandscapeConfig = {
toolBoxHeight: '152px',
toolBoxHeight: '152px',
toolBoxContentPaddingBottom: '14px',
toolBoxContentPaddingBottom: '14px',
//
LeftSide 导航
//
HomeFrame Tabbar(横屏)
leftTabsHeight: '560px',
leftTabsHeight: '560px',
leftTabsPaddingLeft: '18px',
leftTabsPaddingLeft: '18px',
iconBoxSize: '56px',
iconBoxSize: '56px',
...
@@ -46,7 +46,7 @@ export const LANDSCAPE_1920x1080: LandscapeConfig = {
...
@@ -46,7 +46,7 @@ export const LANDSCAPE_1920x1080: LandscapeConfig = {
moduleBoxHeight: '320px',
moduleBoxHeight: '320px',
toolBoxHeight: '480px',
toolBoxHeight: '480px',
//
LeftSide 导航
//
HomeFrame Tabbar(横屏)
leftTabsHeight: '620px',
leftTabsHeight: '620px',
leftTabsPaddingLeft: '22px',
leftTabsPaddingLeft: '22px',
iconBoxSize: '64px',
iconBoxSize: '64px',
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/portrait.uts
View file @
a80cc5e
...
@@ -15,7 +15,7 @@ export type PortraitConfig = {
...
@@ -15,7 +15,7 @@ export type PortraitConfig = {
toolBoxMarginBottom?: string
toolBoxMarginBottom?: string
toolBoxHeight?: string
toolBoxHeight?: string
//
LeftSide TabBar
//
HomeFrame Tabbar(竖屏)
leftSidePortraitPaddingBottom?: string
leftSidePortraitPaddingBottom?: string
tabbarHeight: number
tabbarHeight: number
tabbarIconSize: number
tabbarIconSize: number
...
@@ -34,7 +34,7 @@ export const PORTRAIT_768x1174: PortraitConfig = {
...
@@ -34,7 +34,7 @@ export const PORTRAIT_768x1174: PortraitConfig = {
toolBoxHeight: '552px',
toolBoxHeight: '552px',
toolBoxMarginBottom: '60px',
toolBoxMarginBottom: '60px',
//
LeftSide TabBar
//
HomeFrame Tabbar(竖屏)
leftSidePortraitPaddingBottom: '8px',
leftSidePortraitPaddingBottom: '8px',
tabbarHeight: 106,
tabbarHeight: 106,
tabbarIconSize: 60
tabbarIconSize: 60
...
@@ -44,7 +44,7 @@ export const PORTRAIT_768x1174: PortraitConfig = {
...
@@ -44,7 +44,7 @@ export const PORTRAIT_768x1174: PortraitConfig = {
* 其他竖屏分辨率(默认)
* 其他竖屏分辨率(默认)
*/
*/
export const PORTRAIT_COMMON: PortraitConfig = {
export const PORTRAIT_COMMON: PortraitConfig = {
//
LeftSide TabBar
//
HomeFrame Tabbar(竖屏)
tabbarHeight: 56,
tabbarHeight: 56,
tabbarIconSize: 24
tabbarIconSize: 24
};
};
...
...
apps/uniappX/uniapp-x-tape/pages.json
View file @
a80cc5e
...
@@ -31,13 +31,13 @@
...
@@ -31,13 +31,13 @@
}
}
},
},
{
{
"path"
:
"pages/reception
Shell
"
,
"path"
:
"pages/reception
Center/center
"
,
"style"
:
{
"style"
:
{
"navigationStyle"
:
"custom"
"navigationStyle"
:
"custom"
}
}
},
},
{
{
"path"
:
"pages/person
MyShell
"
,
"path"
:
"pages/person
/myCenter
"
,
"style"
:
{
"style"
:
{
"navigationStyle"
:
"custom"
"navigationStyle"
:
"custom"
}
}
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
{
{
"path"
:
"pages/index/index"
,
"path"
:
"pages/index/index"
,
"style"
:
{
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"首页"
"navigationBarTitleText"
:
"首页"
}
}
},
},
...
@@ -106,5 +107,34 @@
...
@@ -106,5 +107,34 @@
"backgroundColor"
:
"#F8F8F8"
,
"backgroundColor"
:
"#F8F8F8"
,
"pageOrientation"
:
"auto"
"pageOrientation"
:
"auto"
},
},
"tabBar"
:
{
"color"
:
"#8a98b5"
,
"selectedColor"
:
"#3773f8"
,
"borderStyle"
:
"black"
,
"backgroundColor"
:
"#ffffff"
,
"fontSize"
:
"11px"
,
"iconWidth"
:
"24px"
,
"height"
:
"50px"
,
"list"
:
[
{
"pagePath"
:
"pages/index/index"
,
"text"
:
"首页"
,
"iconPath"
:
"static/images/tabbar/home.png"
,
"selectedIconPath"
:
"static/images/tabbar/home-active.png"
},
{
"pagePath"
:
"pages/receptionCenter/center"
,
"text"
:
"接待中心"
,
"iconPath"
:
"static/images/tabbar/record.png"
,
"selectedIconPath"
:
"static/images/tabbar/record-active.png"
},
{
"pagePath"
:
"pages/person/myCenter"
,
"text"
:
"我的"
,
"iconPath"
:
"static/images/tabbar/study.png"
,
"selectedIconPath"
:
"static/images/tabbar/study-active.png"
}
]
},
"uniIdRouter"
:
{}
"uniIdRouter"
:
{}
}
}
apps/uniappX/uniapp-x-tape/pages/boutique/components/Boutique
Landscape
.uvue
→
apps/uniappX/uniapp-x-tape/pages/boutique/components/Boutique
HomePanel
.uvue
View file @
a80cc5e
<template>
<template>
<view class="page-container container">
<view class="page-container boutique-home-panel">
<HomeFrame
<HomeFrame ref="homeRef"
ref="homeRef"
class="boutique-home-frame-root"
:embed-in-tab-slot="true"
:show-footer="true"
:show-footer="true"
:show-tabbar="false"
:swiper-custom="true"
:swiper-custom="true"
:intro-load-complete="logic.loadComplete.value"
:intro-load-complete="logic.loadComplete.value"
:intro-swiper-list="boutiqueIntroSwiperList"
:intro-swiper-list="boutiqueIntroSwiperList"
...
@@ -11,16 +13,13 @@
...
@@ -11,16 +13,13 @@
intro-empty-title="暂无套餐"
intro-empty-title="暂无套餐"
:intro-empty-text="boutiqueIntroEmptyText"
:intro-empty-text="boutiqueIntroEmptyText"
@intro-slide-tap="onIntroSlideTap"
@intro-slide-tap="onIntroSlideTap"
@start="handleStart"
@start="handleStart">
>
</HomeFrame>
</HomeFrame>
<CenterPopup
<CenterPopup ref="customerTypeRef"
ref="customerTypeRef"
:list="logic.typeList"
:list="logic.typeList"
title="请选择当前洽谈的客户类型"
title="请选择当前洽谈的客户类型"
@choose="onChooseCustomerType"
@choose="onChooseCustomerType" />
/>
<PackageDetailPopup ref="packageRef" @close="closePackageDetail">
<PackageDetailPopup ref="packageRef" @close="closePackageDetail">
<view class="package-detail-box">
<view class="package-detail-box">
...
@@ -37,7 +36,8 @@
...
@@ -37,7 +36,8 @@
套餐介绍
套餐介绍
</view>
</view>
<view class="package-content">
<view class="package-content">
<rich-text :nodes="logic.chooseItem.value.scriptIntroduction != null ? (logic.chooseItem.value.scriptIntroduction as string) : ''"></rich-text>
<rich-text :nodes="logic.chooseItem.value.scriptIntroduction != null ? (logic.chooseItem.value.scriptIntroduction as string) : ''">
</rich-text>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -46,16 +46,17 @@
...
@@ -46,16 +46,17 @@
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { ComponentPublicInstance, computed, ref } from "vue";
import { ComponentPublicInstance, computed, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import CenterPopup from "@/components/CenterPopup.uvue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue";
import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue";
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
const props = defineProps<{
const props = defineProps<{
logic: BoutiqueLogic
;
logic: BoutiqueLogic
}>();
}>();
const logic = props.logic;
const logic = props.logic;
...
@@ -93,18 +94,13 @@ const boutiqueIntroEmptyText = computed((): string => {
...
@@ -93,18 +94,13 @@ const boutiqueIntroEmptyText = computed((): string => {
const t = logic.swiperNoDataObject["text"];
const t = logic.swiperNoDataObject["text"];
return t != null ? `${t}` : "敬请期待";
return t != null ? `${t}` : "敬请期待";
});
});
const homeRef = ref(null);
const homeRef = ref(null);
const customerTypeRef = ref(null);
const customerTypeRef = ref(null);
const packageRef = ref(null);
const packageRef = ref(null);
function callExposedMethod(comp: any, methodName: string): void {
function callExposedMethod(comp: any, methodName: string): void {
if (comp == null) return;
if (comp == null) return;
const obj = comp as UTSJSONObject;
(comp as ComponentPublicInstance).$callMethod(methodName);
const fn = obj[methodName];
if (fn != null && typeof fn === "function") {
(fn as () => void)();
}
}
}
function handleStart(): void {
function handleStart(): void {
...
@@ -132,23 +128,32 @@ function closePackageDetail(): void {
...
@@ -132,23 +128,32 @@ function closePackageDetail(): void {
}
}
function updateHome(): void {
function updateHome(): void {
// 横屏默认进入详情(保持旧行为)
logic.jumpPage(homeRef.value as any, "");
logic.jumpPage(homeRef.value as any, "");
}
}
defineExpose({
defineExpose({
updateHome:
updateHome
updateHome
});
});
</script>
</script>
<style scoped lang="scss">
<style scoped lang="scss">
.page-container {
/* 套在 SceneShell flex 链内时,仅用 height:100% 竖屏常算不出高度;与权益页同级结构一致用 flex 占满 */
.page-container.boutique-home-panel {
flex: 1;
width: 100%;
width: 100%;
height: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
position: relative;
box-sizing: border-box;
}
}
.container {
.boutique-home-frame-root {
position: relative;
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
}
}
.package-detail-box {
.package-detail-box {
...
...
apps/uniappX/uniapp-x-tape/pages/boutique/components/BoutiquePortrait.uvue
deleted
100644 → 0
View file @
9754b52
<template>
<view class="page-container container">
<HomeFrame ref="homeRef"
:show-footer="true"
:swiper-custom="true"
:intro-load-complete="logic.loadComplete.value"
:intro-swiper-list="boutiqueIntroSwiperList"
:intro-modules="logic.packageList.value"
intro-eyebrow="精品轻改"
intro-empty-title="暂无套餐"
:intro-empty-text="boutiqueIntroEmptyText"
@intro-slide-tap="onIntroSlideTap"
@start="handleStart">
</HomeFrame>
<CenterPopup ref="customerTypeRef"
:list="logic.typeList"
title="请选择当前洽谈的客户类型"
@choose="onChooseCustomerType" />
<PackageDetailPopup ref="packageRef" @close="closePackageDetail">
<view class="package-detail-box">
<view class="package-box">
<view class="package-name">
套餐内容
</view>
<view class="package-content">
<rich-text :nodes="logic.chooseItem.value.content != null ? (logic.chooseItem.value.content as string) : ''"></rich-text>
</view>
</view>
<view class="package-box package-detail">
<view class="package-name">
套餐介绍
</view>
<view class="package-content">
<rich-text :nodes="logic.chooseItem.value.scriptIntroduction != null ? (logic.chooseItem.value.scriptIntroduction as string) : ''">
</rich-text>
</view>
</view>
</view>
</PackageDetailPopup>
</view>
</template>
<script setup lang="uts">
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { ComponentPublicInstance, computed, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
const props = defineProps<{
logic: BoutiqueLogic;
}>();
const logic = props.logic;
const PKG_BANNER_FALLBACK: UTSJSONObject = {
"1": "/static/images/boutique/package-1.webp",
"2": "/static/images/boutique/package-2.webp"
} as UTSJSONObject;
function bannerUrlForItem(item: any): string {
const u = logic.getPkg(item, "bannerImg") as string;
if (u != null && u !== "") {
return u;
}
const tKey = `${logic.getPkg(item, "type")}`;
const fb = PKG_BANNER_FALLBACK[tKey];
if (fb != null && typeof fb === "string" && fb !== "") {
return fb as string;
}
return "/static/images/boutique/package-1.webp";
}
const boutiqueIntroSwiperList = computed((): UnSwiperItem[] => {
const list = logic.packageList.value;
const out: UnSwiperItem[] = [];
for (let i = 0; i < list.length; i++) {
out.push({
url: bannerUrlForItem(list[i])
} as UnSwiperItem);
}
return out;
});
const boutiqueIntroEmptyText = computed((): string => {
const t = logic.swiperNoDataObject["text"];
return t != null ? `${t}` : "敬请期待";
});
const homeRef = ref(null);
const customerTypeRef = ref(null);
const packageRef = ref(null);
function callExposedMethod(comp: any, methodName: string): void {
if (comp == null) return;
// uni-app x 组件实例在运行时不一定能 cast 成 UTSJSONObject;用 $callMethod 最稳
(comp as ComponentPublicInstance).$callMethod(methodName);
}
function handleStart(): void {
callExposedMethod(customerTypeRef.value as any, "open");
}
function onChooseCustomerType(index: number): void {
logic.chooseCustomerType(homeRef.value as any, index);
}
function toDetail(index: number): void {
const item = logic.packageList.value[index];
if (item != null) {
logic.chooseItem.value = item as UTSJSONObject;
callExposedMethod(packageRef.value as any, "open");
}
}
function onIntroSlideTap(index: number): void {
toDetail(index);
}
function closePackageDetail(): void {
logic.chooseItem.value = {};
}
function updateHome(): void {
// 竖屏进入时也保持旧行为:如果需要自动跳转详情,复用逻辑层 jumpPage
logic.jumpPage(homeRef.value as any, "");
}
defineExpose({
updateHome
});
</script>
<style scoped lang="scss">
.page-container {
width: 100%;
height: 100%;
}
.container {
position: relative;
}
</style>
apps/uniappX/uniapp-x-tape/pages/boutique/index.uvue
View file @
a80cc5e
<template>
<template>
<layout-root>
<view class="boutique-redirect"></view>
<BoutiquePortrait v-if="isPortrait"
ref="portraitRef"
:logic="logic" />
<BoutiqueLandscape v-else
ref="landscapeRef"
:logic="logic" />
</layout-root>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { computed, ref } from "vue";
onLoad(() => {
uni.switchTab({
import BoutiqueLandscape from "@/pages/boutique/components/BoutiqueLandscape.uvue";
url: "/pages/index/index",
import BoutiquePortrait from "@/pages/boutique/components/BoutiquePortrait.uvue";
fail: (_err: any) => {
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
uni.reLaunch({ url: "/pages/index/index" });
import { layoutService } from "@/services/LayoutService.uts";
}
});
const logic = useBoutiqueLogic();
const isPortrait = computed(() => layoutService.isMode("portrait"));
// 注意:UTS 运行时对组件实例的类型转换较严格(容易触发 ClassCastException)。
// 这里不再通过父组件 ref 去调用子组件 expose 方法,避免运行时崩溃。
const landscapeRef = ref(null);
const portraitRef = ref(null);
onShow(async () => {
if (logic.ensureLoginOrRelauch() === false) return;
await logic.initIfNeeded();
logic.getBoutiquePackageList();
});
});
</script>
</script>
<style scoped lang="scss">
<style scoped lang="scss">
/* 入口页不承载具体样式,样式下沉到横竖屏组件 */
.boutique-redirect {
width: 100%;
height: 100%;
}
</style>
</style>
apps/uniappX/uniapp-x-tape/pages/common/components/MerchantList.uvue
View file @
a80cc5e
...
@@ -103,7 +103,12 @@ function jumpPage(item: MerchantItem, openSceneArr: number[]): void {
...
@@ -103,7 +103,12 @@ function jumpPage(item: MerchantItem, openSceneArr: number[]): void {
}
}
newUserInfo.sceneType = usedCarSceneType;
newUserInfo.sceneType = usedCarSceneType;
storage.set("userInfo", newUserInfo, 0);
storage.set("userInfo", newUserInfo, 0);
uni.reLaunch({ url: "/pages/usedCar/index" });
uni.switchTab({
url: "/pages/index/index",
fail: (_err: any) => {
uni.reLaunch({ url: "/pages/index/index" });
}
});
}).catch((error): void => {
}).catch((error): void => {
uni.showToast({ title: "网络异常", icon: "none" });
uni.showToast({ title: "网络异常", icon: "none" });
});
});
...
...
apps/uniappX/uniapp-x-tape/pages/common/components/Scene.uvue
View file @
a80cc5e
...
@@ -98,52 +98,29 @@ function jump(info: UTSJSONObject, data: any | null): void {
...
@@ -98,52 +98,29 @@ function jump(info: UTSJSONObject, data: any | null): void {
info.staffUuid = info.uuid;
info.staffUuid = info.uuid;
storage.set("userInfo", info, 0);
storage.set("userInfo", info, 0);
const sceneType = info.sceneType as null | number;
storage.remove("boutique_YQorderSetting");
storage.remove("boutique_YQorderSetting");
let url = "/pages/index/index";
const url = "/pages/index/index";
switch (sceneType) {
case 0: {
url = "/pages/equity/index";
break;
}
case 1: {
// 精品页统一入口:由入口页内部决定横竖屏组件
url = "/pages/boutique/index";
break;
}
case 7: {
url = "/pages/usedCar/index";
break;
}
}
console.log(`准备跳转: ${ url}`);
console.log(`准备跳转: ${ url}`);
uni.switchTab({
url,
fail: (_err: any) => {
uni.reLaunch({ url });
uni.reLaunch({ url });
}
});
}).catch((error) => {
}).catch((error) => {
console.error(`getMerchantBrand 失败: ${ JSON.stringify(error)}`);
console.error(`getMerchantBrand 失败: ${ JSON.stringify(error)}`);
info.channelType = 1;
info.channelType = 1;
storage.set("userInfo", info, 0);
storage.set("userInfo", info, 0);
const sceneType = info.sceneType as null | number;
const url = "/pages/index/index";
let url = "/pages/index/index";
switch (sceneType) {
case 0: {
url = "/pages/equity/index";
break;
}
case 1: {
// 精品页统一入口:由入口页内部决定横竖屏组件
url = "/pages/boutique/index";
break;
}
case 7: {
url = "/pages/usedCar/index";
break;
}
}
console.log(`准备跳转(catch): ${ url}`);
console.log(`准备跳转(catch): ${ url}`);
uni.switchTab({
url,
fail: (_err: any) => {
uni.reLaunch({ url });
uni.reLaunch({ url });
}
});
});
});
}
}
...
...
apps/uniappX/uniapp-x-tape/pages/equity/components/EquityHomePanel.uvue
0 → 100644
View file @
a80cc5e
<template>
<view class="page-container equity-page hf-equity-tab-root fade-in">
<HomeFrame ref="homeRef"
:embed-in-tab-slot="true"
:show-tabbar="false"
:show-footer="true"
:swiper-custom="true"
:intro-load-complete="loadComplete"
:intro-swiper-list="equitySwiperList"
:intro-modules="moduleList"
intro-eyebrow="权益中心"
intro-empty-title="权益配置中"
@intro-slide-tap="onIntroSlideTap"
@start="handleStart">
</HomeFrame>
</view>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue";
import { UnSwiperItem } from "@/uni_modules/uview-unix";
import { getCarBrandsListApi, getEmployeeListApi, getMerchantCarBrandList } from "@/api/common-api.uts";
import { getMockData, getSoureData } from "@/api/system-api.uts";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import { dispatch, state } from "@/store/index.uts";
import { storage } from "@/utils/storage.uts";
const homeRef = ref(null);
const loadComplete = ref<boolean>(false);
const moduleList = ref<Array<any>>([]);
const toolList = ref<Array<any>>([]);
const mediaId = ref<number | string>("");
const EQUITY_SWIPER_PLACEHOLDER = "/static/images/login/nothing.webp";
function normalizeModuleItem(item: any): UTSJSONObject {
const obj = item as UTSJSONObject;
const detailTitle =
(obj.detailTitle as null | string)
?? (obj.materialTitle as null | string)
?? (obj.shortTitle as null | string)
?? (obj.materialName as null | string)
?? (obj.title as null | string)
?? (obj.name as null | string)
?? "";
const briefIntroduction =
(obj.briefIntroduction as null | string)
?? (obj.productIntroduction as null | string)
?? (obj.introduction as null | string)
?? (obj.desc as null | string)
?? "";
return {
...obj,
detailTitle,
briefIntroduction
} as UTSJSONObject;
}
function normalizeViewData(data: any): UTSJSONObject {
const src = data as UTSJSONObject;
const rawModuleList =
(src.moduleList as null | Array<any>)
?? (src.materialInfoList as null | Array<any>)
?? [];
const modules = rawModuleList.map((item: any) => normalizeModuleItem(item));
const tools = (src.toolList as null | Array<any>) ?? [];
return {
...src,
moduleList: modules,
toolList: tools
} as UTSJSONObject;
}
function isRenderableImage(value: string): boolean {
if (value == null || value == "") {
return false;
}
if (
value.startsWith("http://")
|| value.startsWith("https://")
|| value.startsWith("file://")
|| value.startsWith("content://")
|| value.startsWith("/")
|| value.startsWith("./")
|| value.startsWith("../")
) {
return true;
}
if (value.startsWith("data:image/")) {
const marker = "base64,";
const markerIndex = value.indexOf(marker);
if (markerIndex < 0) {
return false;
}
const raw = value.slice(markerIndex + marker.length).replace(/\s/g, "");
if (raw == "" || raw.length < 16) {
return false;
}
if (raw.indexOf("\uFFFD") >= 0) {
return false;
}
return /^[A-Za-z0-9+/=]+$/.test(raw);
}
return false;
}
function pickModuleCover(obj: UTSJSONObject): string {
const candidates = [
obj.thumbnail as any | null,
obj.thumbnailUrl as any | null,
obj.bannerImg as any | null,
obj.contentPicUrl as any | null,
obj.homeEntranceCover as any | null,
obj.imageUrl as any | null,
obj.imgUrl as any | null,
obj.coverUrl as any | null,
obj.coverImg as any | null,
obj.productPoster as any | null,
obj.detailUrl as any | null
];
for (const candidate of candidates) {
if (candidate == null || typeof candidate !== "string") {
continue;
}
const src = candidate as string;
if (isRenderableImage(src)) {
return src;
}
}
return "";
}
function setViewInfo(data: any): void {
const dataObj = normalizeViewData(data);
moduleList.value = dataObj.moduleList as Array<any>;
toolList.value = dataObj.toolList as Array<any>;
const idValue = dataObj.id;
mediaId.value = typeof idValue === "number" ? idValue.toString() : (idValue as string) ?? "";
loadComplete.value = true;
console.log("[equity] setViewInfo data:", dataObj);
console.log("[equity] setViewInfo moduleList:", moduleList.value);
if (moduleList.value.length > 0) {
console.log("[equity] setViewInfo first module:", moduleList.value[0]);
}
}
function handleStart(): void {
uni.navigateTo({ url: `/pages/equity/detail/index` });
}
function getReceptionCover(obj: UTSJSONObject): string {
const source = obj.receptionSourceDetailList;
if (source == null) {
return "";
}
if (Array.isArray(source)) {
const list = source as Array<any>;
for (const item of list) {
if (item == null) {
continue;
}
const itemObj = item as UTSJSONObject;
const detailUrl = itemObj.detailUrl as string;
if (detailUrl != null && isRenderableImage(detailUrl)) {
return detailUrl;
}
}
return "";
}
if (typeof source === "object") {
const sourceObj = source as UTSJSONObject;
const detailUrl = sourceObj.detailUrl as string;
if (detailUrl != null && isRenderableImage(detailUrl)) {
return detailUrl;
}
for (const key in sourceObj) {
const value = sourceObj[key];
if (value != null && typeof value === "string" && isRenderableImage(value as string)) {
return value as string;
}
if (value != null && typeof value === "object") {
const nestedObj = value as UTSJSONObject;
const nestedUrl = nestedObj.detailUrl as string;
if (nestedUrl != null && isRenderableImage(nestedUrl)) {
return nestedUrl;
}
}
}
}
return "";
}
function getToolCoverById(moduleId: any | null): string {
if (moduleId == null) {
return "";
}
for (const item of toolList.value) {
const itemObj = item as UTSJSONObject;
if (itemObj.id == moduleId) {
const cover = itemObj.shortTitleUrl as string;
if (cover != null && isRenderableImage(cover)) {
return cover;
}
}
}
return "";
}
const equitySwiperList = computed((): UnSwiperItem[] => {
const list = moduleList.value;
const out: UnSwiperItem[] = [];
for (let i = 0; i < list.length; i++) {
const obj = list[i] as UTSJSONObject;
let cover = pickModuleCover(obj);
if (cover == null || cover == "") {
const receptionCover = getReceptionCover(obj);
if (receptionCover != "") {
cover = receptionCover;
} else {
const moduleId: any | null = obj.id;
cover = getToolCoverById(moduleId);
}
}
out.push({
url: cover != "" ? cover : EQUITY_SWIPER_PLACEHOLDER
} as UnSwiperItem);
}
return out;
});
function toPreview(item: any): void {
const obj = item as UTSJSONObject;
const id = obj.id as null | number | string;
if (id == null) return;
uni.navigateTo({ url: `/pages/equity/detail/index?id=${id}&type=preview` });
}
function onIntroSlideTap(index: number): void {
const list = moduleList.value;
if (index >= 0 && index < list.length) {
toPreview(list[index]);
}
}
async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promise<void> {
const userInfo = storage.get("userInfo") as UTSJSONObject;
const shopMerchantId: string = (userInfo.shopMerchantId as string) ?? "";
const sceneType: number = (userInfo.sceneType as number) ?? 0;
const storageKey = `source_${sceneType}_${shopMerchantId}`;
const cachedData = uni.getStorageSync(storageKey);
let data: null | UTSJSONObject = null;
if (cachedData != null && cachedData !== "") {
try {
if (typeof cachedData === "string") {
data = JSON.parse<UTSJSONObject>(cachedData as string);
} else if (cachedData instanceof UTSJSONObject) {
data = cachedData;
}
} catch (error) {
console.error("解析缓存数据失败:", error);
}
}
console.log(data);
if (data != null) {
setViewInfo(data);
}
try {
const requestData = await getSoureData(shopMerchantId, sceneType, {
brandIdList,
subBrandIdList
});
console.log("[equity] getSoureData response:", requestData);
if (requestData != null) {
setViewInfo(requestData as UTSJSONObject);
} else {
loadComplete.value = true;
}
} catch (error) {
console.error("获取数据失败:", error);
loadComplete.value = true;
}
}
/** 按序加载车型 */
async function getCarBrandsList(carBrandList: Array<any>, index: number) {
const item = carBrandList[index] as UTSJSONObject;
if (item == null) return;
const storageKey = `${(item.id as number)}_${(item.brandId as number)}_carlist`;
const carList = uni.getStorageSync(storageKey);
if (index < carBrandList.length - 1) {
const nextIndex = index + 1;
if (carList == null) {
const list = await getCarBrandsListApi({
brandId: (item.brandId as string) ?? "",
childBrandId: (item.id as string) ?? ""
});
if (list != null) {
uni.setStorageSync(storageKey, list);
}
getCarBrandsList(carBrandList, nextIndex);
} else {
getCarBrandsList(carBrandList, nextIndex);
}
}
}
function get_Vehicle_Sales_Data(): void {
const userInfo = storage.get("userInfo") as UTSJSONObject;
const storageCarBrandList = storage.get("carBrandList");
const storageEmployeeList = storage.get("employeeList");
const shopMerchantId = userInfo.shopMerchantId;
getMerchantCarBrandList([shopMerchantId ?? ""]).then((res: any) => {
const resObj = res as UTSJSONObject;
const dataArray = resObj.data as Array<any>;
const firstItem = dataArray[0] as UTSJSONObject;
const carBrandList = [] as any[];
const list = firstItem.carBrandList as Array<any>;
const brandIdList: number[] = [];
const subBrandIdList: number[] = [];
list?.forEach((e: any) => {
const eObj = e as UTSJSONObject;
const childs = eObj.childs as Array<any>;
childs.forEach((i: any) => {
const iObj = i as UTSJSONObject;
iObj.brandName = (eObj.name as string) ?? "";
iObj.brandId = (eObj.id as number);
carBrandList.push(iObj);
const idStr: number = (iObj.id as number);
subBrandIdList.push(idStr);
});
const idStr: number = (eObj.id as number);
brandIdList.push(idStr);
});
getSoure(brandIdList, subBrandIdList);
dispatch("setCarBrandsList", carBrandList);
storage.set("carBrandList", carBrandList, 0);
if (carBrandList.length > 0) {
const index = 0;
getCarBrandsList(carBrandList, index);
}
});
/** 获取销售人员 */
getEmployeeListApi({
merchantId: shopMerchantId
}).then(res => {
dispatch("setEmployeeList", res);
storage.set("employeeList", res, 0);
});
}
onLoad((_options) => {
getMockData(true).then(mockdata => {
console.log(mockdata, "===");
const userInfo = storage.get("userInfo") as UTSJSONObject;
const mockDataObj = mockdata as UTSJSONObject;
const channelType = userInfo.channelType as number;
if (channelType == 1 && mockDataObj.boutiqueDefaultCarBrandId != null) {
state.user.boutiqueDefaultCarBrandId = (mockDataObj.boutiqueDefaultCarBrandId as number);
if (mockDataObj.defaultCarId != null) {
state.user.defaultCarId = (mockDataObj.defaultCarId as number);
}
}
});
get_Vehicle_Sales_Data();
});
onShow(() => {
const userInfo = storage.get("userInfo");
if (userInfo == null) {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
const userInfoObj = userInfo as UTSJSONObject;
const shopMerchantId = (userInfoObj.shopMerchantId as string) ?? "";
const sceneType = (userInfoObj.sceneType as number) ?? 0;
if (shopMerchantId == null) {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
if (homeRef.value != null) {
(homeRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
@import "../styles/landscape.scss";
@import "../styles/portrait.scss";
/* 与 BoutiqueHomePanel 一致:嵌在 SceneShell 槽内时参与 flex,避免竖屏高度链断掉 */
.hf-equity-tab-root {
flex: 1;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
</style>
apps/uniappX/uniapp-x-tape/pages/equity/index.uvue
View file @
a80cc5e
<template>
<template>
<layout-root>
<view class="equity-redirect"></view>
<view class="page-container equity-page fade-in">
<HomeFrame ref="homeRef"
:show-footer="true"
:swiper-custom="true"
:intro-load-complete="loadComplete"
:intro-swiper-list="equitySwiperList"
:intro-modules="moduleList"
intro-eyebrow="权益中心"
intro-empty-title="权益配置中"
@intro-slide-tap="onIntroSlideTap"
@start="handleStart">
</HomeFrame>
</view>
</layout-root>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue";
onLoad(() => {
import { UnSwiperItem } from '@/uni_modules/uview-unix';
uni.switchTab({
url: "/pages/index/index",
import { getCarBrandsListApi, getEmployeeListApi, getMerchantCarBrandList } from "@/api/common-api.uts";
fail: (_err: any) => {
import { getMockData, getSoureData } from "@/api/system-api.uts";
uni.reLaunch({ url: "/pages/index/index" });
import HomeFrame from "@/components/HomeFrame/index.uvue";
import { dispatch, state } from "@/store/index.uts";
// import { onLoad, onShow } from '@dcloudio/uni-app'
import { storage } from "@/utils/storage.uts";
const homeRef = ref(null);
const detailRef = ref(null);
const loadComplete = ref<boolean>(false);
const moduleList = ref<Array<any>>([]);
const toolList = ref<Array<any>>([]);
const mediaId = ref<number | string>("");
const EQUITY_SWIPER_PLACEHOLDER = "/static/images/login/nothing.webp";
function normalizeModuleItem(item: any): UTSJSONObject {
const obj = item as UTSJSONObject;
const detailTitle =
(obj.detailTitle as null | string)
?? (obj.materialTitle as null | string)
?? (obj.shortTitle as null | string)
?? (obj.materialName as null | string)
?? (obj.title as null | string)
?? (obj.name as null | string)
?? "";
const briefIntroduction =
(obj.briefIntroduction as null | string)
?? (obj.productIntroduction as null | string)
?? (obj.introduction as null | string)
?? (obj.desc as null | string)
?? "";
return {
...obj,
detailTitle,
briefIntroduction
} as UTSJSONObject;
}
function normalizeViewData(data: any): UTSJSONObject {
const src = data as UTSJSONObject;
const rawModuleList =
(src.moduleList as null | Array<any>)
?? (src.materialInfoList as null | Array<any>)
?? [];
const modules = rawModuleList.map((item: any) => normalizeModuleItem(item));
const tools = (src.toolList as null | Array<any>) ?? [];
return {
...src,
moduleList: modules,
toolList: tools
} as UTSJSONObject;
}
function isRenderableImage(value: string): boolean {
if (value == null || value == "") {
return false;
}
if (
value.startsWith("http://")
|| value.startsWith("https://")
|| value.startsWith("file://")
|| value.startsWith("content://")
|| value.startsWith("/")
|| value.startsWith("./")
|| value.startsWith("../")
) {
return true;
}
if (value.startsWith("data:image/")) {
const marker = "base64,";
const markerIndex = value.indexOf(marker);
if (markerIndex < 0) {
return false;
}
const raw = value.slice(markerIndex + marker.length).replace(/\s/g, "");
if (raw == "" || raw.length < 16) {
return false;
}
if (raw.indexOf("�") >= 0) {
return false;
}
return /^[A-Za-z0-9+/=]+$/.test(raw);
}
return false;
}
function pickModuleCover(obj: UTSJSONObject): string {
const candidates = [
obj.thumbnail as any | null,
obj.thumbnailUrl as any | null,
obj.bannerImg as any | null,
obj.contentPicUrl as any | null,
obj.homeEntranceCover as any | null,
obj.imageUrl as any | null,
obj.imgUrl as any | null,
obj.coverUrl as any | null,
obj.coverImg as any | null,
obj.productPoster as any | null,
obj.detailUrl as any | null
];
for (const candidate of candidates) {
if (candidate == null || typeof candidate !== "string") {
continue;
}
const src = candidate as string;
if (isRenderableImage(src)) {
return src;
}
}
return "";
}
function setViewInfo(data: any): void {
const dataObj = normalizeViewData(data);
moduleList.value = dataObj.moduleList as Array<any>;
toolList.value = dataObj.toolList as Array<any>;
const idValue = dataObj.id;
mediaId.value = typeof idValue === "number" ? idValue.toString() : (idValue as string) ?? "";
loadComplete.value = true;
console.log("[equity] setViewInfo data:", dataObj);
console.log("[equity] setViewInfo moduleList:", moduleList.value);
if (moduleList.value.length > 0) {
console.log("[equity] setViewInfo first module:", moduleList.value[0]);
const firstObj = moduleList.value[0] as UTSJSONObject;
const firstCover = pickModuleCover(firstObj);
}
// 直接将数据属性设置到 state.user 上
// const userState = state.user as UserStateType;
// for (const key in dataObj) {
// if (key !== "moduleList" && key !== "toolList" && key !== "id") {
// (userState as any)[key] = dataObj[key];
// }
// }
}
function handleStart(): void {
// const currentModuleList = moduleList.value;
// if (currentModuleList.length === 0) {
// return uni.showToast({
// title: "该场景尚未配置素材,请联系总部人员",
// icon: "none"
// });
// }
// const firstItem = currentModuleList[0] as UTSJSONObject;
// const firstId = firstItem.id as number;
// uni.navigateTo({ url: `/pages/equity/detail/index?id=${firstId}&type=edit` });
uni.navigateTo({ url: `/pages/equity/detail/index` });
}
function getReceptionCover(obj: UTSJSONObject): string {
const source = obj.receptionSourceDetailList;
if (source == null) {
return "";
}
if (Array.isArray(source)) {
const list = source as Array<any>;
for (const item of list) {
if (item == null) {
continue;
}
const itemObj = item as UTSJSONObject;
const detailUrl = itemObj.detailUrl as string;
if (detailUrl != null && isRenderableImage(detailUrl)) {
return detailUrl;
}
}
return "";
}
if (typeof source === "object") {
const sourceObj = source as UTSJSONObject;
const detailUrl = sourceObj.detailUrl as string;
if (detailUrl != null && isRenderableImage(detailUrl)) {
return detailUrl;
}
for (const key in sourceObj) {
const value = sourceObj[key];
if (value != null && typeof value === "string" && isRenderableImage(value as string)) {
return value as string;
}
if (value != null && typeof value === "object") {
const nestedObj = value as UTSJSONObject;
const nestedUrl = nestedObj.detailUrl as string;
if (nestedUrl != null && isRenderableImage(nestedUrl)) {
return nestedUrl;
}
}
}
}
return "";
}
function getToolCoverById(moduleId: any | null): string {
if (moduleId == null) {
return "";
}
for (const item of toolList.value) {
const itemObj = item as UTSJSONObject;
if (itemObj.id == moduleId) {
const cover = itemObj.shortTitleUrl as string;
if (cover != null && isRenderableImage(cover)) {
return cover;
}
}
}
return "";
}
const equitySwiperList = computed((): UnSwiperItem[] => {
const list = moduleList.value;
const out: UnSwiperItem[] = [];
for (let i = 0; i < list.length; i++) {
const obj = list[i] as UTSJSONObject;
let cover = pickModuleCover(obj);
if (cover == null || cover == "") {
const receptionCover = getReceptionCover(obj);
if (receptionCover != "") {
cover = receptionCover;
} else {
const moduleId: any | null = obj.id;
cover = getToolCoverById(moduleId);
}
}
out.push({
url: cover != "" ? cover : EQUITY_SWIPER_PLACEHOLDER
} as UnSwiperItem);
}
}
return out;
});
function toPreview(item: any): void {
const obj = item as UTSJSONObject;
const id = obj.id as null | number | string;
if (id == null) return;
uni.navigateTo({ url: `/pages/equity/detail/index?id=${id}&type=preview` });
}
function onIntroSlideTap(index: number): void {
const list = moduleList.value;
if (index >= 0 && index < list.length) {
toPreview(list[index]);
}
}
async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promise<void> {
const userInfo = storage.get("userInfo") as UTSJSONObject;
const shopMerchantId: string = (userInfo.shopMerchantId as string) ?? "";
const sceneType: number = (userInfo.sceneType as number) ?? 0;
const storageKey = `source_${sceneType}_${shopMerchantId}`;
const cachedData = uni.getStorageSync(storageKey);
let data: null | UTSJSONObject = null;
if (cachedData != null && cachedData !== "") {
try {
if (typeof cachedData === "string") {
data = JSON.parse<UTSJSONObject>(cachedData as string);
} else if (cachedData instanceof UTSJSONObject) {
data = cachedData;
}
} catch (error) {
console.error("解析缓存数据失败:", error);
}
}
console.log(data);
if (data != null) {
setViewInfo(data);
}
try {
const requestData = await getSoureData(shopMerchantId, sceneType, {
brandIdList,
subBrandIdList
});
});
console.log("[equity] getSoureData response:", requestData);
if (requestData != null) {
setViewInfo(requestData as UTSJSONObject);
} else {
loadComplete.value = true;
}
} catch (error) {
console.error("获取数据失败:", error);
loadComplete.value = true;
}
}
/** 按序加载车型 */
async function getCarBrandsList(carBrandList: Array<any>, index: number) {
const item = carBrandList[index] as UTSJSONObject;
if (item == null) return;
const storageKey = `${(item.id as number)}_${(item.brandId as number)}_carlist`;
const carList = uni.getStorageSync(storageKey);
if (index < carBrandList.length - 1) {
const nextIndex = index + 1;
if (carList == null) {
const list = await getCarBrandsListApi({
brandId: (item.brandId as string) ?? "",
childBrandId: (item.id as string) ?? ""
});
if (list != null) {
uni.setStorageSync(storageKey, list);
}
getCarBrandsList(carBrandList, nextIndex);
} else {
getCarBrandsList(carBrandList, nextIndex);
}
}
}
function get_Vehicle_Sales_Data(): void {
const userInfo = storage.get("userInfo") as UTSJSONObject;
const storageCarBrandList = storage.get("carBrandList");
const storageEmployeeList = storage.get("employeeList");
const shopMerchantId = userInfo.shopMerchantId;
getMerchantCarBrandList([shopMerchantId ?? ""]).then((res: any) => {
const resObj = res as UTSJSONObject;
const dataArray = resObj.data as Array<any>;
const firstItem = dataArray[0] as UTSJSONObject;
const carBrandList = [] as any[];
const list = firstItem.carBrandList as Array<any>;
const brandIdList: number[] = [];
const subBrandIdList: number[] = [];
list?.forEach((e: any) => {
const eObj = e as UTSJSONObject;
const childs = eObj.childs as Array<any>;
childs.forEach((i: any) => {
const iObj = i as UTSJSONObject;
iObj.brandName = (eObj.name as string) ?? "";
iObj.brandId = (eObj.id as number);
carBrandList.push(iObj);
const idStr: number = (iObj.id as number);
subBrandIdList.push(idStr);
});
const idStr: number = (eObj.id as number);
brandIdList.push(idStr);
});
getSoure(brandIdList, subBrandIdList);
dispatch("setCarBrandsList", carBrandList);
storage.set("carBrandList", carBrandList, 0);
if (carBrandList.length > 0) {
const index = 0;
getCarBrandsList(carBrandList, index);
}
});
/** 获取销售人员 */
getEmployeeListApi({
merchantId: shopMerchantId
}).then(res => {
dispatch("setEmployeeList", res);
storage.set("employeeList", res, 0);
});
}
onLoad((options) => {
getMockData(true).then(mockdata =>{
console.log(mockdata, "===");
const userInfo = storage.get("userInfo") as UTSJSONObject;
const mockDataObj = mockdata as UTSJSONObject;
const channelType = userInfo.channelType as number;
if (channelType == 1 && mockDataObj.boutiqueDefaultCarBrandId != null) {
state.user.boutiqueDefaultCarBrandId = (mockDataObj.boutiqueDefaultCarBrandId as number); // 默认车辆品牌
if (mockDataObj.defaultCarId != null) {
state.user.defaultCarId = (mockDataObj.defaultCarId as number);// 默认车系
}
}
});
get_Vehicle_Sales_Data();
});
});
onShow(() => {
const userInfo = storage.get("userInfo");
if (userInfo == null) {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
const userInfoObj = userInfo as UTSJSONObject;
const shopMerchantId = (userInfoObj.shopMerchantId as string) ?? "";
const sceneType = (userInfoObj.sceneType as number) ?? 0;
if (shopMerchantId == null) {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
if (homeRef.value != null) {
(homeRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
</script>
<style scoped lang="scss">
<style scoped lang="scss">
@import "./styles/common.scss";
.equity-redirect {
@import "./styles/landscape.scss";
width: 100%;
@import "./styles/portrait.scss";
height: 100%;
}
</style>
</style>
apps/uniappX/uniapp-x-tape/pages/index/index.uvue
View file @
a80cc5e
<template>
<template>
<scroll-view style="flex: 1" class="flex flex-col bg-indigo-500">
<!-- 唯一物理「首页」tab:SceneShell(导航壳)+ HomeMainTab(三场景);场景内各自 Panel + HomeFrame(embedInTabSlot) -->
<view class="flex flex-col">
<layout-root>
<view class="flex flex-col">
<view class="index-shell-page">
<view class="flex flex-col px-8 pt-10 pb-8 items-center">
<!-- 可拉伸层:单列 flex 下单个子项须 flex:1+min-height:0 才吃满高度;接待/我的等同层无 flex 故无此问题 -->
<text class="text-3xl font-bold text-white mb-2">uni-app x 示例</text>
<view class="index-shell-scene-stretch">
<text class="text-base text-white opacity-90">功能演示与测试</text>
<!-- 布局调试:确认结构后去掉 hf-layout-debug -->
</view>
<SceneShell ref="shellRef"
class="hf-layout-debug"
<view class="flex flex-col px-12 py-12 flex-1 bg-gray-50 rounded-t-3xl">
:active-tab-index="0">
<view
<template #default="{ userInfo }">
class="bg-white rounded-2xl shadow-lg border border-gray-200 overflow-hidden w-full"
<view class="tab-panel">
:class="{ 'card-pressed': isCardPressed(item.path) }"
<HomeMainTab :logic="logic"
@touchstart="handleTouchStart(item.path)"
:user-info="userInfo" />
@touchend="pressedCard = ''"
@tap="toPath(item)"
v-for="item in data"
:key="item.label + item.path"
>
<!-- 使用 justify-between 而不是依赖 flex-1,兼容 App 端布局行为 -->
<view class="flex flex-row items-center p-5 w-full">
<view class="flex flex-row items-center">
<view
class="w-48 h-48 flex items-center justify-center bg-indigo-100 rounded-xl flex-shrink-0 mr-4"
>
<text class="text-2xl">{{ getIcon(item.icon) }}</text>
</view>
<text class="text-lg font-semibold text-gray-800">
{{ item.label }}
</text>
</view>
<view
class="w-32 h-32 flex items-center justify-center bg-indigo-500 rounded-lg flex-shrink-0"
style="margin-left: auto"
>
<text class="text-lg text-white font-bold">→</text>
</view>
</view>
</view>
</template>
</SceneShell>
</view>
</view>
</view>
</view>
</view>
</layout-root>
</view>
</scroll-view>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { get } from "@/utils/common.uts";
import { ComponentPublicInstance, ref } from "vue";
// import { router } from "@/utils/router.uts";
type Item = {
label: string;
icon?: string;
path?: string;
disabled?: boolean;
hidden?: boolean;
children?: Item[];
};
const data = computed<Item[]>(() => {
return [
{ label: "LocalStore", icon: "database", path: "/pages/demo/local-store/index" },
{ label: "Tailwind CSS", icon: "tailwind", path: "/pages/demo/tailwindcss/index" },
{ label: "gl_tape 迁移", icon: "migrate", path: "/pages/demo/gl-tape-demo/index" },
{ label: "echart", icon: "chart", path: "/pages/demo/echarts/index" },
{ label: "录音示例", icon: "microphone", path: "/pages/demo/record/index" },
{ label: "权限", icon: "lock", path: "/pages/demo/permission/index" },
{ label: "媒体", icon: "media", path: "/pages/demo/media/index" },
{ label: "老项目", icon: "folder", path: "/pages/demo/old/index" }
];
});
const pressedCard = ref<string>("");
import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import HomeMainTab from "@/components/HomeFrame/presets/HomeMainTab.uvue";
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { storage } from "@/utils/storage.uts";
// 判断卡片是否被按下(UTS 要求条件语句必须使用布尔类型)
const shellRef = ref(null);
const isCardPressed = (path?: string): boolean => {
const logic = useBoutiqueLogic();
if (path == null) {
return pressedCard.value === "";
}
return pressedCard.value === path;
};
// 处理触摸开始事件(UTS 要求条件语句必须使用布尔类型)
const handleTouchStart = (path?: string): void => {
if (path != null && path.length > 0) {
pressedCard.value = path;
} else {
pressedCard.value = "";
}
};
const getIcon = (icon?: string): string => {
function readSceneType(): number {
// 为兼容 UTS,将图标映射改为显式分支判断,避免使用对象下标访问和 Record 等 TS 特性
const raw = storage.get("userInfo");
if (icon == "database") {
if (raw == null) {
return "💾";
return 1;
}
if (icon == "tailwind") {
return "🎨";
}
if (icon == "migrate") {
return "🔄";
}
if (icon == "chart") {
return "📊";
}
if (icon == "lock") {
return "🔒";
}
if (icon == "media") {
return "🎬";
}
if (icon == "folder") {
return "📁";
}
if (icon == "microphone") {
return "🎤";
}
}
// 默认图标
const st = (raw as UTSJSONObject).sceneType as null | number;
return "📄";
return st != null ? st : 1;
};
}
const toPath = (item: Item) => {
if (typeof item.path === "string" && item.path.trim().length > 0) {
// router.push({ path: item.path });
uni.navigateTo({
url: item.path,
success: () => {
// 跳转成功
},
fail: (err: any) => {
// NavigateToFailImpl 不是标准的 UTSJSONObject,需要使用索引访问
// 先输出完整的错误对象,方便调试
console.error(`页面跳转失败: ${item.path}, 完整错误对象:`, err);
// 使用索引访问属性,避免 error18
// NavigateToFailImpl 类型特殊,需要先转换为 UTSJSONObject 或使用索引访问
let errMsg = "未知错误";
let errCode: number | null = null;
let errSubject: string | null = null;
// 尝试使用 UTSJSONObject 转换
try {
// @ts-ignore - 尝试将错误对象转换为 UTSJSONObject
const errObj = new UTSJSONObject(err);
const errMsgTemp = errObj.getAny("errMsg");
const errCodeTemp = errObj.getAny("errCode");
const errSubjectTemp = errObj.getAny("errSubject");
if (errMsgTemp != null) {
errMsg = errMsgTemp as string;
}
if (errCodeTemp != null) {
errCode = errCodeTemp as number;
}
if (errSubjectTemp != null) {
errSubject = errSubjectTemp as string;
}
} catch (e: any) {
// 如果转换失败,尝试使用 JSON 序列化/反序列化
try {
const jsonStr = JSON.stringify(err);
const parsed = JSON.parse(jsonStr) as UTSJSONObject;
const errMsgTemp = get(parsed, "errMsg");
const errCodeTemp = get(parsed, "errCode");
const errSubjectTemp = get(parsed, "errSubject");
if (errMsgTemp != null) {
onShow(async () => {
errMsg = errMsgTemp as string;
if (logic.ensureLoginOrRelauch() === false) {
}
return;
if (errCodeTemp != null) {
errCode = errCodeTemp as number;
}
if (errSubjectTemp != null) {
errSubject = errSubjectTemp as string;
}
}
} catch (e2: any) {
// 先同步壳层 userInfo,再读场景;避免 switchTab 回首页时插槽仍是旧数据导致子树不渲染/场景错乱
console.error("无法解析错误对象:", e2);
if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
}
const st = readSceneType();
if (st === 1) {
await logic.initIfNeeded();
logic.getBoutiquePackageList();
}
}
});
</script>
// 输出详细错误信息
<style scoped lang="scss">
console.error(`页面跳转失败详情: path=${item.path}, errMsg=${errMsg}, errCode=${errCode}, errSubject=${errSubject}`);
.index-shell-page {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
// 根据错误码提供更友好的错误提示
/* 吃掉 index 页剩余主轴尺寸;横竖屏都要有明确高宽,内层 height:100% / flex 链才能算对 */
let toastMsg = errMsg;
.index-shell-scene-stretch {
if (errCode == 4) {
flex: 1;
// errCode 4 通常表示页面路径不存在或未注册
min-height: 0;
toastMsg = "页面路径不存在或未在 pages.json 中注册";
min-width: 0;
}
width: 100%;
display: flex;
flex-direction: column;
}
uni.showToast({
.index-shell-scene-stretch :deep(.scene-shell-root) {
title: toastMsg,
flex: 1;
icon: "none",
min-height: 0;
duration: 3000
min-width: 0;
});
width: 100%;
}
height: 100%;
});
}
}
pressedCard.value = "";
};
</script>
<style>
.tab-panel {
/* 卡片按下效果 */
flex: 1;
.card-pressed {
width: 100%;
transform: scale(0.98);
height: 100%;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
}
}
</style>
</style>
apps/uniappX/uniapp-x-tape/pages/person/MyCenterMain.uvue
0 → 100644
View file @
a80cc5e
<template>
<view class="my-center">
<view class="safe-top-spacer" :style="safeTopStyle"></view>
<scroll-view class="my-scroll" :scroll-y="true" :show-scrollbar="false">
<view class="my-content">
<view class="profile-card">
<view class="profile-head">
<un-avatar :text="avatarText"
shape="circle"
size="52"
bgColor="#2f6af7"
color="#ffffff"
fontSize="20" />
<view class="profile-main">
<text class="name">{{ userName }}</text>
<text class="meta">{{ plainPhone }}</text>
</view>
<view class="scene-tag">
<text class="scene-tag-text">{{ currentSceneTitle }}</text>
</view>
</view>
<view class="profile-divider"></view>
<view class="profile-shop-row">
<text class="profile-shop-label">当前门店</text>
<text class="profile-shop-value">{{ shopName }}</text>
</view>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-shell">
<un-cell-group title="账号信息" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="姓名"
:value="userName"
icon="account-fill" />
<un-cell title="门店"
:value="shopName"
icon="home-fill" />
<un-cell title="手机号"
:value="plainPhone"
icon="phone-fill" />
<un-cell title="当前场景"
:value="currentSceneTitle"
icon="grid-fill" />
</un-cell-group>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-shell">
<un-cell-group title="常用功能" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="切换场景"
:value="currentSceneTitle"
icon="grid-fill"
isLink
clickable
@click="onSceneChange" />
<un-cell title="个人考勤"
icon="clock-fill"
isLink
clickable
@click="goAttendance" />
<un-cell title="系统设置"
icon="setting-fill"
isLink
clickable
@click="onSetting" />
</un-cell-group>
</view>
</view>
</scroll-view>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="onChooseScene"
@update:visible="onScenePopupVisible" />
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
</view>
</template>
<script setup lang="uts">
import { computed, ref, onMounted } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import { resolveMainHomeUrl } from "@/utils/homeRoute.uts";
import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import SettingBox from "./SettingBox.uvue";
const props = defineProps<{
userInfo?: null | UTSJSONObject
}>();
type SceneTypeItem = { title: string; describe: string; icon: string; };
const showScenePopup = ref(false);
const showSetting = ref(false);
const safeTopPx = ref(0);
const safeTopStyle = computed((): UTSJSONObject => {
return {
height: `${safeTopPx.value}px`,
width: "100%",
} as UTSJSONObject;
});
function syncSafeTopInset(): void {
const info = uni.getWindowInfo();
let topInset = 0;
const insets = info.safeAreaInsets;
if (insets != null) {
const t = insets.top;
if (t != null && t > 0) {
topInset = Math.round(t);
}
}
if (topInset <= 0) {
const safe = info.safeArea;
if (safe != null) {
const st = safe.top;
if (st != null && st > 0) {
topInset = Math.round(st);
}
}
}
if (topInset <= 0) {
const sb = info.statusBarHeight;
if (sb != null && sb > 0) {
topInset = Math.round(sb);
}
}
safeTopPx.value = topInset;
}
function getSceneTypeItem(sceneId: number): null | SceneTypeItem {
if (sceneId == 1) return { title: "轻改", describe: "太阳膜升级转化", icon: "轻" };
if (sceneId == 0) return { title: "会员权益/升级", describe: "权益延保", icon: "权" };
if (sceneId == 7) return { title: "二手车", describe: "二手车业务", icon: "二" };
return null;
}
const sceneTypeIdList = computed((): number[] => {
const info = props.userInfo;
let openArr: number[] = [1, 0, 7];
if (info != null) {
const arr = (info as UTSJSONObject).openSceneArr as null | number[];
if (arr != null && arr.length > 0) {
openArr = arr;
}
}
const result: number[] = [];
for (const e of openArr) {
if (e == 1 || e == 0 || e == 7) {
result.push(e);
}
}
return result.length > 0 ? result : [1, 0, 7];
});
const sceneTypeList = computed((): UTSJSONObject[] => {
const result: UTSJSONObject[] = [];
for (const id of sceneTypeIdList.value) {
const item = getSceneTypeItem(id);
if (item != null) {
result.push({ title: item.title, describe: item.describe, icon: item.icon } as UTSJSONObject);
}
}
return result;
});
const userName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
return raw != null ? `${raw}` : "";
});
const shopName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.shopMerchantName ?? obj.merchantName ?? "";
return raw != null ? `${raw}` : "";
});
const plainPhone = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.phone ?? obj.mobile ?? "";
return raw != null ? `${raw}` : "";
});
const avatarText = computed((): string => {
const name = userName.value;
if (name == "") return "我";
return name.slice(0, 1);
});
const currentSceneTitle = computed((): string => {
const info = props.userInfo;
if (info == null) return "未知";
const sceneType = (info as UTSJSONObject).sceneType as null | number;
if (sceneType == null) return "未知";
const item = getSceneTypeItem(sceneType);
return item != null ? item.title : "未知";
});
function onScenePopupVisible(v: boolean): void {
showScenePopup.value = v;
}
function onSettingVisible(v: boolean): void {
showSetting.value = v;
}
function onSceneChange(): void {
showScenePopup.value = true;
}
function onSetting(): void {
showSetting.value = true;
}
function onChooseScene(index: number): void {
const ids = sceneTypeIdList.value;
if (index < 0 || index >= ids.length) return;
const sceneType = ids[index];
const raw = storage.get("userInfo");
if (raw == null) return;
const info = raw as UTSJSONObject;
const current = info.sceneType as null | number;
if (current != null && current == sceneType) return;
info.sceneType = sceneType;
uni.showLoading({ title: "切换中", mask: true });
storage.set("userInfo", info, 0);
uni.switchTab({
url: resolveMainHomeUrl(),
success: () => {
hideNativeTabBar();
},
complete: () => {
uni.hideLoading();
},
fail: (_err: any) => {
uni.hideLoading();
uni.reLaunch({ url: resolveMainHomeUrl() });
}
});
}
function goAttendance(): void {
uni.navigateTo({ url: "/pages/person/attendance" });
}
onMounted(() => {
syncSafeTopInset();
});
</script>
<style scoped lang="scss">
.my-center {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
background: linear-gradient(180deg, #edf4ff 0%, #f4f8ff 34%, #f7f9fc 100%);
}
.safe-top-spacer {
width: 100%;
flex-shrink: 0;
}
.my-scroll {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding: 20px;
box-sizing: border-box;
}
.my-content {
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
}
.profile-card {
background: linear-gradient(145deg, #ffffff 0%, #f6f9ff 100%);
border: 1px solid #dfe9f7;
border-radius: 16px;
padding: 14px 14px 12px;
box-shadow: 0 8px 20px rgba(37, 99, 235, 0.10);
}
.profile-head {
display: flex;
flex-direction: row;
align-items: center;
}
.profile-main {
margin-left: 14px;
display: flex;
flex-direction: column;
flex: 1;
}
.name {
font-size: 19px;
font-weight: 600;
color: #1a2433;
line-height: 24px;
}
.meta {
margin-top: 2px;
font-size: 12px;
color: #7b8ba3;
}
.scene-tag {
height: 26px;
padding: 0 10px;
background: #eaf2ff;
border: 1px solid #cfe0f8;
border-radius: 999px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.scene-tag-text {
font-size: 11px;
font-weight: 600;
color: #2a5ac7;
}
.profile-divider {
height: 1px;
background-color: #e6edf8;
margin-top: 10px;
margin-bottom: 10px;
}
.profile-shop-row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.profile-shop-label {
font-size: 12px;
color: #8091aa;
}
.profile-shop-value {
flex: 1;
margin-left: 10px;
text-align: right;
font-size: 13px;
font-weight: 500;
color: #334155;
}
.section-shell {
width: 100%;
background-color: #ffffff;
border: 1px solid #e5edf8;
border-radius: 16px;
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
padding: 2px;
box-sizing: border-box;
}
</style>
apps/uniappX/uniapp-x-tape/pages/person/myCenter.uvue
View file @
a80cc5e
<template>
<template>
<view class="my-center">
<layout-root>
<view class="safe-top-spacer" :style="safeTopStyle"></view>
<view class="page-container my-route-page">
<scroll-view class="my-scroll" :scroll-y="true" :show-scrollbar="false">
<SceneShell ref="shellRef"
<view class="my-content">
:active-tab-index="2">
<view class="profile-card">
<template #default="{ userInfo }">
<view class="profile-head">
<MyCenterTab :user-info="userInfo" />
<un-avatar :text="avatarText"
</template>
shape="circle"
</SceneShell>
size="52"
</view>
bgColor="#2f6af7"
</layout-root>
color="#ffffff"
fontSize="20" />
<view class="profile-main">
<text class="name">{{ userName }}</text>
<text class="meta">{{ plainPhone }}</text>
</view>
<view class="scene-tag">
<text class="scene-tag-text">{{ currentSceneTitle }}</text>
</view>
</view>
<view class="profile-divider"></view>
<view class="profile-shop-row">
<text class="profile-shop-label">当前门店</text>
<text class="profile-shop-value">{{ shopName }}</text>
</view>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-shell">
<un-cell-group title="账号信息" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="姓名"
:value="userName"
icon="account-fill" />
<un-cell title="门店"
:value="shopName"
icon="home-fill" />
<un-cell title="手机号"
:value="plainPhone"
icon="phone-fill" />
<un-cell title="当前场景"
:value="currentSceneTitle"
icon="grid-fill" />
</un-cell-group>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-shell">
<un-cell-group title="常用功能" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="切换场景"
:value="currentSceneTitle"
icon="grid-fill"
isLink
clickable
@click="onSceneChange" />
<un-cell title="个人考勤"
icon="clock-fill"
isLink
clickable
@click="goAttendance" />
<un-cell title="系统设置"
icon="setting-fill"
isLink
clickable
@click="onSetting" />
</un-cell-group>
</view>
</view>
</scroll-view>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="onChooseScene"
@update:visible="onScenePopupVisible" />
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
</view>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { computed, ref, onMounted } from "vue";
import { ComponentPublicInstance, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import { storage } from "@/utils/storage.uts";
import SettingBox from "./SettingBox.uvue";
const props = defineProps<{
userInfo?: null | UTSJSONObject
}>();
type SceneTypeItem = { title: string; describe: string; icon: string; };
const showScenePopup = ref(false);
const showSetting = ref(false);
const safeTopPx = ref(0);
const safeTopStyle = computed((): UTSJSONObject => {
return {
height: `${safeTopPx.value}px`,
width: "100%",
} as UTSJSONObject;
});
function syncSafeTopInset(): void {
const info = uni.getWindowInfo();
let topInset = 0;
const insets = info.safeAreaInsets;
if (insets != null) {
const t = insets.top;
if (t != null && t > 0) {
topInset = Math.round(t);
}
}
if (topInset <= 0) {
const safe = info.safeArea;
if (safe != null) {
const st = safe.top;
if (st != null && st > 0) {
topInset = Math.round(st);
}
}
}
if (topInset <= 0) {
const sb = info.statusBarHeight;
if (sb != null && sb > 0) {
topInset = Math.round(sb);
}
}
safeTopPx.value = topInset;
}
function getSceneTypeItem(sceneId: number): null | SceneTypeItem {
import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
if (sceneId == 1) return { title: "轻改", describe: "太阳膜升级转化", icon: "轻" };
import MyCenterTab from "@/components/HomeFrame/presets/MyCenterTab.uvue";
if (sceneId == 0) return { title: "会员权益/升级", describe: "权益延保", icon: "权" };
if (sceneId == 7) return { title: "二手车", describe: "二手车业务", icon: "二" };
return null;
}
const sceneTypeIdList = computed((): number[] => {
const shellRef = ref(null);
const info = props.userInfo;
let openArr: number[] = [1, 0, 7];
if (info != null) {
const arr = (info as UTSJSONObject).openSceneArr as null | number[];
if (arr != null && arr.length > 0) {
openArr = arr;
}
}
const result: number[] = [];
for (const e of openArr) {
if (e == 1 || e == 0 || e == 7) {
result.push(e);
}
}
return result.length > 0 ? result : [1, 0, 7];
});
const sceneTypeList = computed((): UTSJSONObject[] => {
onShow(() => {
const result: UTSJSONObject[] = [];
if (shellRef.value != null) {
for (const id of sceneTypeIdList.value) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
const item = getSceneTypeItem(id);
if (item != null) {
result.push({ title: item.title, describe: item.describe, icon: item.icon } as UTSJSONObject);
}
}
}
return result;
});
const userName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
return raw != null ? `${raw}` : "";
});
const shopName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.shopMerchantName ?? obj.merchantName ?? "";
return raw != null ? `${raw}` : "";
});
const phoneText = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.phone ?? obj.mobile ?? "";
return raw != null && `${raw}` != "" ? `手机号:${raw}` : "";
});
const plainPhone = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.phone ?? obj.mobile ?? "";
return raw != null ? `${raw}` : "";
});
const avatarText = computed((): string => {
const name = userName.value;
if (name == "") return "我";
return name.slice(0, 1);
});
const currentSceneTitle = computed((): string => {
const info = props.userInfo;
if (info == null) return "未知";
const sceneType = (info as UTSJSONObject).sceneType as null | number;
if (sceneType == null) return "未知";
const item = getSceneTypeItem(sceneType);
return item != null ? item.title : "未知";
});
function onScenePopupVisible(v: boolean): void {
showScenePopup.value = v;
}
function onSettingVisible(v: boolean): void {
showSetting.value = v;
}
function onSceneChange(): void {
showScenePopup.value = true;
}
function onSetting(): void {
showSetting.value = true;
}
function onChooseScene(index: number): void {
const ids = sceneTypeIdList.value;
if (index < 0 || index >= ids.length) return;
const sceneType = ids[index];
const raw = storage.get("userInfo");
if (raw == null) return;
const info = raw as UTSJSONObject;
const current = info.sceneType as null | number;
if (current != null && current == sceneType) return;
info.sceneType = sceneType;
uni.showLoading({ title: "切换中", mask: true });
storage.set("userInfo", info, 0);
let url = "/pages/boutique/index";
if (sceneType == 0) url = "/pages/equity/index";
else if (sceneType == 7) url = "/pages/usedCar/index";
uni.reLaunch({ url });
}
function goAttendance(): void {
uni.navigateTo({ url: "/pages/person/attendance" });
}
onMounted(() => {
syncSafeTopInset();
});
});
</script>
</script>
<style scoped lang="scss">
<style scoped lang="scss">
.
my-cent
er {
.
page-contain
er {
width: 100%;
width: 100%;
height: 100%;
height: 100%;
display: flex;
flex-direction: column;
background: linear-gradient(180deg, #edf4ff 0%, #f4f8ff 34%, #f7f9fc 100%);
}
.safe-top-spacer {
width: 100%;
flex-shrink: 0;
}
.my-scroll {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding: 20px;
box-sizing: border-box;
}
.my-content {
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
}
.profile-card {
background: linear-gradient(145deg, #ffffff 0%, #f6f9ff 100%);
border: 1px solid #dfe9f7;
border-radius: 16px;
padding: 14px 14px 12px;
box-shadow: 0 8px 20px rgba(37, 99, 235, 0.10);
}
.profile-head {
display: flex;
flex-direction: row;
align-items: center;
}
.profile-main {
margin-left: 14px;
display: flex;
flex-direction: column;
flex: 1;
}
.name {
font-size: 19px;
font-weight: 600;
color: #1a2433;
line-height: 24px;
}
.meta {
margin-top: 2px;
font-size: 12px;
color: #7b8ba3;
}
.scene-tag {
height: 26px;
padding: 0 10px;
background: #eaf2ff;
border: 1px solid #cfe0f8;
border-radius: 999px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.scene-tag-text {
font-size: 11px;
font-weight: 600;
color: #2a5ac7;
}
.profile-divider {
height: 1px;
background-color: #e6edf8;
margin-top: 10px;
margin-bottom: 10px;
}
.profile-shop-row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.profile-shop-label {
font-size: 12px;
color: #8091aa;
}
.profile-shop-value {
flex: 1;
margin-left: 10px;
text-align: right;
font-size: 13px;
font-weight: 500;
color: #334155;
}
.section-shell {
width: 100%;
background-color: #ffffff;
border: 1px solid #e5edf8;
border-radius: 16px;
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
padding: 2px;
box-sizing: border-box;
}
}
</style>
</style>
apps/uniappX/uniapp-x-tape/pages/personMyShell.uvue
deleted
100644 → 0
View file @
9754b52
<template>
<layout-root>
<view class="page-container my-route-page">
<SceneShell ref="shellRef" :active-tab-index="2">
<template #default="{ userInfo }">
<MyCenterTab :user-info="userInfo" />
</template>
</SceneShell>
</view>
</layout-root>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, ref } from "vue";
import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import MyCenterTab from "@/components/HomeFrame/presets/MyCenterTab.uvue";
const shellRef = ref(null);
onShow(() => {
if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
.page-container {
width: 100%;
height: 100%;
}
</style>
apps/uniappX/uniapp-x-tape/pages/receptionCenter/ReceptionCenterMain.uvue
0 → 100644
View file @
a80cc5e
<template>
<view class="reception-center-page" :key="isLandscape">
<!-- 顶部安全区 -->
<view
v-if="isPortrait768x1174"
class="reception-safe-top-spacer"
:style="receptionSafeTopSpacerStyle"
></view>
<!-- <un-navbar title="接待中心" left-icon="" /> -->
<!-- <view class="reception-navbar-spacer"></view> -->
<!-- Tab 切换 -->
<view v-if="isLandscape != true" class="reception-tabs-container" :style="receptionTabsContainerStyle">
<un-tabs
class="reception-main-tabs"
:style="receptionMainTabsShellStyle"
:value="mainTabIndex"
:list="mainTabs"
:height="mainTabBarHeight"
:lineWidth="mainTabLineWidth"
:lineHeight="mainTabLineHeight"
lineColor="#1677ff"
:activeStyle="mainTabActiveStyle"
:inactiveStyle="mainTabInactiveStyle"
:itemStyle="mainTabItemStyle"
@change="onMainTabChange"
></un-tabs>
</view>
<!-- Tab 内容区域 -->
<view class="reception-content-container">
<!-- 竖屏:保持原逻辑(Tabs 切换展示) -->
<view v-if="isLandscape != true" class="reception-content-portrait">
<ReceptionDashboardTab
v-if="mainTabIndex == 0"
:performance-data="performanceData"
:performance-metrics-visible="performanceMetricsVisible"
:selected-brand="selectedBrand"
:time-progress-percent="timeProgressPercent"
:compare-rows="currentOutputTab.compareRows"
:summary="currentOutputTab.summary"
:target-value-text="monthValueTargetText"
:achievement-value-text="monthValueAchievementText"
:output-tab-index="outputTabIndex"
@toggle-metrics="togglePerformanceMetricsVisibility"
@open-brand-picker="show = true"
@update:output-tab-index="onOutputTabIndexChange"
/>
<ReceptionCustomerListTab
v-if="mainTabIndex == 1"
:sticky-header="isLandscape"
:list-sub-tab-index="listSubTabIndex"
:reception-filter-narrow-mode="receptionFilterNarrowMode"
:entry-filter-index="entryFilterIndex"
:filter-tab-index="filterTabIndex"
:submitted-result-tab-index="submittedResultTabIndex"
:review-tab-index="reviewTabIndex"
: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"
@entry-click="onListCustomerEntryClick"
@entry-edit="onListCustomerEntryEdit"
@entry-delete="onListCustomerEntryDelete"
@reception-click="onReceptionCardClick"
/>
</view>
<!-- 横屏:隐藏 Tabs,左右分栏同时展示(左 1/3 业绩看板,右 2/3 客户列表) -->
<view v-else class="reception-content-landscape">
<view class="reception-landscape-left">
<ReceptionDashboardTab
:performance-data="performanceData"
:performance-metrics-visible="performanceMetricsVisible"
:selected-brand="selectedBrand"
:time-progress-percent="timeProgressPercent"
:compare-rows="currentOutputTab.compareRows"
:summary="currentOutputTab.summary"
:target-value-text="monthValueTargetText"
:achievement-value-text="monthValueAchievementText"
:output-tab-index="outputTabIndex"
@toggle-metrics="togglePerformanceMetricsVisibility"
@open-brand-picker="show = true"
@update:output-tab-index="onOutputTabIndexChange"
/>
</view>
<view class="reception-landscape-right">
<ReceptionCustomerListTab
:sticky-header="isLandscape"
:list-sub-tab-index="listSubTabIndex"
:reception-filter-narrow-mode="receptionFilterNarrowMode"
:entry-filter-index="entryFilterIndex"
:filter-tab-index="filterTabIndex"
:submitted-result-tab-index="submittedResultTabIndex"
:review-tab-index="reviewTabIndex"
: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"
@entry-click="onListCustomerEntryClick"
@entry-edit="onListCustomerEntryEdit"
@entry-delete="onListCustomerEntryDelete"
@reception-click="onReceptionCardClick"
/>
</view>
</view>
</view>
<!-- 全局弹窗 -->
<un-picker :show="show" :columns="columns" @close="onClose" @cancel="onClose" @confirm="onConfirm" />
<un-picker
:key="submittedResultPickerLayerKey"
:show="showSubmittedResultPicker"
:columns="submittedResultPickerColumns"
:default-index="submittedResultPickerDefaultIndex"
@close="onSubmittedResultPickerClose"
@cancel="onSubmittedResultPickerClose"
@confirm="onSubmittedResultPickerConfirm"
/>
<un-picker
:key="reviewPickerLayerKey"
:show="showReviewPicker"
:columns="reviewPickerColumns"
:default-index="reviewPickerDefaultIndex"
@close="onReviewPickerClose"
@cancel="onReviewPickerClose"
@confirm="onReviewPickerConfirm"
/>
<!-- 客户录入列表 → 客户档案(FormDetail) -->
<view v-if="showCustomerFormDetail" class="form-detail-inner">
<FormDetail
:show="showCustomerFormDetail"
:detail="customerFormDetailItem"
@close="onCustomerFormDetailClose"
/>
</view>
<!-- 接待复盘列表 → 接待详情(receptionDetail) -->
<view v-if="showReceptionRecordDetail" class="form-detail-inner">
<ReceptionDetail :item="receptionRecordItem" @close="onReceptionRecordDetailClose" />
</view>
</view>
</template>
<script setup lang="uts">
// 接待中心 Tab 聚合页
import { ref, computed, onMounted, onUnmounted, watch, onResize } from 'vue'
import { type UnPickerColumn, type UnPickerColumnItem, type UnPickerConfirmEvent, type UnTabItem } from '@/uni_modules/uview-unix'
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 { getLandscapeConfig } from "./styles/landscape.uts";
import {
getPortraitConfig,
getReceptionPortraitMainTabsConfig,
type ReceptionPortraitMainTabsConfig
} from "./styles/portrait.uts";
const isPortrait768x1174 = computed((): boolean => {
// 仅在 768x1174 分辨率(竖屏适配类名)下展示顶部安全区占位
return cssClassRef.value.indexOf('layout-portrait-768x1174') >= 0
})
// ========== Tab 管理 ==========
// ========== Tab 管理 ==========
/** 主 Tab:0=业绩看板,1=客户列表 */
const mainTabIndex = ref(0)
const mainTabs: UnTabItem[] = [
{ name: '业绩看板' } as UnTabItem,
{ name: '客户列表' } as UnTabItem
]
// 动态样式 - 根据分辨率返回不同的样式
// 动态样式 - 根据分辨率返回不同的样式
const dynamicModuleBoxStyle = computed((): any => {
// 使用 cssClassRef.value 确保响应式
const adapterCls = cssClassRef.value;
if (adapterCls.indexOf('layout-landscape-1174x768') >= 0) {
const cfg = getLandscapeConfig(adapterCls)
return cfg != null ? ({ ...cfg } as UTSJSONObject) : ({} as UTSJSONObject);
}
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 原样式 */
const receptionPortraitMainTabsOverride = computed((): null | ReceptionPortraitMainTabsConfig => {
return getReceptionPortraitMainTabsConfig(cssClassRef.value)
})
const receptionTabsContainerStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value
if (c == null) {
return {} as UTSJSONObject
}
return {
padding: c.containerPadding
} as UTSJSONObject
})
const receptionMainTabsShellStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value
if (c == null) {
return {} as UTSJSONObject
}
return {
padding: c.mainTabsPadding,
borderRadius: c.mainTabsBorderRadius,
boxShadow: c.mainTabsBoxShadow
} as UTSJSONObject
})
const mainTabBarHeight = computed((): number => {
const c = receptionPortraitMainTabsOverride.value
return c != null ? c.height : 52
})
const mainTabLineWidth = computed((): number => {
const c = receptionPortraitMainTabsOverride.value
return c != null ? c.lineWidth : 42
})
const mainTabLineHeight = computed((): number => {
const c = receptionPortraitMainTabsOverride.value
return c != null ? c.lineHeight : 4
})
const mainTabActiveStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value
if (c == null) {
return {
color: '#1677ff',
fontWeight: 700,
fontSize: '17px'
} as UTSJSONObject
}
return {
color: '#1677ff',
fontWeight: 700,
fontSize: c.activeFontSize
} as UTSJSONObject
})
const mainTabInactiveStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value
if (c == null) {
return {
color: '#94a3b8',
fontWeight: 500,
fontSize: '15px'
} as UTSJSONObject
}
return {
color: '#94a3b8',
fontWeight: 400,
fontSize: c.inactiveFontSize
} as UTSJSONObject
})
const mainTabItemStyle = computed((): UTSJSONObject => {
const c = receptionPortraitMainTabsOverride.value
if (c == null) {
return {
paddingLeft: '18px',
paddingRight: '18px'
} as UTSJSONObject
}
return {
paddingLeft: c.itemPaddingLeft,
paddingRight: c.itemPaddingRight,
paddingBottom: c.itemPaddingBottom
} as UTSJSONObject
})
/** 客户列表下的二级 Tab:0=客户录入,1=接待复盘(原 rightTabIndex) */
const listSubTabIndex = ref(0)
// 产值卡片 tabs:0=本月交付转化率,1=本月交付客单价
const outputTabIndex = ref(0);
// 筛选 tabs:0=已提交,1=未提交(接待复盘用)
const filterTabIndex = ref(0);
// 客户录入筛选:0=今日到店(请求带当日 startTime/endTime),1=全部客户(不传时间范围)
const entryFilterIndex = ref(0);
// 已提交下结果 tabs:0=战败,1=成交(→ orderFinishFlag)
const submittedResultTabIndex = ref(0);
// 未提交下子 tabs:0=待上传,1=待提交(当前与列表参数同样映射到 orderFinishFlag,若后端字段不同再拆参)
const unsubmittedPendingTabIndex = ref(0);
const reviewTabIndex = ref(0)
// 客户档案列表(客户录入 Tab,接口 dj.api.smartcarlife.customervisits.customerInfoPage)
const customerList = ref<UTSJSONObject[]>([])
// 接待复盘列表(接待复盘 Tab,接口 dj.api.smartcarlife.reception.customer.page)
const receptionRecordList = ref<UTSJSONObject[]>([])
/** 客户档案分页(customerInfoPage) */
const CUSTOMER_FILE_PAGE_SIZE = 10
const customerFilePageNum = ref(1)
/** 客户录入列表:触底加载更多 */
const customerListLoadingMore = ref(false)
const customerListHasMore = ref(true)
/** 接待复盘分页(reception.customer.page) */
const RECEPTION_PAGE_SIZE = 10
const receptionPageNum = ref(1)
const receptionListLoadingMore = ref(false)
const receptionListHasMore = ref(true)
const show = ref(false)
/** 已提交:战败/成交下拉 */
const showSubmittedResultPicker = ref(false)
/** 每次打开战败/成交选择器递增,保证 default-index 作用到滚轮 */
const submittedResultPickerLayerKey = ref(0)
/** 已提交:未复盘/复盘下拉 */
const showReviewPicker = ref(false)
/** 每次打开复盘选择器递增,保证 default-index 一定作用到滚轮(避免仅首次挂载生效) */
const reviewPickerLayerKey = ref(0)
/** 右侧筛选区窄屏适配:避免 segmented 最小宽度导致横向溢出 */
const receptionFilterNarrowMode = ref(false)
/** uni-app x UTS 当前编译目标不支持 uni.onWindowResize,用定时轮询窗口尺寸以响应旋转 */
let receptionDashboardLayoutPollId: number | null = null
const RECEPTION_LAYOUT_POLL_MS = 400
/** 是否横屏(windowWidth > windowHeight)。横屏模式下隐藏 Tabs,左右分栏同时展示两个模块 */
const isLandscape = ref(false)
/** 记录上一次打印过的方向,避免轮询期间刷屏 */
let lastOrientationLogLandscape: boolean | null = null
/** 顶部安全区占位(px):与系统状态栏/刘海对齐,随窗口信息刷新 */
const receptionPageInsetTopPx = ref(0)
const receptionSafeTopSpacerStyle = computed((): UTSJSONObject => {
return {
height: `${receptionPageInsetTopPx.value}px`,
width: '100%',
} as UTSJSONObject
})
function syncReceptionDashboardLayout(): void {
/**
* 接待中心「布局同步」:
* - 计算顶部安全区占位,避免自定义导航与状态栏/刘海重叠
* - 判断横竖屏(横屏用于左右分栏展示、竖屏用于 Tab 切换展示)
* - 横屏窄宽时启用筛选区窄模式,避免 segmented 等控件最小宽度导致溢出
*
* 说明:
* - uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,因此通过定时轮询触发同步
* - 部分机型旋转后 getWindowInfo 的 windowWidth/windowHeight 刷新可能滞后,这里优先用 systemInfo 的 screenWidth/screenHeight 做兜底
*/
// 必须用 uni.getWindowInfo():uview-unix 的 getWindowInfo 在 Android 上返回 GetWindowInfoResult,不能 as UTSJSONObject
const info = uni.getWindowInfo()
// 自定义导航:预留顶部安全区,避免与状态栏/刘海重叠(优先 safeAreaInsets.top -> safeArea.top -> statusBarHeight)
let topInset = 0
const insets = info.safeAreaInsets
if (insets != null) {
const t = insets.top
if (t != null && t > 0) {
topInset = Math.round(t)
}
}
if (topInset <= 0) {
const safe = info.safeArea
if (safe != null) {
const st = safe.top
if (st != null && st > 0) {
topInset = Math.round(st)
}
}
}
if (topInset <= 0) {
const sb = info.statusBarHeight
if (sb != null && sb > 0) {
topInset = Math.round(sb)
}
}
if (receptionPageInsetTopPx.value != topInset) {
receptionPageInsetTopPx.value = topInset
}
// 宽高优先取 systemInfo(部分机型旋转后 getWindowInfo 可能刷新不及时)
const sys = uni.getSystemInfoSync()
const sysSw = sys.screenWidth
const sysSh = sys.screenHeight
const ww = info.windowWidth
const wh = info.windowHeight
const sw = info.screenWidth
const sh = info.screenHeight
// 横屏判定:宽 > 高。取值优先级:systemInfo.screen* -> windowInfo.screen* -> windowInfo.window*
const w = sysSw > 0 ? sysSw : (sw > 0 ? sw : ww)
const h = sysSh > 0 ? sysSh : (sh > 0 ? sh : wh)
const nextSplit = w > h
if (isLandscape.value != nextSplit) {
isLandscape.value = nextSplit
}
if (lastOrientationLogLandscape == null || lastOrientationLogLandscape != nextSplit) {
lastOrientationLogLandscape = nextSplit
console.log(
`[ReceptionCenter] 屏幕方向变化:${nextSplit ? '横屏' : '竖屏'}(w=${w}, h=${h}, window=${ww}x${wh}, screen=${sw}x${sh})`
)
}
console.log('[ReceptionCenter] syncReceptionDashboardLayout');
// 横屏窄宽适配:避免右侧筛选区控件(如 segmented)在小于阈值时出现横向溢出
const RECEPTION_FILTER_NARROW_WIDTH = 920
const nextFilterNarrowMode = nextSplit && w > 0 && w < RECEPTION_FILTER_NARROW_WIDTH
if (receptionFilterNarrowMode.value != nextFilterNarrowMode) {
receptionFilterNarrowMode.value = nextFilterNarrowMode
}
}
let getPerformanceDataImpl: () => Promise<void> = async (): Promise<void> => {}
let getCustomerListImpl: (append: boolean) => Promise<void> = async (_append: boolean): Promise<void> => {}
let getReceptionRecordListImpl: (append: boolean) => Promise<void> = async (_append: boolean): Promise<void> => {}
// onResize 回调可能在窗口尺寸变化过程中高频触发,这里做一次去重,避免控制台刷屏
let lastOnResizeWidth: number | null = null
let lastOnResizeHeight: number | null = null
onResize((res: any) => {
// 1) 直接打印回调参数(满足“打印返回参数”的需求)
console.log('[ReceptionCenter][onResize] res =', res)
// 2) 尝试从回调中提取 width/height 做去重(字段结构在不同端可能不同,必须防御性处理)
let w: number | null = null
let h: number | null = null
const obj = res as UTSJSONObject
const sizeRaw = obj['size']
if (sizeRaw != null) {
const sizeObj = sizeRaw as UTSJSONObject
const ww = sizeObj['windowWidth']
const wh = sizeObj['windowHeight']
if (typeof ww === 'number') { w = ww }
if (typeof wh === 'number') { h = wh }
} else {
const ww = obj['windowWidth']
const wh = obj['windowHeight']
if (typeof ww === 'number') { w = ww }
if (typeof wh === 'number') { h = wh }
}
if (w != null && h != null) {
if (lastOnResizeWidth != w || lastOnResizeHeight != h) {
lastOnResizeWidth = w
lastOnResizeHeight = h
console.log(`[ReceptionCenter][onResize] size = ${w}x${h}`)
}
}
})
function getPerformanceData(): Promise<void> {
return getPerformanceDataImpl()
}
function getCustomerList(append: boolean): Promise<void> {
console.log('[ReceptionCenter] 获取客户列表触底加载', append)
return getCustomerListImpl(append)
}
function getReceptionRecordList(append: boolean): Promise<void> {
return getReceptionRecordListImpl(append)
}
// ========== Tab 切换事件 ==========
/** 主 Tab 切换 */
function onMainTabChange(e: any): void {
let nextIndex = 0
if (typeof e === 'number') {
nextIndex = e
} else {
const eventObj = e as UTSJSONObject
const idx = eventObj['index']
if (idx != null && typeof idx === 'number') {
nextIndex = idx
}
}
mainTabIndex.value = nextIndex
console.log('[ReceptionCenter] 主 Tab 切换:', mainTabIndex.value)
if (mainTabIndex.value == 0) {
void getPerformanceData()
} else {
customerFilePageNum.value = 1
receptionPageNum.value = 1
if (listSubTabIndex.value == 0) {
void getCustomerList(false)
} else {
void getReceptionRecordList(false)
}
}
}
function onOutputTabIndexChange(index: number): void {
console.log('[ReceptionCenter] 产值卡片 Tab 切换:', index)
outputTabIndex.value = index
}
/** 客户列表下的二级 Tab 切换 */
function switchListSubTab(index: number): void {
listSubTabIndex.value = index
console.log('[ReceptionCenter] 列表二级 Tab 切换:', listSubTabIndex.value)
// 重置页码并加载对应列表
if (index == 0) {
customerFilePageNum.value = 1
void getCustomerList(false)
} else {
receptionPageNum.value = 1
void getReceptionRecordList(false)
}
}
/** 客户列表触底加载更多 */
function onListScrollToLower(): void {
// 横屏:左右分栏同时展示「业绩看板 + 客户列表」,此时 mainTabIndex 可能仍为 0
// 因此触底加载不能依赖 mainTabIndex == 1 的门禁,否则横屏永远不触发加载更多
if (isLandscape.value != true && mainTabIndex.value != 1) {
return
}
if (listSubTabIndex.value == 0) {
console.log('[ReceptionCenter] 客户列表触底')
void getCustomerList(true)
} else {
console.log('[ReceptionCenter] 接待列表触底')
void getReceptionRecordList(true)
}
}
/** 业绩看板数值是否展示(睁眼可见 / 闭眼隐藏) */
const performanceMetricsVisible = ref(true)
function togglePerformanceMetricsVisibility(): void {
performanceMetricsVisible.value = !performanceMetricsVisible.value
}
// 客户档案详情(客户录入列表卡片)
const showCustomerFormDetail = ref(false)
const customerFormDetailItem = ref<UTSJSONObject | null>(null)
// 接待复盘详情(接待列表卡片 → receptionDetail.uvue)
const showReceptionRecordDetail = ref(false)
const receptionRecordItem = ref<UTSJSONObject>({})
// 是否使用鸿蒙/问界口径(true=问界/鸿蒙;false=延保/权益)
// channelType == 1 => 问界/鸿蒙
const isHarmonyValue = ref(false)
type PerformanceTypeItem = { label: string; value: number }
function performanceTypeList(): UnPickerColumn {
let list: PerformanceTypeItem[] = []
if (isHarmonyValue.value) {
list = [
{ label: '问界', value: 1 },
{ label: '鸿蒙', value: 2 },
]
} else {
list = [
{ label: '延保', value: 1 },
{ label: '权益', value: 3 },
]
}
// 对象字面量需显式断言为 UnPickerColumnItem,否则 UTS 会推断为 UTSJSONObject
const items: UnPickerColumn = []
let i = 0
while (i < list.length) {
items.push({ text: list[i].label, value: list[i].value } as UnPickerColumnItem)
i++
}
return items
}
// 选中的类型(默认取当前列表第一项)
const selectedBrand = ref<string>(performanceTypeList()[0].text)
const selectedBrandValue = ref<number>(performanceTypeList()[0].value as number)
watch(isHarmonyValue, () => {
// 口径切换时,避免 selectedBrand 仍指向旧列表项
const items = performanceTypeList()
if (items.length > 0) {
selectedBrand.value = items[0].text
selectedBrandValue.value = items[0].value as number
}
})
// picker 列
const columns = computed((): UnPickerColumn[] => {
return [performanceTypeList()]
})
/** 战败/成交:与 submittedResultTabIndex 0/1 一致 */
const submittedResultPickerColumns = computed((): UnPickerColumn[] => {
const col: UnPickerColumn = []
col.push({ text: '战败', value: 0 } as UnPickerColumnItem)
col.push({ text: '成交', value: 1 } as UnPickerColumnItem)
return [col]
})
/** 打开战败/成交下拉时按当前选中回显(下标与 submittedResultTabIndex 一致) */
const submittedResultPickerDefaultIndex = computed((): number[] => {
return [submittedResultTabIndex.value]
})
/** 未复盘/复盘:与 reviewTabIndex 0/1 一致 */
const reviewPickerColumns = computed((): UnPickerColumn[] => {
const col: UnPickerColumn = []
col.push({ text: '未复盘', value: 0 } as UnPickerColumnItem)
col.push({ text: '已复盘', value: 1 } as UnPickerColumnItem)
return [col]
})
/** 打开复盘下拉时按当前 Tab 回显滚轮位置(单列,下标与 reviewTabIndex 一致) */
const reviewPickerDefaultIndex = computed((): number[] => {
return [reviewTabIndex.value]
})
// 确认:将选中值填充到 tag,并关闭弹窗
const onConfirm = (e: UnPickerConfirmEvent): void => {
const items = e.value
if (items != null && items.length > 0) {
selectedBrand.value = items[0].text
selectedBrandValue.value = items[0].value as number
}
show.value = false
}
// 取消:仅关闭弹窗,不更新选中值
const onClose = (): void => {
show.value = false
}
// 客户录入按钮点击:跳转到预录信息页面
function onCustomerEntryClick(): void {
uni.navigateTo({
url: '/pages/receptionCenter/FormAdd'
})
}
function onListCustomerEntryEdit(item: UTSJSONObject): void {
uni.navigateTo({
url: `/pages/receptionCenter/FormAdd?record=${encodeURIComponent(JSON.stringify(item))}`
})
}
function onCustomerFormDetailClose(): void {
showCustomerFormDetail.value = false
customerFormDetailItem.value = null
}
function onReceptionRecordDetailClose(): void {
showReceptionRecordDetail.value = false
receptionRecordItem.value = {}
}
function onListCustomerEntryClick(item: UTSJSONObject): void {
customerFormDetailItem.value = item
showCustomerFormDetail.value = true
showReceptionRecordDetail.value = false
}
function onListCustomerEntryDelete(item: UTSJSONObject): void {
const idStr = getStr(item, 'id')
const list = customerList.value
const next: UTSJSONObject[] = []
let i = 0
while (i < list.length) {
if (getStr(list[i], 'id') != idStr) {
next.push(list[i])
}
i++
}
customerList.value = next
uni.showToast({ title: '已删除', icon: 'none' })
}
function onReceptionCardClick(item: UTSJSONObject): void {
if (filterTabIndex.value == 0) {
receptionRecordItem.value = item
showReceptionRecordDetail.value = true
showCustomerFormDetail.value = false
} else {
uni.showToast({ title: '该接待尚不支持复盘', icon: 'none' })
}
}
// Tab 数据结构
type OutputTabData = {
compareRows: CompareRow[]
summary: OutputSummary
}
// 业绩数据(需在使用前声明,UTS 不支持变量提升)
const performanceData = ref<UTSJSONObject>({})
// 时间进度:按「当月日期 / 当月天数」换算为百分比
const timeProgress = ref<number>(0)
function setTimeProgress(): void {
// e.g. 2026-03-30 => 30 / 31 => 97%
const now = new Date()
const nowNum = now.getDate()
// 通过“下个月第 0 天”拿到“本月最后一天”,从而得到当月天数
const monthDayNum = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate()
timeProgress.value = monthDayNum > 0 ? Math.round(nowNum / monthDayNum * 100) : 0
}
// 页面首次渲染也要有值(避免首帧出现 0% 闪烁)
setTimeProgress()
const timeProgressPercent = computed((): number => {
// 防御性 clamp:确保 width 与文本不会出现异常值
if (timeProgress.value < 0) { return 0 }
if (timeProgress.value > 100) { return 100 }
return timeProgress.value
})
// 当前 tab 数据:由 outputTabIndex 与 performanceData 驱动
// Tab0=本月交付转化率:展示率(excellentStoreAvgDealRate/thisStoreDealRate/personalDealRate)
// Tab1=本月交付客单价:展示额(excellentStoreAvgDeal/thisStoreKdj/personalKdj)
const currentOutputTab = computed((): OutputTabData => {
const d = performanceData.value
const idx = outputTabIndex.value
// 转化率:当前值即百分比(0-100),宽度 = 当前值/100 换算为百分比展示,即 value%
const toRatePct = (x: number): string => Math.min(100, x).toFixed(1) + '%'
const tab0: OutputTabData = {
compareRows: [
{ 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, 'personalDealRate')), barClass: 'bg-blue-400', value: getNum(d, 'personalDealRate').toFixed(1) + '%' }
],
summary: {
summaryLabel: '实际产值',
summaryValueNum: getNum(d, 'actualProduction').toFixed(1),
summaryValueUnit: '万',
personalLabel: '个人产值',
personalValue: getNum(d, 'personalProduction').toFixed(1) + '万',
ringPercent: getNum(d, 'achievementRatio').toFixed(1) + '%',
ringLabel: '达成率',
ringPercentNum: Math.min(100, getNum(d, 'achievementRatio')),
ringComparePercent: 100
}
}
const eAvg = getNum(d, 'excellentStoreAvgDeal')
const thisVal = getNum(d, 'thisStoreKdj')
const perVal = getNum(d, 'personalKdj')
// 客单价:以最大值为100%基准,当前值/最大值*100 换算展示
const maxDeal = eAvg > thisVal ? (eAvg > perVal ? eAvg : perVal) : (thisVal > perVal ? thisVal : perVal)
const toDealPct = (x: number): string => (maxDeal > 0 ? (x / maxDeal * 100) : 0).toFixed(1) + '%'
const tab1: OutputTabData = {
compareRows: [
{ 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(perVal), barClass: 'bg-blue-400', value: '¥' + Math.round(perVal) }
],
summary: {
summaryLabel: '实际产值',
summaryValueNum: getNum(d, 'actualProduction').toFixed(1),
summaryValueUnit: '万',
personalLabel: '个人产值',
personalValue: getNum(d, 'personalProduction').toFixed(1) + '万',
ringPercent: getNum(d, 'achievementRatio').toFixed(1) + '%',
ringLabel: '达成率',
ringPercentNum: Math.min(100, getNum(d, 'achievementRatio')),
ringComparePercent: 100
}
}
if (idx == 1) { return tab1 }
return tab0
})
/** 本月产值卡片底部:目标产值展示(有接口字段则用数据,否则保留占位) */
const monthValueTargetText = computed((): string => {
const d = performanceData.value
const v = getNum(d, 'targetProduction')
if (v > 0) {
return v.toFixed(0) + '万'
}
return '-'
})
/** 本月产值卡片底部:达成比例(有接口字段则用数据,否则保留占位) */
const monthValueAchievementText = computed((): string => {
const d = performanceData.value
const v = getNum(d, 'productionContribution')
if (v > 0) {
return v.toFixed(0) + '%'
}
return '-'
})
/**
* 从登录态取门店 merchantId 与场景业务类型(与 FormAdd 一致:sceneType==0 为 1,否则 2)。
* 缺登录或门店号时返回 null,调用方跳过请求。
*/
function getLoginShopMerchantAndSceneBussiness(): UTSJSONObject | null {
const rawUser = storage.get('userInfo') as UTSJSONObject | null
if (rawUser == null) {
return null
}
const merchantId = rawUser['shopMerchantId']
if (merchantId == null || `${merchantId}` == '') {
return null
}
const sceneTypeRaw = rawUser['sceneType']
const sceneTypeNum = sceneTypeRaw != null ? (sceneTypeRaw as number) : 1
const sceneBussiness = sceneTypeNum == 0 ? 1 : 2
return {
merchantId: merchantId,
sceneBussiness: sceneBussiness,
} as UTSJSONObject
}
/** 当日到店:与 receiption.uts 中 customerInfoPage 示例时间格式一致 */
// 客户档案列表请求参数(预录列表:分页 + 今日到店时传 startTime/endTime)
function getDefaultCustomerFileParams(): UTSJSONObject | null {
const ctx = getLoginShopMerchantAndSceneBussiness()
if (ctx == null) {
return null
}
const params = {
"pageNum": customerFilePageNum.value,
"pageSize": CUSTOMER_FILE_PAGE_SIZE,
"receptionStatus": 1,
"merchantId": ctx['merchantId'],
"bussinessScene": ctx['sceneBussiness'] as number,
} as UTSJSONObject
if (entryFilterIndex.value == 0) {
const range = getTodayDayRangeStrings()
params['startTime'] = range['startTime']
params['endTime'] = range['endTime']
}
return params
}
/**
* 接待复盘列表:dj.api.smartcarlife.reception.customer.page
* - 已提交/未提交 → submitted(1/0,与列表项 submitted 字段对齐;若后端参数名不同请改此处)
* - 复盘/未复盘 → reviewFlag(0=已复盘,非 0 如 1=未复盘)
* - 战败/成交(已提交)/ 待上传·待提交(未提交)→ orderFinishFlag(0/1;未提交若后端另有字段请改映射)
*/
function getDefaultReceptionListParams(): UTSJSONObject | null {
const ctx = getLoginShopMerchantAndSceneBussiness()
if (ctx == null) {
return null
}
// 与 reviewTabIndex、复盘选择器一致:0=已复盘,1=未复盘
const reviewFlag = reviewTabIndex.value
const submitted = filterTabIndex.value == 0 ? 1 : 0
const orderFinishFlag = submitted == 1
? (submittedResultTabIndex.value == 1 ? 1 : 0)
: (unsubmittedPendingTabIndex.value == 1 ? 1 : 0)
return {
"merchantId": ctx['merchantId'],
"pageNum": receptionPageNum.value,
"pageSize": RECEPTION_PAGE_SIZE,
"reviewFlag": reviewFlag,
"orderFinishFlag": orderFinishFlag,
"bussinessType": ctx['sceneBussiness'] as number,
"submitted": submitted,
} as UTSJSONObject
}
// 页面加载/模块切换时请求门店业绩数据
getPerformanceDataImpl = async (): Promise<void> => {
const raw = storage.get('userInfo') as UTSJSONObject | null
if (raw == null) {
performanceData.value = getMockPerformanceData()
return
}
const userInfo = raw
const shopMerchantId = userInfo['shopMerchantId']
const sceneType = userInfo['sceneType']
const range = getCurrentMonthRange()
// 组装接口入参(对齐旧项目逻辑)
const params: UTSJSONObject = {
merchantIdList: shopMerchantId,
sceneType: sceneType != null ? sceneType : 1,
startDate: range['startDate'],
endDate: range['endDate'],
} as UTSJSONObject
if (sceneType != null && sceneType == 0) {
if (isHarmonyValue.value === true) {
// 鸿蒙/问界:bussinessType 固定 1,hmzxFlag 来自当前模块值
params['bussinessType'] = 1
params['hmzxFlag'] = selectedBrandValue.value
} else {
// 延保/权益:bussinessType 来自当前模块值
params['bussinessType'] = selectedBrandValue.value
}
} else {
// 非 0 场景:hmzxFlag 由 isHarmony 决定(模块值只用于展示,不参与接口参数)
params['hmzxFlag'] = isHarmonyValue.value === true ? 3 : 4
}
try {
const res = await getMerchantPerformance(params)
const resObj = res as UTSJSONObject
const bizData = resObj['data'] as UTSJSONObject | null
// performanceData.value = isPerformanceDataEmpty(bizData) ? getMockPerformanceData() : (bizData as UTSJSONObject)
performanceData.value = bizData as UTSJSONObject
} catch (err) {
performanceData.value = getMockPerformanceData()
}
}
watch(selectedBrandValue, () => {
// picker 模块值切换:刷新业绩看板
getPerformanceData()
})
/** append=false 首屏/筛选重置替换列表;append=true 触底追加下一页(pageNum 先 +1 再请求,失败回退) */
getCustomerListImpl = async (append: boolean): Promise<void> => {
if (append) {
if (customerListHasMore.value != true) {
return
}
if (customerListLoadingMore.value == true) {
return
}
}
let pageBumped = false
if (append) {
customerFilePageNum.value = customerFilePageNum.value + 1
pageBumped = true
} else {
customerListHasMore.value = true
}
const fileParams = getDefaultCustomerFileParams()
if (fileParams == null) {
console.warn('[getCustomerList] 无登录门店信息,跳过客户档案列表请求')
if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1
}
return
}
// 首屏/筛选重置与加载更多统一置位,供列表骨架屏、底部「加载中」与空态判断使用(append=false 原先未置 true,导致首屏一直空白)
customerListLoadingMore.value = true
try {
const res = await getCustomerFileList(fileParams)
console.log('[ReceptionCenter] 获取客户列表res', res)
const resObj = res as UTSJSONObject
const codeRaw = resObj['code']
if (`${codeRaw}` != '0') {
const msgRaw = resObj['message']
const msgStr = msgRaw != null && `${msgRaw}` != '' ? `${msgRaw}` : '客户列表加载失败'
if (append != true) {
customerList.value = []
customerListHasMore.value = false
}
if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1
}
uni.showToast({ title: msgStr, icon: 'none' })
return
}
const bizData = resObj['data'] as UTSJSONObject | null
if (bizData == null) {
if (append != true) {
customerList.value = []
}
customerListHasMore.value = false
if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1
}
return
}
const list = bizData['list']
if (list == null || (list instanceof Array) != true) {
if (append != true) {
customerList.value = []
}
customerListHasMore.value = false
if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1
}
return
}
const arr: UTSJSONObject[] = []
let i = 0
while (i < list.length) {
const item = list[i] as UTSJSONObject
arr.push(item)
i++
}
if (append == true) {
customerList.value = mergeByKey(customerList.value, arr, 'id')
} else {
customerList.value = arr
}
customerListHasMore.value = resolveHasMore(
bizData,
arr.length,
customerList.value.length,
CUSTOMER_FILE_PAGE_SIZE
)
} catch (err) {
console.error('获取客户档案列表失败:', err)
if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1
}
if (append != true) {
customerListHasMore.value = false
}
uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' })
} finally {
customerListLoadingMore.value = false
}
}
/** append=false 重置页码后整表替换;append=true 触底下一页合并(与 getCustomerList 一致) */
getReceptionRecordListImpl = async (append: boolean): Promise<void> => {
if (append) {
if (receptionListHasMore.value != true) {
return
}
if (receptionListLoadingMore.value == true) {
return
}
}
let pageBumped = false
if (append) {
receptionPageNum.value = receptionPageNum.value + 1
pageBumped = true
} else {
receptionListHasMore.value = true
}
const receptionParams = getDefaultReceptionListParams()
if (receptionParams == null) {
console.warn('[getReceptionRecordList] 无登录门店信息,跳过接待复盘列表请求')
if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1
}
return
}
receptionListLoadingMore.value = true
console.log("receptionParams接待复盘参数",receptionParams);
try {
const res = await getReceptionList(receptionParams)
console.log("receptionParams接待复盘列表",res);
const resObj = res as UTSJSONObject
const codeRaw = resObj['code']
if (`${codeRaw}` != '0') {
const msgRaw = resObj['message']
const msgStr = msgRaw != null && `${msgRaw}` != '' ? `${msgRaw}` : '接待列表加载失败'
if (append != true) {
receptionRecordList.value = []
receptionListHasMore.value = false
}
if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1
}
uni.showToast({ title: msgStr, icon: 'none' })
return
}
const bizData = resObj['data'] as UTSJSONObject | null
if (bizData == null) {
if (append != true) {
receptionRecordList.value = []
}
receptionListHasMore.value = false
if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1
}
return
}
const list = bizData['list']
if (list == null || (list instanceof Array) != true) {
if (append != true) {
receptionRecordList.value = []
}
receptionListHasMore.value = false
if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1
}
return
}
const arr: UTSJSONObject[] = []
let i = 0
while (i < list.length) {
const item = list[i] as UTSJSONObject
arr.push(item)
i++
}
if (append == true) {
receptionRecordList.value = mergeByKey(receptionRecordList.value, arr, 'batchId')
} else {
receptionRecordList.value = arr
}
receptionListHasMore.value = resolveHasMore(
bizData,
arr.length,
receptionRecordList.value.length,
RECEPTION_PAGE_SIZE
)
} catch (err) {
console.error('获取接待复盘列表失败:', err)
if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1
}
if (append != true) {
receptionListHasMore.value = false
}
uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' })
} finally {
receptionListLoadingMore.value = false
}
}
function switchFilterTab(index: number): void {
filterTabIndex.value = index
receptionPageNum.value = 1
void getReceptionRecordList(false)
}
function switchEntryFilterTab(index: number): void {
entryFilterIndex.value = index
customerFilePageNum.value = 1
void getCustomerList(false)
}
function switchReviewTab(index: number): void {
reviewTabIndex.value = index
receptionPageNum.value = 1
void getReceptionRecordList(false)
}
function switchSubmittedResultTab(index: number): void {
submittedResultTabIndex.value = index
receptionPageNum.value = 1
void getReceptionRecordList(false)
}
function switchUnsubmittedPendingTab(index: number): void {
unsubmittedPendingTabIndex.value = index
receptionPageNum.value = 1
void getReceptionRecordList(false)
}
function onSubmittedResultPickerConfirm(e: UnPickerConfirmEvent): void {
const items = e.value
if (items != null && items.length > 0) {
const idx = items[0].value as number
switchSubmittedResultTab(idx)
}
showSubmittedResultPicker.value = false
}
function onSubmittedResultPickerClose(): void {
showSubmittedResultPicker.value = false
}
function openSubmittedResultPicker(): void {
submittedResultPickerLayerKey.value = submittedResultPickerLayerKey.value + 1
showSubmittedResultPicker.value = true
}
function onReviewPickerConfirm(e: UnPickerConfirmEvent): void {
const items = e.value
if (items != null && items.length > 0) {
const idx = items[0].value as number
if (reviewTabIndex.value != idx) {
switchReviewTab(idx)
}
}
showReviewPicker.value = false
}
function onReviewPickerClose(): void {
showReviewPicker.value = false
}
function openReviewPicker(): void {
reviewPickerLayerKey.value = reviewPickerLayerKey.value + 1
showReviewPicker.value = true
}
onMounted(() => {
// JS判断安全区顶部占位、横竖屏判断、以及 横屏窄宽时右侧筛选区的窄屏模式
syncReceptionDashboardLayout()
// uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,这里统一用轮询保证兼容性
// 如需 H5 实时监听,可在 H5 条件编译块里单独注册
// 页面加载后再次兜底计算(避免运行期时区/时间跳变导致不一致)
setTimeProgress()
// 根据当前 Tab 加载对应数据
// 横屏:左右分栏同时展示两个模块,因此初始化时两边数据都需要拉取
if (isLandscape.value == true) {
void getPerformanceData()
if (listSubTabIndex.value == 0) {
void getCustomerList(false)
} else {
void getReceptionRecordList(false)
}
} else {
if (mainTabIndex.value == 0) {
void getPerformanceData()
} else {
if (listSubTabIndex.value == 0) {
void getCustomerList(false)
} else {
void getReceptionRecordList(false)
}
}
}
console.log('[ReceptionCenter] 页面初始化完成')
})
// 在 center.uvue setup 顶部监听自定义事件,刷新列表
onMounted(() => {
uni.$on('refresh-reception-list', () => {
// 重新加载第一页
customerFilePageNum.value = 1
void getCustomerList(false)
})
})
onUnmounted(() => {
uni.$off('refresh-reception-list')
})
</script>
<style scoped lang="scss">
// @import "./styles/common.scss";
// @import "./styles/landscape.scss";
// @import "./styles/portrait.scss";
/* 接待中心页面包一层:供预录表单绝对定位覆盖 */
.reception-center-page {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
position: relative;
display: flex;
flex-direction: column;
}
/* 动态高度由 receptionSafeTopSpacerStyle 注入,避免与状态栏区域重叠 */
.reception-safe-top-spacer {
width: 100%;
flex-shrink: 0;
}
/* ========== Tab 容器 ========== */
.reception-tabs-container {
background-color: #ffffff;
flex-shrink: 0;
border-bottom: 1px solid #eef2f7;
padding: 8px 12px 6px;
box-sizing: border-box;
}
.reception-main-tabs {
background: linear-gradient(180deg, #f8fbff 0%, #f1f7ff 100%);
border-radius: 14px;
padding: 0 10px;
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}
.reception-navbar-spacer {
height: 44px;
flex-shrink: 0;
}
.reception-content-container {
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
.reception-content-portrait {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.reception-content-landscape {
flex: 1;
min-height: 0;
display: flex;
flex-direction: row;
}
.reception-landscape-left {
flex: 1;
min-height: 0;
min-width: 0;
overflow: hidden;
border-right: 1px solid #eef2f7;
}
.reception-landscape-right {
flex: 2;
min-height: 0;
min-width: 0;
overflow: hidden;
}
/* 预录信息 / 客户档案详情 全屏层:对齐 HomeFrame .reception-detail-inner */
.form-add-inner,
.form-detail-inner {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
z-index: 10;
background-color: #ffffff;
}
</style>
apps/uniappX/uniapp-x-tape/pages/receptionCenter/center.uvue
View file @
a80cc5e
<template>
<template>
<!-- 接待中心 Tab 聚合页 -->
<!-- 接待中心 Tab 聚合页:与 pages/index、pages/person/myCenter 一致,SceneShell 负责 hideNativeTabBar + un-tabbar -->
<layout-root :key="isLandscape">
<layout-root :page-vars="pageVars">
<!-- <view class="test" :style="dynamicModuleBoxStyle">
<view class="reception-shell-page">
测试文案 {{ dynamicModuleBoxStyle}}
<SceneShell ref="shellRef"
:active-tab-index="1">
<template #default>
<!-- <view class="test test-view">
<text class="test-orientation-text">hooks:{{ hookOrientation }} {{ hookOrientation=='landscape'?'横屏':'竖屏'}} {{ isLandscape }}</text>
</view> -->
</view> -->
<view class="reception-center-page">
<view class="reception-center-page">
<!-- 顶部安全区 -->
<view
v-if="isPortrait768x1174"
class="reception-safe-top-spacer"
:style="receptionSafeTopSpacerStyle"
></view>
<!-- <un-navbar title="接待中心" left-icon="" /> -->
<!-- <un-navbar title="接待中心" left-icon="" /> -->
<!-- <view class="reception-navbar-spacer"></view> -->
<!-- <view class="reception-navbar-spacer"></view> -->
...
@@ -170,12 +167,16 @@
...
@@ -170,12 +167,16 @@
<ReceptionDetail :item="receptionRecordItem" @close="onReceptionRecordDetailClose" />
<ReceptionDetail :item="receptionRecordItem" @close="onReceptionRecordDetailClose" />
</view>
</view>
</view>
</view>
</layout-root>
</template>
</SceneShell>
</view>
</layout-root>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
// 接待中心 Tab 聚合页
// 接待中心 Tab 聚合页
import { ref, computed, onMounted, onUnmounted, watch, onResize } from 'vue'
import { ref, computed, onMounted, onUnmounted, watch, onResize, type Ref, type ComponentPublicInstance } from 'vue'
import SceneShell from '@/components/HomeFrame/SceneShell.uvue'
import { type UnPickerColumn, type UnPickerColumnItem, type UnPickerConfirmEvent, type UnTabItem } from '@/uni_modules/uview-unix'
import { type UnPickerColumn, type UnPickerColumnItem, type UnPickerConfirmEvent, type UnTabItem } from '@/uni_modules/uview-unix'
import FormDetail from './forms/FormDetail.uvue'
import FormDetail from './forms/FormDetail.uvue'
import ReceptionDetail from './receptionDetail.uvue'
import ReceptionDetail from './receptionDetail.uvue'
...
@@ -187,6 +188,7 @@ import { getMerchantPerformance, getCustomerFileList, getReceptionList } from '@
...
@@ -187,6 +188,7 @@ import { getMerchantPerformance, getCustomerFileList, getReceptionList } from '@
import { storage } from '@/utils/storage.uts'
import { storage } from '@/utils/storage.uts'
import { resolutionState } from '@/services/adapter/index.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 { getLandscapeConfig } from "./styles/landscape.uts";
import { getLandscapeConfig } from "./styles/landscape.uts";
import {
import {
...
@@ -194,12 +196,26 @@ import {
...
@@ -194,12 +196,26 @@ import {
getReceptionPortraitMainTabsConfig,
getReceptionPortraitMainTabsConfig,
type ReceptionPortraitMainTabsConfig
type ReceptionPortraitMainTabsConfig
} from "./styles/portrait.uts";
} from "./styles/portrait.uts";
import pageVars from './styles/index.vars'
const shellRef = ref(null)
onShow(() => {
if (shellRef.value != null) {
(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
})
})
// ========== Tab 管理 ==========
/** useOrientation 全局状态,配合 updateOrientation 在 onMounted / onResize 刷新后展示 */
const receptionOrientationHook = useOrientation()
const hookOrientation = computed((): string => {
return (receptionOrientationHook.orientationKey as Ref<string>).value
})
// ========== Tab 管理 ==========
// ========== Tab 管理 ==========
/** 主 Tab:0=业绩看板,1=客户列表 */
/** 主 Tab:0=业绩看板,1=客户列表 */
const mainTabIndex = ref(0)
const mainTabIndex = ref(0)
...
@@ -337,6 +353,109 @@ const submittedResultTabIndex = ref(0);
...
@@ -337,6 +353,109 @@ const submittedResultTabIndex = ref(0);
const unsubmittedPendingTabIndex = ref(0);
const unsubmittedPendingTabIndex = ref(0);
const reviewTabIndex = ref(0)
const reviewTabIndex = ref(0)
// Tab 数据结构
type OutputTabData = {
compareRows: CompareRow[]
summary: OutputSummary
}
// 业绩数据(需在使用前声明,UTS 不支持变量提升)
const performanceData = ref<UTSJSONObject>({})
// 时间进度:按「当月日期 / 当月天数」换算为百分比
const timeProgress = ref<number>(0)
function setTimeProgress(): void {
// e.g. 2026-03-30 => 30 / 31 => 97%
const now = new Date()
const nowNum = now.getDate()
// 通过“下个月第 0 天”拿到“本月最后一天”,从而得到当月天数
const monthDayNum = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate()
timeProgress.value = monthDayNum > 0 ? Math.round(nowNum / monthDayNum * 100) : 0
}
// 页面首次渲染也要有值(避免首帧出现 0% 闪烁)
setTimeProgress()
const timeProgressPercent = computed((): number => {
// 防御性 clamp:确保 width 与文本不会出现异常值
if (timeProgress.value < 0) { return 0 }
if (timeProgress.value > 100) { return 100 }
return timeProgress.value
})
// 当前 tab 数据:由 outputTabIndex 与 performanceData 驱动
// Tab0=本月交付转化率:展示率(excellentStoreAvgDealRate/thisStoreDealRate/personalDealRate)
// Tab1=本月交付客单价:展示额(excellentStoreAvgDeal/thisStoreKdj/personalKdj)
const currentOutputTab = computed((): OutputTabData => {
const d = performanceData.value
const idx = outputTabIndex.value
// 转化率:当前值即百分比(0-100),宽度 = 当前值/100 换算为百分比展示,即 value%
const toRatePct = (x: number): string => Math.min(100, x).toFixed(1) + '%'
const tab0: OutputTabData = {
compareRows: [
{ 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, 'personalDealRate')), barClass: 'bg-blue-400', value: getNum(d, 'personalDealRate').toFixed(1) + '%' }
],
summary: {
summaryLabel: '实际产值',
summaryValueNum: getNum(d, 'actualProduction').toFixed(1),
summaryValueUnit: '万',
personalLabel: '个人产值',
personalValue: getNum(d, 'personalProduction').toFixed(1) + '万',
ringPercent: getNum(d, 'achievementRatio').toFixed(1) + '%',
ringLabel: '达成率',
ringPercentNum: Math.min(100, getNum(d, 'achievementRatio')),
ringComparePercent: 100
}
}
const eAvg = getNum(d, 'excellentStoreAvgDeal')
const thisVal = getNum(d, 'thisStoreKdj')
const perVal = getNum(d, 'personalKdj')
// 客单价:以最大值为100%基准,当前值/最大值*100 换算展示
const maxDeal = eAvg > thisVal ? (eAvg > perVal ? eAvg : perVal) : (thisVal > perVal ? thisVal : perVal)
const toDealPct = (x: number): string => (maxDeal > 0 ? (x / maxDeal * 100) : 0).toFixed(1) + '%'
const tab1: OutputTabData = {
compareRows: [
{ 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(perVal), barClass: 'bg-blue-400', value: '¥' + Math.round(perVal) }
],
summary: {
summaryLabel: '实际产值',
summaryValueNum: getNum(d, 'actualProduction').toFixed(1),
summaryValueUnit: '万',
personalLabel: '个人产值',
personalValue: getNum(d, 'personalProduction').toFixed(1) + '万',
ringPercent: getNum(d, 'achievementRatio').toFixed(1) + '%',
ringLabel: '达成率',
ringPercentNum: Math.min(100, getNum(d, 'achievementRatio')),
ringComparePercent: 100
}
}
if (idx == 1) { return tab1 }
return tab0
})
/** 本月产值卡片底部:目标产值展示(有接口字段则用数据,否则保留占位) */
const monthValueTargetText = computed((): string => {
const d = performanceData.value
const v = getNum(d, 'targetProduction')
if (v > 0) {
return v.toFixed(0) + '万'
}
return '-'
})
/** 本月产值卡片底部:达成比例(有接口字段则用数据,否则保留占位) */
const monthValueAchievementText = computed((): string => {
const d = performanceData.value
const v = getNum(d, 'productionContribution')
if (v > 0) {
return v.toFixed(0) + '%'
}
return '-'
})
// 客户档案列表(客户录入 Tab,接口 dj.api.smartcarlife.customervisits.customerInfoPage)
// 客户档案列表(客户录入 Tab,接口 dj.api.smartcarlife.customervisits.customerInfoPage)
const customerList = ref<UTSJSONObject[]>([])
const customerList = ref<UTSJSONObject[]>([])
...
@@ -369,61 +488,26 @@ const receptionFilterNarrowMode = ref(false)
...
@@ -369,61 +488,26 @@ const receptionFilterNarrowMode = ref(false)
let receptionDashboardLayoutPollId: number | null = null
let receptionDashboardLayoutPollId: number | null = null
const RECEPTION_LAYOUT_POLL_MS = 400
const RECEPTION_LAYOUT_POLL_MS = 400
/** 是否横屏(windowWidth > windowHeight)。横屏模式下隐藏 Tabs,左右分栏同时展示两个模块 */
/** 是否横屏:与 orientationKey / hookOrientation 同源(useOrientation 的 isPortrait),保持 computed 随 updateOrientation 更新 */
const isLandscape = ref(false)
const isLandscape = computed((): boolean => {
return (receptionOrientationHook.isPortrait as Ref<boolean>).value != true
})
/** 记录上一次打印过的方向,避免轮询期间刷屏 */
/** 记录上一次打印过的方向,避免轮询期间刷屏 */
let lastOrientationLogLandscape: boolean | null = null
let lastOrientationLogLandscape: boolean | null = null
/** 顶部安全区占位(px):与系统状态栏/刘海对齐,随窗口信息刷新 */
const receptionPageInsetTopPx = ref(0)
const receptionSafeTopSpacerStyle = computed((): UTSJSONObject => {
return {
height: `${receptionPageInsetTopPx.value}px`,
width: '100%',
} as UTSJSONObject
})
function syncReceptionDashboardLayout(): void {
function syncReceptionDashboardLayout(): void {
/**
/**
* 接待中心「布局同步」:
* 接待中心「布局同步」:
* - 计算顶部安全区占位,避免自定义导航与状态栏/刘海重叠
* - 横竖屏 UI 由 useOrientation(isPortrait / orientationKey)与 isLandscape(computed)驱动,须先刷新全局方向再读 isLandscape
* - 判断横竖屏(横屏用于左右分栏展示、竖屏用于 Tab 切换展示)
* - 横屏窄宽时启用筛选区窄模式,避免 segmented 等控件最小宽度导致溢出
* - 横屏窄宽时启用筛选区窄模式,避免 segmented 等控件最小宽度导致溢出
*
*
* 说明:
* 说明:
* - uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,因此通过定时轮询触发同步
* - uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,因此通过定时轮询触发同步
* - 部分机型旋转后 getWindowInfo 的 windowWidth/windowHeight 刷新可能滞后,这里优先用 systemInfo 的 screenWidth/screenHeight 做兜底
* - 部分机型旋转后 getWindowInfo 的 windowWidth/windowHeight 刷新可能滞后,这里优先用 systemInfo 的 screenWidth/screenHeight 做兜底
*/
*/
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()
// 自定义导航:预留顶部安全区,避免与状态栏/刘海重叠(优先 safeAreaInsets.top -> safeArea.top -> statusBarHeight)
let topInset = 0
const insets = info.safeAreaInsets
if (insets != null) {
const t = insets.top
if (t != null && t > 0) {
topInset = Math.round(t)
}
}
if (topInset <= 0) {
const safe = info.safeArea
if (safe != null) {
const st = safe.top
if (st != null && st > 0) {
topInset = Math.round(st)
}
}
}
if (topInset <= 0) {
const sb = info.statusBarHeight
if (sb != null && sb > 0) {
topInset = Math.round(sb)
}
}
if (receptionPageInsetTopPx.value != topInset) {
receptionPageInsetTopPx.value = topInset
}
// 宽高优先取 systemInfo(部分机型旋转后 getWindowInfo 可能刷新不及时)
// 宽高优先取 systemInfo(部分机型旋转后 getWindowInfo 可能刷新不及时)
const sys = uni.getSystemInfoSync()
const sys = uni.getSystemInfoSync()
const sysSw = sys.screenWidth
const sysSw = sys.screenWidth
...
@@ -437,21 +521,17 @@ function syncReceptionDashboardLayout(): void {
...
@@ -437,21 +521,17 @@ function syncReceptionDashboardLayout(): void {
// 横屏判定:宽 > 高。取值优先级: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)
const nextSplit = w > h
if (lastOrientationLogLandscape == null || lastOrientationLogLandscape != isLandscape.value) {
if (isLandscape.value != nextSplit) {
lastOrientationLogLandscape = isLandscape.value
isLandscape.value = nextSplit
}
if (lastOrientationLogLandscape == null || lastOrientationLogLandscape != nextSplit) {
lastOrientationLogLandscape = nextSplit
console.log(
console.log(
`[ReceptionCenter] 屏幕方向变化:${
nextSplit
? '横屏' : '竖屏'}(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 =
nextSplit
&& 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
}
}
...
@@ -493,6 +573,8 @@ onResize((res: any) => {
...
@@ -493,6 +573,8 @@ onResize((res: any) => {
console.log(`[ReceptionCenter][onResize] size = ${w}x${h}`)
console.log(`[ReceptionCenter][onResize] size = ${w}x${h}`)
}
}
}
}
updateOrientation()
syncReceptionDashboardLayout()
})
})
function getPerformanceData(): Promise<void> {
function getPerformanceData(): Promise<void> {
...
@@ -585,6 +667,17 @@ const customerFormDetailItem = ref<UTSJSONObject | null>(null)
...
@@ -585,6 +667,17 @@ const customerFormDetailItem = ref<UTSJSONObject | null>(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 {
if (filterTabIndex.value == 0) {
receptionRecordItem.value = item
showReceptionRecordDetail.value = true
showCustomerFormDetail.value = false
} else {
uni.showToast({ title: '该接待尚不支持复盘', icon: 'none' })
}
}
// 是否使用鸿蒙/问界口径(true=问界/鸿蒙;false=延保/权益)
// 是否使用鸿蒙/问界口径(true=问界/鸿蒙;false=延保/权益)
// channelType == 1 => 问界/鸿蒙
// channelType == 1 => 问界/鸿蒙
...
@@ -717,119 +810,6 @@ function onListCustomerEntryDelete(item: UTSJSONObject): void {
...
@@ -717,119 +810,6 @@ function onListCustomerEntryDelete(item: UTSJSONObject): void {
uni.showToast({ title: '已删除', icon: 'none' })
uni.showToast({ title: '已删除', icon: 'none' })
}
}
function onReceptionCardClick(item: UTSJSONObject): void {
if (filterTabIndex.value == 0) {
receptionRecordItem.value = item
showReceptionRecordDetail.value = true
showCustomerFormDetail.value = false
} else {
uni.showToast({ title: '该接待尚不支持复盘', icon: 'none' })
}
}
// Tab 数据结构
type OutputTabData = {
compareRows: CompareRow[]
summary: OutputSummary
}
// 业绩数据(需在使用前声明,UTS 不支持变量提升)
const performanceData = ref<UTSJSONObject>({})
// 时间进度:按「当月日期 / 当月天数」换算为百分比
const timeProgress = ref<number>(0)
function setTimeProgress(): void {
// e.g. 2026-03-30 => 30 / 31 => 97%
const now = new Date()
const nowNum = now.getDate()
// 通过“下个月第 0 天”拿到“本月最后一天”,从而得到当月天数
const monthDayNum = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate()
timeProgress.value = monthDayNum > 0 ? Math.round(nowNum / monthDayNum * 100) : 0
}
// 页面首次渲染也要有值(避免首帧出现 0% 闪烁)
setTimeProgress()
const timeProgressPercent = computed((): number => {
// 防御性 clamp:确保 width 与文本不会出现异常值
if (timeProgress.value < 0) { return 0 }
if (timeProgress.value > 100) { return 100 }
return timeProgress.value
})
// 当前 tab 数据:由 outputTabIndex 与 performanceData 驱动
// Tab0=本月交付转化率:展示率(excellentStoreAvgDealRate/thisStoreDealRate/personalDealRate)
// Tab1=本月交付客单价:展示额(excellentStoreAvgDeal/thisStoreKdj/personalKdj)
const currentOutputTab = computed((): OutputTabData => {
const d = performanceData.value
const idx = outputTabIndex.value
// 转化率:当前值即百分比(0-100),宽度 = 当前值/100 换算为百分比展示,即 value%
const toRatePct = (x: number): string => Math.min(100, x).toFixed(1) + '%'
const tab0: OutputTabData = {
compareRows: [
{ 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, 'personalDealRate')), barClass: 'bg-blue-400', value: getNum(d, 'personalDealRate').toFixed(1) + '%' }
],
summary: {
summaryLabel: '实际产值',
summaryValueNum: getNum(d, 'actualProduction').toFixed(1),
summaryValueUnit: '万',
personalLabel: '个人产值',
personalValue: getNum(d, 'personalProduction').toFixed(1) + '万',
ringPercent: getNum(d, 'achievementRatio').toFixed(1) + '%',
ringLabel: '达成率',
ringPercentNum: Math.min(100, getNum(d, 'achievementRatio')),
ringComparePercent: 100
}
}
const eAvg = getNum(d, 'excellentStoreAvgDeal')
const thisVal = getNum(d, 'thisStoreKdj')
const perVal = getNum(d, 'personalKdj')
// 客单价:以最大值为100%基准,当前值/最大值*100 换算展示
const maxDeal = eAvg > thisVal ? (eAvg > perVal ? eAvg : perVal) : (thisVal > perVal ? thisVal : perVal)
const toDealPct = (x: number): string => (maxDeal > 0 ? (x / maxDeal * 100) : 0).toFixed(1) + '%'
const tab1: OutputTabData = {
compareRows: [
{ 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(perVal), barClass: 'bg-blue-400', value: '¥' + Math.round(perVal) }
],
summary: {
summaryLabel: '实际产值',
summaryValueNum: getNum(d, 'actualProduction').toFixed(1),
summaryValueUnit: '万',
personalLabel: '个人产值',
personalValue: getNum(d, 'personalProduction').toFixed(1) + '万',
ringPercent: getNum(d, 'achievementRatio').toFixed(1) + '%',
ringLabel: '达成率',
ringPercentNum: Math.min(100, getNum(d, 'achievementRatio')),
ringComparePercent: 100
}
}
if (idx == 1) { return tab1 }
return tab0
})
/** 本月产值卡片底部:目标产值展示(有接口字段则用数据,否则保留占位) */
const monthValueTargetText = computed((): string => {
const d = performanceData.value
const v = getNum(d, 'targetProduction')
if (v > 0) {
return v.toFixed(0) + '万'
}
return '-'
})
/** 本月产值卡片底部:达成比例(有接口字段则用数据,否则保留占位) */
const monthValueAchievementText = computed((): string => {
const d = performanceData.value
const v = getNum(d, 'productionContribution')
if (v > 0) {
return v.toFixed(0) + '%'
}
return '-'
})
/**
/**
* 从登录态取门店 merchantId 与场景业务类型(与 FormAdd 一致:sceneType==0 为 1,否则 2)。
* 从登录态取门店 merchantId 与场景业务类型(与 FormAdd 一致:sceneType==0 为 1,否则 2)。
* 缺登录或门店号时返回 null,调用方跳过请求。
* 缺登录或门店号时返回 null,调用方跳过请求。
...
@@ -1221,7 +1201,8 @@ function openReviewPicker(): void {
...
@@ -1221,7 +1201,8 @@ function openReviewPicker(): void {
}
}
onMounted(() => {
onMounted(() => {
// JS判断安全区顶部占位、横竖屏判断、以及 横屏窄宽时右侧筛选区的窄屏模式
// 先刷新全局方向,再同步安全区与窄屏模式(与 isLandscape 的 computed 数据源一致)
updateOrientation()
syncReceptionDashboardLayout()
syncReceptionDashboardLayout()
// uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,这里统一用轮询保证兼容性
// uni-app x(尤其 APP 端)对 onWindowResize 支持不稳定,这里统一用轮询保证兼容性
// 如需 H5 实时监听,可在 H5 条件编译块里单独注册
// 如需 H5 实时监听,可在 H5 条件编译块里单独注册
...
@@ -1266,9 +1247,25 @@ onUnmounted(() => {
...
@@ -1266,9 +1247,25 @@ onUnmounted(() => {
</script>
</script>
<style scoped lang="scss">
<style scoped lang="scss">
//
@import "./styles/common.scss";
@import "./styles/common.scss";
// @import "./styles/landscape.scss";
// @import "./styles/landscape.scss";
// @import "./styles/portrait.scss";
// @import "./styles/portrait.scss";
.reception-shell-page {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.reception-shell-page :deep(.scene-shell-root) {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
height: 100%;
}
/* 接待中心页面包一层:供预录表单绝对定位覆盖 */
/* 接待中心页面包一层:供预录表单绝对定位覆盖 */
.reception-center-page {
.reception-center-page {
flex: 1;
flex: 1;
...
@@ -1280,18 +1277,12 @@ onUnmounted(() => {
...
@@ -1280,18 +1277,12 @@ onUnmounted(() => {
flex-direction: column;
flex-direction: column;
}
}
/* 动态高度由 receptionSafeTopSpacerStyle 注入,避免与状态栏区域重叠 */
.reception-safe-top-spacer {
width: 100%;
flex-shrink: 0;
}
/* ========== Tab 容器 ========== */
/* ========== Tab 容器 ========== */
.reception-tabs-container {
.reception-tabs-container {
background-color: #ffffff;
background-color: #ffffff;
flex-shrink: 0;
flex-shrink: 0;
border-bottom: 1px solid #eef2f7;
border-bottom: 1px solid #eef2f7;
padding:
8
px 12px 6px;
padding:
0
px 12px 6px;
box-sizing: border-box;
box-sizing: border-box;
}
}
...
@@ -1307,55 +1298,12 @@ onUnmounted(() => {
...
@@ -1307,55 +1298,12 @@ onUnmounted(() => {
flex-shrink: 0;
flex-shrink: 0;
}
}
.reception-
content-container
{
.reception-
route-body
{
flex: 1;
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
.reception-content-portrait {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.reception-content-landscape {
flex: 1;
min-height: 0;
display: flex;
flex-direction: row;
}
.reception-landscape-left {
flex: 1;
min-height: 0;
min-width: 0;
overflow: hidden;
border-right: 1px solid #eef2f7;
}
.reception-landscape-right {
flex: 2;
min-height: 0;
min-width: 0;
overflow: hidden;
}
/* 预录信息 / 客户档案详情 全屏层:对齐 HomeFrame .reception-detail-inner */
.form-add-inner,
.form-detail-inner {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
z-index: 10;
background-color: #ffffff;
}
}
</style>
</style>
apps/uniappX/uniapp-x-tape/pages/receptionCenter/filters/ReceptionListPrimaryFilter.uvue
View file @
a80cc5e
...
@@ -127,8 +127,8 @@ const preEntryIconSize = computed((): number => {
...
@@ -127,8 +127,8 @@ const preEntryIconSize = computed((): number => {
})
})
</script>
</script>
<style>
<style
scoped lang="scss"
>
@import "../styles/reception-filter-shared.css";
@import "../styles/reception-filter-shared.
s
css";
.filter-group-compact.filter-group-entry-segmented {
.filter-group-compact.filter-group-entry-segmented {
flex: 1 1 0;
flex: 1 1 0;
...
...
apps/uniappX/uniapp-x-tape/pages/receptionCenter/filters/ReceptionListSecondaryFilter.uvue
View file @
a80cc5e
...
@@ -133,8 +133,8 @@ const reviewTagArrowStyle = computed((): UTSJSONObject => {
...
@@ -133,8 +133,8 @@ const reviewTagArrowStyle = computed((): UTSJSONObject => {
})
})
</script>
</script>
<style>
<style
scoped lang="scss"
>
@import "../styles/reception-filter-shared.css";
@import "../styles/reception-filter-shared.
s
css";
.filter-actions.filter-actions--review {
.filter-actions.filter-actions--review {
flex: 2 1 0;
flex: 2 1 0;
...
...
apps/uniappX/uniapp-x-tape/pages/receptionCenter/styles/common.scss
View file @
a80cc5e
.adapter
{
color
:var
(
--adapter-color
)
;
font-size
:
var
(
--
adapter-fontsize
);
}
.test-view
{
height
:
var
(
--
test-view-height
);
background-color
:
var
(
--
test-view-bg
,
transparent
);
}
.reception-tabs-container
{
padding
:
var
(
--
reception-tabs-container-padding
);
}
\ No newline at end of file
\ No newline at end of file
apps/uniappX/uniapp-x-tape/pages/receptionCenter/styles/index.vars.uts
0 → 100644
View file @
a80cc5e
// 约定式命名:必须叫 index.vars.uts
export default {
common: {
'--home-box-bg': '#FF4444',
},
portrait: {
'--adapter-color': 'red',
'--adapter-fontsize': '50px',
'--test-view-height': '60px',
'--test-view-bg': 'red',
// 'padding': '10px'
},
landscape: {
'--adapter-color': 'green',
'--adapter-fontsize': '50px',
'--test-view-height': '30px',
'--test-view-bg': 'green',
// 'padding': '10px'
},
resolutions: {
'portrait-768x1174': {
'--adapter-color': 'blue',
'--adapter-fontsize': '50px',
'--test-view-height': '60px',
'--test-view-bg': 'blue',
// 'padding': '10px'
'--reception-tabs-container-padding': '8px 12px 60px'
},
'landscape-1174x768': {
'--adapter-color': '#FF4444',
'--adapter-fontsize': '20px',
'--test-view-width': '100%',
'--test-view-height': '30px',
'--test-view-bg': 'pink',
// 'padding': '10px'
},
},
}
apps/uniappX/uniapp-x-tape/pages/receptionCenter/styles/reception-filter-shared.css
→
apps/uniappX/uniapp-x-tape/pages/receptionCenter/styles/reception-filter-shared.
s
css
View file @
a80cc5e
...
@@ -27,35 +27,35 @@
...
@@ -27,35 +27,35 @@
.entry-filter-segmented-wrap
{
.entry-filter-segmented-wrap
{
align-items
:
stretch
;
align-items
:
stretch
;
}
.entry-filter-segmented-wrap
.un-segmented
{
.un-segmented
{
flex
:
1
;
flex
:
1
;
width
:
100%
;
width
:
100%
;
border-width
:
0
;
border-width
:
0
;
background-color
:
rgba
(
0
,
0
,
0
,
0
.04
);
background-color
:
rgba
(
0
,
0
,
0
,
0
.04
);
border-radius
:
10px
;
border-radius
:
10px
;
padding
:
2px
;
padding
:
2px
;
}
}
.entry-filter-segmented-wrap
.un-segmented__item
{
.un-segmented__item
{
border-width
:
0
;
border-width
:
0
;
border-radius
:
10px
;
border-radius
:
10px
;
}
.entry-filter-segmented-wrap
.un-segmented__item
.un-segmented__item__text
{
.un-segmented__item__text
{
color
:
#64748b
;
color
:
#64748b
;
font-size
:
14px
;
font-size
:
14px
;
}
}
.entry-filter-segmented-wrap
.un-segmented__item
--active
{
&
--active
{
background-color
:
#ffffff
;
background-color
:
#ffffff
;
box-shadow
:
0
2px
8px
rgba
(
0
,
0
,
0
,
0
.05
);
box-shadow
:
0
2px
8px
rgba
(
0
,
0
,
0
,
0
.05
);
}
.entry-filter-segmented-wrap
.un-segmented__item--active
.un-segmented__item__text
{
.un-segmented__item__text
{
color
:
#1677ff
;
color
:
#1677ff
;
font-weight
:
600
;
font-weight
:
600
;
}
}
}
}
}
.filter-actions
{
.filter-actions
{
...
...
apps/uniappX/uniapp-x-tape/pages/receptionCenter/tabs/ReceptionCustomerListTab.uvue
View file @
a80cc5e
<template>
<template>
<layout-root :page-vars="pageVars">
<view class="list-content-wrapper">
<view class="list-content-wrapper">
<!-- 横屏分栏时:子 Tab + 筛选区固定在列表上方,仅下方列表滚动,避免随滚动移出视区 -->
<!-- 横屏分栏时:子 Tab + 筛选区固定在列表上方,仅下方列表滚动,避免随滚动移出视区 -->
<view v-if="stickyHeader == true" class="list-header-fixed">
<view v-if="stickyHeader == true" class="list-header-fixed">
...
@@ -141,6 +142,7 @@
...
@@ -141,6 +142,7 @@
</list-item>
</list-item>
</list-view>
</list-view>
</view>
</view>
</layout-root>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
...
@@ -155,7 +157,7 @@ import {
...
@@ -155,7 +157,7 @@ import {
getReceptionPortraitListSubTabsConfig,
getReceptionPortraitListSubTabsConfig,
type ReceptionPortraitListSubTabsConfig,
type ReceptionPortraitListSubTabsConfig,
} from '../styles/portrait.uts'
} from '../styles/portrait.uts'
import pageVars from '../styles/index.vars'
const props = defineProps<{
const props = defineProps<{
/** 横屏分栏时为 true:子 Tab + 筛选区不参与纵向滚动,固定在列表区域顶部 */
/** 横屏分栏时为 true:子 Tab + 筛选区不参与纵向滚动,固定在列表区域顶部 */
stickyHeader?: boolean
stickyHeader?: boolean
...
@@ -219,7 +221,8 @@ const showReceptionEmpty = computed((): boolean => {
...
@@ -219,7 +221,8 @@ const showReceptionEmpty = computed((): boolean => {
})
})
</script>
</script>
<style>
<style scoped lang="scss">
@import "../styles/common.scss";
.list-content-wrapper {
.list-content-wrapper {
flex: 1;
flex: 1;
overflow: hidden;
overflow: hidden;
...
...
apps/uniappX/uniapp-x-tape/pages/receptionCenter/tabs/ReceptionDashboardTab.uvue
View file @
a80cc5e
<template>
<template>
<scroll-view class="dashboard-scroll-view" :scroll-y="true" :show-scrollbar="false">
<layout-root :page-vars="pageVars">
<!-- <scroll-view class="dashboard-scroll-view" :scroll-y="true" :show-scrollbar="false"> -->
<!-- <view class="test test-view">
<text class="test-orientation-text">hooks</text>
</view> -->
<view class="dashboard-content" :style="dashboardContentStyle">
<view class="dashboard-content" :style="dashboardContentStyle">
<view class="card-header" :style="dashboardCardHeaderStyle">
<view class="card-header" :style="dashboardCardHeaderStyle">
<view class="header-surface" :style="dashboardHeaderSurfaceStyle">
<view class="header-surface" :style="dashboardHeaderSurfaceStyle">
...
@@ -51,7 +55,8 @@
...
@@ -51,7 +55,8 @@
:metrics-visible="performanceMetricsVisible"
:metrics-visible="performanceMetricsVisible"
/>
/>
</view>
</view>
</scroll-view>
<!-- </scroll-view> -->
</layout-root>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
...
@@ -61,6 +66,7 @@ import CardOutputValue from '../cards/CardOutputValue.uvue'
...
@@ -61,6 +66,7 @@ import CardOutputValue from '../cards/CardOutputValue.uvue'
import CardMonthValue from '../cards/CardMonthValue.uvue'
import CardMonthValue from '../cards/CardMonthValue.uvue'
import type { CompareRow, OutputSummary } from '../types/reception-output-types.uts'
import type { CompareRow, OutputSummary } from '../types/reception-output-types.uts'
import { cssClassRef } from "@/services/adapter";
import { cssClassRef } from "@/services/adapter";
import pageVars from '../styles/index.vars'
// 导入样式变量
// 导入样式变量
import {
import {
getReceptionPortraitDashboardConfig,
getReceptionPortraitDashboardConfig,
...
@@ -243,7 +249,8 @@ const progressWidth = computed((): string => {
...
@@ -243,7 +249,8 @@ const progressWidth = computed((): string => {
})
})
</script>
</script>
<style>
<style scoped lang="scss">
@import "../styles/common.scss";
.dashboard-scroll-view {
.dashboard-scroll-view {
flex: 1;
flex: 1;
min-height: 0;
min-height: 0;
...
...
apps/uniappX/uniapp-x-tape/pages/receptionShell.uvue
deleted
100644 → 0
View file @
9754b52
<template>
<layout-root>
<view class="page-container reception-route-page">
<SceneShell ref="shellRef" :active-tab-index="1">
<view class="reception-route-body">
<ReceptionStack />
</view>
</SceneShell>
</view>
</layout-root>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, ref } from "vue";
import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import ReceptionStack from "@/components/HomeFrame/presets/ReceptionStack.uvue";
const shellRef = ref(null);
onShow(() => {
if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
.page-container {
width: 100%;
height: 100%;
}
.reception-route-body {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
position: relative;
}
</style>
apps/uniappX/uniapp-x-tape/pages/usedCar/components/UsedCarHomePanel.uvue
0 → 100644
View file @
a80cc5e
<template>
<view class="page-container used-car-home-in-tab">
<HomeFrame ref="homeRef"
:embed-in-tab-slot="true"
:show-tabbar="false"
:show-footer="true">
<template #home>
<view class="home-content">
<view class="header">
<text class="title">二手车场景</text>
<text class="subtitle">Used Car</text>
</view>
<view class="action-area">
<text class="status-text">二手车场景不支持开始接待跳转</text>
</view>
<view class="info-panel">
<text class="info-label">接待状态:</text>
<text class="info-value">{{ receptionStatusText }}</text>
</view>
</view>
</template>
</HomeFrame>
</view>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import { useReception } from "@/composables/useReception";
import { storage } from "@/utils/storage.uts";
const homeRef = ref(null);
const reception = useReception();
type RefWithValue = { value: number }
const receptionStatusText = computed((): string => {
const status = (reception as UTSJSONObject).receptionStatus as null | RefWithValue;
if (status != null && status.value == 0) {
return "未开始";
} else if (status != null && status.value == 1) {
return "接待中";
} else {
return "已完成";
}
});
onLoad((_options: OnLoadOptions) => {
uni.hideLoading();
});
onShow(() => {
const userInfo = storage.get("userInfo");
if (userInfo == null) {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
const userInfoObj = userInfo as UTSJSONObject;
const shopMerchantId = userInfoObj.shopMerchantId as null | string;
const shopMerchantName = userInfoObj.shopMerchantName as null | string;
if (shopMerchantId == null || shopMerchantId == "" || shopMerchantName == null || shopMerchantName == "") {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
if (homeRef.value != null) {
(homeRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
.page-container.used-car-home-in-tab {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.home-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
}
.header {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 48px;
}
.title {
font-size: 32px;
font-weight: 600;
color: #333;
margin-bottom: 8px;
}
.subtitle {
font-size: 16px;
color: #999;
}
.action-area {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 32px;
}
.status-text {
font-size: 14px;
color: #ff4747;
}
.info-panel {
display: flex;
flex-direction: row;
align-items: center;
}
.info-label {
font-size: 14px;
color: #666;
}
.info-value {
font-size: 14px;
color: #333;
font-weight: 500;
}
</style>
apps/uniappX/uniapp-x-tape/pages/usedCar/index.uvue
View file @
a80cc5e
<template>
<template>
<view class="usedcar-redirect"></view>
<layout-root>
<view class="page-container">
<HomeFrame ref="homeRef" :show-footer="true">
<template #home>
<view class="home-content">
<view class="header">
<text class="title">二手车场景</text>
<text class="subtitle">Used Car</text>
</view>
<view class="action-area">
<text class="status-text">二手车场景不支持开始接待跳转</text>
</view>
<view class="info-panel">
<text class="info-label">接待状态:</text>
<text class="info-value">{{ receptionStatusText }}</text>
</view>
</view>
</template>
</HomeFrame>
</view>
</layout-root>
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue";
onLoad(() => {
uni.switchTab({
import HomeFrame from "@/components/HomeFrame/index.uvue";
url: "/pages/index/index",
import { useReception } from "@/composables/useReception";
fail: (_err: any) => {
// import { onLoad, onShow } from '@dcloudio/uni-app'
uni.reLaunch({ url: "/pages/index/index" });
import { storage } from "@/utils/storage.uts";
const homeRef = ref(null);
const reception = useReception();
type RefWithValue = { value: number }
const receptionStatusText = computed((): string => {
const status = (reception as UTSJSONObject).receptionStatus as null | RefWithValue;
if (status != null && status.value == 0) {
return "未开始";
} else if (status != null && status.value == 1) {
return "接待中";
} else {
return "已完成";
}
});
onLoad((options: OnLoadOptions) => {
uni.hideLoading();
});
onShow(() => {
const userInfo = storage.get("userInfo");
if (userInfo == null) {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
const userInfoObj = userInfo as UTSJSONObject;
const shopMerchantId = userInfoObj.shopMerchantId as null | string;
const shopMerchantName = userInfoObj.shopMerchantName as null | string;
if (shopMerchantId == null || shopMerchantId == "" || shopMerchantName == null || shopMerchantName == "") {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
if (homeRef.value != null) {
(homeRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
}
});
});
});
</script>
</script>
<style scoped lang="scss">
<style scoped lang="scss">
.
page-container
{
.
usedcar-redirect
{
width: 100%;
width: 100%;
height: 100%;
height: 100%;
}
}
.home-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
}
.header {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 48px;
}
.title {
font-size: 32px;
font-weight: 600;
color: #333;
margin-bottom: 8px;
}
.subtitle {
font-size: 16px;
color: #999;
}
.action-area {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 32px;
}
.status-text {
font-size: 14px;
color: #ff4747;
}
.info-panel {
display: flex;
flex-direction: row;
align-items: center;
}
.info-label {
font-size: 14px;
color: #666;
}
.info-value {
font-size: 14px;
color: #333;
font-weight: 500;
}
</style>
</style>
apps/uniappX/uniapp-x-tape/utils/homeRoute.uts
0 → 100644
View file @
a80cc5e
/** 首页壳路径:场景内容由壳内按 userInfo.sceneType 渲染 */
export function resolveMainHomeUrl(): string {
return "/pages/index/index";
}
apps/uniappX/uniapp-x-tape/utils/tabBarShell.uts
0 → 100644
View file @
a80cc5e
/** tabBar 页:隐藏系统原生 tabBar,由 SceneShell + un-tabbar 负责展示与 switchTab */
export function hideNativeTabBar(): void {
uni.hideTabBar({
animation: false,
fail: (_err: any) => {
// 非 tab 页或未配置 tabBar 时可能失败,忽略
}
});
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment