@ -1,94 +0,0 @@
|
||||
<template>
|
||||
<view class="ticket-search-result">
|
||||
<view class="header">车票查询结果</view>
|
||||
<view class="ticket-list">
|
||||
<!-- 在这里循环渲染车票列表 -->
|
||||
<view v-for="ticket in ticketList" :key="ticket.id" class="ticket" @click="buyTicket(ticket)">
|
||||
<view class="ticket-header">
|
||||
<text>{{ ticket.departure }} - {{ ticket.destination }}</text>
|
||||
<text>{{ ticket.departureTime }} - {{ ticket.arrivalTime }}</text>
|
||||
</view>
|
||||
<view class="ticket-body">
|
||||
<view class="ticket-info">
|
||||
<text>车次</text>
|
||||
<text>{{ ticket.trainNumber }}</text>
|
||||
</view>
|
||||
<view class="ticket-info">
|
||||
<text>座位类型</text>
|
||||
<text>{{ ticket.seatType }}</text>
|
||||
</view>
|
||||
<view class="ticket-info">
|
||||
<text>剩余票数</text>
|
||||
<text>{{ ticket.remainingTickets }}</text>
|
||||
</view>
|
||||
<view class="ticket-info">
|
||||
<text>价格</text>
|
||||
<text>{{ ticket.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
ticketList: [
|
||||
{ id: 1, departure: '北京', destination: '上海', departureTime: '08:00', arrivalTime: '14:00', trainNumber: 'G101', seatType: '二等座', remainingTickets: 20, price: '200元' },
|
||||
{ id: 2, departure: '北京', destination: '广州', departureTime: '09:00', arrivalTime: '18:00', trainNumber: 'G102', seatType: '一等座', remainingTickets: 10, price: '300元' },
|
||||
{ id: 3, departure: '北京', destination: '深圳', departureTime: '10:00', arrivalTime: '20:00', trainNumber: 'G103', seatType: '商务座', remainingTickets: 5, price: '400元' }
|
||||
]
|
||||
};
|
||||
},
|
||||
method:{
|
||||
buyTikect(ticket){
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/Buy-ticket'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.ticket-search-result {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ticket {
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.ticket-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.ticket-header text {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.ticket-body {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ticket-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ticket-info text {
|
||||
font-size: 16px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>火车票信息</h1>
|
||||
<ul>
|
||||
<li v-for="train in ticketInfo" :key="train.id">
|
||||
<!-- 假设 train 对象中有相应的属性来显示火车票信息 -->
|
||||
<p>{{ train.name }} - {{ train.departure }} to {{ train.destination }}</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
ticketInfo: [] // 初始化为空数组
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 从 localStorage 中获取存储的数据
|
||||
const ticketInfoString = localStorage.getItem('ticketInfo');
|
||||
|
||||
if (ticketInfoString) {
|
||||
// 解析 JSON 字符串为 JavaScript 对象
|
||||
this.ticketInfo = JSON.parse(ticketInfoString);
|
||||
} else {
|
||||
console.log('未在 localStorage 中找到火车票信息');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 这里是样式部分 */
|
||||
h1 {
|
||||
color: blue;
|
||||
}
|
||||
</style>
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,8 @@
|
||||
{
|
||||
"hash": "1d9cd2f2",
|
||||
"configHash": "8f0d262f",
|
||||
"lockfileHash": "e3b0c442",
|
||||
"browserHash": "780b15fb",
|
||||
"optimized": {},
|
||||
"chunks": {}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 275 KiB |