SupplierDetail.vue 8.7 KB

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