Переглянути джерело

店铺/供应商/品牌合并

huangb 7 роки тому
батько
коміт
7ded521b1d

+ 8 - 9
components/brandCenter/BrandIndex.vue

@@ -151,9 +151,9 @@
         PcSearchHeader
       },
       mounted () {
-        if (this.$route.path !== '/product/brand/brandList/A') {
-          this.$router.push('/product/brand/brandList/A')
-        }
+        // if (this.$route.path !== '/product/brand/brandList/A') {
+        //   this.$router.push('/product/brand/brandList/A')
+        // }
       },
       computed: {
         brandList () {
@@ -162,7 +162,7 @@
           return brandsList
         },
         activeIndex () {
-          return !this.isSearch ? this.$route.params.initial : ''
+          return !this.isSearch ? this.$route.query.initial : ''
         },
         user () {
           return this.$store.state.option.user
@@ -207,7 +207,7 @@
           this.reloadData()
         },
         reloadData: function () {
-          !this.isSearch ? this.$store.dispatch('product/loadBrandsPager', {'initial': this.$route.params.initial, 'page': this.nowPage, 'count': this.pageSize, 'keyword': this.keyword}) : this.searchData()
+          !this.isSearch ? this.$store.dispatch('product/loadBrandsPager', {'initial': this.$route.query.initial, 'page': this.nowPage, 'count': this.pageSize, 'keyword': this.keyword}) : this.searchData()
         },
         searchData: function () {
           this.showSearchModal = true
@@ -238,15 +238,15 @@
           } else {
             this.initParams()
             this.reloadData()
-            this.$router.push('/product/brand/brandList/A')
+            this.$router.push('/eCommerce/home/brand/?initial=A')
           }
         },
         goBrandIndex: function (index) {
-          if (index === this.$route.params.initial) {
+          if (index === this.$route.query.initial) {
             this.initParams()
             this.reloadData()
           } else {
-            this.$router.push('/product/brand/brandList/' + index)
+            this.$router.push('/eCommerce/home/brand/?initial=' + index)
 //            window.location.href = '/product/brand/brandList/' + index + '#index'
 //            window.open('/product/brand/brandList/' + index + '#index', '_self')
           }
@@ -271,7 +271,6 @@
 <style lang="scss" scoped>
   .search-index {
     margin: 0 auto;
-    margin-top: 20px;
     width: 1190px;
     overflow: hidden;
     .brand-recommend {

+ 2 - 7
components/brandCenter/RecommendBrand.vue

@@ -1,8 +1,5 @@
 <template>
   <div class="recommend-brand">
-    <div class="brand-toggle">
-      <toggle-store/>
-    </div>
     <div class="brand-content">
       <div v-swiper:mySwiper="swiperOption" class="swiper-container">
         <div class="swiper-wrapper">
@@ -20,7 +17,6 @@
   </div>
 </template>
 <script>
-  import ToggleStore from '~components/provider/ToggleStore.vue'
   export default {
     data () {
       return {
@@ -45,8 +41,8 @@
         }
       }
     },
-    components: {
-      ToggleStore
+    created () {
+      this.$store.dispatch('loadBrandCarousel')
     },
     computed: {
       banners () {
@@ -62,7 +58,6 @@
   .recommend-brand {
     width: 1190px;
     margin: 0 auto;
-    padding-top: 20px;
     overflow: hidden;
     .brand-toggle {
       float: left;

+ 8 - 8
components/main/Nav.vue

@@ -13,15 +13,15 @@
         <span>询价求购</span>
         <img class="new-animate" src="/images/all/banner-cuxiao03.png" alt="">
       </nuxt-link>
-      <nuxt-link to="/supplier" class="item" v-if="!isInFrame">
-        <span>供应商</span>
-      </nuxt-link>
+      <!--<nuxt-link to="/supplier" class="item" v-if="!isInFrame">-->
+        <!--<span>供应商</span>-->
+      <!--</nuxt-link>-->
       <a class="item" @click="goB2B">
         <span>B2B商务</span>
         <img class="new-animate" src="/images/all/hot.png" alt="">
       </a>
-      <nuxt-link  to="/provider/shop" class="item">
-        <span>店铺
+      <nuxt-link  to="/eCommerce/home/factory" class="item">
+        <span>电商
           <!--<i class="iconfont icon-arrow-down"></i>-->
           <!--<i class="iconfont icon-arrow-up"></i>-->
         </span>
@@ -38,9 +38,9 @@
           <!--</li>-->
         <!--</ul>-->
       </nuxt-link>
-      <nuxt-link to="/product/brand/brandList/A" class="item">
-        <span>品牌墙</span>
-      </nuxt-link>
+      <!--<nuxt-link to="/product/brand/brandList/A" class="item">-->
+        <!--<span>品牌墙</span>-->
+      <!--</nuxt-link>-->
       <nuxt-link to="/pcb" class="item">
         <span>PCB专区</span>
       </nuxt-link>

+ 4 - 1
components/provider/Carousel.vue

@@ -28,7 +28,7 @@
     computed: {
       storeType () {
         this.activeSlide = 0
-        return this.$store.state.provider.stores.storeType.data
+        return this.$route.params.type
       },
       swiperOption () {
         return {
@@ -46,6 +46,9 @@
           nextButton: '.swiper-button-next'
         }
       }
+    },
+    created () {
+      this.$store.dispatch('loadBanners', {type: this.storeType + '_banner_carousel'})
     }
   }
 </script>

+ 6 - 5
components/provider/RecommendStore.vue

@@ -8,12 +8,13 @@
       <banner/>
     </div>
     <!--品牌-->
-    <!--<div class="carousel" v-else-if="storeType = 'brand'">-->
-      <!--<recommend-brand></recommend-brand>-->
-    <!--</div>-->
+    <div class="carousel" v-else-if="storeType === 'brand'">
+      <recommend-brand></recommend-brand>
+    </div>
     <!--店铺-->
     <div class="carousel" v-else>
-      <carousel :banners="banners" v-for="item in init" v-if="item.show" :key="item.id" />
+      <!--<carousel :banners="banners" v-for="item in init" v-if="item.show" :key="item.id" />-->
+      <carousel :banners="banners"/>
     </div>
   </div>
 </template>
@@ -38,7 +39,7 @@ export default {
   },
   computed: {
     storeType () {
-      return this.$store.state.provider.stores.storeType.data
+        return this.$route.params.type
     },
     // providerType () {
     //   return this.$route.path === '/provider/home' ? 'agency' : 'original'

+ 4 - 4
components/provider/RecommendStoreShow.vue

@@ -5,9 +5,9 @@
       <article-two/>
     </div>
     <!--品牌-->
-    <!--<div v-else-if="storeType = 'brand'">-->
-      <!--<brand-index/>-->
-    <!--</div>-->
+    <div v-else-if="storeType === 'brand'">
+      <brand-index/>
+    </div>
     <!--店铺-->
     <div v-else>
       <div class="new-store">
@@ -41,7 +41,7 @@ export default {
   },
   computed: {
     storeType () {
-      return this.$store.state.provider.stores.storeType.data
+      return this.$route.params.type
     }
   }
 }

+ 1 - 1
components/provider/Suppliers.vue

@@ -76,7 +76,7 @@ export default {
       if (this.pageParams) {
         this.pageParams.page = 1
       }
-      return this.$store.state.provider.stores.storeType.data
+      return this.$route.params.type
     },
     stores () {
       return this.$store.state.provider.stores.storeList.data

+ 37 - 19
components/provider/ToggleStore.vue

@@ -47,7 +47,7 @@
         <div class="count">
           <span>已入驻</span>
           <div class="count_num">
-            <span v-for="item in formatNumber(storeCount, 4)" v-text="item">1</span>
+            <span v-for="item in formatNumber(supplierArr, 4)" v-text="item">1</span>
           </div>
         </div>
       </div>
@@ -62,7 +62,7 @@
         <div class="count">
           <span>已入驻</span>
           <div class="count_num">
-            <span v-for="item in formatNumber(storeCount, 4)" v-text="item">1</span>
+            <span v-for="item in formatNumber(brandArr, 4)" v-text="item">1</span>
           </div>
         </div>
       </div>
@@ -76,9 +76,16 @@
 
 export default {
   name: 'excellent-suppliers',
+  data () {
+    return {
+      supplierArr: [],
+      brandArr: []
+    }
+  },
   computed: {
     storeType () {
-      return this.$store.state.provider.stores.storeType.data
+      console.log(this.$route.params.type, '1111')
+      return this.$route.params.type
     },
     store () {
       return this.$store.state.provider.storeCms.recommendStore.data
@@ -88,33 +95,44 @@ export default {
     },
     originalCount () {
       return this.$store.state.provider.stores.originalCount.data
+    },
+    count () {
+      // let allCount =  this.$store.state.option.counter.data ? this.$store.state.option.counter.data : []
+      // allCount.forEach((value) => {
+      //   if (value.item === '供应商') {
+      //     this.supplierArr.push(value.count)
+      //   }
+      //   if (value.item === '品   牌') {
+      //     this.brandArr.push(value.count)
+      //   }
+      // })
     }
   },
   mounted () {
-    if (this.$route.path === '/product/brand/brandList') {
-      this.$store.commit('provider/stores/SET_STORETYPE', type)
-    }
+    this.$nextTick(() => {
+      this.count
+    })
+  },
+  create () {
+    this.$store.dispatch('loadCounterData')
   },
   methods: {
     // 切换Store
     toggleStore (type) {
       if (type === this.storeType) return
-      this.$store.commit('provider/stores/SET_STORETYPE', type)
       this.$store.dispatch('loadBanners', {type: type + '_banner_carousel'})
       this.$store.dispatch('provider/findSimilarStoreList', { page: 1, count: 10, type: type === 'factory' ? 'ORIGINAL_FACTORY' : 'AGENCY-DISTRIBUTION' })
       if (type === 'brand') {
-        this.$router.push('/product/brand/brandList/A')
-      } else {
-        if (type === 'origin') {
-          this.$store.commit('provider/stores/SET_STORETYPE', 'origin')
-        }
-        if (type === 'supplier') {
-          this.$store.commit('provider/stores/SET_STORETYPE', 'supplier')
-        }
-        if (type === 'factory') {
-          this.$store.commit('provider/stores/SET_STORETYPE', 'factory')
-        }
-        this.$router.push('/provider/shop')
+        this.$router.push('/eCommerce/home/brand/?initial=A')
+      }
+      if (type === 'supplier') {
+        this.$router.push('/eCommerce/home/supplier')
+      }
+      if (type === 'factory') {
+        this.$router.push('/eCommerce/home/factory')
+      }
+      if (type === 'origin') {
+        this.$router.push('/eCommerce/home/origin')
       }
     },
     // 店铺入驻数量

+ 2 - 2
pages/applyPurchase/index.vue

@@ -1,13 +1,13 @@
 <template>
   <div class="seek">
     <div class="container">
-      <div class="article">
+      <div class="article" style="float: left;width: 220px;">
         <article-one></article-one>
         <article-two></article-two>
         <article-three></article-three>
         <article-four></article-four>
       </div>
-      <div class="section">
+      <div class="section" style="margin-left: 235px;vertical-align: top;">
         <publish-apply></publish-apply>
         <apply-info></apply-info>
         <!--<business-opportunities id="opportunities"></business-opportunities>-->

+ 18 - 0
pages/eCommerce/home.vue

@@ -0,0 +1,18 @@
+<template>
+  <div style="background: rgb(242, 241, 241);">
+    <recommend-store></recommend-store>
+    <nuxt-child></nuxt-child>
+  </div>
+</template>
+<script>
+  import { RecommendStore } from '~components/provider'
+  export default  {
+    layout: 'main',
+    components: {
+      RecommendStore
+    },
+    fetch ({store}) {
+      return store.dispatch('loadCounterData')
+    }
+  }
+</script>

+ 47 - 0
pages/eCommerce/home/_type.vue

@@ -0,0 +1,47 @@
+<template>
+  <div><recommendStore-show/></div>
+</template>
+<script>
+  import RecommendStoreShow  from '~components/provider/RecommendStoreShow.vue'
+  export default {
+    layout: 'main',
+    components: {
+      RecommendStoreShow
+    },
+    fetch ({store, route, params}) {
+      return params.type === 'supplier' ? Promise.all([
+        store.dispatch('supplier/loadVendorList', {page: 1, size: 10}),
+        store.dispatch('supplier/loadVendorAll', {page: 1, size: 20}),
+        store.dispatch('supplier/loadNewMerchant', {filter: 'page', size: 10}),
+        store.dispatch('supplier/loadRecommend', {size: 19}),
+      ]) : params.type === 'brand' ? Promise.all([
+        store.dispatch('loadFloors'),
+        store.dispatch('loadBanners', {type: 'Brand-v3'}),
+        store.dispatch('loadBrandCarousel'),
+        store.dispatch('loadBrandBanner'),
+        store.dispatch('product/loadRecommends'),
+        store.dispatch('product/loadBrandsPager', {'initial': route.query.initial, 'page': 1, 'count': 60, 'keyword': ''})
+      ]) : params.type === 'factory' ? Promise.all([
+        store.dispatch('loadBanners', {type: 'factory_banner_carousel'}),
+        store.dispatch('provider/loadSalesStore', { isOriginal: true }),
+        store.dispatch('provider/loadNewStores', { types: 'ORIGINAL_FACTORY', size: 5 }),
+        store.dispatch('provider/loadRecommendOriginal', { types: 'ORIGINAL_FACTORY', num: 5 }),
+        store.dispatch('provider/findSimilarStoreList', { page: 1, count: 10, type: 'ORIGINAL_FACTORY' }),
+        store.dispatch('provider/loadHotComponents'),
+        store.dispatch('provider/loadFactoriesCount'),
+        store.dispatch('provider/loadAgencyCount'),
+        store.dispatch('loadStoreStatus', { op: 'check' }),
+      ]) : params.type === 'origin' ? Promise.all([
+        store.dispatch('loadBanners', {type: 'origin_banner_carousel'}),
+        store.dispatch('provider/loadSalesStore', { isOriginal: true }),
+        store.dispatch('provider/loadNewStores', { types: 'ORIGINAL_FACTORY', size: 5 }),
+        store.dispatch('provider/loadRecommendOriginal', { types: 'ORIGINAL_FACTORY', num: 5 }),
+        store.dispatch('provider/findSimilarStoreList', { page: 1, count: 10, type: 'ORIGINAL_FACTORY' }),
+        store.dispatch('provider/loadHotComponents'),
+        store.dispatch('provider/loadFactoriesCount'),
+        store.dispatch('provider/loadAgencyCount'),
+        store.dispatch('loadStoreStatus', { op: 'check' }),
+      ]) : []
+    }
+  }
+</script>

+ 3 - 1
pages/provider/shop.vue

@@ -14,7 +14,9 @@ export default {
   layout: 'main',
   fetch ({ store, route }) {
     return Promise.all([
-      store.commit('provider/stores/SET_STORETYPE', 'factory'),
+      // 计数器
+      store.dispatch('loadCounterData'),
+      store.commit('provider/stores/SET_STORETYPE', 'origin'),
       // 店铺
       store.dispatch('loadBanners', {type: 'factory_banner_carousel'}),
       store.dispatch('provider/loadSalesStore', { isOriginal: true }),

+ 1 - 1
pages/supplier/index.vue

@@ -5,7 +5,7 @@
         <article-two></article-two>
       </div>
       <div class="section">
-        <banner/>
+        <!--<banner/>-->
         <!--<carousel>-->
         <!--<kind-category @loadchild="loadProductKinds"></kind-category>-->
         <!--</carousel>-->