reward-in.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="reward-in">
  3. <custom-nav noback="noback" transparent="transparent" ref="ltm" title=" " />
  4. <view class="content">
  5. <view class="data-card">
  6. <image src="../../static/icon/data-card.png" class="position-center"></image>
  7. <view class="data-card-text position-center">
  8. <text class="text">累计业绩(元)</text>
  9. <text class="num">{{ all_money | numDot }}元</text>
  10. </view>
  11. </view>
  12. <view class="data-chart">
  13. <view class="data-date">
  14. <picker mode="date" :value="date" start="2015-09-01" :end="end" @change="DateChange">
  15. <view class="picker">{{ date + ' >' }}</view>
  16. </picker>
  17. </view>
  18. <view class="chart">
  19. <view class="chart-wrapper">
  20. <view class="value position-center">
  21. <view class="title">收入金额(元)</view>
  22. <view class="value">{{ money }}</view>
  23. </view>
  24. <chart-progress :chartData="chartData" width="320" height="320" />
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import { _API_FortuneReward } from '@/apis/fortune.js'
  33. import chartProgress from '@/components/charts/chart-progress.vue'
  34. export default {
  35. components: { chartProgress },
  36. data() {
  37. return {
  38. title: '奖励收入',
  39. end: this.$options.filters.getYear(+new Date()) + '-' + this.$options.filters.getMonth(+new Date()) + '-' + this.$options.filters.getDate(+new Date()),
  40. date: this.$options.filters.getYear(+new Date()) + '-' + this.$options.filters.getMonth(+new Date()) + '-' + this.$options.filters.getDate(+new Date()),
  41. money: 0,
  42. all_money: 0
  43. }
  44. },
  45. computed: {
  46. chartData() {
  47. return {
  48. series: [
  49. {
  50. name: '奖励收入',
  51. data: this.money / this.all_money,
  52. color: '#F76454'
  53. }
  54. ]
  55. }
  56. }
  57. },
  58. mounted() {
  59. this.request(new Date(this.date) / 1000) // 请求数据
  60. },
  61. methods: {
  62. DateChange(e) {
  63. if(this.date !== e.detail.value) { // 当选择的日期不等于今天时再请求数据
  64. this.request(+ new Date(e.detail.value) / 1000).then(() => this.date = e.detail.value) // 请求数据
  65. }
  66. },
  67. request(time) { // 请求数据方法
  68. return new Promise(resolve => {
  69. uni.showLoading({ mask: true })
  70. _API_FortuneReward({ type: 1, time }).then(res => {
  71. resolve()
  72. this.money = res.data.money
  73. this.all_money = res.data.all_money
  74. })
  75. })
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss">
  81. .reward-in {
  82. @include page();
  83. .content {
  84. @include flex(column);
  85. .data-chart {
  86. flex: 1;
  87. width: 100%;
  88. @include flex(column);
  89. justify-content: flex-start;
  90. .data-date {
  91. @include flex();
  92. width: 100%;
  93. height: 76rpx;
  94. font-size: 32rpx;
  95. margin-bottom: 1rpx;
  96. background: #FFFFFF;
  97. letter-spacing: 4rpx;
  98. }
  99. .chart {
  100. @include flex();
  101. width: 100%;
  102. height: 423rpx;
  103. background: #FFFFFF;
  104. .chart-wrapper {
  105. width: 320rpx;
  106. height: 320rpx;
  107. overflow: hidden;
  108. position: relative;
  109. .value {
  110. width: 100%;
  111. z-index: 9999;
  112. text-align: center;
  113. .title {
  114. font-size: 26rpx;
  115. }
  116. .value {
  117. font-size: 50rpx;
  118. margin-top: 26rpx;
  119. }
  120. }
  121. }
  122. }
  123. }
  124. }
  125. }
  126. </style>