Floor.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div class="floor">
  3. <ul>
  4. <nuxt-link tag="li" :key="item.batchCode" :to="`/store/productDetail/${item.batchCode}`" class="list-item" v-for="item in data">
  5. <div class="img">
  6. <img :src="getLogo(item)" alt="">
  7. </div>
  8. <p class="text">{{item.code}}</p>
  9. <template v-if="item.prices && item.prices.length">
  10. <span class="text price" v-if="item.currencyName == 'RMB'">{{'¥' + item.prices[0].rMBPrice}}</span>
  11. <span class="text price" v-if="item.currencyName == 'USD'">{{'$' + item.prices[0].uSDPrice}}</span>
  12. </template>
  13. </nuxt-link>
  14. </ul>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. props: {
  20. data: {
  21. type: Array,
  22. default: []
  23. }
  24. },
  25. methods: {
  26. getLogo: function (item) {
  27. if (item.batchCode) {
  28. if (item.img) {
  29. return item.img
  30. } else {
  31. return '/images/component/default.png'
  32. }
  33. } else {
  34. if (item.brand && item.brand.logoUrl) {
  35. return item.brand.logoUrl
  36. } else {
  37. return '/images/component/default.png'
  38. }
  39. }
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. $img-size: 215px;
  46. .floor {
  47. .list-item {
  48. display: inline-block;
  49. margin-right: 10px;
  50. width: 290px;
  51. height: 350px;
  52. border-radius: 2px;
  53. -webkit-box-shadow: 2px 3px 9px 0 rgba( 0, 0, 0, .2 );
  54. -moz-box-shadow: 2px 3px 9px 0 rgba( 0, 0, 0, .2 );
  55. box-shadow: 2px 3px 9px 0 rgba( 0, 0, 0, .2 );
  56. text-align: center;
  57. border: 1px solid #fff;
  58. cursor: pointer;
  59. &:nth-child(4n) {
  60. margin-right: 0;
  61. }
  62. &:nth-child(n + 5) {
  63. margin-top: 10px;
  64. }
  65. &:hover {
  66. border-color: #366cf3;
  67. }
  68. .img {
  69. height: $img-size;
  70. line-height: $img-size;
  71. width: $img-size;
  72. margin: 11px auto 30px;
  73. img {
  74. max-width: $img-size;
  75. max-height: $img-size;
  76. }
  77. }
  78. .text {
  79. height: 20px;
  80. font-weight: bold;
  81. }
  82. .price {
  83. color: #f14f4f;
  84. }
  85. }
  86. }
  87. </style>