shop.vue 4.6 KB

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