operationDataPersonal.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view style="padding-bottom: 30rpx;">
  3. <!-- 图表统计 -->
  4. <view class="echart-box">
  5. <view class="echart-box-header ddflex">
  6. <view class="echart-box-title">运营情况</view>
  7. </view>
  8. <view class="sssb-box ddflex">
  9. <view class="sssb-item">
  10. <view class="sssb-label">营业总额</view>
  11. <view class="sssb-data sssb-color">867.00</view>
  12. </view>
  13. <view class="sssb-line"></view>
  14. <view class="sssb-item">
  15. <view class="sssb-label">收益总额</view>
  16. <view class="sssb-data sssb-color">1915.00</view>
  17. </view>
  18. </view>
  19. <view style="margin-top: 30rpx;height:500rpx">
  20. <view class="echart-title">近一周营业额度(元)图表数据</view>
  21. <l-echart ref="chart2" @finished="init"></l-echart>
  22. </view>
  23. <view style="margin-top: 30rpx;height:500rpx">
  24. <view class="echart-title">近一周收益额度(元)</view>
  25. <l-echart ref="chart3" @finished="init"></l-echart>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. const app = getApp();
  32. const req = require("../../utils/request.js");
  33. import LEchart from '../../components/l-echart/l-echart.vue';
  34. import * as echarts from '../../utils/echarts.min.js'
  35. export default {
  36. components: {
  37. LEchart
  38. },
  39. props: {},
  40. data() {
  41. return {
  42. systems: {},
  43. isTop: 0,
  44. pxToRpxScale: 0,
  45. rpxTopxScale: 0,
  46. // 近一周营业额度(元)图表数据
  47. option2: {
  48. tooltip: {
  49. trigger: 'axis',
  50. axisPointer: {
  51. type: 'shadow'
  52. },
  53. confine: true
  54. },
  55. grid: {
  56. left: 0,
  57. right: 8,
  58. bottom: 20,
  59. top: 30,
  60. containLabel: true
  61. },
  62. xAxis: [{
  63. type: 'category',
  64. data: [],
  65. axisLine: {
  66. lineStyle: {
  67. color: '#999999'
  68. }
  69. },
  70. axisLabel: {
  71. color: '#666666',
  72. // interval: 0,
  73. }
  74. }],
  75. yAxis: [{
  76. type: 'value',
  77. axisTick: {
  78. show: false
  79. },
  80. axisLine: {
  81. lineStyle: {
  82. color: '#999999'
  83. }
  84. },
  85. axisLabel: {
  86. color: '#666666'
  87. }
  88. }],
  89. series: [{
  90. name: '订单',
  91. type: 'bar',
  92. label: {
  93. normal: {
  94. show: true,
  95. position: 'top',
  96. color: '#FF770F',
  97. formatter: '¥{c}',
  98. },
  99. },
  100. data: [285, 200, 285, 300, 285, 285, 320],
  101. barWidth: 15,
  102. itemStyle: {
  103. // 颜色
  104. color: '#FF770F',
  105. // 给bar设置倒角
  106. barBorderRadius: [0, 0, 0, 0]
  107. }
  108. }]
  109. },
  110. // 近一周收益额度(元)
  111. option3: {
  112. tooltip: {
  113. trigger: 'axis',
  114. axisPointer: {
  115. type: 'shadow'
  116. },
  117. confine: true
  118. },
  119. grid: {
  120. left: 0,
  121. right: 8,
  122. bottom: 20,
  123. top: 30,
  124. containLabel: true
  125. },
  126. xAxis: [{
  127. type: 'category',
  128. data: [],
  129. axisLine: {
  130. lineStyle: {
  131. color: '#999999'
  132. }
  133. },
  134. axisLabel: {
  135. color: '#666666',
  136. // interval: 0,
  137. }
  138. }],
  139. yAxis: [{
  140. type: 'value',
  141. axisTick: {
  142. show: false
  143. },
  144. axisLine: {
  145. lineStyle: {
  146. color: '#999999'
  147. }
  148. },
  149. axisLabel: {
  150. color: '#666666'
  151. }
  152. }],
  153. series: [{
  154. name: '订单',
  155. type: 'bar',
  156. label: {
  157. normal: {
  158. show: true,
  159. position: 'top',
  160. color: '#FF770F',
  161. formatter: '¥{c}',
  162. },
  163. },
  164. data: [285, 200, 285, 300, 285, 285, 320],
  165. barWidth: 15,
  166. itemStyle: {
  167. // 颜色
  168. color: '#FF770F',
  169. // 给bar设置倒角
  170. barBorderRadius: [0, 0, 0, 0]
  171. }
  172. }]
  173. }
  174. }
  175. },
  176. onLoad(options) {
  177. },
  178. onShow() {
  179. },
  180. methods: {
  181. jumpUrl(url) {
  182. if (req.isLogins(true)) {
  183. uni.navigateTo({
  184. url: url
  185. })
  186. }
  187. },
  188. init() {
  189. if (this.$refs.chart2) {
  190. this.$refs.chart2.init(echarts, async chart => {
  191. // let echartData = await this.getEchartData()
  192. this.option2.xAxis[0].data = ['04-04', '04-05', '04-06', '04-07', '04-08', '04-09',
  193. '04-10'
  194. ]
  195. this.option2.yAxis[0].axisLabel.fontSize = 13 * this.rpxTopxScale
  196. this.option2.xAxis[0].axisLabel.fontSize = 13 * this.rpxTopxScale
  197. this.option2.series[0].data = [300, 270, 340, 344, 300, 320, 310]
  198. this.option2.series[0].label.normal.fontSize = 13 * this.rpxTopxScale
  199. chart.setOption(this.option2);
  200. });
  201. }
  202. if (this.$refs.chart3) {
  203. this.$refs.chart3.init(echarts, async chart => {
  204. // let echartData = await this.getEchartData()
  205. this.option3.xAxis[0].data = ['04-04', '04-05', '04-06', '04-07', '04-08', '04-09',
  206. '04-10'
  207. ]
  208. this.option3.yAxis[0].axisLabel.fontSize = 13 * this.rpxTopxScale
  209. this.option3.xAxis[0].axisLabel.fontSize = 13 * this.rpxTopxScale
  210. this.option3.series[0].data = [300, 270, 340, 344, 300, 320, 310]
  211. this.option3.series[0].label.normal.fontSize = 13 * this.rpxTopxScale
  212. chart.setOption(this.option3);
  213. });
  214. }
  215. }
  216. },
  217. mounted() {
  218. const systemInfo = uni.getSystemInfoSync();
  219. // px转换到rpx的比例
  220. let pxToRpxScale = 750 / systemInfo.windowWidth;
  221. this.pxToRpxScale = pxToRpxScale
  222. this.rpxTopxScale = systemInfo.windowWidth / 750
  223. let systems = {
  224. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  225. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  226. };
  227. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  228. this.systems = systems;
  229. },
  230. onPageScroll: function(e) {
  231. if (e.scrollTop > this.systems.barHeight) {
  232. this.isTop = 1;
  233. } else {
  234. this.isTop = 0;
  235. }
  236. }
  237. }
  238. </script>
  239. <style>
  240. @import "./operationDataPersonal.css";
  241. </style>