echart-active.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="echart-content">
  3. <view class="echart-title">
  4. <view class="e-name">机构活跃统计</view>
  5. <view class="e-more" @click="handClick">查看></view>
  6. </view>
  7. <view class="echart-mains">
  8. <view class="echart-mains-none" v-if="isEmpty">
  9. <image
  10. class="none-image"
  11. src="https://static.caimei365.com/app/img/bg/icon_echart_none@2x.png"
  12. mode=""
  13. ></image>
  14. <view class="none-text">暂无数据</view>
  15. </view>
  16. <view class="echart-mains-data" v-else>
  17. <qiun-data-charts type="pie" :opts="opts" :chartData="orderChartData" :errorShow="false" />
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import { mapState, mapMutations } from 'vuex'
  24. import chartMixin from './mixins/chart.mixin.js'
  25. export default {
  26. mixins: [chartMixin],
  27. props:{
  28. portraitMap:{
  29. type:Array,
  30. default:[]
  31. }
  32. },
  33. data() {
  34. return {
  35. isEmpty:false,
  36. orderChartData:null,
  37. opts: {
  38. timing: 'easeOut',
  39. duration: 50,
  40. rotate: false,
  41. rotateLock: false,
  42. color: [
  43. '#3AA0FF',
  44. '#36CBCB',
  45. '#FAC858',
  46. '#EE6666',
  47. '#73C0DE',
  48. '#3CA272',
  49. '#FC8452',
  50. '#9A60B4',
  51. '#ea7ccc'
  52. ],
  53. padding: [5, 5, 5, 5],
  54. fontSize: 13,
  55. fontColor: '#666666',
  56. dataLabel: true,
  57. dataPointShape: true,
  58. dataPointShapeType: 'solid',
  59. touchMoveLimit: 60,
  60. enableScroll: false,
  61. enableMarkLine: false,
  62. legend: {
  63. show: false,
  64. position: 'bottom',
  65. lineHeight: 25,
  66. float: 'bottom',
  67. padding: 5,
  68. margin: 5,
  69. backgroundColor: 'rgba(0,0,0,0)',
  70. borderColor: 'rgba(0,0,0,0)',
  71. borderWidth: 0,
  72. fontSize: 12,
  73. fontColor: '#666666',
  74. hiddenColor: '#CECECE',
  75. itemGap: 10
  76. },
  77. title: {
  78. name: '订单总量',
  79. fontSize: 12,
  80. color: '#666666',
  81. offsetX: 0,
  82. offsetY: 0
  83. },
  84. subtitle: {
  85. name: '70%',
  86. fontSize: 12,
  87. color: '#7cb5ec',
  88. offsetX: 0,
  89. offsetY: 0
  90. },
  91. extra: {
  92. pie:{
  93. activeOpacity: 0.5,
  94. activeRadius: 10,
  95. offsetAngle: 0,
  96. labelWidth: 15,
  97. border: true,
  98. borderWidth: 3,
  99. borderColor: "#FFFFFF",
  100. customRadius: 60,
  101. linearType: "none"
  102. },
  103. tooltip: {
  104. showBox: true,
  105. showArrow: true,
  106. showCategory: false,
  107. borderWidth: 0,
  108. borderRadius: 0,
  109. borderColor: '#000000',
  110. borderOpacity: 0.7,
  111. bgColor: '#000000',
  112. bgOpacity: 0.7,
  113. gridType: 'solid',
  114. dashLength: 4,
  115. gridColor: '#CCCCCC',
  116. boxPadding: 3,
  117. fontSize: 12,
  118. lineHeight: 20,
  119. fontColor: '#FFFFFF',
  120. legendShow: true,
  121. legendShape: 'auto',
  122. splitLine: true,
  123. horizentalLine: false,
  124. xAxisLabel: false,
  125. yAxisLabel: false,
  126. labelBgColor: '#FFFFFF',
  127. labelBgOpacity: 0.7,
  128. labelFontColor: '#666666'
  129. }
  130. }
  131. }
  132. }
  133. },
  134. created() {
  135. console.log('portraitMap',this.portraitMap)
  136. this.getSetOrderData(this.portraitMap)
  137. },
  138. methods: {
  139. getSetOrderData(data) {
  140. //模拟从服务器获取数据时的延时
  141. if(data.length>0){
  142. this.isEmpty = false
  143. setTimeout(() => {
  144. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  145. let res = {
  146. series: [
  147. {
  148. format: 'pieDemo1',
  149. data: data
  150. }
  151. ]
  152. }
  153. this.orderChartData = JSON.parse(JSON.stringify(res))
  154. }, 500)
  155. }else{
  156. this.isEmpty = true
  157. }
  158. },
  159. handClick(){
  160. this.$api.navigateTo(`/pages/seller/club/club-active-details`)
  161. }
  162. },
  163. onShow() {}
  164. }
  165. </script>
  166. <style lang="scss"></style>