Suppliers.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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="280">
  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. types: this.types
  73. }
  74. }
  75. },
  76. computed: {
  77. stores () {
  78. return this.$store.state.provider.stores.storeList.data
  79. },
  80. user () {
  81. return this.$store.state.option.user
  82. },
  83. enterprise () {
  84. let ens = this.user.data.enterprises
  85. if (ens && ens.length) {
  86. return ens.find(item => item.current) || {enName: '个人账户'}
  87. } else {
  88. return {enName: '个人账户'}
  89. }
  90. }
  91. },
  92. methods: {
  93. search (obj) {
  94. this.pageParams.page = 1
  95. this.pageParams.keyword = obj.keyword === '' ? null : obj.keyword
  96. this.$store.dispatch('provider/findStoreList', this.pageParams)
  97. },
  98. showLittleDescription (description) {
  99. if (!description || description === '') {
  100. return '暂无简介'
  101. }
  102. return description.slice(0, 160)
  103. },
  104. async pageCommodity (pageParams) {
  105. // pageCommodity (pageParams) {
  106. pageParams.op = 'pageByType'
  107. try {
  108. let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
  109. this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
  110. } catch (err) {
  111. this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
  112. }
  113. // this.$http.get('/api/store-service/stores', { params: pageParams }).then(response => {
  114. // this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', response)
  115. // }, err => {
  116. // this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
  117. // })
  118. },
  119. handleCurrentChange (page) {
  120. this.pageParams.page = page
  121. this.pageParams.keyword = this.keyword === '' ? null : this.keyword
  122. this.pageCommodity(this.pageParams)
  123. },
  124. goStoreApply: function () {
  125. if (this.user.logged) {
  126. if (this.enterprise && this.enterprise.isVendor === 313) {
  127. window.location.href = '/vendor#/store-apply'
  128. } else {
  129. this.$router.push('/register-saler')
  130. }
  131. } else {
  132. this.$router.push('/auth/login')
  133. }
  134. }
  135. }
  136. }
  137. </script>
  138. <style scoped>
  139. .el-pagination .el-pager li.active{
  140. background-color: #5078cb;
  141. border-color: #337ab7;
  142. }
  143. #store-list{
  144. width: 1190px;
  145. padding: 0;
  146. }
  147. #store-list table {
  148. border: 1px solid #d8d4d4;
  149. font-size: 14px;
  150. }
  151. #store-list table>thead>tr {
  152. background: none;
  153. background-color: #f7f7f7;
  154. font-size: 14px;
  155. font-weight: 600;
  156. color: rgb(50,50,50);
  157. }
  158. #store-list table>thead>tr input {
  159. font-weight: 100;
  160. }
  161. #store-list .text-message {
  162. color: rgb(80,120,203);
  163. }
  164. #store-list .btn-primary {
  165. background-color: rgb(80,120,203);
  166. color: #fff;
  167. width: 100px;
  168. height: 30px;
  169. line-height: 14px;
  170. }
  171. #store-list table>tbody .logo {
  172. width: 150px;
  173. height: 76px;
  174. text-align: center;
  175. line-height: 72px;
  176. border:1px solid #ccc;
  177. }
  178. #store-list table>tbody img {
  179. max-width: 148px;
  180. max-height: 72px;
  181. }
  182. #store-list table>tbody .vertical-middle{
  183. vertical-align: middle;
  184. }
  185. #store-list table>tbody .store-mark {
  186. margin: 10px 0;
  187. }
  188. #store-list table>tbody .text-point {
  189. color: #ff3737;
  190. font-weight: 600;
  191. }
  192. #store-list table>tbody .store-name {
  193. font-size: 17px;
  194. font-weight: 600;
  195. color: #000;
  196. }
  197. #store-list table>tbody .store-message {
  198. color: #999;
  199. width: 95%;
  200. overflow: hidden;
  201. text-overflow: ellipsis;
  202. display: -webkit-box;
  203. -webkit-box-orient: vertical;
  204. -webkit-line-clamp: 3;
  205. line-height: 18px;
  206. }
  207. #store-list table>tbody tr td{
  208. padding: 15px;
  209. }
  210. @font-face {
  211. font-family: 'iconfont'; /* project id 357960 */
  212. src: url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.eot');
  213. src: url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.eot?#iefix') format('embedded-opentype'),
  214. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.woff') format('woff'),
  215. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.ttf') format('truetype'),
  216. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.svg#iconfont') format('svg');
  217. }
  218. </style>