index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div class="resume-box" :class="{'fullShow': fullShow}">
  3. <div class="resume-header" v-if="showTitle">
  4. <div class="resume-title">
  5. 余额充值
  6. </div>
  7. </div>
  8. <div class="d-flex align-center mb-10 mt-5">
  9. <div
  10. v-for="(item, index) in list"
  11. :key="index"
  12. class="packagesItem cursor-pointer mx-3"
  13. :class="{'active': current === (index+1)}"
  14. style="width: 200px;"
  15. @click="handleSelect(item, index)"
  16. >
  17. <div class="d-flex flex-column align-center pb-5" style="position: relative;">
  18. <div
  19. class="my-4 mt-6 font-size-16 font-weight-bold titleColor"
  20. :style="{'color': current === (index + 1) ? '#ff4747' : '#000'}"
  21. >
  22. {{ item.name }}
  23. </div>
  24. <!-- <div class="font-weight-bold priceBox">
  25. <span v-if="item.custom">
  26. <input
  27. v-model="item.payPrice"
  28. type="text"
  29. class="custom-input-num"
  30. :style="{'color': current === (index + 1) ? '#ff4747' : '#000'}"
  31. @keyup.enter="handleCustomEnter"
  32. @focus="item.tip = '输入完成后请按Enter键确认'"
  33. >
  34. </span>
  35. <span class="font28" v-else>{{ item.payPrice }}</span>
  36. </div> -->
  37. <div class="dailyPrice font-size-12 mt-1">
  38. <span v-if="!item.custom">¥{{ FenYuanTransform(item.payPrice) }}</span>
  39. <span v-else>{{ item.tip }}</span>
  40. </div>
  41. <div class="vip">
  42. <svg-icon v-if="current === (index+1)" name="diamond-active" size="50"></svg-icon>
  43. <svg-icon v-else name="diamond" size="50"></svg-icon>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <initPay
  49. v-if="itemInfo"
  50. :info="itemInfo"
  51. @stopInterval="null"
  52. @paySuccess="null"
  53. ></initPay>
  54. </div>
  55. </template>
  56. <script setup>
  57. defineOptions({ name: 'personalRecharge-index'})
  58. import { FenYuanTransform } from '@/utils/position'
  59. import { ref } from 'vue'
  60. import { getUserWalletRechargeList } from '@/api/recruit/personal/myWallet.js'
  61. import initPay from './initPay.vue'
  62. defineProps({
  63. showTitle: {
  64. type: Boolean,
  65. default: true
  66. }
  67. })
  68. import { useRoute } from 'vue-router'; const route = useRoute()
  69. const fullShow = ref(route.path === '/personalRecharge' ? true : false)
  70. const current = ref(0)
  71. const price = ref(0)
  72. const list = ref([])
  73. const getListData = async () => {
  74. const data = await getUserWalletRechargeList()
  75. list.value = data || []
  76. // 默认选中
  77. if (data?.length && data[0]) handleSelect(data[0], 0)
  78. // const end = { name: '自定义充值', payPrice: 100, custom: true, tip: '输入完成后请按Enter键确认' }
  79. // list.value = data ? [...data, end] : [end]
  80. }
  81. getListData()
  82. // const handleCustomEnter = (e) => {
  83. // const num = e.target.value
  84. // const custom = list.value.find(k => k.custom)
  85. // if (num < 100) {
  86. // custom.tip = '最低充值金额为100元'
  87. // custom.price = 100
  88. // return
  89. // }
  90. // price.value = num
  91. // }
  92. // const timer = ref(null)
  93. const itemInfo = ref(null)
  94. // let count = 1; const interval = 2000;
  95. const handleSelect = (item, index) => {
  96. // count = 1
  97. itemInfo.value = item
  98. current.value = index + 1
  99. price.value = item.payPrice
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .fullShow {
  104. width: 1100px;
  105. background-color: #fff;
  106. margin: 0 auto;
  107. min-height: 720px;
  108. }
  109. .packagesItem {
  110. border: 1px solid var(--color-f3);
  111. border-radius: 8px;
  112. background-color: var(--color-f2f4f742);
  113. }
  114. .dailyPrice {
  115. border-radius: 14px;
  116. background-color: #dde3e94f;
  117. padding: 2px 18px;
  118. color: var(--color-666);
  119. }
  120. .active {
  121. border: 2px solid #cf990c;
  122. background: linear-gradient(rgb(255, 242, 214) 8.86%, rgb(255, 225, 177) 100%);;
  123. .priceBox {
  124. color: var(--v-error-base);
  125. }
  126. .dailyPrice {
  127. color: var(--v-error-base);
  128. background-color: #fff4e7;
  129. }
  130. }
  131. .custom-input-num {
  132. border: none;
  133. outline: none;
  134. background-color: transparent;
  135. max-width: 100%;
  136. text-align: center;
  137. font-weight: 700;
  138. }
  139. .vip {
  140. width: 50px;
  141. height: 50px;
  142. position: absolute;
  143. top: 0;
  144. right: 0;
  145. overflow: hidden;
  146. border-radius: 8px
  147. }
  148. :deep(.v-slide-group__content) {
  149. background: none !important;
  150. }
  151. </style>