完成飞猪火车票

This commit is contained in:
tangxinyue 2026-03-10 09:46:54 +08:00
parent b8975f5015
commit 16b3a536a4
16 changed files with 1082 additions and 18 deletions

View File

@ -187,7 +187,7 @@
}
},
{
"path": "train-tickets/fliggy-air-tickets/fliggy-air-tickets",
"path": "train-tickets/fliggy-train-tickets/fliggy-train-tickets",
"style": {
"navigationBarTitleText": "飞猪火车票",
"navigationStyle": "custom"

View File

@ -80,7 +80,7 @@ const appList = [
logo: '/static/image/other/tickets-app/fliggy-logo.png',
bgImage: '/static/image/other/tickets-app/fliggy-bg.png',
airPath: '/pages/other/air-tickets/fliggy-air-tickets/fliggy-air-tickets',
trainPath: "开发中",
trainPath: "/pages/other/train-tickets/fliggy-train-tickets/fliggy-train-tickets",
isHot: true
},
]

View File

@ -21,10 +21,14 @@
<view class="input">{{ ticketsInfo.orderInfo.orderTime }}</view>
</view>
</picker>
<view v-if="app != '12306'" class="form-item">
<view v-if="app != '12306' && app != 'fliggy'" class="form-item">
<text class="label">订单总价</text>
<input class="input" type="number" v-model="ticketsInfo.orderInfo.price" />
</view>
<view v-if="app == 'fliggy'" class="form-item">
<text class="label">已购服务</text>
<input class="input" v-model="ticketsInfo.serviceText" />
</view>
</view>
</view>
@ -103,7 +107,8 @@
<text class="label">姓名</text>
<input class="input" v-model="passenger.name" />
</view>
<picker :range="ticketType" range-key="label" @change="(e) => onTicketTypeChange(e, index)">
<picker v-if="app != 'fliggy'" :range="ticketType" range-key="label"
@change="(e) => onTicketTypeChange(e, index)">
<view class="form-item" style="border-bottom: 1rpx solid #F5F5F5;">
<text class="label">票种</text>
<view class="input">{{ passenger.type }}</view>
@ -227,7 +232,8 @@ const defaultData = {
"cashback": "25",
"startDay": "01-01",
"endDay": "01-02"
}
},
serviceText: "多人连坐 ¥10x2份"
}
//
const ticketType = [{

View File

@ -123,11 +123,13 @@
<view class="codefun-flex-row codefun-justify-between mt-7">
<view class="codefun-self-center group_12">
<text class="font_2 text_23">{{ item.idType }}</text>
<text class="font_7">5**************3</text>
<text class="font_7">{{ item.idType.includes('身份证') ?
showFristAndLastNumber(item.idNumber) : (item.idType.includes('护照') ?
stringUtil.maskPassport(item.idNumber) : item.idNumber) }}</text>
</view>
<view class="codefun-flex-row codefun-items-center">
<text class="codefun-shrink-0 font_5 text_24">硬座</text>
<text class="font_5 text_25">¥64.5</text>
<text class="codefun-shrink-0 font_5 text_24">{{ item.seatType }}</text>
<text class="font_5 text_25">¥{{ item.price }}</text>
</view>
</view>
<view class="codefun-flex-row codefun-justify-end mt-7">
@ -185,8 +187,7 @@
<view class="codefun-flex-col codefun-items-start section_8">
<text class="font_14 text_30">已购服务</text>
<view class="codefun-flex-row codefun-items-center mt-27">
<text class="codefun-shrink-0 font_6 text_31">多人连坐</text>
<text class="font_6 text_32">¥ 10x2份</text>
<text class="codefun-shrink-0 font_6 text_31">{{ ticketsInfo.serviceText }}</text>
</view>
</view>
<view class="codefun-flex-col section_9">
@ -238,7 +239,19 @@
import NavBar from '@/components/nav-bar/nav-bar.vue';
import { reactive, ref, computed, toRefs } from 'vue';
import { onShow, onPageScroll } from '@dcloudio/uni-app';
import { util } from '@/utils/common.js';
import { util, stringUtil } from '@/utils/common.js';
const buttonGroup = [{
name: "编辑车票信息",
click: () => {
goEdit()
}
}]
function goEdit() {
util.goPage(`/pages/other/train-tickets/edit/edit?app=fliggy&storageKey=${data.STORAGE_KEY}`)
}
const data = reactive({
navBar: {
bgColor: '#FCE041'
@ -269,8 +282,8 @@ const data = reactive({
"seatType": "商务座",
"carriage": "01",
"seatNo": "03C",
"idType": "外国护照KR",
"idNumber": 1236256324589623,
"idType": "身份证",
"idNumber": "1111111111111333",
"price": "2110",
"status": "已支付",
"isMe": true,
@ -281,12 +294,19 @@ const data = reactive({
"cashback": "25",
"startDay": "01-01",
"endDay": "01-02"
}
},
"serviceText": "多人连坐 ¥10x2份"
},
})
let { ticketsInfo } = toRefs(data)
onShow(() => {
const stored = uni.getStorageSync(data.STORAGE_KEY)
if (stored) {
Object.assign(data.ticketsInfo, stored)
}
})
const formatDateTime = (timeStr, dateStr) => {
if (!timeStr) return '';
const parts = timeStr.split(' ');
@ -316,12 +336,23 @@ const formatDateTime = (timeStr, dateStr) => {
return `${month}-${day} ${week}`;
}
const showFristAndLastNumber = (str) => {
if (!str) {
return '';
}
const len = str.length;
if (len <= 2) {
return str;
}
return str.slice(0, 1) + '*'.repeat(len - 2) + str.slice(-1);
}
</script>
<style>
@import '/common/global.css';
@import '/common/main.css';
</style>
<style lang="less">
<style lang="less" scoped>
.ml-5 {
margin-left: 10rpx;
}
@ -331,7 +362,7 @@ const formatDateTime = (timeStr, dateStr) => {
}
.mt-3 {
margin-top: 6rpx;
// margin-top: 6rpx;
}
.mt-15 {

File diff suppressed because it is too large Load Diff

View File

@ -122,9 +122,10 @@ page {
.section_6 {
padding: 24rpx 32rpx;
background-image: url('https://ide.code.fun/api/image?token=69aa2b4a9a40b800116f8c00&name=c0f80a6a5d1e928f0eebbb1c141f11c9.png');
background-color: #ffffff;
background-size: 100% 100%;
background-repeat: no-repeat;
border-radius: 20rpx;
.image_13 {
width: 72rpx;

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB