StoreContent.vue 9.5 KB

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