index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. </carousel>
  12. <advert></advert>
  13. <floor-list></floor-list>
  14. <img class="banner-img" src="/images/all/banner-home2.jpg" style="margin: 44px auto 24px;" alt="">
  15. <news></news>
  16. <partner></partner>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import { KindCategory, Carousel, Advert, FloorList, Partner, News } from '~components/home'
  22. import { Christmas, NewYear } from '~components/default'
  23. import { Home } from '~components/mobile'
  24. export default {
  25. name: 'index',
  26. layout (context) {
  27. return context.store.state.option.isMobile ? 'mobile' : 'main'
  28. },
  29. data () {
  30. return {
  31. isOpen: false,
  32. hasNewYear: false,
  33. defaultFloorsData: [
  34. // 'BT2018012500000141',
  35. // 'BT2018012500000126',
  36. // 'BT2018012500000131',
  37. // 'BT2018012500000152',
  38. // 'BT2018012500000124',
  39. // 'BT2018012500000164',
  40. // 'BT2018012500000167',
  41. // 'BT2018012500000145',
  42. // 'BT2018012500000151',
  43. // 'BT2018012500000161',
  44. // 'BT2018012500000149',
  45. // 'BT2018012500000162'
  46. 'BT2018012900002056',
  47. 'BT2018012900002056',
  48. 'BT2018012900002056',
  49. 'BT2018012900002056',
  50. 'BT2018012900002056',
  51. 'BT2018012900002056',
  52. 'BT2018012900002056',
  53. 'BT2018012900002056',
  54. 'BT2018012900002056',
  55. 'BT2018012900002056',
  56. 'BT2018012900002056',
  57. 'BT2018012900002056'
  58. ]
  59. }
  60. },
  61. components: {
  62. KindCategory,
  63. Carousel,
  64. Advert,
  65. FloorList,
  66. Partner,
  67. News,
  68. Christmas,
  69. NewYear,
  70. Home
  71. },
  72. fetch ({store}) {
  73. return !store.state.option.isMobile ? Promise.all([
  74. store.dispatch('loadFloors'),
  75. store.dispatch('loadBanners', {type: 'home'}),
  76. store.dispatch('loadProductKinds', { id: 0 }),
  77. store.dispatch('loadNewsSnapshot', { page: 1, pageSize: 10 }),
  78. store.dispatch('loadBatchCommodities', {batchCodeList: store.state.option.url === 'http://www.usoftmall.com' ? [
  79. 'BT2018013000000043',
  80. 'BT2018013000000026',
  81. 'BT2018013000000030',
  82. 'BT2018013000000052',
  83. 'BT2018013000000025',
  84. 'BT2018013000000053',
  85. 'BT2018013000000033',
  86. 'BT2018013000000047',
  87. 'BT2018013000000057',
  88. 'BT2018013000000048',
  89. 'BT2018013000000051',
  90. 'BT2018013000000020'] : [
  91. 'BT2018012900002056',
  92. 'BT2018012900002056',
  93. 'BT2018012900002056',
  94. 'BT2018012900002056',
  95. 'BT2018012900002056',
  96. 'BT2018012900002056',
  97. 'BT2018012900002056',
  98. 'BT2018012900002056',
  99. 'BT2018012900002056',
  100. 'BT2018012900002056',
  101. 'BT2018012900002056',
  102. 'BT2018012900002056']
  103. }),
  104. store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 50, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null}),
  105. store.dispatch('loadStoreStatus', { op: 'check' })
  106. ]) : []
  107. },
  108. computed: {
  109. user () {
  110. return this.$store.state.option.user
  111. },
  112. isMobile: function () {
  113. return this.$store.state.option.isMobile
  114. }
  115. },
  116. methods: {
  117. listenOpen () {
  118. this.isOpen = false
  119. },
  120. loadProductKinds (id) {
  121. this.$store.dispatch('loadAllProductKinds', {id})
  122. }
  123. }
  124. }
  125. </script>