Seek.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. mounted () {
  98. // 获取链接
  99. this.$nextTick(() => {
  100. this.myActiveType()
  101. })
  102. },
  103. methods: {
  104. onSearch: function () {
  105. this.isSearch = true
  106. this.remindKeyword = this.seekKeyword
  107. this.page = 1
  108. this.isChange = true
  109. this.reloadData()
  110. },
  111. reloadData: function () {
  112. this.$emit('reloadAction', this.page, this.count, this.seekKeyword, this.seekType, this.activeType)
  113. },
  114. onPullUpAction: function () {
  115. this.page++
  116. this.reloadData()
  117. },
  118. switchActiveType: function (type) {
  119. this.activeType = type
  120. this.isSearch = false
  121. this.remindKeyword = this.seekKeyword = ''
  122. this.page = 1
  123. this.isChange = true
  124. this.reloadData()
  125. },
  126. myActiveType: function () {
  127. if (this.$store.state.option.messageType) {
  128. this.activeType = 'self'
  129. } else {
  130. this.activeType = 'all'
  131. }
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .search-content {
  138. text-align: center;
  139. padding: .25rem 0 0 0;
  140. input {
  141. border: 1px solid #376ff3;
  142. width: 7.2rem;
  143. margin: 0 0 0 -.02rem;
  144. }
  145. span {
  146. height: .46rem;
  147. line-height: .46rem;
  148. }
  149. }
  150. $seekTitleLine: .72rem;
  151. .seek-title {
  152. height: $seekTitleLine;
  153. line-height: $seekTitleLine;
  154. .mobile-switch-btn {
  155. /* height: $seekTitleLine;
  156. line-height: $seekTitleLine;*/
  157. font-size: .28rem;
  158. /*&.active {
  159. border-bottom-width: .07rem;
  160. }*/
  161. }
  162. }
  163. </style>