echart-consult.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. clubId:{
  29. type:Number,
  30. default:0
  31. },
  32. totalAmount:{
  33. type:Number,
  34. default:0
  35. },
  36. totalNum:{
  37. type:Number,
  38. default:0
  39. }
  40. },
  41. data() {
  42. return {
  43. isEmpty:false,
  44. current: 0,
  45. orderChartData:null,
  46. orderTotal:0,
  47. orderTotalAmount:0,
  48. orderData:{
  49. startTime: '',
  50. endTime: '',
  51. orderScopeNum:0,
  52. orderScopeTotalFee:0,
  53. },
  54. params:{
  55. clubId:0,// 机构id
  56. dateType:3,// 日期类别 0日 1月 2半年 3全年
  57. startTime:'',// 开始时间
  58. endTime:'',// 结束时间
  59. type:0 // 统计类别 0订单 1搜索关键词 2咨询记录 3访问记录 4初始状态
  60. },
  61. opts: {
  62. timing: 'easeOut',
  63. duration: 50,
  64. rotate: false,
  65. rotateLock: false,
  66. color: [
  67. '#1890FF',
  68. '#91CB74',
  69. '#FAC858',
  70. '#EE6666',
  71. '#73C0DE',
  72. '#3CA272',
  73. '#FC8452',
  74. '#9A60B4',
  75. '#ea7ccc'
  76. ],
  77. padding: [5, 5, 5, 5],
  78. fontSize: 13,
  79. fontColor: '#666666',
  80. dataLabel: true,
  81. dataPointShape: true,
  82. dataPointShapeType: 'solid',
  83. touchMoveLimit: 60,
  84. enableScroll: false,
  85. enableMarkLine: false,
  86. legend: {
  87. show: false,
  88. position: 'bottom',
  89. lineHeight: 25,
  90. float: 'bottom',
  91. padding: 5,
  92. margin: 5,
  93. backgroundColor: 'rgba(0,0,0,0)',
  94. borderColor: 'rgba(0,0,0,0)',
  95. borderWidth: 0,
  96. fontSize: 12,
  97. fontColor: '#666666',
  98. hiddenColor: '#CECECE',
  99. itemGap: 10
  100. },
  101. title: {
  102. name: '订单总量',
  103. fontSize: 12,
  104. color: '#666666',
  105. offsetX: 0,
  106. offsetY: 0
  107. },
  108. subtitle: {
  109. name: '70%',
  110. fontSize: 12,
  111. color: '#7cb5ec',
  112. offsetX: 0,
  113. offsetY: 0
  114. },
  115. extra: {
  116. pie:{
  117. activeOpacity: 0.5,
  118. activeRadius: 10,
  119. offsetAngle: 0,
  120. labelWidth: 15,
  121. border: true,
  122. borderWidth: 3,
  123. borderColor: "#FFFFFF",
  124. customRadius: 60,
  125. linearType: "none"
  126. },
  127. tooltip: {
  128. showBox: true,
  129. showArrow: true,
  130. showCategory: false,
  131. borderWidth: 0,
  132. borderRadius: 0,
  133. borderColor: '#000000',
  134. borderOpacity: 0.7,
  135. bgColor: '#000000',
  136. bgOpacity: 0.7,
  137. gridType: 'solid',
  138. dashLength: 4,
  139. gridColor: '#CCCCCC',
  140. boxPadding: 3,
  141. fontSize: 12,
  142. lineHeight: 20,
  143. fontColor: '#FFFFFF',
  144. legendShow: true,
  145. legendShape: 'auto',
  146. splitLine: true,
  147. horizentalLine: false,
  148. xAxisLabel: false,
  149. yAxisLabel: false,
  150. labelBgColor: '#FFFFFF',
  151. labelBgOpacity: 0.7,
  152. labelFontColor: '#666666'
  153. }
  154. }
  155. }
  156. }
  157. },
  158. created() {
  159. this.params.clubId = this.clubId
  160. console.log('orderTotal',this.orderTotal)
  161. this.orderTotal = this.totalNum
  162. this.orderTotalAmount = this.totalAmount
  163. this.userClubPortrait(0)
  164. },
  165. methods: {
  166. async userClubPortrait(type){
  167. this.params.type = type
  168. try {
  169. const res = await this.UserService.userClubPortrait(this.params)
  170. const data = res.data
  171. this.orderData.orderScopeNum = data.portrait.orderScopeNum
  172. this.orderData.orderScopeTotalFee = data.portrait.orderScopeTotalFee
  173. this.orderData.startTime = this.params.startTime = data.portrait.startTime
  174. this.orderData.endTime = this.params.endTime = data.portrait.endTime
  175. if(data.order){
  176. this.isEmpty = false
  177. this.getSetOrderData(data.order)
  178. }else{
  179. this.isEmpty = true
  180. }
  181. } catch (error) {
  182. this.$util.msg(error.msg, 2000)
  183. }
  184. },
  185. getSetOrderData(data) {
  186. //模拟从服务器获取数据时的延时
  187. setTimeout(() => {
  188. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  189. let res = {
  190. series: [
  191. {
  192. format: 'pieDemo1',
  193. data: data.orderList
  194. }
  195. ]
  196. }
  197. this.orderChartData = JSON.parse(JSON.stringify(res))
  198. }, 500)
  199. },
  200. handClick(){
  201. this.$api.navigateTo(`/pages/seller/club/club-consult-details`)
  202. }
  203. },
  204. onShow() {}
  205. }
  206. </script>
  207. <style lang="scss"></style>