Seek.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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>{{seekTitle}}</p>
  6. </div>
  7. <div class="mobile-fix-content" id="mobileFixContent">
  8. <div class="search-content">
  9. <input type="text" v-model="seekKeyword" :placeholder="`型号/品牌${userType == 'buyer' ? '' : '/类目/规格/公司'}`" @keyup.13="onSearch">
  10. <span @click="onSearch"><i class="iconfont icon-sousuo"></i></span>
  11. </div>
  12. <seek-list :keyword="remindKeyword" :isSearch="isSearch" :userType="userType" :seekType="seekType" :purchaseManList="purchaseManListData"></seek-list>
  13. <pull-up :fixId="'mobileFixContent'" :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, EmptyStatus } 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. isSearch: false,
  31. remindKeyword: ''
  32. }
  33. },
  34. props: ['userType'],
  35. components: {
  36. SeekList,
  37. PullUp,
  38. EmptyStatus
  39. },
  40. watch: {
  41. 'purchase.data': {
  42. handler: function (val) {
  43. let list = val.content ? val.content.slice() : []
  44. if (this.isChange) {
  45. this.purchaseManListData = list
  46. this.isChange = false
  47. } else {
  48. this.purchaseManListData = this.purchaseManListData.concat(list)
  49. }
  50. },
  51. immediate: true
  52. }
  53. },
  54. computed: {
  55. seekType () {
  56. return this.$route.query.seekType
  57. },
  58. purchase () {
  59. return this.$store.state.applyPurchase.purchaseManList.purchaseManList
  60. },
  61. fetching () {
  62. return this.purchase.fetching
  63. },
  64. allPage () {
  65. return Math.floor(this.purchase.data.totalElements / this.purchase.data.size) + Math.floor(this.purchase.data.totalElements % this.purchase.data.size > 0 ? 1 : 0)
  66. },
  67. seekTitle () {
  68. if (this.seekType === 'wait') {
  69. if (this.userType === 'saler') {
  70. return '我的商机'
  71. } else {
  72. return '待报价'
  73. }
  74. } else if (this.seekType === 'done') {
  75. return '已报价'
  76. }
  77. return '已报价'
  78. }
  79. },
  80. methods: {
  81. onSearch: function () {
  82. this.isSearch = true
  83. this.remindKeyword = this.seekKeyword
  84. this.page = 1
  85. this.isChange = true
  86. this.reloadData()
  87. },
  88. reloadData: function () {
  89. this.$emit('reloadAction', this.page, this.count, this.seekKeyword, this.seekType)
  90. },
  91. onPullUpAction: function () {
  92. this.page++
  93. this.reloadData()
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .search-content {
  100. text-align: center;
  101. padding: .25rem 0 0 0;
  102. input {
  103. border: 1px solid #376ff3;
  104. }
  105. span {
  106. height: .46rem;
  107. line-height: .46rem;
  108. }
  109. }
  110. </style>