businessOpportunity.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="mobile-content">
  3. <div class="mobile-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <div class="search-content">
  6. <input type="text" v-model="seekKeyword" placeholder="品牌/类目/型号/规格/公司" @keyup.13="searchSeek">
  7. <span @click="searchSeek">
  8. <i class="iconfont icon-sousuo"></i>
  9. </span>
  10. </div>
  11. </div>
  12. <div class="seek-title">
  13. <img src="/images/mobile/@2x/applyPurchase/opportunity.png" alt="">
  14. <span>我的商机</span>
  15. </div>
  16. <seek-list v-if="purchaseManListData && purchaseManListData.length" :purchaseManList="purchaseManListData" :isDataChange="isDataChange"></seek-list>
  17. <empty-status :type="isSearch ? 'search' : 'collect'"
  18. :text="isSearch ? `抱歉,暂无与“${remindKeyword}”匹配的求购信息`: '上传物料至个人物料库,可获得更多的商机哦!'"
  19. :showLink="true"
  20. v-else
  21. ></empty-status>
  22. <loading v-show="isSearchSearchingMore"></loading>
  23. <div v-if="purchaseManList && false"></div>
  24. </div>
  25. </template>
  26. <script>
  27. import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
  28. import {Loading, EmptyStatus} from '~components/mobile/common'
  29. export default {
  30. layout: 'mobile',
  31. middleware: 'authenticated',
  32. components: {
  33. SeekList,
  34. Loading,
  35. EmptyStatus
  36. },
  37. data () {
  38. return {
  39. isSearchSearchingMore: false,
  40. page: 1,
  41. size: 10,
  42. purchaseManListData: [],
  43. showSeekSearch: true,
  44. seekKeyword: '',
  45. isChange: false,
  46. isDataChange: false,
  47. isSearch: false,
  48. remindKeyword: ''
  49. }
  50. },
  51. mounted: function () {
  52. this.$nextTick(() => {
  53. localStorage.removeItem('RETURNURL')
  54. window.addEventListener('scroll', this.scroll, false)
  55. })
  56. },
  57. // watch: {
  58. // $route: function (val, oldVal) {
  59. // window.removeEventListener('scroll', this.scroll, false)
  60. // }
  61. // },
  62. fetch ({store}) {
  63. return Promise.all([
  64. store.dispatch('applyPurchase/loadVendorPushList', {pageNumber: 1, pageSize: 10, sorting: {'releaseDate': 'DESC'}, enuu: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null, useruu: store.state.option.user.data.userUU})
  65. ])
  66. },
  67. computed: {
  68. purchaseManList () {
  69. let list = this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  70. if (this.isChange) {
  71. this.purchaseManListData = []
  72. this.seekPage = 1
  73. this.isChange = false
  74. this.isDataChange = true
  75. } else {
  76. this.purchaseManListData = this.purchaseManListData.concat(list.content || [])
  77. this.isSearchSearchingMore = false
  78. this.isDataChange = false
  79. }
  80. return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  81. },
  82. allPage () {
  83. return Math.floor(this.purchaseManList.totalElements / this.purchaseManList.size) + Math.floor(this.purchaseManList.totalElements % this.purchaseManList.size > 0 ? 1 : 0)
  84. }
  85. },
  86. methods: {
  87. scroll: function () {
  88. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  89. if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchSearchingMore && this.page < this.allPage) {
  90. this.getMoreSearch()
  91. }
  92. },
  93. // blur: function() {
  94. // // setTimeout(() => {
  95. // this.$store.dispatch('mobile/SetInputGetFocus', false)
  96. // // }, 300)
  97. // },
  98. // inputGetFocus: function() {
  99. // setTimeout(() => {
  100. // this.$store.dispatch('mobile/SetInputGetFocus', true)
  101. // }, 300)
  102. // },
  103. getMoreSearch: function () {
  104. this.page++
  105. this.isSearchSearchingMore = true
  106. this.reloadData()
  107. },
  108. reloadData: function () {
  109. this.$store.dispatch('applyPurchase/loadVendorPushList', {pageNumber: this.page, pageSize: this.size, sorting: {'releaseDate': 'DESC'}, keyword: this.seekKeyword, enuu: this.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, useruu: this.user.data.userUU})
  110. },
  111. searchSeek: function () {
  112. this.isSearch = true
  113. this.remindKeyword = this.seekKeyword
  114. this.page = 1
  115. this.isChange = true
  116. this.reloadData()
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .mobile-content {
  123. .mobile-header {
  124. position: fixed;
  125. top: 0;
  126. z-index: 10;
  127. width:100%;
  128. height:.88rem;
  129. line-height: .88rem;
  130. background: #3e82f5;
  131. padding:0 .2rem 0 .1rem;
  132. color:#fff;
  133. > a {
  134. font-size:.28rem;
  135. color:#fff;
  136. position: absolute;
  137. i {
  138. font-size: .48rem;
  139. margin-right: -.1rem;
  140. }
  141. }
  142. .search-content {
  143. margin-left: .5rem;
  144. line-height: normal;
  145. padding-top: .14rem;
  146. input {
  147. color: #333;
  148. width: 6.48rem;
  149. line-height: normal;
  150. }
  151. span {
  152. height: .46rem;
  153. line-height: .46rem;
  154. }
  155. }
  156. }
  157. }
  158. </style>