overview.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template','form'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template,Form) {
  2. return {
  3. index: function () {
  4. // 基于准备好的dom,初始化echarts实例
  5. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  6. var myChart1 = Echarts.init(document.getElementById('echart1'), 'walden');
  7. // 指定图表的配置项和数据
  8. var option = {
  9. title: {
  10. text: '各支付方式订单数',
  11. left: 'center'
  12. },
  13. xAxis: {
  14. type: 'category',
  15. data: Config.type_column
  16. },
  17. yAxis: {
  18. type: 'value'
  19. },
  20. tooltip: {
  21. trigger: 'item'
  22. },
  23. series: [
  24. {
  25. data: Config.type_data,
  26. type: 'bar',
  27. showBackground: true,
  28. itemStyle: {
  29. normal: {
  30. color: function (params) {
  31. // build a color map as your need.
  32. var colorList = [
  33. '#C1232B', '#B5C334', '#FCCE10', '#E87C25', '#27727B',
  34. '#FE8463', '#9BCA63', '#FAD860', '#F3A43B', '#60C0DD',
  35. '#D7504B', '#C6E579', '#F4E001', '#F0805A', '#26C0C0'
  36. ];
  37. return colorList[params.dataIndex]
  38. }
  39. }
  40. },
  41. }
  42. ]
  43. };
  44. var option1 = {
  45. title: {
  46. text: '支付方式占比',
  47. left: 'center'
  48. },
  49. tooltip: {
  50. trigger: 'item'
  51. },
  52. legend: {
  53. orient: 'vertical',
  54. left: 'left'
  55. },
  56. series: [{
  57. name: '',
  58. type: 'pie', // 设置图表类型为饼图
  59. radius: '55%', // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
  60. color: ['#37A2DA', '#32C5E9'],
  61. label: {
  62. normal: {
  63. show: true,
  64. formatter: '{b}: {c}({d}%)'
  65. }
  66. },
  67. data: [
  68. {value: Config.type_data[0], name: Config.type_column[0]},
  69. {value: Config.type_data[1], name: Config.type_column[1]},
  70. {value: Config.type_data[2], name: Config.type_column[2]},
  71. {value: Config.type_data[3], name: Config.type_column[3]},
  72. {value: Config.type_data[4], name: Config.type_column[4]},
  73. {value: Config.type_data[5], name: Config.type_column[5]}
  74. ],
  75. }]
  76. };
  77. // 使用刚指定的配置项和数据显示图表。
  78. myChart.setOption(option);
  79. myChart1.setOption(option1);
  80. },
  81. seller_statistics() {
  82. Form.api.bindevent($('.form'))
  83. Table.api.init()
  84. var table = $("#table");
  85. var table1 = $("#table1");
  86. // 初始化表格
  87. table.bootstrapTable({
  88. url: location.href+'&type=1',
  89. pk: 'id',
  90. sortName: 'id',
  91. searchFormVisible: true,
  92. showExport: true,
  93. commonSearch: true,
  94. search: false,
  95. columns: [
  96. [
  97. {field: 'rank', title: __('排名'), operate: false,},
  98. {field: 'nickname', title: __('销售人'), operate: false,},
  99. {field: 'amount', title: __('销售额'), operate: false,},
  100. {field: 'date', title: __('时间'), operate: 'range', addClass: 'datetimerange', visible: false,defaultValue:defDate},
  101. ]
  102. ]
  103. });
  104. table1.bootstrapTable({
  105. url: location.href+'&type=2',
  106. pk: 'id',
  107. sortName: 'id',
  108. searchFormVisible: true,
  109. showExport: true,
  110. commonSearch: true,
  111. search: false,
  112. columns: [
  113. [
  114. {field: 'rank', title: __('排名'), operate: false,},
  115. {field: 'nickname', title: __('销售人'), operate: false,},
  116. {field: 'amount', title: __('提成额'), operate: false,},
  117. {field: 'date', title: __('时间'), operate: 'range', addClass: 'datetimerange', visible: false,defaultValue:defDate},
  118. ]
  119. ]
  120. });
  121. Table.api.bindevent(table);
  122. Table.api.bindevent(table1);
  123. }
  124. };
  125. });