SupplierDetail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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 || 'PCS'}}</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. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  72. </div>
  73. </template>
  74. <script>
  75. import { PublishSupplierSeek } from '~components/mobile/applyPurchase'
  76. import { RemindBox, LoginBox } from '~components/mobile/common'
  77. export default {
  78. data () {
  79. return {
  80. key: '',
  81. isSearchSearchingMore: false,
  82. page: 1,
  83. size: 10,
  84. productListData: [],
  85. isChange: false,
  86. isDataChange: false,
  87. showPublishBox: false,
  88. remindText: '',
  89. timeoutCount: 0,
  90. currentProduct: {},
  91. showLoginBox: false
  92. }
  93. },
  94. components: {
  95. PublishSupplierSeek,
  96. RemindBox,
  97. LoginBox
  98. },
  99. mounted: function () {
  100. this.$nextTick(() => {
  101. window.addEventListener('scroll', this.scroll, false)
  102. })
  103. },
  104. watch: {
  105. '$store.state.supplier.data.productList.data': {
  106. handler (val, oldVal) {
  107. if (this.isChange) {
  108. this.productListData = val.content
  109. this.page = 1
  110. this.isChange = false
  111. this.isDataChange = true
  112. } else {
  113. this.productListData = this.productListData.concat(val.content)
  114. this.isSearchSearchingMore = false
  115. this.isDataChange = false
  116. }
  117. },
  118. immediate: true
  119. }
  120. },
  121. computed: {
  122. enInfo () {
  123. return this.$store.state.supplier.data.enterpriseData.data
  124. },
  125. productList () {
  126. return this.$store.state.supplier.data.productList.data
  127. },
  128. allPage () {
  129. return Math.floor(this.productList.totalElements / this.productList.size) + Math.floor(this.productList.totalElements % this.productList.size > 0 ? 1 : 0)
  130. },
  131. storeInfo () {
  132. return this.$store.state.shop.storeInfo.store.data
  133. }
  134. },
  135. methods: {
  136. scroll: function () {
  137. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  138. if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchSearchingMore && this.page < this.allPage) {
  139. this.getMoreSearch()
  140. }
  141. },
  142. getMoreSearch: function () {
  143. this.page++
  144. this.isSearchSearchingMore = true
  145. this.reloadData()
  146. },
  147. reloadData: function () {
  148. this.$store.dispatch('supplier/getSupplierProductList', { vendUU: this.$route.params.uu, page: this.page, size: this.size, keyword: this.key })
  149. },
  150. search: function () {
  151. this.page = 1
  152. this.isChange = true
  153. this.reloadData()
  154. },
  155. publish: function (product) {
  156. if (this.user.logged) {
  157. this.currentProduct = product
  158. this.showPublishBox = true
  159. } else {
  160. this.showLoginBox = true
  161. }
  162. },
  163. onRemind: function (str) {
  164. this.remindText = str
  165. this.timeoutCount ++
  166. },
  167. goLastPage: function () {
  168. window.history.back(-1)
  169. }
  170. }
  171. }
  172. </script>
  173. <style lang="scss" scoped>
  174. .supplier-detail {
  175. background: #29a9f9;
  176. padding: .38rem .19rem;
  177. position: relative;
  178. margin-bottom: 1rem;
  179. .open {
  180. position: absolute;
  181. height: .58rem;
  182. left: -.1rem;
  183. top: .15rem;
  184. }
  185. .detail {
  186. height: 4.46rem;
  187. padding: 0 .31rem;
  188. background: #fff;
  189. overflow: hidden;
  190. border-radius: .05rem;
  191. h1 {
  192. height: 1.11rem;
  193. line-height: 1.11rem;
  194. text-align: center;
  195. font-size: .44rem;
  196. border-bottom: 1px solid rgba(0, 0, 0, .26);
  197. overflow: hidden;
  198. text-overflow: ellipsis;
  199. white-space: nowrap;
  200. i {
  201. color: #3f84f6;
  202. font-size: .31rem;
  203. float: right;
  204. }
  205. }
  206. .line {
  207. margin-top: .26rem;
  208. font-size: .28rem;
  209. color: #666;
  210. padding: 0 .15rem;
  211. overflow: hidden;
  212. text-overflow: ellipsis;
  213. white-space: nowrap;
  214. .img-wrap {
  215. width: .3rem;
  216. text-align: center;
  217. display: inline-block;
  218. margin-right: .31rem;
  219. img {
  220. height: .25rem;
  221. }
  222. }
  223. }
  224. }
  225. .list {
  226. background: #f2f2f2;
  227. margin-top: .21rem;
  228. border-radius: .05rem;
  229. .search-content {
  230. padding-top: .15rem;
  231. padding-bottom: .15rem;
  232. text-align: center;
  233. input {
  234. border: 1px solid #3f84f6;
  235. }
  236. }
  237. ul {
  238. li {
  239. &:nth-child(odd) {
  240. background: #fff;
  241. }
  242. position: relative;
  243. padding: .29rem 0 .16rem .22rem;
  244. overflow: hidden;
  245. .prop {
  246. margin-bottom: .11rem;
  247. font-size: .28rem;
  248. &:last-child {
  249. margin-bottom: 0;
  250. }
  251. .head {
  252. color: #666;
  253. }
  254. .item {
  255. display: inline-block;
  256. width: 1.68rem;
  257. overflow: hidden;
  258. text-overflow: ellipsis;
  259. white-space: nowrap;
  260. margin-right: .18rem;
  261. vertical-align: middle;
  262. &:last-child {
  263. margin-right: 0;
  264. }
  265. }
  266. }
  267. .seek-btn {
  268. position: absolute;
  269. right: .17rem;
  270. top: .67rem;
  271. display: block;
  272. width: 1.5rem;
  273. height: .44rem;
  274. line-height: .44rem;
  275. text-align: center;
  276. color: #fff;
  277. background: #3f84f6;
  278. border-radius: .22rem;
  279. font-size: .26rem;
  280. }
  281. }
  282. }
  283. }
  284. }
  285. </style>