Commit 21bf162f by Lin

refactor(接待中心): 移除冗余组件并优化表单样式

- 删除 ReceptionCenter 组件,整合其功能至接待中心页面
- 优化 FormAdd 组件的表单项样式,统一对齐方式和交互体验
- 调整 CustomerTags 组件的样式,避免布局冲突
- 清理不必要的代码和注释,提升代码可读性
1 parent fe62a028
......@@ -6,11 +6,12 @@
<view class="reception-navbar-spacer"></view>
<view class="form-add-wrap">
<view class="form-add-body">
<un-form :model="formData" labelWidth="80" borderBottom>
<un-form :model="formData" labelWidth="80" labelAlign="left" borderBottom>
<un-form-item label="车主姓名" prop="ownerName">
<un-input
v-model="formData['ownerName']"
border="none"
inputAlign="right"
placeholder="请输入车主姓名"
:maxlength="50"
></un-input>
......@@ -21,53 +22,61 @@
v-model="formData['ownerPhone']"
border="none"
type="tel"
inputAlign="right"
placeholder="请输入车主电话"
:maxlength="11"
></un-input>
</un-form-item>
<un-form-item label="品牌车型" prop="brandModel">
<un-cell
:value="formData.brandModel !== '' ? formData.brandModel : '请选择品牌车型'"
isLink
:border="false"
size="large"
@click="brandCascaderShow = true"
:valueStyle="formData.brandModel !== '' ? 'color: #1e293b; font-size: 15px;' : 'color: #94a3b8; font-size: 15px;'"
></un-cell>
<view class="form-add-link-cell" @click="brandCascaderShow = true">
<text
class="form-add-link-cell__value"
:style="getCellValueStyle(formData.brandModel !== '')"
>
{{ formData.brandModel !== '' ? formData.brandModel : '请选择品牌车型' }}
</text>
<un-icon name="arrow-right" color="#a1a1a1"></un-icon>
</view>
</un-form-item>
<un-form-item label="接待场景" prop="receptionSceneName">
<un-cell
:value="formData.receptionSceneName !== '' ? formData.receptionSceneName : '请选择接待场景'"
isLink
size="large"
:border="false"
@click="sceneSelectShow = true"
:valueStyle="formData.receptionSceneName !== '' ? 'color: #1e293b; font-size: 15px;' : 'color: #94a3b8; font-size: 15px;'"
></un-cell>
<view class="form-add-link-cell" @click="sceneSelectShow = true">
<text
class="form-add-link-cell__value"
:style="getCellValueStyle(formData.receptionSceneName !== '')"
>
{{ formData.receptionSceneName !== '' ? formData.receptionSceneName : '请选择接待场景' }}
</text>
<un-icon name="arrow-right" color="#a1a1a1"></un-icon>
</view>
</un-form-item>
<un-form-item label="到店日期" prop="arrivalDate">
<un-cell
:value="formData.arrivalDate !== '' ? formData.arrivalDate : '请选择到店日期'"
isLink
size="large"
:border="false"
@click="onOpenDatePicker"
:valueStyle="formData.arrivalDate !== '' ? 'color: #1e293b; font-size: 15px;' : 'color: #94a3b8; font-size: 15px;'"
></un-cell>
<view class="form-add-link-cell" @click="onOpenDatePicker">
<text
class="form-add-link-cell__value"
:style="getCellValueStyle(formData.arrivalDate !== '')"
>
{{ formData.arrivalDate !== '' ? formData.arrivalDate : '请选择到店日期' }}
</text>
<un-icon name="arrow-right" color="#a1a1a1"></un-icon>
</view>
</un-form-item>
<un-form-item label="客户标签" prop="customerTagName">
<un-cell
:value="formData.customerTagName !== '' ? formData.customerTagName : '请选择客户标签'"
isLink
size="large"
:border="false"
<view
class="form-add-link-cell"
@click="customerTagsSelectShow = true"
:valueStyle="formData.customerTagName !== '' ? 'color: #1e293b; font-size: 15px;' : 'color: #94a3b8; font-size: 15px;'"
:style="{ position: 'relative', zIndex: 10 }"
></un-cell>
>
<text
class="form-add-link-cell__value"
:style="getCellValueStyle(formData.customerTagName !== '')"
>
{{ formData.customerTagName !== '' ? formData.customerTagName : '请选择客户标签' }}
</text>
<un-icon name="arrow-right" color="#a1a1a1"></un-icon>
</view>
</un-form-item>
</un-form>
</view>
......@@ -124,6 +133,13 @@ import { storage } from '@/utils/storage.uts'
const phoneRex = /^1[3-9]\d{9}$/
function getCellValueStyle(hasValue: boolean): string {
// 统一控制:label 左、value 右(这里只管 value 的对齐与颜色)
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;'
}
const props = withDefaults(
defineProps<{
show?: boolean
......@@ -564,17 +580,18 @@ async function handleSubmit(): Promise<void> {
const body = res as UTSJSONObject
const code = fieldStr(body, 'code')
console.log('saveVisitsInfo 保存更新成功code', code)
if (code !== '0') {
// 失败直接提示后结束
if (code != '0') {
const msg = fieldStr(body, 'message')
uni.showToast({ title: msg !== '' ? msg : '保存失败', icon: 'none' })
return
}
// 成功:处理重复记录提示(后端可能用 data 标记归类结果)
const flag = fieldStr(body, 'data')
if (flag === '2') {
// 重复记录处理
await new Promise<void>((resolve) => {
uni.showModal({
content: '存在与该手机号相同的接待记录,系统将自动归类到已接待',
......@@ -588,11 +605,8 @@ async function handleSubmit(): Promise<void> {
// 提父级刷新并关闭
uni.showToast({ title: '提交成功', icon: 'success' })
resetForm()
emit('saved')
emit('close')
handleClose();
uni.$emit('refresh-reception-list')
uni.navigateBack()
} catch (_e) {
uni.showToast({ title: '网络异常,请重试', icon: 'none' })
......@@ -708,4 +722,24 @@ onLoad((options: UTSJSONObject) => {
.submit-btn .btn-text {
color: #ffffff;
}
.form-add-link-cell {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
}
.form-add-link-cell__value {
flex: 1;
}
.form-add-link-cell__arrow {
margin-left: 6px;
color: #cbd5e1;
font-size: 14px;
text-align: right;
}
</style>
......@@ -89,9 +89,6 @@
@confirm="onReviewPickerConfirm"
/>
<!-- 客户档案详情全屏层 -->
<view v-if="showReceptionDetail" class="form-detail-inner">
<!-- 客户录入列表 → 客户档案(FormDetail) -->
<view v-if="showCustomerFormDetail" class="form-detail-inner">
<FormDetail
......
......@@ -561,10 +561,12 @@
</script>
<style scoped lang="scss">
/* 仅作弹层容器:勿 flex:1,否则会与表单区(如 FormAdd 的 form-add-wrap)瓜分纵向空间并引发点击穿透/叠层问题 */
.customer-tags-root {
width: 100%;
flex: 1;
min-height: 0;
height: 0;
flex-grow: 0;
flex-shrink: 0;
display: flex;
flex-direction: column;
/* Android:滚动父级勿用 overflow:hidden,易导致子 list-view 手势异常(FormDetail 同注) */
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!