接待 线索类型的客户逻辑

This commit is contained in:
zhonghua.li
2026-05-02 20:57:28 +08:00
parent 382132c0d9
commit f4341af66e
3 changed files with 194 additions and 3 deletions

View File

@@ -81,6 +81,11 @@ import TagManagementPanel from "./tag_management_panel.vue";
incomingTab: {
type: String,
default: ''
},
/** 从客户列表等入口写入本地缓存的一次性预填(不含销售字段,由 loadCurrentUserInfo 填充) */
receptionPrefill: {
type: Object,
default: null
}
},
// #ifdef APP
@@ -395,6 +400,36 @@ import TagManagementPanel from "./tag_management_panel.vue";
};
// 重新加载当前登录用户信息
this.loadCurrentUserInfo();
this.applyReceptionPrefillFromProp();
},
applyReceptionPrefillFromProp() {
const p = this.receptionPrefill;
if (!p || typeof p !== 'object') {
return;
}
const allowed = [
'id',
'customerName',
'contact',
'customerSource',
'gender',
'age',
'dealershipId',
'dealershipName',
'intendedModel',
'infoCard',
'remark',
'detailedAddress',
'recordingCount',
'contactCount'
];
const slice = {};
allowed.forEach((k) => {
if (Object.prototype.hasOwnProperty.call(p, k)) {
slice[k] = p[k];
}
});
this.receptionForm = { ...this.receptionForm, ...slice };
},
onReceptionCancel() {
// 组件内部已处理取消逻辑,这里只需要重置表单数据

View File

@@ -1,10 +1,13 @@
<template>
<furniture-reception-impl :incomingTab="incomingTab" />
<furniture-reception-impl :incomingTab="incomingTab" :receptionPrefill="receptionPrefill" />
</template>
<script>
import FurnitureReceptionImpl from './furniture_reception-impl.vue';
/** 与 CustomerList 写入的 key 一致:客户管理「准备接待」预填开始接待表单 */
const RECEPTION_FORM_PREFILL_KEY = 'workbench-reception-form-prefill';
export default {
name: 'FurnitureReceptionEntry',
components: {
@@ -13,12 +16,31 @@ export default {
data() {
return {
incomingTab: '',
receptionPrefill: null,
};
},
onLoad(options = {}) {
const allowed = ['status', 'reception', 'tag'];
const raw = options.tab != null ? String(options.tab) : '';
this.incomingTab = allowed.includes(raw) ? raw : 'reception';
try {
const rawPrefill = uni.getStorageSync(RECEPTION_FORM_PREFILL_KEY);
if (!rawPrefill) {
return;
}
try {
const parsed = typeof rawPrefill === 'string' ? JSON.parse(rawPrefill) : rawPrefill;
if (parsed && typeof parsed === 'object') {
this.receptionPrefill = parsed;
}
} catch (parseErr) {
console.warn('[FurnitureReceptionEntry] 接待表单预填 JSON 无效:', parseErr);
} finally {
uni.removeStorageSync(RECEPTION_FORM_PREFILL_KEY);
}
} catch (e) {
console.warn('[FurnitureReceptionEntry] 读取接待表单预填失败:', e);
}
},
};
</script>