index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. // validate ({ params }) {
  12. // return false
  13. // },
  14. layout: 'shop',
  15. data () {
  16. return {
  17. uuid: this.$route.params.uuid
  18. }
  19. },
  20. fetch ({ store, params, redirect }) {
  21. if (!params.uuid) {
  22. return redirect('/error')
  23. }
  24. return Promise.all([
  25. store.dispatch('shop/findStoreInfoFromUuid', params),
  26. store.dispatch('shop/findRecommendProducts', params),
  27. store.dispatch('shop/pageCommoditiesOfStore', params.uuid, { page: 1, count: 6 })
  28. ])
  29. },
  30. async asyncData ({ params }) {
  31. // asyncData ({ params }) {
  32. let { data } = await axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  33. // axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  34. // .then(response => {
  35. return { kinds: data }
  36. // })
  37. },
  38. components: {
  39. RecommendProduct,
  40. CommodityList
  41. }
  42. }
  43. </script>
  44. <style>
  45. #nav_fragment .el-dialog__wrapper .el-dialog--tiny{
  46. width: 320px !important;
  47. }
  48. #nav_fragment .el-dialog__wrapper .el-dialog__body{
  49. padding: 14px !important;
  50. }
  51. </style>