index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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-DISTRIBUTION-AGENCY' )">全部</li>
  8. <li @click="onDown('ORIGINAL_FACTORY')">原厂</li>
  9. <li @click="onDown('AGENCY')">代理</li>
  10. <li @click="onDown('DISTRIBUTION')">经销</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=='true'?'color:#ff7800':'color:#bbb'" @click="focusStore(item)"></i>
  25. </div>
  26. </div>
  27. </div>
  28. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  29. </div>
  30. </template>
  31. <script>
  32. import RemindBox from '~components/mobile/common/remindBox.vue'
  33. export default {
  34. layout: 'main',
  35. data () {
  36. return {
  37. page: '',
  38. count: '',
  39. types: '',
  40. down: false,
  41. downName: '全部',
  42. isFocus: true,
  43. collectResult: '收藏成功',
  44. timeoutCount: 0
  45. }
  46. },
  47. components: {
  48. RemindBox
  49. },
  50. fetch ({ store }) {
  51. return Promise.all([
  52. store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY' })
  53. ])
  54. },
  55. computed: {
  56. list () {
  57. return this.$store.state.provider.stores.storeList.data
  58. }
  59. },
  60. methods: {
  61. isType (type) {
  62. let bgurl = ''
  63. if (type === 'ORIGINAL_FACTORY') {
  64. bgurl = '/images/mobile/@2x/shop/yuanchang@2x.png'
  65. }
  66. if (type === 'DISTRIBUTION') {
  67. bgurl = '/images/mobile/@2x/shop/jingxiao@2x.png'
  68. }
  69. if (type === 'AGENCY') {
  70. bgurl = '/images/mobile/@2x/shop/daili@2x.png'
  71. }
  72. return bgurl
  73. },
  74. onClick () {
  75. this.down = !this.down
  76. },
  77. onDown (type) {
  78. this.$store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: type })
  79. this.down = !this.down
  80. if (type === 'ORIGINAL_FACTORY') {
  81. this.downName = '原厂'
  82. }
  83. if (type === 'DISTRIBUTION') {
  84. this.downName = '经销'
  85. }
  86. if (type === 'AGENCY') {
  87. this.downName = '代理'
  88. }
  89. if (type === 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY') {
  90. this.downName = '全部'
  91. }
  92. },
  93. focusStore: function (item) {
  94. // item.isFocus = item.isFocus === 'false' ? 'true' : 'false'
  95. if (item.isFocus === 'false') {
  96. this.$http.post('/trade/storeFocus/save', {storeName: item.storeName, storeid: item.id})
  97. .then(response => {
  98. item.isFocus = 'true'
  99. this.collectResult = '收藏成功'
  100. this.timeoutCount++
  101. })
  102. } else {
  103. this.$http.post('/trade/storeFocus/delete/storeId', [item.id])
  104. .then(response => {
  105. item.isFocus = 'false'
  106. this.collectResult = '取消成功'
  107. this.timeoutCount++
  108. })
  109. }
  110. }
  111. }
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. .shop{
  116. margin-bottom: .98rem;
  117. min-height: 10rem;
  118. background: #e2e4e6;
  119. .shop-top{
  120. display:inline-flex;
  121. justify-content: space-between;
  122. align-items: center;
  123. width:100%;
  124. height:1.14rem;
  125. padding:0 .3rem;
  126. position:relative;
  127. background:#fff;
  128. .supdown{
  129. position:absolute;
  130. top:.8rem;
  131. right:.2rem;
  132. z-index:100;
  133. background:#616264;
  134. border-radius:.1rem;
  135. li{
  136. font-size: .28rem;
  137. color:#ffffff;
  138. height: .32rem;
  139. line-height: .32rem;
  140. margin: .4rem .3rem;
  141. }
  142. }
  143. p{
  144. font-size:.24rem;
  145. color:#000;
  146. i{
  147. font-size: .53rem;
  148. color:#418ef7;
  149. }
  150. span{
  151. font-size:.3rem;
  152. color:#f94f28;
  153. margin:0 .1rem;
  154. }
  155. }
  156. >span{
  157. font-size:.28rem;
  158. color:#53a0f7;
  159. }
  160. }
  161. .shop-list {
  162. background:#fff;
  163. margin-top:.12rem;
  164. padding-bottom:.28rem;
  165. /*&:hover{*/
  166. /*background: #e1e1e1;*/
  167. /*}*/
  168. h3{
  169. font-size:.32rem;
  170. line-height: .8rem;
  171. margin:0;
  172. margin-left:.27rem;
  173. margin-bottom:.14rem;
  174. }
  175. .list-item{
  176. width:6.77rem;
  177. margin-left:.39rem;
  178. justify-content: space-around;
  179. display:inline-flex;
  180. .item-img{
  181. position:relative;
  182. width:2.42rem;
  183. height:1.69rem;
  184. i{
  185. display:block;
  186. position:absolute;
  187. width:.65rem;
  188. height:.33rem;
  189. }
  190. img{
  191. display:inline-block;
  192. width:100%;
  193. height:100%;
  194. border:.02rem solid #418bf6;
  195. }
  196. }
  197. .list-item-phone{
  198. width:3.95rem;
  199. padding-top:.18rem;
  200. position:relative;
  201. p{
  202. font-size:.28rem;
  203. line-height: .45rem;
  204. margin:0;
  205. }
  206. i{
  207. display:block;
  208. position:absolute;
  209. top: 0;
  210. right: 0;
  211. font-size:.4rem;
  212. color:#ff7800;
  213. }
  214. i.active{
  215. color:#333;
  216. }
  217. }
  218. }
  219. }
  220. }
  221. </style>