StoreContent.vue 5.9 KB

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