manage-money.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="manage-money">
  3. <custom-nav ref="ltm" :title="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. created() {
  61. uni.startPullDownRefresh()
  62. },
  63. onPullDownRefresh() {
  64. this.request()
  65. },
  66. methods: {
  67. switchChart(active) {
  68. this.active = active
  69. uni.startPullDownRefresh()
  70. },
  71. request() { // 网络请求方法
  72. this.$refs.ltm.loading()
  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. }).catch(() => {
  79. this.$refs.ltm.toast('网络崩溃了,请下拉刷试试')
  80. }).finally(() => uni.stopPullDownRefresh())
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss">
  86. .manage-money {
  87. @include page();
  88. .content {
  89. background: #FFFFFF;
  90. .chart {
  91. @include flex(column);
  92. height: 720rpx;
  93. background: #F4E4F9;
  94. .switch {
  95. @include flex();
  96. width: 100%;
  97. height: 110rpx;
  98. text {
  99. @include flex();
  100. height: 46rpx;
  101. width: 100rpx;
  102. font-size: 28rpx;
  103. border-radius: 23rpx;
  104. color: $app-base-color;
  105. border: 2rpx solid $app-base-color;
  106. &.active {
  107. color: #FFFFFF;
  108. background: $app-base-color;
  109. }
  110. }
  111. text:nth-child(2) {
  112. margin: 0 55rpx;
  113. }
  114. }
  115. .chart-line {
  116. flex: 1;
  117. width: 100%;
  118. padding: 0 10rpx;
  119. box-sizing: border-box;
  120. }
  121. }
  122. }
  123. }
  124. </style>