customertt_newold.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {Template header}
  2. <body>
  3. <div class="warp">
  4. <div class="title default" style="margin-bottom:20px;"><input id="timetk" value="{date('Y-m-d',time()-7*24*3600)}" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD'})">
  5. 至&nbsp;&nbsp;&nbsp;&nbsp; <input id="timetj" value="{date('Y-m-d',time())}" name="timetj" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD'})"><span>确 定</span></div>
  6. <div id="container" style="width:100%;height:40%;float:left"></div>
  7. <div class="button"><font class="fh">关 闭</font></div>
  8. </div>
  9. <script src="{$theme}js/echarts.min.js?v=201911220005"></script>
  10. <script type="text/javascript">
  11. $(".default span").click(function() {
  12. defaultgo();
  13. });
  14. $(document).ready(function() {
  15. defaultgo();
  16. })
  17. function defaultgo() {
  18. layx.load('loadId','数据加载中');
  19. $.ajax({
  20. url: "/customertt/newold/",
  21. data: "timek="+$("#timetk").val()+"&timej="+$("#timetj").val(),
  22. type: "POST",
  23. dataType: "json",
  24. success: function(a) {
  25. if (a && a.success) {
  26. layx.destroy('loadId');
  27. var dom = document.getElementById("container");
  28. var myChart = echarts.init(dom);
  29. var app = {};
  30. option = null;
  31. option = {
  32. tooltip: {
  33. trigger: 'axis'
  34. },
  35. legend: {
  36. data:['新客户','复购客户']
  37. },
  38. toolbox: {
  39. show: true,
  40. feature: {
  41. dataZoom: {
  42. yAxisIndex: 'none'
  43. },
  44. dataView: {readOnly: false},
  45. magicType: {type: ['line', 'bar']},
  46. restore: {},
  47. saveAsImage: {}
  48. }
  49. },
  50. xAxis: {
  51. type: 'category',
  52. boundaryGap: false,
  53. data: a.time
  54. },
  55. yAxis: {
  56. type: 'value',
  57. axisLabel: {
  58. formatter: '{value}'
  59. }
  60. },
  61. series: [
  62. {
  63. name:'新客户',
  64. type:'line',
  65. data: a.cnew,
  66. markPoint: {
  67. data: [
  68. {type: 'max', name: '最大值'},
  69. {type: 'min', name: '最小值'}
  70. ]
  71. },
  72. markLine: {
  73. data: [
  74. {type: 'average', name: '平均值'}
  75. ]
  76. }
  77. },
  78. {
  79. name:'复购客户',
  80. type:'line',
  81. data: a.cold,
  82. markLine: {
  83. data: [
  84. {type: 'average', name: '平均值'},
  85. [{
  86. symbol: 'none',
  87. x: '90%',
  88. yAxis: 'max'
  89. }, {
  90. symbol: 'circle',
  91. label: {
  92. normal: {
  93. position: 'start',
  94. formatter: '最大值'
  95. }
  96. },
  97. type: 'max',
  98. name: '最高点'
  99. }]
  100. ]
  101. }
  102. }
  103. ]
  104. };
  105. ;
  106. if (option && typeof option === "object") {
  107. myChart.setOption(option, true);
  108. }
  109. }
  110. }
  111. });
  112. };
  113. </script>
  114. <script type="text/javascript" src="{$theme}js/laydate.js"></script>
  115. {Template footer}