_uuid.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <div class="detail">
  3. <div v-if="componentDetail">
  4. <component-menu/>
  5. <component-detail/>
  6. <store-info/>
  7. </div>
  8. <div v-else>
  9. <error-page :title="'器件'"></error-page>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. import { ComponentMenu, ComponentDetail, StoreInfo } from '~components/product'
  15. import { ErrorPage } from '~components/error'
  16. export default {
  17. // validate({ params, redirect }) {
  18. // window.location.href = '/error'
  19. // },
  20. layout: 'main',
  21. components: {
  22. ComponentMenu,
  23. ComponentDetail,
  24. StoreInfo,
  25. ErrorPage
  26. },
  27. fetch({ store, route }) {
  28. return Promise.all([
  29. store.dispatch('loadComponentDetail', { id: route.params.uuid }),
  30. store.dispatch('loadComponentStore', { uuid: route.params.uuid }),
  31. store.dispatch('loadComponentInformation', {
  32. count: 10,
  33. page: 1,
  34. sorting: { minPriceRMB: 'ASC' },
  35. filter: {
  36. uuid: route.params.uuid,
  37. ignoreUMall: false,
  38. ignoreStore: false,
  39. storeIds: '',
  40. status: 601
  41. }
  42. }),
  43. store.dispatch('getUmallStoreId'),
  44. store.dispatch('product/saveStores'),
  45. store.dispatch('loadStoreStatus', { op: 'check' })
  46. ])
  47. },
  48. computed: {
  49. componentDetail() {
  50. return this.$store.state.componentDetail.detail.data
  51. }
  52. },
  53. mounted() {
  54. this.$nextTick(() => {
  55. // if (!this.$store.state.componentDetail.detail.data) {
  56. // this.$router.replace('/error')
  57. // }
  58. })
  59. }
  60. }
  61. </script>