Skip to content

Commit d3f3044

Browse files
YunaiVgitee-org
authored andcommitted
!576 【功能完善】商城客服
Merge pull request !576 from puhui999/dev-crm
2 parents 1d01955 + 70abc5f commit d3f3044

File tree

10 files changed

+349
-219
lines changed

10 files changed

+349
-219
lines changed

src/api/mall/promotion/kefu/message/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export const KeFuMessageApi = {
2929
url: '/promotion/kefu-message/update-read-status?conversationId=' + conversationId
3030
})
3131
},
32-
// 获得消息分页数据
33-
getKeFuMessagePage: async (params: any) => {
34-
return await request.get({ url: '/promotion/kefu-message/page', params })
32+
// 获得消息数据
33+
getKeFuMessageList: async (params: any) => {
34+
return await request.get({ url: '/promotion/kefu-message/list', params })
3535
}
3636
}

src/store/modules/mall/kefu.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { store } from '@/store'
2+
import { defineStore } from 'pinia'
3+
import { KeFuConversationApi, KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
4+
import { KeFuMessageRespVO } from '@/api/mall/promotion/kefu/message'
5+
6+
// TODO puhui999: 待优化完善
7+
interface MallKefuInfoVO {
8+
conversationList: KeFuConversationRespVO[] // 会话列表
9+
conversationMessageList: Map<number, KeFuMessageRespVO[]> // 会话消息
10+
}
11+
12+
export const useMallKefuStore = defineStore('mall-kefu', {
13+
state: (): MallKefuInfoVO => ({
14+
conversationList: [],
15+
conversationMessageList: new Map<number, KeFuMessageRespVO[]>() // key 会话,value 会话消息列表
16+
}),
17+
getters: {
18+
getConversationList(): KeFuConversationRespVO[] {
19+
return this.conversationList
20+
},
21+
getConversationMessageList(): Map<number, KeFuMessageRespVO[]> {
22+
return this.conversationMessageList
23+
}
24+
},
25+
actions: {
26+
async setConversationList() {
27+
const list = await KeFuConversationApi.getConversationList()
28+
list.sort((a: KeFuConversationRespVO, _) => (a.adminPinned ? -1 : 1))
29+
this.conversationList = list
30+
}
31+
// async setConversationMessageList(conversationId: number) {}
32+
}
33+
})
34+
35+
export const useUserStoreWithOut = () => {
36+
return useMallKefuStore(store)
37+
}

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div class="kefu">
2+
<el-aside class="kefu p-5px h-100%" width="260px">
3+
<div class="color-[#999] font-bold my-10px">会话记录({{ conversationList.length }})</div>
34
<div
45
v-for="item in conversationList"
56
:key="item.id"
@@ -22,7 +23,7 @@
2223
<div class="ml-10px w-100%">
2324
<div class="flex justify-between items-center w-100%">
2425
<span class="username">{{ item.userNickname }}</span>
25-
<span class="color-[var(--left-menu-text-color)]" style="font-size: 13px">
26+
<span class="color-[#999]" style="font-size: 13px">
2627
{{ formatPast(item.lastMessageTime, 'YYYY-MM-DD') }}
2728
</span>
2829
</div>
@@ -31,7 +32,7 @@
3132
v-dompurify-html="
3233
getConversationDisplayText(item.lastMessageContentType, item.lastMessageContent)
3334
"
34-
class="last-message flex items-center color-[var(--left-menu-text-color)]"
35+
class="last-message flex items-center color-[#999]"
3536
>
3637
</div>
3738
</div>
@@ -65,7 +66,7 @@
6566
取消
6667
</li>
6768
</ul>
68-
</div>
69+
</el-aside>
6970
</template>
7071

7172
<script lang="ts" setup>
@@ -180,11 +181,12 @@ watch(showRightMenu, (val) => {
180181

181182
<style lang="scss" scoped>
182183
.kefu {
184+
background-color: #fff;
185+
183186
&-conversation {
184187
height: 60px;
185-
padding: 10px;
186188
//background-color: #fff;
187-
transition: border-left 0.05s ease-in-out; /* 设置过渡效果 */
189+
//transition: border-left 0.05s ease-in-out; /* 设置过渡效果 */
188190
189191
.username {
190192
min-width: 0;
@@ -205,13 +207,10 @@ watch(showRightMenu, (val) => {
205207
}
206208
}
207209
208-
.active {
209-
border-left: 5px #3271ff solid;
210-
background-color: var(--login-bg-color);
211-
}
212-
210+
.active,
213211
.pinned {
214-
background-color: var(--left-menu-bg-active-color);
212+
background-color: rgba(128, 128, 128, 0.5); // 透明色,暗黑模式下也能体现
213+
border-radius: 8px;
215214
}
216215
217216
.right-menu-ul {

0 commit comments

Comments
 (0)