Files
QSY-lvjuxcx/pkgExplore/room_detail/components/RoomSummary.vue
2026-06-29 09:42:53 +08:00

298 lines
6.6 KiB
Vue

<template>
<view class="summary-card">
<!-- 价格与标签区 -->
<view class="price-header tn-flex tn-flex-row-between tn-flex-col-center">
<view class="price-block tn-flex tn-flex-col-bottom">
<template v-if="hasPrice">
<text class="price-symbol">¥</text>
<text class="price-value">{{ detailData.priceValue }}</text>
<text class="price-unit">{{ t('priceUnit') }}</text>
</template>
<template v-else>
<text class="price-empty">{{ t('pricePending') }}</text>
</template>
</view>
<!-- 支付方式作为高亮小签 -->
<view class="pay-method-tag" v-if="detailData.payMethod">
<text class="tn-icon-trusty-fill tag-icon"></text>
<text>{{ displayPayMethod }}</text>
</view>
</view>
<!-- 标签列表区 -->
<view class="tags-row tn-flex tn-flex-wrap" v-if="summaryBadges && summaryBadges.length">
<view v-for="(item, index) in summaryBadges" :key="index" class="badge-item">
{{ item }}
</view>
</view>
<!-- 地址导航区 -->
<view class="address-banner" v-if="displayAddress" @click="handleAddressClick">
<view class="address-bg-decoration">
<text class="tn-icon-map decoration-icon"></text>
</view>
<view class="address-content tn-flex tn-flex-row-between tn-flex-col-center">
<view class="address-left tn-flex tn-flex-col-center">
<view class="icon-wrap tn-flex tn-flex-row-center tn-flex-col-center">
<text class="tn-icon-location-fill location-icon"></text>
</view>
<view class="address-info">
<view class="address-text tn-text-ellipsis">{{ shortAddress }}</view>
<view class="address-sub tn-flex tn-flex-col-center">
<text class="address-sub-text">{{ t('addressHint') }}</text>
<text class="tn-icon-right address-sub-icon"></text>
</view>
</view>
</view>
<view class="address-right">
<view class="nav-btn tn-flex tn-flex-row-center tn-flex-col-center">
<text class="tn-icon-navigation-fill"></text>
<text class="nav-text">{{ t('navigate') }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { localizePayMethodText } from '../../../utils/select-room-normalizers'
export default {
props: {
detailData: {
type: Object,
default: () => ({})
},
hasPrice: {
type: Boolean,
default: false
},
summaryBadges: {
type: Array,
default: () => []
},
language: {
type: String,
default: 'zh'
}
},
computed: {
displayPayMethod() {
return localizePayMethodText(this.detailData.payMethod, this.language)
},
displayAddress() {
if (this.language === 'en') {
return this.detailData.addressEnDisplay || this.detailData.addressEn || this.detailData.address || ''
}
return this.detailData.address || this.detailData.addressEn || ''
},
shortAddress() {
const addr = this.displayAddress;
if (!addr) {
return this.t('noAddress')
}
if (this.language === 'en') {
return addr
}
const short = addr.replace(/^(?:.*?省|.*?自治区)?(?:.*?市|.*?自治州)?/, '');
return short.trim() ? short : (addr || this.t('noAddress'));
}
},
methods: {
t(key) {
return this.$tm('pkgExplore.room_detail.room_detail', key)
},
handleAddressClick() {
this.$emit('open-map', this.detailData)
}
}
}
</script>
<style scoped lang="scss">
.summary-card {
background: #ffffff;
padding: 48rpx 32rpx 32rpx;
margin: 0;
position: relative;
z-index: 10;
border-bottom: 1rpx solid #F2F3F5;
}
/* 价格区域 */
.price-header {
margin-bottom: 32rpx;
}
.price-block {
align-items: baseline;
}
.price-symbol {
font-size: 32rpx;
font-weight: 800;
color: #1D2129;
margin-right: 6rpx;
margin-bottom: 8rpx;
}
.price-value {
font-size: 72rpx;
line-height: 1;
font-weight: 800;
color: #1D2129;
font-family: 'DIN Alternate', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
letter-spacing: -2rpx;
}
.price-unit {
font-size: 24rpx;
color: #86909C;
margin-left: 8rpx;
margin-bottom: 10rpx;
}
.price-empty {
font-size: 32rpx;
font-weight: 700;
color: #4E5969;
}
.pay-method-tag {
display: flex;
align-items: center;
background: linear-gradient(135deg, rgba($brand-primary, 0.1) 0%, rgba($brand-primary, 0.2) 100%);
color: $brand-primary;
padding: 10rpx 20rpx;
border-radius: 100rpx;
font-size: 24rpx;
font-weight: 700;
.tag-icon {
font-size: 28rpx;
margin-right: 6rpx;
}
}
/* 标签区 */
.tags-row {
gap: 16rpx;
margin-bottom: 32rpx;
}
.badge-item {
padding: 8rpx 16rpx;
border-radius: 8rpx;
background: #F2F3F5;
color: #4E5969;
font-size: 22rpx;
font-weight: 500;
}
/* 地址导航区 */
.address-banner {
position: relative;
background: linear-gradient(135deg, #F0F6FF 0%, #F8FAFF 100%);
border-radius: 20rpx;
padding: 28rpx 24rpx;
border: 1rpx solid rgba($brand-primary, 0.15);
box-shadow: 0 8rpx 20rpx rgba($brand-primary, 0.05);
overflow: hidden;
transition: all 0.2s;
&:active {
transform: scale(0.98);
background: linear-gradient(135deg, #E8F2FF 0%, #F0F6FF 100%);
}
}
.address-bg-decoration {
position: absolute;
right: -20rpx;
top: -20rpx;
opacity: 0.04;
pointer-events: none;
.decoration-icon {
font-size: 160rpx;
color: $brand-primary;
}
}
.address-content {
position: relative;
z-index: 2;
}
.address-left {
flex: 1;
min-width: 0;
}
.icon-wrap {
width: 68rpx;
height: 68rpx;
border-radius: 20rpx;
background: #ffffff;
box-shadow: 0 6rpx 16rpx rgba($brand-primary, 0.12);
margin-right: 20rpx;
flex-shrink: 0;
}
.location-icon {
font-size: 36rpx;
color: $brand-primary;
}
.address-info {
flex: 1;
min-width: 0;
padding-right: 20rpx;
}
.address-text {
font-size: 28rpx;
font-weight: 700;
color: #1D2129;
margin-bottom: 8rpx;
line-height: 1.4;
}
.address-sub {
font-size: 22rpx;
color: $brand-primary;
}
.address-sub-text {
margin-right: 4rpx;
}
.address-sub-icon {
font-size: 20rpx;
}
.address-right {
flex-shrink: 0;
padding-left: 10rpx;
}
.nav-btn {
height: 60rpx;
padding: 0 24rpx;
border-radius: 100rpx;
background: #ffffff;
color: $brand-primary;
font-size: 24rpx;
font-weight: 700;
box-shadow: 0 4rpx 12rpx rgba($brand-primary, 0.08);
border: 1rpx solid rgba($brand-primary, 0.2);
text.tn-icon-navigation-fill {
margin-right: 6rpx;
font-size: 26rpx;
}
}
</style>