Seek_old.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. taxrate: val.taxrate,
  77. user: val.user
  78. }
  79. })
  80. }
  81. if (this.isChange) {
  82. this.purchaseManListData = list
  83. this.isChange = false
  84. } else {
  85. this.purchaseManListData = this.purchaseManListData.concat(list)
  86. }
  87. },
  88. immediate: true
  89. }
  90. },
  91. computed: {
  92. seekType () {
  93. return this.$route.query.seekType
  94. },
  95. purchase () {
  96. return this.$store.state.applyPurchase.purchaseManList.purchaseManList
  97. },
  98. fetching () {
  99. return this.purchase.fetching
  100. },
  101. allPage () {
  102. return Math.floor(this.purchase.data.totalElements / this.purchase.data.size) + Math.floor(this.purchase.data.totalElements % this.purchase.data.size > 0 ? 1 : 0)
  103. },
  104. seekTitle () {
  105. let title = ''
  106. switch (this.seekType) {
  107. case 'todo': title = '待报价'; break
  108. case 'done': title = '已报价'; break
  109. case 'personage': title = '我的商机'; break
  110. case 'enterprise': title = '公司商机'; break
  111. case 'enquiry': title = '定向询价'; break
  112. case 'seekPurchase': title = '公共询价'; break
  113. case 'purchaseinquiry': title = '定向询价'; break
  114. default: title = '已报价'
  115. }
  116. return title
  117. }
  118. },
  119. mounted () {
  120. // 获取链接
  121. this.$nextTick(() => {
  122. this.myActiveType()
  123. })
  124. },
  125. methods: {
  126. onSearch: function () {
  127. this.isSearch = true
  128. this.remindKeyword = this.seekKeyword
  129. this.page = 1
  130. this.isChange = true
  131. this.reloadData()
  132. },
  133. reloadData: function () {
  134. // let overdue = this.overdue === 'attention' ? '0' : '1'
  135. this.$emit('reloadAction', this.page, this.count, this.seekKeyword, this.seekType, this.activeType)
  136. },
  137. onPullUpAction: function () {
  138. this.page++
  139. this.reloadData()
  140. },
  141. switchActiveType: function (type) {
  142. this.activeType = type
  143. this.isSearch = false
  144. this.remindKeyword = this.seekKeyword = ''
  145. this.page = 1
  146. this.isChange = true
  147. this.reloadData()
  148. },
  149. myActiveType: function () {
  150. if (this.$store.state.option.messageType) {
  151. this.activeType = 'done'
  152. } else {
  153. this.activeType = 'todo'
  154. }
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .search-content {
  161. text-align: center;
  162. padding: .25rem 0 0 0;
  163. input {
  164. border: 1px solid #376ff3;
  165. width: 7.2rem;
  166. margin: 0 0 0 -.02rem;
  167. }
  168. span {
  169. /*height: .46rem;*/
  170. /*line-height: .46rem;*/
  171. }
  172. }
  173. $seekTitleLine: .72rem;
  174. .product-switch-item {
  175. text-align: center;
  176. background: #fff;
  177. border-bottom: 1px solid #d8d8d8;
  178. box-shadow: 0 1px 3px #ddd;
  179. .mobile-switch-btn {
  180. color: #333;
  181. display: inline-block;
  182. height: .72rem;
  183. line-height: .72rem;
  184. font-size: .28rem;
  185. width: 1.4rem;
  186. &:first-child {
  187. margin-right: 1.78rem;
  188. }
  189. &.active {
  190. color: #3f84f6;
  191. border-bottom: .04rem solid #3f84f6;
  192. }
  193. }
  194. }
  195. .seek-title {
  196. height: $seekTitleLine;
  197. line-height: $seekTitleLine;
  198. .mobile-switch-btn {
  199. /* height: $seekTitleLine;
  200. line-height: $seekTitleLine;*/
  201. font-size: .28rem;
  202. &.active {
  203. b{
  204. border-bottom: .04rem solid #3f84f6;
  205. }
  206. border-bottom:none;
  207. }
  208. width:50%;
  209. b{
  210. display:inline-block;
  211. font-weight: normal;
  212. line-height: .64rem;
  213. }
  214. &:first-child{
  215. margin:0;
  216. }
  217. &.fours{
  218. width:25%;
  219. }
  220. }
  221. }
  222. </style>