FloorList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div class="floor-list">
  3. <div class="container">
  4. <floor-bar :floors="floors"></floor-bar>
  5. <a href="/store/33069557578d44e69bd91ad12d28a8d4" target="_blank"><img src="/images/all/banner-cuxiao.png" alt=""></a>
  6. <floor :floor="defaultFloors[0]" :isDefault="true" v-if="!isEmpty"></floor>
  7. <floor :floor="defaultFloors[1]" :isDefault="true" v-if="!isEmpty"></floor>
  8. <floor v-for="(floor, index) in floors.data" :floor="floor" :isDefault="false" :key="index"></floor>
  9. </div>
  10. <span v-if="expandFloors && false">floor</span>
  11. </div>
  12. </template>
  13. <script>
  14. import Floor from './Floor.vue'
  15. import FloorBar from './FloorBar.vue'
  16. export default {
  17. name: 'floor-list',
  18. components: {
  19. Floor,
  20. FloorBar
  21. },
  22. data () {
  23. return {
  24. defaultFloors: [
  25. {
  26. items: [
  27. {
  28. backGroundColor: '',
  29. body: '',
  30. hrefUrl: '/store/33069557578d44e69bd91ad12d28a8d4',
  31. pictureUrl: '/images/floor/banner1.jpg',
  32. size: 'large'
  33. }
  34. ]
  35. },
  36. {
  37. items: [
  38. {
  39. backGroundColor: '',
  40. body: '',
  41. hrefUrl: '/store/33069557578d44e69bd91ad12d28a8d4',
  42. pictureUrl: '/images/floor/banner2.jpg',
  43. size: 'large'
  44. }
  45. ]
  46. }
  47. ]
  48. }
  49. },
  50. computed: {
  51. floors () {
  52. return this.$store.state.floor.list
  53. },
  54. isProd () {
  55. return this.$store.state.option.url === 'http://www.usoftmall.com'
  56. },
  57. expandFloors () {
  58. let data = this.$store.state.floor.list_expand.data
  59. let _this = this
  60. for (let i = 0; i < data.length; i++) {
  61. let obj = {
  62. backGroundColor: '',
  63. body: '',
  64. hrefUrl: '',
  65. name: '',
  66. pictureUrl: '',
  67. size: '',
  68. price: '',
  69. currency: 'RMB'
  70. }
  71. if (data[i]) {
  72. obj.name = data[i].code
  73. obj.body = data[i].brandNameEn + '<br/>' + (data[i].kindNameCn || '其他')
  74. obj.hrefUrl = '/store/productDetail/' + data[i].batchCode
  75. obj.pictureUrl = '/images/floor/' + (this.isProd ? data[i].code : '2SD2704KT146') + '.png'
  76. obj.size = i % 3 === 0 ? 'medium' : 'small'
  77. obj.currency = data[i].currencyName
  78. obj.price = _this.getMinPrice(data[i].prices, data[i].currencyName)
  79. _this.defaultFloors[i < 6 ? 0 : 1].items.push(obj)
  80. }
  81. }
  82. return data
  83. },
  84. isEmpty () {
  85. let data = this.$store.state.floor.list_expand.data
  86. for (let i = 0; i < data.length; i++) {
  87. if (!(data.length && data[0] && data[0] !== null)) {
  88. return true
  89. }
  90. }
  91. return false
  92. }
  93. },
  94. methods: {
  95. getMinPrice: function (prices, currency) {
  96. for (let i = 0; i < prices.length; i++) {
  97. if (i === prices.length - 1) {
  98. return currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
  99. }
  100. }
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. @import '~assets/scss/variables';
  107. /*add*/
  108. .floor-list .container{
  109. padding: 0;
  110. }
  111. .floor-list {
  112. margin-bottom: $xlg-pad;
  113. }
  114. .floor-list .container > a > img {
  115. margin-bottom: -48px;
  116. margin-top: 30px;
  117. }
  118. </style>