index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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' )" v-show="downName !== '全部'">全部</li>
  8. <li @click="onDown('ORIGINAL_FACTORY')" v-show="downName !== '原厂'">原厂</li>
  9. <li @click="onDown('AGENCY')" v-show="downName !== '代理'">代理</li>
  10. <li @click="onDown('DISTRIBUTION')" v-show="downName !== '经销'">经销</li>
  11. </ul>
  12. </div>
  13. <div class="shop-list" v-for="item in list.content" @click="goStoreDetail(item.uuid)">
  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, $event)"></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, $event) {
  94. // item.isFocus = item.isFocus === 'false' ? 'true' : 'false'
  95. $event.stopPropagation()
  96. if (item.isFocus === 'false') {
  97. this.$http.post('/trade/storeFocus/save', {storeName: item.storeName, storeid: item.id})
  98. .then(response => {
  99. item.isFocus = 'true'
  100. this.collectResult = '收藏成功'
  101. this.timeoutCount++
  102. })
  103. } else {
  104. this.$http.post('/trade/storeFocus/delete/storeId', [item.id])
  105. .then(response => {
  106. item.isFocus = 'false'
  107. this.collectResult = '取消成功'
  108. this.timeoutCount++
  109. })
  110. }
  111. },
  112. goStoreDetail: function (uuid) {
  113. this.$router.push('/mobile/shop/' + uuid)
  114. }
  115. }
  116. }
  117. </script>
  118. <style scoped lang="scss">
  119. .shop{
  120. margin-bottom: .98rem;
  121. min-height: 10rem;
  122. background: #e2e4e6;
  123. .shop-top{
  124. display:inline-flex;
  125. justify-content: space-between;
  126. align-items: center;
  127. width:100%;
  128. height:1.14rem;
  129. padding:0 .3rem;
  130. position:relative;
  131. background:#fff;
  132. .supdown{
  133. position:absolute;
  134. top:.8rem;
  135. right:.2rem;
  136. z-index:100;
  137. background:#616264;
  138. border-radius:.1rem;
  139. li{
  140. font-size: .28rem;
  141. color:#ffffff;
  142. height: .32rem;
  143. line-height: .32rem;
  144. margin: .4rem .3rem;
  145. }
  146. }
  147. p{
  148. font-size:.24rem;
  149. color:#000;
  150. i{
  151. font-size: .53rem;
  152. color:#418ef7;
  153. }
  154. span{
  155. font-size:.3rem;
  156. color:#f94f28;
  157. margin:0 .1rem;
  158. }
  159. }
  160. >span{
  161. font-size:.28rem;
  162. color:#53a0f7;
  163. }
  164. }
  165. .shop-list {
  166. background:#fff;
  167. margin-top:.12rem;
  168. padding-bottom:.28rem;
  169. /*&:hover{*/
  170. /*background: #e1e1e1;*/
  171. /*}*/
  172. h3{
  173. font-size:.32rem;
  174. line-height: .8rem;
  175. margin:0;
  176. margin-left:.27rem;
  177. margin-bottom:.14rem;
  178. }
  179. .list-item{
  180. width:6.77rem;
  181. margin-left:.39rem;
  182. justify-content: space-around;
  183. display:inline-flex;
  184. .item-img{
  185. position:relative;
  186. width:2.42rem;
  187. height:1.69rem;
  188. i{
  189. display:block;
  190. position:absolute;
  191. width:.65rem;
  192. height:.33rem;
  193. }
  194. img{
  195. display:inline-block;
  196. width:100%;
  197. height:100%;
  198. border:.02rem solid #eee;
  199. }
  200. }
  201. .list-item-phone{
  202. width:3.95rem;
  203. padding-top:.18rem;
  204. position:relative;
  205. p{
  206. font-size:.28rem;
  207. line-height: .45rem;
  208. margin:0;
  209. }
  210. i{
  211. display:block;
  212. position:absolute;
  213. top: 0;
  214. right: 0;
  215. font-size:.4rem;
  216. color:#ff7800;
  217. }
  218. i.active{
  219. color:#333;
  220. }
  221. }
  222. }
  223. &:active {
  224. background: #e1e1e1;
  225. }
  226. }
  227. }
  228. </style>