家居场景销售接待

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>
<view class="customer-list-container">
<view class="service-status-toolbar">
<text class="toolbar-total">{{ list.length }}</text>
<text class="toolbar-total">{{ customerListTotal || list.length }}</text>
<input
class="toolbar-input"
v-model="salesName"
@@ -61,30 +61,198 @@
</template>
<script>
import { getApiUrl } from '@/common/config.js';
export default {
name: 'CustomerList',
props: {
list: {
type: Array,
default: () => []
}
},
props: {},
data() {
return {
salesName: '',
customerName: ''
customerName: '',
customerList: [],
customerListTotal: 0,
customerListPage: {
current: 1,
size: 10
}
}
},
computed: {
list() {
return this.customerList;
}
},
mounted() {
// 组件挂载时自动加载数据
this.loadCustomerList();
},
methods: {
onInputChange() {
// 输入框变化时,可以在这里添加实时搜索逻辑(如果需要)
},
handleRefresh() {
// 触发刷新事件,并传递查询参数
this.$emit('filterClick', {
// 刷新客户列表
this.refreshCustomerList({
salesName: this.salesName.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
v-if="activeTab === 'customer'"
:list="customerList"
@itemClick="viewCustomerDetail"
@filterClick="refreshCustomerList" />
@itemClick="viewCustomerDetail" />
</view>
<!-- 客户档案弹窗 -->
@@ -474,24 +472,7 @@
currentAudioUrl: null, // 当前音频URL用于清理Blob URL
showTextModal: false, // 是否显示文本内容弹框
currentRecordingText: '', // 当前显示的录音文本内容
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'
}
]
transcribingIds: [] // 正在转文本的录音ID列表
}
},
computed: {
@@ -502,7 +483,10 @@
}
},
onLoad() {
this.loadServiceList();
// 加载服务记录列表
if (this.activeTab === 'service') {
this.loadServiceList();
}
},
onUnload() {
// 组件销毁时,清理音频播放器
@@ -538,6 +522,7 @@
if (tab === 'service' && this.serviceList.length === 0) {
this.loadServiceList();
}
// 客户列表数据由 CustomerList 组件自己管理,不需要在这里加载
},
// 刷新服务记录列表
refreshServiceList(filterParams = {}) {
@@ -546,11 +531,6 @@
// 重新加载数据,传递查询参数
this.loadServiceList(filterParams);
},
refreshCustomerList(filterParams = {}) {
// 客户列表刷新方法(可以根据需要实现搜索逻辑)
console.log('客户列表刷新', filterParams);
// TODO: 实现客户列表的搜索和刷新逻辑
},
// 服务记录列表到底部加载更多
onServiceListReachBottom() {
// 如果已经加载全部数据,则不再请求
@@ -2326,7 +2306,7 @@
duration: 3000
});
}
},
}
}
}
</script>

View File

@@ -2,139 +2,150 @@
<view class="reception-form-wrapper">
<scroll-view class="reception-form" scroll-y enable-back-to-top>
<view class="form-card">
<view class="form-item">
<text class="form-item__label">服务次数</text>
<view class="form-item__text">
<text>{{ formData.contactCount || 0 }}</text>
</view>
</view>
<view class="form-item">
<text class="form-item__label">客户姓名</text>
<input
class="form-item__input"
v-model="formData.customerName"
placeholder="请输入客户姓名"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">客户电话</text>
<input
class="form-item__input"
v-model="formData.contact"
@blur="onContactBlur"
type="number"
placeholder="请输入客户电话"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item customer-source-select-wrapper">
<text class="form-item__label">客户来源</text>
<view
class="customer-source-select"
@click.stop="toggleCustomerSourceDropdown"
>
<text
:class="formData.customerSource ? 'form-item__picker-text' : 'form-item__picker-placeholder'"
>
{{ formData.customerSource || "请选择客户来源" }}
</text>
<uni-icons type="bottom" size="16" color="#9ca3af"></uni-icons>
</view>
<view
v-if="showCustomerSourceDropdown"
class="customer-source-select-dropdown"
@click.stop
>
<view
class="customer-source-select-dropdown__item"
v-for="option in customerSourceOptions"
:key="option"
@click="selectCustomerSource(option)"
>
<text :class="{'active': option === formData.customerSource}">
{{ option }}
</text>
<view class="form-item">
<text class="form-item__label">服务次数</text>
<view class="form-item__text">
<text>{{ formData.contactCount || 0 }}</text>
</view>
</view>
<view class="form-item">
<text class="form-item__label">客户姓名</text>
<input
class="form-item__input"
v-model="formData.customerName"
placeholder="请输入客户姓名"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">客户电话</text>
<input
class="form-item__input"
v-model="formData.contact"
@blur="onContactBlur"
type="number"
placeholder="请输入客户电话"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">客户来源</text>
<view class="customer-source-select-wrapper">
<view
class="customer-source-select"
@click.stop="toggleCustomerSourceDropdown"
>
<text
:class="formData.customerSource ? 'form-item__picker-text' : 'form-item__picker-placeholder'"
>
{{ formData.customerSource || "请选择客户来源" }}
</text>
<uni-icons type="bottom" size="16" color="#9ca3af"></uni-icons>
</view>
<view
v-if="showCustomerSourceDropdown"
class="customer-source-select-dropdown"
@click.stop
>
<view
class="customer-source-select-dropdown__item"
v-for="option in customerSourceOptions"
:key="option"
@click="selectCustomerSource(option)"
>
<text :class="{'active': option === formData.customerSource}">
{{ option }}
</text>
</view>
</view>
</view>
</view>
<view class="form-item">
<text class="form-item__label">门店名称</text>
<input
class="form-item__input"
v-model="formData.dealershipName"
placeholder="请输入门店名称"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">性别</text>
<radio-group
class="gender-radio-group"
@change="onGenderChange">
<label
class="gender-radio"
v-for="(option, index) in genderOptions"
:key="index">
<radio
:value="option"
:checked="formData.gender === option"
color="#2563eb" />
<text class="gender-radio__text">{{ option }}</text>
</label>
</radio-group>
</view>
<view class="form-item">
<text class="form-item__label">年龄</text>
<input
class="form-item__input"
v-model="formData.age"
type="number"
placeholder="请输入年龄"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">销售姓名</text>
<input
class="form-item__input"
v-model="formData.salesName"
placeholder="请输入销售姓名"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">销售电话</text>
<input
class="form-item__input"
v-model="formData.salesPhone"
type="number"
placeholder="请输入销售电话"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">住址</text>
<input
class="form-item__input"
v-model="formData.remarks"
placeholder="请输入详细住址"
placeholder-style="color: #9ca3af"
/>
</view>
</view>
<view class="form-item">
<text class="form-item__label">门店名称</text>
<input
class="form-item__input"
v-model="formData.dealershipName"
placeholder="请输入门店名称"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">性别</text>
<radio-group
class="gender-radio-group"
@change="onGenderChange">
<label
class="gender-radio"
v-for="(option, index) in genderOptions"
:key="index">
<radio
:value="option"
:checked="formData.gender === option"
color="#2563eb" />
<text class="gender-radio__text">{{ option }}</text>
</label>
</radio-group>
</view>
<view class="form-item">
<text class="form-item__label">年龄</text>
<input
class="form-item__input"
v-model="formData.age"
type="number"
placeholder="请输入年龄"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">销售姓名</text>
<input
class="form-item__input"
v-model="formData.salesName"
placeholder="请输入销售姓名"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">销售电话</text>
<input
class="form-item__input"
v-model="formData.salesPhone"
type="number"
placeholder="请输入销售电话"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">住址</text>
<input
class="form-item__input"
v-model="formData.remarks"
placeholder="请输入详细住址"
placeholder-style="color: #9ca3af"
/>
</view>
</view>
</scroll-view>
<view class="form-actions form-actions--triple">
<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>
</view>
<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>
</view>
<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>
</view>
</view>
</scroll-view>
<!-- 遮罩层点击关闭下拉框 -->
<view
v-if="showCustomerSourceDropdown"
@@ -490,14 +501,17 @@ export default {
box-sizing: border-box;
width: 100%;
z-index: 1;
display: flex;
flex-direction: column;
}
.reception-form {
flex: 1;
width: 100%;
height: 100%;
padding: 24rpx 16rpx 0 16rpx; /* 顶部24rpx间距与列表项间距一致底部0 */
padding: 24rpx 16rpx 0 16rpx;
box-sizing: border-box;
background-color: #F5F5F5;
overflow-y: auto;
}
.form-card {
@@ -510,10 +524,18 @@ export default {
margin-bottom: 32rpx;
}
.form-card .form-item:last-child {
margin-bottom: 0;
}
.form-item {
display: flex;
align-items: center;
margin-bottom: 32rpx;
min-height: 88rpx;
box-sizing: border-box;
width: 100%;
flex-wrap: nowrap;
}
/* 对于包含 textarea 的表单项label 顶部对齐 */
@@ -525,31 +547,33 @@ export default {
flex: 1;
display: flex;
gap: 32rpx;
flex-wrap: wrap;
flex-wrap: nowrap;
align-items: center;
}
.gender-radio {
display: flex;
align-items: center;
gap: 12rpx;
flex-shrink: 0;
}
.gender-radio__text {
color: #374151;
font-size: 28rpx;
white-space: nowrap;
}
.form-item:last-child {
margin-bottom: 0;
}
.form-item__label {
font-size: 28rpx;
color: #333;
font-weight: 500;
/* 原 160rpx缩小 20% 以减小与输入框的间距 */
width: 128rpx;
width: 140rpx;
flex-shrink: 0;
margin-right: 24rpx;
white-space: nowrap;
box-sizing: border-box;
}
.form-item--half {
@@ -558,7 +582,9 @@ export default {
.form-item__input {
flex: 1;
min-width: 0;
height: 88rpx;
line-height: 88rpx;
background-color: #f9fafb;
border-radius: 12rpx;
padding: 0 24rpx;
@@ -569,6 +595,7 @@ export default {
.form-item__text {
flex: 1;
min-width: 0;
height: 88rpx;
background-color: #f9fafb;
border-radius: 12rpx;
@@ -585,8 +612,11 @@ export default {
.form-actions {
display: flex;
gap: 24rpx;
padding-bottom: 40rpx;
gap: 16rpx;
padding: 24rpx 16rpx 32rpx 16rpx;
background-color: #F5F5F5;
box-sizing: border-box;
flex-shrink: 0;
}
.form-actions--triple {
@@ -600,46 +630,56 @@ export default {
display: flex;
align-items: 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 {
background-color: #f3f4f6;
.form-btn--cancel:active,
.form-btn--save:active,
.form-btn--start:active {
background-color: #f0f0f0;
border-color: #d1d5db;
opacity: 0.9;
}
.form-btn--save {
/* 调浅主按钮色,使页面更柔和 */
background-color: #4C8DFF;
}
.form-btn--start {
background-color: #10B981;
.form-btn__icon-circle {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(0, 122, 255, 0.08);
flex-shrink: 0;
}
.form-btn__text {
font-size: 32rpx;
font-size: 30rpx;
font-weight: 500;
color: #007AFF;
}
.form-btn--cancel .form-btn__text {
color: #6b7280;
}
.form-btn--save .form-btn__text {
color: #ffffff;
}
.form-btn--cancel .form-btn__text,
.form-btn--save .form-btn__text,
.form-btn--start .form-btn__text {
color: #ffffff;
color: #007AFF;
}
/* 客户来源下拉框样式 */
.customer-source-select-wrapper {
position: relative;
flex: 1;
min-width: 0;
display: flex;
align-items: center;
}
.customer-source-select {
width: 100%;
min-width: 0;
height: 88rpx;
background-color: #f9fafb;
border-radius: 12rpx;
@@ -649,12 +689,18 @@ export default {
justify-content: space-between;
box-sizing: border-box;
border: 1px solid transparent;
overflow: hidden;
}
.customer-source-select uni-icons {
flex-shrink: 0;
margin-left: 12rpx;
}
.customer-source-select-dropdown {
position: absolute;
top: 100%;
left: 128rpx;
left: 0;
right: 0;
background-color: #fff;
border-radius: 16rpx;
@@ -662,6 +708,7 @@ export default {
margin-top: 8rpx;
z-index: 11;
padding: 12rpx 0;
box-sizing: border-box;
}
.customer-source-select-dropdown__item {
@@ -695,10 +742,20 @@ export default {
.form-item__picker-text {
font-size: 28rpx;
color: #333;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.form-item__picker-placeholder {
font-size: 28rpx;
color: #9ca3af;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

View File

@@ -82,16 +82,16 @@
</view>
<text class="staff-name">{{ item.staffName }}</text>
</view>
<view class="service-status">
<view class="service-action-btn service-action-btn--supplement" @click.stop="showSupplementDialog(item)">
<text>补录</text>
<view class="service-status">
<view class="service-action-btn service-action-btn--supplement" @click.stop="showSupplementDialog(item)">
<text>补录</text>
</view>
<view class="service-action-btn service-action-btn--finish" @click.stop="finishService(item)">
<text>结束</text>
</view>
<uni-icons type="bars" size="16" color="#007AFF"></uni-icons>
<text>服务中</text>
</view>
<view class="service-action-btn service-action-btn--finish" @click.stop="finishService(item)">
<text>结束</text>
</view>
<uni-icons type="bars" size="16" color="#007AFF"></uni-icons>
<text>服务中</text>
</view>
</view>
<view class="customer-info">
@@ -732,6 +732,7 @@ import CommonBeginReception from "./common_begin_reception.vue";
customerPhone: record.customerPhone || '',
customerId: record.customerId || '',
recordingName: record.recordingName || '',
remarks: record.remarks || '',
tags,
durationText: formattedUpdateTime ? `最近更新时间:${formattedUpdateTime}` : '最近暂无更新时间'
};
@@ -1803,6 +1804,13 @@ import CommonBeginReception from "./common_begin_reception.vue";
font-size: 28rpx;
}
.service-status-loading-more {
padding: 48rpx 0;
text-align: center;
color: #999;
font-size: 28rpx;
}
/* 标签管理样式 - 添加表单 */
.tag-management {
/* 使用绝对定位从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 @@