Seek.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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="product-switch-item" v-if="userType == 'buyer'">
  14. <span :class="overdue==='attention'?'mobile-switch-btn active':'mobile-switch-btn'" @click="ChangeTab('attention')">未截止</span>
  15. <span :class="overdue==='isattention'?'mobile-switch-btn active':'mobile-switch-btn'" @click="ChangeTab('isattention')">已截止</span>
  16. </div>
  17. <div class="search-content">
  18. <input type="text" v-model="seekKeyword" :placeholder="userType == 'buyer' ? '品牌/型号' : '品牌/物料名称/型号/规格/公司'" @keyup.13="onSearch">
  19. <span @click="onSearch"><i class="iconfont icon-sousuo"></i></span>
  20. </div>
  21. <seek-list :keyword="remindKeyword" :isSearch="isSearch" :userType="userType" :seekType="seekType" :purchaseManList="purchaseManListData"></seek-list>
  22. <pull-up :fixId="'mobileFixContent'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
  28. import { PullUp, EmptyStatus } from '~components/mobile/common'
  29. export default {
  30. layout: 'mobileNoHeader',
  31. middleware: 'authenticated',
  32. data () {
  33. return {
  34. seekKeyword: '',
  35. purchaseManListData: [],
  36. page: 1,
  37. count: 10,
  38. isChange: false,
  39. isSearch: false,
  40. remindKeyword: '',
  41. activeType: 'all',
  42. overdue: 'attention'
  43. }
  44. },
  45. props: ['userType'],
  46. components: {
  47. SeekList,
  48. PullUp,
  49. EmptyStatus
  50. },
  51. watch: {
  52. 'purchase.data': {
  53. handler: function (val) {
  54. let list = this.baseUtils.deepCopy(val.content || [])
  55. if (this.seekType === 'done' && this.userType === 'saler') {
  56. list.map(val => {
  57. val.quotation = {
  58. replies: val.replies,
  59. vendName: val.vendName,
  60. leadtime: val.leadtime,
  61. user: val.user
  62. }
  63. })
  64. }
  65. if (this.isChange) {
  66. this.purchaseManListData = list
  67. this.isChange = false
  68. } else {
  69. this.purchaseManListData = this.purchaseManListData.concat(list)
  70. }
  71. },
  72. immediate: true
  73. }
  74. },
  75. computed: {
  76. seekType () {
  77. return this.$route.query.seekType
  78. },
  79. purchase () {
  80. return this.$store.state.applyPurchase.purchaseManList.purchaseManList
  81. },
  82. fetching () {
  83. return this.purchase.fetching
  84. },
  85. allPage () {
  86. return Math.floor(this.purchase.data.totalElements / this.purchase.data.size) + Math.floor(this.purchase.data.totalElements % this.purchase.data.size > 0 ? 1 : 0)
  87. },
  88. seekTitle () {
  89. if (this.seekType === 'wait') {
  90. if (this.userType === 'saler') {
  91. return '商机管理'
  92. } else {
  93. return '待报价'
  94. }
  95. } else if (this.seekType === 'done') {
  96. return '已报价'
  97. }
  98. return '已报价'
  99. }
  100. },
  101. mounted () {
  102. // 获取链接
  103. this.$nextTick(() => {
  104. this.myActiveType()
  105. })
  106. },
  107. methods: {
  108. ChangeTab(a) {
  109. this.overdue = a
  110. this.page = 1
  111. this.remindKeyword = this.seekKeyword = ''
  112. this.isChange = true
  113. this.reloadData()
  114. },
  115. onSearch: function () {
  116. this.isSearch = true
  117. this.remindKeyword = this.seekKeyword
  118. this.page = 1
  119. this.isChange = true
  120. this.reloadData()
  121. },
  122. reloadData: function () {
  123. let overdue = this.overdue === 'attention' ? '0' : '1'
  124. this.$emit('reloadAction', this.page, this.count, this.seekKeyword, this.seekType, this.activeType, overdue)
  125. },
  126. onPullUpAction: function () {
  127. this.page++
  128. this.reloadData()
  129. },
  130. switchActiveType: function (type) {
  131. this.activeType = type
  132. this.isSearch = false
  133. this.remindKeyword = this.seekKeyword = ''
  134. this.page = 1
  135. this.isChange = true
  136. this.reloadData()
  137. },
  138. myActiveType: function () {
  139. if (this.$store.state.option.messageType) {
  140. this.activeType = 'self'
  141. } else {
  142. this.activeType = 'all'
  143. }
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. .search-content {
  150. text-align: center;
  151. padding: .25rem 0 0 0;
  152. input {
  153. border: 1px solid #376ff3;
  154. width: 7.2rem;
  155. margin: 0 0 0 -.02rem;
  156. }
  157. span {
  158. height: .46rem;
  159. line-height: .46rem;
  160. }
  161. }
  162. $seekTitleLine: .72rem;
  163. .product-switch-item {
  164. text-align: center;
  165. background: #fff;
  166. border-bottom: 1px solid #d8d8d8;
  167. box-shadow: 0 1px 3px #ddd;
  168. .mobile-switch-btn {
  169. color: #333;
  170. display: inline-block;
  171. height: .72rem;
  172. line-height: .72rem;
  173. font-size: .28rem;
  174. width: 1.4rem;
  175. &:first-child {
  176. margin-right: 1.78rem;
  177. }
  178. &.active {
  179. color: #3f84f6;
  180. border-bottom: .04rem solid #3f84f6;
  181. }
  182. }
  183. }
  184. .seek-title {
  185. height: $seekTitleLine;
  186. line-height: $seekTitleLine;
  187. .mobile-switch-btn {
  188. /* height: $seekTitleLine;
  189. line-height: $seekTitleLine;*/
  190. font-size: .28rem;
  191. /*&.active {
  192. border-bottom-width: .07rem;
  193. }*/
  194. }
  195. }
  196. </style>