Seek.vue 6.5 KB

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