190 lines
3.5 KiB
Vue
190 lines
3.5 KiB
Vue
<template>
|
||
<view class="page" v-if="store">
|
||
<!-- 门店信息卡片 -->
|
||
<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.businessTime }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 地址行 -->
|
||
<view class="address-row">
|
||
<text class="address-text">{{ store.address }}</text>
|
||
<view class="distance-row" v-if="store.distance !== null">
|
||
<u-icon name="map" color="#999999" size="24"></u-icon>
|
||
<text class="distance-text">{{ store.distance < 1 ? Math.round(store.distance * 1000) + 'm' : Math.round(store.distance) + 'km' }}</text>
|
||
</view>
|
||
</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" v-for="(item, index) in discountList" :key="index">{{ item }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
store: null
|
||
}
|
||
},
|
||
computed: {
|
||
discountList() {
|
||
if (!this.store || !this.store.merchantDiscount) return []
|
||
return this.store.merchantDiscount.split('\n')
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
if (options.id) {
|
||
this.loadDetail(options.id)
|
||
}
|
||
},
|
||
methods: {
|
||
loadDetail(shopId) {
|
||
const loc = uni.getStorageSync('lng') && uni.getStorageSync('lat')
|
||
? { lng: uni.getStorageSync('lng'), lat: uni.getStorageSync('lat') }
|
||
: null
|
||
const params = { shopId: shopId }
|
||
if (loc) {
|
||
params.lng = loc.lng
|
||
params.lat = loc.lat
|
||
}
|
||
this.$u.api.getStoreDetail(params).then(res => {
|
||
if (res.errcode === 0 && res.data) {
|
||
this.store = res.data
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.page {
|
||
height: 100vh;
|
||
background-color: #f2f2f7;
|
||
overflow: hidden;
|
||
}
|
||
|
||
/* 门店卡片 */
|
||
.store-card {
|
||
display: flex;
|
||
background-color: #ffffff;
|
||
margin: 12px;
|
||
border-radius: 8px;
|
||
padding: 12px;
|
||
gap: 12px;
|
||
}
|
||
|
||
.store-img {
|
||
width: 100px;
|
||
height: 100px;
|
||
border-radius: 6px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.store-info {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
gap: 6px;
|
||
}
|
||
|
||
.store-name {
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
color: #1a1818;
|
||
}
|
||
|
||
.store-category {
|
||
font-size: 13px;
|
||
color: #999999;
|
||
}
|
||
|
||
.store-hours {
|
||
font-size: 13px;
|
||
color: #666666;
|
||
}
|
||
|
||
/* 地址行 */
|
||
.address-row {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
background-color: #ffffff;
|
||
padding: 12px 16px;
|
||
}
|
||
|
||
.address-text {
|
||
font-size: 13px;
|
||
color: #999999;
|
||
flex: 1;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.distance-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 2px;
|
||
flex-shrink: 0;
|
||
margin-left: 8px;
|
||
}
|
||
|
||
.distance-text {
|
||
font-size: 12px;
|
||
color: #999999;
|
||
}
|
||
|
||
/* 商户优惠 */
|
||
.discount-section {
|
||
background-color: #ffffff;
|
||
margin: 12px;
|
||
border-radius: 8px;
|
||
padding: 16px;
|
||
}
|
||
|
||
.section-title {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
margin-bottom: 16px;
|
||
}
|
||
|
||
.discount-tag-icon {
|
||
font-size: 16px;
|
||
color: #0088ff;
|
||
}
|
||
|
||
.discount-title {
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
color: #1a1818;
|
||
}
|
||
|
||
.discount-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
}
|
||
|
||
.discount-item {
|
||
font-size: 13px;
|
||
color: #666666;
|
||
line-height: 1.6;
|
||
}
|
||
</style>
|