index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <div class="index">
  3. <div v-if="isMobile">
  4. <Home></Home>
  5. </div>
  6. <div v-if="!isMobile">
  7. <!-- <christmas v-if="isOpen" @listenopen="listenOpen" :hasNewYear="hasNewYear"></christmas>-->
  8. <!-- <new-year></new-year>-->
  9. <carousel>
  10. <kind-category @loadchild="loadProductKinds"></kind-category>
  11. <display-card></display-card>
  12. </carousel>
  13. <advert></advert>
  14. <floor-list></floor-list>
  15. <img class="banner-img" src="/images/all/banner-home2.jpg" style="margin: 44px auto 24px;" alt="">
  16. <news></news>
  17. <partner></partner>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import { KindCategory, displayCard, Carousel, Advert, FloorList, Partner, News } from '~components/home'
  23. // import { Christmas, NewYear } from '~components/default'
  24. import { Home } from '~components/mobile'
  25. export default {
  26. name: 'index',
  27. // middleware: 'wechatInfo',
  28. layout (context) {
  29. // console.log(context.store.state.option.isMobile)
  30. return context.store.state.option.isMobile ? 'mobile' : 'main'
  31. },
  32. data () {
  33. return {
  34. isOpen: false,
  35. hasNewYear: false,
  36. defaultFloorsData: [
  37. // 'BT2018012500000141',
  38. // 'BT2018012500000126',
  39. // 'BT2018012500000131',
  40. // 'BT2018012500000152',
  41. // 'BT2018012500000124',
  42. // 'BT2018012500000164',
  43. // 'BT2018012500000167',
  44. // 'BT2018012500000145',
  45. // 'BT2018012500000151',
  46. // 'BT2018012500000161',
  47. // 'BT2018012500000149',
  48. // 'BT2018012500000162'
  49. 'BT2018012900002056',
  50. 'BT2018012900002056',
  51. 'BT2018012900002056',
  52. 'BT2018012900002056',
  53. 'BT2018012900002056',
  54. 'BT2018012900002056',
  55. 'BT2018012900002056',
  56. 'BT2018012900002056',
  57. 'BT2018012900002056',
  58. 'BT2018012900002056',
  59. 'BT2018012900002056',
  60. 'BT2018012900002056'
  61. ]
  62. }
  63. },
  64. components: {
  65. KindCategory,
  66. displayCard,
  67. Carousel,
  68. Advert,
  69. FloorList,
  70. Partner,
  71. News,
  72. // Christmas,
  73. // NewYear,
  74. Home
  75. },
  76. fetch ({store}) {
  77. let today = new Date()
  78. let nowYear = today.getFullYear()
  79. let nowMonth = today.getMonth() + 1
  80. let LastMonth = today.getMonth()
  81. return !store.state.option.isMobile ? Promise.all([
  82. store.dispatch('loadFloors'),
  83. store.dispatch('loadBanners', {type: 'home'}),
  84. store.dispatch('loadProductKinds', { id: 0 }),
  85. store.dispatch('loadNewsSnapshot', { page: 1, pageSize: 10 }),
  86. store.dispatch('supplier/loadVendorAll', {page: 1, size: 20}),
  87. store.dispatch('loadAllCount', {_status: 'actived', usedFor: 'mall_home_banner'}),
  88. store.dispatch('loadInquirySheet', {year: nowYear, month: nowMonth}),
  89. store.dispatch('loadInquirySheetLast', {year: nowYear, month: LastMonth}),
  90. store.dispatch('loadBatchCommodities', {batchCodeList: store.state.option.url === 'http://www.usoftmall.com' ? [
  91. 'BT2018013000000043',
  92. 'BT2018013000000026',
  93. 'BT2018013000000030',
  94. 'BT2018013000000052',
  95. 'BT2018013000000025',
  96. 'BT2018013000000053',
  97. 'BT2018013000000033',
  98. 'BT2018013000000047',
  99. 'BT2018013000000057',
  100. 'BT2018013000000048',
  101. 'BT2018013000000051',
  102. 'BT2018013000000020'] : [
  103. 'BT2018012900002056',
  104. 'BT2018012900002056',
  105. 'BT2018012900002056',
  106. 'BT2018012900002056',
  107. 'BT2018012900002056',
  108. 'BT2018012900002056',
  109. 'BT2018012900002056',
  110. 'BT2018012900002056',
  111. 'BT2018012900002056',
  112. 'BT2018012900002056',
  113. 'BT2018012900002056',
  114. 'BT2018012900002056']
  115. }),
  116. store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 50, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null}),
  117. store.dispatch('loadStoreStatus', { op: 'check' })
  118. ]) : Promise.all([
  119. store.dispatch('supplier/loadVendorAll', {page: 1, size: 20}),
  120. store.dispatch('loadAllCount', {_status: 'actived', usedFor: 'mall_home_banner'}),
  121. store.dispatch('loadInquirySheet', {year: nowYear, month: nowMonth}),
  122. store.dispatch('loadInquirySheetLast', {year: nowYear, month: LastMonth}),
  123. store.dispatch('provider/findStoreListInMobil', {page: 1, count: 10, type: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT', keyword: ''}),
  124. store.dispatch('applyPurchase/loadMobileHomeList', {pageNumber: 1, pageSize: 5, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
  125. ])
  126. },
  127. computed: {
  128. user () {
  129. return this.$store.state.option.user
  130. },
  131. isMobile: function () {
  132. return this.$store.state.option.isMobile
  133. }
  134. },
  135. methods: {
  136. listenOpen () {
  137. this.isOpen = false
  138. },
  139. loadProductKinds (id) {
  140. this.$store.dispatch('loadAllProductKinds', {id})
  141. }
  142. }
  143. }
  144. </script>