Seek.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="seek">
  3. <div class="com-mobile-header mobile-center-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>{{seekTitle}}</p>
  6. <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
  7. </div>
  8. <div class="mobile-fix-content mobile-centerfix-content" id="mobileFixContent">
  9. <div class="seek-title com-switch-item" v-if="userType == 'saler' && seekType == 'wait'">
  10. <span class="mobile-switch-btn" :class="{'active': activeType=='all'}" @click="switchActiveType('all')">公司商机</span>
  11. <span class="mobile-switch-btn" :class="{'active': activeType=='self'}" @click="switchActiveType('self')">我的商机</span>
  12. </div>
  13. <div class="search-content">
  14. <input type="text" v-model="seekKeyword" :placeholder="userType == 'buyer' ? '品牌/型号' : '品牌/类目/型号/规格/公司'" @keyup.13="onSearch">
  15. <span @click="onSearch"><i class="iconfont icon-sousuo"></i></span>
  16. </div>
  17. <seek-list :keyword="remindKeyword" :isSearch="isSearch" :userType="userType" :seekType="seekType" :purchaseManList="purchaseManListData"></seek-list>
  18. <pull-up :fixId="'mobileFixContent'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
  24. import { PullUp, EmptyStatus } from '~components/mobile/common'
  25. import {deepCopy} from '~utils/baseUtils'
  26. export default {
  27. layout: 'mobileNoHeader',
  28. middleware: 'authenticated',
  29. data () {
  30. return {
  31. seekKeyword: '',
  32. purchaseManListData: [],
  33. page: 1,
  34. count: 10,
  35. isChange: false,
  36. isSearch: false,
  37. remindKeyword: '',
  38. activeType: 'all'
  39. }
  40. },
  41. props: ['userType'],
  42. components: {
  43. SeekList,
  44. PullUp,
  45. EmptyStatus
  46. },
  47. watch: {
  48. 'purchase.data': {
  49. handler: function (val) {
  50. let list = deepCopy(val.content || [])
  51. if (this.seekType === 'done' && this.userType === 'saler') {
  52. list.map(val => {
  53. val.quotation = {
  54. replies: val.replies,
  55. vendName: val.vendName,
  56. leadtime: val.leadtime,
  57. user: val.user
  58. }
  59. })
  60. }
  61. if (this.isChange) {
  62. this.purchaseManListData = list
  63. this.isChange = false
  64. } else {
  65. this.purchaseManListData = this.purchaseManListData.concat(list)
  66. }
  67. },
  68. immediate: true
  69. }
  70. },
  71. computed: {
  72. seekType () {
  73. return this.$route.query.seekType
  74. },
  75. purchase () {
  76. return this.$store.state.applyPurchase.purchaseManList.purchaseManList
  77. },
  78. fetching () {
  79. return this.purchase.fetching
  80. },
  81. allPage () {
  82. return Math.floor(this.purchase.data.totalElements / this.purchase.data.size) + Math.floor(this.purchase.data.totalElements % this.purchase.data.size > 0 ? 1 : 0)
  83. },
  84. seekTitle () {
  85. if (this.seekType === 'wait') {
  86. if (this.userType === 'saler') {
  87. return '商机管理'
  88. } else {
  89. return '待报价'
  90. }
  91. } else if (this.seekType === 'done') {
  92. return '已报价'
  93. }
  94. return '已报价'
  95. }
  96. },
  97. methods: {
  98. onSearch: function () {
  99. this.isSearch = true
  100. this.remindKeyword = this.seekKeyword
  101. this.page = 1
  102. this.isChange = true
  103. this.reloadData()
  104. },
  105. reloadData: function () {
  106. this.$emit('reloadAction', this.page, this.count, this.seekKeyword, this.seekType, this.activeType)
  107. },
  108. onPullUpAction: function () {
  109. this.page++
  110. this.reloadData()
  111. },
  112. switchActiveType: function (type) {
  113. this.activeType = type
  114. this.isSearch = false
  115. this.remindKeyword = this.seekKeyword = ''
  116. this.page = 1
  117. this.isChange = true
  118. this.reloadData()
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. .search-content {
  125. text-align: center;
  126. padding: .25rem 0 0 0;
  127. input {
  128. border: 1px solid #376ff3;
  129. width: 7.2rem;
  130. margin: 0 0 0 -.02rem;
  131. }
  132. span {
  133. height: .46rem;
  134. line-height: .46rem;
  135. }
  136. }
  137. $seekTitleLine: .72rem;
  138. .seek-title {
  139. height: $seekTitleLine;
  140. line-height: $seekTitleLine;
  141. .mobile-switch-btn {
  142. /* height: $seekTitleLine;
  143. line-height: $seekTitleLine;*/
  144. font-size: .28rem;
  145. /*&.active {
  146. border-bottom-width: .07rem;
  147. }*/
  148. }
  149. }
  150. </style>