index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="bruefReport_wrap">
  3. <view class="staticts_wrap">
  4. <view class="staticts_item">
  5. <view class="label">新增客户</view>
  6. <view class="count">-</view>
  7. </view>
  8. <view class="staticts_item">
  9. <view class="label">新增线索</view>
  10. <view class="count">{{staticts.addClueCount}}</view>
  11. </view>
  12. <view class="staticts_item">
  13. <view class="label">新增商家</view>
  14. <view class="count">-</view>
  15. </view>
  16. </view>
  17. <view class="clue_state_wrap">
  18. <view class="header_wrap">
  19. <view class="header_left">线索阶段</view>
  20. <view class="haeder_right" @click="handleToClue">
  21. <text>全部</text>
  22. <u-icon name="arrow-right" color="#aaa"></u-icon>
  23. </view>
  24. </view>
  25. <view class="charts-box">
  26. <qiun-data-charts
  27. type="ring"
  28. :opts="opts"
  29. :chartData="chartData"
  30. />
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. props : {
  38. queryParams : {
  39. type : Object,
  40. default : ()=>{}
  41. },
  42. type : {
  43. type : Number,
  44. required : true
  45. },
  46. },
  47. data() {
  48. return {
  49. staticts: {
  50. addClueCount: 0,
  51. },
  52. chartData: {},
  53. opts: {
  54. rotate: false,
  55. rotateLock: false,
  56. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4","#ea7ccc"],
  57. padding: [5,5,5, 5],
  58. dataLabel: true,
  59. enableScroll: false,
  60. legend: {
  61. show: true,
  62. position: "right",
  63. lineHeight: 25,
  64. },
  65. title: {
  66. name: "线索量",
  67. fontSize: 15,
  68. color: "#666666"
  69. },
  70. subtitle: {
  71. name: "0",
  72. fontSize: 25,
  73. color: "#7cb5ec"
  74. },
  75. extra: {
  76. ring: {
  77. ringWidth: 16,
  78. activeOpacity: 0.5,
  79. activeRadius: 10,
  80. offsetAngle: 0,
  81. labelWidth: 1,
  82. border: false,
  83. borderWidth: 3,
  84. borderColor: "#FFFFFF"
  85. }
  86. }
  87. }
  88. };
  89. },
  90. methods: {
  91. handleToClue(){
  92. uni.navigateTo({
  93. url : "/pages/clue/index?type=" + this.type
  94. });
  95. },
  96. handleInit(){
  97. this.getServerData();
  98. this.statisticsAddClueCount();
  99. },
  100. async statisticsAddClueCount(){
  101. const { data } = await uni.$u.api.statisticsAddClueCount({type : this.type,...this.queryParams});
  102. this.staticts = data;
  103. },
  104. async getServerData() {
  105. const { data } = await uni.$u.api.statisticsCaseState({type : this.type,...this.queryParams});
  106. const seriesData = data.map(v=>({
  107. name:v.clueStateName + "(" + v.count + ")",
  108. value:v.count
  109. }));
  110. const totalCount = data.reduce((acc,cur)=>{
  111. return acc + cur.count;
  112. },0);
  113. this.opts.subtitle.name = totalCount;
  114. this.chartData = { series : [ { data : seriesData } ] };
  115. },
  116. }
  117. };
  118. </script>
  119. <style scoped lang="scss">
  120. .header_wrap {
  121. display: flex;
  122. justify-content: space-between;
  123. padding: 10px;
  124. border-bottom: 1px solid #ddd;
  125. background-color: #fff;
  126. .header_left {
  127. font-size: 18px;
  128. }
  129. .haeder_right {
  130. display: flex;
  131. align-items: center;
  132. text {
  133. font-size: 14px;
  134. color: #b8b8b8;
  135. margin-right: 10px;
  136. }
  137. ::v-deep .u-icon__icon {
  138. font-size: 12px !important;
  139. }
  140. }
  141. }
  142. .clue_state_wrap {
  143. margin:0 20px;
  144. background-color: #fff;
  145. }
  146. .staticts_wrap {
  147. display: flex;
  148. justify-content: center;
  149. background: #fff;
  150. margin: 20px;
  151. border-radius: 10px;
  152. .staticts_item {
  153. display: flex;
  154. justify-content: center;
  155. align-items: center;
  156. flex-direction: column;
  157. width: 33%;
  158. padding: 20px;
  159. .label {
  160. color: #aaa;
  161. font-size: 16px;
  162. }
  163. .count {
  164. font-size: 20px;
  165. font-weight: bold;
  166. }
  167. }
  168. }
  169. /* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
  170. .charts-box {
  171. width: 100%;
  172. height: 300px;
  173. }
  174. </style>