tianyi 4 weeks ago
parent
commit
11f74b9aa2
  1. 43
      components/tab-bar/myCenter.vue
  2. 15
      components/tab-bar/tab-bar.vue

43
components/tab-bar/myCenter.vue

@ -53,48 +53,11 @@
this.workerCounts = 0 this.workerCounts = 0
this.shopCounts = 0 this.shopCounts = 0
if(worker){ if(worker){
this.tui.request("/mall/delivery/countOrderByStatus", "POST", {workerId:uni.getStorageSync('worker').workerId,regionId:JSON.parse(uni.getStorageSync('area')).id}, false, true).then((res) => { this.workerCounts = uni.getStorageSync('workerCounts')
if (res.code == 200) {
if(res.result != null){
for(let i = 0;i<res.result.length;i++){
if(res.result[i].status == 3){
this.workerCounts = Number(res.result[i].orderCount)
}
}
}
that.$forceUpdate();
} else {
that.tui.toast(res.message);
return;
}
uni.hideLoading();
}).catch((res) => {});
} }
if(shopId){ if(shopId){
this.tui.request("/mall/order/countByShop/"+uni.getStorageSync('shopId'), "GET", {}, false, true).then((res) => { this.shopCounts = uni.getStorageSync('shopCounts')
if (res.code == 200) {
this.shopData = res.result
for(let i=0;i<this.shopData.orderStatusCount.length;i++){
if(this.shopData.orderStatusCount[i].counttype){
if(this.shopData.orderStatusCount[i].counttype == 'daisong'){
this.shopCounts += Number(this.shopData.orderStatusCount[i].count)
}else if(this.shopData.orderStatusCount[i].counttype == 'daiqu'){
this.shopCounts += Number(this.shopData.orderStatusCount[i].count)
}else if(this.shopData.orderStatusCount[i].counttype == 'daixiaofei'){
this.shopCounts += Number(this.shopData.orderStatusCount[i].count)
}else if(this.shopData.orderStatusCount[i].counttype == 'daichucan'){
this.shopCounts += Number(this.shopData.orderStatusCount[i].count)
}
}
}
this.shopCounts += Number(this.shopData.pendingBadReviewCount)
this.shopCounts += Number(this.shopData.refundCount)
that.$forceUpdate();
} else {
this.tui.toast(res.message)
}
uni.hideLoading()
}).catch((res) => {})
} }
}, },
clickShop(item){ clickShop(item){

15
components/tab-bar/tab-bar.vue

@ -95,7 +95,7 @@
if (index == i) { if (index == i) {
this.$emit('tab-index', i); this.$emit('tab-index', i);
if(index == 2) return if(index == 2) return
if(index != 0 && index != 4){ if(index != 0){
this.getWorkerCounts() this.getWorkerCounts()
} }
this.tabList[i].isCheck = true this.tabList[i].isCheck = true
@ -134,6 +134,10 @@
}else{ }else{
this.indexMyCount += Number(res.result[i].orderCount) this.indexMyCount += Number(res.result[i].orderCount)
} }
if(res.result[i].status == 3){
let workerCounts = Number(res.result[i].orderCount)
uni.setStorageSync('workerCounts',workerCounts)
}
} }
} }
that.$forceUpdate(); that.$forceUpdate();
@ -148,21 +152,30 @@
this.tui.request("/mall/order/countByShop/"+uni.getStorageSync('shopId'), "GET", {}, false, true).then((res) => { this.tui.request("/mall/order/countByShop/"+uni.getStorageSync('shopId'), "GET", {}, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.shopData = res.result this.shopData = res.result
let shopCounts = 0
for(let i=0;i<this.shopData.orderStatusCount.length;i++){ for(let i=0;i<this.shopData.orderStatusCount.length;i++){
if(this.shopData.orderStatusCount[i].counttype){ if(this.shopData.orderStatusCount[i].counttype){
if(this.shopData.orderStatusCount[i].counttype == 'daisong'){ if(this.shopData.orderStatusCount[i].counttype == 'daisong'){
this.indexMyCount += Number(this.shopData.orderStatusCount[i].count) this.indexMyCount += Number(this.shopData.orderStatusCount[i].count)
shopCounts += Number(this.shopData.orderStatusCount[i].count)
}else if(this.shopData.orderStatusCount[i].counttype == 'daiqu'){ }else if(this.shopData.orderStatusCount[i].counttype == 'daiqu'){
this.indexMyCount += Number(this.shopData.orderStatusCount[i].count) this.indexMyCount += Number(this.shopData.orderStatusCount[i].count)
shopCounts += Number(this.shopData.orderStatusCount[i].count)
}else if(this.shopData.orderStatusCount[i].counttype == 'daixiaofei'){ }else if(this.shopData.orderStatusCount[i].counttype == 'daixiaofei'){
this.indexMyCount += Number(this.shopData.orderStatusCount[i].count) this.indexMyCount += Number(this.shopData.orderStatusCount[i].count)
shopCounts += Number(this.shopData.orderStatusCount[i].count)
}else if(this.shopData.orderStatusCount[i].counttype == 'daichucan'){ }else if(this.shopData.orderStatusCount[i].counttype == 'daichucan'){
this.indexMyCount += Number(this.shopData.orderStatusCount[i].count) this.indexMyCount += Number(this.shopData.orderStatusCount[i].count)
shopCounts += Number(this.shopData.orderStatusCount[i].count)
} }
} }
} }
this.indexMyCount += Number(this.shopData.pendingBadReviewCount) this.indexMyCount += Number(this.shopData.pendingBadReviewCount)
this.indexMyCount += Number(this.shopData.refundCount) this.indexMyCount += Number(this.shopData.refundCount)
shopCounts += Number(this.shopData.pendingBadReviewCount)
shopCounts += Number(this.shopData.refundCount)
uni.setStorageSync('shopCounts',shopCounts)
that.$forceUpdate(); that.$forceUpdate();
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)

Loading…
Cancel
Save