Browse Source

处理头部消息

wangcz 7 years ago
parent
commit
6709ef611b
2 changed files with 29 additions and 2 deletions
  1. 28 1
      components/default/Header.vue
  2. 1 1
      pages/mobile/center/vendor/outOfStorage/index.vue

+ 28 - 1
components/default/Header.vue

@@ -54,6 +54,7 @@
             <a class="item" href="/user#/index">买家中心</a>
             <a class="item" @click="toVendor">卖家中心</a>
             <a class="item" href="/sso#/index">帐户中心</a>
+            <a class="item" href="/user#/messagePersonal">消息 ({{count}})</a>
           </template>
           <template v-else>
             <a class="item" @click="onLoginClick()">登录</a>
@@ -77,7 +78,9 @@
 //        keyword: '',
 //        isSearching: false
 //         ShowApplyAdv: true,
-        showEnterpriseToggle: false
+        showEnterpriseToggle: false,
+        messageUrl: process.env.messageUrl,
+        count: 0
       }
     },
     computed: {
@@ -98,6 +101,30 @@
         return this.$store.state.option.url
       }
     },
+    mounted () {
+      if(this.user.logged && this.user.data) {
+        let userUU = this.user.data.userUU
+        let enUU = this.user.data.enterprise ? this.user.data.enterprise.uu : null
+        if(userUU && enUU) {
+          let param = {
+            'receiverUu': userUU,
+            'receiverEnuu': enUU,
+            'consumerApp': 'MALL',
+            'isRead': 0
+          }
+          this.$http.get(`/messages/count`, {params: param})
+            .then((res) => {
+              if(res.data) {
+                this.count = res.data.count ? (res.data.count < 100 ? res.data.count : '99+') : 0
+              } else {
+                this.count = 0
+              }
+            }).catch((err) => {
+              console.log(err)
+          })
+        }
+      }
+    },
     methods: {
       logout () {
         this.$http.get('/logout/crossBefore').then(response => {

+ 1 - 1
pages/mobile/center/vendor/outOfStorage/index.vue

@@ -20,8 +20,8 @@
           </div>
           <div class="tab-content">
             <span :class="{'active': handleItem === 0}" @click="setHandleItem(0)">{{switchType === 'INBOUND' ? '查看入库记录' : '查看出库记录'}}</span>
-            <span :class="{'active': handleItem === 1}" @click="setHandleItem(1)">{{switchType === 'INBOUND' ? '其它入库' : '其它出库'}}</span>
             <span :class="{'active': handleItem === 2}" @click="setHandleItem(2)">{{switchType === 'INBOUND' ? '采购入库' : '销售出库'}}</span>
+            <span :class="{'active': handleItem === 1}" @click="setHandleItem(1)">{{switchType === 'INBOUND' ? '其它入库' : '其它出库'}}</span>
           </div>
           <div class="filters-wrap" v-show="handleItem !== 1">
             <base-filter