Commit 0cf26e43 by Lin

feat(reception): 更新接待中心表单和列表样式以支持动态适配

- 为接待中心的表单和列表组件添加动态样式计算,提升在不同分辨率下的适应性
- 更新表单项的标签和输入框样式,确保一致性和可读性
- 增加骨架屏的高度和样式,优化加载体验
- 引入新的文本样式配置,增强用户界面的视觉效果
1 parent b016d58b
......@@ -7,9 +7,11 @@
:title="currentView == 'brand' ? '请选择车品牌' : '请选择车系'"
:z-index="dynamicZIndex"
@close="handleMessageBoxClose">
currentView是: {{currentView}}
<scroll-view class="select-box"
:show-scrollbar="false"
:style="{ maxHeight: windowHeight * 0.6 + 'px' }">
currentView: {{currentView}}
<!-- 品牌列表 -->
<view v-show="currentView == 'brand'" class="view-content">
<template v-for="(item, index) in carBrandList"
......@@ -264,6 +266,7 @@ function selectBrand(item: any, index: number): void {
// 从 API 获取车系数据
getCarBrandsListApi({ brandId: _brandId, childBrandId: _carId }).then(res => {
const typedRes = res as UTSArray<any>;
console.error("获取车系列表成功:", typedRes);
currentCarList.value = typedRes;
if (typedRes.length > 0) {
......@@ -320,7 +323,7 @@ function open(): void {
const childs = (e as UTSJSONObject).childs as UTSArray<Any>;
const _brandName = (e as UTSJSONObject).name as string;
const _brandId = (e as UTSJSONObject).id as number;
console.log(childs);
console.log("Brand childs:", childs);
if (childs.length > 0){
for (const child_ of childs){
const child = child_ as UTSJSONObject;
......
......@@ -7,28 +7,41 @@
<view class="form-add-wrap">
<view class="form-add-body">
<un-form :model="formData" labelWidth="80" labelAlign="left" borderBottom>
<un-form-item label="车主姓名" prop="ownerName">
<un-form-item prop="ownerName">
<template #label>
<text :style="formAddLabelTextStyle">车主姓名</text>
</template>
<un-input
v-model="formData['ownerName']"
border="none"
inputAlign="right"
placeholder="请输入车主姓名"
:fontSize="formAddInputFontSize"
:placeholderStyle="formAddPlaceholderStyle"
:maxlength="50"
></un-input>
</un-form-item>
<un-form-item label="车主电话" prop="ownerPhone">
<un-form-item prop="ownerPhone">
<template #label>
<text :style="formAddLabelTextStyle">车主电话</text>
</template>
<un-input
v-model="formData['ownerPhone']"
border="none"
type="tel"
inputAlign="right"
placeholder="请输入车主电话"
:fontSize="formAddInputFontSize"
:placeholderStyle="formAddPlaceholderStyle"
:maxlength="11"
></un-input>
</un-form-item>
<un-form-item label="品牌车型" prop="brandModel">
<un-form-item prop="brandModel">
<template #label>
<text :style="formAddLabelTextStyle">品牌车型</text>
</template>
<view class="form-add-link-cell" @click="brandCascaderShow = true">
<text
class="form-add-link-cell__value"
......@@ -39,7 +52,10 @@
<un-icon name="arrow-right" color="#a1a1a1"></un-icon>
</view>
</un-form-item>
<un-form-item label="接待场景" prop="receptionSceneName">
<un-form-item prop="receptionSceneName">
<template #label>
<text :style="formAddLabelTextStyle">接待场景</text>
</template>
<view class="form-add-link-cell" @click="sceneSelectShow = true">
<text
class="form-add-link-cell__value"
......@@ -51,7 +67,10 @@
</view>
</un-form-item>
<un-form-item label="到店日期" prop="arrivalDate">
<un-form-item prop="arrivalDate">
<template #label>
<text :style="formAddLabelTextStyle">到店日期</text>
</template>
<view class="form-add-link-cell" @click="onOpenDatePicker">
<text
class="form-add-link-cell__value"
......@@ -63,7 +82,10 @@
</view>
</un-form-item>
<un-form-item label="客户标签" prop="customerTagName">
<un-form-item prop="customerTagName">
<template #label>
<text :style="formAddLabelTextStyle">客户标签</text>
</template>
<view
class="form-add-link-cell"
@click="customerTagsSelectShow = true"
......@@ -82,10 +104,10 @@
</view>
<view class="form-add-footer">
<view class="btn cancel-btn" @click="handleClose">
<text class="btn-text btn-text-cancel">取消</text>
<text class="btn-text btn-text-cancel" :style="formAddBtnTextStyle">取消</text>
</view>
<view class="btn submit-btn" @click="handleSubmit">
<text class="btn-text btn-text-submit">提交</text>
<text class="btn-text btn-text-submit" :style="formAddBtnTextStyle">提交</text>
</view>
</view>
</view>
......@@ -130,14 +152,69 @@ import SenceSelect from './filters/SenceSelect.uvue'
import CustomerTags from './filters/CustomerTags.uvue'
import { saveVisitsInfo, updateVisitsInfo, findVisitsInfo } from '@/api/receiption.uts'
import { storage } from '@/utils/storage.uts'
import { cssClassRef } from '@/services/adapter'
import {
getReceptionPortraitFormAddTextConfig,
type ReceptionPortraitFormAddTextConfig,
} from './styles/portrait.uts'
const phoneRex = /^1[3-9]\d{9}$/
const portraitFormAddText = computed((): ReceptionPortraitFormAddTextConfig | null => {
return getReceptionPortraitFormAddTextConfig(cssClassRef.value)
})
function formAddTextPick(mapper: (c: ReceptionPortraitFormAddTextConfig) => UTSJSONObject): UTSJSONObject {
const c = portraitFormAddText.value
if (c == null) {
return {} as UTSJSONObject
}
return mapper(c)
}
const formAddCellValueTextStyle = computed((): UTSJSONObject => {
return formAddTextPick((c) => {
return { fontSize: c.cellValueFontSize } as UTSJSONObject
})
})
const formAddBtnTextStyle = computed((): UTSJSONObject => {
return formAddTextPick((c) => {
return { fontSize: c.btnTextFontSize } as UTSJSONObject
})
})
const formAddLabelStyle = computed((): UTSJSONObject => {
return formAddTextPick((c) => {
return { fontSize: c.labelFontSize } as UTSJSONObject
})
})
const formAddLabelTextStyle = computed((): UTSJSONObject => {
return formAddLabelStyle.value
})
const formAddInputFontSize = computed((): number => {
const c = portraitFormAddText.value
if (c == null) {
return 14
}
return c.inputFontSize
})
const formAddPlaceholderStyle = computed((): UTSJSONObject => {
return formAddTextPick((c) => {
return { fontSize: c.placeholderFontSize } as UTSJSONObject
})
})
function getCellValueStyle(hasValue: boolean): string {
// 统一控制:label 左、value 右(这里只管 value 的对齐与颜色)
const cfg = portraitFormAddText.value
const fs = cfg != null ? cfg.cellValueFontSize : '14px'
return hasValue
? 'color: #1e293b; font-size: 14px; text-align: right;margin-right: 6px;'
: 'color:rgb(151, 150, 150); font-size: 14px; text-align: right;margin-right: 6px;'
? `color: #1e293b; font-size: ${fs}; text-align: right;margin-right: 6px;`
: `color:rgb(151, 150, 150); font-size: ${fs}; text-align: right;margin-right: 6px;`
}
const props = withDefaults(
......
......@@ -16,12 +16,12 @@
<view class="form-detail-body">
<view class="form-section">
<view class="form-section-header">
<text class="form-section-title">车主信息</text>
<text class="form-section-title" :style="formSectionTitleTextStyle">车主信息</text>
</view>
<view class="form-section-body">
<view v-for="item in ownerInfoRows" :key="item.key" class="form-row">
<text class="form-label">{{ item.label }}</text>
<text class="form-value">{{ item.value }}</text>
<text class="form-label" :style="formLabelTextStyle">{{ item.label }}</text>
<text class="form-value" :style="formValueTextStyle">{{ item.value }}</text>
</view>
</view>
</view>
......@@ -30,7 +30,7 @@
<list-item class="form-detail-li form-detail-li-goods" :type="1">
<view class="goods-section-wrap">
<view class="form-detail-goods-head">
<text class="form-detail-goods-title">商品套餐</text>
<text class="form-detail-goods-title" :style="goodsTitleTextStyle">商品套餐</text>
</view>
<CustomEmpty
v-if="goodsRowPairs.length == 0"
......@@ -50,9 +50,9 @@
<image class="goods-image" :src="item.image" mode="aspectFill"></image>
</view>
<view class="goods-info">
<text class="goods-name">{{ item.name }}</text>
<text class="goods-meta">业务场景:{{ item.scene }}</text>
<text class="goods-meta">客户标签:{{ item.customerTag }}</text>
<text class="goods-name" :style="goodsNameTextStyle">{{ item.name }}</text>
<text class="goods-meta" :style="goodsMetaTextStyle">业务场景:{{ item.scene }}</text>
<text class="goods-meta" :style="goodsMetaTextStyle">客户标签:{{ item.customerTag }}</text>
</view>
</view>
</view>
......@@ -70,6 +70,11 @@ import { findVisitsInfo } from '@/api/receiption.uts'
import { getMaterialResponsePage } from '@/api/customer-api.uts'
import { storage } from '@/utils/storage.uts'
import CustomEmpty from '@/components/CustomEmpty/index.uvue'
import { cssClassRef } from '@/services/adapter'
import {
getReceptionPortraitFormDetailTextConfig,
type ReceptionPortraitFormDetailTextConfig,
} from '../styles/portrait.uts'
const GOODS_PLACEHOLDER_IMAGE = 'https://dummyimage.com/320x200/f3f6ff/94a3b8.png&text=%E6%9A%82%E6%97%A0%E5%9B%BE'
......@@ -81,6 +86,57 @@ type GoodsCardItem = {
customerTag: string
}
const portraitFormDetailText = computed((): ReceptionPortraitFormDetailTextConfig | null => {
return getReceptionPortraitFormDetailTextConfig(cssClassRef.value)
})
function formDetailTextPick(mapper: (c: ReceptionPortraitFormDetailTextConfig) => UTSJSONObject): UTSJSONObject {
const c = portraitFormDetailText.value
if (c == null) {
return {} as UTSJSONObject
}
return mapper(c)
}
const formSectionTitleTextStyle = computed((): UTSJSONObject => {
return formDetailTextPick((c) => {
return { fontSize: c.sectionTitleFontSize } as UTSJSONObject
})
})
const formLabelTextStyle = computed((): UTSJSONObject => {
return formDetailTextPick((c) => {
return { fontSize: c.labelFontSize } as UTSJSONObject
})
})
const formValueTextStyle = computed((): UTSJSONObject => {
return formDetailTextPick((c) => {
return { fontSize: c.valueFontSize } as UTSJSONObject
})
})
const goodsTitleTextStyle = computed((): UTSJSONObject => {
return formDetailTextPick((c) => {
return { fontSize: c.goodsTitleFontSize } as UTSJSONObject
})
})
const goodsNameTextStyle = computed((): UTSJSONObject => {
return formDetailTextPick((c) => {
return { fontSize: c.goodsNameFontSize } as UTSJSONObject
})
})
const goodsMetaTextStyle = computed((): UTSJSONObject => {
return formDetailTextPick((c) => {
return {
fontSize: c.goodsMetaFontSize,
lineHeight: c.goodsMetaLineHeight,
} as UTSJSONObject
})
})
/** 顶部安全区占位(px):与系统状态栏/刘海对齐,随窗口信息刷新 */
const receptionPageInsetTopPx = ref(0)
......
......@@ -80,7 +80,7 @@ const props = defineProps<{
}>()
const loading = computed<boolean>(() => props.loading === true)
const skeletonCardCount = 4
const skeletonCardCount = 6
/** 是否横屏(w > h)。uni-app x UTS 当前编译目标不支持 onWindowResize,使用轮询响应旋转 */
const isLandscape = ref(false)
......@@ -361,11 +361,14 @@ function onEntryCardMaskDelete(item: UTSJSONObject): void {
padding: 16px;
border-radius: 16px;
margin-bottom: 12px;
box-sizing: border-box;
}
.list-card-entry {
position: relative;
overflow: hidden;
/* 骨架屏与真实卡片保持一致的高度,避免 loading 时卡片“塌陷” */
min-height: 172px;
}
.list-card-entry-landscape {
......
......@@ -68,7 +68,7 @@ const props = defineProps<{
}>()
const loading = computed<boolean>(() => props.loading === true)
const skeletonCardCount = 4
const skeletonCardCount = 6
/** 是否横屏(w > h)。uni-app x UTS 当前编译目标不支持 onWindowResize,使用轮询响应旋转 */
const isLandscape = ref(false)
......@@ -334,6 +334,9 @@ function onCardClick(item: UTSJSONObject): void {
padding: 16px;
border-radius: 16px;
margin-bottom: 12px;
box-sizing: border-box;
/* 骨架屏与真实卡片保持一致的高度,避免 loading 时卡片“塌陷” */
min-height: 200px;
}
.list-card-landscape {
......
......@@ -297,6 +297,123 @@ export function getReceptionPortraitListTextConfig(resolutionKey: string): null
}
/**
* 768×1174 竖屏下客户档案详情页(FormDetail)文字字号覆盖(其余分辨率走 scss 默认值)
*/
export type ReceptionPortraitFormDetailTextConfig = {
sectionTitleFontSize: string
labelFontSize: string
valueFontSize: string
goodsTitleFontSize: string
goodsNameFontSize: string
goodsMetaFontSize: string
goodsMetaLineHeight: string
}
export const RECEPTION_PORTRAIT_FORM_DETAIL_TEXT_768x1174: ReceptionPortraitFormDetailTextConfig = {
sectionTitleFontSize: '22px',
labelFontSize: '18px',
valueFontSize: '18px',
goodsTitleFontSize: '22px',
goodsNameFontSize: '18px',
goodsMetaFontSize: '16px',
goodsMetaLineHeight: '22px',
}
export function getReceptionPortraitFormDetailTextConfig(resolutionKey: string): null | ReceptionPortraitFormDetailTextConfig {
if (resolutionKey.indexOf('layout-portrait-768x1174') >= 0) {
return RECEPTION_PORTRAIT_FORM_DETAIL_TEXT_768x1174
}
return null
}
/**
* 768×1174 竖屏下客户档案新增/编辑页(FormAdd)文字字号覆盖(其余分辨率走 scss 默认值)
* - 仅覆盖本页自绘的 value / footer 按钮文案
* - un-form-item 的 label / un-input 内部字号如需覆盖,应在对应组件内做 props 或主题配置
*/
export type ReceptionPortraitFormAddTextConfig = {
labelFontSize: string
inputFontSize: number
placeholderFontSize: string
cellValueFontSize: string
btnTextFontSize: string
}
export const RECEPTION_PORTRAIT_FORM_ADD_TEXT_768x1174: ReceptionPortraitFormAddTextConfig = {
labelFontSize: '18px',
inputFontSize: 18,
placeholderFontSize: '18px',
cellValueFontSize: '18px',
btnTextFontSize: '18px',
}
export function getReceptionPortraitFormAddTextConfig(resolutionKey: string): null | ReceptionPortraitFormAddTextConfig {
if (resolutionKey.indexOf('layout-portrait-768x1174') >= 0) {
return RECEPTION_PORTRAIT_FORM_ADD_TEXT_768x1174
}
return null
}
/**
* 768×1174 竖屏下接待详情页(receptionDetail)文字字号覆盖(其余分辨率走 scss 默认值)
*/
export type ReceptionPortraitReceptionDetailTextConfig = {
customerNameFontSize: string
customerPhoneFontSize: string
tagTextFontSize: string
scoreNumFontSize: string
statusTextFontSize: string
riskFallbackFontSize: string
actionTextFontSize: string
playTimeFontSize: string
tabTextFontSize: string
tabValueFontSize: string
analysisTitleTextFontSize: string
analysisTitleValueFontSize: string
matchBtnTextFontSize: string
bubbleTimeFontSize: string
bubbleTextFontSize: string
suggestionTitleFontSize: string
analysisNothingTextFontSize: string
aiTitleTextFontSize: string
aiNothingTextFontSize: string
/** 富文本话术推荐(rich-text nodes)内联字号 */
scriptRecFontSize: string
scriptRecLineHeight: string
}
export const RECEPTION_PORTRAIT_RECEPTION_DETAIL_TEXT_768x1174: ReceptionPortraitReceptionDetailTextConfig = {
customerNameFontSize: '24px',
customerPhoneFontSize: '16px',
tagTextFontSize: '12px',
scoreNumFontSize: '28px',
statusTextFontSize: '12px',
riskFallbackFontSize: '12px',
actionTextFontSize: '16px',
playTimeFontSize: '16px',
tabTextFontSize: '16px',
tabValueFontSize: '16px',
analysisTitleTextFontSize: '18px',
analysisTitleValueFontSize: '18px',
matchBtnTextFontSize: '14px',
bubbleTimeFontSize: '14px',
bubbleTextFontSize: '16px',
suggestionTitleFontSize: '16px',
analysisNothingTextFontSize: '16px',
aiTitleTextFontSize: '18px',
aiNothingTextFontSize: '16px',
scriptRecFontSize: '16px',
scriptRecLineHeight: '1.6',
}
export function getReceptionPortraitReceptionDetailTextConfig(resolutionKey: string): null | ReceptionPortraitReceptionDetailTextConfig {
if (resolutionKey.indexOf('layout-portrait-768x1174') >= 0) {
return RECEPTION_PORTRAIT_RECEPTION_DETAIL_TEXT_768x1174
}
return null
}
/**
* 768×1174:客户列表页顶栏「客户录入 / 接待复盘」双行子 Tab 字号(与主 Tab 档位接近、仍弱一级)
*/
export type ReceptionPortraitListSubTabsConfig = {
......
// 参考链接 https://doc.dcloud.net.cn/uni-app-x/tutorial/ls-plugin.html#setting
{
"targets": [
"APP-ANDROID"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!