stat_finance_chart.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="page-box-bg-fff m-t20 r-30 p-30">
  3. <!-- 模块title -->
  4. <StatisticsTitle :genre="0" :leftText="'财务汇总占比'" :rightText="'同比环比'" @onHandle="onHandle"></StatisticsTitle>
  5. <view class="content_chart row-justify-sb center">
  6. <view class="chart_item column-c sys-from-background-color m-r30 r-20 p-tb20">
  7. <CircleChart ref="outObj" :bgColor="'#2B7DFA'"></CircleChart>
  8. <text class="size-24 sys-from-background-color m-t16">放款</text>
  9. </view>
  10. <view class="chart_item column-c sys-from-background-color r-20 p-tb20">
  11. <CircleChart ref="putObj" :bgColor="'#ED9A2C'"></CircleChart>
  12. <text class="size-24 sys-from-background-color m-t16">回款</text>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import CircleChart from "@/common/chart/circle_chart.vue";
  19. import StatisticsTitle from "./statistics_title.vue";
  20. export default {
  21. name: 'stat_finance_chart',
  22. props:{
  23. 'moneyData':{
  24. default:()=>{
  25. return {
  26. out_money: 0,
  27. out_num: 0,
  28. put_money: 0,
  29. put_num: 0,
  30. }
  31. }
  32. }
  33. },
  34. components: {
  35. CircleChart,
  36. StatisticsTitle
  37. },
  38. watch:{
  39. 'moneyData':function (){
  40. this.initData()
  41. },
  42. 'outRatio':function (){
  43. this.$refs.outObj.setServerData(this.outRatio)
  44. },
  45. 'putRatio':function () {
  46. this.$refs.putObj.setServerData(this.putRatio)
  47. }
  48. },
  49. data() {
  50. return {
  51. totalMoney:0,
  52. outRatio:0,
  53. putRatio:0,
  54. };
  55. },
  56. methods: {
  57. initData(){
  58. this.totalMoney=this.moneyData.out_money+this.moneyData.put_money
  59. if(this.totalMoney>0){
  60. this.outRatio=(this.moneyData.out_money/this.totalMoney).toFixed(2)
  61. this.putRatio=(this.moneyData.put_money/this.totalMoney).toFixed(2)
  62. }
  63. },
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .content_chart {
  69. text-align: center;
  70. .chart_item {
  71. width: 330rpx;
  72. .num {
  73. width: 140rpx;
  74. height: 50rpx;
  75. line-height: 50rpx;
  76. background: #F7F9FE;
  77. border-radius: 10rpx;
  78. }
  79. }
  80. }
  81. </style>