Seek.vue 9.7 KB

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