Seek.vue 10.0 KB

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