shop.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div id="main">
  3. <header-view v-if="!isInFrame"></header-view>
  4. <template v-if="isShowShopHeader">
  5. <store-header/>
  6. <store-title/>
  7. </template>
  8. <template v-else>
  9. <main-header></main-header>
  10. <main-nav></main-nav>
  11. </template>
  12. <img v-if="isConsignment" class="banner-img" src="/images/all/banner-consignment.png" alt="">
  13. <!--<img v-if="isConsignment" class="cuxiao-banner" src="/images/all/banner-cuxiao.png" alt="">-->
  14. <nuxt/>
  15. <img v-if="isConsignment && !isInDetail" class="banner-img" src="/images/all/banner-consignment2.jpg" alt="" style="margin: 10px auto 30px;">
  16. <footer-view></footer-view>
  17. <right-bar></right-bar>
  18. </div>
  19. </template>
  20. <script>
  21. import { Header, Footer, RightBar } from '~components/default'
  22. import { StoreHeader, StoreTitle } from '~components/store'
  23. import { MainHeader, MainNav } from '~components/main'
  24. function getCount (str, char) {
  25. return str.split(char).length - 1
  26. }
  27. export default {
  28. name: 'shop',
  29. components: {
  30. HeaderView: Header,
  31. FooterView: Footer,
  32. RightBar,
  33. StoreHeader,
  34. StoreTitle,
  35. MainHeader,
  36. MainNav
  37. },
  38. head () {
  39. return {
  40. title: this.title,
  41. meta: [
  42. {hid: 'description', name: 'description', content: this.description},
  43. {hid: 'keywords', name: 'keywords', content: this.keywords}
  44. ]
  45. }
  46. },
  47. computed: {
  48. title () {
  49. let path = this.$route.path
  50. if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
  51. if (!this.isConsignment) {
  52. if (!this.storeInfo.storeName) {
  53. return '【优软商城】IC电子元器件现货采购交易平台商城'
  54. }
  55. return this.storeInfo.storeName + this.getStoreType(this.storeInfo.type) + '专卖店-优软商城'
  56. } else {
  57. return 'IC电子元器件库存寄售呆滞尾料空闲库存商城自营现货寄售-优软商城'
  58. }
  59. } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
  60. if (!this.commodity) {
  61. return '【优软商城】IC电子元器件现货采购交易平台商城'
  62. }
  63. return this.commodity.brandNameEn + this.commodity.code + '价格|现货库存|报价|产品参数-优软商城'
  64. } else {
  65. return '【优软商城】IC电子元器件现货采购交易平台商城'
  66. }
  67. },
  68. description () {
  69. let path = this.$route.path
  70. if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
  71. if (!this.isConsignment) {
  72. if (!this.storeInfo.storeName) {
  73. return '优软商城为您提供IC电子元器件库存寄售呆滞尾料空闲库存现货寄售服务,商城自营现货寄售让您更放心更省心。'
  74. }
  75. return this.storeInfo.storeName + '官方' + this.getStoreType(this.storeInfo.type) + '专卖店,提供最新IC电子元器件现货在线销售。'
  76. } else {
  77. return '优软商城为您提供IC电子元器件库存寄售呆滞尾料空闲库存现货寄售服务,商城自营现货寄售让您更放心更省心。'
  78. }
  79. } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
  80. if (!this.commodity) {
  81. return '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
  82. }
  83. return this.commodity.enterpriseName + '提供' + this.commodity.brandNameEn + this.commodity.code + '价格和' + this.commodity.code + '现货库存,并且内容还包含' + this.commodity.code + '产品参数、' + this.commodity.code + '规格书数据手册等。'
  84. } else {
  85. return '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
  86. }
  87. },
  88. keywords () {
  89. let path = this.$route.path
  90. if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
  91. if (!this.isConsignment) {
  92. if (!this.storeInfo.storeName) {
  93. return '优软商城,ic芯片库存寄售,电子元器件寄售'
  94. }
  95. return '电子元器件' + this.getStoreType(this.storeInfo.type) + '专卖店'
  96. } else {
  97. return '优软商城,ic芯片库存寄售,电子元器件寄售'
  98. }
  99. } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
  100. if (!this.commodity) {
  101. return '优软商城'
  102. }
  103. return this.commodity.code + '价格,' + this.commodity.code + '现货,' + this.commodity.code + '报价,' + this.commodity.code + '产品参数'
  104. } else {
  105. return '优软商城'
  106. }
  107. },
  108. storeInfo () {
  109. return this.$store.state.shop.storeInfo.store.data
  110. },
  111. isConsignment () {
  112. return this.storeInfo.type === 'CONSIGNMENT'
  113. },
  114. isInDetail () {
  115. return this.$route.path.indexOf('/store/productDetail/') !== -1
  116. },
  117. isShowShopHeader () {
  118. if (this.isInDetail) {
  119. if (this.$store.state.shop.storeInfo.commodity.data.id) {
  120. return true
  121. } else {
  122. return false
  123. }
  124. } else if (this.storeInfo.id) {
  125. return true
  126. } else {
  127. return false
  128. }
  129. }
  130. },
  131. methods: {
  132. getStoreType: function (type) {
  133. if (type === 'ORIGINAL_FACTORY') {
  134. return '原厂'
  135. } else if (type === 'AGENCY') {
  136. return '代理'
  137. } else if (type === 'DISTRIBUTION') {
  138. return '经销'
  139. } else if (type === 'CONSIGNMENT') {
  140. return '寄售'
  141. }
  142. return ''
  143. }
  144. }
  145. }
  146. </script>
  147. <style scoped>
  148. .banner-img {
  149. margin-top: -10px;
  150. }
  151. .cuxiao-banner {
  152. margin: 15px auto 20px ;
  153. display: block;
  154. }
  155. </style>