Skip to content

Commit 9dfb869

Browse files
author
puhui999
committed
【新增】mall 客服商品消息
1 parent 848bc60 commit 9dfb869

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

src/views/mall/promotion/kefu/components/KeFuChatBox.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
<TextMessageItem :message="item" />
5656
<!-- 图片消息 -->
5757
<ImageMessageItem :message="item" />
58+
<!-- 商品消息 -->
59+
<ProductMessageItem :message="item" />
5860
</div>
5961
<el-avatar
6062
v-if="item.senderType === UserTypeEnum.ADMIN"
@@ -101,6 +103,7 @@ import EmojiSelectPopover from './tools/EmojiSelectPopover.vue'
101103
import PictureSelectUpload from './tools/PictureSelectUpload.vue'
102104
import TextMessageItem from './message/TextMessageItem.vue'
103105
import ImageMessageItem from './message/ImageMessageItem.vue'
106+
import ProductMessageItem from './message/ProductMessageItem.vue'
104107
import { Emoji } from './tools/emoji'
105108
import { KeFuMessageContentTypeEnum } from './tools/constants'
106109
import { isEmpty } from '@/utils/is'
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<template>
2+
<!-- 图片消息 -->
3+
<template v-if="KeFuMessageContentTypeEnum.PRODUCT === message.contentType">
4+
<div
5+
:class="[
6+
message.senderType === UserTypeEnum.MEMBER
7+
? `ml-10px`
8+
: message.senderType === UserTypeEnum.ADMIN
9+
? `mr-10px`
10+
: ''
11+
]"
12+
>
13+
<div class="goods flex items-center">
14+
<el-image
15+
:src="getMessageContent.picUrl"
16+
class="image"
17+
fit="contain"
18+
@click="imagePreview(getMessageContent.picUrl)"
19+
/>
20+
<view class="flex-1">
21+
<view class="title ss-line-2">
22+
{{ getMessageContent.spuName }}
23+
</view>
24+
<view v-if="getMessageContent.introduction" class="subtitle ss-line-1">
25+
{{ getMessageContent.introduction }}
26+
</view>
27+
<view class="price mt-8px"> ¥{{ getMessageContent.price }}</view>
28+
</view>
29+
</div>
30+
</div>
31+
</template>
32+
</template>
33+
34+
<script lang="ts" setup>
35+
import { KeFuMessageContentTypeEnum } from '../tools/constants'
36+
import { UserTypeEnum } from '@/utils/constants'
37+
import { KeFuMessageRespVO } from '@/api/mall/promotion/kefu/message'
38+
import { createImageViewer } from '@/components/ImageViewer'
39+
40+
defineOptions({ name: 'ImageMessageItem' })
41+
const props = defineProps<{
42+
message: KeFuMessageRespVO
43+
}>()
44+
const getMessageContent = computed(() => JSON.parse(props.message.content))
45+
/** 图预览 */
46+
const imagePreview = (imgUrl: string) => {
47+
createImageViewer({
48+
urlList: [imgUrl]
49+
})
50+
}
51+
</script>
52+
<style lang="scss" scoped>
53+
.goods {
54+
padding: 20px;
55+
border-radius: 12px;
56+
background-color: #e1e1e1;
57+
58+
.ss-line {
59+
min-width: 0;
60+
overflow: hidden;
61+
text-overflow: ellipsis;
62+
display: -webkit-box;
63+
-webkit-box-orient: vertical;
64+
65+
&-1 {
66+
-webkit-line-clamp: 1;
67+
}
68+
69+
&-2 {
70+
-webkit-line-clamp: 2;
71+
}
72+
}
73+
74+
.image {
75+
width: 116px;
76+
height: 116px;
77+
flex-shrink: 0;
78+
margin-right: 20px;
79+
}
80+
81+
.title {
82+
height: 64px;
83+
line-height: 32px;
84+
font-size: 26px;
85+
font-weight: 500;
86+
color: #333;
87+
}
88+
89+
.subtitle {
90+
font-size: 24px;
91+
font-weight: 400;
92+
color: #999;
93+
}
94+
95+
.price {
96+
font-size: 26px;
97+
font-weight: 500;
98+
color: #ff3000;
99+
}
100+
}
101+
</style>

0 commit comments

Comments
 (0)