applyPurchase.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. return this.$store.state.product.common.publishMobile
  81. },
  82. fetching () {
  83. return this.compCollectList.fetching
  84. },
  85. allPage () {
  86. return Math.floor(this.compCollectList.data.totalElements / this.compCollectList.data.size) + Math.floor(this.compCollectList.data.totalElements % this.compCollectList.data.size > 0 ? 1 : 0)
  87. }
  88. },
  89. components: {
  90. RemindBox,
  91. PullUp,
  92. EmptyStatus,
  93. PublishSeek
  94. },
  95. methods: {
  96. searchComplist () {
  97. this.showPublishBox = false
  98. this.page = 1
  99. this.isChange = true
  100. if (this.keyword) {
  101. this.reloadList()
  102. }
  103. },
  104. onRemind: function (str) {
  105. this.remindText = str
  106. this.timeoutCount++
  107. },
  108. reloadList: function () {
  109. this.$store.dispatch('product/loadPublishList', { page: this.page, count: this.count, keyword: this.keyword })
  110. },
  111. onPullUpAction: function () {
  112. this.page++
  113. this.reloadList()
  114. },
  115. compInquiry: function (item, e) {
  116. if (e) {
  117. e.stopPropagation()
  118. }
  119. this.componentSeekObj.code = item.cmpCode ? item.cmpCode : '-'
  120. this.componentSeekObj.brand = item.brand ? item.brand : '-'
  121. this.componentSeekObj.spec = item.spec ? item.spec : '-'
  122. this.componentSeekObj.prodTitle = item.kind ? item.kind : '-'
  123. this.componentSeekObj = JSON.parse(JSON.stringify(this.componentSeekObj))
  124. this.showPublishBox = true
  125. },
  126. goUrl: function (url) {
  127. this.$router.push(url)
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .mobile-fix-content {
  134. .search-content {
  135. text-align: center;
  136. input {
  137. border: 1px solid #376ff3;
  138. }
  139. span{
  140. top:0;
  141. }
  142. }
  143. ul {
  144. margin: .2rem;
  145. li {
  146. border-radius: .05rem;
  147. margin: .25rem 0 0 0;
  148. position: relative;
  149. background: #fff;
  150. .listInfo {
  151. padding: .25rem .1rem .25rem .23rem;
  152. p {
  153. color: #666;
  154. font-size: .3rem;
  155. line-height: .45rem;
  156. overflow: hidden;
  157. text-overflow: ellipsis;
  158. white-space: nowrap;
  159. span {
  160. color: #333;
  161. }
  162. }
  163. }
  164. .sa-pub {
  165. position: absolute;
  166. bottom: .2rem;
  167. right:0;
  168. display: block;
  169. width: 1.7rem;
  170. height: .47rem;
  171. line-height: .47rem;
  172. text-align: center;
  173. font-size: .26rem;
  174. color: #fff;
  175. background: #008bf7;
  176. margin-right:.2rem;
  177. border-radius: .05rem;
  178. }
  179. }
  180. }
  181. }
  182. </style>