Suppliers.vue 6.5 KB

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