index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div>
  3. <div class="card-box">
  4. <el-row :gutter="20">
  5. <el-col :span="4" v-for="item in cardList" :key="item.key">
  6. <el-card shadow="never">
  7. <div class="card-title">{{ item.name }}: {{ data[item.key] }}</div>
  8. </el-card>
  9. </el-col>
  10. </el-row>
  11. </div>
  12. <ListPage :column="listPageData.tableColumn" :tableApi="listPageData.tableApi" :isSelect="listPageData.isSelect"
  13. :scopeBtns="listPageData.scopeBtns" :searchBtns="listPageData.searchBtns" ref="userTableRef" :isScope="false" >
  14. <template #footerLeft>
  15. <el-row :gutter="20">
  16. <el-col :span="4">
  17. <div class="card-title">总金额: {{ totalMoney }}</div>
  18. </el-col>
  19. <el-col :span="4">
  20. <div class="card-title">可提现金额: {{ balanceMoney }}</div>
  21. </el-col>
  22. </el-row>
  23. </template>
  24. </ListPage>
  25. </div>
  26. </template>
  27. <script setup>
  28. import { ref } from 'vue';
  29. import ListPage from '@/views/components/ListPage/index.vue';
  30. import { list, walletTotal } from "@/api/finance/wallet.js";
  31. import { provide,inject } from 'vue'
  32. const { proxy } = getCurrentInstance();
  33. const userTableRef = ref();
  34. const listPageData = reactive({
  35. tableColumn: [
  36. {
  37. label: '金额变动时间',
  38. queryLabel: '时间',
  39. prop: 'createTime',
  40. type: 'date',
  41. isSearch: true,
  42. keys: ['lastChangeTimeStart', 'lastChangeTimeEnd'],
  43. },
  44. {
  45. label: '区域公司',
  46. prop: 'areaName',
  47. type: 'input',
  48. isSearch: true,
  49. },
  50. {
  51. label: '服务中心',
  52. prop: 'serviceCentreName',
  53. type: 'input',
  54. isSearch: true,
  55. },
  56. {
  57. label: '志愿者姓名',
  58. prop: 'volunteerName',
  59. queryLabel: '姓名',
  60. type: 'input',
  61. isSearch: true,
  62. },
  63. {
  64. label: '手机号',
  65. prop: 'volunteerPhone',
  66. type: 'input',
  67. isSearch: true,
  68. },
  69. {
  70. label: '待入账',
  71. prop: 'orderFrozenBalance',
  72. },
  73. {
  74. label: '可提现',
  75. prop: 'balance',
  76. },
  77. {
  78. label: '提现中',
  79. prop: 'beBalance',
  80. },
  81. {
  82. label: '总金额',
  83. prop: 'totalAmount',
  84. },
  85. {
  86. label: '已提现',
  87. prop: 'withdrawnAmount',
  88. },
  89. // {
  90. // label: '总余额',
  91. // prop: 'totalBalance',
  92. // },
  93. ],
  94. searchBtns: [
  95. {
  96. label: '导出',
  97. func: (parmas) => {
  98. console.log("TCL: parmas", parmas)
  99. try {
  100. proxy.download("core/volunteer/account/export/VolunteerAccountList", {
  101. ...parmas
  102. }, `钱包管理_${new Date().getTime()}.xlsx`);
  103. } catch (error) {
  104. console.log("TCL: error", error)
  105. }
  106. },
  107. key: 'export',
  108. type: 'primary'
  109. },
  110. ],
  111. tableApi: list,//接口地址
  112. isSelect: true,//是否勾选
  113. scopeBtns: [],
  114. })
  115. const selectList = ref([]);
  116. //总金额
  117. const totalMoney = computed(() => {
  118. let total = 0;
  119. selectList.value.forEach((item) => {
  120. total += Number(item.totalAmount);
  121. });
  122. return total;
  123. });
  124. //可提现金额
  125. const balanceMoney = computed(() => {
  126. let total = 0;
  127. selectList.value.forEach((item) => {
  128. total += Number(item.balance);
  129. });
  130. return total;
  131. });
  132. const selectChange = (rows) => {
  133. console.log("TCL: selectChange -> rows", rows)
  134. selectList.value = rows;
  135. }
  136. provide('selectChange',selectChange)
  137. const cardList = [
  138. {
  139. name: '总金额',
  140. key: 'totalAmount'
  141. },
  142. {
  143. name: '可提现',
  144. key: 'balance'
  145. },
  146. {
  147. name: '已提现',
  148. key: 'withdrawAmount'
  149. },
  150. {
  151. name: '提现中',
  152. key: 'beBalance'
  153. },
  154. {
  155. name: '待入账',
  156. key: 'orderFrozenBalance'
  157. }
  158. ]
  159. const data = ref({
  160. totalAmount: 0.0,
  161. balance: 0.0,
  162. beBalance: 0.0,
  163. withdrawAmount: 0.0,
  164. waitAmount: 0.0,
  165. orderFrozenBalance: 0.0
  166. })
  167. const getWalletTotal = async () => {
  168. try {
  169. const res = await walletTotal()
  170. data.value = res.data
  171. } catch (error) {
  172. console.log("TCL: getWalletTotal -> error", error)
  173. }
  174. }
  175. getWalletTotal()
  176. </script>
  177. <style lang='scss' scoped>
  178. .card-box {
  179. padding: 20px 20px 0;
  180. .card-title {
  181. display: flex;
  182. align-items: center;
  183. justify-content: center;
  184. }
  185. }
  186. </style>