overview.js 6.3 KB

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