StoreContent.vue 10 KB

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