| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- ${Scripts.src("/zinc/chart/highcharts.js")}
- ${Scripts.src("/zinc/chart/exporting.js")}
- ${Scripts.src("/zinc/chart/highcharts-zh_CN.js")}
- <script>
- var dataMap = new Z.HashMap();
- var dataList = [];
- var orgMap = new Z.HashMap();
- var finalizeEndMap = new Z.HashMap();
- var finalizeSum =0;
- var allOrgCountMap=new Z.HashMap();
- var allCount=0;
- //倒叙方法 [].reverse();
- function getObject(json)
- {
- json = json.replace(/\r/g, '');
- json = json.replace(/\n/g, '<br/>');
- json = json.replace(/\t/g, ' ');
- var reg = /(\u0000)|(\u0001)|(\u0002)|(\u0003)|(\u0004)|(\u0005)|(\u0006)|(\u0007)|(\u000b)|(\u000e)|(\u000f)|(\u0010)|(\u0011)|(\u0012)|(\u0013)|(\u0014)|(\u0015)|(\u0016)|(\u0017)|(\u0018)|(\u0019)|(\u001a)|(\u001b)|(\u001c)|(\u001d)|(\u001e)|(\u001f)/g;
- //var reg = //g;
- return Z.J.toObject(json.replace(reg, ""));
- }
- function initData()
- {//数据初始化
- <#for item : orgAfterMap.values()>
- dataMap.put('${item.getAfterBlamer()}', getObject('${item}'));
- dataList.push(dataMap.get('${item.getAfterBlamer()}'));
- </#for>
-
- <#for item : finalizeMap.keySet()>
- finalizeEndMap.put('${item}','${finalizeMap.get(item)}');
- </#for>
-
- <#for item : allDesignOrderCountMap.keySet()>
- allOrgCountMap.put('${item}','${allDesignOrderCountMap.get(item)}');
- </#for>
-
- <#for item : orgList>
- orgMap.put('${item.getOrgId()}', getObject('${item}'));
- </#for>
-
- };
- function getOrgName(orgId)
- {//获取售后原因
- return orgMap.get(''+orgId) ? orgMap.get(''+orgId).orgName : ''+orgId;
- }
- function doBuildCharts()
- {//构建图表
-
- var allCount = 0;
- var chartDatas = [];
-
- try
- {
- Z.each(dataList, function(orgData, i){
- allCount += orgData.afterCount ? orgData.afterCount : 0;
- });
-
- Z.each(dataList, function(orgData, i){
- var ratio = 0;
- if (allCount > 0)
- {
- ratio = ((orgData.afterCount ? orgData.afterCount : 0) / allCount)*100;
- }
-
- var name = getOrgName(orgData.afterBlamer);
- chartDatas.push({name: name, y:ratio.toFixed(2)*1})
- //chartDatas.push({name:"1232331", y:200})
- });
- }
- catch(e)
- {console.error(e)}
-
- console.log(chartDatas);
- console.log(allCount);
-
-
- Highcharts.chart('container',
- {
- chart: {plotBackgroundColor: null,plotBorderWidth: null,plotShadow: false,type: 'pie'},
- title: {text: '售后组织总统计(总售后单量:'+allCount+')'},
- tooltip: {pointFormat: '{series.name}: <b>{point.percentage:.2f}%</b>'},
- plotOptions:
- {
- pie:
- {
- allowPointSelect: true,
- cursor: 'pointer',
- dataLabels:
- {
- enabled: true,
- format: '<b>{point.name}</b>: {point.percentage:.2f} %',
- style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'}
- }
- }
- },
- series:
- [{
- name: '百分比',
- colorByPoint: true,
- data:chartDatas
- }]
- });
- }
- function doBuildChartTable()
- {//构建表格统计
- var allCount = 0;
- var allLostAmount = 0;
- var allOrderAmount = 0;
- var allOrgOrdAmount = 0;
- Z.each(dataList, function(orgData, i){
- var oName = getOrgName(orgData.afterBlamer);
- allCount += orgData.afterCount ? orgData.afterCount : 0;
- allLostAmount += orgData.lostAmount ? orgData.lostAmount : 0;
- allOrderAmount += orgData.totalOrderAmount ? Z.Amounts.toYuanMustRadix(orgData.totalOrderAmount)*1 : 0;
- allOrgOrdAmount += allOrgCountMap.get(oName)==null ? 0:Z.Amounts.toYuanMustRadix(allOrgCountMap.get(oName))*1;
- });
-
- var chartTableHtml = '';
- chartTableHtml += '<table class="z-table z-bordered-line z-pd10 z-bg-white z-text-left">';
- chartTableHtml += ' <tr class="z-bg-gray">';
- chartTableHtml += ' <td width="100">售后组织</td>';
- chartTableHtml += ' <td width="80">总定稿量</td>';
- chartTableHtml += ' <td width="95">总定稿金额</td>';
- chartTableHtml += ' <td width="80">售后单量</td>';
- //chartTableHtml += ' <td width="110">售后单量占比</td>';
- chartTableHtml += ' <td width="95">售后单损失金额</td>';
- chartTableHtml += ' <td width="95">售后单金额</td>';
- chartTableHtml += ' <td width="95">售后&总定稿金额占比</td>';
- chartTableHtml += ' <td width="95">售后&总定稿量占比</td>';
- //chartTableHtml += ' <td width="*">售后损失&订单金额占比</td>';
- chartTableHtml += ' </tr>';
-
- Z.each(dataList, function(orgData, i){
- var orgName = getOrgName(orgData.afterBlamer);
- var afterCount = orgData.afterCount ? orgData.afterCount : 0;
- var totalOrderAmount = orgData.totalOrderAmount ? Z.Amounts.toYuanMustRadix(orgData.totalOrderAmount)*1 : 0;
- var lostAmount = orgData.lostAmount ? orgData.lostAmount : 0;
- var finalizeCount = finalizeEndMap.get(orgName) == null ? 0 : finalizeEndMap.get(orgName);
- var allOrgCount=allOrgCountMap.get(orgName) == null ? 0 : Z.Amounts.toYuanMustRadix(allOrgCountMap.get(orgName))*1;
- finalizeSum += parseInt(finalizeCount);
-
- chartTableHtml += ' <tr class="z-h40" bgcolor="'+(i%2 != 0 ? '#f3fdfc' : '#ffffff')+'">';
- chartTableHtml += ' <td><a href="javascript:doShowDetailList(\''+orgData.afterBlamer+'\')" class="z-text-ellipsis z-pointer" style="max-width:120px" title="'+orgName+'">'+orgName+'</a></td>';
- chartTableHtml += ' <td>'+finalizeCount+'</td>';
- chartTableHtml += ' <td>'+allOrgCount+'</td>';
- chartTableHtml += ' <td>'+afterCount+'</td>';
- //chartTableHtml += ' <td>'+(allCount == 0 ? 0 : (afterCount/allCount)*100).toFixed(2)+'%</td>';
- chartTableHtml += ' <td>'+lostAmount.toFixed(2)+'</td>';
- chartTableHtml += ' <td>'+totalOrderAmount.toFixed(2)+'</td>';
- chartTableHtml += ' <td>'+(allOrgCount == 0 ? 100 : (totalOrderAmount/allOrgCount)*100).toFixed(2)+'%</td>';
- chartTableHtml += ' <td>'+(finalizeCount == 0 ? 100 : (afterCount/finalizeCount)*100).toFixed(2)+'%</td>';
- //chartTableHtml += ' <td>'+(totalOrderAmount == 0 ? 100 : (lostAmount/totalOrderAmount)*100).toFixed(2)+'%</td>';
- chartTableHtml += ' </tr>';
- });
-
- chartTableHtml += ' <tr class="z-bold">';
- chartTableHtml += ' <td>总计</td>';
- chartTableHtml += ' <td>'+finalizeSum+'</td>';
- chartTableHtml += ' <td>'+allOrgOrdAmount.toFixed(2)+'</td>';
- chartTableHtml += ' <td>'+allCount+'</td>';
- //chartTableHtml += ' <td>100%</td>';
- chartTableHtml += ' <td>'+allLostAmount.toFixed(2)+'</td>';
- chartTableHtml += ' <td>'+allOrderAmount.toFixed(2)+'</td>';
- chartTableHtml += ' <td>'+(allOrgOrdAmount == 0 ? 100 : (allOrderAmount/allOrgOrdAmount)*100).toFixed(2)+'%</td>';
- chartTableHtml += ' <td>'+(finalizeSum == 0 ? 100 : (allCount/finalizeSum)*100).toFixed(2)+'%</td>';
- //chartTableHtml += ' <td>'+(allOrderAmount == 0 ? 0 : (allLostAmount/allOrderAmount)*100).toFixed(2)+'%</td>';
- chartTableHtml += ' </tr>';
- chartTableHtml += ' </table>';
-
- Z("#chartTable_panal").htmlc(chartTableHtml)
- }
- Z.onload(function()
- {
- //初始化数据
- initData();
-
- //构建图表
- doBuildCharts();
-
- //构建表格统计
- doBuildChartTable();
-
- });
- function getAfterStatusHtml(status)
- {//获取售后状态
- <#for item : AfterConstants.getStatusList()>
- if (''+status == ''+'${item.value()}')
- {
- var status${item_index} = "${AfterConstants.statusHtml(item.value())}";
- return status${item_index};
- }
- </#for>
-
- return '';
- }
- function doShowDetailList(orgId)
- {//显示详情列表
- var afterModule = dataMap.get(''+orgId);
- var detailList = afterModule.afterDetail ? afterModule.afterDetail : [];
- if (detailList .length == 0)
- return;
-
-
- detailList.sort(function (a, b){
- a.afterCount = Z.V.isInteger(a.afterCount) ? a.afterCount : 0;
- b.afterCount = Z.V.isInteger(b.afterCount) ? b.afterCount : 0;
-
- a.lostAmount = Z.V.isFloat(a.lostAmount) ? a.lostAmount : 0;
- b.lostAmount = Z.V.isFloat(b.lostAmount) ? b.lostAmount : 0;
-
- var result1 = a.afterCount - b.afterCount;
- var result2 = a.lostAmount - b.lostAmount;
- return result2 != 0 ? result2 : result1;
- });
- detailList.sort();
- detailList.reverse();
-
-
- var detailHtml = '';
-
- var commNorecod = '';
- commNorecod += '<tr valign="middle" class="z-h40 z-text-center z-bg-white">';
- commNorecod += ' <td colspan="20">暂无数据信息</td>';
- commNorecod += '</tr>';
- var commThead = ''
- commThead += '<tr class="z-h40 z-text-center z-bg-gray">';
- commThead += ' <td width="90">售后单号</td>';
- commThead += ' <td width="90">设计单号</td>';
- commThead += ' <td width="90">处理状态</td>';
- commThead += ' <td width="100">损失金额</td>';
- commThead += ' <td width="100">设计师</td>';
- commThead += ' <td width="100">店铺</td>';
- commThead += ' <td width="100">旺旺号</td>';
- commThead += ' <td width="*">产品</td>';
- commThead += ' <td width="90">订单金额</td>';
- commThead += ' <td width="90">售后创建时间</td>';
- commThead += ' <td width="90">联系人</td>';
- commThead += ' <td width="100">联系电话</td>';
- commThead += '</tr>';
-
- detailHtml += '<div class="z-overflow-y-auto" style="max-height:750px">';
- detailHtml += '<table class="z-table z-bordered z-bg-white z-text-center">';
- detailHtml += commThead;
-
- if (detailList.length > 0)
- {
- Z.each(detailList, function(item, i)
- {
- detailHtml += '<tr align="center" class="z-h40 z-pointer" bgcolor="'+(i%2 != 0 ? '#f3fdfc' : '#ffffff')+'"> ';
- detailHtml += ' <td>'+item.designAfsId+'</td>';
- detailHtml += ' <td>'+item.designId+'</td>';
- detailHtml += ' <td>'+getAfterStatusHtml(item.afterStatus)+'</td>';
- detailHtml += ' <td>'+(item.lossAmount ? item.lossAmount : 0).toFixed(2)+'</td>';
- detailHtml += ' <td>'+item.designer+'</td>';
- detailHtml += ' <td>'+(item.shopNick ? item.shopNick : '')+'</td>';
- detailHtml += ' <td>'+(item.buyerNick ? item.buyerNick : '')+'</td>';
- detailHtml += ' <td>'+(item.orderText ? item.orderText : '')+'</td>';
- detailHtml += ' <td>'+parseFloat((item.amount ? Z.Amounts.toYuanMustRadix(''+item.amount) : 0)).toFixed(2)+'</td>';
- detailHtml += ' <td>'+(item.afterFinishTime ? item.afterCreateTime : '')+'</td>';
- detailHtml += ' <td>'+(item.userContact ? item.userContact : '')+'</td>';
- detailHtml += ' <td>'+(item.userMobile ? item.userMobile : '')+'</td>';
- detailHtml += '</tr>';
- });
-
- detailHtml += '<tr valign="middle" class="z-h40 z-text-right z-bg-white">';
- detailHtml += ' <td colspan="15">共 <span class="z-text-red">'+detailList.length+'</span> 条数据 </td>';
- detailHtml += '</tr>';
- }
- else
- detailHtml += commNorecod;
- detailHtml += ' </table>';
- detailHtml += '</div>'
- detailHtml += '</table>';
- detailHtml += '</div>';
-
- var title ='<span class="zi-text-red zi-bold">['+getOrgName(afterModule.afterBlamer)+']</span>售后订单详情统';
- if (Z("#detailHtml").length == 0)
- Z.dialog({id:'detailDialog',title: '<span id="detailDialogTile"><span>', text: '<div id="detailHtml"></div>', width:1300, height:780, shadow:true})
- Z("#detailDialogTile").htmlc(title);
- Z("#detailHtml").htmlc(detailHtml);
- }
- </script>
- ${zhiqim_manager_breadcrumb("售后统计")}
- ${zhiqim_manager_content()}
- <#-- 导航栏 -->
- <div class="z-tabnav-main z-blue z-mg-b20">
- <nav>
- <ul>
- <li onclick="Z.Location.href('personalAfterStatistics.htm');">个人售后统计</li>
- <#if ZmrPathRule.check(request, "/designAfterStatistics.htm")><li onclick="Z.L.href('designAfterStatistics.htm')">售后订单统计</li></#if>
- <#if ZmrPathRule.check(request, "/designAfterCreateStatistics.htm")><li onclick="Z.L.href('designAfterCreateStatistics.htm')">售后创建统计</li></#if>
- <#if ZmrPathRule.check(request, "/designAfterReasonStatistics.htm")><li onclick="Z.L.href('designAfterReasonStatistics.htm')">售后原因统计</li></#if>
- <li class="z-active">售后组织统计</li>
- </ul>
- </nav>
- </div>
- <#-- 查询条件 -->
- ${zhiqim_manager_title("查询条件")}
- <form name="theForm" action="/designAfterOrgStatistics.htm">
- <table class="z-table z-bordered z-pd6">
- <tr class="z-h40 z-bg-white">
- <td>查询日期:
- <select name="year" class="z-select" data-role="z-select" data-class="z-blue">
- <#for yyyy : 2018..DateTimes.getCurrentYear()>
- <option value="${yyyy}" <#if year==yyyy>selected</#if>>${yyyy}</option>
- </#for>
- </select>
- <select name="month" class="z-select" data-role="z-select" data-class="z-blue">
- <#for mm : 1..12>
- <option value="${mm}" <#if month==mm>selected</#if>>${mm}</option>
- </#for>
- </select>
- <button type="button" class="z-mg-l10 z-button ${zmr_color_class}" onclick="Z.loading({shadow: true});this.form.submit();">查询</button>
- </td>
- </tr>
- </table>
- </form>
- <br>
- <#-- 分页列表-->
- <table class="z-table z-bordered z-pd6 z-bg-white">
- <tr>
- <td width="40%"><div id="container" class="z-bg-white" style="min-width:400px;height:600px"></div></td>
- <td width="*" valign="top">
- <div id="chartTable_panal" class="z-overflow-y-auto" style="max-height:750px">
- <table class="z-table z-bordered-line z-pd10 z-bg-white z-text-left">
- <tr class="z-bg-gray">
- <td width="100">售后组织</td>
- <td width="80">总定稿量</td>
- <td width="95">总定稿金额</td>
- <td width="80">售后单量</td>
- <!--<td width="110">售后单量占比</td> -->
- <td width="95">售后单损失金额</td>
- <td width="95">售后单金额</td>
- <td width="95">售后&总定稿金额占比</td>
- <td width="95">售后&总定稿量占比</td>
- <!--<td width="*">售后损失&订单金额占比</td>-->
- </tr>
- <tr class="z-bold">
- <td>总计</td>
- <td>0</td>
- <td>0</td>
- <td>0</td>
- <td>0</td>
- <td>0</td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- ${zhiqim_manager_content_end()}
|