var hz_shang = dc("hz_shang"); var wm2 = false; hz_shang.style.display = 'inline-block'; var barChart = echarts.init(document.getElementById('barChart')); var types = "7Day"; var getOption = function(chartType) { var chartOption = { title: { subtext: '单位(台)' }, tooltip: { trigger: 'axis' }, grid: { x: 45, x2: 10, y: 60, y2: 25 }, toolbox: { show: false, feature: { saveAsImage: { show: true } } }, calculable: true, xAxis: [{ type: 'category', data: ['1日', '2日', '3日', '4日', '5日', '6日', '7日'] }], yAxis: [{ type: 'value' }], series: [{ name: '收入', type: 'bar', itemStyle: { normal: { color: function(params) { var colorList = ['#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc', '#55c0dc']; return colorList[params.dataIndex] } } }, label: { normal: { show: true, position: 'top' } }, data: [0, 0, 0, 0, 0, 0, 0] }] }; return chartOption }; mui.ready(function() { $.ajax(base_path+'/statistics/is_sales_man?dates=' + new Date().getTime(), { data: {}, dataType: 'json', type: 'get', timeout: 15000, xhrFields: { withCredentials: true }, crossDomain: true, success: function(dt) { if (dt.isRedirect) { location.href = dt.redirectURL; } else { if(dt.status) { var src=''; if(dt.data.sRoleId==1){ $("#yewu").show(); src=base_path + "/statistics/sales_management.html"; }else if(dt.data.sRoleId==2){ $("#guanli").show(); src=base_path + "/statistics/total_management.html"; } mui('body').on('tap', '#guanli .mui-table-view-cell', function() { mui.openWindow({url: src}); }); } } }, error: function(xhr, type, errorThrown) { //异常处理; console.log(xhr); } }); document.querySelector('.loading-bg').style.display = 'none'; barChart.setOption(getOption('bar')); fenxiao_center_data(); pulldata() }); mui.each(document.querySelectorAll('#tabbar-chart-bar .mui-control-item'), function(index, el) { el.addEventListener('tap', function() { switch(index) { case 0: types = "7Day"; pulldata(); break; case 1: types = "6Mon"; pulldata(); break; case 2: types = "Year"; pulldata(); break; default: break } }, false) }); function pulldata() { var btnArray = ['否', '是']; $.ajax(base_path + '/rebackStatic/statisInfo2?dates=' + new Date().getTime(), { data: { "openid": "230", "type": types }, dataType: 'json', type: 'post', timeout: 15000, xhrFields: { withCredentials: true }, crossDomain: true, success: function(dt) { if (dt.isRedirect) { location.href = dt.redirectURL; } else { if(dt.status) { var counts = []; var dates = []; mui(dt.data).each(function(index) { counts[index] = this.salesNumber; dates[index] = this.strDate }); barChart.setOption({ xAxis: { data: dates }, series: [{ name: '收入', data: counts }] }) } else { mui.confirm(dt.message, ' ', btnArray, function(e) { if(e.index == 1) { setTimeout(function() { location.href = domanUrl + base_path + "/drp/indexPage?dates=" + new Date().getTime() }, 5000) } }) } } }, error: function(xhr, type, errorThrown) { console.log(xhr) } }) }; function fenxiao_center_data() { var btnArray = ['否', '是']; $.ajax(base_path + '/placeInfo/showPlaceInfoCenter?dates=' + new Date().getTime(), { dataType: 'json', type: 'post', timeout: 15000, xhrFields: { withCredentials: true }, crossDomain: true, success: function(dt) { if (dt.isRedirect) { location.href = dt.redirectURL; } else { if(dt.status) { document.querySelector('.tx').innerHTML = ''; if(dt.data.wm2 == "true") { wm2 = true; document.querySelector(".fenxiao_wm2").style.display = 'inline-block'; document.querySelector(".fenxiao_share").style.display = 'inline-block' } document.querySelector('.role_name').innerHTML = dt.data.role; document.querySelector('.user_name').innerHTML = dt.data.userName; document.querySelector('.wechat_name').innerHTML = dt.data.nickName; var shareOpenid = dt.data.shareOpenid; var link = "https:" + domanUrl + base_path + "/drp/share2WM?shareOpenid=" + shareOpenid; window.repleFlag = false; window.wxFriend = { "appId": "", "imgUrl": '//s.iamberry.com/watero/images/shop/index.jpg', "link": link, "desc": "美国标准,4级净化,5档水温,废水比3:1,水质TDS智能显示。", "title": "Watero,美国高端净水专家,4级净化,5档水温,免安装饮水一体机。", "netError": "您的网络异常,请刷新重试!如多次刷新无效,请向我们反应 ~", "shareTimeSuccess": "分享成功", "shareTimeCancel": "已取消分享", "shareAppSuccess": "分享成功", "shareAppCancel": "已取消分享" }; getConfig() } else { mui.confirm(dt.message, ' ', btnArray, function(e) { if(e.index == 1) { setTimeout(function() { location.href = domanUrl + base_path + "/drp/indexPage?dates=" + new Date().getTime() }, 5000) } }) } } }, error: function(xhr, type, errorThrown) { console.log(xhr) } }) }; function tixian() { window.location.href = base_path + "/drp/withdrawalsList" }; function getIncomeRecord() { window.location.href = base_path + "/drp/UnIncomeOrderList2" }; function xialianlist() { if(wm2) { window.location.href = base_path + "/drp/xialianUser2" } else { window.location.href = base_path + "/drp/xialianUser" } }; function weiruzhang() { if(wm2) { window.location.href = base_path + "/drp/UnIncomeOrderList" } else { window.location.href = base_path + "/drp/UnIncomeOrderList2" } }; function fenxiao_wm2() { window.location.href = "/watero/wechat/drp/share2WM" }; function salesNumbers() { window.location.href = base_path + "/drp/salesNumbers" };