statistics_title.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="m-b20 statistics_title">
  3. <view class="row-justify-sb center">
  4. <view class="row-c left">
  5. <view class="circle column-c justify-center">
  6. <view class="outer" :style="{background:bgColor[genre]}"></view>
  7. <view class="inside" :style="{background:bgColor[genre]}"></view>
  8. </view>
  9. <text class="size-28 text-color-12 sys-weight-600 m-l16">{{leftText}}</text>
  10. </view>
  11. <view class="row-c line-40" v-if="is_right && !is_age" @click="onHandle">
  12. <text class="size-24 text-color-8F9 m-r6">{{rightText}}</text>
  13. <uni-icons type="forward" size="16" color="#8F99B1"></uni-icons>
  14. </view>
  15. <view v-else></view>
  16. <view class="row-c" v-if="is_age">
  17. <view class="row-c m-l20" v-for="(item,index) in list" :key="index">
  18. <view class="wh-14 m-r10" :style="{background:item.color}"></view>
  19. <text class="size-24 text-color-576">{{item.name}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: 'statistics_title',
  28. props: {
  29. genre: {
  30. type: Number,
  31. default: 0
  32. },
  33. leftText: {
  34. type: String,
  35. default: ''
  36. },
  37. rightText: {
  38. type: String,
  39. default: ''
  40. },
  41. is_right: {
  42. type: Boolean,
  43. default: true
  44. },
  45. is_age: {
  46. type: Boolean,
  47. default: false
  48. },
  49. },
  50. data() {
  51. return {
  52. bgColor: ['#0FB160', '#FE7F37', '#10A2B0', '#DE2519'],
  53. list: [{
  54. name: '数量',
  55. color: '#2B7DFA'
  56. }, {
  57. name: '年龄',
  58. color: '#00BF8A'
  59. }, {
  60. name: '金额',
  61. color: '#ED9A2C'
  62. }, ]
  63. };
  64. },
  65. methods: {
  66. onHandle() {
  67. this.$emit('onHandle')
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .statistics_title {
  74. .left {
  75. line-height: 40rpx;
  76. .circle {
  77. position: relative;
  78. .outer {
  79. width: 35rpx;
  80. height: 35rpx;
  81. opacity: 0.2;
  82. border-radius: 50%;
  83. }
  84. .inside {
  85. width: 12rpx;
  86. height: 12rpx;
  87. border-radius: 50%;
  88. position: absolute;
  89. top: calc(50% - 6rpx);
  90. }
  91. }
  92. }
  93. .right {
  94. line-height: 35rpx;
  95. }
  96. }
  97. </style>