manage-money.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="manage-money">
  3. <custom-nav noback="noback" transparent="transparent" ref="ltm" title=" " />
  4. <view class="content">
  5. <view class="chart">
  6. <view class="switch">
  7. <text :class="{ active: active === 7 }" @tap="switchChart(7)">7日</text>
  8. <text :class="{ active: active === 15 }" @tap="switchChart(15)">15日</text>
  9. <text :class="{ active: active === 30 }" @tap="switchChart(30)">30日</text>
  10. </view>
  11. <view class="chart-line">
  12. <chart-line :chartData="chartData" color="#A213C8" background="#F4E4F9" unit="元" />
  13. </view>
  14. </view>
  15. <view class="kingkong">
  16. <navigator v-for="(item, index) in operationList" :url="item.url" :key="index">
  17. <image :src="item.image"></image>
  18. <text>{{ item.name }}</text>
  19. </navigator>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import { _API_FortuneChart } from '@/apis/fortune.js'
  26. import chartLine from '@/components/charts/chart-line.vue'
  27. export default {
  28. components: {
  29. chartLine
  30. },
  31. data() {
  32. return {
  33. title: '财富管理',
  34. chartData: {},
  35. active: 15,
  36. operationList: [
  37. {
  38. name: '收入流水',
  39. url: '../../pages/income-running/income-running',
  40. image: '../../static/index/index/income-running.png'
  41. },
  42. {
  43. name: '奖励支出',
  44. url: '../../pages/reward-out/reward-out',
  45. image: '../../static/index/index/reward-out.png'
  46. },
  47. {
  48. name: '奖励收入',
  49. url: '../../pages/reward-in/reward-in',
  50. image: '../../static/index/index/reward-in.png'
  51. },
  52. {
  53. name: '零售录单',
  54. url: '../../pages/record-order/record-order',
  55. image: '../../static/index/index/income-shop.png'
  56. }
  57. ]
  58. }
  59. },
  60. mounted() {
  61. this.request()
  62. },
  63. onPullDownRefresh() {
  64. this.request()
  65. },
  66. methods: {
  67. switchChart(active) {
  68. this.active = active
  69. this.request()
  70. },
  71. request() { // 网络请求方法
  72. uni.showLoading({ mask: true })
  73. _API_FortuneChart({ day: this.active }).then(res => {
  74. const data = { categories: [], series: [{ data: [] }] }
  75. data.categories = res.data.date
  76. data.series[0].data = res.data.data
  77. this.chartData = data
  78. })
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .manage-money {
  85. @include page();
  86. .content {
  87. background: #FFFFFF;
  88. .chart {
  89. @include flex(column);
  90. height: 720rpx;
  91. background: #F4E4F9;
  92. .switch {
  93. @include flex();
  94. width: 100%;
  95. height: 110rpx;
  96. text {
  97. @include flex();
  98. height: 46rpx;
  99. width: 100rpx;
  100. font-size: 28rpx;
  101. border-radius: 23rpx;
  102. color: $app-base-color;
  103. border: 2rpx solid $app-base-color;
  104. &.active {
  105. color: #FFFFFF;
  106. background: $app-base-color;
  107. }
  108. }
  109. text:nth-child(2) {
  110. margin: 0 55rpx;
  111. }
  112. }
  113. .chart-line {
  114. flex: 1;
  115. width: 100%;
  116. padding: 0 10rpx;
  117. box-sizing: border-box;
  118. }
  119. }
  120. }
  121. }
  122. </style>