/** * Created 机构订单图表 by zjy on 2023/02/10. */ // 初始化咨询记录接口参数 const serviceDefaultParams = { clubId:0,// 机构id dateType:0,// 日期类别 0日 1月 2半年 3全年 startTime:'',// 开始时间 endTime:'',// 结束时间 type:2// 统计类别 0订单 1搜索关键词 2咨询记录 3访问记录 4初始状态 } // 初始化选择时间控件 const getInfoServiceDate = function () { const startDate = getDateStr(new Date(), -365), endDate = getDateStr(new Date(), 0); $('#serviceDate').dateRangePicker({ language: 'cn', startDate: startDate, endDate: endDate, format: 'YYYY-MM-DD', showShortcuts: false, autoClose: isPC, isNowrap: false, getValue: function () { if (serviceDefaultParams.startTime && serviceDefaultParams.endTime) { return serviceDefaultParams.startTime + ' to ' + serviceDefaultParams.endTime; } else { return ''; } }, setValue: function (s, s1, s2) { serviceDefaultParams.startTime = s1; serviceDefaultParams.endTime = s2; $('#serviceTimeStart').val(s1); $('#serviceTimeEnd').val(s2); getServiceData() } }); } const getServiceData = function (dateType) { serviceDefaultParams.dateType = dateType; console.log('机构咨询记录数据接口请求',serviceDefaultParams) const data = { yAxisData:['M22', '玻尿酸', '超声刀', '面膜', '耗材', '润月雅', 'Ross', '超声跑', '拗口似','是脚手'], seriesData:[1000, 2000, 3000, 4000, 5000, 6000,7000,8000,9000,10000] } getServiceEacths(data) // $.ajax({ // url: "${ctx}/order/cmPayShop/modifyPayShopAmount", // type: "GET", // data: params, // contentType : 'application/json;charset=UTF-8', //contentType很重要 // success: function (res) { // if (res.success) { // // } else { // console.log('机构订单图表数据异常') // } // } // }); } const getServiceEacths = function (data) { // 基于准备好的dom,初始化echarts实例 const myChart = echarts.init(document.getElementById('serviceEacths')); const option = { title: { show:false }, tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, legend: { show:false, }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: { type: 'value', boundaryGap: [0, 0.01] }, yAxis: { type: 'category', data: data.yAxisData }, series: [ { type: 'bar', data: data.seriesData, itemStyle:{ color:'#36cbcb', fontSize: 14, } } ] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); window.onresize = myChart.resize;//移动适配 };