家具销售场景大模型联调
This commit is contained in:
54
pages.json
54
pages.json
@@ -112,60 +112,6 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/general_sales/prepare/prepare",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/general_sales/process/process",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/general_sales/summary/summary",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/furniture_sales/prepare/prepare",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/furniture_sales/process/process",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/furniture_sales/summary/summary",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/car_sales/prepare/prepare",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/car_sales/process/process",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/car_sales/summary/summary",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/ucenter/ucenter",
|
"path": "pages/ucenter/ucenter",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@@ -91,6 +91,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getApiUrl } from '@/common/config.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ServiceList',
|
name: 'ServiceList',
|
||||||
props: {
|
props: {
|
||||||
@@ -159,12 +161,107 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 处理AI分析
|
// 处理AI分析
|
||||||
handleAnalysis(item) {
|
async handleAnalysis(item) {
|
||||||
this.closeServiceActionMenu();
|
this.closeServiceActionMenu();
|
||||||
this.$emit('menuAction', {
|
|
||||||
action: 'analysis',
|
try {
|
||||||
item: item
|
// 获取录音记录ID
|
||||||
});
|
const recordId = item.id || item.rawData?.id;
|
||||||
|
if (!recordId) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '无法获取记录ID',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取完整的 AudioManagement 对象,优先使用 rawData,如果没有则使用 item 的字段构建
|
||||||
|
const audioManagement = item.rawData || {
|
||||||
|
id: recordId
|
||||||
|
};
|
||||||
|
|
||||||
|
uni.showLoading({
|
||||||
|
title: 'AI分析中...'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用AI分析接口:/api/audioManagement/AIAnlyzById
|
||||||
|
const url = getApiUrl('/api/audioManagement/AIAnlyzById');
|
||||||
|
|
||||||
|
// 获取认证信息
|
||||||
|
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: url,
|
||||||
|
method: 'POST',
|
||||||
|
data: audioManagement,
|
||||||
|
header: headers,
|
||||||
|
timeout: 60000 // AI分析可能需要较长时间,设置60秒超时
|
||||||
|
});
|
||||||
|
|
||||||
|
uni.hideLoading();
|
||||||
|
|
||||||
|
if (res.statusCode === 200 && res.data && res.data.success) {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.data.message || 'AI分析请求已提交',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
|
||||||
|
// 如果返回了更新后的数据,通知父组件更新列表项
|
||||||
|
if (res.data.data) {
|
||||||
|
// 构建更新后的item数据
|
||||||
|
const updatedItem = {
|
||||||
|
...item,
|
||||||
|
rawData: res.data.data,
|
||||||
|
description: res.data.data.summary || item.description
|
||||||
|
};
|
||||||
|
|
||||||
|
// 通知父组件更新该项
|
||||||
|
this.$emit('updateItem', {
|
||||||
|
recordId: recordId,
|
||||||
|
data: updatedItem
|
||||||
|
});
|
||||||
|
|
||||||
|
// 触发详情查看事件,使用更新后的数据打开详情页
|
||||||
|
this.$emit('itemClick', updatedItem);
|
||||||
|
} else {
|
||||||
|
// 如果没有返回数据,仍然打开详情页
|
||||||
|
this.$emit('itemClick', item);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.data?.message || 'AI分析失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading();
|
||||||
|
console.error('AI分析失败:', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: `AI分析失败: ${error.errMsg || error.message || '未知错误'}`,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 处理录音
|
// 处理录音
|
||||||
handleAudio(item) {
|
handleAudio(item) {
|
||||||
|
|||||||
@@ -40,7 +40,8 @@
|
|||||||
@itemClick="viewDetail"
|
@itemClick="viewDetail"
|
||||||
@filterClick="refreshServiceList"
|
@filterClick="refreshServiceList"
|
||||||
@reachBottom="onServiceListReachBottom"
|
@reachBottom="onServiceListReachBottom"
|
||||||
@menuAction="handleMenuAction" />
|
@menuAction="handleMenuAction"
|
||||||
|
@updateItem="handleUpdateItem" />
|
||||||
|
|
||||||
<!-- 客户列表 -->
|
<!-- 客户列表 -->
|
||||||
<CustomerList
|
<CustomerList
|
||||||
@@ -570,9 +571,10 @@
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case 'view':
|
case 'view':
|
||||||
// 查看详情:打开详情弹窗
|
// 查看详情:打开详情弹窗
|
||||||
|
this.viewDetail(item);
|
||||||
break;
|
break;
|
||||||
case 'analysis':
|
case 'analysis':
|
||||||
// AI分析:打开详情弹窗并切换到相关标签页
|
// AI分析:已经在 ServiceList 组件中处理,这里不需要处理
|
||||||
break;
|
break;
|
||||||
case 'audio':
|
case 'audio':
|
||||||
// 录音详情:加载录音分段列表
|
// 录音详情:加载录音分段列表
|
||||||
@@ -586,6 +588,16 @@
|
|||||||
console.warn('未知的菜单操作:', action);
|
console.warn('未知的菜单操作:', action);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 处理列表项更新
|
||||||
|
handleUpdateItem({ recordId, data }) {
|
||||||
|
// 在列表中找到对应的项并更新
|
||||||
|
const index = this.serviceList.findIndex(serviceItem =>
|
||||||
|
(serviceItem.id || serviceItem.rawData?.id) === recordId
|
||||||
|
);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.$set(this.serviceList, index, data);
|
||||||
|
}
|
||||||
|
},
|
||||||
// 删除服务记录
|
// 删除服务记录
|
||||||
async deleteServiceRecord(item) {
|
async deleteServiceRecord(item) {
|
||||||
console.log('删除服务记录,item:', item);
|
console.log('删除服务记录,item:', item);
|
||||||
|
|||||||
Reference in New Issue
Block a user