This commit is contained in:
lcj
2026-07-15 16:53:38 +08:00
parent 073dfa5c00
commit 5cab2be283
4008 changed files with 49859 additions and 1095 deletions
+165 -136
View File
@@ -1,70 +1,75 @@
<template>
<view class="page">
<!-- 自定义导航栏 -->
<view class="nav-bar" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="nav-header">
<view class="nav-back" @click="goBack">
<text class="back-icon">&#xe600;</text>
</view>
<text class="nav-title">权益详情</text>
</view>
</view>
<!-- 门店信息卡片 -->
<view class="store-card">
<image class="store-img" :src="store.image" mode="aspectFill" />
<view class="store-info">
<text class="store-name">{{ store.name }}</text>
<text class="store-category">{{ store.category }}</text>
<text class="store-hours">营业时间:{{ store.hours }}</text>
</view>
</view>
<!-- 地址行 -->
<view class="address-row">
<text class="address-text">{{ store.address }}</text>
<view class="distance-row">
<text class="distance-icon">&#xe609;</text>
<text class="distance-text">{{ store.distance }}km</text>
</view>
</view>
<!-- 选择预约日期 -->
<view class="date-section">
<view class="section-title">
<text class="section-icon">!</text>
<text class="section-title-text">选择预约日期</text>
</view>
<view class="date-list">
<view
v-for="(item, index) in dateList"
:key="index"
class="date-card"
:class="{ active: selectedDate === index }"
@click="selectDate(index)"
>
<text class="date-weekday">{{ item.weekday }}</text>
<text class="date-day">{{ item.day }}</text>
<text class="date-stock">{{ item.stock }}</text>
<view v-if="detail">
<!-- 门店信息卡片 -->
<view class="store-card">
<image class="store-img" :src="detail.shopImage" mode="aspectFill" />
<view class="store-info">
<text class="store-name">{{ detail.shopName }}</text>
<text class="store-category">{{ detail.category }}</text>
<text class="store-hours">营业时间:{{ detail.businessTime }}</text>
</view>
</view>
<text class="date-tip">该日期无需选择场次,直接预约即可!仅可预约近 3 日内时段</text>
</view>
<!-- 商户优惠 -->
<view class="discount-section">
<view class="section-title">
<text class="discount-tag-icon">&#xe60d;</text>
<text class="discount-title">商户优惠</text>
<!-- 地址行 -->
<view class="address-row">
<text class="address-text">{{ detail.address }}</text>
<view class="distance-row" v-if="detail.distance !== null">
<u-icon name="map" color="#999999" size="24"></u-icon>
<text class="distance-text">{{ detail.distance < 1 ? Math.round(detail.distance * 1000) + 'm' : Math.round(detail.distance) + 'km' }}</text>
</view>
</view>
<view class="discount-list">
<text class="discount-item" v-for="(item, index) in store.discounts" :key="index">{{ item }}</text>
</view>
</view>
<!-- 底部预约按钮 -->
<view class="bottom-bar">
<view class="book-btn" @click="onBook">立即预约</view>
<!-- 选择预约日期 -->
<view class="date-section">
<view class="section-title">
<image src="https://aliyunoss.hn12301.net/hhrs/hhrs_xzyyrq.png" style="width: 30rpx;height: 30rpx;"></image>
<text class="section-title-text">选择预约日期</text>
</view>
<view class="date-list">
<view
v-for="(item, index) in detail.dates"
:key="index"
class="date-card"
:class="{ active: selectedDate === index, disabled: item.disabled }"
@click="!item.disabled && selectDate(index)"
>
<text class="date-weekday">{{ item.weekday }}</text>
<text class="date-day">{{ item.day }}</text>
<text class="date-stock">{{ item.stock }}</text>
</view>
</view>
<!-- 时段选择 -->
<view class="time-slot-section" v-if="detail.dates[selectedDate] && detail.dates[selectedDate].timeSlots">
<text class="section-title-text" style="margin-top:16px;">选择时段</text>
<view class="time-slot-list">
<view v-for="(slot, idx) in detail.dates[selectedDate].timeSlots" :key="slot.id"
class="time-slot-card" :class="{ active: selectedTimeSlot === idx }"
@click="selectTimeSlot(idx)">
<text class="slot-name">{{ slot.name }}</text>
<text class="slot-time">{{ slot.time }}</text>
<text class="slot-stock">{{ slot.stock }}</text>
</view>
</view>
</view>
<text class="date-tip" v-if="detail.isAppointment">仅可预约近 {{ detail.appointmentDays }} 日内时段</text>
</view>
<!-- 使用说明 -->
<view class="discount-section">
<view class="section-title">
<image src="https://aliyunoss.hn12301.net/hhrs/hhrs_qysm.png" style="width: 30rpx;height: 30rpx;"></image>
<text class="discount-title">权益说明</text>
</view>
<view class="discount-list">
<text class="discount-item">{{ detail.cardInstruction }}</text>
</view>
</view>
<!-- 底部预约按钮 -->
<view class="bottom-bar">
<view class="book-btn" @click="onBook">立即预约</view>
</view>
</view>
</view>
</template>
@@ -73,102 +78,72 @@
export default {
data() {
return {
statusBarHeight: 44,
ruleId: '',
detail: null,
selectedDate: 0,
store: {
id: 1,
name: '怀化黄岩白马风景区',
category: '景区',
hours: '08:00~12:00',
address: '怀化市鹤城区万达广场 C 区501',
distance: '1.4',
image: 'https://aliyunoss.hn12301.net/hhrs/hhrs_venue1.png',
discounts: [
'用本人 62 开头社保卡凭电子社保码,可享景区免费入园权益',
'仅限社保卡持卡人本人使用,非持卡人核销后会扣除使用次数且无法入园',
'电子社保码截图无效,需在核销时打开电子社保卡页面。电子社保卡可在云闪付-湖南社保卡,或者微信-湖南智慧人社公众号'
]
},
dateList: [
{ weekday: '明天', day: '7月14日', stock: '无限库存' },
{ weekday: '周三', day: '7月15日', stock: '无限库存' },
{ weekday: '周四', day: '7月16日', stock: '无限库存' }
]
selectedTimeSlot: null
}
},
onLoad(options) {
const sysInfo = uni.getSystemInfoSync()
this.statusBarHeight = sysInfo.statusBarHeight || 44
if (options.id) {
this.ruleId = options.id
this.loadDetail(options.id)
}
},
methods: {
goBack() {
uni.navigateBack()
},
selectDate(index) {
this.selectedDate = index
this.selectedTimeSlot = null
},
selectTimeSlot(index) {
this.selectedTimeSlot = index
},
onBook() {
if (!this.detail) return
const date = this.detail.dates[this.selectedDate]
if (date.disabled) {
uni.showToast({ title: date.reason || '该日期不可预约', icon: 'none' })
return
}
if (this.detail.isAppointment && this.detail.dates[this.selectedDate].timeSlots && this.selectedTimeSlot === null) {
uni.showToast({ title: '请选择时段', icon: 'none' })
return
}
// TODO: 调用预约接口
uni.showToast({ title: '预约成功', icon: 'success' })
},
loadDetail(id) {
// TODO: 调用接口
loadDetail(ruleId) {
const loc = uni.getStorageSync('lng') && uni.getStorageSync('lat')
? { lng: uni.getStorageSync('lng'), lat: uni.getStorageSync('lat') }
: null
const params = { ruleId: ruleId }
if (loc) {
params.lng = loc.lng
params.lat = loc.lat
}
this.$u.api.getRightsDetail(params).then(res => {
if (res.errcode === 0 && res.data) {
this.detail = res.data
const firstAvailable = res.data.dates.findIndex(d => !d.disabled)
this.selectedDate = firstAvailable >= 0 ? firstAvailable : 0
}
})
}
}
}
</script>
<style>
.page {
min-height: 100vh;
background-color: #f2f2f7;
padding-bottom: 80px;
}
.nav-bar {
background-color: #ffffff;
position: sticky;
top: 0;
z-index: 100;
}
.nav-header {
height: 44px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.nav-back {
position: absolute;
left: 14px;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.back-icon {
font-size: 20px;
color: #1a1818;
}
.nav-title {
font-size: 16px;
font-weight: 500;
color: #1a1818;
}
page {
background-color: #f2f2f7;
padding-top: 24rpx;
}
</style>
<style scoped lang="less">
/* 门店卡片 */
.store-card {
display: flex;
background-color: #ffffff;
margin: 12px;
margin:0rpx 12px 12px 12px;
border-radius: 8px;
padding: 12px;
gap: 12px;
@@ -231,11 +206,6 @@ export default {
margin-left: 8px;
}
.distance-icon {
font-size: 12px;
color: #999999;
}
.distance-text {
font-size: 12px;
color: #999999;
@@ -295,6 +265,11 @@ export default {
border-color: #0088ff;
}
.date-card.disabled {
opacity: 0.4;
pointer-events: none;
}
.date-weekday {
font-size: 12px;
color: #999999;
@@ -330,6 +305,60 @@ export default {
display: block;
}
.time-slot-section {
margin-top: 16px;
}
.time-slot-list {
display: flex;
gap: 12px;
margin-top: 12px;
}
.time-slot-card {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 8px;
border: 1px solid #e8e8e8;
border-radius: 8px;
gap: 4px;
}
.time-slot-card.active {
background-color: #0088ff;
border-color: #0088ff;
}
.slot-name {
font-size: 13px;
font-weight: 600;
color: #1a1818;
}
.time-slot-card.active .slot-name {
color: #ffffff;
}
.slot-time {
font-size: 11px;
color: #999999;
}
.time-slot-card.active .slot-time {
color: rgba(255,255,255,0.8);
}
.slot-stock {
font-size: 11px;
color: #999999;
}
.time-slot-card.active .slot-stock {
color: rgba(255,255,255,0.8);
}
/* 商户优惠 */
.discount-section {
background-color: #ffffff;