Suppliers.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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" 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. op: 'pageByType',
  70. types: this.types,
  71. sorting: {'createTime': 'DESC'}
  72. },
  73. stores: {},
  74. params: {
  75. op: 'pageByType',
  76. page: 1,
  77. count: 10,
  78. types: this.types
  79. },
  80. flag: true
  81. }
  82. },
  83. mounted () {
  84. this.$http.get('/api/store-service/stores', {params: this.params})
  85. .then(response => {
  86. this.stores = response.data
  87. })
  88. this.flag = false
  89. },
  90. updated () {
  91. if (this.flag) {
  92. this.$http.get('/api/store-service/stores', {params: this.params})
  93. .then(response => {
  94. this.stores = response.data
  95. })
  96. this.flag = false
  97. }
  98. },
  99. computed: {
  100. // stores () {
  101. // return this.$store.state.provider.stores.storeList.data
  102. // }
  103. },
  104. methods: {
  105. search () {
  106. this.pageParams.page = 1
  107. this.pageParams.keyword = this.keyword === '' ? null : this.keyword
  108. // this.$store.dispatch('provider/findStoreList', this.pageParams)
  109. this.$http.get('/api/store-service/stores', {params: this.pageParams})
  110. .then(response => {
  111. this.stores = response.data
  112. })
  113. },
  114. showLittleDescription (description) {
  115. if (!description || description === '') {
  116. return '暂无简介'
  117. }
  118. return description.slice(0, 160)
  119. },
  120. async pageCommodity (pageParams) {
  121. pageParams.op = 'pageByType'
  122. try {
  123. let { data } = await this.$http.get('/api/store-service/stores', { params: this.pageParams })
  124. this.stores = data
  125. } catch (err) {
  126. // this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
  127. }
  128. },
  129. handleCurrentChange (page) {
  130. this.pageParams.page = page
  131. this.pageParams.keyword = this.keyword === '' ? null : this.keyword
  132. this.pageCommodity(this.pageParams)
  133. }
  134. }
  135. }
  136. </script>
  137. <style scoped>
  138. @import "~element-ui/lib/theme-default/index.css";
  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. font-family: "Microsoft Yahei";
  164. }
  165. #store-list .btn-primary {
  166. background-color: rgb(80,120,203);
  167. color: #fff;
  168. width: 100px;
  169. height: 30px;
  170. line-height: 14px;
  171. }
  172. #store-list table>tbody .logo {
  173. width: 150px;
  174. height: 76px;
  175. text-align: center;
  176. line-height: 72px;
  177. border:1px solid #ccc;
  178. }
  179. #store-list table>tbody img {
  180. max-width: 148px;
  181. max-height: 72px;
  182. }
  183. #store-list table>tbody .vertical-middle{
  184. vertical-align: middle;
  185. }
  186. #store-list table>tbody .store-mark {
  187. margin: 10px 0;
  188. }
  189. #store-list table>tbody .text-point {
  190. font-family: "Microsoft Yahei", "微软雅黑";
  191. color: #ff3737;
  192. font-weight: 600;
  193. }
  194. #store-list table>tbody .store-name {
  195. font-size: 17px;
  196. font-weight: 600;
  197. color: #000;
  198. }
  199. #store-list table>tbody .store-message {
  200. color: #999;
  201. width: 95%;
  202. overflow: hidden;
  203. text-overflow: ellipsis;
  204. display: -webkit-box;
  205. -webkit-box-orient: vertical;
  206. -webkit-line-clamp: 3;
  207. line-height: 18px;
  208. }
  209. #store-list table>tbody tr td{
  210. padding: 15px;
  211. }
  212. @font-face {
  213. font-family: 'iconfont'; /* project id 357960 */
  214. src: url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.eot');
  215. src: url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.eot?#iefix') format('embedded-opentype'),
  216. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.woff') format('woff'),
  217. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.ttf') format('truetype'),
  218. url('//at.alicdn.com/t/font_sw3uw5ndd9uow29.svg#iconfont') format('svg');
  219. }
  220. </style>