Seek.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div class="seek">
  3. <div class="com-mobile-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>{{seekType === 'wait' ? '待报价' : '已报价'}}</p>
  6. </div>
  7. <div class="mobile-content">
  8. <div class="search-content">
  9. <input type="text" v-model="seekKeyword" placeholder="型号/品牌/类目/规格/公司" @keyup.13="onSearch">
  10. <span @click="onSearch"><i class="iconfont icon-sousuo"></i></span>
  11. </div>
  12. <seek-list :userType="userType" :seekType="seekType" :purchaseManList="purchaseManListData"></seek-list>
  13. <pull-up :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
  19. import { PullUp } from '~components/mobile/common'
  20. export default {
  21. layout: 'mobileNoHeader',
  22. middleware: 'authenticated',
  23. data () {
  24. return {
  25. seekKeyword: '',
  26. purchaseManListData: [],
  27. page: 1,
  28. count: 10,
  29. isChange: false
  30. }
  31. },
  32. props: ['userType'],
  33. components: {
  34. SeekList,
  35. PullUp
  36. },
  37. watch: {
  38. 'purchase.data': {
  39. handler: function (val) {
  40. let list = val.content ? val.content.slice() : []
  41. if (this.isChange) {
  42. this.purchaseManListData = list
  43. this.isChange = false
  44. } else {
  45. this.purchaseManListData = this.purchaseManListData.concat(list)
  46. }
  47. },
  48. immediate: true
  49. }
  50. },
  51. computed: {
  52. seekType () {
  53. return this.$route.query.seekType
  54. },
  55. purchase () {
  56. return this.$store.state.applyPurchase.purchaseManList.purchaseManList
  57. },
  58. fetching () {
  59. return this.purchase.fetching
  60. },
  61. allPage () {
  62. return Math.floor(this.purchase.data.totalElements / this.purchase.data.size) + Math.floor(this.purchase.data.totalElements % this.purchase.data.size > 0 ? 1 : 0)
  63. }
  64. },
  65. methods: {
  66. onSearch: function () {
  67. this.page = 1
  68. this.isChange = true
  69. this.reloadData()
  70. },
  71. reloadData: function () {
  72. this.$emit('reloadAction', this.page, this.count, this.seekKeyword, this.seekType)
  73. },
  74. onPullUpAction: function () {
  75. this.page++
  76. this.reloadData()
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .search-content {
  83. text-align: center;
  84. padding: .25rem 0 0 0;
  85. input {
  86. border: 1px solid #376ff3;
  87. }
  88. span {
  89. height: .46rem;
  90. line-height: .46rem;
  91. }
  92. }
  93. </style>