处理时间显示
This commit is contained in:
@@ -42,6 +42,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="service-meta">
|
<view class="service-meta">
|
||||||
<text class="service-date">{{ item.date }}</text>
|
<text class="service-date">{{ item.date }}</text>
|
||||||
|
<text class="service-duration" v-if="item.duration != null && item.duration > 0">录音时长:{{ formatDuration(item.duration) }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="service-recording-name" v-if="item.recordingName">
|
||||||
|
<text class="recording-name-label">记录名称:</text>
|
||||||
|
<text class="recording-name-value">{{ item.recordingName }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-content">
|
<view class="service-content">
|
||||||
<text class="service-desc">{{ item.description }}</text>
|
<text class="service-desc">{{ item.description }}</text>
|
||||||
@@ -177,6 +182,18 @@
|
|||||||
}
|
}
|
||||||
// 触发列表项点击事件,打开详情页面
|
// 触发列表项点击事件,打开详情页面
|
||||||
this.$emit('itemClick', item);
|
this.$emit('itemClick', item);
|
||||||
|
},
|
||||||
|
// 格式化时长(分钟转换为时分秒格式)
|
||||||
|
formatDuration(minutes) {
|
||||||
|
// 确保是数字类型,后端返回的单位是分钟
|
||||||
|
const numMinutes = Number(minutes);
|
||||||
|
if (isNaN(numMinutes) || numMinutes < 0) return '00:00:00';
|
||||||
|
// 将分钟转换为总秒数,然后格式化为时分秒
|
||||||
|
const totalSeconds = Math.floor(numMinutes * 60); // 将分钟转为秒,向下取整
|
||||||
|
const hours = Math.floor(totalSeconds / 3600);
|
||||||
|
const mins = Math.floor((totalSeconds % 3600) / 60);
|
||||||
|
const secs = totalSeconds % 60;
|
||||||
|
return `${String(hours).padStart(2, '0')}:${String(mins).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -355,13 +372,14 @@
|
|||||||
.service-meta {
|
.service-meta {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
|
gap: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.service-date {
|
.service-date {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
margin-right: 16rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.service-duration {
|
.service-duration {
|
||||||
@@ -369,6 +387,23 @@
|
|||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.service-recording-name {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recording-name-label {
|
||||||
|
color: #999;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recording-name-value {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
.service-content {
|
.service-content {
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2275,12 +2275,21 @@
|
|||||||
formattedTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
formattedTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理录音时长:确保转换为数字,如果是 null/undefined 则保留为 null
|
||||||
|
let durationValue = null;
|
||||||
|
if (item.duration !== null && item.duration !== undefined && item.duration !== '') {
|
||||||
|
const numDuration = Number(item.duration);
|
||||||
|
durationValue = isNaN(numDuration) ? null : numDuration;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
title: `${item.salesName || ''}的服务记录`,
|
title: `${item.salesName || ''}的服务记录`,
|
||||||
date: formattedTime ? `时间:${formattedTime}` : '',
|
date: formattedTime ? `时间:${formattedTime}` : '',
|
||||||
description: item.summary || '',
|
description: item.summary || '',
|
||||||
customerName: item.customerName || '',
|
customerName: item.customerName || '',
|
||||||
|
recordingName: item.recordingName || '', // 记录名称
|
||||||
|
duration: durationValue, // 录音时长(分钟),数字类型,null 表示无数据
|
||||||
// 保留原始数据,用于详情页
|
// 保留原始数据,用于详情页
|
||||||
rawData: item
|
rawData: item
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user