store.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div class="mobile-center">
  3. <div class="com-mobile-header mobile-center-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>店铺关注</p>
  6. <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
  7. </div>
  8. <div class="mobile-content">
  9. <div v-if="storeList.length" class="shop-list" v-bind:key="item.id" v-for="item in storeList" @click="goStoreDetail(item.storeInfo.uuid)">
  10. <h3>{{item.storeName}}</h3>
  11. <div class="list-item">
  12. <div class="item-img">
  13. <img :src="getBackground(item.storeInfo.type)" />
  14. <img :src="item.storeInfo.logoUrl || '/images/component/default.png'">
  15. </div>
  16. <div class="list-item-phone">
  17. <p>电话:<span>{{item.storeInfo.enterprise.enTel || '-'}}</span></p>
  18. <p>传真:<span>{{item.storeInfo.enterprise.enFax || '-'}}</span></p>
  19. <p>联系商家:<a @click="selectStoreInfo(item, $event)">点击查看</a></p>
  20. <i class="iconfont icon-shoucang" @click="cancelFocus(item, $event)"></i>
  21. </div>
  22. </div>
  23. </div>
  24. <empty-status v-if="!storeList.length" :type="'collect'" :showLink="true" :text="'抱歉,暂无店铺关注'"></empty-status>
  25. </div>
  26. <div class="mobile-modal" v-if="showStoreInfo" @touchmove="preventTouchMove($event)">
  27. <div class="mobile-modal-box mobile-link-en">
  28. <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
  29. <div class="mobile-modal-content">
  30. <!-- <div>商家地址:{{storeInfo.enAddress || storeInfo.address || '-'}}</div>-->
  31. <!--<div class="content-line link-url">在线咨询</div>-->
  32. <div v-if="storeInfo.enTel">致电:<a :href="'tel:' + storeInfo.enTel" target="_blank" class="content-line link-url">{{storeInfo.enTel || '-'}}</a></div>
  33. <div v-else>暂无联系方式</div>
  34. <!--<div>邮件:<a :href="'mailto:' + storeInfo.enEmail" target="_blank" class="content-line link-url">{{storeInfo.enEmail || '-'}}</a></div>-->
  35. </div>
  36. </div>
  37. </div>
  38. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  39. <pull-up :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  40. </div>
  41. </template>
  42. <script>
  43. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  44. export default {
  45. middleware: 'authenticated',
  46. layout: 'mobileNoHeader',
  47. data () {
  48. return {
  49. remindText: '',
  50. timeoutCount: 0,
  51. page: 1,
  52. count: 10,
  53. isChange: false,
  54. storeList: [],
  55. showStoreInfo: false,
  56. storeInfo: {}
  57. }
  58. },
  59. watch: {
  60. 'storeCollectList.data': {
  61. handler: function (val) {
  62. if (this.isChange) {
  63. this.storeList = val.content
  64. this.isChange = false
  65. } else {
  66. this.storeList = [...this.storeList, ...val.content]
  67. }
  68. },
  69. immediate: true
  70. }
  71. },
  72. computed: {
  73. storeCollectList () {
  74. return this.$store.state.shop.storeInfo.focusPage
  75. },
  76. fetching () {
  77. return this.storeCollectList.fetching
  78. },
  79. allPage () {
  80. return Math.floor(this.storeCollectList.data.totalElements / this.storeCollectList.data.size) + Math.floor(this.storeCollectList.data.totalElements % this.storeCollectList.data.size > 0 ? 1 : 0)
  81. }
  82. },
  83. fetch ({ store }) {
  84. return Promise.all([
  85. // 获取店铺关注列表
  86. store.dispatch('shop/StoreFocusPage', { count: 10, page: 1 })
  87. ])
  88. },
  89. components: {
  90. RemindBox,
  91. PullUp,
  92. EmptyStatus
  93. },
  94. methods: {
  95. onRemind: function (str) {
  96. this.remindText = str
  97. this.timeoutCount++
  98. },
  99. cancelFocus: function (item, event) {
  100. event.stopPropagation()
  101. this.$http.post('/trade/storeFocus/delete/storeId', [item.storeid])
  102. .then(response => {
  103. this.onRemind('取消收藏成功')
  104. this.isChange = true
  105. this.page = 1
  106. this.reloadList()
  107. }, err => {
  108. this.onRemind(err.response.data || '取消收藏失败')
  109. })
  110. },
  111. reloadList: function () {
  112. this.$store.dispatch('shop/StoreFocusPage', { count: this.count, page: this.page })
  113. },
  114. onPullUpAction: function () {
  115. this.page++
  116. this.reloadList()
  117. },
  118. getBackground: function (type) {
  119. let url = ''
  120. if (type === 'AGENCY') {
  121. url += '/images/mobile/@2x/shop/agency.png'
  122. } else if (type === 'DISTRIBUTION') {
  123. url += '/images/mobile/@2x/shop/distribution.png'
  124. } else if (type === 'ORIGINAL_FACTORY') {
  125. url += '/images/mobile/@2x/shop/original_factory.png'
  126. } else if (type === 'CONSIGNMENT') {
  127. url = '/images/mobile/@2x/shop/consignment.png'
  128. }
  129. return url
  130. },
  131. goStoreDetail: function (uuid) {
  132. this.$router.push('/mobile/shop/' + uuid)
  133. },
  134. selectStoreInfo: function (store, event) {
  135. event.stopPropagation()
  136. this.storeInfo = store.storeInfo.enterprise || {}
  137. this.showStoreInfo = true
  138. },
  139. checkInfo: function (str) {
  140. return str && str.trim() !== ''
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .mobile-content {
  147. padding-top: 1.26rem !important;
  148. }
  149. .shop-list {
  150. background:#fff;
  151. border-bottom: .1rem solid #dfe2e4;
  152. padding: .14rem 0 .14rem 0;
  153. &:first-child {
  154. border-top: .1rem solid #dfe2e4;
  155. }
  156. h3{
  157. font-size: .32rem;
  158. line-height: .4rem;
  159. margin: 0 0 0 .27rem;
  160. overflow: hidden;
  161. text-overflow: ellipsis;
  162. white-space: nowrap;
  163. padding-top: .1rem;
  164. position: relative;
  165. top: .1rem;
  166. }
  167. .list-item{
  168. width:6.77rem;
  169. margin-left:.39rem;
  170. .item-img{
  171. width:2.4rem;
  172. vertical-align: middle;
  173. display: inline-block;
  174. img{
  175. &:nth-child(2) {
  176. width:2.4rem;
  177. height:1.69rem;
  178. border: 1px solid #eee;
  179. }
  180. &:nth-child(1) {
  181. position:absolute;
  182. width:.65rem;
  183. height:.33rem;
  184. }
  185. }
  186. }
  187. .list-item-phone{
  188. width:3.95rem;
  189. padding:.18rem 0;
  190. position:relative;
  191. display: inline-block;
  192. vertical-align: middle;
  193. margin-left: .26rem;
  194. p{
  195. font-size:.28rem;
  196. line-height: .67rem;
  197. margin:0;
  198. overflow: hidden;
  199. text-overflow: ellipsis;
  200. white-space: nowrap;
  201. width: 3.2rem;
  202. }
  203. i{
  204. display:block;
  205. position:absolute;
  206. top: -.06rem;
  207. right: -.18rem;
  208. font-size:.5rem;
  209. color:#ff7800;
  210. width: .6rem;
  211. height: .6rem;
  212. text-align: center;
  213. line-height: .6rem;
  214. }
  215. }
  216. }
  217. &:active {
  218. background: #e1e1e1;
  219. }
  220. }
  221. </style>