vip.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="content-page-wrap flex-column">
  3. <top-main ref ="topMainRef" title="VIP" back></top-main>
  4. <view class="head-title flex-left justify-between">
  5. <view style="width: 94rpx">
  6. <u-icon
  7. name="arrow-left"
  8. color="#000E08"
  9. size="42rpx"
  10. @click="goBack"
  11. bold
  12. ></u-icon>
  13. </view>
  14. <view>VIP</view>
  15. <view style="width: 94rpx"> </view>
  16. </view>
  17. <view class="video-box">
  18. <radio-group @change="radioChange">
  19. <view
  20. class="card-row flex-column"
  21. v-for="(item, index) in vipList"
  22. :key="index"
  23. :style="{ backgroundImage: `url(${item.img})` }"
  24. >
  25. <view class="card-text">
  26. <view>
  27. <text> {{ item.costmoney }}TOX</text>
  28. <text class="cost-text"> {{ item.money }}TOX</text>
  29. </view>
  30. <radio :value="item.id" :checked="item.id==1?true:false" backgroundColor="" activeBackgroundColor="#3F3939"></radio>
  31. </view>
  32. </view>
  33. </radio-group>
  34. </view>
  35. <view style="margin: 30rpx 140rpx 60rpx">
  36. <u-button
  37. type="primary"
  38. text="支付"
  39. size="large"
  40. shape="circle"
  41. color="#3F3939"
  42. @click="handlePayment"
  43. ></u-button>
  44. </view>
  45. </view>
  46. </template>
  47. <script setup>
  48. import { ref, onMounted } from 'vue';
  49. import topMain from "@/components/topMain.vue";
  50. const topMainRef = ref(null);
  51. let vipList = ref([
  52. {
  53. costmoney: "0.01",
  54. money: "10",
  55. id: "1",
  56. img: "",
  57. },
  58. {
  59. costmoney: "0.02",
  60. money: "100",
  61. id: "2",
  62. img: "",
  63. },
  64. {
  65. costmoney: "0.03",
  66. money: "2000",
  67. id: "3",
  68. img: "",
  69. },
  70. ]);
  71. let selectedVip = ref("1"); // 设置默认选中的值为第一个选项的id
  72. const goBack = () => {
  73. uni.navigateBack();
  74. };
  75. const loadImages = async () => {
  76. try {
  77. const monthlyCard = (await import('@/static/img/monthly-card.svg')).default;
  78. const yearCard = (await import('@/static/img/year-card.svg')).default;
  79. const nftCard = (await import('@/static/img/nft-card.svg')).default;
  80. vipList.value[0].img = monthlyCard;
  81. vipList.value[1].img = yearCard;
  82. vipList.value[2].img = nftCard;
  83. console.log("Images loaded", vipList.value);
  84. } catch (error) {
  85. console.error("Error loading images", error);
  86. }
  87. };
  88. const radioChange = (evt) => {
  89. selectedVip.value = evt.detail.value;
  90. };
  91. const handlePayment = () => {
  92. const selectedVipItem = vipList.value.find(vip => vip.id === selectedVip.value);
  93. if (selectedVipItem) {
  94. topMainRef.value.transfer(selectedVipItem.costmoney);
  95. }
  96. };
  97. onMounted(() => {
  98. loadImages();
  99. });
  100. </script>
  101. <style lang="less" scoped>
  102. .content-page-wrap {
  103. overflow-x: hidden;
  104. padding: 32rpx;
  105. .video-box {
  106. width: 100%;
  107. .card-row {
  108. background-repeat: no-repeat;
  109. background-size: 100%;
  110. height: 430rpx;
  111. margin-bottom: 20rpx;
  112. .card-text {
  113. flex: 1;
  114. display: flex;
  115. align-items: flex-end;
  116. justify-content: space-between;
  117. padding: 32rpx 64rpx;
  118. color: #000;
  119. font-size: 32rpx;
  120. font-weight: bold;
  121. .cost-text {
  122. margin-left: 20rpx;
  123. text-decoration: line-through 4rpx solid #ff1717;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. </style>