StoreContent.vue 10 KB

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