tianyi 1 week ago
parent
commit
47711a7790
  1. 54
      components/tab-bar/tab-bar.vue

54
components/tab-bar/tab-bar.vue

@ -1,6 +1,15 @@
<template>
<view class="tabbar-box">
<view class="bar-box" @click="clickBar(index)" v-for="(item,index) in tabList" :key="index" :class="item.shaking?'shaking':''">
<view class="red-dot" v-if="index == 0 && indexZhipaiCount > 0">
{{indexZhipaiCount}}
</view>
<view class="red-dot" v-if="index == 1 && indexWorkerCount > 0">
{{indexWorkerCount}}
</view>
<view class="red-dot" v-if="index == 4 && indexMyCount > 0">
{{indexMyCount}}
</view>
<view class="img-box" v-if="index != 2">
<img :src="item.isCheck?item.tabIconSelect:item.tabIcon" alt="" />
</view>
@ -48,7 +57,10 @@
tabIconSelect: '/static/images/tabbar/wode.png',
isCheck: false,
shaking:false
}]
}],
indexZhipaiCount:0,
indexWorkerCount:0,
indexMyCount:0
}
},
props: {
@ -78,6 +90,7 @@
methods: {
//tab
clickBar(index) {
this.getWorkerCounts()
for (let i = 0; i < this.tabList.length; i++) {
if (index == i) {
this.$emit('tab-index', i);
@ -95,6 +108,32 @@
this.$forceUpdate()
}
}
},
getWorkerCounts(){
if(!uni.getStorageSync('worker')){
return;
}
let that = this
this.tui.request("/mall/delivery/countOrderByStatus", "POST", {workerId:uni.getStorageSync('worker').workerId}, false, true).then((res) => {
if (res.code == 200) {
if(res.result != null){
for(let i = 0;i<res.result.length;i++){
if(res.result[i].status == 0){
this.indexZhipaiCount = Number(res.result[i].orderCount)
}else if(res.result[i].status == 1 || res.result[i].status == 2){
this.indexWorkerCount += Number(res.result[i].orderCount)
}else{
this.indexMyCount = Number(res.result[i].orderCount)
}
}
}
that.$forceUpdate();
} else {
that.tui.toast(res.message);
return;
}
uni.hideLoading();
}).catch((res) => {});
}
}
}
@ -118,6 +157,19 @@
.bar-box {
height: 100%;
flex: 1;
position: relative;
}
.red-dot{
width: 15px;
height: 15px;
border-radius: 15px;
line-height: 15px;
text-align: center;
color: #fff;
position: absolute;
top: 5px;
right: 10px;
background: red;
}
.img-box {

Loading…
Cancel
Save