【功能修复】修复客服聊天列表页点击商品卡片无法显示商品详情的问题

pull/88/head
卢越 2024-08-25 19:42:04 +08:00
parent 75c5203c90
commit 2c4ad9f78a
1 changed files with 35 additions and 30 deletions

View File

@ -4,12 +4,20 @@
<view class="message-item ss-flex-col scroll-item"> <view class="message-item ss-flex-col scroll-item">
<view class="ss-flex ss-row-center ss-col-center"> <view class="ss-flex ss-row-center ss-col-center">
<!-- 日期 --> <!-- 日期 -->
<view v-if="message.contentType !== KeFuMessageContentTypeEnum.SYSTEM && showTime(message, messageIndex)" <view
class="date-message"> v-if="
message.contentType !== KeFuMessageContentTypeEnum.SYSTEM &&
showTime(message, messageIndex)
"
class="date-message"
>
{{ formatDate(message.createTime) }} {{ formatDate(message.createTime) }}
</view> </view>
<!-- 系统消息 --> <!-- 系统消息 -->
<view v-if="message.contentType === KeFuMessageContentTypeEnum.SYSTEM" class="system-message"> <view
v-if="message.contentType === KeFuMessageContentTypeEnum.SYSTEM"
class="system-message"
>
{{ message.content }} {{ message.content }}
</view> </view>
</view> </view>
@ -18,32 +26,35 @@
v-if="message.contentType !== KeFuMessageContentTypeEnum.SYSTEM" v-if="message.contentType !== KeFuMessageContentTypeEnum.SYSTEM"
class="ss-flex ss-col-top" class="ss-flex ss-col-top"
:class="[ :class="[
message.senderType === UserTypeEnum.ADMIN message.senderType === UserTypeEnum.ADMIN
? `ss-row-left` ? `ss-row-left`
: message.senderType === UserTypeEnum.MEMBER : message.senderType === UserTypeEnum.MEMBER
? `ss-row-right` ? `ss-row-right`
: '', : '',
]" ]"
> >
<!-- 客服头像 --> <!-- 客服头像 -->
<image <image
v-show="message.senderType === UserTypeEnum.ADMIN" v-show="message.senderType === UserTypeEnum.ADMIN"
class="chat-avatar ss-m-r-24" class="chat-avatar ss-m-r-24"
:src=" :src="
sheep.$url.cdn(message.senderAvatar) || sheep.$url.cdn(message.senderAvatar) ||
sheep.$url.static('/static/img/shop/chat/default.png') sheep.$url.static('/static/img/shop/chat/default.png')
" "
mode="aspectFill" mode="aspectFill"
></image> ></image>
<!-- 内容 --> <!-- 内容 -->
<template v-if="message.contentType === KeFuMessageContentTypeEnum.TEXT"> <template v-if="message.contentType === KeFuMessageContentTypeEnum.TEXT">
<view class="message-box" :class="{'admin': message.senderType === UserTypeEnum.ADMIN}"> <view class="message-box" :class="{ admin: message.senderType === UserTypeEnum.ADMIN }">
<mp-html :content="replaceEmoji(message.content)" /> <mp-html :content="replaceEmoji(message.content)" />
</view> </view>
</template> </template>
<template v-if="message.contentType === KeFuMessageContentTypeEnum.IMAGE"> <template v-if="message.contentType === KeFuMessageContentTypeEnum.IMAGE">
<view class="message-box" :class="{'admin': message.senderType === UserTypeEnum.ADMIN}" <view
:style="{ width: '200rpx' }"> class="message-box"
:class="{ admin: message.senderType === UserTypeEnum.ADMIN }"
:style="{ width: '200rpx' }"
>
<su-image <su-image
class="message-img" class="message-img"
isPreview isPreview
@ -59,29 +70,23 @@
<template v-if="message.contentType === KeFuMessageContentTypeEnum.PRODUCT"> <template v-if="message.contentType === KeFuMessageContentTypeEnum.PRODUCT">
<GoodsItem <GoodsItem
:goodsData="getMessageContent(message)" :goodsData="getMessageContent(message)"
@tap=" @tap="sheep.$router.go('/pages/goods/index', { id: getMessageContent(message).spuId })"
sheep.$router.go('/pages/goods/index', {
id: getMessageContent(message).id,
})
"
/> />
</template> </template>
<template v-if="message.contentType === KeFuMessageContentTypeEnum.ORDER"> <template v-if="message.contentType === KeFuMessageContentTypeEnum.ORDER">
<OrderItem <OrderItem
:orderData="getMessageContent(message)" :orderData="getMessageContent(message)"
@tap=" @tap="sheep.$router.go('/pages/order/detail', { id: getMessageContent(message).id })"
sheep.$router.go('/pages/order/detail', {
id: getMessageContent(message).id,
})
"
/> />
</template> </template>
<!-- user头像 --> <!-- user头像 -->
<image <image
v-if="message.senderType === UserTypeEnum.MEMBER" v-if="message.senderType === UserTypeEnum.MEMBER"
class="chat-avatar ss-m-l-24" class="chat-avatar ss-m-l-24"
:src="sheep.$url.cdn(message.senderAvatar) || :src="
sheep.$url.static('/static/img/shop/chat/default.png')" sheep.$url.cdn(message.senderAvatar) ||
sheep.$url.static('/static/img/shop/chat/default.png')
"
mode="aspectFill" mode="aspectFill"
> >
</image> </image>
@ -104,7 +109,7 @@
// //
message: { message: {
type: Object, type: Object,
default: ()=>({}), default: () => ({}),
}, },
// //
messageIndex: { messageIndex: {
@ -112,10 +117,10 @@
default: 0, default: 0,
}, },
// //
messageList:{ messageList: {
type: Array, type: Array,
default: () => [], default: () => [],
} },
}); });
const getMessageContent = computed(() => (item) => JSON.parse(item.content)); // const getMessageContent = computed(() => (item) => JSON.parse(item.content)); //