_keyword.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <div class="container" id="searchResult">
  3. <search-title :keyword="key" @showAction="showAction" @typeAction="onTypeChanged"></search-title>
  4. <store-content v-show="show" @pageAction="onPageChanged"></store-content>
  5. </div>
  6. </template>
  7. <script>
  8. import { SearchTitle, StoreContent } from '~components/searchStore'
  9. export default {
  10. layout: 'main',
  11. components: {
  12. SearchTitle,
  13. StoreContent
  14. },
  15. data () {
  16. return {
  17. key: this.$route.query.w,
  18. show: true,
  19. type: 'AGENCY-DISTRIBUTION-ORIGINAL_FACTORY'
  20. }
  21. },
  22. watch: {
  23. '$route.query.w': {
  24. handler: function (val) {
  25. this.key = val
  26. this.reloadAll()
  27. },
  28. immediate: false
  29. }
  30. },
  31. fetch ({store, route}) {
  32. return Promise.all([
  33. store.dispatch('searchStore/searchStoreDetail', {page: 1, count: 8, keyword: route.query.w, types: 'AGENCY-DISTRIBUTION-ORIGINAL_FACTORY', op: 'pageByType'})
  34. ])
  35. },
  36. methods: {
  37. reloadAll: function () {
  38. this.types = 'AGENCY-DISTRIBUTION-ORIGINAL_FACTORY'
  39. this.$store.dispatch('searchStore/searchStoreDetail', {page: 1, count: 8, keyword: this.key, types: 'AGENCY-DISTRIBUTION-ORIGINAL_FACTORY', op: 'pageByType'})
  40. },
  41. showAction: function (show) {
  42. this.show = show
  43. },
  44. onPageChanged: function (page) {
  45. this.$store.dispatch('searchStore/searchStoreDetail', {page: page, count: 8, keyword: this.$route.query.w, types: this.type, op: 'pageByType'})
  46. },
  47. onTypeChanged: function (type) {
  48. this.type = type
  49. }
  50. }
  51. }
  52. </script>
  53. <style>
  54. #search-store-content .el-dialog--tiny{
  55. width: 320px !important;
  56. }
  57. #search-store-content .el-dialog__body{
  58. padding: 12px !important;
  59. }
  60. </style>