shop.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. isInFrame () {
  49. if (this.$route.query.type === 'erp') {
  50. this.$store.commit('option/ADD_COOKIES', 'type=erp;')
  51. return true
  52. } else {
  53. let cookies = this.$store.state.option.cookies
  54. let cookieArr = cookies.split(';')
  55. let cookieObj = {}
  56. for (let i = 0; i < cookieArr.length; i++) {
  57. if (cookieArr[i].indexOf('=') > -1) {
  58. let tmpArr = cookieArr[i].split('=')
  59. cookieObj[tmpArr[0].trim()] = tmpArr[1].trim()
  60. }
  61. }
  62. return cookieObj.type === 'erp'
  63. }
  64. },
  65. title () {
  66. let path = this.$route.path
  67. if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
  68. if (!this.isConsignment) {
  69. if (!this.storeInfo.storeName) {
  70. return '【优软商城】IC电子元器件现货采购交易平台商城'
  71. }
  72. return this.storeInfo.storeName + this.getStoreType(this.storeInfo.type) + '专卖店-优软商城'
  73. } else {
  74. return 'IC电子元器件库存寄售呆滞尾料空闲库存商城自营现货寄售-优软商城'
  75. }
  76. } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
  77. if (!this.commodity) {
  78. return '【优软商城】IC电子元器件现货采购交易平台商城'
  79. }
  80. return this.commodity.brandNameEn + this.commodity.code + '价格|现货库存|报价|产品参数-优软商城'
  81. } else {
  82. return '【优软商城】IC电子元器件现货采购交易平台商城'
  83. }
  84. },
  85. description () {
  86. let path = this.$route.path
  87. if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
  88. if (!this.isConsignment) {
  89. if (!this.storeInfo.storeName) {
  90. return '优软商城为您提供IC电子元器件库存寄售呆滞尾料空闲库存现货寄售服务,商城自营现货寄售让您更放心更省心。'
  91. }
  92. return this.storeInfo.storeName + '官方' + this.getStoreType(this.storeInfo.type) + '专卖店,提供最新IC电子元器件现货在线销售。'
  93. } else {
  94. return '优软商城为您提供IC电子元器件库存寄售呆滞尾料空闲库存现货寄售服务,商城自营现货寄售让您更放心更省心。'
  95. }
  96. } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
  97. if (!this.commodity) {
  98. return '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
  99. }
  100. return this.commodity.enterpriseName + '提供' + this.commodity.brandNameEn + this.commodity.code + '价格和' + this.commodity.code + '现货库存,并且内容还包含' + this.commodity.code + '产品参数、' + this.commodity.code + '规格书数据手册等。'
  101. } else {
  102. return '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
  103. }
  104. },
  105. keywords () {
  106. let path = this.$route.path
  107. if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
  108. if (!this.isConsignment) {
  109. if (!this.storeInfo.storeName) {
  110. return '优软商城,ic芯片库存寄售,电子元器件寄售'
  111. }
  112. return '电子元器件' + this.getStoreType(this.storeInfo.type) + '专卖店'
  113. } else {
  114. return '优软商城,ic芯片库存寄售,电子元器件寄售'
  115. }
  116. } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
  117. if (!this.commodity) {
  118. return '优软商城'
  119. }
  120. return this.commodity.code + '价格,' + this.commodity.code + '现货,' + this.commodity.code + '报价,' + this.commodity.code + '产品参数'
  121. } else {
  122. return '优软商城'
  123. }
  124. },
  125. storeInfo () {
  126. return this.$store.state.shop.storeInfo.store.data
  127. },
  128. isConsignment () {
  129. return this.storeInfo.type === 'CONSIGNMENT'
  130. },
  131. isInDetail () {
  132. return this.$route.path.indexOf('/store/productDetail/') !== -1
  133. },
  134. isShowShopHeader () {
  135. if (this.isInDetail) {
  136. if (this.$store.state.shop.storeInfo.commodity.data.id) {
  137. return true
  138. } else {
  139. return false
  140. }
  141. } else if (this.storeInfo.id) {
  142. return true
  143. } else {
  144. return false
  145. }
  146. }
  147. },
  148. methods: {
  149. getStoreType: function (type) {
  150. if (type === 'ORIGINAL_FACTORY') {
  151. return '原厂'
  152. } else if (type === 'AGENCY') {
  153. return '代理'
  154. } else if (type === 'DISTRIBUTION') {
  155. return '经销'
  156. } else if (type === 'CONSIGNMENT') {
  157. return '寄售'
  158. }
  159. return ''
  160. }
  161. }
  162. }
  163. </script>
  164. <style scoped>
  165. .banner-img {
  166. margin-top: -10px;
  167. }
  168. .cuxiao-banner {
  169. margin: 15px auto 20px ;
  170. display: block;
  171. }
  172. </style>