shop.vue 4.4 KB

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