index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <div class="shop">
  3. <div class="shop-top">
  4. <p><i class="iconfont icon-dianpu1"></i><span>{{list.totalElements}}</span>家店铺</p>
  5. <span @click="onClick()">{{downName}} <i class="iconfont icon-arrow-down"></i></span>
  6. <ul class="supdown" v-if="down">
  7. <li @click="onDown('ORIGINAL_FACTORY')">原厂</li>
  8. <li @click="onDown('AGENCY')">代理</li>
  9. <li @click="onDown('DISTRIBUTION')">经销</li>
  10. <li @click="onDown('ORIGINAL_FACTORY-DISTRIBUTION-AGENCY' )">全部</li>
  11. </ul>
  12. </div>
  13. <div class="shop-list" v-for="item in list.content">
  14. <h3>{{item.storeName}}</h3>
  15. <div class="list-item">
  16. <div class="item-img">
  17. <i :style="'background:url(' + isType(item.type) + ')no-repeat 0 0/.65rem .33rem;'"></i>
  18. <img :src="item.logoUrl || '/images/component/default.png'">
  19. </div>
  20. <div class="list-item-phone">
  21. <p>电话:<span>{{item.enterprise.enTel}}</span></p>
  22. <p>传真:<span>{{item.enterprise.enFax}}</span></p>
  23. <p>商家介绍: <nuxt-link :to="'/mobile/merchantDescription/'+item.uuid">点击查看</nuxt-link></p>
  24. <i class="iconfont icon-shoucang" :style="(item.isFocus==='false')?'color:#ff7800':'color:#333'"></i>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. export default {
  32. layout: 'main',
  33. data () {
  34. return {
  35. page: '',
  36. count: '',
  37. types: '',
  38. down: false,
  39. downName: '全部',
  40. isFocus: true
  41. }
  42. },
  43. fetch ({ store }) {
  44. return Promise.all([
  45. store.dispatch('provider/findStoreList', { page: 1, count: 10, types: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY' })
  46. ])
  47. },
  48. computed: {
  49. list () {
  50. const listData = this.$store.state.provider.stores.storeList.data
  51. for (let i = 0; i < listData.content.length; i++) {
  52. this.$http.get('/trade/storeFocus/ifFocus?storeid=' + listData.content[i].id)
  53. .then(
  54. function (response) {
  55. listData.content[i].isFocus = response.data
  56. console.log(listData.content[i])
  57. }
  58. )
  59. }
  60. return listData
  61. }
  62. },
  63. methods: {
  64. isType (type) {
  65. let bgurl = ''
  66. if (type === 'ORIGINAL_FACTORY') {
  67. bgurl = '/images/mobile/@2x/shop/yuangchang@2x.png'
  68. }
  69. if (type === 'DISTRIBUTION') {
  70. bgurl = '/images/mobile/@2x/shop/jingxiao@2x.png'
  71. }
  72. if (type === 'AGENCY') {
  73. bgurl = '/images/mobile/@2x/shop/daili@2x.png'
  74. }
  75. return bgurl
  76. },
  77. onClick () {
  78. this.down = !this.down
  79. },
  80. onDown (type) {
  81. this.$store.dispatch('provider/findStoreList', { page: 1, count: 10, types: type })
  82. this.down = !this.down
  83. if (type === 'ORIGINAL_FACTORY') {
  84. this.downName = '原厂'
  85. }
  86. if (type === 'DISTRIBUTION') {
  87. this.downName = '经销'
  88. }
  89. if (type === 'AGENCY') {
  90. this.downName = '代理'
  91. }
  92. if (type === 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY') {
  93. this.downName = '全部'
  94. }
  95. }
  96. }
  97. }
  98. </script>
  99. <style scoped lang="scss">
  100. .shop{
  101. margin-bottom: .98rem;
  102. min-height: 10rem;
  103. background: #e2e4e6;
  104. .shop-top{
  105. display:inline-flex;
  106. justify-content: space-between;
  107. align-items: center;
  108. width:100%;
  109. height:1.14rem;
  110. padding:0 .3rem;
  111. position:relative;
  112. background:#fff;
  113. .supdown{
  114. position:absolute;
  115. top:.8rem;
  116. right:.2rem;
  117. z-index:100;
  118. background:#616264;
  119. border-radius:.1rem;
  120. li{
  121. font-size: .28rem;
  122. color:#ffffff;
  123. height: .32rem;
  124. line-height: .32rem;
  125. margin: .2rem;
  126. margin-right:.4rem;
  127. }
  128. }
  129. p{
  130. font-size:.24rem;
  131. color:#000;
  132. i{
  133. font-size: .53rem;
  134. color:#418ef7;
  135. }
  136. span{
  137. font-size:.3rem;
  138. color:#f94f28;
  139. margin:0 .1rem;
  140. }
  141. }
  142. >span{
  143. font-size:.28rem;
  144. color:#53a0f7;
  145. }
  146. }
  147. .shop-list {
  148. background:#fff;
  149. margin-top:.12rem;
  150. padding-bottom:.28rem;
  151. &:hover{
  152. background: #e1e1e1;
  153. }
  154. h3{
  155. font-size:.32rem;
  156. line-height: .8rem;
  157. margin:0;
  158. margin-left:.27rem;
  159. margin-bottom:.14rem;
  160. }
  161. .list-item{
  162. width:6.77rem;
  163. margin-left:.39rem;
  164. justify-content: space-around;
  165. display:inline-flex;
  166. .item-img{
  167. position:relative;
  168. width:2.42rem;
  169. height:1.69rem;
  170. i{
  171. display:block;
  172. position:absolute;
  173. width:.65rem;
  174. height:.33rem;
  175. }
  176. img{
  177. display:inline-block;
  178. width:100%;
  179. height:100%;
  180. border:.02rem solid #418bf6;
  181. }
  182. }
  183. .list-item-phone{
  184. width:3.95rem;
  185. padding-top:.18rem;
  186. position:relative;
  187. p{
  188. font-size:.28rem;
  189. line-height: .45rem;
  190. margin:0;
  191. }
  192. i{
  193. display:block;
  194. position:absolute;
  195. top:.1rem;
  196. right:.1rem;
  197. font-size:.4rem;
  198. color:#ff7800;
  199. }
  200. i.active{
  201. color:#333;
  202. }
  203. }
  204. }
  205. }
  206. }
  207. </style>