- 新增 invoice_title、showcase、wallet_log 模型及对应语言包 - 新增后台控制器、视图及搜索字段配置 - 修复服务类目删除保护逻辑 - 优化后台登录页面文案及样式 - 新增前端角色切换逻辑及页面拦截 - 新增 SVG 图标及样式变量 - 修复接口权限及下拉框默认值问题
229 行
9.0 KiB
JavaScript
229 行
9.0 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme'], function ($, undefined, Backend, Datatable, Table, Echarts) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 1. 初始化近 7 天家居售后订单与资金流水复合双轴图表 (奇兵到家橙白旗舰配色)
|
|
var trendDom = document.getElementById('home-chart-trend');
|
|
if (trendDom) {
|
|
var trendChart = Echarts.init(trendDom, 'walden');
|
|
var trendOption = {
|
|
tooltip: {
|
|
trigger: 'axis',
|
|
backgroundColor: 'rgba(15, 23, 42, 0.92)',
|
|
borderColor: '#ff6a00',
|
|
borderWidth: 1,
|
|
padding: [10, 14],
|
|
textStyle: {
|
|
color: '#ffffff',
|
|
fontSize: 12
|
|
},
|
|
axisPointer: {
|
|
type: 'cross',
|
|
crossStyle: {
|
|
color: '#fdba74'
|
|
}
|
|
}
|
|
},
|
|
legend: {
|
|
data: ['服务订单量 (单)', 'GMV 资金流水 (元)'],
|
|
top: 0,
|
|
left: 'center',
|
|
itemGap: 24,
|
|
textStyle: {
|
|
color: '#475569',
|
|
fontWeight: 500
|
|
}
|
|
},
|
|
grid: {
|
|
left: '2%',
|
|
right: '3%',
|
|
bottom: '3%',
|
|
top: '18%',
|
|
containLabel: true
|
|
},
|
|
xAxis: [{
|
|
type: 'category',
|
|
data: Config.dateColumns || [],
|
|
axisPointer: {
|
|
type: 'shadow'
|
|
},
|
|
axisLine: {
|
|
lineStyle: {
|
|
color: '#e2e8f0'
|
|
}
|
|
},
|
|
axisLabel: {
|
|
color: '#64748b',
|
|
fontSize: 12
|
|
}
|
|
}],
|
|
yAxis: [
|
|
{
|
|
type: 'value',
|
|
name: '订单量 (单)',
|
|
minInterval: 1,
|
|
splitLine: {
|
|
lineStyle: {
|
|
type: 'dashed',
|
|
color: '#f8fafc'
|
|
}
|
|
},
|
|
axisLabel: {
|
|
color: '#64748b'
|
|
}
|
|
},
|
|
{
|
|
type: 'value',
|
|
name: 'GMV (元)',
|
|
splitLine: {
|
|
show: false
|
|
},
|
|
axisLabel: {
|
|
color: '#ff6a00',
|
|
formatter: '¥{value}'
|
|
}
|
|
}
|
|
],
|
|
series: [
|
|
{
|
|
name: '服务订单量 (单)',
|
|
type: 'bar',
|
|
barMaxWidth: 24,
|
|
itemStyle: {
|
|
barBorderRadius: [6, 6, 0, 0],
|
|
color: new Echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
{ offset: 0, color: '#ff9800' },
|
|
{ offset: 1, color: '#ff6a00' }
|
|
]),
|
|
shadowColor: 'rgba(255, 106, 0, 0.25)',
|
|
shadowBlur: 6
|
|
},
|
|
data: Config.orderCounts || []
|
|
},
|
|
{
|
|
name: 'GMV 资金流水 (元)',
|
|
type: 'line',
|
|
yAxisIndex: 1,
|
|
smooth: true,
|
|
showSymbol: true,
|
|
symbolSize: 7,
|
|
itemStyle: {
|
|
color: '#ea580c',
|
|
borderColor: '#ffffff',
|
|
borderWidth: 2
|
|
},
|
|
lineStyle: {
|
|
width: 3,
|
|
color: '#ea580c'
|
|
},
|
|
areaStyle: {
|
|
color: new Echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
{ offset: 0, color: 'rgba(255, 106, 0, 0.32)' },
|
|
{ offset: 1, color: 'rgba(255, 106, 0, 0.02)' }
|
|
])
|
|
},
|
|
data: Config.orderAmounts || []
|
|
}
|
|
]
|
|
};
|
|
trendChart.setOption(trendOption);
|
|
}
|
|
|
|
// 2. 初始化订单生命周期环形甜甜圈图 (奇兵到家活力色系)
|
|
var pieDom = document.getElementById('home-chart-pie');
|
|
if (pieDom) {
|
|
var pieChart = Echarts.init(pieDom, 'walden');
|
|
|
|
var colorPalette = {
|
|
'已完成': '#10b981',
|
|
'待接单': '#ff6a00',
|
|
'已接单': '#0284c7',
|
|
'待上门': '#3b82f6',
|
|
'已到达': '#6366f1',
|
|
'服务中': '#0ea5e9',
|
|
'待验收': '#f59e0b',
|
|
'待支付': '#94a3b8',
|
|
'报价中': '#d97706',
|
|
'已取消': '#cbd5e1',
|
|
'售后中': '#dc2626'
|
|
};
|
|
|
|
var statusList = Config.statusChartData || [];
|
|
var pieData = statusList.map(function (item) {
|
|
return {
|
|
name: item.name,
|
|
value: item.value,
|
|
itemStyle: {
|
|
color: colorPalette[item.name] || undefined
|
|
}
|
|
};
|
|
});
|
|
|
|
var pieOption = {
|
|
tooltip: {
|
|
trigger: 'item',
|
|
formatter: '{b}: {c} 单 ({d}%)'
|
|
},
|
|
legend: {
|
|
orient: 'horizontal',
|
|
bottom: '0',
|
|
left: 'center',
|
|
textStyle: {
|
|
color: '#64748b',
|
|
fontSize: 12
|
|
},
|
|
itemWidth: 10,
|
|
itemHeight: 10
|
|
},
|
|
series: [
|
|
{
|
|
name: '订单履约状态',
|
|
type: 'pie',
|
|
radius: ['45%', '70%'],
|
|
center: ['50%', '45%'],
|
|
avoidLabelOverlap: false,
|
|
itemStyle: {
|
|
borderRadius: 8,
|
|
borderColor: '#fff',
|
|
borderWidth: 2
|
|
},
|
|
label: {
|
|
show: false,
|
|
position: 'center'
|
|
},
|
|
emphasis: {
|
|
label: {
|
|
show: true,
|
|
fontSize: 16,
|
|
fontWeight: 'bold',
|
|
formatter: '{b}\n{c} 单'
|
|
}
|
|
},
|
|
labelLine: {
|
|
show: false
|
|
},
|
|
data: pieData
|
|
}
|
|
]
|
|
};
|
|
pieChart.setOption(pieOption);
|
|
}
|
|
|
|
// 3. 视口与刷新联动
|
|
$(window).resize(function () {
|
|
if (trendChart) trendChart.resize();
|
|
if (pieChart) pieChart.resize();
|
|
});
|
|
|
|
$(document).on("click", ".btn-refresh", function () {
|
|
setTimeout(function () {
|
|
if (trendChart) trendChart.resize();
|
|
if (pieChart) pieChart.resize();
|
|
}, 100);
|
|
});
|
|
}
|
|
};
|
|
|
|
return Controller;
|
|
});
|