SupplierDetail.vue 8.6 KB

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