shop.vue 5.2 KB

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