index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div class="default-width">
  3. <div class="pa-3 mb-2 white-bgc">
  4. <!-- 余额展示 -->
  5. <div class="statisticsBox">
  6. <div class="ml-10 mt-2">
  7. <div class="item-title">
  8. 您当前可用余额
  9. </div>
  10. <div class="item-value">
  11. {{ userAccount?.balance && userAccount?.balance > 0 ? (userAccount?.balance / 100.0).toFixed(2) : 0 }}
  12. <span
  13. class="text-decoration-underline cursor-pointer"
  14. style="color: #666; font-size: 16px;"
  15. @click.stop="handleRecharge"
  16. >充值</span>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <!-- 表格 -->
  22. <div class="mt-3 white-bgc pa-3 pt-3">
  23. <v-tabs v-model="tab" align-tabs="start" color="primary" bg-color="#f7f8fa" @update:model-value="handleChangeTab">
  24. <v-tab value="rechargeDetails">{{ $t('points.rechargeDetails') }}</v-tab>
  25. <!-- <v-tab :value="otherHeader">otherHeader</v-tab> -->
  26. </v-tabs>
  27. <CtTable
  28. class="mt-3"
  29. :items="dataList"
  30. :headers="headerList[tab]"
  31. :loading="false"
  32. :elevation="0"
  33. :isTools="false"
  34. :showPage="true"
  35. :total="total"
  36. :page-info="query"
  37. itemKey="id"
  38. @pageHandleChange="handleChangePage"
  39. >
  40. </CtTable>
  41. </div>
  42. </div>
  43. </template>
  44. <script setup>
  45. defineOptions({name: 'myWallet-myBalance-index'})
  46. import { ref } from 'vue'
  47. import { timesTampChange } from '@/utils/date'
  48. import { FenYuanTransform } from '@/utils/position'
  49. import { getUserWalletRechargePage } from '@/api/recruit/personal/myWallet.js'
  50. const tab = ref('rechargeDetails')
  51. const userAccount = ref(JSON.parse(localStorage.getItem('userAccount')) || {}) // 账户信息
  52. const total = ref(0)
  53. const query = ref({
  54. pageNo: 1,
  55. pageSize: 10,
  56. })
  57. const dataList = ref([])
  58. const headerList = {
  59. rechargeDetails: [
  60. { title: '充值金额', key: 'payPrice', value: item => FenYuanTransform(item.payPrice) + '元', sortable: false },
  61. { title: '支付方式', key: 'payChannelName', sortable: false },
  62. { title: '支付订单编号', key: 'payOrderId', sortable: false },
  63. { title: '交易时间', key: 'payTime', value: item => timesTampChange(item.payTime), sortable: false },
  64. ],
  65. // otherHeader: []
  66. }
  67. // 积分、签到明细
  68. const getData = async () => {
  69. const res = await getUserWalletRechargePage(query.value)
  70. dataList.value = res.list
  71. total.value = res.total
  72. }
  73. getData()
  74. const handleChangePage = (e) => {
  75. query.value.pageNo = e
  76. getData()
  77. }
  78. // 切换
  79. const handleChangeTab = () => {
  80. query.value.pageNo = 1
  81. getData()
  82. }
  83. // 充值
  84. import { useRouter } from 'vue-router'; const router = useRouter()
  85. const handleRecharge = () => {
  86. router.push({ path: '/personalRecharge' })
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .statisticsBox {
  91. padding: 10px 0;
  92. border-radius: 10px;
  93. background-color: var(--default-bgc);
  94. // background-color: var(--color-f3);
  95. // font-family: 宋体, SimSun;
  96. }
  97. .item-title {
  98. font-size: 20px;
  99. color: var(--color-333);
  100. line-height: 28px;
  101. font-weight: bold;
  102. }
  103. .item-value {
  104. font-size: 42px;
  105. color: #00B760;
  106. line-height: 50px;
  107. }
  108. </style>