index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!--<template>
  2. <div class="container">
  3. <div v-if="!storeInfoStore.id">
  4. <recommend-product/>
  5. <commodity-list :kinds="kinds"/>
  6. </div>
  7. <div v-else>
  8. <error-page :title="'店铺'"></error-page>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import axios from '~plugins/axios'
  14. import { CommodityList, RecommendProduct } from '~components/store'
  15. import { ErrorPage } from '~components/error'
  16. export default {
  17. // validate ({ params }) {
  18. // return false
  19. // },
  20. layout: 'shop',
  21. data () {
  22. return {
  23. uuid: this.$route.params.uuid
  24. }
  25. },
  26. fetch ({ store, params, redirect }) {
  27. if (!params.uuid) {
  28. return redirect('/error')
  29. }
  30. return Promise.all([
  31. store.dispatch('shop/findStoreInfoFromUuid', params),
  32. store.dispatch('shop/findRecommendProducts', params),
  33. store.dispatch('shop/pageCommoditiesOfStore', params.uuid, { page: 1, count: 6 }),
  34. store.dispatch('loadStoreStatus', { op: 'check' })
  35. ])
  36. },
  37. async asyncData ({ params }) {
  38. // asyncData ({ params }) {
  39. let { data } = await axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  40. // axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  41. // .then(response => {
  42. return { kinds: data }
  43. // })
  44. },
  45. components: {
  46. RecommendProduct,
  47. CommodityList,
  48. ErrorPage
  49. },
  50. computed: {
  51. storeInfoStore() {
  52. return this.$store.state.shop.storeInfo.store.data
  53. }
  54. }
  55. }
  56. </script>
  57. <style>
  58. #nav_fragment .el-dialog__wrapper .el-dialog&#45;&#45;tiny{
  59. width: 320px !important;
  60. }
  61. #nav_fragment .el-dialog__wrapper .el-dialog__body{
  62. padding: 14px !important;
  63. }
  64. </style>-->
  65. <template>
  66. <div>
  67. <div class="store-banner">
  68. <store-banner></store-banner>
  69. </div>
  70. <enterprise-info></enterprise-info>
  71. <!--<recommend-list></recommend-list>-->
  72. <!--<certificate></certificate>-->
  73. </div>
  74. </template>
  75. <script>
  76. // import axios from '~plugins/axios'
  77. import { EnterpriseInfo, StoreBanner } from '~components/store'
  78. export default {
  79. layout: 'main',
  80. data () {
  81. return {
  82. uuid: this.$route.params.uuid
  83. }
  84. },
  85. computed: {
  86. storeInfo () {
  87. return this.$store.state.shop.storeInfo.store.data
  88. },
  89. isConsignment () {
  90. return this.storeInfo.type === 'CONSIGNMENT'
  91. }
  92. },
  93. fetch ({ store, params, redirect }) {
  94. if (!params.uuid) {
  95. return redirect('/error')
  96. }
  97. return Promise.all([
  98. store.dispatch('pcb/getPcbKinds', {parentId: 3825}),
  99. store.dispatch('shop/findStoreInfoFromUuid', params),
  100. store.dispatch('shop/findRecommendProducts', params),
  101. store.dispatch('shop/pageCommoditiesOfStore', params.uuid, { page: 1, count: 10 }),
  102. store.dispatch('loadStoreStatus', { op: 'check' })
  103. ])
  104. },
  105. // async asyncData ({ params }) {
  106. // let { data } = await axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  107. // return { kinds: data }
  108. // },
  109. components: {
  110. // Certificate,
  111. EnterpriseInfo,
  112. StoreBanner
  113. // RecommendList
  114. }
  115. }
  116. </script>
  117. <style>
  118. #nav_fragment .el-dialog__wrapper .el-dialog--tiny{
  119. width: 320px !important;
  120. }
  121. #nav_fragment .el-dialog__wrapper .el-dialog__body{
  122. padding: 14px !important;
  123. }
  124. .store-banner{
  125. min-width: 1190px;
  126. background: #ece9ec;
  127. padding-top: 20px;
  128. }
  129. </style>