Suppliers.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <div class="container" id="store-list">
  3. <table class="table">
  4. <thead>
  5. <tr>
  6. <td width="175"></td>
  7. <td width="auto"></td>
  8. <td width="400">
  9. <search-header :outerKeyword="keyword" @searchAction="search" :placeholder="'品牌/类目/型号/店铺名'"></search-header>
  10. <!--<div class="input-group" style="display: table;">-->
  11. <!--<input class="form-control" type="search" v-model="keyword" placeholder="品牌/类目/型号/店铺名" @search="search()" />-->
  12. <!--<span class="input-group-btn">-->
  13. <!--<button type="button" class="btn btn-default" @click="search()"><i class="iconfont">&#xe6fc;</i></button>-->
  14. <!--</span>-->
  15. <!--</div>-->
  16. </td>
  17. <td width="150" style="vertical-align: middle"><span>入驻商家:</span><span class="text-message">{{stores ? stores.totalElements : 0}}</span><span>家</span></td>
  18. <td width="150" style="vertical-align: middle;">
  19. <a @click="goStoreApply" style="width: 100px; height: 30px; display: inline-block;"><button class="btn btn-primary" style="margin-left: 6px;">立即入驻</button></a>
  20. </td>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. <!--<tr>{{$data}}</tr>-->
  25. <tr v-for="store in stores.content" v-if="store">
  26. <td>
  27. <div class="logo">
  28. <a :href="'/store/' + store.uuid" target="_blank"><img :src="store.logoUrl || '/images/store/common/default.png'" :alt="store.storeName"></a>
  29. </div>
  30. </td>
  31. <td colspan="3">
  32. <a class="store-name" :href="'/store/' + store.uuid" target="_blank"><div :title="store.storeName">{{store.storeName}}</div></a>
  33. <div class="store-message">
  34. <span>企业介绍:</span>
  35. <span style="word-break: break-word;">{{showLittleDescription(store.enterprise.description)}}<em v-if="store.description && store.description.length > 160">...</em></span>
  36. </div>
  37. </td>
  38. <td class="vertical-middle">
  39. <a :href="'/store/' + store.uuid" target="_blank"><button class="btn btn-primary">进入店铺&nbsp;&gt;</button></a>
  40. </td>
  41. </tr>
  42. <tr v-if="!stores.content || stores.content.length == 0">
  43. <td colspan="10" class="text-center" style="line-height: 40px; font-size: 20px;">
  44. <i class="fa fa-smile-o fa-lg"></i> 暂无店铺信息
  45. </td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. <div style="float: right;">
  50. <page :total="stores.totalElements" :page-size="pageParams.count"
  51. :current="pageParams.page" v-on:childEvent="handleCurrentChange"></page>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import Page from '~components/common/page/pageComponent.vue'
  57. import SearchHeader from '~components/common/PcSearchHeader.vue'
  58. export default {
  59. name: 'suppliers',
  60. props: ['types'],
  61. components: {
  62. Page,
  63. SearchHeader
  64. },
  65. data () {
  66. return {
  67. keyword: '',
  68. pageParams: {
  69. page: 1,
  70. count: 10,
  71. keyword: '',
  72. type: this.types,
  73. field: ''
  74. }
  75. }
  76. },
  77. computed: {
  78. stores () {
  79. return this.$store.state.provider.stores.storeList.data
  80. },
  81. user () {
  82. return this.$store.state.option.user
  83. },
  84. enterprise () {
  85. let ens = this.user.data.enterprises
  86. if (ens && ens.length) {
  87. return ens.find(item => item.current) || {enName: '个人账户'}
  88. } else {
  89. return {enName: '个人账户'}
  90. }
  91. }
  92. },
  93. methods: {
  94. search (obj) {
  95. this.pageParams.page = 1
  96. this.pageParams.keyword = obj.keyword === '' ? null : obj.keyword
  97. this.pageParams.field = obj.type ? 'similar' : null
  98. this.pageCommodity(this.pageParams)
  99. },
  100. showLittleDescription (description) {
  101. if (!description || description === '') {
  102. return '暂无企业介绍'
  103. }
  104. return description.slice(0, 160)
  105. },
  106. async pageCommodity (pageParams) {
  107. // pageCommodity (pageParams) {
  108. pageParams.op = 'similar'
  109. try {
  110. let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
  111. this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
  112. } catch (err) {
  113. this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
  114. }
  115. // this.$http.get('/api/store-service/stores', { params: pageParams }).then(response => {
  116. // this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', response)
  117. // }, err => {
  118. // this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
  119. // })
  120. },
  121. handleCurrentChange (page) {
  122. this.pageParams.page = page
  123. this.pageParams.keyword = this.keyword === '' ? null : this.keyword
  124. this.pageCommodity(this.pageParams)
  125. }
  126. }
  127. }
  128. </script>
  129. <style scoped>
  130. .el-pagination .el-pager li.active{
  131. background-color: #5078cb;
  132. border-color: #337ab7;
  133. }
  134. #store-list{
  135. width: 1190px;
  136. padding: 0;
  137. }
  138. #store-list table {
  139. border: 1px solid #d8d4d4;
  140. font-size: 14px;
  141. }
  142. #store-list table>thead>tr {
  143. background: none;
  144. background-color: #f7f7f7;
  145. font-size: 14px;
  146. font-weight: 600;
  147. color: rgb(50,50,50);
  148. }
  149. #store-list table>thead>tr input {
  150. font-weight: 100;
  151. }
  152. #store-list .text-message {
  153. color: rgb(80,120,203);
  154. }
  155. #store-list .btn-primary {
  156. background-color: rgb(80,120,203);
  157. color: #fff;
  158. width: 100px;
  159. height: 30px;
  160. line-height: 14px;
  161. }
  162. #store-list table>tbody .logo {
  163. width: 150px;
  164. height: 76px;
  165. text-align: center;
  166. line-height: 72px;
  167. border:1px solid #ccc;
  168. }
  169. #store-list table>tbody img {
  170. max-width: 148px;
  171. max-height: 72px;
  172. }
  173. #store-list table>tbody .vertical-middle{
  174. vertical-align: middle;
  175. }
  176. #store-list table>tbody .store-mark {
  177. margin: 10px 0;
  178. }
  179. #store-list table>tbody .text-point {
  180. color: #ff3737;
  181. font-weight: 600;
  182. }
  183. #store-list table>tbody .store-name {
  184. font-size: 17px;
  185. font-weight: 600;
  186. color: #000;
  187. }
  188. #store-list table>tbody .store-message {
  189. color: #999;
  190. width: 95%;
  191. overflow: hidden;
  192. text-overflow: ellipsis;
  193. display: -webkit-box;
  194. -webkit-box-orient: vertical;
  195. -webkit-line-clamp: 3;
  196. line-height: 18px;
  197. }
  198. #store-list table>tbody tr td{
  199. padding: 15px;
  200. }
  201. @font-face {
  202. font-family: 'iconfont'; /* project id 357960 */
  203. src: url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.eot');
  204. src: url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.eot?#iefix') format('embedded-opentype'),
  205. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.woff') format('woff'),
  206. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.ttf') format('truetype'),
  207. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.svg#iconfont') format('svg');
  208. }
  209. </style>