shop.vue 4.7 KB

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