213 lines
9.4 KiB
HTML
213 lines
9.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title></title>
|
|
<link href="../Scripts/layui-v2.4.5/css/layui.css" rel="stylesheet" />
|
|
<!--<script src="../Scripts/jquery-1.10.2.min.js"></script>-->
|
|
<script src="../Scripts/layui-v2.4.5/layui.js" charset="utf-8"></script>
|
|
<script src="../Scripts/echarts-4.8.0/dist/echarts.min.js"></script>
|
|
<script type="text/javascript">
|
|
layui.use(['table','form'], function () {
|
|
var table = layui.table;
|
|
var form = layui.form;
|
|
var $ = layui.jquery;
|
|
|
|
var data = [];
|
|
data.push({ weight: 70, rfmName: "复购", todayconunt: 0, sevenconunt: 0, fifteenconunt: 0, thirtyconunt: 0, sixtyconunt: 0 });
|
|
data.push({ weight: 60, rfmName: "升级意向", todayconunt: 0, sevenconunt: 0, fifteenconunt: 0, thirtyconunt: 0, sixtyconunt: 0 });
|
|
data.push({ weight: 50, rfmName: "购买", todayconunt: 0, sevenconunt: 0, fifteenconunt: 0, thirtyconunt: 0, sixtyconunt: 0 });
|
|
data.push({ weight: 40, rfmName: "消退", todayconunt: 0, sevenconunt: 0, fifteenconunt: 0, thirtyconunt: 0, sixtyconunt: 0 });
|
|
data.push({ weight: 30, rfmName: "意向", todayconunt: 0, sevenconunt: 0, fifteenconunt: 0, thirtyconunt: 0, sixtyconunt: 0 });
|
|
data.push({ weight: 20, rfmName: "互动", todayconunt: 0, sevenconunt: 0, fifteenconunt: 0, thirtyconunt: 0, sixtyconunt: 0 });
|
|
data.push({ weight: 10, rfmName: "一般", todayconunt: 0, sevenconunt: 0, fifteenconunt: 0, thirtyconunt: 0, sixtyconunt: 0 });
|
|
data.push({ weight: 0, rfmName: "失联", todayconunt: 0, sevenconunt: 0, fifteenconunt: 0, thirtyconunt: 0, sixtyconunt: 0 });
|
|
|
|
//var url = "http://192.168.11.141:10045/saleClus/cgi/countRfm";
|
|
$.post("http://sc.soft.dn8188.com/saleClus/cgi/countRfm", function (rsp) {
|
|
//console.log(rsp);
|
|
|
|
$.each(rsp.list.todayconunt, function (i, j) {
|
|
$.each(data, function (m, n) {
|
|
if (j.weight == n.weight) {
|
|
n.todayconunt = j.countTotal;
|
|
}
|
|
});
|
|
});
|
|
|
|
$.each(rsp.list.sevenconunt, function (i, j) {
|
|
$.each(data, function (m, n) {
|
|
if (j.weight == n.weight) {
|
|
n.sevenconunt = j.countTotal;
|
|
}
|
|
});
|
|
});
|
|
|
|
$.each(rsp.list.fifteenconunt, function (i, j) {
|
|
$.each(data, function (m, n) {
|
|
if (j.weight == n.weight) {
|
|
n.fifteenconunt = j.countTotal;
|
|
}
|
|
});
|
|
});
|
|
|
|
$.each(rsp.list.thirtyconunt, function (i, j) {
|
|
$.each(data, function (m, n) {
|
|
if (j.weight == n.weight) {
|
|
n.thirtyconunt = j.countTotal;
|
|
}
|
|
});
|
|
});
|
|
|
|
$.each(rsp.list.sixtyconunt, function (i, j) {
|
|
$.each(data, function (m, n) {
|
|
if (j.weight == n.weight) {
|
|
n.sixtyconunt = j.countTotal;
|
|
}
|
|
});
|
|
});
|
|
|
|
//console.log(data);
|
|
|
|
table.render({
|
|
elem: '#table'
|
|
, totalRow: true
|
|
, cols: [[
|
|
{ field: 'weight', title: 'ID', totalRowText: '合计' }
|
|
, { field: 'rfmName', title: '标签' }
|
|
, { field: 'todayconunt', title: '总用户数', totalRow: true }
|
|
, { field: 'sevenconunt', title: '7日前用户数', totalRow: true }
|
|
, { field: 'fifteenconunt', title: '15日前用户数', totalRow: true }
|
|
, { field: 'thirtyconunt', title: '30日前用户数', totalRow: true }
|
|
, { field: 'sixtyconunt', title: '60日前用户数', totalRow: true }
|
|
]]
|
|
, data: data
|
|
});
|
|
|
|
});
|
|
|
|
|
|
/*图表数据*/
|
|
form.on('select(type)', function (data) {
|
|
InitData(data.value);
|
|
});
|
|
|
|
function InitData(type) {
|
|
var data2 = [];
|
|
|
|
//var url = "http://192.168.11.141:10045/saleClus/cgi/countTenDayForRfm";
|
|
|
|
$.post("http://sc.soft.dn8188.com/saleClus/cgi/countTenDayForRfm", { type: type }, function (rsp) {
|
|
//console.log(rsp);
|
|
|
|
$.each(rsp.list, function (i, j) {
|
|
var d = new Date(Date.parse(i.replace(/-/g, "/")));
|
|
var colName = (d.getMonth() + 1) + "." + d.getDate();
|
|
data2.push({ countDate: colName, '复购': 0, '升级意向': 0, '购买': 0, '消退': 0, '意向': 0, '互动': 0, '一般': 0, '失联': 0 });
|
|
});
|
|
|
|
data2.sort(sortDownDate);
|
|
|
|
$.each(data2, function (m, n) {
|
|
$.each(rsp.list, function (i, j) {
|
|
//console.log(j);
|
|
$.each(j, function (x, y) {
|
|
//console.log(y);
|
|
var dd = new Date(Date.parse(y.countDate.replace(/-/g, "/")));
|
|
var ddname = (dd.getMonth() + 1) + "." + dd.getDate();
|
|
if (y.rfmName == "复购" && n.countDate == ddname) {
|
|
n["复购"] = y.countTotal;
|
|
}
|
|
if (y.rfmName == "升级意向" && n.countDate == ddname) {
|
|
n["升级意向"] = y.countTotal;
|
|
}
|
|
if (y.rfmName == "购买" && n.countDate == ddname) {
|
|
n["购买"] = y.countTotal;
|
|
}
|
|
if (y.rfmName == "消退" && n.countDate == ddname) {
|
|
n["消退"] = y.countTotal;
|
|
}
|
|
if (y.rfmName == "意向" && n.countDate == ddname) {
|
|
n["意向"] = y.countTotal;
|
|
}
|
|
if (y.rfmName == "互动" && n.countDate == ddname) {
|
|
n["互动"] = y.countTotal;
|
|
}
|
|
if (y.rfmName == "一般" && n.countDate == ddname) {
|
|
n["一般"] = y.countTotal;
|
|
}
|
|
if (y.rfmName == "失联" && n.countDate == ddname) {
|
|
n["失联"] = y.countTotal;
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
//console.log(data2);
|
|
|
|
var myChart = echarts.init(document.getElementById('main'));
|
|
|
|
option = {
|
|
legend: {},
|
|
tooltip: { trigger: 'axis' },
|
|
dataset: {
|
|
dimensions: ['countDate', '复购', '升级意向', '购买', '消退', '意向', '互动', '一般', '失联'],
|
|
source: data2
|
|
},
|
|
xAxis: { type: 'category' },
|
|
yAxis: {},
|
|
series: [
|
|
{ type: 'line', smooth: true },
|
|
{ type: 'line', smooth: true },
|
|
{ type: 'line', smooth: true },
|
|
{ type: 'line', smooth: true },
|
|
{ type: 'line', smooth: true },
|
|
{ type: 'line', smooth: true },
|
|
{ type: 'line', smooth: true },
|
|
{ type: 'line', smooth: true }
|
|
]
|
|
};
|
|
|
|
myChart.setOption(option);
|
|
|
|
});
|
|
}
|
|
|
|
InitData(1);
|
|
|
|
});
|
|
|
|
function sortDownDate(a, b) {
|
|
return Date.parse(a.countDate) - Date.parse(b.countDate);
|
|
|
|
}
|
|
|
|
function sortUpDate(a, b) {
|
|
return Date.parse(b.countDate) - Date.parse(a.countDate);
|
|
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="layui-container">
|
|
<br />
|
|
<div class="layui-form">
|
|
<div class="layui-inline">
|
|
<select id="type" name="type" lay-filter="type">
|
|
<option value="1">总用户数</option>
|
|
<option value="2">7天前用户数</option>
|
|
<option value="3">15天前用户数</option>
|
|
<option value="4">30天前用户数</option>
|
|
<option value="5">60天前的用户数</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<br />
|
|
<div id="main" style="width: 100%;height:500px;"></div>
|
|
<hr />
|
|
<br />
|
|
<table class="layui-hide" id="table"></table>
|
|
</div>
|
|
</body>
|
|
</html> |