diff --git a/App.vue b/App.vue index cfe8b73..cda5c2e 100644 --- a/App.vue +++ b/App.vue @@ -33,31 +33,40 @@ method: "POST", header: { 'content-type': 'application/json', - 'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token + 'Authorization': 'Bearer ' + uni.getStorageSync( + 'weapp_session_login_data').token }, data: { houseId: uni.getStorageSync('buildingID').id }, success: (data) => { + console.log(data.data.data.receivingCustomer, 'receivingCustomer') + if (data.data.data == null) { + uni.removeTabBarBadge({ + index: 0, + }) return } else { + uni.removeTabBarBadge({ + index: 0, + }) if (data.data.data.receivingCustomer > 0) { uni.setTabBarBadge({ index: 0, - text: data.data.data.receivingCustomer.toString() || "0" - }) - } else { - uni.removeTabBarBadge({ - inndex: 0, + text: `${data.data.data.receivingCustomer}` }) } } }, - fail: () => {} + fail: () => { + uni.removeTabBarBadge({ + index: 0, + }) + } }) }, - + upDateBulidIngObj() { this.bulidIngObj = uni.getStorageSync('buildingID') }, diff --git a/pages/index/customer.vue b/pages/index/customer.vue index 4465345..56ec65d 100644 --- a/pages/index/customer.vue +++ b/pages/index/customer.vue @@ -10,54 +10,6 @@ 暂无数据 - @@ -72,9 +24,6 @@ - @@ -129,10 +78,6 @@ {{ item.createTime }} - @@ -208,12 +153,14 @@ if (!res) { this.init() } + this.getTabBarBadge() }).catch(e => { console.log(e) uni.showToast({ title: '网络异常,请稍后重试~', icon: 'none' }); + this.getTabBarBadge() }) } } @@ -343,6 +290,7 @@ title: "操作成功" }) this.init(); + this.getTabBarBadge() }); } setTimeout(() => { diff --git a/pages/index/index.vue b/pages/index/index.vue index f8532c7..087a1f8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -738,11 +738,11 @@ if (data.data.data.receivingCustomer > 0) { uni.setTabBarBadge({ index: 0, - text: data.data.data.receivingCustomer.toString() || "0" + text: `${data.data.data.receivingCustomer}` }) } else { uni.removeTabBarBadge({ - inndex: 0, + index: 0, }) } }