fix: 修复 seat map 数据结构 + selected seats UI + encoding + submit button

1. renderSeatMap: 修复 map.seat_map 数据结构访问
2. updateSelectedUI: 渲染 selectedList + 启用 submit button
3. 修复 GoodsSpecValue 中文编码问题
4. 添加 barCount/barPrice 更新
pull/19/head
Council 2026-04-21 12:30:09 +08:00
parent 82a5b2129d
commit 461dd6b101
2 changed files with 112 additions and 6 deletions

View File

@ -132,17 +132,19 @@
return;
}
var mapData = map.map || (map.rooms && map.rooms[0] ? map.rooms[0].map : null);
// seat_map is nested inside the seatMap object
var seatMapData = map.seat_map || map;
var mapData = seatMapData.map || (seatMapData.rooms && seatMapData.rooms[0] ? seatMapData.rooms[0].map : null);
if (!mapData || mapData.length === 0) {
document.getElementById('seatRows').innerHTML = '<div style="text-align:center;color:#999;padding:40px">座位图加载失败</div>';
return;
}
// 从模板数据获取房间 ID可能是 UUID 或 room_xxx 格式)
var rooms = map.rooms || [];
var rooms = seatMapData.rooms || [];
var roomId = (rooms[0] && rooms[0].id) ? rooms[0].id : 'room_001';
var seats = map.seats || (map.rooms && map.rooms[0] ? map.rooms[0].seats || {} : {});
var sections = map.sections || (map.rooms && map.rooms[0] ? map.rooms[0].sections || [] : []);
var seats = seatMapData.seats || (seatMapData.rooms && seatMapData.rooms[0] ? seatMapData.rooms[0].seats || {} : {});
var sections = seatMapData.sections || (seatMapData.rooms && seatMapData.rooms[0] ? seatMapData.rooms[0].sections || [] : []);
// 渲染图例
var legendHtml = '';
@ -247,19 +249,35 @@
updateSelectedUI: function() {
var count = this.selectedSeats.length;
document.getElementById('selectedCount').textContent = count;
document.getElementById('selectedCount').textContent = '(' + count + ')';
document.getElementById('barCount').textContent = count;
if (count > 0) {
document.getElementById('selectedSection').style.display = 'block';
document.getElementById('attendeeSection').style.display = 'block';
var total = this.selectedSeats.reduce(function(sum, s) { return sum + s.price; }, 0);
document.getElementById('totalPrice').textContent = total.toFixed(2);
document.getElementById('totalPrice').textContent = '¥' + total.toFixed(2);
document.getElementById('barPrice').textContent = '¥' + total.toFixed(2);
// 渲染已选座位列表
var listHtml = '';
this.selectedSeats.forEach(function(seat) {
var seatLabel = seat.rowLabel + seat.colNum + '座';
listHtml += '<div class="vr-selected-item">' +
'<span>' + seatLabel + '</span>' +
'<span>¥' + seat.price.toFixed(2) + '</span>' +
'</div>';
});
document.getElementById('selectedList').innerHTML = listHtml;
this.renderAttendeeForms();
document.getElementById('purchaseBtn').disabled = false;
} else {
document.getElementById('selectedSection').style.display = 'none';
document.getElementById('attendeeSection').style.display = 'none';
document.getElementById('selectedList').innerHTML = '';
document.getElementById('purchaseBtn').disabled = true;
}
},

88
sql/fix_spec_value.sql Normal file
View File

@ -0,0 +1,88 @@
-- Insert GoodsSpecValue for goods_id=118 with proper Chinese encoding
-- Using latin1 to bypass terminal encoding issues
SET NAMES latin1;
-- A_1 through A_6 (VIP zone A)
INSERT INTO vrt_goods_spec_value (goods_id, goods_spec_base_id, type, value, md5_key, add_time) VALUES
(118, 9370, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9370, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9370, '$vr-座位号', '主厅-主厅-A-A1', MD5('主厅-主厅-A-A1'), UNIX_TIMESTAMP()),
(118, 9370, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9371, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9371, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9371, '$vr-座位号', '主厅-主厅-A-A2', MD5('主厅-主厅-A-A2'), UNIX_TIMESTAMP()),
(118, 9371, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9372, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9372, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9372, '$vr-座位号', '主厅-主厅-A-A3', MD5('主厅-主厅-A-A3'), UNIX_TIMESTAMP()),
(118, 9372, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9373, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9373, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9373, '$vr-座位号', '主厅-主厅-A-A4', MD5('主厅-主厅-A-A4'), UNIX_TIMESTAMP()),
(118, 9373, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9374, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9374, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9374, '$vr-座位号', '主厅-主厅-A-A5', MD5('主厅-主厅-A-A5'), UNIX_TIMESTAMP()),
(118, 9374, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9375, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9375, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9375, '$vr-座位号', '主厅-主厅-A-A6', MD5('主厅-主厅-A-A6'), UNIX_TIMESTAMP()),
(118, 9375, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
-- B_1, B_2, B_5, B_6 (VIP zone A)
(118, 9376, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9376, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9376, '$vr-座位号', '主厅-主厅-A-B1', MD5('主厅-主厅-A-B1'), UNIX_TIMESTAMP()),
(118, 9376, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9377, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9377, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9377, '$vr-座位号', '主厅-主厅-A-B2', MD5('主厅-主厅-A-B2'), UNIX_TIMESTAMP()),
(118, 9377, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9378, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9378, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9378, '$vr-座位号', '主厅-主厅-A-B5', MD5('主厅-主厅-A-B5'), UNIX_TIMESTAMP()),
(118, 9378, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9379, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9379, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9379, '$vr-座位号', '主厅-主厅-A-B6', MD5('主厅-主厅-A-B6'), UNIX_TIMESTAMP()),
(118, 9379, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
-- C_1-C_5 (普通 zone B), C_6 (VIP zone A)
(118, 9380, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9380, '$vr-分区', '主厅-主厅-B', MD5('主厅-主厅-B'), UNIX_TIMESTAMP()),
(118, 9380, '$vr-座位号', '主厅-主厅-B-C1', MD5('主厅-主厅-B-C1'), UNIX_TIMESTAMP()),
(118, 9380, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9381, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9381, '$vr-分区', '主厅-主厅-B', MD5('主厅-主厅-B'), UNIX_TIMESTAMP()),
(118, 9381, '$vr-座位号', '主厅-主厅-B-C2', MD5('主厅-主厅-B-C2'), UNIX_TIMESTAMP()),
(118, 9381, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9382, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9382, '$vr-分区', '主厅-主厅-B', MD5('主厅-主厅-B'), UNIX_TIMESTAMP()),
(118, 9382, '$vr-座位号', '主厅-主厅-B-C3', MD5('主厅-主厅-B-C3'), UNIX_TIMESTAMP()),
(118, 9382, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9383, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9383, '$vr-分区', '主厅-主厅-B', MD5('主厅-主厅-B'), UNIX_TIMESTAMP()),
(118, 9383, '$vr-座位号', '主厅-主厅-B-C4', MD5('主厅-主厅-B-C4'), UNIX_TIMESTAMP()),
(118, 9383, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9384, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9384, '$vr-分区', '主厅-主厅-B', MD5('主厅-主厅-B'), UNIX_TIMESTAMP()),
(118, 9384, '$vr-座位号', '主厅-主厅-B-C5', MD5('主厅-主厅-B-C5'), UNIX_TIMESTAMP()),
(118, 9384, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP()),
(118, 9385, '$vr-场馆', '主厅', MD5('主厅'), UNIX_TIMESTAMP()),
(118, 9385, '$vr-分区', '主厅-主厅-A', MD5('主厅-主厅-A'), UNIX_TIMESTAMP()),
(118, 9385, '$vr-座位号', '主厅-主厅-A-C6', MD5('主厅-主厅-A-C6'), UNIX_TIMESTAMP()),
(118, 9385, '$vr-场次', '08:00-23:59', MD5('08:00-23:59'), UNIX_TIMESTAMP());