<template>
  <!-- 组件模板只能包含一个根元素，除非使用v-if 和 v-if-else -->
  <div>
    <!-- 轮播及店铺推荐 -->
    <recommend-store/>

    <recommendStore-show/>
  </div>
</template>
<script>
import { RecommendStore, RecommendStoreShow } from '~components/provider'

export default {
  layout: 'main',
  fetch ({ store, route }) {
    return Promise.all([
      store.commit('provider/stores/SET_STORETYPE', 'factory'),
      // 店铺
      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' }),
      // 供应商
      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}),
      // 品牌
      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.params.initial, 'page': 1, 'count': 60, 'keyword': ''})
    ])
  },
  components: {
    RecommendStore,
    RecommendStoreShow
  },
  data () {
    return {
      msg: 'hello vue'
    }
  }
}
</script>
<style scoped lang="scss">
  div{
    background: #f2f1f1;
  }
</style>
