Suppliers.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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">
  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">
  18. <a href="vendor#/store-apply"><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"><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. <el-pagination
  50. :current-page.sync="pageParams.page"
  51. :page-size="pageParams.count"
  52. layout="prev, pager, next, jumper"
  53. :total="stores.totalElements"
  54. @current-change="handleCurrentChange">
  55. </el-pagination>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. export default {
  61. name: 'suppliers',
  62. props: ['types'],
  63. data () {
  64. return {
  65. keyword: '',
  66. pageParams: {
  67. page: 1,
  68. count: 10,
  69. keyword: '',
  70. types: this.types
  71. }
  72. }
  73. },
  74. computed: {
  75. stores () {
  76. return this.$store.state.provider.stores.storeList.data
  77. }
  78. },
  79. methods: {
  80. search () {
  81. this.pageParams.page = 1
  82. this.pageParams.keyword = this.keyword === '' ? null : this.keyword
  83. this.$store.dispatch('provider/findStoreList', this.pageParams)
  84. },
  85. showLittleDescription (description) {
  86. if (!description || description === '') {
  87. return '暂无简介'
  88. }
  89. return description.slice(0, 160)
  90. },
  91. async pageCommodity (pageParams) {
  92. pageParams.op = 'pageByType'
  93. try {
  94. let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
  95. this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
  96. } catch (err) {
  97. this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
  98. }
  99. },
  100. handleCurrentChange (page) {
  101. this.pageParams.page = page
  102. this.pageParams.keyword = this.keyword === '' ? null : this.keyword
  103. this.pageCommodity(this.pageParams)
  104. }
  105. }
  106. }
  107. </script>
  108. <style>
  109. .el-pagination .el-pager li.active{
  110. background-color: #5078cb;
  111. border-color: #337ab7;
  112. }
  113. #store-list{
  114. width: 1190px;
  115. padding: 0;
  116. }
  117. #store-list table {
  118. border: 1px solid #d8d4d4;
  119. font-size: 14px;
  120. }
  121. #store-list table>thead>tr {
  122. background: none;
  123. background-color: #f7f7f7;
  124. font-size: 14px;
  125. font-weight: 600;
  126. color: rgb(50,50,50);
  127. }
  128. #store-list table>thead>tr input {
  129. font-weight: 100;
  130. }
  131. #store-list .text-message {
  132. color: rgb(80,120,203);
  133. font-family: "Microsoft Yahei";
  134. }
  135. #store-list .btn-primary {
  136. background-color: rgb(80,120,203);
  137. color: #fff;
  138. width: 100px;
  139. height: 30px;
  140. line-height: 14px;
  141. }
  142. #store-list table>tbody .logo {
  143. width: 150px;
  144. height: 76px;
  145. text-align: center;
  146. line-height: 72px;
  147. border:1px solid #ccc;
  148. }
  149. #store-list table>tbody img {
  150. max-width: 148px;
  151. max-height: 72px;
  152. }
  153. #store-list table>tbody .vertical-middle{
  154. vertical-align: middle;
  155. }
  156. #store-list table>tbody .store-mark {
  157. margin: 10px 0;
  158. }
  159. #store-list table>tbody .text-point {
  160. font-family: "Microsoft Yahei", "微软雅黑";
  161. color: #ff3737;
  162. font-weight: 600;
  163. }
  164. #store-list table>tbody .store-name {
  165. font-size: 17px;
  166. font-weight: 600;
  167. color: #000;
  168. }
  169. #store-list table>tbody .store-message {
  170. color: #999;
  171. width: 95%;
  172. overflow: hidden;
  173. text-overflow: ellipsis;
  174. display: -webkit-box;
  175. -webkit-box-orient: vertical;
  176. -webkit-line-clamp: 3;
  177. line-height: 18px;
  178. }
  179. #store-list table>tbody tr td{
  180. padding: 15px;
  181. }
  182. @font-face {
  183. font-family: 'iconfont'; /* project id 357960 */
  184. src: url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.eot');
  185. src: url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.eot?#iefix') format('embedded-opentype'),
  186. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.woff') format('woff'),
  187. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.ttf') format('truetype'),
  188. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.svg#iconfont') format('svg');
  189. }
  190. </style>