Files
h5-meike/pages/ticket/scenic.vue
T
xuchaoandClaude Opus 4.8 97b22650ad refactor: 列表页清理死模块 + 卡片自适应 + 飘带改字 + 悬浮钮定位
按需求四项(桌面+手机实测):
1 删除搜索栏/筛选栏/u-loadmore/两个 u-picker 及其仅供它们使用的脚本
   (地区/类型方法与数据、search 等),onReachBottom 分页保留。
2 卡片 .nr_item 左右边距改百分比(3.2%)、去掉固定宽 702rpx 改 width:auto+border-box,
   右侧信息列改 flex:1,原售价宽改 100%,使左右边距随屏宽等比变化、实测左右相等。
3 补贴价飘带"工会补贴价"改"会员补贴价"。
4 悬浮按钮固定距屏幕底部 50px、左侧 12px;因定位已写死,移除与之矛盾的拖拽逻辑,
   保留单击直达;加轻微投影与按下回弹反馈。
注:模板未使用的旧样式 .item/.r_text1/.n_text1 按约定保留未删;
   其它页面"工会补贴价/工会会员补贴价"文案本次未动(仅改飘带)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 15:37:30 +08:00

274 lines
6.0 KiB
Vue

<template>
<view>
<view class='nr_item' v-for="(item,index) in lookList" :key="index" @click="toDetail(item.id)">
<image class="nr_img" :src="item.mainPic||'https://aliyunoss.hn12301.net/sd/all_moren.png'"></image>
<view class="nr_item_r">
<text class="n_text">{{item.name||''}}</text>
<view class="nr_tags">
<text :class="index1==0?'t_text1':index1==1?'t_text':index1==2?'t_text2':'t_text3'"
v-for="(item1,index1) in ['节日福利/春游秋游','余额券','满减券']" :key="index1">{{item1}}</text>
</view>
<view class="r_text">{{item.subTypeId}}</view>
<view class="nr_origin">原售价<text
class="nr_origin_num">{{(item.price/100).toFixed(0)}}</text>元</view>
<view class="p_text">会员补贴价¥<text
class="p_num">{{(item.unitPrice/100).toFixed(0)}}</text>元</view>
</view>
</view>
<!-- xuchao: 订单悬浮按钮 -->
<gmy-float-touch :mainImg="mainImg" @menuClick="floatTouchClick"></gmy-float-touch>
</view>
</template>
<script>
// xuchao: 门票列表页(启动页/入口页)
import auth from '@/common/auth.js'
import gmyFloatTouch from "@/components/gmy-float-touch/gmy-float-touch.vue"
var that = ''
export default {
components: { gmyFloatTouch },
data() {
return {
mainImg: "../../static/logo4.png",
pageAll: 2,
isLoad: true,
lookList: [],
obj: {
"name": "",
"typeId": "",
"cityId": "",
"pageSize": 10,
"pageNum": 1,
"todayAvailable": false
}
}
},
onLoad() {
that = this
// xuchao: 未登录则(正式)跳登录页 / (开发)静默假登录
if (!auth.requireLogin('/pages/ticket/scenic')) return
this.queryTicketsPageMethod()
},
onReachBottom() {
this.queryTicketsPageMethod()
},
methods: {
queryTicketsPageMethod() {
if (this.obj.pageNum <= this.pageAll && this.isLoad) {
this.isLoad = false
this.$u.api.queryTicketsPage(this.obj).then(res => {
this.isLoad = true
this.obj.pageNum = this.obj.pageNum * 1 + 1
this.pageAll = Math.ceil(res.data.total / 10)
this.lookList = this.lookList.concat(res.data.list)
})
}
},
toDetail(e) {
uni.navigateTo({
url: 'scenicdetail?id=' + e
})
},
// xuchao: 悬浮按钮 —— 跳门票订单列表
floatTouchClick(e) {
if (e == 4) {
uni.navigateTo({
url: '/pages/ticket/orderlist'
})
}
}
}
}
</script>
<style>
page {
background: #FFEFD5;
}
</style>
<style scoped lang="less">
.nr_item {
// xuchao: 左右边距用百分比,随屏幕宽度等比变化;宽度自适应(去掉固定 702rpx)
width: auto;
box-sizing: border-box;
margin: 24rpx 3.2% 0;
display: flex;
background: #fff;
padding: 12rpx;
.nr_img {
width: 268rpx;
height: 268rpx;
flex: none;
}
.nr_item_r {
// xuchao: 右侧信息列改为弹性填充,配合卡片宽度自适应
flex: 1;
min-width: 0;
margin-left: 20rpx;
display: flex;
gap: 8rpx;
flex-direction: column;
position: relative;
.nr_tags {
display: flex;
gap: 12rpx;
flex-wrap: wrap;
}
.p_text {
position: absolute;
bottom: 0rpx;
width: 240rpx;
right: 0rpx;
height: 50rpx;
background: url('https://aliyunoss.hn12301.net/xgh/image_bj_text.png');
background-size: 100% 100%;
display: flex;
align-items: center;
color: #fff;
font-size: 16rpx;
padding-left: 18rpx;
border-radius: 4rpx;
}
.p_num {
font-size: 32rpx;
font-style: italic;
font-weight: bold;
margin-bottom: 8rpx;
}
.nr_origin {
position: absolute;
bottom: 60rpx;
right: 0rpx;
width: 100%;
text-align: right;
color: #4F4F4F;
font-size: 12rpx;
}
.nr_origin_num {
font-size: 28rpx;
text-decoration: line-through;
font-weight: bold;
}
.r_text {
width: 100%;
overflow: hidden !important;
text-overflow: ellipsis !important;
display: -webkit-box !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 20rpx;
}
.n_text {
color: #008F90;
font-weight: bolder;
overflow: hidden !important;
text-overflow: ellipsis !important;
display: -webkit-box !important;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
font-size: 32rpx;
}
.t_text {
background-color: #FDEEC3;
font-size: 18rpx;
padding: 5rpx 10rpx;
color: #D57817;
border-radius: 4rpx;
}
.t_text1 {
background-color: #FDF4ED;
font-size: 18rpx;
padding: 5rpx 10rpx;
color: #AF4744;
border-radius: 4rpx;
}
.t_text2 {
background-color: #cbebfb;
font-size: 18rpx;
padding: 5rpx 10rpx;
color: #6ba0b3;
border-radius: 4rpx;
}
.t_text3 {
background-color: #F0F1F5;
font-size: 18rpx;
padding: 5rpx 10rpx;
color: #525357;
border-radius: 4rpx;
}
}
}
// 以下为旧版遗留、当前模板未使用的样式(.item / .r_text1 / .n_text1),按约定仅提示不删
.item {
width: 702rpx;
padding: 12rpx;
border-radius: 8rpx;
background-color: #fff;
position: relative;
margin-top: 24rpx;
display: flex;
margin-left: 24rpx;
.item_name {
width: 434rpx;
line-height: normal;
color: #000;
font-size: 28rpx;
font-weight: bold;
overflow: hidden !important;
text-overflow: ellipsis !important;
display: -webkit-box !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.tag {
font-size: 20rpx;
color: #fff;
padding: 6rpx 5rpx;
background: linear-gradient(180deg, #FF9E49 0%, #ED3B1A 100%);
border-radius: 4rpx;
margin-top: 12rpx;
margin-right: 12rpx;
}
.tag1 {
font-size: 20rpx;
color: #999999;
padding: 5rpx;
border: 2rpx #999999 solid;
border-radius: 4rpx;
margin-top: 12rpx;
margin-right: 12rpx;
}
.hot_tag {
height: 36rpx;
color: #fff;
font-size: 20rpx;
position: absolute;
top: 12rpx;
left: 12rpx;
background: rgba(0, 0, 0, 0.5);
padding: 0rpx 8rpx;
border-radius: 8rpx 0rpx 8rpx 0rpx;
line-height: 36rpx;
}
}
</style>