SupplierDetail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <div class="supplier-detail">
  3. <img v-if="$route.query.isStore === '1'" class="open" src="/images/mobile/supplier/is-open.png" alt="">
  4. <div class="detail">
  5. <h1>{{enInfo.enName}} <nuxt-link v-if="$route.query.isStore === '1'" :to="`/mobile/shop/${storeInfo.uuid}`"><i class="iconfont icon-xiangyou"></i></nuxt-link></h1>
  6. <div class="line">
  7. <div class="img-wrap">
  8. <img src="/images/mobile/supplier/business.png" alt="">
  9. </div>
  10. <span>营业执照号:</span>
  11. <span>{{enInfo.enBussinessCode || '-'}}</span>
  12. </div>
  13. <div class="line">
  14. <div class="img-wrap">
  15. <img src="/images/mobile/supplier/address.png" alt="">
  16. </div>
  17. <span>地址:</span>
  18. <span>{{enInfo.enAddress || '-'}}</span>
  19. </div>
  20. <div class="line">
  21. <div class="img-wrap">
  22. <img src="/images/mobile/supplier/email.png" alt="">
  23. </div>
  24. <span>邮箱:</span>
  25. <span>{{enInfo.enEmail || '-'}}</span>
  26. </div>
  27. <div class="line">
  28. <div class="img-wrap">
  29. <img src="/images/mobile/supplier/phone.png" alt="">
  30. </div>
  31. <span>电话:</span>
  32. <span>{{enInfo.enTel || '-'}}</span>
  33. </div>
  34. <div class="line">
  35. <div class="img-wrap">
  36. <img src="/images/mobile/supplier/house.png" alt="">
  37. </div>
  38. <span>行业:</span>
  39. <span>{{enInfo.enIndustry || '-'}}</span>
  40. </div>
  41. </div>
  42. <div class="list">
  43. <div class="search-content">
  44. <input type="text" placeholder="请输入您要查找的型号或品牌" @keyup.13="search" v-model="key">
  45. <span @click="search" >
  46. <i class="iconfont icon-sousuo"></i>
  47. </span>
  48. </div>
  49. <ul>
  50. <li v-for="product in productListData">
  51. <div class="prop">
  52. <span class="head">型号/品牌:</span>
  53. <span class="item">{{product.cmpCode || '—'}}</span>
  54. <span class="item">{{(product.standard == 1 ? product.pbranden : product.brand) || '—'}}</span>
  55. </div>
  56. <div class="prop">
  57. <span class="head">类目/规格:</span>
  58. <span class="item">{{(product.standard == 1 ? product.kind : product.prodName) || '—'}}</span>
  59. <span class="item">{{product.spec || '—'}}</span>
  60. </div>
  61. <div class="prop">
  62. <span class="head">单位:</span>
  63. <span class="item">{{product.unit || '—'}}</span>
  64. </div>
  65. <a class="seek-btn" @click="publish(product)">立即询价</a>
  66. </li>
  67. </ul>
  68. </div>
  69. <publish-supplier-seek :product="currentProduct" :showPublishBox="showPublishBox" @cancelAction="showPublishBox = false" @remindAction="onRemind"></publish-supplier-seek>
  70. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  71. </div>
  72. </template>
  73. <script>
  74. import { PublishSupplierSeek } from '~components/mobile/applyPurchase'
  75. import { RemindBox } from '~components/mobile/common'
  76. export default {
  77. data () {
  78. return {
  79. key: '',
  80. isSearchSearchingMore: false,
  81. page: 1,
  82. size: 10,
  83. productListData: [],
  84. isChange: false,
  85. isDataChange: false,
  86. showPublishBox: false,
  87. remindText: '',
  88. timeoutCount: 0,
  89. currentProduct: {}
  90. }
  91. },
  92. components: {
  93. PublishSupplierSeek,
  94. RemindBox
  95. },
  96. mounted: function () {
  97. this.$nextTick(() => {
  98. window.addEventListener('scroll', this.scroll, false)
  99. })
  100. },
  101. watch: {
  102. '$store.state.supplier.data.productList.data': {
  103. handler (val, oldVal) {
  104. if (this.isChange) {
  105. this.productListData = val.content
  106. this.page = 1
  107. this.isChange = false
  108. this.isDataChange = true
  109. } else {
  110. this.productListData = this.productListData.concat(val.content)
  111. this.isSearchSearchingMore = false
  112. this.isDataChange = false
  113. }
  114. },
  115. immediate: true
  116. }
  117. },
  118. computed: {
  119. enInfo () {
  120. return this.$store.state.supplier.data.enterpriseData.data
  121. },
  122. productList () {
  123. return this.$store.state.supplier.data.productList.data
  124. },
  125. allPage () {
  126. return Math.floor(this.productList.totalElements / this.productList.size) + Math.floor(this.productList.totalElements % this.productList.size > 0 ? 1 : 0)
  127. },
  128. storeInfo () {
  129. return this.$store.state.shop.storeInfo.store.data
  130. }
  131. },
  132. methods: {
  133. scroll: function () {
  134. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  135. if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchSearchingMore && this.page < this.allPage) {
  136. this.getMoreSearch()
  137. }
  138. },
  139. getMoreSearch: function () {
  140. this.page++
  141. this.isSearchSearchingMore = true
  142. this.reloadData()
  143. },
  144. reloadData: function () {
  145. this.$store.dispatch('supplier/getSupplierProductList', { vendUU: this.$route.params.uu, page: this.page, size: this.size, keyword: this.key })
  146. },
  147. search: function () {
  148. this.page = 1
  149. this.isChange = true
  150. this.reloadData()
  151. },
  152. publish: function (product) {
  153. this.currentProduct = product
  154. this.showPublishBox = true
  155. },
  156. onRemind: function (str) {
  157. this.remindText = str
  158. this.timeoutCount ++
  159. },
  160. goLastPage: function () {
  161. window.history.back(-1)
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .supplier-detail {
  168. background: #29a9f9;
  169. padding: .38rem .19rem;
  170. position: relative;
  171. .open {
  172. position: absolute;
  173. height: .58rem;
  174. left: -.1rem;
  175. top: .15rem;
  176. }
  177. .detail {
  178. height: 4.46rem;
  179. padding: 0 .31rem;
  180. background: #fff;
  181. overflow: hidden;
  182. border-radius: .05rem;
  183. h1 {
  184. height: 1.11rem;
  185. line-height: 1.11rem;
  186. text-align: center;
  187. font-size: .44rem;
  188. border-bottom: 1px solid rgba(0, 0, 0, .26);
  189. overflow: hidden;
  190. text-overflow: ellipsis;
  191. white-space: nowrap;
  192. i {
  193. color: #3f84f6;
  194. font-size: .31rem;
  195. float: right;
  196. }
  197. }
  198. .line {
  199. margin-top: .26rem;
  200. font-size: .28rem;
  201. color: #666;
  202. padding: 0 .15rem;
  203. overflow: hidden;
  204. text-overflow: ellipsis;
  205. white-space: nowrap;
  206. .img-wrap {
  207. width: .3rem;
  208. text-align: center;
  209. display: inline-block;
  210. margin-right: .31rem;
  211. img {
  212. height: .25rem;
  213. }
  214. }
  215. }
  216. }
  217. .list {
  218. background: #f2f2f2;
  219. margin-top: .21rem;
  220. border-radius: .05rem;
  221. .search-content {
  222. padding-top: .15rem;
  223. padding-bottom: .15rem;
  224. text-align: center;
  225. input {
  226. border: 1px solid #3f84f6;
  227. }
  228. }
  229. ul {
  230. li {
  231. &:nth-child(odd) {
  232. background: #fff;
  233. }
  234. position: relative;
  235. padding: .29rem 0 .16rem .22rem;
  236. overflow: hidden;
  237. .prop {
  238. margin-bottom: .11rem;
  239. font-size: .28rem;
  240. &:last-child {
  241. margin-bottom: 0;
  242. }
  243. .head {
  244. color: #666;
  245. }
  246. .item {
  247. display: inline-block;
  248. width: 1.68rem;
  249. overflow: hidden;
  250. text-overflow: ellipsis;
  251. white-space: nowrap;
  252. margin-right: .18rem;
  253. vertical-align: middle;
  254. &:last-child {
  255. margin-right: 0;
  256. }
  257. }
  258. }
  259. .seek-btn {
  260. position: absolute;
  261. right: .17rem;
  262. top: .67rem;
  263. display: block;
  264. width: 1.5rem;
  265. height: .44rem;
  266. line-height: .44rem;
  267. text-align: center;
  268. color: #fff;
  269. background: #3f84f6;
  270. border-radius: .22rem;
  271. font-size: .26rem;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. </style>