feat: 新增自定义单程票价、站点名称展示及中文事件类型支持
后端调整:支持单程订单使用客户端传入的自定义票价,无需通过系统自动计算 前端优化:新增中文事件类型支持,添加站点编码转中文名称功能,更新日志展示站点中文名称,自动拉取站点列表构建解析映射
This commit is contained in:
+21
-5
@@ -199,18 +199,23 @@
|
||||
const cardType = ev?.detail?.card_type || ev?.card_type || ev?.["类型"] || '储值卡';
|
||||
return `[${cardType}];余额: ${balance};时间: ${timeStr}`;
|
||||
}
|
||||
if (type === 'topup' || type === 'refill' || action === 'topup') {
|
||||
if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||
const amount = ev?.amount ?? ev?.["充值数额"] ?? 0;
|
||||
const code = ev?.station_code || ev?.["站点编号"] || '---';
|
||||
const name = ev?.station_name || ev?.["站点中文"] || ev?.["发生站"] || (typeof getStationName === 'function' && code !== '---' ? getStationName(code) : code);
|
||||
if (code !== '---' || ev?.station_name) {
|
||||
return `机器ID: ${deviceId};站点编号: ${code};站点中文: ${name};充值数额: ${amount};余额: ${balance};时间: ${timeStr}`;
|
||||
}
|
||||
return `机器ID: ${deviceId};充值数额: ${amount};余额: ${balance};时间: ${timeStr}`;
|
||||
}
|
||||
if (action === 'entry' || type === 'entry') {
|
||||
if (action === 'entry' || type === 'entry' || type === '进站') {
|
||||
const code = ev?.station_code || ev?.["站点编号"] || '---';
|
||||
const name = ev?.station_name || ev?.["站点中文"] || ev?.["发生站"] || '---';
|
||||
const name = ev?.station_name || ev?.["站点中文"] || ev?.["发生站"] || (typeof getStationName === 'function' && code !== '---' ? getStationName(code) : code);
|
||||
return `机器ID: ${deviceId};站点编号: ${code};站点中文: ${name};余额: ${balance};时间: ${timeStr}`;
|
||||
}
|
||||
if (action === 'exit' || type === 'exit') {
|
||||
if (action === 'exit' || type === 'exit' || type === '出站') {
|
||||
const code = ev?.station_code || ev?.["站点编号"] || '---';
|
||||
const name = ev?.station_name || ev?.["站点中文"] || ev?.["发生站"] || '---';
|
||||
const name = ev?.station_name || ev?.["站点中文"] || ev?.["发生站"] || (typeof getStationName === 'function' && code !== '---' ? getStationName(code) : code);
|
||||
return `机器ID: ${deviceId};站点编号: ${code};站点中文: ${name};余额: ${balance};时间: ${timeStr}`;
|
||||
}
|
||||
|
||||
@@ -355,7 +360,18 @@
|
||||
}, 240);
|
||||
});
|
||||
|
||||
let stationMap = {};
|
||||
window.getStationName = (code) => stationMap[code] || code;
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const res = await fetch('/api/public/stations');
|
||||
const list = await res.json();
|
||||
if (Array.isArray(list)) {
|
||||
list.forEach(s => { stationMap[s.code] = s.name || s.cn_name; });
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
await pingServer();
|
||||
await refreshList(false);
|
||||
if (state.cards[0]) await loadCard(state.cards[0].card_id);
|
||||
|
||||
Reference in New Issue
Block a user