applyPurchase.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="apply_purchase_mobile">
  3. <div class="com-mobile-header mobile-center-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>发布求购</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="search-content search-content2">
  10. <input type="text" placeholder="请输入您要询价求购的型号" v-model="keyword" @keyup.13="searchComplist">
  11. <span @click="searchComplist" >
  12. <i class="iconfont icon-sousuo"></i>
  13. </span>
  14. </div>
  15. <publish-seek v-if="showPublishBox" :dataObj="componentSeekObj" @remindAction="onRemind"></publish-seek>
  16. <template v-else>
  17. <ul v-if="compList && compList.length">
  18. <li v-for="comp in compList">
  19. <div class="listInfo">
  20. <p>品牌:<span v-text="comp.brand || '-'"></span></p>
  21. <p>物料名称(类目):<span v-text="comp.kind || '-'"></span></p>
  22. <p>型号:<span v-text="comp.cmpCode || '-'"></span></p>
  23. <p>规格:<span v-text="comp.spec || '-'"></span></p>
  24. <p>单位:<span v-text="comp.unit || 'PCS'"></span></p>
  25. </div>
  26. <a class="sa-pub" @click="compInquiry(comp, $event)">立即询价</a>
  27. </li>
  28. </ul>
  29. <empty-status :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'" v-else></empty-status>
  30. </template>
  31. </div>
  32. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  33. <pull-up :fixId="'mobileFixContent'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  34. </div>
  35. </template>
  36. <script>
  37. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  38. import {PublishSeek} from '~components/mobile/applyPurchase'
  39. export default {
  40. middleware: 'authenticated',
  41. layout: 'mobileNoHeader',
  42. fetch ({ store }) {
  43. return Promise.all([
  44. store.dispatch('product/loadPublishList', { count: 10, page: 1, keyword: null })
  45. ])
  46. },
  47. data () {
  48. return {
  49. keyword: '',
  50. remindText: '',
  51. timeoutCount: 0,
  52. page: 1,
  53. count: 10,
  54. isChange: false,
  55. compList: [],
  56. componentSeekObj: {
  57. code: '',
  58. brand: '',
  59. spec: '',
  60. prodTitle: ''
  61. },
  62. showPublishBox: true
  63. }
  64. },
  65. watch: {
  66. 'compCollectList.data': {
  67. handler: function (val) {
  68. if (this.isChange) {
  69. this.compList = val.content
  70. this.isChange = false
  71. } else {
  72. this.compList = [...this.compList, ...val.content]
  73. }
  74. },
  75. immediate: true
  76. }
  77. },
  78. computed: {
  79. compCollectList () {
  80. console.log('123', this.$store.state.product.common.publishMobile)
  81. return this.$store.state.product.common.publishMobile
  82. },
  83. fetching () {
  84. return this.compCollectList.fetching
  85. },
  86. allPage () {
  87. return Math.floor(this.compCollectList.data.totalElements / this.compCollectList.data.size) + Math.floor(this.compCollectList.data.totalElements % this.compCollectList.data.size > 0 ? 1 : 0)
  88. }
  89. },
  90. components: {
  91. RemindBox,
  92. PullUp,
  93. EmptyStatus,
  94. PublishSeek
  95. },
  96. methods: {
  97. searchComplist () {
  98. this.showPublishBox = false
  99. this.page = 1
  100. this.isChange = true
  101. if (this.keyword) {
  102. this.reloadList()
  103. }
  104. },
  105. onRemind: function (str) {
  106. this.remindText = str
  107. this.timeoutCount++
  108. },
  109. reloadList: function () {
  110. this.$store.dispatch('product/loadPublishList', { page: this.page, count: this.count, keyword: this.keyword })
  111. },
  112. onPullUpAction: function () {
  113. this.page++
  114. this.reloadList()
  115. },
  116. compInquiry: function (item, e) {
  117. if (e) {
  118. e.stopPropagation()
  119. }
  120. this.componentSeekObj.code = item.cmpCode ? item.cmpCode : '-'
  121. this.componentSeekObj.brand = item.brand ? item.brand : '-'
  122. this.componentSeekObj.spec = item.spec ? item.spec : '-'
  123. this.componentSeekObj.prodTitle = item.kind ? item.kind : '-'
  124. this.componentSeekObj = JSON.parse(JSON.stringify(this.componentSeekObj))
  125. this.showPublishBox = true
  126. },
  127. goUrl: function (url) {
  128. this.$router.push(url)
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .mobile-fix-content {
  135. .search-content {
  136. text-align: center;
  137. input {
  138. border: 1px solid #376ff3;
  139. }
  140. span{
  141. top:0;
  142. }
  143. }
  144. ul {
  145. margin: .2rem;
  146. li {
  147. border-radius: .05rem;
  148. margin: .25rem 0 0 0;
  149. position: relative;
  150. background: #fff;
  151. .listInfo {
  152. padding: .25rem .1rem .25rem .23rem;
  153. p {
  154. color: #666;
  155. font-size: .3rem;
  156. line-height: .45rem;
  157. overflow: hidden;
  158. text-overflow: ellipsis;
  159. white-space: nowrap;
  160. span {
  161. color: #333;
  162. }
  163. }
  164. }
  165. .sa-pub {
  166. position: absolute;
  167. bottom: .2rem;
  168. right:0;
  169. display: block;
  170. width: 1.7rem;
  171. height: .47rem;
  172. line-height: .47rem;
  173. text-align: center;
  174. font-size: .26rem;
  175. color: #fff;
  176. background: #008bf7;
  177. margin-right:.2rem;
  178. border-radius: .05rem;
  179. }
  180. }
  181. }
  182. }
  183. </style>