diff --git a/api/other.js b/api/other.js index f624eca..910041e 100644 --- a/api/other.js +++ b/api/other.js @@ -67,6 +67,14 @@ export function allChatCount(data){ }) } +export function allBadgeCount(data){ + return request({ + url:`/user/all-chat-count`, + method: "get", + data:data + }) +} + /** * 待服务订单统计 * @param data diff --git a/components/RightNav/index.vue b/components/RightNav/index.vue index cac8095..05aad34 100644 --- a/components/RightNav/index.vue +++ b/components/RightNav/index.vue @@ -26,7 +26,14 @@ import functions from "@/utils/functions"; import {getConfig} from "@/api/other"; import {userChatCount} from "@/api/user"; + import {number} from "../../uni_modules/uv-ui-tools/libs/function/test"; export default{ + props:{ + badge:{ + type:Number, + default:0, + } + }, data() { return { imageShow:false, @@ -54,13 +61,13 @@ }, mounted() { let that = this; - if(uni.getStorageSync('token')){ - that.getMsgNumber(); - setInterval(() => { - that.getMsgNumber(); - },5000) - that.getKFWechat(); - } + // if(uni.getStorageSync('token')){ + // that.getMsgNumber(); + // setInterval(() => { + // that.getMsgNumber(); + // },5000) + // that.getKFWechat(); + // } }, methods: { getMsgNumber(){ @@ -126,6 +133,11 @@ created() { this.getPhone(); }, + watch:{ + badge(newValue,oldValue){ + this.msgCount = newValue; + } + } } diff --git a/pages/Index/components/ChatPage/index.vue b/pages/Index/components/ChatPage/index.vue index 58cd484..99bac64 100644 --- a/pages/Index/components/ChatPage/index.vue +++ b/pages/Index/components/ChatPage/index.vue @@ -109,7 +109,18 @@ return false; } this.status = 'loading'; - chatList(this.page, this.$store.state.userInfo.is_waitstaff === 1 ? 2:(this.$store.state.userInfo.store_id > 0?1:0)).then(res => { + let type = 0; + if(this.$store.state.userInfo.is_waitstaff === 3){ + type = 3; + }else if(this.$store.state.userInfo.is_waitstaff === 1){ + type = 2; + }else if(this.$store.state.userInfo.store_id > 0){ + type = 1; + }else{ + type = 0; + } + + chatList(this.page, type).then(res => { this.chatList.push.apply(this.chatList,res.data); if(res.data.length === 0){ this.status = 'nomore'; diff --git a/pages/Index/components/OrderPage/index.vue b/pages/Index/components/OrderPage/index.vue index c00b1fb..d237377 100644 --- a/pages/Index/components/OrderPage/index.vue +++ b/pages/Index/components/OrderPage/index.vue @@ -76,13 +76,13 @@ button-color="#F7E1C3" button-width="100%"> - - - + + + + + + + - + @@ -30,7 +30,7 @@ import {UserCache} from "@/config/config.js"; import log from "@/utils/log"; import {userDetail, userExtends} from "@/api/user"; - import {allChatCount, waitOrderCount} from "../../api/other"; + import {allBadgeCount, allChatCount, waitOrderCount} from "../../api/other"; export default { components: { FooterNav, @@ -43,6 +43,7 @@ }, data() { return { + kFbadge:0, inter:{}, current:0, footCheck: 'home', @@ -88,13 +89,12 @@ }, methods: { getCountBadges(type = 1){ - allChatCount({type:type}).then(res => { + allBadgeCount({type:type}).then(res => { console.log(res) - this.footGroup[2].badge = res.data.count; + this.footGroup[2].badge = res.data.count_user; + this.footGroup[1].badge = res.data.count_worker; + this.kFbadge = res.data.count_kf; }); - waitOrderCount().then(res => { - this.footGroup[1].badge = res.data.count; - }) }, footSelect(index){ if(index === 1|| index === 2){ @@ -167,7 +167,10 @@ if(this.inter)clearInterval(this.inter); this.getCountBadges(type); this.inter = setInterval(() => { - this.getCountBadges(type); + // this.getCountBadges(type); + this.footGroup[2].badge = res.data.count_user; + this.footGroup[1].badge = res.data.count_worker; + this.kFbadge = res.data.count_kf; },5000) } }, diff --git a/pages/OrderDetail/index.vue b/pages/OrderDetail/index.vue index 9d20165..be5acdb 100644 --- a/pages/OrderDetail/index.vue +++ b/pages/OrderDetail/index.vue @@ -1,7 +1,7 @@