newBox.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="newBox">
  3. <view class="home_recommend_ul flex">
  4. <view class="home_recommend_li" v-for="(item,index) in shopList" :key="index" @click="goMessage(item,0)">
  5. <view class="home_recommend_li_img">
  6. <view class="home_recommend_li_img_top flex">
  7. <view class="home_recommend_li_img_box">
  8. <image :src="item.image" mode="aspectFill"></image>
  9. </view>
  10. <view class="home_recommend_li_img_right" v-if="item.right.length != 0">
  11. <image :src="items" mode="aspectFill" v-for="(items,index) in item.right" :key="index"></image>
  12. </view>
  13. </view>
  14. <view class="home_recommend_li_img_bot">
  15. <image :src="items" mode="aspectFill" v-for="(items,index) in item.bot" :key="index"></image>
  16. </view>
  17. </view>
  18. <view class="home_recommend_li_main">
  19. <view class="home_recommend_li_price">价值:¥{{ item.price_min }}~¥{{ item.price_max }}</view>
  20. <view class="home_recommend_li_name">{{ item.box_name }}</view>
  21. <view class="home_recommend_li_glod flex">
  22. <text>{{ item.coin_price }}金币</text>
  23. <text>共{{ item.goods_num }}款商品</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. shopList:[],//商品列表
  35. };
  36. },
  37. methods:{
  38. //去详情
  39. goMessage (item,type) {
  40. uni.navigateTo({url:'/pages/index/details?id=' + item.box_id + '&type=' + type})
  41. },
  42. //最新开箱
  43. getNewbox () {
  44. this.$api.newestOpen().then(res=>{
  45. if (res.code === 1) {
  46. res.data.forEach(item=>{
  47. item.image = item.goods_images[0]
  48. item.right = []
  49. item.bot = []
  50. item.goods_images.forEach((em,index)=>{
  51. if (index > 0 && index < 3) {
  52. item.right.push(em)
  53. }
  54. if (index > 2) {
  55. item.bot.push(em)
  56. }
  57. })
  58. })
  59. this.shopList = res.data
  60. }
  61. })
  62. },
  63. },
  64. onLoad() {
  65. this.getNewbox()
  66. }
  67. }
  68. </script>
  69. <style lang="scss">
  70. .home_recommend_ul {
  71. flex-wrap: wrap;
  72. padding: 0 28rpx;
  73. padding-top: 30rpx;
  74. .home_recommend_li {
  75. width: 332rpx;
  76. padding: 20rpx;
  77. margin-bottom: 30rpx;
  78. background: #FFFFFF;
  79. box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(153, 153, 153, 0.1);
  80. border-radius: 10rpx;
  81. .home_recommend_li_img {
  82. height: 295rpx;
  83. .home_recommend_li_img_top {
  84. align-items: flex-start;
  85. }
  86. .home_recommend_li_img_bot {
  87. display: flex;
  88. margin-top: 20rpx;
  89. justify-content: flex-end;
  90. image {
  91. width: 85rpx;
  92. height: 85rpx;
  93. margin-left: 20rpx;
  94. &:first-child {
  95. margin-left: 0;
  96. }
  97. border-radius: 6rpx;
  98. }
  99. }
  100. .home_recommend_li_img_box {
  101. image {
  102. width: 190rpx;
  103. height: 190rpx;
  104. border-radius: 6rpx;
  105. }
  106. }
  107. .home_recommend_li_img_right {
  108. image {
  109. width: 85rpx;
  110. height: 85rpx;
  111. border-radius: 6rpx;
  112. &:first-child {
  113. margin-bottom: 20rpx;
  114. }
  115. }
  116. }
  117. }
  118. .home_recommend_li_price {
  119. // width: 280rpx;
  120. height: 40rpx;
  121. color: #FFFFFF;
  122. margin: 20rpx 0;
  123. font-size: 26rpx;
  124. line-height: 40rpx;
  125. padding-left: 18rpx;
  126. background: #F6AF32;
  127. border-radius: 20rpx;
  128. }
  129. .home_recommend_li_name {
  130. font-size: 28rpx;
  131. display: -webkit-box;
  132. -webkit-box-orient: vertical;
  133. -webkit-line-clamp: 2;
  134. overflow: hidden;
  135. height: 76rpx;
  136. }
  137. .home_recommend_li_glod {
  138. margin-top: 30rpx;
  139. text {
  140. color: #CF271B;
  141. font-size: 26tpx;
  142. &:last-child {
  143. color: #666666;
  144. font-size: 24rpx;
  145. }
  146. }
  147. }
  148. }
  149. }
  150. </style>