fenxiao_center2.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. var hz_shang = dc("hz_shang");
  2. var wm2 = false;
  3. hz_shang.style.display = 'inline-block';
  4. var barChart = echarts.init(document.getElementById('barChart'));
  5. var types = "7Day";
  6. var getOption = function(chartType) {
  7. var chartOption = {
  8. title: {
  9. subtext: '单位(台)'
  10. },
  11. tooltip: {
  12. trigger: 'axis'
  13. },
  14. grid: {
  15. x: 45,
  16. x2: 10,
  17. y: 60,
  18. y2: 25
  19. },
  20. toolbox: {
  21. show: false,
  22. feature: {
  23. saveAsImage: {
  24. show: true
  25. }
  26. }
  27. },
  28. calculable: true,
  29. xAxis: [{
  30. type: 'category',
  31. data: ['1日', '2日', '3日', '4日', '5日', '6日', '7日']
  32. }],
  33. yAxis: [{
  34. type: 'value'
  35. }],
  36. series: [{
  37. name: '收入',
  38. type: 'bar',
  39. itemStyle: {
  40. normal: {
  41. color: function(params) {
  42. var colorList = ['#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc'];
  43. return colorList[params.dataIndex]
  44. }
  45. }
  46. },
  47. label: {
  48. normal: {
  49. show: true,
  50. position: 'top'
  51. }
  52. },
  53. data: [0, 0, 0, 0, 0, 0, 0]
  54. }]
  55. };
  56. return chartOption
  57. };
  58. mui.ready(function() {
  59. $.ajax(base_path+'/statistics/is_sales_man?dates=' + new Date().getTime(), {
  60. data: {},
  61. dataType: 'json',
  62. type: 'get',
  63. timeout: 15000,
  64. xhrFields: {
  65. withCredentials: true
  66. },
  67. crossDomain: true,
  68. success: function(dt) {
  69. if (dt.isRedirect) {
  70. location.href = dt.redirectURL;
  71. } else {
  72. if(dt.status) {
  73. var src='';
  74. if(dt.data.sRoleId==1){
  75. $("#yewu").show();
  76. src=base_path + "/statistics/sales_management.html";
  77. }else if(dt.data.sRoleId==2){
  78. $("#guanli").show();
  79. src=base_path + "/statistics/total_management.html";
  80. }
  81. mui('body').on('tap', '#guanli .mui-table-view-cell', function() {
  82. mui.openWindow({url: src});
  83. });
  84. }
  85. }
  86. },
  87. error: function(xhr, type, errorThrown) {
  88. //异常处理;
  89. console.log(xhr);
  90. }
  91. });
  92. document.querySelector('.loading-bg').style.display = 'none';
  93. barChart.setOption(getOption('bar'));
  94. fenxiao_center_data();
  95. pulldata()
  96. });
  97. mui.each(document.querySelectorAll('#tabbar-chart-bar .mui-control-item'), function(index, el) {
  98. el.addEventListener('tap', function() {
  99. switch(index) {
  100. case 0:
  101. types = "7Day";
  102. pulldata();
  103. break;
  104. case 1:
  105. types = "6Mon";
  106. pulldata();
  107. break;
  108. case 2:
  109. types = "Year";
  110. pulldata();
  111. break;
  112. default:
  113. break
  114. }
  115. }, false)
  116. });
  117. function pulldata() {
  118. var btnArray = ['否', '是'];
  119. $.ajax(base_path + '/rebackStatic/statisInfo2?dates=' + new Date().getTime(), {
  120. data: {
  121. "openid": "230",
  122. "type": types
  123. },
  124. dataType: 'json',
  125. type: 'post',
  126. timeout: 15000,
  127. xhrFields: {
  128. withCredentials: true
  129. },
  130. crossDomain: true,
  131. success: function(dt) {
  132. if (dt.isRedirect) {
  133. location.href = dt.redirectURL;
  134. } else {
  135. if(dt.status) {
  136. var counts = [];
  137. var dates = [];
  138. mui(dt.data).each(function(index) {
  139. counts[index] = this.salesNumber;
  140. dates[index] = this.strDate
  141. });
  142. barChart.setOption({
  143. xAxis: {
  144. data: dates
  145. },
  146. series: [{
  147. name: '收入',
  148. data: counts
  149. }]
  150. })
  151. } else {
  152. mui.confirm(dt.message, ' ', btnArray, function(e) {
  153. if(e.index == 1) {
  154. setTimeout(function() {
  155. location.href = domanUrl + base_path + "/drp/indexPage?dates=" + new Date().getTime()
  156. }, 5000)
  157. }
  158. })
  159. }
  160. }
  161. },
  162. error: function(xhr, type, errorThrown) {
  163. console.log(xhr)
  164. }
  165. })
  166. };
  167. function fenxiao_center_data() {
  168. var btnArray = ['否', '是'];
  169. $.ajax(base_path + '/placeInfo/showPlaceInfoCenter?dates=' + new Date().getTime(), {
  170. dataType: 'json',
  171. type: 'post',
  172. timeout: 15000,
  173. xhrFields: {
  174. withCredentials: true
  175. },
  176. crossDomain: true,
  177. success: function(dt) {
  178. if (dt.isRedirect) {
  179. location.href = dt.redirectURL;
  180. } else {
  181. if(dt.status) {
  182. document.querySelector('.tx').innerHTML = '<img class="wechat_tx" src="' + dt.data.headImg + '">';
  183. if(dt.data.wm2 == "true") {
  184. wm2 = true;
  185. document.querySelector(".fenxiao_wm2").style.display = 'inline-block';
  186. document.querySelector(".fenxiao_share").style.display = 'inline-block'
  187. }
  188. document.querySelector('.role_name').innerHTML = dt.data.role;
  189. document.querySelector('.user_name').innerHTML = dt.data.userName;
  190. document.querySelector('.wechat_name').innerHTML = dt.data.nickName;
  191. var shareOpenid = dt.data.shareOpenid;
  192. var link = "https:" + domanUrl + base_path + "/drp/share2WM?shareOpenid=" + shareOpenid;
  193. window.repleFlag = false;
  194. window.wxFriend = {
  195. "appId": "",
  196. "imgUrl": '//s.iamberry.com/watero/images/shop/index.jpg',
  197. "link": link,
  198. "desc": "美国标准,4级净化,5档水温,废水比3:1,水质TDS智能显示。",
  199. "title": "Watero,美国高端净水专家,4级净化,5档水温,免安装饮水一体机。",
  200. "netError": "您的网络异常,请刷新重试!如多次刷新无效,请向我们反应 ~",
  201. "shareTimeSuccess": "分享成功",
  202. "shareTimeCancel": "已取消分享",
  203. "shareAppSuccess": "分享成功",
  204. "shareAppCancel": "已取消分享"
  205. };
  206. getConfig()
  207. } else {
  208. mui.confirm(dt.message, ' ', btnArray, function(e) {
  209. if(e.index == 1) {
  210. setTimeout(function() {
  211. location.href = domanUrl + base_path + "/drp/indexPage?dates=" + new Date().getTime()
  212. }, 5000)
  213. }
  214. })
  215. }
  216. }
  217. },
  218. error: function(xhr, type, errorThrown) {
  219. console.log(xhr)
  220. }
  221. })
  222. };
  223. function tixian() {
  224. window.location.href = base_path + "/drp/withdrawalsList"
  225. };
  226. function getIncomeRecord() {
  227. window.location.href = base_path + "/drp/UnIncomeOrderList2"
  228. };
  229. function xialianlist() {
  230. if(wm2) {
  231. window.location.href = base_path + "/drp/xialianUser2"
  232. } else {
  233. window.location.href = base_path + "/drp/xialianUser"
  234. }
  235. };
  236. function weiruzhang() {
  237. if(wm2) {
  238. window.location.href = base_path + "/drp/UnIncomeOrderList"
  239. } else {
  240. window.location.href = base_path + "/drp/UnIncomeOrderList2"
  241. }
  242. };
  243. function fenxiao_wm2() {
  244. window.location.href = "/watero/wechat/drp/share2WM"
  245. };
  246. function salesNumbers() {
  247. window.location.href = base_path + "/drp/salesNumbers"
  248. };