StoreContent.vue 8.3 KB

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