Seek.vue 8.2 KB

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