index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="financial">
  3. <view class="financial-box">
  4. <view class="drawable-price">
  5. <text>可提现余额(元)</text>
  6. <text>{{ financialData.withdrawableMoney || "0" }}</text>
  7. </view>
  8. <view class="detailed" @click="navigateTo(`/pages_module/withdrawal/index`)">查看明细</view>
  9. </view>
  10. <view class="financial-price">
  11. <view class="price-title">基本数据</view>
  12. <view class="price-list">
  13. <view
  14. class="price-item"
  15. v-for="(item, index) in detailedList"
  16. :key="index"
  17. >
  18. <text>{{ item.title }}</text>
  19. <text>{{ financialData[item.name] || "0" }}</text>
  20. </view>
  21. <!-- 占位盒子 -->
  22. <view class="price-item hide"></view>
  23. </view>
  24. </view>
  25. <view class="financial-price">
  26. <view class="price-title">消费金相关</view>
  27. <view class="price-list">
  28. <view
  29. class="price-item"
  30. v-for="(item, index) in voucherList"
  31. :key="index"
  32. >
  33. <text>{{ item.title }}</text>
  34. <text>{{ financialData[item.name] || "0" }}</text>
  35. </view>
  36. <!-- 占位盒子 -->
  37. <view class="price-item hide"></view>
  38. </view>
  39. </view>
  40. <view class="water">
  41. <view class="water-title">流水</view>
  42. <view class="water-box">
  43. <view class="water-header">
  44. <view
  45. class="header-item"
  46. :class="idx == 1 ? 'active' : ''"
  47. @click="changeIdx(1)"
  48. >日流水</view
  49. >
  50. <view
  51. class="header-item"
  52. :class="idx == 2 ? 'active' : ''"
  53. @click="changeIdx(2)"
  54. >月流水</view
  55. >
  56. </view>
  57. <WaterContainer :type="idx" :financialData="financialData"></WaterContainer>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import { getFinancial } from "@/config/index";
  64. import { detailedList, voucherList } from "./data";
  65. import WaterContainer from "../components/waterContainer/index"
  66. export default {
  67. onShow(){
  68. this.getFinancialData();
  69. },
  70. components:{
  71. WaterContainer
  72. },
  73. data() {
  74. return {
  75. // 静态数据
  76. detailedList: detailedList,
  77. voucherList: voucherList,
  78. // 动态数据
  79. // 切换日数据 以及 月数据
  80. idx: 1,
  81. financialData: {},
  82. queryData: {
  83. condition: "1",
  84. time: "",
  85. paymentMode:""
  86. },
  87. };
  88. },
  89. methods: {
  90. // 获取 总 数据
  91. async getFinancialData() {
  92. try {
  93. this.$loading.show("统计中...");
  94. const res = await getFinancial(this.queryData);
  95. this.financialData = res.data;
  96. // console.log(this.financialData);
  97. } finally {
  98. this.$loading.hide();
  99. }
  100. },
  101. // 控制激活态
  102. changeIdx(val) {
  103. this.idx = val;
  104. this.queryData.condition = val
  105. // 重新获取总数据
  106. this.getFinancialData()
  107. },
  108. },
  109. };
  110. </script>
  111. <style lang="scss" scoped>
  112. @import "./index.scss";
  113. </style>