diff --git a/components/tab-bar/myCenter.vue b/components/tab-bar/myCenter.vue index 7d19e49..45e715f 100644 --- a/components/tab-bar/myCenter.vue +++ b/components/tab-bar/myCenter.vue @@ -4,6 +4,7 @@ 商家中心-{{shopCounts}} 兼职注册 兼职主页-{{workerCounts}} + 钱包余额-{{balance}} @@ -34,6 +35,7 @@ schoolShop:[], workerCounts:0, shopCounts:0, + balance:0, worker:uni.getStorageSync('worker') } }, @@ -59,6 +61,28 @@ if(shopId){ this.shopCounts = uni.getStorageSync('shopCounts') } + this.balance = 0 + this.tui.request("/worker/getAllDepo/", "GET", {userId:uni.getStorageSync('id')}, false, true).then((res) => { + if (res.code == 200) { + if(res.result.user){ + this.balance += Number(res.result.user.depoBal) + } + if(res.result.worker){ + this.balance += Number(res.result.worker.depoBal) + this.balance += Number(res.result.worker.depoBalRel) + } + if(res.result.shop){ + for(let i = 0; i < res.result.shop.length;i++){ + this.balance += Number(res.result.shop[i].balance) + } + } + this.balance = this.balance.toFixed(2) + that.$forceUpdate(); + } else { + this.tui.toast(res.message) + } + uni.hideLoading() + }).catch((res) => {}) }, clickShop(item){ uni.setStorageSync('shopId',item.id)