| | |
| | | <script src="${ctxPath}/modular/system/dataStatistics/echarts.min.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/switchery/switchery.js"></script> |
| | | <script> |
| | | // 仅格式化前端展示,接口返回的原始数值不作改动。 |
| | | function formatStatisticNumber(value) { |
| | | var number = Number(value); |
| | | return isFinite(number) ? number.toFixed(2) : '0.00'; |
| | | } |
| | | laydate.render({ |
| | | elem: '#beginTime' |
| | | , trigger: 'click' |
| | |
| | | var time = $("#beginTime").val(); |
| | | // 营收卡片与收入类型卡片使用同一接口、同一时间范围,避免筛选后口径不一致。 |
| | | var incomeAjax = new $ax(Feng.ctxPath + "/data/getIncomeData", function(resp){ |
| | | $("#totalIncome").text(resp.incomeStatistics.totalIncomeAmount || 0); |
| | | $("#netIncomeAmount").text(resp.incomeStatistics.netIncomeAmount || 0); |
| | | $("#couponDeductionAmount").text(resp.incomeStatistics.couponDeductionAmount || 0); |
| | | $("#refundAmount").text(resp.incomeStatistics.refundAmount || 0); |
| | | $("#totalIncome").text(formatStatisticNumber(resp.incomeStatistics.totalIncomeAmount)); |
| | | $("#netIncomeAmount").text(formatStatisticNumber(resp.incomeStatistics.netIncomeAmount)); |
| | | $("#couponDeductionAmount").text(formatStatisticNumber(resp.incomeStatistics.couponDeductionAmount)); |
| | | $("#refundAmount").text(formatStatisticNumber(resp.incomeStatistics.refundAmount)); |
| | | var incomeTypeNet = resp.incomeTypeNet || {}; |
| | | $("#fee1").text(incomeTypeNet[1] || 0); |
| | | $("#fee2").text(incomeTypeNet[2] || 0); |
| | | $("#fee3").text(incomeTypeNet[3] || 0); |
| | | $("#fee4").text(incomeTypeNet[4] || 0); |
| | | $("#fee5").text(incomeTypeNet[5] || 0); |
| | | $("#fee7").text(incomeTypeNet[6] || 0); |
| | | $("#fee1").text(formatStatisticNumber(incomeTypeNet[1])); |
| | | $("#fee2").text(formatStatisticNumber(incomeTypeNet[2])); |
| | | $("#fee3").text(formatStatisticNumber(incomeTypeNet[3])); |
| | | $("#fee4").text(formatStatisticNumber(incomeTypeNet[4])); |
| | | $("#fee5").text(formatStatisticNumber(incomeTypeNet[5])); |
| | | $("#fee7").text(formatStatisticNumber(incomeTypeNet[6])); |
| | | renderTicketIncomeChart(resp.ticketIncome || {}); |
| | | }); |
| | | incomeAjax.set("time", time); |
| | |
| | | |
| | | function renderIncomeStatistics(elementId, periodName, statistics) { |
| | | document.getElementById(elementId).innerText = periodName + "统计:总营收金额 " |
| | | + statistics.totalIncomeAmount + ",净收入金额 " + statistics.netIncomeAmount |
| | | + ",优惠券抵扣金额 " + statistics.couponDeductionAmount + ",退款金额 " |
| | | + statistics.refundAmount; |
| | | + formatStatisticNumber(statistics.totalIncomeAmount) + ",净收入金额 " + formatStatisticNumber(statistics.netIncomeAmount) |
| | | + ",优惠券抵扣金额 " + formatStatisticNumber(statistics.couponDeductionAmount) + ",退款金额 " |
| | | + formatStatisticNumber(statistics.refundAmount); |
| | | } |
| | | |
| | | function renderIncomeStatisticsList(elementId, title, labels, statistics) { |
| | | var records = labels.map(function (label, index) { |
| | | var item = statistics[index]; |
| | | return '<div class="income-period-record"><strong>' + label + '</strong>:总营收金额 ' |
| | | + item.totalIncomeAmount + ',净收入金额 ' + item.netIncomeAmount |
| | | + ',优惠券抵扣金额 ' + item.couponDeductionAmount |
| | | + ',退款金额 ' + item.refundAmount + '</div>'; |
| | | + formatStatisticNumber(item.totalIncomeAmount) + ',净收入金额 ' + formatStatisticNumber(item.netIncomeAmount) |
| | | + ',优惠券抵扣金额 ' + formatStatisticNumber(item.couponDeductionAmount) |
| | | + ',退款金额 ' + formatStatisticNumber(item.refundAmount) + '</div>'; |
| | | }).join(''); |
| | | document.getElementById(elementId).innerHTML = '<div class="income-period-title">' + title |
| | | + '</div><div class="income-period-records">' + records + '</div>'; |
| | |
| | | formatter: function (params) { |
| | | var item = params[0]; |
| | | var detail = statistics[item.dataIndex]; |
| | | return labels[item.dataIndex] + '<br/>总营收:' + detail.totalIncomeAmount |
| | | + '<br/>净收入:' + detail.netIncomeAmount |
| | | + '<br/>优惠券抵扣:' + detail.couponDeductionAmount |
| | | + '<br/>退款:' + detail.refundAmount; |
| | | return labels[item.dataIndex] + '<br/>总营收:' + formatStatisticNumber(detail.totalIncomeAmount) |
| | | + '<br/>净收入:' + formatStatisticNumber(detail.netIncomeAmount) |
| | | + '<br/>优惠券抵扣:' + formatStatisticNumber(detail.couponDeductionAmount) |
| | | + '<br/>退款:' + formatStatisticNumber(detail.refundAmount); |
| | | } |
| | | }, |
| | | grid: {left: '5%', right: '4%', bottom: '18%', containLabel: true}, |
| | |
| | | var netIncomeAmount = document.getElementById("netIncomeAmount"); |
| | | var couponDeductionAmount = document.getElementById("couponDeductionAmount"); |
| | | var refundAmount = document.getElementById("refundAmount"); |
| | | t1.innerText = list[0] || 0; |
| | | netIncomeAmount.innerText = resp.incomeStatistics.netIncomeAmount || 0; |
| | | couponDeductionAmount.innerText = resp.incomeStatistics.couponDeductionAmount || 0; |
| | | refundAmount.innerText = resp.incomeStatistics.refundAmount || 0; |
| | | t1.innerText = formatStatisticNumber(list[0]); |
| | | netIncomeAmount.innerText = formatStatisticNumber(resp.incomeStatistics.netIncomeAmount); |
| | | couponDeductionAmount.innerText = formatStatisticNumber(resp.incomeStatistics.couponDeductionAmount); |
| | | refundAmount.innerText = formatStatisticNumber(resp.incomeStatistics.refundAmount); |
| | | renderIncomeStatisticsList("yearIncomeStatistics", "历年营收明细", resp.yearLabels, resp.yearIncomeStatistics); |
| | | renderIncomeStatisticsList("monthIncomeStatistics", "本年各月营收明细", resp.monthLabels, resp.monthIncomeStatistics); |
| | | renderIncomeStatisticsList("weekIncomeStatistics", "近四周营收明细", resp.weekLabels, resp.weekIncomeStatistics); |
| | |
| | | renderIncomeTrendChart("incomeMonthChart", "本年各月营收趋势", resp.monthLabels, resp.monthIncomeStatistics); |
| | | renderIncomeTrendChart("incomeWeekChart", "近四周营收趋势", resp.weekLabels, resp.weekIncomeStatistics); |
| | | renderIncomeTrendChart("incomeDayChart", "近七日营收趋势", resp.dayLabels, resp.dayIncomeStatistics); |
| | | $("#back1").text(resp.yearIncomeStatistics[resp.yearIncomeStatistics.length - 1].refundAmount || 0); |
| | | $("#back2").text(resp.monthIncomeStatistics[new Date().getMonth()].refundAmount || 0); |
| | | $("#back3").text(resp.weekIncomeStatistics[resp.weekIncomeStatistics.length - 1].refundAmount || 0); |
| | | $("#back4").text(resp.dayIncomeStatistics[resp.dayIncomeStatistics.length - 1].refundAmount || 0); |
| | | $("#back1").text(formatStatisticNumber(resp.yearIncomeStatistics[resp.yearIncomeStatistics.length - 1].refundAmount)); |
| | | $("#back2").text(formatStatisticNumber(resp.monthIncomeStatistics[new Date().getMonth()].refundAmount)); |
| | | $("#back3").text(formatStatisticNumber(resp.weekIncomeStatistics[resp.weekIncomeStatistics.length - 1].refundAmount)); |
| | | $("#back4").text(formatStatisticNumber(resp.dayIncomeStatistics[resp.dayIncomeStatistics.length - 1].refundAmount)); |
| | | renderRefundChart(myChart1, resp); |
| | | }); |
| | | ajax.set("type",1); |