StoreContent.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div>
  3. <ul class="store-list" v-if="storeData.content && storeData.content.length > 0">
  4. <li v-for="(store, index) in storeData.content">
  5. <div class="store-content-left">
  6. <a :href="'/store/' + store.uuid">
  7. <img :src="store.logoUrl?store.logoUrl:'/images/all/default.png'" class="storeImg" alt="">
  8. </a>
  9. <div class="store-detail">
  10. <a :href="'/store/' + store.uuid">{{store.storeName}}</a>
  11. <span href="">电话:{{store.enterprise.enTel}}</span>
  12. <span href="">传真:{{store.enterprise.enFax}}</span>
  13. <span href="">地址:{{store.enterprise.enAddress}}</span>
  14. </div>
  15. <div class="btn-content">
  16. <span style="position: relative;" class="call-seller">
  17. <img src="static/img/common/songguo.png?_v=1503050008623">
  18. <a name="21059" href="javascript:void(0)" class="contact_btn">联系卖家</a>
  19. </span>
  20. <a class="focus-store store-btn" @click="focusStore(store, index)" v-text="focusData[index] === 'true'?'已关注':'关注店铺'"></a>
  21. <a :href="'/store/' + store.uuid" class="enter-store store-btn">进入店铺</a>
  22. </div>
  23. </div>
  24. <ul class="store-component-list" v-if="componentData">
  25. <li v-for="item in componentData[index].content">
  26. <a :href="`/product/component/${item.uuid}`"><img :src="item.img?item.img:'/images/all/default.png'" alt=""></a>
  27. <a :href="`/product/component/${item.uuid}`" class="store-component-code" v-text="item.code" :title="item.code"></a>
  28. <a :href="`/product/brand/${item.branduuid}`" v-text="item.brandNameEn"></a>
  29. <a :href="`/product/kind/${item.kindUuid}`" v-text="item.kindNameCn"></a>
  30. </li>
  31. </ul>
  32. </li>
  33. </ul>
  34. <page :total="storeData.totalElements" :page-size="pageSize"
  35. :current="nowPage" v-on:childEvent="listenPage"></page>
  36. <el-dialog
  37. :visible.sync="dialogVisible"
  38. size="tiny"
  39. >
  40. <h3 class="header-text">关注成功!</h3>
  41. <div class="focus modal-body">
  42. <button type="button" @click="dialogVisible = false" class="btn" style="margin-left:25px;">关&nbsp;&nbsp;闭</button>
  43. <button type="button" @click="dialogVisible = false" class="focus-btn btn btn btn-info" style="margin-left:35px;">
  44. <a href="/user#/storeFocus" target="_blank">查看我的店铺关注</a>
  45. </button>
  46. </div>
  47. </el-dialog>
  48. </div>
  49. </template>
  50. <script>
  51. import Page from '~components/common/page/pageComponent.vue'
  52. export default {
  53. data () {
  54. return {
  55. dialogVisible: false,
  56. pageSize: 8,
  57. nowPage: 1
  58. }
  59. },
  60. components: {
  61. Page
  62. },
  63. computed: {
  64. user () {
  65. return this.$store.state.option.user
  66. },
  67. storeDetail () {
  68. return this.$store.state.searchStore.searchStoreDetail.detail.data
  69. },
  70. storeData () {
  71. return this.storeDetail[0].stores
  72. },
  73. focusData () {
  74. return this.storeDetail[1].isFocus
  75. },
  76. componentData () {
  77. return this.storeDetail[1].image
  78. }
  79. },
  80. methods: {
  81. focusStore: function (store, index) {
  82. if (!this.user.logged) {
  83. this.$http.get('/login/page').then(response => {
  84. if (response.data) {
  85. this.$router.push('/auth/login')
  86. }
  87. })
  88. } else {
  89. if (this.focusData[index] === 'true') {
  90. // 已关注
  91. this.$message.error('店铺已关注,不能重复关注')
  92. } else {
  93. // 未关注
  94. this.$http.post('/trade/storeFocus/save', {storeName: store.storeName, storeid: store.id})
  95. .then(response => {
  96. if (response.data === 'success') {
  97. // 关注成功
  98. this.dialogVisible = true
  99. this.focusData[index] = 'true'
  100. } else {
  101. // 关注失败
  102. this.$message.error('关注失败')
  103. }
  104. })
  105. }
  106. }
  107. },
  108. listenPage: function (page) {
  109. this.$emit('pageAction', page)
  110. }
  111. }
  112. }
  113. </script>
  114. <style scoped>
  115. .store-list {
  116. border-right: 1px solid;
  117. border-left: 1px solid;
  118. }
  119. .store-list >li{
  120. border-bottom: 1px solid;
  121. padding: 20px 0;
  122. }
  123. .store-content-left {
  124. width: 550px;
  125. display: inline-block;
  126. }
  127. .store-content-left >div {
  128. display: inline-block;
  129. }
  130. .store-content-left >a {
  131. color: black;
  132. }
  133. .store-content-left >a >img.storeImg {
  134. border: 1px solid;
  135. width: 250px;
  136. height: 200px;
  137. margin-left: 10px;
  138. }
  139. .btn-content {
  140. position: relative;
  141. top: 30px;
  142. float: right;
  143. }
  144. .btn-content >span {
  145. display: block;
  146. }
  147. .btn-content >span:hover {
  148. cursor: pointer;
  149. }
  150. .store-detail {
  151. margin-left: 20px;
  152. }
  153. .store-detail >a {
  154. font-size: 14px;
  155. font-weight: 700;
  156. color: black;
  157. }
  158. .store-detail a:hover {
  159. color: #f39801;
  160. }
  161. .store-detail >span{
  162. display: block;
  163. margin-top: 10px;
  164. font-size: 12px;
  165. width: 178px;
  166. }
  167. .btn-content .call-seller {
  168. margin-bottom: 30px;
  169. }
  170. .btn-content .call-seller .contact_btn {
  171. width: 62px;
  172. height: 18px;
  173. line-height: 18px;
  174. background: #ef7f03;
  175. display: inline-block;
  176. text-align: center;
  177. color: #fff;
  178. font-size: 12px;
  179. border-radius: 5px;
  180. }
  181. .btn-content .store-btn {
  182. padding: 5px;
  183. background: #169bd5;
  184. text-align: center;
  185. border-radius: 5px;
  186. color: white;
  187. display: block;
  188. }
  189. .btn-content .focus-store {
  190. margin-bottom: 30px;
  191. }
  192. .btn-content .enter-store {
  193. }
  194. .store-component-list {
  195. width: 638px;
  196. display: inline-block;
  197. vertical-align: middle;
  198. padding-left: 20px;
  199. }
  200. .store-component-list >li {
  201. display: inline-block;
  202. text-align: center;
  203. padding: 5px 15px;
  204. border: 1px solid;
  205. margin-left: 20px;
  206. width: 132px;
  207. height: 132px;
  208. }
  209. .store-component-list >li img {
  210. width: 100px;
  211. height:60px;
  212. }
  213. .store-component-list >li img:hover {
  214. cursor: pointer;
  215. }
  216. .store-component-list >li a:not(:first-child) {
  217. display: block;
  218. font-size: 10px;
  219. color: black;
  220. margin-top: 3px;
  221. max-width: 100px;
  222. overflow: hidden;
  223. text-overflow: ellipsis;
  224. height: 16px;
  225. line-height: 16px;
  226. }
  227. .store-component-list >li a:hover {
  228. color: #f39801;
  229. }
  230. .store-component-list .store-component-code {
  231. font-weight: 600;
  232. }
  233. .header-text {
  234. text-align: center;
  235. font-size: 20px;
  236. color: #008B00;
  237. margin-top: 0;
  238. }
  239. .el-dialog__body{
  240. padding: 20px !important;
  241. }
  242. .focus button.focus-btn a{
  243. color: #fff;
  244. }
  245. </style>