Jelajahi Sumber

新增 商机关注

shenjj 7 tahun lalu
induk
melakukan
af603d8b66

+ 3 - 1
components/mobile/common/StatisticsMobile.vue

@@ -110,6 +110,7 @@
         }
       },
       formatNumber (num, type) {
+        if (num === '' || !num) return false
         if (num.toString().indexOf('E') !== -1) {
           let arr = num.toString().split('E')
           num = arr[0] * Math.pow(10, arr[1])
@@ -140,6 +141,7 @@
         return num
       },
       formatDouble (num) {
+        if (num === '' || !num) return false
         if (num.toString().indexOf('E') !== -1) {
           let arr = num.toString().split('E')
           num = arr[0] * Math.pow(10, arr[1])
@@ -175,7 +177,7 @@
       },
       list () {
         let list = JSON.parse(JSON.stringify(this.$store.state.provider.stores.storeList.data))
-        console.log(list)
+        // console.log(list)
         return list.totalElements
       },
       itemData () {

+ 60 - 9
pages/mobile/center/vendor/attentionBus.vue

@@ -10,14 +10,14 @@
           <i class="iconfont icon-sousuo"></i>
           </span>
       </div>
-      <div class="attention-bus-list">
+      <div class="attention-bus-list" v-if="attentionList.length > 0">
         <ul>
-          <li v-for="item in attentionList">
+          <li v-for="(item, index) in attentionList" v-bind:key="index">
             <div class="item">
               <div class="name">
                 {{ item.nameCn | filterStr}}
               </div>
-              <div class="attention-button" @click="attentionFn(item)">
+              <div class="attention-button" @click="attentionFn(item, index)">
                 <i class="iconfont icon-shoucang" :class="{'active': item.status}"></i>
                 <p v-if="item.status === 1">取消关注</p>
                 <p v-else>关注</p>
@@ -26,6 +26,11 @@
           </li>
         </ul>
       </div>
+      <div class="none-state" v-else>
+        <img src="/images/mobile/@2x/search-empty.png">
+        <p>暂无数据</p>
+        <nuxt-link to="/">返回首页</nuxt-link>
+      </div>
       <div class="fixedAlert" v-show="isShowAlert">
         关注类目,商机无限!
         <i class="iconfont icon-guanbi" @click="isShowAlert = false"></i>
@@ -91,25 +96,43 @@
           this.attentionList = []
           this.getMoreSearch()
         },
-        attentionFn(item) {
-          if (item.status === 1) {
-            this.$http.post('/kind/concern', {kindConcern: item, type: 'del'}).then(res => {
+        attentionFn(kindConcern, index) {
+          let param = {
+            date: kindConcern.date,
+            enUU: kindConcern.enUU,
+            nameCn: kindConcern.nameCn,
+            nameEn: kindConcern.nameEn,
+            status: kindConcern.status
+          }
+          if (kindConcern.status === 1) {
+            param.id = kindConcern.id
+            this.$http.post('/produce/kindConcern/modify', param).then(res => {
               this.collectResult = '取消成功'
               this.timeoutCount++
+              this.attentionList.splice(index, 1)
+              if (this.attentionList.length <= 15 && this.page < this.allPage) {
+                this.page++
+                this.getAttentionListArray(this.page)
+              }
             })
           } else {
-            this.$http.post('/kind/concern', {indConcern: item, type: 'add'}).then(res => {
+            this.$http.post('/produce/kindConcern/modify', param).then(res => {
               this.collectResult = '关注成功'
               this.timeoutCount++
+              this.attentionList.splice(index, 1)
+              if (this.attentionList.length <= 15 && this.page < this.allPage) {
+                this.page++
+                this.getAttentionListArray(this.page)
+              }
             })
           }
         },
         getAttentionListArray(page) {
           this.isSearchSearchingMore = true
           if (this.activeType === 'attention') {
-            this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 10, page: page, type: 'yes', enUU: this.$store.state.option.user.data.enterprise.uu})
+            this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 20, page: page, type: 'yes', enUU: this.$store.state.option.user.data.enterprise.uu})
           } else {
-            this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 10, page: page, type: 'no', enUU: this.$store.state.option.user.data.enterprise.uu})
+            this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 20, page: page, type: 'no', enUU: this.$store.state.option.user.data.enterprise.uu})
           }
         },
         getMoreSearch() {
@@ -245,5 +268,33 @@
         }
       }
     }
+    .none-state{
+      text-align: center;
+      padding:1.5rem 0;
+      background: #fff;
+      margin-top:.1rem;
+      width:100%;
+      img{
+        margin:0 auto;
+        width: 4.08rem;
+        height: 2.62rem;
+      }
+      p {
+        font-size: .32rem;
+        color: #999;
+        margin: 1.19rem 0 0 0;
+      }
+      a {
+        display: block;
+        font-size: .28rem;
+        color: #fff;
+        width: 1.88rem;
+        height: .54rem;
+        line-height: .54rem;
+        background: #418bf6;
+        margin: .7rem auto 0;
+        border-radius: .05rem;
+      }
+    }
   }
 </style>

+ 1 - 1
store/product.js

@@ -203,7 +203,7 @@ export const actions = {
   // 获取用户收藏类目数据
   getUserCollectCode({ commit }, params = {}) {
     commit('component/REQUEST_COLLECTCODE')
-    return axios.get('/kind/concern/list', { params: params })
+    return axios.get('/produce/kindConcern/list', { params: params })
       .then(response => {
         commit('component/REQUEST_COLLECTCODE_SUCCESS', response.data)
       }, err => {