moli.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="wrapper">
  3. <view class="font4 bold color-1">宝箱推荐</view>
  4. <view>
  5. <view
  6. v-for="item in data"
  7. :key="item.id"
  8. class="marginT15 flex-align"
  9. @click="showDetail(item)"
  10. >
  11. <view class="relative radius4 overflow-hidden flex-shrink0">
  12. <image :src="item.cover" class="image" mode="aspectFill" />
  13. <!-- <view class="image-desc">欧气命中节省¥987</view> -->
  14. </view>
  15. <view
  16. class="marginL10 relative flex1 self-stretch flex-column-between overflow-hidden"
  17. >
  18. <view class="color-1 font4 line-ellipsis flex-shrink1">{{ item.name }}</view>
  19. <view class="color-money font2">¥{{ item.price }}</view>
  20. <view class="font2 color-2">
  21. {{ item.goodsHighLevelQuantity }}稀有款 | 共{{ item.goodsTotalQuantity }}款
  22. </view>
  23. <view
  24. style="heigth: 80rpx"
  25. class="relative"
  26. :style="{ width: scrollwidth + 'px' }"
  27. >
  28. <scroll-view scroll-x class="scroll-wrapper">
  29. <image
  30. v-for="img in item.goodsCoverList"
  31. :key="img"
  32. :src="img"
  33. class="item"
  34. mode="aspectFit"
  35. />
  36. </scroll-view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. props: {
  46. data: Array
  47. },
  48. computed: {
  49. scrollwidth() {
  50. let width = this.$store.state.systemInfo.screenWidth
  51. width = width - uni.upx2px(28 * 2 + 220 + 20)
  52. return width
  53. }
  54. },
  55. methods: {
  56. showDetail(item) {
  57. if (item.mode === 'UNLIMITED') {
  58. this.$router.pushCheck('award_detail', {
  59. poolId: item.id
  60. })
  61. } else if (item.mode === 'YFS_PRO') {
  62. this.$router.pushCheck('award_detail_yfs', {
  63. poolId: item.id
  64. })
  65. }
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .wrapper {
  72. margin-top: 20rpx;
  73. background: #fff;
  74. border-radius: 20rpx;
  75. padding: 36rpx 28rpx;
  76. .image {
  77. width: 220rpx;
  78. height: 220rpx;
  79. border-radius: 4rpx;
  80. }
  81. .image-desc {
  82. color: #fff;
  83. font-size: 20rpx;
  84. position: absolute;
  85. left: 0;
  86. bottom: 0;
  87. width: 220rpx;
  88. height: 40rpx;
  89. line-height: 40rpx;
  90. text-align: center;
  91. background: linear-gradient(270deg, #b91a59 0%, #3f0bbd 100%);
  92. }
  93. .scroll-wrapper {
  94. overflow: hidden;
  95. height: 80rpx;
  96. white-space: nowrap;
  97. .item {
  98. display: inline-block;
  99. background: #f2f2f2;
  100. width: 80rpx;
  101. height: 80rpx;
  102. margin-right: 12rpx;
  103. border-radius: 8rpx;
  104. }
  105. }
  106. }
  107. </style>