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