index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <div class="container">
  3. <recommend-product/>
  4. <commodity-list :kinds="kinds"/>
  5. </div>
  6. </template>
  7. <script>
  8. import axios from '~plugins/axios'
  9. import { CommodityList, RecommendProduct } from '~components/store'
  10. export default {
  11. layout: 'shop',
  12. data () {
  13. return {
  14. uuid: this.$route.params.uuid
  15. }
  16. },
  17. fetch ({ store, params, redirect }) {
  18. if (!params.uuid) {
  19. return redirect('/error')
  20. }
  21. return Promise.all([
  22. store.dispatch('shop/findStoreInfoFromUuid', params),
  23. store.dispatch('shop/findRecommendProducts', params),
  24. store.dispatch('shop/pageCommoditiesOfStore', params.uuid, { page: 1, count: 6 })
  25. ])
  26. },
  27. async asyncData ({ params }) {
  28. // asyncData ({ params }) {
  29. let { data } = await axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  30. // axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  31. // .then(response => {
  32. return { kinds: data }
  33. // })
  34. },
  35. components: {
  36. RecommendProduct,
  37. CommodityList
  38. }
  39. }
  40. </script>
  41. <style>
  42. #nav_fragment .el-dialog__wrapper .el-dialog--tiny{
  43. width: 320px !important;
  44. }
  45. #nav_fragment .el-dialog__wrapper .el-dialog__body{
  46. padding: 14px !important;
  47. }
  48. </style>