excellentValue.vue 2.6 KB

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