shopList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="shopList">
  3. <view class="shopList_head center">未成年人必须在家长监督下使用</view>
  4. <view class="shopList_ul flexs">
  5. <view class="shopList_li" v-for="(item,index) in boxDetail.goodslist" :key="index">
  6. <view class="shopList_li_con center">
  7. <view class="shopList_li_tag center" :class="{orange:item.tag == '稀有',red:item.tag == '至尊'}">{{ item.tag }}</view>
  8. <view class="shopList_li_img">
  9. <image :src="item.image" mode="aspectFill"></image>
  10. </view>
  11. <view class="shopList_li_price">
  12. <text>¥</text>
  13. <text>{{ item.price }}</text>
  14. </view>
  15. </view>
  16. <view class="shopList_li_name">{{ item.goods_name }}</view>
  17. </view>
  18. </view>
  19. <view class="shopList_footer flex" v-if="boxDetail.tags">
  20. <view class="shopList_footer_li" v-for="(item,index) in 3" :key="index">
  21. <text>{{ index == 0 ? '至尊款' : index == 1 ? '稀有款' : '普通款' }}</text>
  22. <text>概率{{ index == 0 ? boxDetail.tags.supreme : index == 1 ? boxDetail.tags.rare : boxDetail.tags.normal }}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. type:null,//1试玩0详情
  32. box_id:'',//盲盒ID
  33. boxDetail:{},//盲盒详情
  34. };
  35. },
  36. methods:{
  37. //获取详情
  38. getDetails () {
  39. this.$api[this.type == 1 ? 'tryBoxDetail' : 'boxDetail' ]({box_id:this.box_id}).then(res=>{
  40. if (res.code === 1) {
  41. this.boxDetail = res.data.more
  42. }
  43. })
  44. }
  45. },
  46. onLoad({id,type}) {
  47. this.type = type
  48. this.box_id = id
  49. this.getDetails()
  50. }
  51. }
  52. </script>
  53. <style>
  54. page {
  55. background: #FFFFFF;
  56. }
  57. </style>
  58. <style lang="scss">
  59. .shopList_head {
  60. height: 80rpx;
  61. color: #FA7E48;
  62. font-size: 28rpx;
  63. background: rgba(247, 157, 44, 0.1);
  64. }
  65. .shopList_ul {
  66. flex-wrap: wrap;
  67. overflow: hidden;
  68. padding: 30rpx 30rpx 120rpx 30rpx;
  69. .shopList_li {
  70. margin: 0 30rpx 30rpx 0;
  71. &:nth-child(3n) {
  72. margin-right: 0;
  73. }
  74. .shopList_li_name {
  75. width: 210rpx;
  76. height: 68rpx;
  77. display: -webkit-box;
  78. -webkit-box-orient: vertical;
  79. -webkit-line-clamp: 2;
  80. overflow: hidden;
  81. font-size: 26rpx;
  82. }
  83. .shopList_li_con {
  84. width: 210rpx;
  85. height: 204rpx;
  86. margin-bottom: 20rpx;
  87. flex-direction: column;
  88. position: relative;
  89. background: #F3F1F4;
  90. border-radius: 10rpx;
  91. .shopList_li_tag {
  92. top: 0;
  93. left: 0;
  94. color: #FFFFFF;
  95. font-size: 22rpx;
  96. width: 80rpx;
  97. height: 36rpx;
  98. z-index: 20;
  99. position: absolute;
  100. background:rgba(0, 0, 0, 0.5);
  101. border-radius: 10rpx 0rpx 20rpx 0rpx;
  102. }
  103. .orange {
  104. background: #FA7E48;
  105. }
  106. .red {
  107. background: #FF413F;
  108. }
  109. .shopList_li_img {
  110. width: 135rpx;
  111. height: 135rpx;
  112. }
  113. .shopList_li_price {
  114. display: flex;
  115. margin-top: 10rpx;
  116. align-items: flex-end;
  117. text {
  118. color: #CF271B;
  119. &:last-child {
  120. font-size: 28rpx;
  121. }
  122. }
  123. }
  124. }
  125. }
  126. }
  127. .shopList_footer {
  128. width: 100%;
  129. bottom: 0;
  130. left: 0;
  131. z-index: 20;
  132. padding-left: 60rpx;
  133. position: fixed;
  134. height: 120rpx;
  135. background: #FFFFFF;
  136. box-shadow: 0rpx 2rpx 5rpx 0rpx rgba(133, 159, 221, 0.6);
  137. .shopList_footer_li {
  138. flex: 1;
  139. display: flex;
  140. flex-direction: column;
  141. text {
  142. color: #FF413F;
  143. font-size: 30rpx;
  144. &:last-child {
  145. margin-top: 15rpx;
  146. font-size: 28rpx;
  147. }
  148. }
  149. &:nth-child(2) {
  150. text {
  151. color: #FA7E48;
  152. }
  153. }
  154. &:last-child {
  155. text {
  156. color: #999999;
  157. }
  158. }
  159. }
  160. }
  161. </style>