excellentValue.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="container">
  3. <view class="list">
  4. <view class="ka" v-for="(item, index) in kaList" @click="toDrawCard(item)">
  5. <view class="top">
  6. <image mode="aspectFit" :src="item.prizeIcon"></image>
  7. </view>
  8. <view class="ka-info">
  9. <view class="ka-name">
  10. {{ item.name }}
  11. </view>
  12. <view class="row">
  13. <view class="money">
  14. ¥<span style="font-size: 16px;">{{ item.price }}</span>
  15. </view>
  16. <view class="number">
  17. <view class="residue">
  18. 剩余{{item.balaceNum}}
  19. </view>
  20. <view class="total">
  21. /{{item.totalNum}}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. raffleListApi
  33. } from "@/api/drawCard.js"
  34. export default {
  35. data() {
  36. return {
  37. kaList: [],
  38. }
  39. },
  40. onLoad() {
  41. this.getList()
  42. },
  43. methods: {
  44. getList() {
  45. let params = {
  46. limit: 99,
  47. page: 1,
  48. type: 5
  49. }
  50. raffleListApi(params).then(res => {
  51. console.log(res, '卡包列表')
  52. this.kaList = res.data.list
  53. })
  54. },
  55. toDrawCard(item) {
  56. wx.navigateTo({
  57. url: '/pages/drawCard_first/drawCard_first?id=' + item.id
  58. })
  59. }
  60. }
  61. }
  62. </script>
  63. <style scoped lang="scss">
  64. .container {
  65. background: #9EC8F9;
  66. .list {
  67. display: grid;
  68. grid-template-columns: 1fr 1fr;
  69. grid-gap: 10px;
  70. padding: 10px;
  71. .ka {
  72. background: #fff;
  73. width: calc(50vw - 15px);
  74. box-shadow: 0px 2px 8px 2px rgba(0,0,0,0.1);
  75. border-radius: 10px;
  76. overflow: hidden;
  77. // height: 60vw;
  78. .top {
  79. // height: 60vw;
  80. background: linear-gradient(180deg, #FAF1A7 0%, #FFE456 100%);
  81. text-align: center;
  82. display: flex;
  83. justify-content: center;
  84. image {
  85. width: 35vw;
  86. height: 50vw;
  87. }
  88. }
  89. .ka-info {
  90. padding: 10px;
  91. .ka-name {
  92. font-size: 15px;
  93. font-weight: 600;
  94. }
  95. .row {
  96. margin-top: 5px;
  97. display: flex;
  98. justify-content: space-between;
  99. .money {
  100. font-size: 12px;
  101. font-weight: 600;
  102. color: #FF2C43;
  103. }
  104. .number {
  105. display: flex;
  106. align-items: center;
  107. .residue {
  108. color: #FF2C43;
  109. font-size: 13px;
  110. }
  111. .total {
  112. font-size: 11px;
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }
  119. }
  120. </style>