index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. return context.store.state.option.isMobile ? 'mobile' : 'main'
  30. },
  31. data () {
  32. return {
  33. isOpen: false,
  34. hasNewYear: false,
  35. defaultFloorsData: [
  36. // 'BT2018012500000141',
  37. // 'BT2018012500000126',
  38. // 'BT2018012500000131',
  39. // 'BT2018012500000152',
  40. // 'BT2018012500000124',
  41. // 'BT2018012500000164',
  42. // 'BT2018012500000167',
  43. // 'BT2018012500000145',
  44. // 'BT2018012500000151',
  45. // 'BT2018012500000161',
  46. // 'BT2018012500000149',
  47. // 'BT2018012500000162'
  48. 'BT2018012900002056',
  49. 'BT2018012900002056',
  50. 'BT2018012900002056',
  51. 'BT2018012900002056',
  52. 'BT2018012900002056',
  53. 'BT2018012900002056',
  54. 'BT2018012900002056',
  55. 'BT2018012900002056',
  56. 'BT2018012900002056',
  57. 'BT2018012900002056',
  58. 'BT2018012900002056',
  59. 'BT2018012900002056'
  60. ]
  61. }
  62. },
  63. components: {
  64. KindCategory,
  65. displayCard,
  66. Carousel,
  67. Advert,
  68. FloorList,
  69. Partner,
  70. News,
  71. // Christmas,
  72. // NewYear,
  73. Home
  74. },
  75. fetch ({store}) {
  76. let today = new Date()
  77. let nowYear = today.getFullYear()
  78. let nowMonth = today.getMonth() + 1
  79. let LastMonth = today.getMonth()
  80. return !store.state.option.isMobile ? Promise.all([
  81. store.dispatch('loadFloors'),
  82. store.dispatch('loadBanners', {type: 'home'}),
  83. store.dispatch('loadProductKinds', { id: 0 }),
  84. store.dispatch('loadNewsSnapshot', { page: 1, pageSize: 10 }),
  85. store.dispatch('supplier/loadVendorAll', {page: 1, size: 20}),
  86. store.dispatch('loadAllCount', {_status: 'actived', usedFor: 'mall_home_banner'}),
  87. store.dispatch('loadInquirySheet', {year: nowYear, month: nowMonth}),
  88. store.dispatch('loadInquirySheetLast', {year: nowYear, month: LastMonth}),
  89. store.dispatch('loadBatchCommodities', {batchCodeList: store.state.option.url === 'http://www.usoftmall.com' ? [
  90. 'BT2018013000000043',
  91. 'BT2018013000000026',
  92. 'BT2018013000000030',
  93. 'BT2018013000000052',
  94. 'BT2018013000000025',
  95. 'BT2018013000000053',
  96. 'BT2018013000000033',
  97. 'BT2018013000000047',
  98. 'BT2018013000000057',
  99. 'BT2018013000000048',
  100. 'BT2018013000000051',
  101. 'BT2018013000000020'] : [
  102. 'BT2018012900002056',
  103. 'BT2018012900002056',
  104. 'BT2018012900002056',
  105. 'BT2018012900002056',
  106. 'BT2018012900002056',
  107. 'BT2018012900002056',
  108. 'BT2018012900002056',
  109. 'BT2018012900002056',
  110. 'BT2018012900002056',
  111. 'BT2018012900002056',
  112. 'BT2018012900002056',
  113. 'BT2018012900002056']
  114. }),
  115. store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 50, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null}),
  116. store.dispatch('loadStoreStatus', { op: 'check' })
  117. ]) : Promise.all([
  118. store.dispatch('supplier/loadVendorAll', {page: 1, size: 20}),
  119. store.dispatch('loadAllCount', {_status: 'actived', usedFor: 'mall_home_banner'}),
  120. store.dispatch('loadInquirySheet', {year: nowYear, month: nowMonth}),
  121. store.dispatch('loadInquirySheetLast', {year: nowYear, month: LastMonth}),
  122. store.dispatch('applyPurchase/loadMobileHomeList', {pageNumber: 1, pageSize: 5, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
  123. ])
  124. },
  125. computed: {
  126. user () {
  127. return this.$store.state.option.user
  128. },
  129. isMobile: function () {
  130. return this.$store.state.option.isMobile
  131. }
  132. },
  133. methods: {
  134. listenOpen () {
  135. this.isOpen = false
  136. },
  137. loadProductKinds (id) {
  138. this.$store.dispatch('loadAllProductKinds', {id})
  139. }
  140. }
  141. }
  142. </script>