Pārlūkot izejas kodu

修改立即入驻逻辑,消息组件创建

yangc 7 gadi atpakaļ
vecāks
revīzija
ef75fdab7b

+ 1 - 14
components/applyPurchase/ApplyFooter.vue

@@ -126,20 +126,7 @@
         } else if (type === 'kind') {
           window.location.href = '/product/kind/home'
         } else if (type === 'openStore') {
-          if (this.user.logged) {
-            this.$http.get('/basic/vendor/transactionInfo').then(response => {
-              if (response.data.isOpenStore) {
-                window.location.href = '/vendor#/store/maintain'
-              } else {
-                window.location.href = '/vendor#/store-apply'
-              }
-            }, err => {
-              this.$message.error('该账户未开通卖家中心')
-              console.log(err)
-            })
-          } else {
-            this.login()
-          }
+          this.goStoreApply()
         } else if (type === 'brand') {
           window.location.href = '/product/brand/brandList/ABC'
         }

+ 0 - 11
components/home/displayCard.vue

@@ -158,17 +158,6 @@
           }
         }
         return num
-      },
-      goStoreApply: function () {
-        if (this.user.logged) {
-          if (this.enterprise && this.enterprise.isVendor === 313) {
-            window.location.href = '/vendor#/index'
-          } else {
-            this.$router.push('/register-saler')
-          }
-        } else {
-          this.$router.push('/auth/login')
-        }
       }
     },
     computed: {

+ 1 - 1
components/mobile/MobileHeader.vue

@@ -143,7 +143,7 @@
 //          this.showSearch = false
 //        }
         this.showSearchIcon = false
-        this.showHeader = val && val !== '/' && val !== '/mobile/applyPurchase/list' && !this.startWith(val, '/mobile/supplier')
+        this.showHeader = val && val !== '/' && val !== '/mobile/applyPurchase/list' && !this.startWith(val, '/mobile/supplier') && !this.startWith(val, '/mobile/center/vendor/attentionBus')
 //        this.showSearch = val !== '/' && !this.startWith(val, '/mobile/search')
         let title = '优软商城'
         if (this.startWith(val, '/mobile/brand/componentDetail/')) {

+ 154 - 0
components/mobile/center/Message.vue

@@ -0,0 +1,154 @@
+<template>
+  <div class="mobile-center">
+    <div class="com-mobile-header mobile-center-header">
+      <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
+      <p>消息</p>
+      <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
+    </div>
+    <div class="mobile-content">
+      <div v-if="msgList && msgList.length" class="message-list" v-bind:key="item.id" v-for="item in msgList">
+        <div class="content">
+          <div class="new-dot">
+            <b v-if="item.isRead === 0"></b>
+            <img src="/images/mobile/center/user/message.png" alt="">
+          </div>
+          <div class="message">
+            <p>{{item.createTime | time}}</p>
+            <a :href="item.type === 'MALL跳转卖家待报价页面' ? '/mobile/center/user/seek?seekType=done' : item.type === 'MALL公共询价' ? '/mobile/center/vendor/seek?seekType=wait' : item.type === '商城公共询价采纳结果' ? '/mobile/center/vendor/seek?seekType=done' : ''"
+               v-if="item.type"
+               :title="item.content" class="info">{{item.content}}</a>
+            <a v-else :title="item.content" class="noLink info">{{item.content}}</a>
+          </div>
+        </div>
+      </div>
+      <empty-status v-if="!msgList.length"  :showLink="true" :text="'抱歉,暂无消息'"></empty-status>
+    </div>
+    <pull-up :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
+  </div>
+</template>
+<script>
+  import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
+  export default {
+    data () {
+      return {
+        count: 10,
+        page: 1,
+        isChange: false,
+        msgList: []
+      }
+    },
+    computed: {
+      user () {
+        return this.$store.state.option.user
+      },
+      messageList () {
+        return this.$store.state.messageShow.messageList.list.data
+      },
+      fetching () {
+        return this.$store.state.messageShow.messageList.list.fetching
+      },
+      allPage () {
+        return Math.floor(this.messageList.totalElements / this.messageList.size) + Math.floor(this.messageList.totalElements % this.messageList.size > 0 ? 1 : 0)
+      }
+    },
+    components: {
+      RemindBox,
+      PullUp,
+      EmptyStatus
+    },
+    watch: {
+      'messageList': {
+        handler: function (val) {
+          if (this.isChange) {
+            this.msgList = val.content
+            this.isChange = false
+          } else {
+            this.msgList = [...this.msgList, ...val.content]
+            this.getRead()
+          }
+        },
+        immediate: true
+      }
+    },
+    methods: {
+      reloadList: function () {
+        this.$store.dispatch('messageShow/getAllMessage', { receiverUu: this.user.data.userUU, receiverEnuu: this.user.data.enterprise.uu, consumerApp: 'MALL', page: this.page, count: this.count, sorting: {'createTime': 'DESC'} })
+      },
+      onPullUpAction: function () {
+        this.page++
+        this.reloadList()
+      },
+      getRead () {
+        let ids = []
+        this.msgList.forEach((value) => {
+          if (value.isRead !== 1) {
+            ids.push(value.id)
+          }
+        })
+        if (ids.length !== 0) {
+          this.$http.post('/messages/read', {receiverUu: this.user.data.userUU, receiverEnuu: this.user.data.enterprise.uu, messageId: ids.join(','), consumerApp: 'MALL'})
+            .then((res) => {
+              console.log(res.data)
+            })
+        }
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .mobile-content {
+    margin-top: .6rem !important;
+    padding: .2rem;
+    background: #f1f3f6;
+    .com-none-state {
+      padding-bottom: 100%;
+    }
+    .message-list {
+      background: #fff;
+      padding: 0 .15rem 0 .2rem;
+      .content {
+        padding: .14rem 0;
+        overflow: hidden;
+        border-bottom: 1px solid #d3d3d3;
+        .new-dot {
+          position: relative;
+          b{
+            position: absolute;
+            left: .1rem;
+            top: .25rem;
+            width: .16rem;
+            height: .16rem;
+            border-radius: 50%;
+            background: #fc0405;
+          }
+        }
+        img{
+          margin: .3rem 0 0 .12rem;
+          float: left;
+          width: .8rem;
+          height: .8rem;
+        }
+        .message{
+          margin-left: .24rem;
+          float: left;
+          width: 5.4rem;
+          p{
+            display: inherit;
+            margin-bottom: .1rem;
+            text-align: right;
+            font-size: .24rem;
+            color: #666;
+          }
+          a.info{
+            font-size: .28rem;
+            color: #333;
+            word-break: break-all;
+          }
+        }
+      }
+    }
+  }
+  .message-list:last-child .content{
+    border-bottom: none;
+  }
+</style>

+ 2 - 1
components/mobile/center/index.js

@@ -1,2 +1,3 @@
 import Seek from './Seek.vue'
-export { Seek }
+import Message from './Message.vue'
+export { Seek, Message }

+ 1 - 14
components/provider/NewStore.vue

@@ -31,7 +31,7 @@
           已入驻商家<span>{{storeCount}}</span>家
         </div>
         <div>
-          <a @click="goStoreApply()"><button>立即入驻</button></a>
+          <a @click="goStoreApply"><button>立即入驻</button></a>
         </div>
       </div>
     </div>
@@ -54,19 +54,6 @@ export default {
     enterprise () {
       return this.user.data.enterprise
     }
-  },
-  methods: {
-    goStoreApply: function () {
-      if (this.user.logged) {
-        if (this.enterprise && this.enterprise.isVendor === 313) {
-          window.location.href = '/vendor#/index'
-        } else {
-          this.$router.push('/register-saler')
-        }
-      } else {
-        this.$router.push('/auth/login')
-      }
-    }
   }
 }
 </script>

+ 0 - 11
components/provider/Suppliers.vue

@@ -124,17 +124,6 @@ export default {
       this.pageParams.keyword = this.keyword === '' ? null : this.keyword
 
       this.pageCommodity(this.pageParams)
-    },
-    goStoreApply: function () {
-      if (this.user.logged) {
-        if (this.enterprise && this.enterprise.isVendor === 313) {
-          window.location.href = '/vendor#/store-apply'
-        } else {
-          this.$router.push('/register-saler')
-        }
-      } else {
-        this.$router.push('/auth/login')
-      }
     }
   }
 }

+ 4 - 145
pages/mobile/center/user/collect/message.vue

@@ -1,44 +1,11 @@
 <template>
-  <div class="mobile-center">
-    <div class="com-mobile-header mobile-center-header">
-      <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
-      <p>消息</p>
-      <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
-    </div>
-    <div class="mobile-content">
-      <div v-if="msgList && msgList.length" class="message-list" v-bind:key="item.id" v-for="item in msgList">
-        <div class="content">
-          <div class="new-dot">
-            <b v-if="item.isRead === 0"></b>
-            <img src="/images/mobile/center/user/message.png" alt="">
-          </div>
-          <div class="message">
-            <p>{{item.createTime | time}}</p>
-            <a :href="item.type === 'MALL跳转卖家待报价页面' ? '/mobile/center/user/seek?seekType=done' : item.type === 'MALL公共询价' ? '/mobile/center/vendor/seek?seekType=wait' : item.type === '商城公共询价采纳结果' ? '/mobile/center/vendor/seek?seekType=done' : ''"
-               v-if="item.type"
-               :title="item.content" class="info" target="_blank">{{item.content}}</a>
-            <a v-else :title="item.content" class="noLink info">{{item.content}}</a>
-          </div>
-        </div>
-      </div>
-      <empty-status v-if="!msgList.length"  :showLink="true" :text="'抱歉,暂无消息'"></empty-status>
-    </div>
-    <pull-up :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
-  </div>
+  <message></message>
 </template>
 <script>
-  import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
+  import { Message } from '~components/mobile/center'
   export default {
     middleware: 'authenticated',
     layout: 'mobileNoHeader',
-    data () {
-      return {
-        count: 10,
-        page: 1,
-        isChange: false,
-        msgList: []
-      }
-    },
     fetch ({ store }) {
       let user = store.state.option.user.data
       return Promise.all([
@@ -46,117 +13,9 @@
         store.dispatch('messageShow/getAllMessage', { receiverUu: user.userUU, receiverEnuu: user.enterprise.uu, consumerApp: 'MALL', count: 10, page: 1, sorting: {'createTime': 'DESC'} })
       ])
     },
-    computed: {
-      user () {
-        return this.$store.state.option.user
-      },
-      messageList () {
-        return this.$store.state.messageShow.messageList.list.data
-      },
-      fetching () {
-        return this.$store.state.messageShow.messageList.list.fetching
-      },
-      allPage () {
-        return Math.floor(this.messageList.totalElements / this.messageList.size) + Math.floor(this.messageList.totalElements % this.messageList.size > 0 ? 1 : 0)
-      }
-    },
     components: {
-      RemindBox,
-      PullUp,
-      EmptyStatus
-    },
-    watch: {
-      'messageList': {
-        handler: function (val) {
-          if (this.isChange) {
-            this.msgList = val.content
-            this.isChange = false
-          } else {
-            this.msgList = [...this.msgList, ...val.content]
-            this.getRead()
-          }
-        },
-        immediate: true
-      }
-    },
-    methods: {
-      reloadList: function () {
-        this.$store.dispatch('messageShow/getAllMessage', { receiverUu: this.user.data.userUU, receiverEnuu: this.user.data.enterprise.uu, consumerApp: 'MALL', page: this.page, count: this.count, sorting: {'createTime': 'DESC'} })
-      },
-      onPullUpAction: function () {
-        this.page++
-        this.reloadList()
-      },
-      getRead () {
-        let ids = []
-        this.msgList.forEach((value) => {
-          if (value.isRead !== 1) {
-            ids.push(value.id)
-          }
-        })
-        if (ids.length !== 0) {
-          this.$http.post('/messages/read', {receiverUu: this.user.data.userUU, receiverEnuu: this.user.data.enterprise.uu, messageId: ids.join(','), consumerApp: 'MALL'})
-            .then((res) => {
-              console.log(res.data)
-            })
-        }
-      }
+      Message
     }
   }
 </script>
-<style lang="scss" scoped>
-  .mobile-content {
-    margin-top: .6rem !important;
-    padding: .2rem;
-    background: #f1f3f6;
-    .com-none-state {
-      padding-bottom: 100%;
-    }
-    .message-list {
-      background: #fff;
-      padding: 0 .15rem 0 .2rem;
-      .content {
-        padding: .14rem 0;
-        overflow: hidden;
-        border-bottom: 1px solid #d3d3d3;
-        .new-dot {
-          position: relative;
-          b{
-            position: absolute;
-            left: .1rem;
-            top: .25rem;
-            width: .16rem;
-            height: .16rem;
-            border-radius: 50%;
-            background: #fc0405;
-          }
-        }
-        img{
-          margin: .3rem 0 0 .12rem;
-          float: left;
-          width: .8rem;
-          height: .8rem;
-        }
-        .message{
-          margin-left: .24rem;
-          float: left;
-          width: 5.4rem;
-          p{
-            display: inherit;
-            margin-bottom: .1rem;
-            text-align: right;
-            font-size: .24rem;
-            color: #666;
-          }
-          a.info{
-            font-size: .28rem;
-            color: #333;
-          }
-        }
-      }
-    }
-  }
-  .message-list:last-child .content{
-     border-bottom: none;
-   }
-</style>
+

+ 4 - 145
pages/mobile/center/vendor/message.vue

@@ -1,44 +1,11 @@
 <template>
-  <div class="mobile-center">
-    <div class="com-mobile-header mobile-center-header">
-      <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
-      <p>消息</p>
-      <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
-    </div>
-    <div class="mobile-content">
-      <div v-if="msgList && msgList.length" class="message-list" v-bind:key="item.id" v-for="item in msgList">
-        <div class="content">
-          <div class="new-dot">
-            <b v-if="item.isRead === 0"></b>
-            <img src="/images/mobile/center/user/message.png" alt="">
-          </div>
-          <div class="message">
-            <p>{{item.createTime | time}}</p>
-            <a :href="item.type === 'MALL跳转卖家待报价页面' ? '/mobile/center/user/seek?seekType=done' : item.type === 'MALL公共询价' ? '/mobile/center/vendor/seek?seekType=wait' : item.type === '商城公共询价采纳结果' ? '/mobile/center/vendor/seek?seekType=done' : ''"
-               v-if="item.type"
-               :title="item.content" class="info" target="_blank">{{item.content}}</a>
-            <a v-else :title="item.content" class="noLink info">{{item.content}}</a>
-          </div>
-        </div>
-      </div>
-      <empty-status v-if="!msgList.length"  :showLink="true" :text="'抱歉,暂无消息'"></empty-status>
-    </div>
-    <pull-up :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
-  </div>
+  <message></message>
 </template>
 <script>
-  import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
+  import { Message } from '~components/mobile/center'
   export default {
     middleware: 'authenticated',
     layout: 'mobileNoHeader',
-    data () {
-      return {
-        count: 10,
-        page: 1,
-        isChange: false,
-        msgList: []
-      }
-    },
     fetch ({ store }) {
       let user = store.state.option.user.data
       return Promise.all([
@@ -46,117 +13,9 @@
         store.dispatch('messageShow/getAllMessage', { receiverUu: user.userUU, receiverEnuu: user.enterprise.uu, consumerApp: 'MALL', count: 10, page: 1, sorting: {'createTime': 'DESC'} })
       ])
     },
-    computed: {
-      user () {
-        return this.$store.state.option.user
-      },
-      messageList () {
-        return this.$store.state.messageShow.messageList.list.data
-      },
-      fetching () {
-        return this.$store.state.messageShow.messageList.list.fetching
-      },
-      allPage () {
-        return Math.floor(this.messageList.totalElements / this.messageList.size) + Math.floor(this.messageList.totalElements % this.messageList.size > 0 ? 1 : 0)
-      }
-    },
     components: {
-      RemindBox,
-      PullUp,
-      EmptyStatus
-    },
-    watch: {
-      'messageList': {
-        handler: function (val) {
-          if (this.isChange) {
-            this.msgList = val.content
-            this.isChange = false
-          } else {
-            this.msgList = [...this.msgList, ...val.content]
-            this.getRead()
-          }
-        },
-        immediate: true
-      }
-    },
-    methods: {
-      reloadList: function () {
-        this.$store.dispatch('messageShow/getAllMessage', { receiverUu: this.user.data.userUU, receiverEnuu: this.user.data.enterprise.uu, consumerApp: 'MALL', page: this.page, count: this.count, sorting: {'createTime': 'DESC'} })
-      },
-      onPullUpAction: function () {
-        this.page++
-        this.reloadList()
-      },
-      getRead () {
-        let ids = []
-        this.msgList.forEach((value) => {
-          if (value.isRead !== 1) {
-            ids.push(value.id)
-          }
-        })
-        if (ids.length !== 0) {
-          this.$http.post('/messages/read', {receiverUu: this.user.data.userUU, receiverEnuu: this.user.data.enterprise.uu, messageId: ids.join(','), consumerApp: 'MALL'})
-            .then((res) => {
-              console.log(res.data)
-            })
-        }
-      }
+      Message
     }
   }
 </script>
-<style lang="scss" scoped>
-  .mobile-content {
-    margin-top: .6rem !important;
-    padding: .2rem;
-    background: #f1f3f6;
-    .com-none-state {
-      padding-bottom: 100%;
-    }
-    .message-list {
-      background: #fff;
-      padding: 0 .15rem 0 .2rem;
-      .content {
-        padding: .14rem 0;
-        overflow: hidden;
-        border-bottom: 1px solid #d3d3d3;
-        .new-dot {
-          position: relative;
-          b{
-            position: absolute;
-            left: .1rem;
-            top: .25rem;
-            width: .16rem;
-            height: .16rem;
-            border-radius: 50%;
-            background: #fc0405;
-          }
-        }
-        img{
-          margin: .3rem 0 0 .12rem;
-          float: left;
-          width: .8rem;
-          height: .8rem;
-        }
-        .message{
-          margin-left: .24rem;
-          float: left;
-          width: 5.4rem;
-          p{
-            display: inherit;
-            margin-bottom: .1rem;
-            text-align: right;
-            font-size: .24rem;
-            color: #666;
-          }
-          a.info{
-            font-size: .28rem;
-            color: #333;
-          }
-        }
-      }
-    }
-  }
-  .message-list:last-child .content{
-     border-bottom: none;
-   }
-</style>
+

+ 19 - 0
plugins/mixin.js

@@ -77,6 +77,25 @@ Vue.mixin({
       } else {
         this.initSctoll.refresh()
       }
+    },
+    login: function (url) {
+      this.$router.push(`/auth/login${url ? '?returnUrl=' + url : ''}`)
+    },
+    goStoreApply: function () {
+      if (this.user.logged) {
+        this.$http.get('/basic/vendor/transactionInfo').then(response => {
+          if (response.data.isOpenStore) {
+            window.location.href = '/vendor#/store/maintain'
+          } else {
+            window.location.href = '/vendor#/store-apply'
+          }
+        }, err => {
+          this.$message.error('该账户未开通卖家中心')
+          console.log(err)
+        })
+      } else {
+        this.login()
+      }
     }
   },
   filters: {