Fix:4897 【商城小程序】用户收到客服消息,消息图标未显示红点提示
This commit is contained in:
@@ -26,3 +26,4 @@ export function getMessageList(params) {
|
|||||||
export function replyMessage(data) {
|
export function replyMessage(data) {
|
||||||
return request.post("/user/reply/add", data, {login: true})
|
return request.post("/user/reply/add", data, {login: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { getUnreadMessageCount } from '@/api/rooms'
|
import { getUnreadMessageCount, getUnreadMessageCountForSeller } from '@/api/rooms'
|
||||||
export default {
|
export default {
|
||||||
name: 'XddTabbar',
|
name: 'XddTabbar',
|
||||||
props: {
|
props: {
|
||||||
@@ -168,20 +168,35 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchUnreadCount() {
|
fetchUnreadCount() {
|
||||||
getUnreadMessageCount().then(res => {
|
uni.request({
|
||||||
const { success, data } = res
|
url: this.$SERVICE_API_URL + '/unread-num',
|
||||||
if (success) {
|
method: 'POST',
|
||||||
const count = data || 0
|
data: {
|
||||||
this.unreadCount = count
|
uid: store.getters.userInfo.uid
|
||||||
uni.$emit('updateUnreadMessageCount', count)
|
},
|
||||||
} else {
|
success:(res)=>{
|
||||||
this.unreadCount = 0
|
if(res.data.status_code === 200) {
|
||||||
uni.$emit('updateUnreadMessageCount', 0)
|
const count = res.data.content || 0
|
||||||
}
|
getUnreadMessageCount().then(res => {
|
||||||
}).catch(() => {
|
const { success, data } = res
|
||||||
this.unreadCount = 0
|
if (success) {
|
||||||
uni.$emit('updateUnreadMessageCount', 0)
|
const _count = data || 0
|
||||||
|
this.unreadCount = count + _count
|
||||||
|
uni.$emit('updateUnreadMessageCount', this.unreadCount)
|
||||||
|
} else {
|
||||||
|
this.unreadCount = 0
|
||||||
|
uni.$emit('updateUnreadMessageCount', 0)
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.unreadCount = 0
|
||||||
|
uni.$emit('updateUnreadMessageCount', 0)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.unreadCount = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
gotoPage(url, type = 1, index) {
|
gotoPage(url, type = 1, index) {
|
||||||
if (this.currIndex === index) return
|
if (this.currIndex === index) return
|
||||||
|
|||||||
@@ -123,7 +123,19 @@ export default {
|
|||||||
getUnreadMessageCount().then(res => {
|
getUnreadMessageCount().then(res => {
|
||||||
const count = res.data || 0
|
const count = res.data || 0
|
||||||
this.unreadNum = count
|
this.unreadNum = count
|
||||||
uni.$emit('updateUnreadMessageCount', count)
|
uni.request({
|
||||||
|
url: this.$SERVICE_API_URL + '/customer-chat-list',
|
||||||
|
method: 'POST',
|
||||||
|
data: {uid: this.uid},
|
||||||
|
success: res => {
|
||||||
|
if (res.data.status_code === 200) {
|
||||||
|
const _count = res.data.content + count
|
||||||
|
uni.$emit('updateUnreadMessageCount', _count)
|
||||||
|
} else {
|
||||||
|
uni.$emit('updateUnreadMessageCount', count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goRoom(item) {
|
goRoom(item) {
|
||||||
|
|||||||
Reference in New Issue
Block a user