StoreContent.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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" :title="store.storeName">{{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 v-text="salesData[index]"></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, index2) in componentData[index].content" @click="goStore(index, index2)">
  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" :title="item.brandNameEn"></a>
  40. <a v-text="item.kindNameCn" :title="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. salesData () {
  92. return this.storeDetail[1].sales
  93. }
  94. },
  95. methods: {
  96. focusStore: function (store, index) {
  97. if (!this.user.logged) {
  98. this.$http.get('/login/page').then(response => {
  99. if (response.data) {
  100. this.$router.push('/auth/login')
  101. }
  102. })
  103. } else {
  104. if (this.focusData[index] === 'true') {
  105. // 已关注
  106. this.$message.error('店铺已关注,不能重复关注')
  107. } else {
  108. // 未关注
  109. this.$http.post('/trade/storeFocus/save', {storeName: store.storeName, storeid: store.id})
  110. .then(response => {
  111. if (response.data === 'success') {
  112. // 关注成功
  113. this.dialogVisible = true
  114. this.focusData[index] = 'true'
  115. } else {
  116. // 关注失败
  117. this.$message.error('关注失败')
  118. }
  119. })
  120. }
  121. }
  122. },
  123. listenPage: function (page) {
  124. this.$emit('pageAction', page)
  125. },
  126. goStore: function (index, compIndex) {
  127. window.open('/product/component/' + this.componentData[index].content[compIndex].uuid)
  128. }
  129. }
  130. }
  131. </script>
  132. <style scoped>
  133. .store-list {
  134. border-right: 1px solid rgb( 231, 231, 231 );
  135. border-left: 1px solid rgb( 231, 231, 231 );
  136. }
  137. .store-list >li{
  138. border-bottom: 1px solid rgb( 231, 231, 231 );
  139. padding: 20px 0;
  140. }
  141. .store-content-left {
  142. display: inline-block;
  143. margin-right: 27px;
  144. }
  145. .store-content-left .component-count{
  146. display: block;
  147. margin-left: 10px;
  148. margin-top: 20px;
  149. }
  150. .store-content-left >div {
  151. display: inline-block;
  152. }
  153. .store-content-left >a {
  154. color: black;
  155. float: left;
  156. width: 100px;
  157. height: 100px;
  158. line-height: 100px;
  159. display: inline-block;
  160. border: 1px solid rgb( 231, 231, 231 );
  161. overflow: hidden;
  162. margin-left: 10px;
  163. }
  164. .store-content-left >a >img.storeImg {
  165. max-width: 100px;
  166. max-height: 100px;
  167. }
  168. .btn-content {
  169. display: block!important;
  170. margin-top: 20px;
  171. }
  172. .btn-content >span {
  173. display: block;
  174. }
  175. .btn-content >span:hover {
  176. cursor: pointer;
  177. }
  178. .store-detail {
  179. margin-left: 20px;
  180. }
  181. .store-detail >a {
  182. font-size: 14px;
  183. font-weight: 700;
  184. color: black;
  185. display: block;
  186. overflow: hidden;
  187. width: 175px;
  188. white-space: nowrap;
  189. text-overflow: ellipsis;
  190. }
  191. .store-detail >span{
  192. display: block;
  193. font-size: 12px;
  194. width: 190px;
  195. }
  196. .store-detail .call-seller {
  197. margin-top: 14px;
  198. }
  199. .store-detail .call-seller .contact_btn {
  200. width: 62px;
  201. height: 18px;
  202. line-height: 18px;
  203. background: #ef7f03;
  204. display: inline-block;
  205. text-align: center;
  206. color: #fff;
  207. font-size: 12px;
  208. border-radius: 5px;
  209. margin-left: 5px;
  210. }
  211. .store-detail .main-product {
  212. margin-top: 12px;
  213. }
  214. .store-detail .main-product a:hover {
  215. cursor: pointer;
  216. color: #5078cb!important;
  217. }
  218. .store-detail .main-product a {
  219. color: #333;
  220. width: 126px;
  221. display: inline-block;
  222. float: left;
  223. overflow: hidden;
  224. word-break: break-all;
  225. height: 35px;
  226. line-height: 16px;
  227. text-overflow: ellipsis;
  228. /*-webkit-line-clamp: 2;
  229. -moz-line-clamp: 2;
  230. -o-line-clamp: 2;
  231. -ms-line-clamp: 2;
  232. -webkit-box-orient: vertical;
  233. -moz-box-orient: vertical;
  234. -o-box-orient: vertical;
  235. -ms-box-orient: vertical;*/
  236. }
  237. .btn-content .store-btn {
  238. padding: 4px 14px;
  239. color: white;
  240. display: inline-block;
  241. }
  242. .btn-content .focus-store {
  243. margin-right: 30px;
  244. margin-left: 10px;
  245. background: #5078cb;
  246. border: 1px solid #5078cb;
  247. }
  248. .btn-content .enter-store {
  249. background: #ff8522;
  250. border: 1px solid #ff8522;
  251. }
  252. .store-component-list {
  253. display: inline-block;
  254. margin-right: 6px;
  255. width: 834px;
  256. float: right;
  257. }
  258. .store-component-list >li {
  259. display: inline-block;
  260. text-align: center;
  261. border: 1px solid rgb( 231, 231, 231 );
  262. margin-right: 14px;
  263. width: 152px;
  264. height: 178px;
  265. }
  266. .store-component-list >li:hover {
  267. cursor: pointer;
  268. color: #fff!important;
  269. border: 1px solid #5078cb;
  270. }
  271. .store-component-list >li:hover .describe-list {
  272. background: #5078cb;
  273. }
  274. .store-component-list >li:hover div a {
  275. color: #fff;
  276. }
  277. .store-component-list >li img {
  278. width: 149px;
  279. height:114px;
  280. }
  281. .store-component-list >li .describe-list {
  282. padding: 2px 10px;
  283. background: #dee0e5;
  284. height: 64px;
  285. }
  286. .store-component-list >li div a {
  287. display: block;
  288. font-size: 14px;
  289. text-align: left;
  290. color: #333;
  291. overflow: hidden;
  292. text-overflow: ellipsis;
  293. line-height: 20px;
  294. white-space: nowrap;
  295. }
  296. /* .store-component-list >li a:hover {
  297. color: #f39801;
  298. }*/
  299. /*.store-component-list .store-component-code {
  300. }*/
  301. .header-text {
  302. text-align: center;
  303. font-size: 20px;
  304. color: #008B00;
  305. margin-top: 0;
  306. }
  307. .el-dialog__body{
  308. padding: 20px !important;
  309. }
  310. .focus button.focus-btn a{
  311. color: #fff;
  312. }
  313. </style>