家居场景销售接待

This commit is contained in:
zhonghua1
2026-01-10 11:12:23 +08:00
parent be6fa3ef28
commit 03c0fe8375
13 changed files with 427 additions and 196 deletions

View File

@@ -76,3 +76,5 @@

View File

@@ -76,3 +76,5 @@

View File

@@ -76,3 +76,5 @@

View File

@@ -1,7 +1,7 @@
<template> <template>
<view class="customer-list-container"> <view class="customer-list-container">
<view class="service-status-toolbar"> <view class="service-status-toolbar">
<text class="toolbar-total">共{{ list.length }}条</text> <text class="toolbar-total">共{{ customerListTotal || list.length }}条</text>
<input <input
class="toolbar-input" class="toolbar-input"
v-model="salesName" v-model="salesName"
@@ -61,30 +61,198 @@
</template> </template>
<script> <script>
import { getApiUrl } from '@/common/config.js';
export default { export default {
name: 'CustomerList', name: 'CustomerList',
props: { props: {},
list: {
type: Array,
default: () => []
}
},
data() { data() {
return { return {
salesName: '', salesName: '',
customerName: '' customerName: '',
customerList: [],
customerListTotal: 0,
customerListPage: {
current: 1,
size: 10
} }
}
},
computed: {
list() {
return this.customerList;
}
},
mounted() {
// 组件挂载时自动加载数据
this.loadCustomerList();
}, },
methods: { methods: {
onInputChange() { onInputChange() {
// 输入框变化时,可以在这里添加实时搜索逻辑(如果需要) // 输入框变化时,可以在这里添加实时搜索逻辑(如果需要)
}, },
handleRefresh() { handleRefresh() {
// 触发刷新事件,并传递查询参数 // 刷新客户列表
this.$emit('filterClick', { this.refreshCustomerList({
salesName: this.salesName.trim(), salesName: this.salesName.trim(),
customerName: this.customerName.trim() customerName: this.customerName.trim()
}); });
},
refreshCustomerList(filterParams = {}) {
// 重置分页到第一页
this.customerListPage.current = 1;
// 重新加载数据,传递查询参数
this.loadCustomerList(filterParams);
},
// 加载客户列表
async loadCustomerList(params = {}) {
try {
// 构建查询参数对象(后端使用 @RequestParam,参数需要作为 URL 查询参数传递)
const queryParams = {
current: this.customerListPage.current,
size: this.customerListPage.size
};
// 添加查询参数:客户姓名、所属销售姓名、销售电话、联系方式
const trimmedCustomerName = params.customerName?.trim();
const trimmedSalesName = params.salesName?.trim();
const trimmedSalesPhone = params.salesPhone?.trim();
const trimmedContact = params.contact?.trim();
if (trimmedCustomerName) {
queryParams.customerName = trimmedCustomerName;
}
if (trimmedSalesName) {
queryParams.salesName = trimmedSalesName;
}
if (trimmedSalesPhone) {
queryParams.salesPhone = trimmedSalesPhone;
}
if (trimmedContact) {
queryParams.contact = trimmedContact;
}
// 将参数转换为 URL 查询字符串(因为后端使用 @RequestParam)
const queryString = Object.keys(queryParams)
.filter(key => queryParams[key] !== null && queryParams[key] !== undefined && queryParams[key] !== '')
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(queryParams[key])}`)
.join('&');
// 调试:打印请求参数
console.log('客户列表查询参数:', JSON.stringify(queryParams));
console.log('查询字符串:', queryString);
// 后端使用 @GetMapping 和 @RequestParam,参数需要作为 URL 查询参数传递
const baseUrl = getApiUrl('/api/customerManagement/list');
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
// 获取认证信息
let tenantId = '';
let token = '';
try {
tenantId = uni.getStorageSync('backend-tenant-id') || '';
token = uni.getStorageSync('backend-token') || '';
} catch (e) {
console.error('获取认证信息失败:', e);
}
// 构建请求头
const headers = {
'Content-Type': 'application/json'
};
if (token) {
headers['Authorization'] = `Bearer ${token}`;
}
if (tenantId) {
headers['X-Tenant-Id'] = tenantId;
}
const res = await uni.request({
url,
method: 'GET',
header: headers,
timeout: 10000
});
if (res.statusCode === 200 && res.data && res.data.success) {
// 转换后端客户数据为显示格式
const customerRecords = res.data.data || [];
// 将 CustomerManagement 数据映射为显示格式
const mappedList = customerRecords.map(item => {
// 格式化创建时间
let formattedTime = '';
if (item.createTime) {
const date = new Date(item.createTime);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
formattedTime = `${year}-${month}-${day}`;
}
// 构建标签数组(根据业务需求可以从不同字段提取)
const tags = [];
if (item.remark) {
// 从备注中提取标签信息
if (item.remark.includes('优惠') || item.remark.includes('活动')) {
tags.push({ text: '关注优惠活动', color: 'orange' });
}
if (item.remark.includes('颜色') || item.remark.includes('搭配')) {
tags.push({ text: '关注颜色搭配', color: 'orange' });
}
}
// 根据录音条数或联系次数判断意向程度
let intent = '中';
const recordingCount = item.recordingCount || 0;
const contactCount = item.contactCount || 0;
if (recordingCount > 3 || contactCount > 5) {
intent = '高';
}
return {
name: item.customerName || '',
intent: intent,
serviceStaff: item.salesName || '',
serviceCount: item.contactCount || item.recordingCount || 0,
lastService: formattedTime,
lastServiceTime: item.updateTime || item.createTime,
tags: tags,
phone: item.contact || item.salesPhone || '',
budget: item.intendedModel || '', // 意向车型作为预算信息
// 保留原始数据字段,方便后续使用
rawData: item
};
});
// 按更新时间倒序排序
mappedList.sort((a, b) => {
if (!a.lastServiceTime) return 1;
if (!b.lastServiceTime) return -1;
return new Date(b.lastServiceTime) - new Date(a.lastServiceTime);
});
// 分页:第一页或刷新时重置,其他情况追加
if (this.customerListPage.current === 1) {
this.customerList = mappedList;
} else {
this.customerList = this.customerList.concat(mappedList);
}
this.customerListTotal = res.data.total || mappedList.length;
} else {
uni.showToast({
title: res.data.message || '获取客户列表失败',
icon: 'none'
});
}
} catch (error) {
console.error('获取客户列表失败:', error);
uni.showToast({
title: `获取客户列表失败: ${error.errMsg || error.message || '未知错误'}`,
icon: 'none',
duration: 3000
});
}
} }
} }
} }

View File

@@ -45,9 +45,7 @@
<!-- 客户列表 --> <!-- 客户列表 -->
<CustomerList <CustomerList
v-if="activeTab === 'customer'" v-if="activeTab === 'customer'"
:list="customerList" @itemClick="viewCustomerDetail" />
@itemClick="viewCustomerDetail"
@filterClick="refreshCustomerList" />
</view> </view>
<!-- 客户档案弹窗 --> <!-- 客户档案弹窗 -->
@@ -474,24 +472,7 @@
currentAudioUrl: null, // 当前音频URL(用于清理Blob URL) currentAudioUrl: null, // 当前音频URL(用于清理Blob URL)
showTextModal: false, // 是否显示文本内容弹框 showTextModal: false, // 是否显示文本内容弹框
currentRecordingText: '', // 当前显示的录音文本内容 currentRecordingText: '', // 当前显示的录音文本内容
transcribingIds: [], // 正在转文本的录音ID列表 transcribingIds: [] // 正在转文本的录音ID列表
customerList: [
{
name: '李女士',
intent: '高',
serviceStaff: '三多',
serviceCount: 3,
lastService: '2025-09-10',
tags: [
{ text: '关注优惠活动', color: 'orange' },
{ text: '关注颜色搭配', color: 'orange' },
{ text: '夫妻两一起来', color: 'orange' },
{ text: '新房装修', color: 'blue' },
{ text: '客厅,卧室', color: 'blue' }
],
phone: '185****3677'
}
]
} }
}, },
computed: { computed: {
@@ -502,7 +483,10 @@
} }
}, },
onLoad() { onLoad() {
// 加载服务记录列表
if (this.activeTab === 'service') {
this.loadServiceList(); this.loadServiceList();
}
}, },
onUnload() { onUnload() {
// 组件销毁时,清理音频播放器 // 组件销毁时,清理音频播放器
@@ -538,6 +522,7 @@
if (tab === 'service' && this.serviceList.length === 0) { if (tab === 'service' && this.serviceList.length === 0) {
this.loadServiceList(); this.loadServiceList();
} }
// 客户列表数据由 CustomerList 组件自己管理,不需要在这里加载
}, },
// 刷新服务记录列表 // 刷新服务记录列表
refreshServiceList(filterParams = {}) { refreshServiceList(filterParams = {}) {
@@ -546,11 +531,6 @@
// 重新加载数据,传递查询参数 // 重新加载数据,传递查询参数
this.loadServiceList(filterParams); this.loadServiceList(filterParams);
}, },
refreshCustomerList(filterParams = {}) {
// 客户列表刷新方法(可以根据需要实现搜索逻辑)
console.log('客户列表刷新', filterParams);
// TODO: 实现客户列表的搜索和刷新逻辑
},
// 服务记录列表到底部加载更多 // 服务记录列表到底部加载更多
onServiceListReachBottom() { onServiceListReachBottom() {
// 如果已经加载全部数据,则不再请求 // 如果已经加载全部数据,则不再请求
@@ -2326,7 +2306,7 @@
duration: 3000 duration: 3000
}); });
} }
}, }
} }
} }
</script> </script>

View File

@@ -28,8 +28,9 @@
placeholder-style="color: #9ca3af" placeholder-style="color: #9ca3af"
/> />
</view> </view>
<view class="form-item customer-source-select-wrapper"> <view class="form-item">
<text class="form-item__label">客户来源</text> <text class="form-item__label">客户来源</text>
<view class="customer-source-select-wrapper">
<view <view
class="customer-source-select" class="customer-source-select"
@click.stop="toggleCustomerSourceDropdown" @click.stop="toggleCustomerSourceDropdown"
@@ -58,6 +59,7 @@
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="form-item"> <view class="form-item">
<text class="form-item__label">门店名称</text> <text class="form-item__label">门店名称</text>
<input <input
@@ -123,18 +125,27 @@
/> />
</view> </view>
</view> </view>
</scroll-view>
<view class="form-actions form-actions--triple"> <view class="form-actions form-actions--triple">
<view class="form-btn form-btn--cancel" @click="handleCancel"> <view class="form-btn form-btn--cancel" @click="handleCancel">
<view class="form-btn__icon-circle">
<uni-icons type="close" size="16" color="#007AFF"></uni-icons>
</view>
<text class="form-btn__text">取消</text> <text class="form-btn__text">取消</text>
</view> </view>
<view class="form-btn form-btn--save" @click="handleSave('save')"> <view class="form-btn form-btn--save" @click="handleSave('save')">
<view class="form-btn__icon-circle">
<uni-icons type="checkmarkempty" size="16" color="#007AFF"></uni-icons>
</view>
<text class="form-btn__text">保存</text> <text class="form-btn__text">保存</text>
</view> </view>
<view class="form-btn form-btn--start" @click="handleSave('start')"> <view class="form-btn form-btn--start" @click="handleSave('start')">
<view class="form-btn__icon-circle">
<uni-icons type="checkmarkempty" size="16" color="#007AFF"></uni-icons>
</view>
<text class="form-btn__text">开始接待</text> <text class="form-btn__text">开始接待</text>
</view> </view>
</view> </view>
</scroll-view>
<!-- 遮罩层,点击关闭下拉框 --> <!-- 遮罩层,点击关闭下拉框 -->
<view <view
v-if="showCustomerSourceDropdown" v-if="showCustomerSourceDropdown"
@@ -490,14 +501,17 @@ export default {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
z-index: 1; z-index: 1;
display: flex;
flex-direction: column;
} }
.reception-form { .reception-form {
flex: 1;
width: 100%; width: 100%;
height: 100%; padding: 24rpx 16rpx 0 16rpx;
padding: 24rpx 16rpx 0 16rpx; /* 顶部24rpx间距(与列表项间距一致),底部0 */
box-sizing: border-box; box-sizing: border-box;
background-color: #F5F5F5; background-color: #F5F5F5;
overflow-y: auto;
} }
.form-card { .form-card {
@@ -510,10 +524,18 @@ export default {
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
.form-card .form-item:last-child {
margin-bottom: 0;
}
.form-item { .form-item {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 32rpx; margin-bottom: 32rpx;
min-height: 88rpx;
box-sizing: border-box;
width: 100%;
flex-wrap: nowrap;
} }
/* 对于包含 textarea 的表单项,label 顶部对齐 */ /* 对于包含 textarea 的表单项,label 顶部对齐 */
@@ -525,31 +547,33 @@ export default {
flex: 1; flex: 1;
display: flex; display: flex;
gap: 32rpx; gap: 32rpx;
flex-wrap: wrap; flex-wrap: nowrap;
align-items: center;
} }
.gender-radio { .gender-radio {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12rpx; gap: 12rpx;
flex-shrink: 0;
} }
.gender-radio__text { .gender-radio__text {
color: #374151; color: #374151;
font-size: 28rpx; font-size: 28rpx;
white-space: nowrap;
} }
.form-item:last-child {
margin-bottom: 0;
}
.form-item__label { .form-item__label {
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
font-weight: 500; font-weight: 500;
/* 原 160rpx,缩小 20% 以减小与输入框的间距 */ width: 140rpx;
width: 128rpx;
flex-shrink: 0; flex-shrink: 0;
margin-right: 24rpx;
white-space: nowrap;
box-sizing: border-box;
} }
.form-item--half { .form-item--half {
@@ -558,7 +582,9 @@ export default {
.form-item__input { .form-item__input {
flex: 1; flex: 1;
min-width: 0;
height: 88rpx; height: 88rpx;
line-height: 88rpx;
background-color: #f9fafb; background-color: #f9fafb;
border-radius: 12rpx; border-radius: 12rpx;
padding: 0 24rpx; padding: 0 24rpx;
@@ -569,6 +595,7 @@ export default {
.form-item__text { .form-item__text {
flex: 1; flex: 1;
min-width: 0;
height: 88rpx; height: 88rpx;
background-color: #f9fafb; background-color: #f9fafb;
border-radius: 12rpx; border-radius: 12rpx;
@@ -585,8 +612,11 @@ export default {
.form-actions { .form-actions {
display: flex; display: flex;
gap: 24rpx; gap: 16rpx;
padding-bottom: 40rpx; padding: 24rpx 16rpx 32rpx 16rpx;
background-color: #F5F5F5;
box-sizing: border-box;
flex-shrink: 0;
} }
.form-actions--triple { .form-actions--triple {
@@ -600,46 +630,56 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 12rpx;
transition: all 0.2s ease;
background-color: #f8f9fa;
border: 1px solid #e5e7eb;
box-sizing: border-box;
} }
.form-btn--cancel { .form-btn--cancel:active,
background-color: #f3f4f6; .form-btn--save:active,
.form-btn--start:active {
background-color: #f0f0f0;
border-color: #d1d5db;
opacity: 0.9;
} }
.form-btn--save { .form-btn__icon-circle {
/* 调浅主按钮色,使页面更柔和 */ width: 40rpx;
background-color: #4C8DFF; height: 40rpx;
} border-radius: 50%;
display: flex;
.form-btn--start { align-items: center;
background-color: #10B981; justify-content: center;
background-color: rgba(0, 122, 255, 0.08);
flex-shrink: 0;
} }
.form-btn__text { .form-btn__text {
font-size: 32rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
color: #007AFF;
} }
.form-btn--cancel .form-btn__text { .form-btn--cancel .form-btn__text,
color: #6b7280; .form-btn--save .form-btn__text,
}
.form-btn--save .form-btn__text {
color: #ffffff;
}
.form-btn--start .form-btn__text { .form-btn--start .form-btn__text {
color: #ffffff; color: #007AFF;
} }
/* 客户来源下拉框样式 */ /* 客户来源下拉框样式 */
.customer-source-select-wrapper { .customer-source-select-wrapper {
position: relative; position: relative;
flex: 1; flex: 1;
min-width: 0;
display: flex;
align-items: center;
} }
.customer-source-select { .customer-source-select {
width: 100%; width: 100%;
min-width: 0;
height: 88rpx; height: 88rpx;
background-color: #f9fafb; background-color: #f9fafb;
border-radius: 12rpx; border-radius: 12rpx;
@@ -649,12 +689,18 @@ export default {
justify-content: space-between; justify-content: space-between;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid transparent; border: 1px solid transparent;
overflow: hidden;
}
.customer-source-select uni-icons {
flex-shrink: 0;
margin-left: 12rpx;
} }
.customer-source-select-dropdown { .customer-source-select-dropdown {
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 128rpx; left: 0;
right: 0; right: 0;
background-color: #fff; background-color: #fff;
border-radius: 16rpx; border-radius: 16rpx;
@@ -662,6 +708,7 @@ export default {
margin-top: 8rpx; margin-top: 8rpx;
z-index: 11; z-index: 11;
padding: 12rpx 0; padding: 12rpx 0;
box-sizing: border-box;
} }
.customer-source-select-dropdown__item { .customer-source-select-dropdown__item {
@@ -695,10 +742,20 @@ export default {
.form-item__picker-text { .form-item__picker-text {
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.form-item__picker-placeholder { .form-item__picker-placeholder {
font-size: 28rpx; font-size: 28rpx;
color: #9ca3af; color: #9ca3af;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
</style> </style>

View File

@@ -732,6 +732,7 @@ import CommonBeginReception from "./common_begin_reception.vue";
customerPhone: record.customerPhone || '', customerPhone: record.customerPhone || '',
customerId: record.customerId || '', customerId: record.customerId || '',
recordingName: record.recordingName || '', recordingName: record.recordingName || '',
remarks: record.remarks || '',
tags, tags,
durationText: formattedUpdateTime ? `最近更新时间:${formattedUpdateTime}` : '最近暂无更新时间' durationText: formattedUpdateTime ? `最近更新时间:${formattedUpdateTime}` : '最近暂无更新时间'
}; };
@@ -1803,6 +1804,13 @@ import CommonBeginReception from "./common_begin_reception.vue";
font-size: 28rpx; font-size: 28rpx;
} }
.service-status-loading-more {
padding: 48rpx 0;
text-align: center;
color: #999;
font-size: 28rpx;
}
/* 标签管理样式 - 添加表单 */ /* 标签管理样式 - 添加表单 */
.tag-management { .tag-management {
/* 使用绝对定位,从tab页底部开始,高度计算:100vh - 导航栏(88rpx) - tab页(72rpx) - 底部导航栏(96rpx) */ /* 使用绝对定位,从tab页底部开始,高度计算:100vh - 导航栏(88rpx) - tab页(72rpx) - 底部导航栏(96rpx) */

View File

@@ -76,3 +76,5 @@

View File

@@ -76,3 +76,5 @@

View File

@@ -76,3 +76,5 @@

View File

@@ -76,3 +76,5 @@

View File

@@ -76,3 +76,5 @@

View File

@@ -76,3 +76,5 @@